]> git.proxmox.com Git - mirror_qemu.git/blame - meson.build
disas: Configure capstone for aarch64 host without libvixl
[mirror_qemu.git] / meson.build
CommitLineData
a5665051 1project('qemu', ['c'], meson_version: '>=0.55.0',
90756b2f 2 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
3e0e5190 3 'b_colorout=auto'],
a5665051
PB
4 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
b29b40f4
PB
7if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
a81df1b6 12ss = import('sourceset')
8b18cdbf 13fs = import('fs')
a81df1b6 14
ce1c1e7a 15sh = find_program('sh')
a81df1b6 16cc = meson.get_compiler('c')
a5665051 17config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
3154fee4 18enable_modules = 'CONFIG_MODULES' in config_host
35be72ba 19enable_static = 'CONFIG_STATIC' in config_host
f8aa24ea 20build_docs = 'BUILD_DOCS' in config_host
8fe11232
MAL
21
22if get_option('qemu_suffix').startswith('/')
23 error('qemu_suffix cannot start with a /')
24endif
25
ab4c0996 26qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
491e74c1 27qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
859aef02
PB
28config_host_data = configuration_data()
29genh = []
a5665051 30
760e4327
PB
31target_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
201e8ed7
PB
41python = 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
ff9ed62b
AB
58# 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
a5665051
PB
66add_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
c46f76d1 75
fc929892
MAL
76link_language = meson.get_external_property('link_language', 'cpp')
77if link_language == 'cpp'
78 add_languages('cpp', required: true, native: false)
79endif
a5665051
PB
80if host_machine.system() == 'darwin'
81 add_languages('objc', required: false, native: false)
82endif
83
968b4db3
PB
84if '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
6ec0e15d
PB
91###########################################
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
a81df1b6
PB
99m = cc.find_library('m', required: false)
100util = cc.find_library('util', required: false)
4a96337d 101winmm = []
a81df1b6 102socket = []
04c6f1e7 103version_res = []
d92989aa
MAL
104coref = []
105iokit = []
b4e312e9 106cocoa = not_found
d92989aa 107hvf = []
a81df1b6
PB
108if targetos == 'windows'
109 socket = cc.find_library('ws2_32')
4a96337d 110 winmm = cc.find_library('winmm')
04c6f1e7
MAL
111
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('.'))
d92989aa
MAL
116elif targetos == 'darwin'
117 coref = dependency('appleframeworks', modules: 'CoreFoundation')
118 iokit = dependency('appleframeworks', modules: 'IOKit')
b4e312e9 119 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
d92989aa 120 hvf = dependency('appleframeworks', modules: 'Hypervisor')
cfad62f1
PB
121elif 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')]
a81df1b6 129endif
6ec0e15d 130
b4e312e9
PB
131if not cocoa.found() and get_option('cocoa').enabled()
132 error('Cocoa not available on this platform')
133endif
134
6ec0e15d
PB
135################
136# Dependencies #
137################
138
215b0c2f
PB
139# 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())
a81df1b6
PB
144gio = 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
46859d93
DB
157gcrypt = 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
a81df1b6
PB
162nettle = 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
b7612f45
PB
172pixman = not_found
173if have_system or have_tools
174 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
1a94933f 175 method: 'pkg-config', static: enable_static)
b7612f45 176endif
5e7fbd25
MAL
177pam = not_found
178if 'CONFIG_AUTH_PAM' in config_host
179 pam = cc.find_library('pam')
180endif
5e5733e5 181libaio = cc.find_library('aio', required: false)
1ffb3bbb 182zlib = dependency('zlib', required: true, static: enable_static)
5e5733e5
MAL
183linux_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
ec0d5893
MAL
197libattr = not_found
198if 'CONFIG_ATTR' in config_host
199 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
200endif
3f99cf57
PB
201seccomp = 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
1917ec6d
PB
210if 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'),
1a94933f 214 method: 'pkg-config', static: enable_static)
ade60d4f 215endif
cdaf0722
MAL
216slirp = 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
478e943f
PB
225pulse = 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
2634733c
PB
239spice = 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
5ee24e78 244rt = cc.find_library('rt', required: false)
ccf7afa5
PB
245libdl = not_found
246if 'CONFIG_PLUGIN' in config_host
247 libdl = cc.find_library('dl', required: true)
248endif
99650b62
PB
249libiscsi = 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
5e5733e5
MAL
254zstd = 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
ea458960
MAL
259gbm = 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
1d7bb6ab
MAL
269curl = 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
f15bff25 274libudev = not_found
f01496a3 275if targetos == 'linux' and (have_system or have_tools)
6ec0e15d
PB
276 libudev = dependency('libudev',
277 required: get_option('mpath').enabled(),
278 static: enable_static)
279endif
280
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 }'''
43b43a40
PB
311 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
6ec0e15d
PB
330 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
f15bff25 343endif
6ec0e15d 344
2634733c
PB
345brlapi = not_found
346if 'CONFIG_BRLAPI' in config_host
347 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
348endif
35be72ba 349
760e4327
PB
350sdl = not_found
351if have_system
363743da 352 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
760e4327
PB
353 sdl_image = not_found
354endif
35be72ba
PB
355if sdl.found()
356 # work around 2.0.8 bug
357 sdl = declare_dependency(compile_args: '-Wno-undef',
358 dependencies: sdl)
7161a433 359 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
1a94933f 360 method: 'pkg-config', static: enable_static)
35be72ba
PB
361else
362 if get_option('sdl_image').enabled()
a8dc2ace
ST
363 error('sdl-image required, but SDL was @0@'.format(
364 get_option('sdl').disabled() ? 'disabled' : 'not found'))
35be72ba
PB
365 endif
366 sdl_image = not_found
2634733c 367endif
35be72ba 368
5e5733e5
MAL
369rbd = 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
478e943f
PB
391oss = 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())
2b1ccdf4
MAL
402endif
403opengl = not_found
404if 'CONFIG_OPENGL' in config_host
de2d3005
PB
405 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
406 link_args: config_host['OPENGL_LIBS'].split())
2b1ccdf4
MAL
407endif
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
a0b93237 433vnc = not_found
2b1ccdf4 434png = not_found
2b1ccdf4 435jpeg = not_found
2b1ccdf4 436sasl = not_found
a0b93237
PB
437if get_option('vnc').enabled()
438 vnc = declare_dependency() # dummy dependency
439 png = dependency('libpng', required: get_option('vnc_png'),
1a94933f 440 method: 'pkg-config', static: enable_static)
a0b93237
PB
441 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
478e943f 451endif
4a96337d
PB
452fdt = 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
708eab42
MAL
457snappy = 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
55166230
MAL
465rdma = not_found
466if 'CONFIG_RDMA' in config_host
467 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
468endif
ab318051
MAL
469numa = not_found
470if 'CONFIG_NUMA' in config_host
471 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
472endif
582ea95f
MAL
473xen = 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
06677ce1
PB
478cacard = 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
0a40bcb7
CB
483u2f = not_found
484if have_system
485 u2f = dependency('u2f-emu', required: get_option('u2f'),
486 method: 'pkg-config',
487 static: enable_static)
488endif
06677ce1
PB
489usbredir = 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
c9322ab5
MAL
499libpmem = 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
c7c91a74
BR
504libdaxctl = not_found
505if 'CONFIG_LIBDAXCTL' in config_host
506 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
507endif
8ce0a45f
MAL
508tasn1 = 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
af04e89d
MAL
513keyutils = dependency('libkeyutils', required: false,
514 method: 'pkg-config', static: enable_static)
a81df1b6 515
3909def8
MAL
516has_gettid = cc.has_function('gettid')
517
aa087962
PB
518# 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
859aef02
PB
538# Create config-host.h
539
b4e312e9 540config_host_data.set('CONFIG_COCOA', cocoa.found())
f01496a3 541config_host_data.set('CONFIG_LIBUDEV', libudev.found())
6ec0e15d
PB
542config_host_data.set('CONFIG_MPATH', mpathpersist.found())
543config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
35be72ba
PB
544config_host_data.set('CONFIG_SDL', sdl.found())
545config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
a0b93237
PB
546config_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())
4113f4cf 550config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
af04e89d 551config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
3909def8 552config_host_data.set('CONFIG_GETTID', has_gettid)
aa087962 553config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
859aef02
PB
554config_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']
f4f5ed2c 560strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
859aef02 561 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
f4f5ed2c 562 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
859aef02
PB
563foreach 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
859aef02 580
2becc36a 581minikconf = find_program('scripts/minikconf.py')
05512f55 582config_all = {}
a98006bc 583config_all_devices = {}
ca0fc784 584config_all_disas = {}
2becc36a
PB
585config_devices_mak_list = []
586config_devices_h = {}
859aef02 587config_target_h = {}
2becc36a 588config_target_mak = {}
ca0fc784
PB
589
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
2becc36a
PB
622kconfig_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',
40bc0ca9 631 'CONFIG_VHOST_VDPA',
2becc36a
PB
632 'CONFIG_VHOST_KERNEL',
633 'CONFIG_VIRTFS',
634 'CONFIG_LINUX',
635 'CONFIG_PVRDMA',
636]
859aef02 637ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
ca0fc784 638
05512f55
PB
639accel_symbols = [
640 'CONFIG_KVM',
641 'CONFIG_HAX',
642 'CONFIG_HVF',
643 'CONFIG_TCG',
644 'CONFIG_WHPX'
645]
646
a81df1b6 647foreach target : target_dirs
859aef02
PB
648 config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
649
ca0fc784
PB
650 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
859aef02
PB
659 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
05512f55
PB
675 foreach sym: accel_symbols
676 if config_target.has_key(sym)
677 config_all += { sym: 'y' }
678 endif
679 endforeach
859aef02
PB
680 config_target_h += {target: configure_file(output: target + '-config-target.h',
681 configuration: config_target_data)}
2becc36a
PB
682
683 if target.endswith('-softmmu')
2becc36a
PB
684 base_kconfig = []
685 foreach sym : kconfig_external_symbols
859aef02 686 if sym in config_target or sym in config_host
2becc36a
PB
687 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])
859aef02
PB
700
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
2becc36a 706 config_devices_mak_list += config_devices_mak
859aef02
PB
707 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
708 configuration: config_devices_data)}
709 config_target += config_devices
a98006bc 710 config_all_devices += config_devices
2becc36a
PB
711 endif
712 config_target_mak += {target: config_target}
a81df1b6 713endforeach
a81df1b6 714
2becc36a
PB
715# 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
05512f55 724config_all += config_all_devices
2becc36a
PB
725config_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
8b18cdbf
RH
734# 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')
bcf36862
RH
740 capstone = dependency('capstone', version: '>=4.0',
741 static: enable_static, method: 'pkg-config',
8b18cdbf
RH
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',
eef20e40 805 'capstone/arch/X86/X86InstPrinterCommon.c',
8b18cdbf
RH
806 'capstone/arch/X86/X86Mapping.c',
807 'capstone/arch/X86/X86Module.c'
808 )
809 endif
810
811 configure_file(output: 'capstone-defs.h', configuration: capstone_data)
812
813 capstone_cargs = [
814 # FIXME: There does not seem to be a way to completely replace the c_args
815 # that come from add_project_arguments() -- we can only add to them.
816 # So: disable all warnings with a big hammer.
817 '-Wno-error', '-w',
818
819 # Include all configuration defines via a header file, which will wind up
820 # as a dependency on the object file, and thus changes here will result
821 # in a rebuild.
822 '-include', 'capstone-defs.h'
823 ]
824
825 libcapstone = static_library('capstone',
826 sources: capstone_files,
827 c_args: capstone_cargs,
828 include_directories: 'capstone/include')
829 capstone = declare_dependency(link_with: libcapstone,
eef20e40 830 include_directories: 'capstone/include/capstone')
8b18cdbf
RH
831endif
832config_host_data.set('CONFIG_CAPSTONE', capstone.found())
833
834genh += configure_file(output: 'config-host.h', configuration: config_host_data)
835
a81df1b6
PB
836# Generators
837
3f885659 838hxtool = find_program('scripts/hxtool')
650b5d54 839shaderinclude = find_program('scripts/shaderinclude.pl')
a81df1b6
PB
840qapi_gen = find_program('scripts/qapi-gen.py')
841qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
842 meson.source_root() / 'scripts/qapi/commands.py',
843 meson.source_root() / 'scripts/qapi/common.py',
a81df1b6
PB
844 meson.source_root() / 'scripts/qapi/error.py',
845 meson.source_root() / 'scripts/qapi/events.py',
846 meson.source_root() / 'scripts/qapi/expr.py',
847 meson.source_root() / 'scripts/qapi/gen.py',
848 meson.source_root() / 'scripts/qapi/introspect.py',
849 meson.source_root() / 'scripts/qapi/parser.py',
850 meson.source_root() / 'scripts/qapi/schema.py',
851 meson.source_root() / 'scripts/qapi/source.py',
852 meson.source_root() / 'scripts/qapi/types.py',
853 meson.source_root() / 'scripts/qapi/visit.py',
854 meson.source_root() / 'scripts/qapi/common.py',
a81df1b6
PB
855 meson.source_root() / 'scripts/qapi-gen.py'
856]
857
858tracetool = [
859 python, files('scripts/tracetool.py'),
860 '--backend=' + config_host['TRACE_BACKENDS']
861]
862
2c273f32
MAL
863qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
864 meson.current_source_dir(),
859aef02 865 config_host['PKGVERSION'], meson.project_version()]
2c273f32
MAL
866qemu_version = custom_target('qemu-version.h',
867 output: 'qemu-version.h',
868 command: qemu_version_cmd,
869 capture: true,
870 build_by_default: true,
871 build_always_stale: true)
872genh += qemu_version
873
3f885659
MAL
874hxdep = []
875hx_headers = [
876 ['qemu-options.hx', 'qemu-options.def'],
877 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
878]
879if have_system
880 hx_headers += [
881 ['hmp-commands.hx', 'hmp-commands.h'],
882 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
883 ]
884endif
885foreach d : hx_headers
b7c70bf2 886 hxdep += custom_target(d[1],
3f885659
MAL
887 input: files(d[0]),
888 output: d[1],
889 capture: true,
890 build_by_default: true, # to be removed when added to a target
891 command: [hxtool, '-h', '@INPUT0@'])
892endforeach
893genh += hxdep
894
eb937365
PM
895SPHINX_ARGS = [config_host['SPHINX_BUILD'],
896 '-Dversion=' + meson.project_version(),
897 '-Drelease=' + config_host['PKGVERSION']]
898
899if get_option('werror')
900 SPHINX_ARGS += [ '-W' ]
901endif
902
b3f4830a
PM
903sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
904 meson.source_root() / 'docs/sphinx/hxtool.py',
905 meson.source_root() / 'docs/sphinx/kerneldoc.py',
906 meson.source_root() / 'docs/sphinx/kernellog.py',
907 meson.source_root() / 'docs/sphinx/qapidoc.py',
908 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
909 qapi_gen_depends ]
910
a81df1b6
PB
911# Collect sourcesets.
912
913util_ss = ss.source_set()
914stub_ss = ss.source_set()
915trace_ss = ss.source_set()
3154fee4 916block_ss = ss.source_set()
4a96337d 917blockdev_ss = ss.source_set()
ff219dca 918qmp_ss = ss.source_set()
2becc36a
PB
919common_ss = ss.source_set()
920softmmu_ss = ss.source_set()
921user_ss = ss.source_set()
922bsd_user_ss = ss.source_set()
923linux_user_ss = ss.source_set()
924specific_ss = ss.source_set()
64ed6f92 925specific_fuzz_ss = ss.source_set()
2becc36a 926
3154fee4 927modules = {}
2becc36a
PB
928hw_arch = {}
929target_arch = {}
930target_softmmu_arch = {}
a81df1b6
PB
931
932###############
933# Trace files #
934###############
935
c9322ab5
MAL
936# TODO: add each directory to the subdirs from its own meson.build, once
937# we have those
a81df1b6
PB
938trace_events_subdirs = [
939 'accel/kvm',
940 'accel/tcg',
941 'crypto',
942 'monitor',
943]
944if have_user
945 trace_events_subdirs += [ 'linux-user' ]
946endif
947if have_block
948 trace_events_subdirs += [
949 'authz',
950 'block',
951 'io',
952 'nbd',
953 'scsi',
954 ]
955endif
956if have_system
957 trace_events_subdirs += [
958 'audio',
959 'backends',
960 'backends/tpm',
961 'chardev',
962 'hw/9pfs',
963 'hw/acpi',
964 'hw/alpha',
965 'hw/arm',
966 'hw/audio',
967 'hw/block',
968 'hw/block/dataplane',
969 'hw/char',
970 'hw/display',
971 'hw/dma',
972 'hw/hppa',
973 'hw/hyperv',
974 'hw/i2c',
975 'hw/i386',
976 'hw/i386/xen',
977 'hw/ide',
978 'hw/input',
979 'hw/intc',
980 'hw/isa',
981 'hw/mem',
982 'hw/mips',
983 'hw/misc',
984 'hw/misc/macio',
985 'hw/net',
986 'hw/nvram',
987 'hw/pci',
988 'hw/pci-host',
989 'hw/ppc',
990 'hw/rdma',
991 'hw/rdma/vmw',
992 'hw/rtc',
993 'hw/s390x',
994 'hw/scsi',
995 'hw/sd',
996 'hw/sparc',
997 'hw/sparc64',
998 'hw/ssi',
999 'hw/timer',
1000 'hw/tpm',
1001 'hw/usb',
1002 'hw/vfio',
1003 'hw/virtio',
1004 'hw/watchdog',
1005 'hw/xen',
1006 'hw/gpio',
a81df1b6
PB
1007 'migration',
1008 'net',
8b7a5507 1009 'softmmu',
a81df1b6
PB
1010 'ui',
1011 ]
1012endif
1013trace_events_subdirs += [
1014 'hw/core',
1015 'qapi',
1016 'qom',
1017 'target/arm',
1018 'target/hppa',
1019 'target/i386',
1020 'target/mips',
1021 'target/ppc',
1022 'target/riscv',
1023 'target/s390x',
1024 'target/sparc',
1025 'util',
1026]
1027
a81df1b6
PB
1028subdir('qapi')
1029subdir('qobject')
1030subdir('stubs')
1031subdir('trace')
1032subdir('util')
5582c58f
MAL
1033subdir('qom')
1034subdir('authz')
a81df1b6 1035subdir('crypto')
2d78b56e 1036subdir('ui')
a81df1b6 1037
3154fee4
MAL
1038
1039if enable_modules
1040 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1041 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1042endif
1043
a81df1b6
PB
1044# Build targets from sourcesets
1045
2becc36a 1046stub_ss = stub_ss.apply(config_all, strict: false)
a81df1b6
PB
1047
1048util_ss.add_all(trace_ss)
2becc36a 1049util_ss = util_ss.apply(config_all, strict: false)
a81df1b6
PB
1050libqemuutil = static_library('qemuutil',
1051 sources: util_ss.sources() + stub_ss.sources() + genh,
aa087962 1052 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
a81df1b6 1053qemuutil = declare_dependency(link_with: libqemuutil,
04c6f1e7 1054 sources: genh + version_res)
a81df1b6 1055
abff1abf
PB
1056decodetree = generator(find_program('scripts/decodetree.py'),
1057 output: 'decode-@BASENAME@.c.inc',
1058 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1059
478e943f 1060subdir('audio')
7fcfd456 1061subdir('io')
848e8ff6 1062subdir('chardev')
ec0d5893 1063subdir('fsdev')
abff1abf 1064subdir('libdecnumber')
d3b18480 1065subdir('target')
708eab42 1066subdir('dump')
ec0d5893 1067
5e5733e5
MAL
1068block_ss.add(files(
1069 'block.c',
1070 'blockjob.c',
1071 'job.c',
1072 'qemu-io-cmds.c',
1073))
1074block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1075
1076subdir('nbd')
1077subdir('scsi')
1078subdir('block')
1079
4a96337d
PB
1080blockdev_ss.add(files(
1081 'blockdev.c',
1082 'blockdev-nbd.c',
1083 'iothread.c',
1084 'job-qmp.c',
1085))
1086
1087# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1088# os-win32.c does not
1089blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1090softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1091
1092softmmu_ss.add_all(blockdev_ss)
1093softmmu_ss.add(files(
1094 'bootdevice.c',
1095 'dma-helpers.c',
1096 'qdev-monitor.c',
1097), sdl)
1098
1099softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1100softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1101softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1102
1103common_ss.add(files('cpus-common.c'))
1104
5d3ea0e1 1105subdir('softmmu')
c9322ab5 1106
c7c91a74 1107specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
c9322ab5
MAL
1108specific_ss.add(files('exec-vary.c'))
1109specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1110 'fpu/softfloat.c',
1111 'tcg/optimize.c',
1112 'tcg/tcg-common.c',
1113 'tcg/tcg-op-gvec.c',
1114 'tcg/tcg-op-vec.c',
1115 'tcg/tcg-op.c',
1116 'tcg/tcg.c',
1117))
1118specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1119
ab318051 1120subdir('backends')
c574e161 1121subdir('disas')
55166230 1122subdir('migration')
ff219dca 1123subdir('monitor')
cdaf0722 1124subdir('net')
17ef2af6 1125subdir('replay')
582ea95f 1126subdir('hw')
1a82878a 1127subdir('accel')
f556b4a1 1128subdir('plugins')
b309c321 1129subdir('bsd-user')
3a30446a
MAL
1130subdir('linux-user')
1131
b309c321
MAL
1132bsd_user_ss.add(files('gdbstub.c'))
1133specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1134
3a30446a
MAL
1135linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1136specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
5d3ea0e1 1137
a2ce7dbd
PB
1138# needed for fuzzing binaries
1139subdir('tests/qtest/libqos')
64ed6f92 1140subdir('tests/qtest/fuzz')
a2ce7dbd 1141
3154fee4
MAL
1142block_mods = []
1143softmmu_mods = []
1144foreach d, list : modules
1145 foreach m, module_ss : list
1146 if enable_modules and targetos != 'windows'
3e292c51 1147 module_ss = module_ss.apply(config_all, strict: false)
3154fee4
MAL
1148 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1149 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1150 if d == 'block'
1151 block_mods += sl
1152 else
1153 softmmu_mods += sl
1154 endif
1155 else
1156 if d == 'block'
1157 block_ss.add_all(module_ss)
1158 else
1159 softmmu_ss.add_all(module_ss)
1160 endif
1161 endif
1162 endforeach
1163endforeach
1164
1165nm = find_program('nm')
604f3e4e 1166undefsym = find_program('scripts/undefsym.py')
3154fee4
MAL
1167block_syms = custom_target('block.syms', output: 'block.syms',
1168 input: [libqemuutil, block_mods],
1169 capture: true,
1170 command: [undefsym, nm, '@INPUT@'])
1171qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1172 input: [libqemuutil, softmmu_mods],
1173 capture: true,
1174 command: [undefsym, nm, '@INPUT@'])
1175
5e5733e5
MAL
1176block_ss = block_ss.apply(config_host, strict: false)
1177libblock = static_library('block', block_ss.sources() + genh,
1178 dependencies: block_ss.dependencies(),
1179 link_depends: block_syms,
1180 name_suffix: 'fa',
1181 build_by_default: false)
1182
1183block = declare_dependency(link_whole: [libblock],
b7c70bf2
MAL
1184 link_args: '@block.syms',
1185 dependencies: [crypto, io])
5e5733e5 1186
ff219dca
PB
1187qmp_ss = qmp_ss.apply(config_host, strict: false)
1188libqmp = static_library('qmp', qmp_ss.sources() + genh,
1189 dependencies: qmp_ss.dependencies(),
1190 name_suffix: 'fa',
1191 build_by_default: false)
1192
1193qmp = declare_dependency(link_whole: [libqmp])
1194
3154fee4
MAL
1195foreach m : block_mods + softmmu_mods
1196 shared_module(m.name(),
1197 name_prefix: '',
1198 link_whole: m,
1199 install: true,
1200 install_dir: config_host['qemu_moddir'])
1201endforeach
1202
64ed6f92
PB
1203softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1204common_ss.add(qom, qemuutil)
1205
1206common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
2becc36a
PB
1207common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1208
1209common_all = common_ss.apply(config_all, strict: false)
1210common_all = static_library('common',
1211 build_by_default: false,
1212 sources: common_all.sources() + genh,
1213 dependencies: common_all.dependencies(),
1214 name_suffix: 'fa')
1215
c9322ab5
MAL
1216feature_to_c = find_program('scripts/feature_to_c.sh')
1217
fd5eef85 1218emulators = {}
2becc36a
PB
1219foreach target : target_dirs
1220 config_target = config_target_mak[target]
1221 target_name = config_target['TARGET_NAME']
1222 arch = config_target['TARGET_BASE_ARCH']
859aef02 1223 arch_srcs = [config_target_h[target]]
64ed6f92
PB
1224 arch_deps = []
1225 c_args = ['-DNEED_CPU_H',
1226 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1227 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
1228 link_args = []
2becc36a 1229
859aef02 1230 config_target += config_host
2becc36a
PB
1231 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1232 if targetos == 'linux'
1233 target_inc += include_directories('linux-headers', is_system: true)
1234 endif
1235 if target.endswith('-softmmu')
1236 qemu_target_name = 'qemu-system-' + target_name
1237 target_type='system'
abff1abf
PB
1238 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1239 arch_srcs += t.sources()
64ed6f92 1240 arch_deps += t.dependencies()
abff1abf 1241
2c44220d
MAL
1242 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1243 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1244 arch_srcs += hw.sources()
64ed6f92 1245 arch_deps += hw.dependencies()
2c44220d 1246
2becc36a 1247 arch_srcs += config_devices_h[target]
64ed6f92 1248 link_args += ['@block.syms', '@qemu.syms']
2becc36a 1249 else
3a30446a 1250 abi = config_target['TARGET_ABI_DIR']
2becc36a
PB
1251 target_type='user'
1252 qemu_target_name = 'qemu-' + target_name
1253 if 'CONFIG_LINUX_USER' in config_target
1254 base_dir = 'linux-user'
1255 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1256 else
1257 base_dir = 'bsd-user'
1258 endif
1259 target_inc += include_directories(
1260 base_dir,
3a30446a 1261 base_dir / abi,
2becc36a 1262 )
3a30446a
MAL
1263 if 'CONFIG_LINUX_USER' in config_target
1264 dir = base_dir / abi
1265 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1266 if config_target.has_key('TARGET_SYSTBL_ABI')
1267 arch_srcs += \
1268 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1269 extra_args : config_target['TARGET_SYSTBL_ABI'])
1270 endif
1271 endif
2becc36a
PB
1272 endif
1273
c9322ab5
MAL
1274 if 'TARGET_XML_FILES' in config_target
1275 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1276 output: target + '-gdbstub-xml.c',
1277 input: files(config_target['TARGET_XML_FILES'].split()),
1278 command: [feature_to_c, '@INPUT@'],
1279 capture: true)
1280 arch_srcs += gdbstub_xml
1281 endif
1282
abff1abf
PB
1283 t = target_arch[arch].apply(config_target, strict: false)
1284 arch_srcs += t.sources()
64ed6f92 1285 arch_deps += t.dependencies()
abff1abf 1286
2becc36a
PB
1287 target_common = common_ss.apply(config_target, strict: false)
1288 objects = common_all.extract_objects(target_common.sources())
64ed6f92 1289 deps = target_common.dependencies()
2becc36a 1290
2becc36a
PB
1291 target_specific = specific_ss.apply(config_target, strict: false)
1292 arch_srcs += target_specific.sources()
64ed6f92 1293 arch_deps += target_specific.dependencies()
2becc36a 1294
64ed6f92 1295 lib = static_library('qemu-' + target,
859aef02 1296 sources: arch_srcs + genh,
b7612f45 1297 dependencies: arch_deps,
2becc36a
PB
1298 objects: objects,
1299 include_directories: target_inc,
64ed6f92
PB
1300 c_args: c_args,
1301 build_by_default: false,
2becc36a 1302 name_suffix: 'fa')
64ed6f92
PB
1303
1304 if target.endswith('-softmmu')
1305 execs = [{
1306 'name': 'qemu-system-' + target_name,
1307 'gui': false,
1308 'sources': files('softmmu/main.c'),
1309 'dependencies': []
1310 }]
35be72ba 1311 if targetos == 'windows' and (sdl.found() or gtk.found())
64ed6f92
PB
1312 execs += [{
1313 'name': 'qemu-system-' + target_name + 'w',
1314 'gui': true,
1315 'sources': files('softmmu/main.c'),
1316 'dependencies': []
1317 }]
1318 endif
1319 if config_host.has_key('CONFIG_FUZZ')
1320 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1321 execs += [{
1322 'name': 'qemu-fuzz-' + target_name,
1323 'gui': false,
1324 'sources': specific_fuzz.sources(),
1325 'dependencies': specific_fuzz.dependencies(),
64ed6f92
PB
1326 }]
1327 endif
1328 else
1329 execs = [{
1330 'name': 'qemu-' + target_name,
1331 'gui': false,
1332 'sources': [],
1333 'dependencies': []
1334 }]
1335 endif
1336 foreach exe: execs
fd5eef85
PB
1337 emulators += {exe['name']:
1338 executable(exe['name'], exe['sources'],
64ed6f92
PB
1339 install: true,
1340 c_args: c_args,
1341 dependencies: arch_deps + deps + exe['dependencies'],
1342 objects: lib.extract_all_objects(recursive: true),
1343 link_language: link_language,
1344 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1345 link_args: link_args,
1346 gui_app: exe['gui'])
fd5eef85 1347 }
10e1d263
MAL
1348
1349 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1350 foreach stp: [
bd5f973a
SH
1351 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1352 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
10e1d263
MAL
1353 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1354 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1355 ]
bd5f973a 1356 custom_target(exe['name'] + stp['ext'],
10e1d263 1357 input: trace_events_all,
bd5f973a 1358 output: exe['name'] + stp['ext'],
10e1d263
MAL
1359 capture: true,
1360 install: stp['install'],
ab4c0996 1361 install_dir: qemu_datadir / '../systemtap/tapset',
10e1d263
MAL
1362 command: [
1363 tracetool, '--group=all', '--format=' + stp['fmt'],
1364 '--binary=' + stp['bin'],
1365 '--target-name=' + target_name,
1366 '--target-type=' + target_type,
1367 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1368 '@INPUT@',
1369 ])
1370 endforeach
1371 endif
64ed6f92 1372 endforeach
2becc36a
PB
1373endforeach
1374
931049b4 1375# Other build targets
897b5afa 1376
f556b4a1
PB
1377if 'CONFIG_PLUGIN' in config_host
1378 install_headers('include/qemu/qemu-plugin.h')
1379endif
1380
f15bff25
PB
1381if 'CONFIG_GUEST_AGENT' in config_host
1382 subdir('qga')
1383endif
1384
9755c94a
LV
1385# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1386# when we don't build tools or system
4113f4cf 1387if xkbcommon.found()
28742467
MAL
1388 # used for the update-keymaps target, so include rules even if !have_tools
1389 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1390 dependencies: [qemuutil, xkbcommon], install: have_tools)
1391endif
1392
931049b4 1393if have_tools
b7c70bf2
MAL
1394 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1395 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1396 qemu_io = executable('qemu-io', files('qemu-io.c'),
1397 dependencies: [block, qemuutil], install: true)
eb705985 1398 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
b7c70bf2 1399 dependencies: [block, qemuutil], install: true)
b7c70bf2 1400
7c58bb76 1401 subdir('storage-daemon')
a9c9727c 1402 subdir('contrib/rdmacm-mux')
1d7bb6ab 1403 subdir('contrib/elf2dmp')
a9c9727c 1404
157e7b13
MAL
1405 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1406 dependencies: qemuutil,
1407 install: true)
1408
931049b4
PB
1409 if 'CONFIG_VHOST_USER' in config_host
1410 subdir('contrib/libvhost-user')
2d7ac0af 1411 subdir('contrib/vhost-user-blk')
b7612f45 1412 subdir('contrib/vhost-user-gpu')
32fcc624 1413 subdir('contrib/vhost-user-input')
99650b62 1414 subdir('contrib/vhost-user-scsi')
931049b4 1415 endif
8f51e01c
MAL
1416
1417 if targetos == 'linux'
1418 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1419 dependencies: [qemuutil, libcap_ng],
1420 install: true,
1421 install_dir: get_option('libexecdir'))
897b5afa
MAL
1422
1423 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1424 dependencies: [authz, crypto, io, qom, qemuutil,
6ec0e15d 1425 libcap_ng, mpathpersist],
897b5afa 1426 install: true)
8f51e01c
MAL
1427 endif
1428
5ee24e78
MAL
1429 if 'CONFIG_IVSHMEM' in config_host
1430 subdir('contrib/ivshmem-client')
1431 subdir('contrib/ivshmem-server')
1432 endif
931049b4
PB
1433endif
1434
f5aa6320 1435subdir('scripts')
3f99cf57 1436subdir('tools')
bdcbea7a 1437subdir('pc-bios')
ce1c1e7a 1438subdir('tests')
f8aa24ea 1439subdir('docs')
e8f3bd71
MAL
1440if 'CONFIG_GTK' in config_host
1441 subdir('po')
1442endif
3f99cf57 1443
8adfeba9
MAL
1444if host_machine.system() == 'windows'
1445 nsis_cmd = [
1446 find_program('scripts/nsis.py'),
1447 '@OUTPUT@',
1448 get_option('prefix'),
1449 meson.current_source_dir(),
1450 host_machine.cpu_family(),
1451 '--',
1452 '-DDISPLAYVERSION=' + meson.project_version(),
1453 ]
1454 if build_docs
1455 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1456 endif
1457 if 'CONFIG_GTK' in config_host
1458 nsis_cmd += '-DCONFIG_GTK=y'
1459 endif
1460
1461 nsis = custom_target('nsis',
1462 output: 'qemu-setup-' + meson.project_version() + '.exe',
1463 input: files('qemu.nsi'),
1464 build_always_stale: true,
1465 command: nsis_cmd + ['@INPUT@'])
1466 alias_target('installer', nsis)
1467endif
1468
f9332757
PB
1469summary_info = {}
1470summary_info += {'Install prefix': config_host['prefix']}
1471summary_info += {'BIOS directory': config_host['qemu_datadir']}
1472summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1473summary_info += {'binary directory': config_host['bindir']}
1474summary_info += {'library directory': config_host['libdir']}
1475summary_info += {'module directory': config_host['qemu_moddir']}
1476summary_info += {'libexec directory': config_host['libexecdir']}
1477summary_info += {'include directory': config_host['includedir']}
1478summary_info += {'config directory': config_host['sysconfdir']}
1479if targetos != 'windows'
1480 summary_info += {'local state directory': config_host['qemu_localstatedir']}
b81efab7 1481 summary_info += {'Manual directory': get_option('mandir')}
f9332757
PB
1482else
1483 summary_info += {'local state directory': 'queried at runtime'}
1484endif
491e74c1 1485summary_info += {'Doc directory': get_option('docdir')}
f9332757
PB
1486summary_info += {'Build directory': meson.current_build_dir()}
1487summary_info += {'Source path': meson.current_source_dir()}
1488summary_info += {'GIT binary': config_host['GIT']}
1489summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1490summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1491summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1492if link_language == 'cpp'
1493 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1494else
1495 summary_info += {'C++ compiler': false}
1496endif
1497if targetos == 'darwin'
1498 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1499endif
1500summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1501summary_info += {'CFLAGS': config_host['CFLAGS']}
1502summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1503summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1504summary_info += {'make': config_host['MAKE']}
f9332757
PB
1505summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1506summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1507summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1508# TODO: add back version
1509summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1510if config_host.has_key('CONFIG_SLIRP')
1511 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1512endif
1513summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1514if config_host.has_key('CONFIG_MODULES')
1515 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1516endif
1517summary_info += {'host CPU': cpu}
1518summary_info += {'host endianness': build_machine.endian()}
1519summary_info += {'target list': config_host['TARGET_DIRS']}
1520summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1521summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1522summary_info += {'strip binaries': get_option('strip')}
1523summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
3e8529dd 1524summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
f9332757
PB
1525if targetos == 'darwin'
1526 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1527endif
1528# TODO: add back version
35be72ba
PB
1529summary_info += {'SDL support': sdl.found()}
1530summary_info += {'SDL image support': sdl_image.found()}
f9332757
PB
1531# TODO: add back version
1532summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1533summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
b7612f45 1534summary_info += {'pixman': pixman.found()}
f9332757
PB
1535# TODO: add back version
1536summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1537summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1538summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1539# TODO: add back version
1540summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1541if config_host.has_key('CONFIG_GCRYPT')
1542 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1543 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1544endif
1545# TODO: add back version
1546summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1547if config_host.has_key('CONFIG_NETTLE')
1548 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1549endif
1550summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1551summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1552summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1553summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1554# TODO: add back version
1555summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1556summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1557summary_info += {'mingw32 support': targetos == 'windows'}
1558summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1559summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1560summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1561summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
6ec0e15d 1562summary_info += {'Multipath support': mpathpersist.found()}
a0b93237
PB
1563summary_info += {'VNC support': vnc.found()}
1564if vnc.found()
1565 summary_info += {'VNC SASL support': sasl.found()}
1566 summary_info += {'VNC JPEG support': jpeg.found()}
1567 summary_info += {'VNC PNG support': png.found()}
f9332757
PB
1568endif
1569summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1570if config_host.has_key('CONFIG_XEN_BACKEND')
1571 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1572endif
1573summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1574summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1575summary_info += {'PIE': get_option('b_pie')}
1576summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1577summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1578summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1579summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1580summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1581summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
05512f55
PB
1582summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1583summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1584summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1585summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1586summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1587if config_all.has_key('CONFIG_TCG')
1588 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1589 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1590endif
aa087962 1591summary_info += {'malloc trim support': has_malloc_trim}
f9332757
PB
1592summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1593summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1594summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1595summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1596summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1597summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1598summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1599summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1600summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1601summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1602summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1603summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1604summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1605summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1606summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1607summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1608summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1609summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1610if config_host['TRACE_BACKENDS'].split().contains('simple')
1611 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1612endif
1613# TODO: add back protocol and server version
1614summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1615summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1616summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1617summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
0a40bcb7 1618summary_info += {'U2F support': u2f.found()}
f9332757
PB
1619summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1620summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1621summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1622summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1623summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1624summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1625summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1626if targetos == 'windows'
1627 if 'WIN_SDK' in config_host
1628 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1629 endif
1630 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1631 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
4bad7c3b 1632 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
f9332757
PB
1633endif
1634summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1635summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1636summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1637summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1638summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1639summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1640summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
bf0e56a3 1641summary_info += {'gcov': get_option('b_coverage')}
f9332757
PB
1642summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1643summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1644summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1645summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1646summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1647summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1648summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1649summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1650summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1651summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1652summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
aa087962 1653summary_info += {'memory allocator': get_option('malloc')}
f9332757
PB
1654summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1655summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1656summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1657summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1658summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1659summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1660summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1661summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1662summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1663summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1664summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1665summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
8b18cdbf 1666summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
f9332757
PB
1667summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1668summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
f01496a3 1669summary_info += {'libudev': libudev.found()}
f9332757
PB
1670summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1671summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1672summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1673if config_host.has_key('HAVE_GDB_BIN')
1674 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1675endif
1676summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1677summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1678summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1679summary(summary_info, bool_yn: true)
1680
1681if not supported_cpus.contains(cpu)
1682 message()
1683 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1684 message()
1685 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1686 message('The QEMU project intends to remove support for this host CPU in')
1687 message('a future release if nobody volunteers to maintain it and to')
1688 message('provide a build host for our continuous integration setup.')
1689 message('configure has succeeded and you can continue to build, but')
1690 message('if you care about QEMU on this platform you should contact')
1691 message('us upstream at qemu-devel@nongnu.org.')
1692endif
1693
1694if not supported_oses.contains(targetos)
1695 message()
1696 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1697 message()
1698 message('Host OS ' + targetos + 'support is not currently maintained.')
1699 message('The QEMU project intends to remove support for this host OS in')
1700 message('a future release if nobody volunteers to maintain it and to')
1701 message('provide a build host for our continuous integration setup.')
1702 message('configure has succeeded and you can continue to build, but')
1703 message('if you care about QEMU on this platform you should contact')
1704 message('us upstream at qemu-devel@nongnu.org.')
1705endif