blob: b9f6e84c2b15552d6a33ab215f932f967b2c45d6 [file] [log] [blame]
Paolo Bonzinia5665052019-06-10 12:05:14 +02001project('qemu', ['c'], meson_version: '>=0.55.0',
Gerd Hoffmann90756b22020-08-25 08:43:42 +02002 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
Paolo Bonzini3e0e5192020-09-01 12:48:00 -04003 'b_colorout=auto'],
Paolo Bonzinia5665052019-06-10 12:05:14 +02004 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
Paolo Bonzinib29b40f2020-08-10 18:04:43 +02007if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040012ss = import('sourceset')
Richard Henderson8b18cdb2020-09-13 12:19:25 -070013fs = import('fs')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040014
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010015sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040016cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020017config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040018enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010019enable_static = 'CONFIG_STATIC' in config_host
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +020020build_docs = 'BUILD_DOCS' in config_host
Marc-André Lureau8fe11232020-09-11 14:42:48 +020021
22if get_option('qemu_suffix').startswith('/')
23 error('qemu_suffix cannot start with a /')
24endif
25
Marc-André Lureauab4c0992020-08-26 15:04:16 +040026qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040027qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020028config_host_data = configuration_data()
29genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020030
Paolo Bonzini760e4322020-08-26 08:09:48 +020031target_dirs = config_host['TARGET_DIRS'].split()
32have_user = false
33have_system = false
34foreach target : target_dirs
35 have_user = have_user or target.endswith('-user')
36 have_system = have_system or target.endswith('-softmmu')
37endforeach
38have_tools = 'CONFIG_TOOLS' in config_host
39have_block = have_system or have_tools
40
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040041python = import('python').find_installation()
42
43supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
44supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
45 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
46
47cpu = host_machine.cpu_family()
48targetos = host_machine.system()
49
50configure_file(input: files('scripts/ninjatool.py'),
51 output: 'ninjatool',
52 configuration: config_host)
53
54##################
55# Compiler flags #
56##################
57
Alexander Bulekovff9ed622020-09-09 18:05:16 -040058# Specify linker-script with add_project_link_arguments so that it is not placed
59# within a linker --start-group/--end-group pair
60if 'CONFIG_FUZZ' in config_host
61 add_project_link_arguments(['-Wl,-T,',
62 (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
63 native: false, language: ['c', 'cpp', 'objc'])
64endif
65
Paolo Bonzinia5665052019-06-10 12:05:14 +020066add_project_arguments(config_host['QEMU_CFLAGS'].split(),
67 native: false, language: ['c', 'objc'])
68add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
69 native: false, language: 'cpp')
70add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
71 native: false, language: ['c', 'cpp', 'objc'])
72add_project_arguments(config_host['QEMU_INCLUDES'].split(),
73 language: ['c', 'cpp', 'objc'])
74
Alexander Bulekovc46f76d2020-09-02 13:36:50 -040075
Marc-André Lureaufc929892019-07-13 01:47:54 +040076link_language = meson.get_external_property('link_language', 'cpp')
77if link_language == 'cpp'
78 add_languages('cpp', required: true, native: false)
79endif
Paolo Bonzinia5665052019-06-10 12:05:14 +020080if host_machine.system() == 'darwin'
81 add_languages('objc', required: false, native: false)
82endif
83
Paolo Bonzini968b4db2020-02-03 14:45:33 +010084if 'SPARSE_CFLAGS' in config_host
85 run_target('sparse',
86 command: [find_program('scripts/check_sparse.py'),
87 config_host['SPARSE_CFLAGS'].split(),
88 'compile_commands.json'])
89endif
90
Paolo Bonzini6ec0e152020-09-16 18:07:29 +020091###########################################
92# Target-specific checks and dependencies #
93###########################################
94
95if targetos != 'linux' and get_option('mpath').enabled()
96 error('Multipath is supported only on Linux')
97endif
98
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040099m = cc.find_library('m', required: false)
100util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200101winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400102socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400103version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400104coref = []
105iokit = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400106cocoa = not_found
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400107hvf = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400108if targetos == 'windows'
109 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200110 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400111
112 win = import('windows')
113 version_res = win.compile_resources('version.rc',
114 depend_files: files('pc-bios/qemu-nsis.ico'),
115 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400116elif targetos == 'darwin'
117 coref = dependency('appleframeworks', modules: 'CoreFoundation')
118 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400119 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400120 hvf = dependency('appleframeworks', modules: 'Hypervisor')
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200121elif targetos == 'sunos'
122 socket = [cc.find_library('socket'),
123 cc.find_library('nsl'),
124 cc.find_library('resolv')]
125elif targetos == 'haiku'
126 socket = [cc.find_library('posix_error_mapper'),
127 cc.find_library('network'),
128 cc.find_library('bsd')]
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400129endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200130
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400131if not cocoa.found() and get_option('cocoa').enabled()
132 error('Cocoa not available on this platform')
133endif
134
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200135################
136# Dependencies #
137################
138
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400139# The path to glib.h is added to all compilation commands. This was
140# grandfathered in from the QEMU Makefiles.
141add_project_arguments(config_host['GLIB_CFLAGS'].split(),
142 native: false, language: ['c', 'cpp', 'objc'])
143glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400144gio = not_found
145if 'CONFIG_GIO' in config_host
146 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
147 link_args: config_host['GIO_LIBS'].split())
148endif
149lttng = not_found
150if 'CONFIG_TRACE_UST' in config_host
151 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
152endif
153urcubp = not_found
154if 'CONFIG_TRACE_UST' in config_host
155 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
156endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100157gcrypt = not_found
158if 'CONFIG_GCRYPT' in config_host
159 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
160 link_args: config_host['GCRYPT_LIBS'].split())
161endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400162nettle = not_found
163if 'CONFIG_NETTLE' in config_host
164 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
165 link_args: config_host['NETTLE_LIBS'].split())
166endif
167gnutls = not_found
168if 'CONFIG_GNUTLS' in config_host
169 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
170 link_args: config_host['GNUTLS_LIBS'].split())
171endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200172pixman = not_found
173if have_system or have_tools
174 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400175 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200176endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400177pam = not_found
178if 'CONFIG_AUTH_PAM' in config_host
179 pam = cc.find_library('pam')
180endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400181libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200182zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400183linux_io_uring = not_found
184if 'CONFIG_LINUX_IO_URING' in config_host
185 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
186 link_args: config_host['LINUX_IO_URING_LIBS'].split())
187endif
188libxml2 = not_found
189if 'CONFIG_LIBXML2' in config_host
190 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
191 link_args: config_host['LIBXML2_LIBS'].split())
192endif
193libnfs = not_found
194if 'CONFIG_LIBNFS' in config_host
195 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
196endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400197libattr = not_found
198if 'CONFIG_ATTR' in config_host
199 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
200endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100201seccomp = not_found
202if 'CONFIG_SECCOMP' in config_host
203 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
204 link_args: config_host['SECCOMP_LIBS'].split())
205endif
206libcap_ng = not_found
207if 'CONFIG_LIBCAP_NG' in config_host
208 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
209endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400210if get_option('xkbcommon').auto() and not have_system and not have_tools
211 xkbcommon = not_found
212else
213 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400214 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400215endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400216slirp = not_found
217if config_host.has_key('CONFIG_SLIRP')
218 slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
219 link_args: config_host['SLIRP_LIBS'].split())
220endif
221vde = not_found
222if config_host.has_key('CONFIG_VDE')
223 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
224endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200225pulse = not_found
226if 'CONFIG_LIBPULSE' in config_host
227 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
228 link_args: config_host['PULSE_LIBS'].split())
229endif
230alsa = not_found
231if 'CONFIG_ALSA' in config_host
232 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
233 link_args: config_host['ALSA_LIBS'].split())
234endif
235jack = not_found
236if 'CONFIG_LIBJACK' in config_host
237 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
238endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200239spice = not_found
240if 'CONFIG_SPICE' in config_host
241 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
242 link_args: config_host['SPICE_LIBS'].split())
243endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400244rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400245libdl = not_found
246if 'CONFIG_PLUGIN' in config_host
247 libdl = cc.find_library('dl', required: true)
248endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200249libiscsi = not_found
250if 'CONFIG_LIBISCSI' in config_host
251 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
252 link_args: config_host['LIBISCSI_LIBS'].split())
253endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400254zstd = not_found
255if 'CONFIG_ZSTD' in config_host
256 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
257 link_args: config_host['ZSTD_LIBS'].split())
258endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400259gbm = not_found
260if 'CONFIG_GBM' in config_host
261 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
262 link_args: config_host['GBM_LIBS'].split())
263endif
264virgl = not_found
265if 'CONFIG_VIRGL' in config_host
266 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
267 link_args: config_host['VIRGL_LIBS'].split())
268endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400269curl = not_found
270if 'CONFIG_CURL' in config_host
271 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
272 link_args: config_host['CURL_LIBS'].split())
273endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200274libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200275if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200276 libudev = dependency('libudev',
277 required: get_option('mpath').enabled(),
278 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200279endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200280
281mpathpersist = not_found
282mpathpersist_new_api = false
283if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
284 mpath_test_source_new = '''
285 #include <libudev.h>
286 #include <mpath_persist.h>
287 unsigned mpath_mx_alloc_len = 1024;
288 int logsink;
289 static struct config *multipath_conf;
290 extern struct udev *udev;
291 extern struct config *get_multipath_config(void);
292 extern void put_multipath_config(struct config *conf);
293 struct udev *udev;
294 struct config *get_multipath_config(void) { return multipath_conf; }
295 void put_multipath_config(struct config *conf) { }
296 int main(void) {
297 udev = udev_new();
298 multipath_conf = mpath_lib_init();
299 return 0;
300 }'''
301 mpath_test_source_old = '''
302 #include <libudev.h>
303 #include <mpath_persist.h>
304 unsigned mpath_mx_alloc_len = 1024;
305 int logsink;
306 int main(void) {
307 struct udev *udev = udev_new();
308 mpath_lib_init(udev);
309 return 0;
310 }'''
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200311 mpathlibs = [libudev]
312 if enable_static
313 mpathlibs += cc.find_library('devmapper',
314 required: get_option('mpath'),
315 static: enable_static)
316 endif
317 mpathlibs += cc.find_library('multipath',
318 required: get_option('mpath'),
319 static: enable_static)
320 mpathlibs += cc.find_library('mpathpersist',
321 required: get_option('mpath'),
322 static: enable_static)
323 foreach lib: mpathlibs
324 if not lib.found()
325 mpathlibs = []
326 break
327 endif
328 endforeach
329 if mpathlibs.length() > 0
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200330 if cc.links(mpath_test_source_new, dependencies: mpathlibs)
331 mpathpersist = declare_dependency(dependencies: mpathlibs)
332 mpathpersist_new_api = true
333 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
334 mpathpersist = declare_dependency(dependencies: mpathlibs)
335 else
336 if get_option('mpath').enabled()
337 error('Cannot detect libmpathpersist API')
338 else
339 warning('Cannot detect libmpathpersist API, disabling')
340 endif
341 endif
342 endif
343endif
344
Paolo Bonzini26347332019-07-29 15:40:07 +0200345brlapi = not_found
346if 'CONFIG_BRLAPI' in config_host
347 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
348endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100349
Paolo Bonzini760e4322020-08-26 08:09:48 +0200350sdl = not_found
351if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800352 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200353 sdl_image = not_found
354endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100355if sdl.found()
356 # work around 2.0.8 bug
357 sdl = declare_dependency(compile_args: '-Wno-undef',
358 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200359 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400360 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100361else
362 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100363 error('sdl-image required, but SDL was @0@'.format(
364 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100365 endif
366 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200367endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100368
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400369rbd = not_found
370if 'CONFIG_RBD' in config_host
371 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
372endif
373glusterfs = not_found
374if 'CONFIG_GLUSTERFS' in config_host
375 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
376 link_args: config_host['GLUSTERFS_LIBS'].split())
377endif
378libssh = not_found
379if 'CONFIG_LIBSSH' in config_host
380 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
381 link_args: config_host['LIBSSH_LIBS'].split())
382endif
383libbzip2 = not_found
384if 'CONFIG_BZIP2' in config_host
385 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
386endif
387liblzfse = not_found
388if 'CONFIG_LZFSE' in config_host
389 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
390endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200391oss = not_found
392if 'CONFIG_AUDIO_OSS' in config_host
393 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
394endif
395dsound = not_found
396if 'CONFIG_AUDIO_DSOUND' in config_host
397 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
398endif
399coreaudio = not_found
400if 'CONFIG_AUDIO_COREAUDIO' in config_host
401 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
402endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400403opengl = not_found
404if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400405 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
406 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400407endif
408gtk = not_found
409if 'CONFIG_GTK' in config_host
410 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
411 link_args: config_host['GTK_LIBS'].split())
412endif
413vte = not_found
414if 'CONFIG_VTE' in config_host
415 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
416 link_args: config_host['VTE_LIBS'].split())
417endif
418x11 = not_found
419if 'CONFIG_X11' in config_host
420 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
421 link_args: config_host['X11_LIBS'].split())
422endif
423curses = not_found
424if 'CONFIG_CURSES' in config_host
425 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
426 link_args: config_host['CURSES_LIBS'].split())
427endif
428iconv = not_found
429if 'CONFIG_ICONV' in config_host
430 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
431 link_args: config_host['ICONV_LIBS'].split())
432endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100433vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400434png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400435jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400436sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100437if get_option('vnc').enabled()
438 vnc = declare_dependency() # dummy dependency
439 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400440 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100441 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
442 required: get_option('vnc_jpeg'),
443 static: enable_static)
444 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
445 required: get_option('vnc_sasl'),
446 static: enable_static)
447 if sasl.found()
448 sasl = declare_dependency(dependencies: sasl,
449 compile_args: '-DSTRUCT_IOVEC_DEFINED')
450 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400451endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200452fdt = not_found
453if 'CONFIG_FDT' in config_host
454 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
455 link_args: config_host['FDT_LIBS'].split())
456endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400457snappy = not_found
458if 'CONFIG_SNAPPY' in config_host
459 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
460endif
461lzo = not_found
462if 'CONFIG_LZO' in config_host
463 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
464endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400465rdma = not_found
466if 'CONFIG_RDMA' in config_host
467 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
468endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400469numa = not_found
470if 'CONFIG_NUMA' in config_host
471 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
472endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400473xen = not_found
474if 'CONFIG_XEN_BACKEND' in config_host
475 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
476 link_args: config_host['XEN_LIBS'].split())
477endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200478cacard = not_found
479if 'CONFIG_SMARTCARD' in config_host
480 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
481 link_args: config_host['SMARTCARD_LIBS'].split())
482endif
César Belley0a40bcb2020-08-26 13:42:04 +0200483u2f = not_found
484if have_system
485 u2f = dependency('u2f-emu', required: get_option('u2f'),
486 method: 'pkg-config',
487 static: enable_static)
488endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200489usbredir = not_found
490if 'CONFIG_USB_REDIR' in config_host
491 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
492 link_args: config_host['USB_REDIR_LIBS'].split())
493endif
494libusb = not_found
495if 'CONFIG_USB_LIBUSB' in config_host
496 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
497 link_args: config_host['LIBUSB_LIBS'].split())
498endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400499libpmem = not_found
500if 'CONFIG_LIBPMEM' in config_host
501 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
502 link_args: config_host['LIBPMEM_LIBS'].split())
503endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600504libdaxctl = not_found
505if 'CONFIG_LIBDAXCTL' in config_host
506 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
507endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400508tasn1 = not_found
509if 'CONFIG_TASN1' in config_host
510 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
511 link_args: config_host['TASN1_LIBS'].split())
512endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400513keyutils = dependency('libkeyutils', required: false,
514 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400515
Marc-André Lureau3909def2020-08-28 15:07:33 +0400516has_gettid = cc.has_function('gettid')
517
Paolo Bonziniaa087962020-09-01 11:15:30 -0400518# Malloc tests
519
520malloc = []
521if get_option('malloc') == 'system'
522 has_malloc_trim = \
523 not get_option('malloc_trim').disabled() and \
524 cc.links('''#include <malloc.h>
525 int main(void) { malloc_trim(0); return 0; }''')
526else
527 has_malloc_trim = false
528 malloc = cc.find_library(get_option('malloc'), required: true)
529endif
530if not has_malloc_trim and get_option('malloc_trim').enabled()
531 if get_option('malloc') == 'system'
532 error('malloc_trim not available on this platform.')
533 else
534 error('malloc_trim not available with non-libc memory allocator')
535 endif
536endif
537
Paolo Bonzini859aef02020-08-04 18:14:26 +0200538# Create config-host.h
539
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400540config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200541config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200542config_host_data.set('CONFIG_MPATH', mpathpersist.found())
543config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100544config_host_data.set('CONFIG_SDL', sdl.found())
545config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100546config_host_data.set('CONFIG_VNC', vnc.found())
547config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
548config_host_data.set('CONFIG_VNC_PNG', png.found())
549config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200550config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400551config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400552config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400553config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200554config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
555config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
556config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
557config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
558
559arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200560strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200561 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200562 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200563foreach k, v: config_host
564 if arrays.contains(k)
565 if v != ''
566 v = '"' + '", "'.join(v.split()) + '", '
567 endif
568 config_host_data.set(k, v)
569 elif k == 'ARCH'
570 config_host_data.set('HOST_' + v.to_upper(), 1)
571 elif strings.contains(k)
572 if not k.startswith('CONFIG_')
573 k = 'CONFIG_' + k.to_upper()
574 endif
575 config_host_data.set_quoted(k, v)
576 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
577 config_host_data.set(k, v == 'y' ? 1 : v)
578 endif
579endforeach
Paolo Bonzini859aef02020-08-04 18:14:26 +0200580
Paolo Bonzini2becc362020-02-03 11:42:03 +0100581minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400582config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400583config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400584config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100585config_devices_mak_list = []
586config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200587config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100588config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400589
590disassemblers = {
591 'alpha' : ['CONFIG_ALPHA_DIS'],
592 'arm' : ['CONFIG_ARM_DIS'],
593 'avr' : ['CONFIG_AVR_DIS'],
594 'cris' : ['CONFIG_CRIS_DIS'],
595 'hppa' : ['CONFIG_HPPA_DIS'],
596 'i386' : ['CONFIG_I386_DIS'],
597 'x86_64' : ['CONFIG_I386_DIS'],
598 'x32' : ['CONFIG_I386_DIS'],
599 'lm32' : ['CONFIG_LM32_DIS'],
600 'm68k' : ['CONFIG_M68K_DIS'],
601 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
602 'mips' : ['CONFIG_MIPS_DIS'],
603 'moxie' : ['CONFIG_MOXIE_DIS'],
604 'nios2' : ['CONFIG_NIOS2_DIS'],
605 'or1k' : ['CONFIG_OPENRISC_DIS'],
606 'ppc' : ['CONFIG_PPC_DIS'],
607 'riscv' : ['CONFIG_RISCV_DIS'],
608 'rx' : ['CONFIG_RX_DIS'],
609 's390' : ['CONFIG_S390_DIS'],
610 'sh4' : ['CONFIG_SH4_DIS'],
611 'sparc' : ['CONFIG_SPARC_DIS'],
612 'xtensa' : ['CONFIG_XTENSA_DIS'],
613}
614if link_language == 'cpp'
615 disassemblers += {
616 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
617 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
618 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
619 }
620endif
621
Paolo Bonzini2becc362020-02-03 11:42:03 +0100622kconfig_external_symbols = [
623 'CONFIG_KVM',
624 'CONFIG_XEN',
625 'CONFIG_TPM',
626 'CONFIG_SPICE',
627 'CONFIG_IVSHMEM',
628 'CONFIG_OPENGL',
629 'CONFIG_X11',
630 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200631 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100632 'CONFIG_VHOST_KERNEL',
633 'CONFIG_VIRTFS',
634 'CONFIG_LINUX',
635 'CONFIG_PVRDMA',
636]
Paolo Bonzini859aef02020-08-04 18:14:26 +0200637ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400638
Paolo Bonzini05512f52020-09-16 15:31:11 -0400639accel_symbols = [
640 'CONFIG_KVM',
641 'CONFIG_HAX',
642 'CONFIG_HVF',
643 'CONFIG_TCG',
644 'CONFIG_WHPX'
645]
646
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400647foreach target : target_dirs
Paolo Bonzini859aef02020-08-04 18:14:26 +0200648 config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
649
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400650 foreach k, v: disassemblers
651 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
652 foreach sym: v
653 config_target += { sym: 'y' }
654 config_all_disas += { sym: 'y' }
655 endforeach
656 endif
657 endforeach
658
Paolo Bonzini859aef02020-08-04 18:14:26 +0200659 config_target_data = configuration_data()
660 foreach k, v: config_target
661 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
662 # do nothing
663 elif ignored.contains(k)
664 # do nothing
665 elif k == 'TARGET_BASE_ARCH'
666 config_target_data.set('TARGET_' + v.to_upper(), 1)
667 elif k == 'TARGET_NAME'
668 config_target_data.set_quoted(k, v)
669 elif v == 'y'
670 config_target_data.set(k, 1)
671 else
672 config_target_data.set(k, v)
673 endif
674 endforeach
Paolo Bonzini05512f52020-09-16 15:31:11 -0400675 foreach sym: accel_symbols
676 if config_target.has_key(sym)
677 config_all += { sym: 'y' }
678 endif
679 endforeach
Paolo Bonzini859aef02020-08-04 18:14:26 +0200680 config_target_h += {target: configure_file(output: target + '-config-target.h',
681 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100682
683 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100684 base_kconfig = []
685 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200686 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100687 base_kconfig += '@0@=y'.format(sym)
688 endif
689 endforeach
690
691 config_devices_mak = target + '-config-devices.mak'
692 config_devices_mak = configure_file(
693 input: ['default-configs' / target + '.mak', 'Kconfig'],
694 output: config_devices_mak,
695 depfile: config_devices_mak + '.d',
696 capture: true,
697 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
698 config_devices_mak, '@DEPFILE@', '@INPUT@',
699 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200700
701 config_devices_data = configuration_data()
702 config_devices = keyval.load(config_devices_mak)
703 foreach k, v: config_devices
704 config_devices_data.set(k, 1)
705 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100706 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200707 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
708 configuration: config_devices_data)}
709 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400710 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100711 endif
712 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400713endforeach
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400714
Paolo Bonzini2becc362020-02-03 11:42:03 +0100715# This configuration is used to build files that are shared by
716# multiple binaries, and then extracted out of the "common"
717# static_library target.
718#
719# We do not use all_sources()/all_dependencies(), because it would
720# build literally all source files, including devices only used by
721# targets that are not built for this compilation. The CONFIG_ALL
722# pseudo symbol replaces it.
723
Paolo Bonzini05512f52020-09-16 15:31:11 -0400724config_all += config_all_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100725config_all += config_host
726config_all += config_all_disas
727config_all += {
728 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
729 'CONFIG_SOFTMMU': have_system,
730 'CONFIG_USER_ONLY': have_user,
731 'CONFIG_ALL': true,
732}
733
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700734# Submodules
735
736capstone = not_found
737capstone_opt = get_option('capstone')
738if capstone_opt in ['enabled', 'auto', 'system']
739 have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile')
740 capstone = dependency('capstone', static: enable_static,
741 method: 'pkg-config',
742 required: capstone_opt == 'system' or
743 capstone_opt == 'enabled' and not have_internal)
744 if capstone.found()
745 capstone_opt = 'system'
746 elif have_internal
747 capstone_opt = 'internal'
748 else
749 capstone_opt = 'disabled'
750 endif
751endif
752if capstone_opt == 'internal'
753 capstone_data = configuration_data()
754 capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1')
755
756 capstone_files = files(
757 'capstone/cs.c',
758 'capstone/MCInst.c',
759 'capstone/MCInstrDesc.c',
760 'capstone/MCRegisterInfo.c',
761 'capstone/SStream.c',
762 'capstone/utils.c'
763 )
764
765 if 'CONFIG_ARM_DIS' in config_all_disas
766 capstone_data.set('CAPSTONE_HAS_ARM', '1')
767 capstone_files += files(
768 'capstone/arch/ARM/ARMDisassembler.c',
769 'capstone/arch/ARM/ARMInstPrinter.c',
770 'capstone/arch/ARM/ARMMapping.c',
771 'capstone/arch/ARM/ARMModule.c'
772 )
773 endif
774
775 # FIXME: This config entry currently depends on a c++ compiler.
776 # Which is needed for building libvixl, but not for capstone.
777 if 'CONFIG_ARM_A64_DIS' in config_all_disas
778 capstone_data.set('CAPSTONE_HAS_ARM64', '1')
779 capstone_files += files(
780 'capstone/arch/AArch64/AArch64BaseInfo.c',
781 'capstone/arch/AArch64/AArch64Disassembler.c',
782 'capstone/arch/AArch64/AArch64InstPrinter.c',
783 'capstone/arch/AArch64/AArch64Mapping.c',
784 'capstone/arch/AArch64/AArch64Module.c'
785 )
786 endif
787
788 if 'CONFIG_PPC_DIS' in config_all_disas
789 capstone_data.set('CAPSTONE_HAS_POWERPC', '1')
790 capstone_files += files(
791 'capstone/arch/PowerPC/PPCDisassembler.c',
792 'capstone/arch/PowerPC/PPCInstPrinter.c',
793 'capstone/arch/PowerPC/PPCMapping.c',
794 'capstone/arch/PowerPC/PPCModule.c'
795 )
796 endif
797
798 if 'CONFIG_I386_DIS' in config_all_disas
799 capstone_data.set('CAPSTONE_HAS_X86', 1)
800 capstone_files += files(
801 'capstone/arch/X86/X86Disassembler.c',
802 'capstone/arch/X86/X86DisassemblerDecoder.c',
803 'capstone/arch/X86/X86ATTInstPrinter.c',
804 'capstone/arch/X86/X86IntelInstPrinter.c',
805 'capstone/arch/X86/X86Mapping.c',
806 'capstone/arch/X86/X86Module.c'
807 )
808 endif
809
810 configure_file(output: 'capstone-defs.h', configuration: capstone_data)
811
812 capstone_cargs = [
813 # FIXME: There does not seem to be a way to completely replace the c_args
814 # that come from add_project_arguments() -- we can only add to them.
815 # So: disable all warnings with a big hammer.
816 '-Wno-error', '-w',
817
818 # Include all configuration defines via a header file, which will wind up
819 # as a dependency on the object file, and thus changes here will result
820 # in a rebuild.
821 '-include', 'capstone-defs.h'
822 ]
823
824 libcapstone = static_library('capstone',
825 sources: capstone_files,
826 c_args: capstone_cargs,
827 include_directories: 'capstone/include')
828 capstone = declare_dependency(link_with: libcapstone,
829 include_directories: 'capstone/include')
830endif
831config_host_data.set('CONFIG_CAPSTONE', capstone.found())
832
833genh += configure_file(output: 'config-host.h', configuration: config_host_data)
834
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400835# Generators
836
Marc-André Lureau3f885652019-07-15 18:06:04 +0400837hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +0400838shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400839qapi_gen = find_program('scripts/qapi-gen.py')
840qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
841 meson.source_root() / 'scripts/qapi/commands.py',
842 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400843 meson.source_root() / 'scripts/qapi/error.py',
844 meson.source_root() / 'scripts/qapi/events.py',
845 meson.source_root() / 'scripts/qapi/expr.py',
846 meson.source_root() / 'scripts/qapi/gen.py',
847 meson.source_root() / 'scripts/qapi/introspect.py',
848 meson.source_root() / 'scripts/qapi/parser.py',
849 meson.source_root() / 'scripts/qapi/schema.py',
850 meson.source_root() / 'scripts/qapi/source.py',
851 meson.source_root() / 'scripts/qapi/types.py',
852 meson.source_root() / 'scripts/qapi/visit.py',
853 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400854 meson.source_root() / 'scripts/qapi-gen.py'
855]
856
857tracetool = [
858 python, files('scripts/tracetool.py'),
859 '--backend=' + config_host['TRACE_BACKENDS']
860]
861
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400862qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
863 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +0200864 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400865qemu_version = custom_target('qemu-version.h',
866 output: 'qemu-version.h',
867 command: qemu_version_cmd,
868 capture: true,
869 build_by_default: true,
870 build_always_stale: true)
871genh += qemu_version
872
Marc-André Lureau3f885652019-07-15 18:06:04 +0400873hxdep = []
874hx_headers = [
875 ['qemu-options.hx', 'qemu-options.def'],
876 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
877]
878if have_system
879 hx_headers += [
880 ['hmp-commands.hx', 'hmp-commands.h'],
881 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
882 ]
883endif
884foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400885 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +0400886 input: files(d[0]),
887 output: d[1],
888 capture: true,
889 build_by_default: true, # to be removed when added to a target
890 command: [hxtool, '-h', '@INPUT0@'])
891endforeach
892genh += hxdep
893
Peter Maydelleb937362020-09-25 17:23:08 +0100894SPHINX_ARGS = [config_host['SPHINX_BUILD'],
895 '-Dversion=' + meson.project_version(),
896 '-Drelease=' + config_host['PKGVERSION']]
897
898if get_option('werror')
899 SPHINX_ARGS += [ '-W' ]
900endif
901
Peter Maydellb3f48302020-09-25 17:23:09 +0100902sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
903 meson.source_root() / 'docs/sphinx/hxtool.py',
904 meson.source_root() / 'docs/sphinx/kerneldoc.py',
905 meson.source_root() / 'docs/sphinx/kernellog.py',
906 meson.source_root() / 'docs/sphinx/qapidoc.py',
907 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
908 qapi_gen_depends ]
909
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400910# Collect sourcesets.
911
912util_ss = ss.source_set()
913stub_ss = ss.source_set()
914trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400915block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +0200916blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200917qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100918common_ss = ss.source_set()
919softmmu_ss = ss.source_set()
920user_ss = ss.source_set()
921bsd_user_ss = ss.source_set()
922linux_user_ss = ss.source_set()
923specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200924specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100925
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400926modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100927hw_arch = {}
928target_arch = {}
929target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400930
931###############
932# Trace files #
933###############
934
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400935# TODO: add each directory to the subdirs from its own meson.build, once
936# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400937trace_events_subdirs = [
938 'accel/kvm',
939 'accel/tcg',
940 'crypto',
941 'monitor',
942]
943if have_user
944 trace_events_subdirs += [ 'linux-user' ]
945endif
946if have_block
947 trace_events_subdirs += [
948 'authz',
949 'block',
950 'io',
951 'nbd',
952 'scsi',
953 ]
954endif
955if have_system
956 trace_events_subdirs += [
957 'audio',
958 'backends',
959 'backends/tpm',
960 'chardev',
961 'hw/9pfs',
962 'hw/acpi',
963 'hw/alpha',
964 'hw/arm',
965 'hw/audio',
966 'hw/block',
967 'hw/block/dataplane',
968 'hw/char',
969 'hw/display',
970 'hw/dma',
971 'hw/hppa',
972 'hw/hyperv',
973 'hw/i2c',
974 'hw/i386',
975 'hw/i386/xen',
976 'hw/ide',
977 'hw/input',
978 'hw/intc',
979 'hw/isa',
980 'hw/mem',
981 'hw/mips',
982 'hw/misc',
983 'hw/misc/macio',
984 'hw/net',
985 'hw/nvram',
986 'hw/pci',
987 'hw/pci-host',
988 'hw/ppc',
989 'hw/rdma',
990 'hw/rdma/vmw',
991 'hw/rtc',
992 'hw/s390x',
993 'hw/scsi',
994 'hw/sd',
995 'hw/sparc',
996 'hw/sparc64',
997 'hw/ssi',
998 'hw/timer',
999 'hw/tpm',
1000 'hw/usb',
1001 'hw/vfio',
1002 'hw/virtio',
1003 'hw/watchdog',
1004 'hw/xen',
1005 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001006 'migration',
1007 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001008 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001009 'ui',
1010 ]
1011endif
1012trace_events_subdirs += [
1013 'hw/core',
1014 'qapi',
1015 'qom',
1016 'target/arm',
1017 'target/hppa',
1018 'target/i386',
1019 'target/mips',
1020 'target/ppc',
1021 'target/riscv',
1022 'target/s390x',
1023 'target/sparc',
1024 'util',
1025]
1026
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001027subdir('qapi')
1028subdir('qobject')
1029subdir('stubs')
1030subdir('trace')
1031subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001032subdir('qom')
1033subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001034subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001035subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001036
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001037
1038if enable_modules
1039 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1040 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1041endif
1042
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001043# Build targets from sourcesets
1044
Paolo Bonzini2becc362020-02-03 11:42:03 +01001045stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001046
1047util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001048util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001049libqemuutil = static_library('qemuutil',
1050 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001051 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001052qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001053 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001054
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001055decodetree = generator(find_program('scripts/decodetree.py'),
1056 output: 'decode-@BASENAME@.c.inc',
1057 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1058
Paolo Bonzini478e9432020-08-17 12:47:55 +02001059subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001060subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001061subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001062subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001063subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001064subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001065subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001066
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001067block_ss.add(files(
1068 'block.c',
1069 'blockjob.c',
1070 'job.c',
1071 'qemu-io-cmds.c',
1072))
1073block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1074
1075subdir('nbd')
1076subdir('scsi')
1077subdir('block')
1078
Paolo Bonzini4a963372020-08-03 16:22:28 +02001079blockdev_ss.add(files(
1080 'blockdev.c',
1081 'blockdev-nbd.c',
1082 'iothread.c',
1083 'job-qmp.c',
1084))
1085
1086# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1087# os-win32.c does not
1088blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1089softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1090
1091softmmu_ss.add_all(blockdev_ss)
1092softmmu_ss.add(files(
1093 'bootdevice.c',
1094 'dma-helpers.c',
1095 'qdev-monitor.c',
1096), sdl)
1097
1098softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1099softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1100softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1101
1102common_ss.add(files('cpus-common.c'))
1103
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001104subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001105
Bruce Rogersc7c91a72020-08-24 09:52:12 -06001106specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001107specific_ss.add(files('exec-vary.c'))
1108specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1109 'fpu/softfloat.c',
1110 'tcg/optimize.c',
1111 'tcg/tcg-common.c',
1112 'tcg/tcg-op-gvec.c',
1113 'tcg/tcg-op-vec.c',
1114 'tcg/tcg-op.c',
1115 'tcg/tcg.c',
1116))
1117specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1118
Marc-André Lureauab318052019-07-24 19:23:16 +04001119subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001120subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001121subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001122subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001123subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001124subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001125subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001126subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001127subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001128subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001129subdir('linux-user')
1130
Marc-André Lureaub309c322019-08-18 19:20:37 +04001131bsd_user_ss.add(files('gdbstub.c'))
1132specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1133
Marc-André Lureau3a304462019-08-18 16:13:08 +04001134linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1135specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001136
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001137# needed for fuzzing binaries
1138subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001139subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001140
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001141block_mods = []
1142softmmu_mods = []
1143foreach d, list : modules
1144 foreach m, module_ss : list
1145 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001146 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001147 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1148 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1149 if d == 'block'
1150 block_mods += sl
1151 else
1152 softmmu_mods += sl
1153 endif
1154 else
1155 if d == 'block'
1156 block_ss.add_all(module_ss)
1157 else
1158 softmmu_ss.add_all(module_ss)
1159 endif
1160 endif
1161 endforeach
1162endforeach
1163
1164nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001165undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001166block_syms = custom_target('block.syms', output: 'block.syms',
1167 input: [libqemuutil, block_mods],
1168 capture: true,
1169 command: [undefsym, nm, '@INPUT@'])
1170qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1171 input: [libqemuutil, softmmu_mods],
1172 capture: true,
1173 command: [undefsym, nm, '@INPUT@'])
1174
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001175block_ss = block_ss.apply(config_host, strict: false)
1176libblock = static_library('block', block_ss.sources() + genh,
1177 dependencies: block_ss.dependencies(),
1178 link_depends: block_syms,
1179 name_suffix: 'fa',
1180 build_by_default: false)
1181
1182block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001183 link_args: '@block.syms',
1184 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001185
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001186qmp_ss = qmp_ss.apply(config_host, strict: false)
1187libqmp = static_library('qmp', qmp_ss.sources() + genh,
1188 dependencies: qmp_ss.dependencies(),
1189 name_suffix: 'fa',
1190 build_by_default: false)
1191
1192qmp = declare_dependency(link_whole: [libqmp])
1193
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001194foreach m : block_mods + softmmu_mods
1195 shared_module(m.name(),
1196 name_prefix: '',
1197 link_whole: m,
1198 install: true,
1199 install_dir: config_host['qemu_moddir'])
1200endforeach
1201
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001202softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1203common_ss.add(qom, qemuutil)
1204
1205common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001206common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1207
1208common_all = common_ss.apply(config_all, strict: false)
1209common_all = static_library('common',
1210 build_by_default: false,
1211 sources: common_all.sources() + genh,
1212 dependencies: common_all.dependencies(),
1213 name_suffix: 'fa')
1214
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001215feature_to_c = find_program('scripts/feature_to_c.sh')
1216
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001217emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001218foreach target : target_dirs
1219 config_target = config_target_mak[target]
1220 target_name = config_target['TARGET_NAME']
1221 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001222 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001223 arch_deps = []
1224 c_args = ['-DNEED_CPU_H',
1225 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1226 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
1227 link_args = []
Paolo Bonzini2becc362020-02-03 11:42:03 +01001228
Paolo Bonzini859aef02020-08-04 18:14:26 +02001229 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001230 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1231 if targetos == 'linux'
1232 target_inc += include_directories('linux-headers', is_system: true)
1233 endif
1234 if target.endswith('-softmmu')
1235 qemu_target_name = 'qemu-system-' + target_name
1236 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001237 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1238 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001239 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001240
Marc-André Lureau2c442202019-08-17 13:55:58 +04001241 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1242 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1243 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001244 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001245
Paolo Bonzini2becc362020-02-03 11:42:03 +01001246 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001247 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001248 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001249 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001250 target_type='user'
1251 qemu_target_name = 'qemu-' + target_name
1252 if 'CONFIG_LINUX_USER' in config_target
1253 base_dir = 'linux-user'
1254 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1255 else
1256 base_dir = 'bsd-user'
1257 endif
1258 target_inc += include_directories(
1259 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001260 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001261 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001262 if 'CONFIG_LINUX_USER' in config_target
1263 dir = base_dir / abi
1264 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1265 if config_target.has_key('TARGET_SYSTBL_ABI')
1266 arch_srcs += \
1267 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1268 extra_args : config_target['TARGET_SYSTBL_ABI'])
1269 endif
1270 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001271 endif
1272
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001273 if 'TARGET_XML_FILES' in config_target
1274 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1275 output: target + '-gdbstub-xml.c',
1276 input: files(config_target['TARGET_XML_FILES'].split()),
1277 command: [feature_to_c, '@INPUT@'],
1278 capture: true)
1279 arch_srcs += gdbstub_xml
1280 endif
1281
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001282 t = target_arch[arch].apply(config_target, strict: false)
1283 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001284 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001285
Paolo Bonzini2becc362020-02-03 11:42:03 +01001286 target_common = common_ss.apply(config_target, strict: false)
1287 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001288 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001289
Paolo Bonzini2becc362020-02-03 11:42:03 +01001290 target_specific = specific_ss.apply(config_target, strict: false)
1291 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001292 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001293
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001294 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001295 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001296 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001297 objects: objects,
1298 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001299 c_args: c_args,
1300 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001301 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001302
1303 if target.endswith('-softmmu')
1304 execs = [{
1305 'name': 'qemu-system-' + target_name,
1306 'gui': false,
1307 'sources': files('softmmu/main.c'),
1308 'dependencies': []
1309 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001310 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001311 execs += [{
1312 'name': 'qemu-system-' + target_name + 'w',
1313 'gui': true,
1314 'sources': files('softmmu/main.c'),
1315 'dependencies': []
1316 }]
1317 endif
1318 if config_host.has_key('CONFIG_FUZZ')
1319 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1320 execs += [{
1321 'name': 'qemu-fuzz-' + target_name,
1322 'gui': false,
1323 'sources': specific_fuzz.sources(),
1324 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001325 }]
1326 endif
1327 else
1328 execs = [{
1329 'name': 'qemu-' + target_name,
1330 'gui': false,
1331 'sources': [],
1332 'dependencies': []
1333 }]
1334 endif
1335 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001336 emulators += {exe['name']:
1337 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001338 install: true,
1339 c_args: c_args,
1340 dependencies: arch_deps + deps + exe['dependencies'],
1341 objects: lib.extract_all_objects(recursive: true),
1342 link_language: link_language,
1343 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1344 link_args: link_args,
1345 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001346 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001347
1348 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1349 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001350 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1351 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001352 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1353 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1354 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001355 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001356 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001357 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001358 capture: true,
1359 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001360 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001361 command: [
1362 tracetool, '--group=all', '--format=' + stp['fmt'],
1363 '--binary=' + stp['bin'],
1364 '--target-name=' + target_name,
1365 '--target-type=' + target_type,
1366 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1367 '@INPUT@',
1368 ])
1369 endforeach
1370 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001371 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001372endforeach
1373
Paolo Bonzini931049b2020-02-05 09:44:24 +01001374# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001375
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001376if 'CONFIG_PLUGIN' in config_host
1377 install_headers('include/qemu/qemu-plugin.h')
1378endif
1379
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001380if 'CONFIG_GUEST_AGENT' in config_host
1381 subdir('qga')
1382endif
1383
Laurent Vivier9755c942020-08-24 17:24:30 +02001384# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1385# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001386if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001387 # used for the update-keymaps target, so include rules even if !have_tools
1388 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1389 dependencies: [qemuutil, xkbcommon], install: have_tools)
1390endif
1391
Paolo Bonzini931049b2020-02-05 09:44:24 +01001392if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001393 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1394 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1395 qemu_io = executable('qemu-io', files('qemu-io.c'),
1396 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001397 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001398 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001399
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001400 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001401 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001402 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001403
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001404 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1405 dependencies: qemuutil,
1406 install: true)
1407
Paolo Bonzini931049b2020-02-05 09:44:24 +01001408 if 'CONFIG_VHOST_USER' in config_host
1409 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001410 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001411 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001412 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001413 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001414 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001415
1416 if targetos == 'linux'
1417 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1418 dependencies: [qemuutil, libcap_ng],
1419 install: true,
1420 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001421
1422 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1423 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001424 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001425 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001426 endif
1427
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001428 if 'CONFIG_IVSHMEM' in config_host
1429 subdir('contrib/ivshmem-client')
1430 subdir('contrib/ivshmem-server')
1431 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001432endif
1433
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001434subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001435subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001436subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001437subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001438subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001439if 'CONFIG_GTK' in config_host
1440 subdir('po')
1441endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001442
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001443if host_machine.system() == 'windows'
1444 nsis_cmd = [
1445 find_program('scripts/nsis.py'),
1446 '@OUTPUT@',
1447 get_option('prefix'),
1448 meson.current_source_dir(),
1449 host_machine.cpu_family(),
1450 '--',
1451 '-DDISPLAYVERSION=' + meson.project_version(),
1452 ]
1453 if build_docs
1454 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1455 endif
1456 if 'CONFIG_GTK' in config_host
1457 nsis_cmd += '-DCONFIG_GTK=y'
1458 endif
1459
1460 nsis = custom_target('nsis',
1461 output: 'qemu-setup-' + meson.project_version() + '.exe',
1462 input: files('qemu.nsi'),
1463 build_always_stale: true,
1464 command: nsis_cmd + ['@INPUT@'])
1465 alias_target('installer', nsis)
1466endif
1467
Paolo Bonzinif9332752020-02-03 13:28:38 +01001468summary_info = {}
1469summary_info += {'Install prefix': config_host['prefix']}
1470summary_info += {'BIOS directory': config_host['qemu_datadir']}
1471summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1472summary_info += {'binary directory': config_host['bindir']}
1473summary_info += {'library directory': config_host['libdir']}
1474summary_info += {'module directory': config_host['qemu_moddir']}
1475summary_info += {'libexec directory': config_host['libexecdir']}
1476summary_info += {'include directory': config_host['includedir']}
1477summary_info += {'config directory': config_host['sysconfdir']}
1478if targetos != 'windows'
1479 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001480 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001481else
1482 summary_info += {'local state directory': 'queried at runtime'}
1483endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001484summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001485summary_info += {'Build directory': meson.current_build_dir()}
1486summary_info += {'Source path': meson.current_source_dir()}
1487summary_info += {'GIT binary': config_host['GIT']}
1488summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1489summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1490summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1491if link_language == 'cpp'
1492 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1493else
1494 summary_info += {'C++ compiler': false}
1495endif
1496if targetos == 'darwin'
1497 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1498endif
1499summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1500summary_info += {'CFLAGS': config_host['CFLAGS']}
1501summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1502summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1503summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001504summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1505summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1506summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1507# TODO: add back version
1508summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1509if config_host.has_key('CONFIG_SLIRP')
1510 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1511endif
1512summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1513if config_host.has_key('CONFIG_MODULES')
1514 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1515endif
1516summary_info += {'host CPU': cpu}
1517summary_info += {'host endianness': build_machine.endian()}
1518summary_info += {'target list': config_host['TARGET_DIRS']}
1519summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1520summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1521summary_info += {'strip binaries': get_option('strip')}
1522summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001523summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001524if targetos == 'darwin'
1525 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1526endif
1527# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001528summary_info += {'SDL support': sdl.found()}
1529summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001530# TODO: add back version
1531summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1532summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001533summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001534# TODO: add back version
1535summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1536summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1537summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1538# TODO: add back version
1539summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1540if config_host.has_key('CONFIG_GCRYPT')
1541 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1542 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1543endif
1544# TODO: add back version
1545summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1546if config_host.has_key('CONFIG_NETTLE')
1547 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1548endif
1549summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1550summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1551summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1552summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1553# TODO: add back version
1554summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1555summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1556summary_info += {'mingw32 support': targetos == 'windows'}
1557summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1558summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1559summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1560summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001561summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001562summary_info += {'VNC support': vnc.found()}
1563if vnc.found()
1564 summary_info += {'VNC SASL support': sasl.found()}
1565 summary_info += {'VNC JPEG support': jpeg.found()}
1566 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001567endif
1568summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1569if config_host.has_key('CONFIG_XEN_BACKEND')
1570 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1571endif
1572summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1573summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1574summary_info += {'PIE': get_option('b_pie')}
1575summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1576summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1577summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1578summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1579summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1580summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04001581summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1582summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1583summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1584summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1585summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1586if config_all.has_key('CONFIG_TCG')
1587 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1588 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1589endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04001590summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001591summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1592summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1593summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1594summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1595summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1596summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1597summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1598summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1599summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1600summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1601summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1602summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1603summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1604summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1605summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1606summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1607summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1608summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1609if config_host['TRACE_BACKENDS'].split().contains('simple')
1610 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1611endif
1612# TODO: add back protocol and server version
1613summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1614summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1615summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1616summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001617summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001618summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1619summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1620summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1621summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1622summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1623summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1624summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1625if targetos == 'windows'
1626 if 'WIN_SDK' in config_host
1627 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1628 endif
1629 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1630 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01001631 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001632endif
1633summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1634summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1635summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1636summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1637summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1638summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1639summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001640summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001641summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1642summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1643summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1644summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1645summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1646summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1647summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1648summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1649summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1650summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1651summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04001652summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001653summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1654summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1655summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1656summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1657summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1658summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1659summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1660summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1661summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1662summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1663summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1664summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001665summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001666summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1667summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02001668summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001669summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1670summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1671summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1672if config_host.has_key('HAVE_GDB_BIN')
1673 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1674endif
1675summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1676summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1677summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1678summary(summary_info, bool_yn: true)
1679
1680if not supported_cpus.contains(cpu)
1681 message()
1682 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1683 message()
1684 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1685 message('The QEMU project intends to remove support for this host CPU in')
1686 message('a future release if nobody volunteers to maintain it and to')
1687 message('provide a build host for our continuous integration setup.')
1688 message('configure has succeeded and you can continue to build, but')
1689 message('if you care about QEMU on this platform you should contact')
1690 message('us upstream at qemu-devel@nongnu.org.')
1691endif
1692
1693if not supported_oses.contains(targetos)
1694 message()
1695 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1696 message()
1697 message('Host OS ' + targetos + 'support is not currently maintained.')
1698 message('The QEMU project intends to remove support for this host OS in')
1699 message('a future release if nobody volunteers to maintain it and to')
1700 message('provide a build host for our continuous integration setup.')
1701 message('configure has succeeded and you can continue to build, but')
1702 message('if you care about QEMU on this platform you should contact')
1703 message('us upstream at qemu-devel@nongnu.org.')
1704endif