Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-cap-20201003' into staging
[qemu/ar7.git] / meson.build
blob20f6ad774aec4c627a5c3fed4865ea1de637ac1e
1 project('qemu', ['c'], meson_version: '>=0.55.0',
2         default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
3                           'b_colorout=auto'],
4         version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
6 not_found = dependency('', required: false)
7 if meson.version().version_compare('>=0.56.0')
8   keyval = import('keyval')
9 else
10   keyval = import('unstable-keyval')
11 endif
12 ss = import('sourceset')
13 fs = import('fs')
15 sh = find_program('sh')
16 cc = meson.get_compiler('c')
17 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
18 enable_modules = 'CONFIG_MODULES' in config_host
19 enable_static = 'CONFIG_STATIC' in config_host
20 build_docs = 'BUILD_DOCS' in config_host
22 if get_option('qemu_suffix').startswith('/')
23   error('qemu_suffix cannot start with a /')
24 endif
26 qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
27 qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
28 config_host_data = configuration_data()
29 genh = []
31 target_dirs = config_host['TARGET_DIRS'].split()
32 have_user = false
33 have_system = false
34 foreach target : target_dirs
35   have_user = have_user or target.endswith('-user')
36   have_system = have_system or target.endswith('-softmmu')
37 endforeach
38 have_tools = 'CONFIG_TOOLS' in config_host
39 have_block = have_system or have_tools
41 python = import('python').find_installation()
43 supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
44 supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
45   'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
47 cpu = host_machine.cpu_family()
48 targetos = host_machine.system()
50 configure_file(input: files('scripts/ninjatool.py'),
51                output: 'ninjatool',
52                configuration: config_host)
54 ##################
55 # Compiler flags #
56 ##################
58 # Specify linker-script with add_project_link_arguments so that it is not placed
59 # within a linker --start-group/--end-group pair
60 if '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'])
64 endif
66 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
67                       native: false, language: ['c', 'objc'])
68 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
69                       native: false, language: 'cpp')
70 add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
71                            native: false, language: ['c', 'cpp', 'objc'])
72 add_project_arguments(config_host['QEMU_INCLUDES'].split(),
73                       language: ['c', 'cpp', 'objc'])
76 link_language = meson.get_external_property('link_language', 'cpp')
77 if link_language == 'cpp'
78   add_languages('cpp', required: true, native: false)
79 endif
80 if host_machine.system() == 'darwin'
81   add_languages('objc', required: false, native: false)
82 endif
84 if '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'])
89 endif
91 ###########################################
92 # Target-specific checks and dependencies #
93 ###########################################
95 if targetos != 'linux' and get_option('mpath').enabled()
96   error('Multipath is supported only on Linux')
97 endif
99 m = cc.find_library('m', required: false)
100 util = cc.find_library('util', required: false)
101 winmm = []
102 socket = []
103 version_res = []
104 coref = []
105 iokit = []
106 cocoa = not_found
107 hvf = []
108 if targetos == 'windows'
109   socket = cc.find_library('ws2_32')
110   winmm = cc.find_library('winmm')
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('.'))
116 elif targetos == 'darwin'
117   coref = dependency('appleframeworks', modules: 'CoreFoundation')
118   iokit = dependency('appleframeworks', modules: 'IOKit')
119   cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
120   hvf = dependency('appleframeworks', modules: 'Hypervisor')
121 elif targetos == 'sunos'
122   socket = [cc.find_library('socket'),
123             cc.find_library('nsl'),
124             cc.find_library('resolv')]
125 elif targetos == 'haiku'
126   socket = [cc.find_library('posix_error_mapper'),
127             cc.find_library('network'),
128             cc.find_library('bsd')]
129 endif
131 if not cocoa.found() and get_option('cocoa').enabled()
132   error('Cocoa not available on this platform')
133 endif
135 ################
136 # Dependencies #
137 ################
139 # The path to glib.h is added to all compilation commands.  This was
140 # grandfathered in from the QEMU Makefiles.
141 add_project_arguments(config_host['GLIB_CFLAGS'].split(),
142                       native: false, language: ['c', 'cpp', 'objc'])
143 glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
144 gio = not_found
145 if 'CONFIG_GIO' in config_host
146   gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
147                            link_args: config_host['GIO_LIBS'].split())
148 endif
149 lttng = not_found
150 if 'CONFIG_TRACE_UST' in config_host
151   lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
152 endif
153 urcubp = not_found
154 if 'CONFIG_TRACE_UST' in config_host
155   urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
156 endif
157 gcrypt = not_found
158 if 'CONFIG_GCRYPT' in config_host
159   gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
160                               link_args: config_host['GCRYPT_LIBS'].split())
161 endif
162 nettle = not_found
163 if 'CONFIG_NETTLE' in config_host
164   nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
165                               link_args: config_host['NETTLE_LIBS'].split())
166 endif
167 gnutls = not_found
168 if 'CONFIG_GNUTLS' in config_host
169   gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
170                               link_args: config_host['GNUTLS_LIBS'].split())
171 endif
172 pixman = not_found
173 if have_system or have_tools
174   pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
175                       method: 'pkg-config', static: enable_static)
176 endif
177 pam = not_found
178 if 'CONFIG_AUTH_PAM' in config_host
179   pam = cc.find_library('pam')
180 endif
181 libaio = cc.find_library('aio', required: false)
182 zlib = dependency('zlib', required: true, static: enable_static)
183 linux_io_uring = not_found
184 if '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())
187 endif
188 libxml2 = not_found
189 if 'CONFIG_LIBXML2' in config_host
190   libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
191                                link_args: config_host['LIBXML2_LIBS'].split())
192 endif
193 libnfs = not_found
194 if 'CONFIG_LIBNFS' in config_host
195   libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
196 endif
197 libattr = not_found
198 if 'CONFIG_ATTR' in config_host
199   libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
200 endif
201 seccomp = not_found
202 if 'CONFIG_SECCOMP' in config_host
203   seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
204                                link_args: config_host['SECCOMP_LIBS'].split())
205 endif
206 libcap_ng = not_found
207 if 'CONFIG_LIBCAP_NG' in config_host
208   libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
209 endif
210 if get_option('xkbcommon').auto() and not have_system and not have_tools
211   xkbcommon = not_found
212 else
213   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
214                          method: 'pkg-config', static: enable_static)
215 endif
216 slirp = not_found
217 if 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())
220 endif
221 vde = not_found
222 if config_host.has_key('CONFIG_VDE')
223   vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
224 endif
225 pulse = not_found
226 if 'CONFIG_LIBPULSE' in config_host
227   pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
228                              link_args: config_host['PULSE_LIBS'].split())
229 endif
230 alsa = not_found
231 if 'CONFIG_ALSA' in config_host
232   alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
233                             link_args: config_host['ALSA_LIBS'].split())
234 endif
235 jack = not_found
236 if 'CONFIG_LIBJACK' in config_host
237   jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
238 endif
239 spice = not_found
240 if 'CONFIG_SPICE' in config_host
241   spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
242                              link_args: config_host['SPICE_LIBS'].split())
243 endif
244 rt = cc.find_library('rt', required: false)
245 libdl = not_found
246 if 'CONFIG_PLUGIN' in config_host
247   libdl = cc.find_library('dl', required: true)
248 endif
249 libiscsi = not_found
250 if 'CONFIG_LIBISCSI' in config_host
251   libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
252                                 link_args: config_host['LIBISCSI_LIBS'].split())
253 endif
254 zstd = not_found
255 if 'CONFIG_ZSTD' in config_host
256   zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
257                             link_args: config_host['ZSTD_LIBS'].split())
258 endif
259 gbm = not_found
260 if 'CONFIG_GBM' in config_host
261   gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
262                            link_args: config_host['GBM_LIBS'].split())
263 endif
264 virgl = not_found
265 if 'CONFIG_VIRGL' in config_host
266   virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
267                              link_args: config_host['VIRGL_LIBS'].split())
268 endif
269 curl = not_found
270 if 'CONFIG_CURL' in config_host
271   curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
272                             link_args: config_host['CURL_LIBS'].split())
273 endif
274 libudev = not_found
275 if targetos == 'linux' and (have_system or have_tools)
276   libudev = dependency('libudev',
277                        required: get_option('mpath').enabled(),
278                        static: enable_static)
279 endif
281 mpathpersist = not_found
282 mpathpersist_new_api = false
283 if 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       }'''
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
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
343 endif
345 brlapi = not_found
346 if 'CONFIG_BRLAPI' in config_host
347   brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
348 endif
350 sdl = not_found
351 if have_system
352   sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
353   sdl_image = not_found
354 endif
355 if sdl.found()
356   # work around 2.0.8 bug
357   sdl = declare_dependency(compile_args: '-Wno-undef',
358                            dependencies: sdl)
359   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
360                          method: 'pkg-config', static: enable_static)
361 else
362   if get_option('sdl_image').enabled()
363     error('sdl-image required, but SDL was @0@'.format(
364           get_option('sdl').disabled() ? 'disabled' : 'not found'))
365   endif
366   sdl_image = not_found
367 endif
369 rbd = not_found
370 if 'CONFIG_RBD' in config_host
371   rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
372 endif
373 glusterfs = not_found
374 if 'CONFIG_GLUSTERFS' in config_host
375   glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
376                                  link_args: config_host['GLUSTERFS_LIBS'].split())
377 endif
378 libssh = not_found
379 if 'CONFIG_LIBSSH' in config_host
380   libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
381                               link_args: config_host['LIBSSH_LIBS'].split())
382 endif
383 libbzip2 = not_found
384 if 'CONFIG_BZIP2' in config_host
385   libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
386 endif
387 liblzfse = not_found
388 if 'CONFIG_LZFSE' in config_host
389   liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
390 endif
391 oss = not_found
392 if 'CONFIG_AUDIO_OSS' in config_host
393   oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
394 endif
395 dsound = not_found
396 if 'CONFIG_AUDIO_DSOUND' in config_host
397   dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
398 endif
399 coreaudio = not_found
400 if 'CONFIG_AUDIO_COREAUDIO' in config_host
401   coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
402 endif
403 opengl = not_found
404 if 'CONFIG_OPENGL' in config_host
405   opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
406                               link_args: config_host['OPENGL_LIBS'].split())
407 endif
408 gtk = not_found
409 if 'CONFIG_GTK' in config_host
410   gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
411                               link_args: config_host['GTK_LIBS'].split())
412 endif
413 vte = not_found
414 if 'CONFIG_VTE' in config_host
415   vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
416                            link_args: config_host['VTE_LIBS'].split())
417 endif
418 x11 = not_found
419 if 'CONFIG_X11' in config_host
420   x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
421                            link_args: config_host['X11_LIBS'].split())
422 endif
423 curses = not_found
424 if 'CONFIG_CURSES' in config_host
425   curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
426                               link_args: config_host['CURSES_LIBS'].split())
427 endif
428 iconv = not_found
429 if 'CONFIG_ICONV' in config_host
430   iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
431                              link_args: config_host['ICONV_LIBS'].split())
432 endif
433 vnc = not_found
434 png = not_found
435 jpeg = not_found
436 sasl = not_found
437 if get_option('vnc').enabled()
438   vnc = declare_dependency() # dummy dependency
439   png = dependency('libpng', required: get_option('vnc_png'),
440                    method: 'pkg-config', static: enable_static)
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
451 endif
452 fdt = not_found
453 if 'CONFIG_FDT' in config_host
454   fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
455                            link_args: config_host['FDT_LIBS'].split())
456 endif
457 snappy = not_found
458 if 'CONFIG_SNAPPY' in config_host
459   snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
460 endif
461 lzo = not_found
462 if 'CONFIG_LZO' in config_host
463   lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
464 endif
465 rdma = not_found
466 if 'CONFIG_RDMA' in config_host
467   rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
468 endif
469 numa = not_found
470 if 'CONFIG_NUMA' in config_host
471   numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
472 endif
473 xen = not_found
474 if '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())
477 endif
478 cacard = not_found
479 if 'CONFIG_SMARTCARD' in config_host
480   cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
481                               link_args: config_host['SMARTCARD_LIBS'].split())
482 endif
483 u2f = not_found
484 if have_system
485   u2f = dependency('u2f-emu', required: get_option('u2f'),
486                    method: 'pkg-config',
487                    static: enable_static)
488 endif
489 usbredir = not_found
490 if '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())
493 endif
494 libusb = not_found
495 if '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())
498 endif
499 libpmem = not_found
500 if 'CONFIG_LIBPMEM' in config_host
501   libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
502                                link_args: config_host['LIBPMEM_LIBS'].split())
503 endif
504 libdaxctl = not_found
505 if 'CONFIG_LIBDAXCTL' in config_host
506   libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
507 endif
508 tasn1 = not_found
509 if 'CONFIG_TASN1' in config_host
510   tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
511                              link_args: config_host['TASN1_LIBS'].split())
512 endif
513 keyutils = dependency('libkeyutils', required: false,
514                       method: 'pkg-config', static: enable_static)
516 has_gettid = cc.has_function('gettid')
518 # Malloc tests
520 malloc = []
521 if 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; }''')
526 else
527   has_malloc_trim = false
528   malloc = cc.find_library(get_option('malloc'), required: true)
529 endif
530 if 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
536 endif
538 # Create config-host.h
540 config_host_data.set('CONFIG_COCOA', cocoa.found())
541 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
542 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
543 config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
544 config_host_data.set('CONFIG_SDL', sdl.found())
545 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
546 config_host_data.set('CONFIG_VNC', vnc.found())
547 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
548 config_host_data.set('CONFIG_VNC_PNG', png.found())
549 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
550 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
551 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
552 config_host_data.set('CONFIG_GETTID', has_gettid)
553 config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
554 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
555 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
556 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
557 config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
559 arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
560 strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
561            'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
562            'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
563 foreach 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
579 endforeach
581 minikconf = find_program('scripts/minikconf.py')
582 config_all = {}
583 config_all_devices = {}
584 config_all_disas = {}
585 config_devices_mak_list = []
586 config_devices_h = {}
587 config_target_h = {}
588 config_target_mak = {}
590 disassemblers = {
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'],
614 if 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   }
620 endif
622 kconfig_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',
631   'CONFIG_VHOST_VDPA',
632   'CONFIG_VHOST_KERNEL',
633   'CONFIG_VIRTFS',
634   'CONFIG_LINUX',
635   'CONFIG_PVRDMA',
637 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
639 accel_symbols = [
640   'CONFIG_KVM',
641   'CONFIG_HAX',
642   'CONFIG_HVF',
643   'CONFIG_TCG',
644   'CONFIG_WHPX'
647 foreach target : target_dirs
648   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
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
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
675   foreach sym: accel_symbols
676     if config_target.has_key(sym)
677       config_all += { sym: 'y' }
678     endif
679   endforeach
680   config_target_h += {target: configure_file(output: target + '-config-target.h',
681                                                configuration: config_target_data)}
683   if target.endswith('-softmmu')
684     base_kconfig = []
685     foreach sym : kconfig_external_symbols
686       if sym in config_target or sym in config_host
687         base_kconfig += '@0@=y'.format(sym)
688       endif
689     endforeach
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])
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
706     config_devices_mak_list += config_devices_mak
707     config_devices_h += {target: configure_file(output: target + '-config-devices.h',
708                                                 configuration: config_devices_data)}
709     config_target += config_devices
710     config_all_devices += config_devices
711   endif
712   config_target_mak += {target: config_target}
713 endforeach
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.
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.
724 config_all += config_all_devices
725 config_all += config_host
726 config_all += config_all_disas
727 config_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,
734 # Submodules
736 capstone = not_found
737 capstone_opt = get_option('capstone')
738 if capstone_opt in ['enabled', 'auto', 'system']
739   have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile')
740   capstone = dependency('capstone', version: '>=4.0',
741                         static: enable_static, 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
751 endif
752 if capstone_opt == 'internal'
753   capstone_data = configuration_data()
754   capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1')
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   )
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
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
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
798   if 'CONFIG_S390_DIS' in config_all_disas
799     capstone_data.set('CAPSTONE_HAS_SYSZ', '1')
800     capstone_files += files(
801       'capstone/arch/SystemZ/SystemZDisassembler.c',
802       'capstone/arch/SystemZ/SystemZInstPrinter.c',
803       'capstone/arch/SystemZ/SystemZMapping.c',
804       'capstone/arch/SystemZ/SystemZModule.c',
805       'capstone/arch/SystemZ/SystemZMCTargetDesc.c'
806     )
807   endif
809   if 'CONFIG_I386_DIS' in config_all_disas
810     capstone_data.set('CAPSTONE_HAS_X86', 1)
811     capstone_files += files(
812       'capstone/arch/X86/X86Disassembler.c',
813       'capstone/arch/X86/X86DisassemblerDecoder.c',
814       'capstone/arch/X86/X86ATTInstPrinter.c',
815       'capstone/arch/X86/X86IntelInstPrinter.c',
816       'capstone/arch/X86/X86InstPrinterCommon.c',
817       'capstone/arch/X86/X86Mapping.c',
818       'capstone/arch/X86/X86Module.c'
819     )
820   endif
822   configure_file(output: 'capstone-defs.h', configuration: capstone_data)
824   capstone_cargs = [
825     # FIXME: There does not seem to be a way to completely replace the c_args
826     # that come from add_project_arguments() -- we can only add to them.
827     # So: disable all warnings with a big hammer.
828     '-Wno-error', '-w',
830     # Include all configuration defines via a header file, which will wind up
831     # as a dependency on the object file, and thus changes here will result
832     # in a rebuild.
833     '-include', 'capstone-defs.h'
834   ]
836   libcapstone = static_library('capstone',
837                                sources: capstone_files,
838                                c_args: capstone_cargs,
839                                include_directories: 'capstone/include')
840   capstone = declare_dependency(link_with: libcapstone,
841                                 include_directories: 'capstone/include/capstone')
842 endif
843 config_host_data.set('CONFIG_CAPSTONE', capstone.found())
845 genh += configure_file(output: 'config-host.h', configuration: config_host_data)
847 # Generators
849 hxtool = find_program('scripts/hxtool')
850 shaderinclude = find_program('scripts/shaderinclude.pl')
851 qapi_gen = find_program('scripts/qapi-gen.py')
852 qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
853                      meson.source_root() / 'scripts/qapi/commands.py',
854                      meson.source_root() / 'scripts/qapi/common.py',
855                      meson.source_root() / 'scripts/qapi/error.py',
856                      meson.source_root() / 'scripts/qapi/events.py',
857                      meson.source_root() / 'scripts/qapi/expr.py',
858                      meson.source_root() / 'scripts/qapi/gen.py',
859                      meson.source_root() / 'scripts/qapi/introspect.py',
860                      meson.source_root() / 'scripts/qapi/parser.py',
861                      meson.source_root() / 'scripts/qapi/schema.py',
862                      meson.source_root() / 'scripts/qapi/source.py',
863                      meson.source_root() / 'scripts/qapi/types.py',
864                      meson.source_root() / 'scripts/qapi/visit.py',
865                      meson.source_root() / 'scripts/qapi/common.py',
866                      meson.source_root() / 'scripts/qapi-gen.py'
869 tracetool = [
870   python, files('scripts/tracetool.py'),
871    '--backend=' + config_host['TRACE_BACKENDS']
874 qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
875                     meson.current_source_dir(),
876                     config_host['PKGVERSION'], meson.project_version()]
877 qemu_version = custom_target('qemu-version.h',
878                              output: 'qemu-version.h',
879                              command: qemu_version_cmd,
880                              capture: true,
881                              build_by_default: true,
882                              build_always_stale: true)
883 genh += qemu_version
885 hxdep = []
886 hx_headers = [
887   ['qemu-options.hx', 'qemu-options.def'],
888   ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
890 if have_system
891   hx_headers += [
892     ['hmp-commands.hx', 'hmp-commands.h'],
893     ['hmp-commands-info.hx', 'hmp-commands-info.h'],
894   ]
895 endif
896 foreach d : hx_headers
897   hxdep += custom_target(d[1],
898                 input: files(d[0]),
899                 output: d[1],
900                 capture: true,
901                 build_by_default: true, # to be removed when added to a target
902                 command: [hxtool, '-h', '@INPUT0@'])
903 endforeach
904 genh += hxdep
906 SPHINX_ARGS = [config_host['SPHINX_BUILD'],
907                '-Dversion=' + meson.project_version(),
908                '-Drelease=' + config_host['PKGVERSION']]
910 if get_option('werror')
911   SPHINX_ARGS += [ '-W' ]
912 endif
914 sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
915                         meson.source_root() / 'docs/sphinx/hxtool.py',
916                         meson.source_root() / 'docs/sphinx/kerneldoc.py',
917                         meson.source_root() / 'docs/sphinx/kernellog.py',
918                         meson.source_root() / 'docs/sphinx/qapidoc.py',
919                         meson.source_root() / 'docs/sphinx/qmp_lexer.py',
920                         qapi_gen_depends ]
922 # Collect sourcesets.
924 util_ss = ss.source_set()
925 stub_ss = ss.source_set()
926 trace_ss = ss.source_set()
927 block_ss = ss.source_set()
928 blockdev_ss = ss.source_set()
929 qmp_ss = ss.source_set()
930 common_ss = ss.source_set()
931 softmmu_ss = ss.source_set()
932 user_ss = ss.source_set()
933 bsd_user_ss = ss.source_set()
934 linux_user_ss = ss.source_set()
935 specific_ss = ss.source_set()
936 specific_fuzz_ss = ss.source_set()
938 modules = {}
939 hw_arch = {}
940 target_arch = {}
941 target_softmmu_arch = {}
943 ###############
944 # Trace files #
945 ###############
947 # TODO: add each directory to the subdirs from its own meson.build, once
948 # we have those
949 trace_events_subdirs = [
950   'accel/kvm',
951   'accel/tcg',
952   'crypto',
953   'monitor',
955 if have_user
956   trace_events_subdirs += [ 'linux-user' ]
957 endif
958 if have_block
959   trace_events_subdirs += [
960     'authz',
961     'block',
962     'io',
963     'nbd',
964     'scsi',
965   ]
966 endif
967 if have_system
968   trace_events_subdirs += [
969     'audio',
970     'backends',
971     'backends/tpm',
972     'chardev',
973     'hw/9pfs',
974     'hw/acpi',
975     'hw/alpha',
976     'hw/arm',
977     'hw/audio',
978     'hw/block',
979     'hw/block/dataplane',
980     'hw/char',
981     'hw/display',
982     'hw/dma',
983     'hw/hppa',
984     'hw/hyperv',
985     'hw/i2c',
986     'hw/i386',
987     'hw/i386/xen',
988     'hw/ide',
989     'hw/input',
990     'hw/intc',
991     'hw/isa',
992     'hw/mem',
993     'hw/mips',
994     'hw/misc',
995     'hw/misc/macio',
996     'hw/net',
997     'hw/nvram',
998     'hw/pci',
999     'hw/pci-host',
1000     'hw/ppc',
1001     'hw/rdma',
1002     'hw/rdma/vmw',
1003     'hw/rtc',
1004     'hw/s390x',
1005     'hw/scsi',
1006     'hw/sd',
1007     'hw/sparc',
1008     'hw/sparc64',
1009     'hw/ssi',
1010     'hw/timer',
1011     'hw/tpm',
1012     'hw/usb',
1013     'hw/vfio',
1014     'hw/virtio',
1015     'hw/watchdog',
1016     'hw/xen',
1017     'hw/gpio',
1018     'migration',
1019     'net',
1020     'softmmu',
1021     'ui',
1022   ]
1023 endif
1024 trace_events_subdirs += [
1025   'hw/core',
1026   'qapi',
1027   'qom',
1028   'target/arm',
1029   'target/hppa',
1030   'target/i386',
1031   'target/mips',
1032   'target/ppc',
1033   'target/riscv',
1034   'target/s390x',
1035   'target/sparc',
1036   'util',
1039 subdir('qapi')
1040 subdir('qobject')
1041 subdir('stubs')
1042 subdir('trace')
1043 subdir('util')
1044 subdir('qom')
1045 subdir('authz')
1046 subdir('crypto')
1047 subdir('ui')
1050 if enable_modules
1051   libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1052   modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1053 endif
1055 # Build targets from sourcesets
1057 stub_ss = stub_ss.apply(config_all, strict: false)
1059 util_ss.add_all(trace_ss)
1060 util_ss = util_ss.apply(config_all, strict: false)
1061 libqemuutil = static_library('qemuutil',
1062                              sources: util_ss.sources() + stub_ss.sources() + genh,
1063                              dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
1064 qemuutil = declare_dependency(link_with: libqemuutil,
1065                               sources: genh + version_res)
1067 decodetree = generator(find_program('scripts/decodetree.py'),
1068                        output: 'decode-@BASENAME@.c.inc',
1069                        arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1071 subdir('audio')
1072 subdir('io')
1073 subdir('chardev')
1074 subdir('fsdev')
1075 subdir('libdecnumber')
1076 subdir('target')
1077 subdir('dump')
1079 block_ss.add(files(
1080   'block.c',
1081   'blockdev-nbd.c',
1082   'blockjob.c',
1083   'job.c',
1084   'qemu-io-cmds.c',
1086 block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1088 subdir('nbd')
1089 subdir('scsi')
1090 subdir('block')
1092 blockdev_ss.add(files(
1093   'blockdev.c',
1094   'iothread.c',
1095   'job-qmp.c',
1098 # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1099 # os-win32.c does not
1100 blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1101 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1103 softmmu_ss.add_all(blockdev_ss)
1104 softmmu_ss.add(files(
1105   'bootdevice.c',
1106   'dma-helpers.c',
1107   'qdev-monitor.c',
1108 ), sdl)
1110 softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1111 softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1112 softmmu_ss.add(when: ['CONFIG_FDT', fdt],  if_true: [files('device_tree.c')])
1114 common_ss.add(files('cpus-common.c'))
1116 subdir('softmmu')
1118 common_ss.add(capstone)
1119 specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
1120 specific_ss.add(files('exec-vary.c'))
1121 specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1122   'fpu/softfloat.c',
1123   'tcg/optimize.c',
1124   'tcg/tcg-common.c',
1125   'tcg/tcg-op-gvec.c',
1126   'tcg/tcg-op-vec.c',
1127   'tcg/tcg-op.c',
1128   'tcg/tcg.c',
1130 specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1132 subdir('backends')
1133 subdir('disas')
1134 subdir('migration')
1135 subdir('monitor')
1136 subdir('net')
1137 subdir('replay')
1138 subdir('hw')
1139 subdir('accel')
1140 subdir('plugins')
1141 subdir('bsd-user')
1142 subdir('linux-user')
1144 bsd_user_ss.add(files('gdbstub.c'))
1145 specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1147 linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1148 specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
1150 # needed for fuzzing binaries
1151 subdir('tests/qtest/libqos')
1152 subdir('tests/qtest/fuzz')
1154 block_mods = []
1155 softmmu_mods = []
1156 foreach d, list : modules
1157   foreach m, module_ss : list
1158     if enable_modules and targetos != 'windows'
1159       module_ss = module_ss.apply(config_all, strict: false)
1160       sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1161                           dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1162       if d == 'block'
1163         block_mods += sl
1164       else
1165         softmmu_mods += sl
1166       endif
1167     else
1168       if d == 'block'
1169         block_ss.add_all(module_ss)
1170       else
1171         softmmu_ss.add_all(module_ss)
1172       endif
1173     endif
1174   endforeach
1175 endforeach
1177 nm = find_program('nm')
1178 undefsym = find_program('scripts/undefsym.py')
1179 block_syms = custom_target('block.syms', output: 'block.syms',
1180                              input: [libqemuutil, block_mods],
1181                              capture: true,
1182                              command: [undefsym, nm, '@INPUT@'])
1183 qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1184                              input: [libqemuutil, softmmu_mods],
1185                              capture: true,
1186                              command: [undefsym, nm, '@INPUT@'])
1188 block_ss = block_ss.apply(config_host, strict: false)
1189 libblock = static_library('block', block_ss.sources() + genh,
1190                           dependencies: block_ss.dependencies(),
1191                           link_depends: block_syms,
1192                           name_suffix: 'fa',
1193                           build_by_default: false)
1195 block = declare_dependency(link_whole: [libblock],
1196                            link_args: '@block.syms',
1197                            dependencies: [crypto, io])
1199 qmp_ss = qmp_ss.apply(config_host, strict: false)
1200 libqmp = static_library('qmp', qmp_ss.sources() + genh,
1201                         dependencies: qmp_ss.dependencies(),
1202                         name_suffix: 'fa',
1203                         build_by_default: false)
1205 qmp = declare_dependency(link_whole: [libqmp])
1207 foreach m : block_mods + softmmu_mods
1208   shared_module(m.name(),
1209                 name_prefix: '',
1210                 link_whole: m,
1211                 install: true,
1212                 install_dir: config_host['qemu_moddir'])
1213 endforeach
1215 softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1216 common_ss.add(qom, qemuutil)
1218 common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
1219 common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1221 common_all = common_ss.apply(config_all, strict: false)
1222 common_all = static_library('common',
1223                             build_by_default: false,
1224                             sources: common_all.sources() + genh,
1225                             dependencies: common_all.dependencies(),
1226                             name_suffix: 'fa')
1228 feature_to_c = find_program('scripts/feature_to_c.sh')
1230 emulators = {}
1231 foreach target : target_dirs
1232   config_target = config_target_mak[target]
1233   target_name = config_target['TARGET_NAME']
1234   arch = config_target['TARGET_BASE_ARCH']
1235   arch_srcs = [config_target_h[target]]
1236   arch_deps = []
1237   c_args = ['-DNEED_CPU_H',
1238             '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1239             '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
1240   link_args = []
1242   config_target += config_host
1243   target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1244   if targetos == 'linux'
1245     target_inc += include_directories('linux-headers', is_system: true)
1246   endif
1247   if target.endswith('-softmmu')
1248     qemu_target_name = 'qemu-system-' + target_name
1249     target_type='system'
1250     t = target_softmmu_arch[arch].apply(config_target, strict: false)
1251     arch_srcs += t.sources()
1252     arch_deps += t.dependencies()
1254     hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1255     hw = hw_arch[hw_dir].apply(config_target, strict: false)
1256     arch_srcs += hw.sources()
1257     arch_deps += hw.dependencies()
1259     arch_srcs += config_devices_h[target]
1260     link_args += ['@block.syms', '@qemu.syms']
1261   else
1262     abi = config_target['TARGET_ABI_DIR']
1263     target_type='user'
1264     qemu_target_name = 'qemu-' + target_name
1265     if 'CONFIG_LINUX_USER' in config_target
1266       base_dir = 'linux-user'
1267       target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1268     else
1269       base_dir = 'bsd-user'
1270     endif
1271     target_inc += include_directories(
1272       base_dir,
1273       base_dir / abi,
1274     )
1275     if 'CONFIG_LINUX_USER' in config_target
1276       dir = base_dir / abi
1277       arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1278       if config_target.has_key('TARGET_SYSTBL_ABI')
1279         arch_srcs += \
1280           syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1281                                              extra_args : config_target['TARGET_SYSTBL_ABI'])
1282       endif
1283     endif
1284   endif
1286   if 'TARGET_XML_FILES' in config_target
1287     gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1288                                 output: target + '-gdbstub-xml.c',
1289                                 input: files(config_target['TARGET_XML_FILES'].split()),
1290                                 command: [feature_to_c, '@INPUT@'],
1291                                 capture: true)
1292     arch_srcs += gdbstub_xml
1293   endif
1295   t = target_arch[arch].apply(config_target, strict: false)
1296   arch_srcs += t.sources()
1297   arch_deps += t.dependencies()
1299   target_common = common_ss.apply(config_target, strict: false)
1300   objects = common_all.extract_objects(target_common.sources())
1301   deps = target_common.dependencies()
1303   target_specific = specific_ss.apply(config_target, strict: false)
1304   arch_srcs += target_specific.sources()
1305   arch_deps += target_specific.dependencies()
1307   lib = static_library('qemu-' + target,
1308                  sources: arch_srcs + genh,
1309                  dependencies: arch_deps,
1310                  objects: objects,
1311                  include_directories: target_inc,
1312                  c_args: c_args,
1313                  build_by_default: false,
1314                  name_suffix: 'fa')
1316   if target.endswith('-softmmu')
1317     execs = [{
1318       'name': 'qemu-system-' + target_name,
1319       'gui': false,
1320       'sources': files('softmmu/main.c'),
1321       'dependencies': []
1322     }]
1323     if targetos == 'windows' and (sdl.found() or gtk.found())
1324       execs += [{
1325         'name': 'qemu-system-' + target_name + 'w',
1326         'gui': true,
1327         'sources': files('softmmu/main.c'),
1328         'dependencies': []
1329       }]
1330     endif
1331     if config_host.has_key('CONFIG_FUZZ')
1332       specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1333       execs += [{
1334         'name': 'qemu-fuzz-' + target_name,
1335         'gui': false,
1336         'sources': specific_fuzz.sources(),
1337         'dependencies': specific_fuzz.dependencies(),
1338       }]
1339     endif
1340   else
1341     execs = [{
1342       'name': 'qemu-' + target_name,
1343       'gui': false,
1344       'sources': [],
1345       'dependencies': []
1346     }]
1347   endif
1348   foreach exe: execs
1349     emulators += {exe['name']:
1350          executable(exe['name'], exe['sources'],
1351                install: true,
1352                c_args: c_args,
1353                dependencies: arch_deps + deps + exe['dependencies'],
1354                objects: lib.extract_all_objects(recursive: true),
1355                link_language: link_language,
1356                link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1357                link_args: link_args,
1358                gui_app: exe['gui'])
1359     }
1361     if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1362       foreach stp: [
1363         {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1364         {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
1365         {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1366         {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1367       ]
1368         custom_target(exe['name'] + stp['ext'],
1369                       input: trace_events_all,
1370                       output: exe['name'] + stp['ext'],
1371                       capture: true,
1372                       install: stp['install'],
1373                       install_dir: qemu_datadir / '../systemtap/tapset',
1374                       command: [
1375                         tracetool, '--group=all', '--format=' + stp['fmt'],
1376                         '--binary=' + stp['bin'],
1377                         '--target-name=' + target_name,
1378                         '--target-type=' + target_type,
1379                         '--probe-prefix=qemu.' + target_type + '.' + target_name,
1380                         '@INPUT@',
1381                       ])
1382       endforeach
1383     endif
1384   endforeach
1385 endforeach
1387 # Other build targets
1389 if 'CONFIG_PLUGIN' in config_host
1390   install_headers('include/qemu/qemu-plugin.h')
1391 endif
1393 if 'CONFIG_GUEST_AGENT' in config_host
1394   subdir('qga')
1395 endif
1397 # Don't build qemu-keymap if xkbcommon is not explicitly enabled
1398 # when we don't build tools or system
1399 if xkbcommon.found()
1400   # used for the update-keymaps target, so include rules even if !have_tools
1401   qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1402                            dependencies: [qemuutil, xkbcommon], install: have_tools)
1403 endif
1405 if have_tools
1406   qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1407              dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1408   qemu_io = executable('qemu-io', files('qemu-io.c'),
1409              dependencies: [block, qemuutil], install: true)
1410   qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
1411                dependencies: [block, qemuutil], install: true)
1413   subdir('storage-daemon')
1414   subdir('contrib/rdmacm-mux')
1415   subdir('contrib/elf2dmp')
1417   executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1418              dependencies: qemuutil,
1419              install: true)
1421   if 'CONFIG_VHOST_USER' in config_host
1422     subdir('contrib/libvhost-user')
1423     subdir('contrib/vhost-user-blk')
1424     subdir('contrib/vhost-user-gpu')
1425     subdir('contrib/vhost-user-input')
1426     subdir('contrib/vhost-user-scsi')
1427   endif
1429   if targetos == 'linux'
1430     executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1431                dependencies: [qemuutil, libcap_ng],
1432                install: true,
1433                install_dir: get_option('libexecdir'))
1435     executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1436                dependencies: [authz, crypto, io, qom, qemuutil,
1437                               libcap_ng, mpathpersist],
1438                install: true)
1439   endif
1441   if 'CONFIG_IVSHMEM' in config_host
1442     subdir('contrib/ivshmem-client')
1443     subdir('contrib/ivshmem-server')
1444   endif
1445 endif
1447 subdir('scripts')
1448 subdir('tools')
1449 subdir('pc-bios')
1450 subdir('tests')
1451 subdir('docs')
1452 if 'CONFIG_GTK' in config_host
1453   subdir('po')
1454 endif
1456 if host_machine.system() == 'windows'
1457   nsis_cmd = [
1458     find_program('scripts/nsis.py'),
1459     '@OUTPUT@',
1460     get_option('prefix'),
1461     meson.current_source_dir(),
1462     host_machine.cpu_family(),
1463     '--',
1464     '-DDISPLAYVERSION=' + meson.project_version(),
1465   ]
1466   if build_docs
1467     nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1468   endif
1469   if 'CONFIG_GTK' in config_host
1470     nsis_cmd += '-DCONFIG_GTK=y'
1471   endif
1473   nsis = custom_target('nsis',
1474                        output: 'qemu-setup-' + meson.project_version() + '.exe',
1475                        input: files('qemu.nsi'),
1476                        build_always_stale: true,
1477                        command: nsis_cmd + ['@INPUT@'])
1478   alias_target('installer', nsis)
1479 endif
1481 summary_info = {}
1482 summary_info += {'Install prefix':    config_host['prefix']}
1483 summary_info += {'BIOS directory':    config_host['qemu_datadir']}
1484 summary_info += {'firmware path':     config_host['qemu_firmwarepath']}
1485 summary_info += {'binary directory':  config_host['bindir']}
1486 summary_info += {'library directory': config_host['libdir']}
1487 summary_info += {'module directory':  config_host['qemu_moddir']}
1488 summary_info += {'libexec directory': config_host['libexecdir']}
1489 summary_info += {'include directory': config_host['includedir']}
1490 summary_info += {'config directory':  config_host['sysconfdir']}
1491 if targetos != 'windows'
1492   summary_info += {'local state directory': config_host['qemu_localstatedir']}
1493   summary_info += {'Manual directory':      get_option('mandir')}
1494 else
1495   summary_info += {'local state directory': 'queried at runtime'}
1496 endif
1497 summary_info += {'Doc directory':     get_option('docdir')}
1498 summary_info += {'Build directory':   meson.current_build_dir()}
1499 summary_info += {'Source path':       meson.current_source_dir()}
1500 summary_info += {'GIT binary':        config_host['GIT']}
1501 summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
1502 summary_info += {'C compiler':        meson.get_compiler('c').cmd_array()[0]}
1503 summary_info += {'Host C compiler':   meson.get_compiler('c', native: true).cmd_array()[0]}
1504 if link_language == 'cpp'
1505   summary_info += {'C++ compiler':      meson.get_compiler('cpp').cmd_array()[0]}
1506 else
1507   summary_info += {'C++ compiler':      false}
1508 endif
1509 if targetos == 'darwin'
1510   summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1511 endif
1512 summary_info += {'ARFLAGS':           config_host['ARFLAGS']}
1513 summary_info += {'CFLAGS':            config_host['CFLAGS']}
1514 summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
1515 summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
1516 summary_info += {'make':              config_host['MAKE']}
1517 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1518 summary_info += {'sphinx-build':      config_host['SPHINX_BUILD']}
1519 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
1520 # TODO: add back version
1521 summary_info += {'slirp support':     config_host.has_key('CONFIG_SLIRP')}
1522 if config_host.has_key('CONFIG_SLIRP')
1523   summary_info += {'smbd':            config_host['CONFIG_SMBD_COMMAND']}
1524 endif
1525 summary_info += {'module support':    config_host.has_key('CONFIG_MODULES')}
1526 if config_host.has_key('CONFIG_MODULES')
1527   summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1528 endif
1529 summary_info += {'host CPU':          cpu}
1530 summary_info += {'host endianness':   build_machine.endian()}
1531 summary_info += {'target list':       config_host['TARGET_DIRS']}
1532 summary_info += {'gprof enabled':     config_host.has_key('CONFIG_GPROF')}
1533 summary_info += {'sparse enabled':    meson.get_compiler('c').cmd_array().contains('cgcc')}
1534 summary_info += {'strip binaries':    get_option('strip')}
1535 summary_info += {'profiler':          config_host.has_key('CONFIG_PROFILER')}
1536 summary_info += {'static build':      config_host.has_key('CONFIG_STATIC')}
1537 if targetos == 'darwin'
1538   summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1539 endif
1540 # TODO: add back version
1541 summary_info += {'SDL support':       sdl.found()}
1542 summary_info += {'SDL image support': sdl_image.found()}
1543 # TODO: add back version
1544 summary_info += {'GTK support':       config_host.has_key('CONFIG_GTK')}
1545 summary_info += {'GTK GL support':    config_host.has_key('CONFIG_GTK_GL')}
1546 summary_info += {'pixman':            pixman.found()}
1547 # TODO: add back version
1548 summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
1549 summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
1550 summary_info += {'GNUTLS support':    config_host.has_key('CONFIG_GNUTLS')}
1551 # TODO: add back version
1552 summary_info += {'libgcrypt':         config_host.has_key('CONFIG_GCRYPT')}
1553 if config_host.has_key('CONFIG_GCRYPT')
1554    summary_info += {'  hmac':            config_host.has_key('CONFIG_GCRYPT_HMAC')}
1555    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1556 endif
1557 # TODO: add back version
1558 summary_info += {'nettle':            config_host.has_key('CONFIG_NETTLE')}
1559 if config_host.has_key('CONFIG_NETTLE')
1560    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1561 endif
1562 summary_info += {'libtasn1':          config_host.has_key('CONFIG_TASN1')}
1563 summary_info += {'PAM':               config_host.has_key('CONFIG_AUTH_PAM')}
1564 summary_info += {'iconv support':     config_host.has_key('CONFIG_ICONV')}
1565 summary_info += {'curses support':    config_host.has_key('CONFIG_CURSES')}
1566 # TODO: add back version
1567 summary_info += {'virgl support':     config_host.has_key('CONFIG_VIRGL')}
1568 summary_info += {'curl support':      config_host.has_key('CONFIG_CURL')}
1569 summary_info += {'mingw32 support':   targetos == 'windows'}
1570 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
1571 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1572 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1573 summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
1574 summary_info += {'Multipath support': mpathpersist.found()}
1575 summary_info += {'VNC support':       vnc.found()}
1576 if vnc.found()
1577   summary_info += {'VNC SASL support':  sasl.found()}
1578   summary_info += {'VNC JPEG support':  jpeg.found()}
1579   summary_info += {'VNC PNG support':   png.found()}
1580 endif
1581 summary_info += {'xen support':       config_host.has_key('CONFIG_XEN_BACKEND')}
1582 if config_host.has_key('CONFIG_XEN_BACKEND')
1583   summary_info += {'xen ctrl version':  config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1584 endif
1585 summary_info += {'brlapi support':    config_host.has_key('CONFIG_BRLAPI')}
1586 summary_info += {'Documentation':     config_host.has_key('BUILD_DOCS')}
1587 summary_info += {'PIE':               get_option('b_pie')}
1588 summary_info += {'vde support':       config_host.has_key('CONFIG_VDE')}
1589 summary_info += {'netmap support':    config_host.has_key('CONFIG_NETMAP')}
1590 summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1591 summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1592 summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1593 summary_info += {'Install blobs':     config_host.has_key('INSTALL_BLOBS')}
1594 summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
1595 summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
1596 summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
1597 summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
1598 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
1599 if config_all.has_key('CONFIG_TCG')
1600   summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1601   summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
1602 endif
1603 summary_info += {'malloc trim support': has_malloc_trim}
1604 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
1605 summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
1606 summary_info += {'fdt support':       config_host.has_key('CONFIG_FDT')}
1607 summary_info += {'membarrier':        config_host.has_key('CONFIG_MEMBARRIER')}
1608 summary_info += {'preadv support':    config_host.has_key('CONFIG_PREADV')}
1609 summary_info += {'fdatasync':         config_host.has_key('CONFIG_FDATASYNC')}
1610 summary_info += {'madvise':           config_host.has_key('CONFIG_MADVISE')}
1611 summary_info += {'posix_madvise':     config_host.has_key('CONFIG_POSIX_MADVISE')}
1612 summary_info += {'posix_memalign':    config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1613 summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1614 summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1615 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1616 summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1617 summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1618 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1619 summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1620 summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1621 summary_info += {'Trace backends':    config_host['TRACE_BACKENDS']}
1622 if config_host['TRACE_BACKENDS'].split().contains('simple')
1623   summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1624 endif
1625 # TODO: add back protocol and server version
1626 summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
1627 summary_info += {'rbd support':       config_host.has_key('CONFIG_RBD')}
1628 summary_info += {'xfsctl support':    config_host.has_key('CONFIG_XFS')}
1629 summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
1630 summary_info += {'U2F support':       u2f.found()}
1631 summary_info += {'libusb':            config_host.has_key('CONFIG_USB_LIBUSB')}
1632 summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
1633 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
1634 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
1635 summary_info += {'libiscsi support':  config_host.has_key('CONFIG_LIBISCSI')}
1636 summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
1637 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1638 if targetos == 'windows'
1639   if 'WIN_SDK' in config_host
1640     summary_info += {'Windows SDK':       config_host['WIN_SDK']}
1641   endif
1642   summary_info += {'QGA VSS support':   config_host.has_key('CONFIG_QGA_VSS')}
1643   summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
1644   summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI')}
1645 endif
1646 summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
1647 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1648 summary_info += {'coroutine pool':    config_host['CONFIG_COROUTINE_POOL'] == '1'}
1649 summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1650 summary_info += {'mutex debugging':   config_host.has_key('CONFIG_DEBUG_MUTEX')}
1651 summary_info += {'crypto afalg':      config_host.has_key('CONFIG_AF_ALG')}
1652 summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
1653 summary_info += {'gcov':              get_option('b_coverage')}
1654 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
1655 summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
1656 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1657 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1658 summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
1659 summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
1660 summary_info += {'bzip2 support':     config_host.has_key('CONFIG_BZIP2')}
1661 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
1662 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
1663 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1664 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
1665 summary_info += {'memory allocator':  get_option('malloc')}
1666 summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1667 summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1668 summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1669 summary_info += {'bochs support':     config_host.has_key('CONFIG_BOCHS')}
1670 summary_info += {'cloop support':     config_host.has_key('CONFIG_CLOOP')}
1671 summary_info += {'dmg support':       config_host.has_key('CONFIG_DMG')}
1672 summary_info += {'qcow v1 support':   config_host.has_key('CONFIG_QCOW1')}
1673 summary_info += {'vdi support':       config_host.has_key('CONFIG_VDI')}
1674 summary_info += {'vvfat support':     config_host.has_key('CONFIG_VVFAT')}
1675 summary_info += {'qed support':       config_host.has_key('CONFIG_QED')}
1676 summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1677 summary_info += {'sheepdog support':  config_host.has_key('CONFIG_SHEEPDOG')}
1678 summary_info += {'capstone':          capstone_opt == 'disabled' ? false : capstone_opt}
1679 summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
1680 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
1681 summary_info += {'libudev':           libudev.found()}
1682 summary_info += {'default devices':   config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1683 summary_info += {'plugin support':    config_host.has_key('CONFIG_PLUGIN')}
1684 summary_info += {'fuzzing support':   config_host.has_key('CONFIG_FUZZ')}
1685 if config_host.has_key('HAVE_GDB_BIN')
1686   summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
1687 endif
1688 summary_info += {'thread sanitizer':  config_host.has_key('CONFIG_TSAN')}
1689 summary_info += {'rng-none':          config_host.has_key('CONFIG_RNG_NONE')}
1690 summary_info += {'Linux keyring':     config_host.has_key('CONFIG_SECRET_KEYRING')}
1691 summary(summary_info, bool_yn: true)
1693 if not supported_cpus.contains(cpu)
1694   message()
1695   warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1696   message()
1697   message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1698   message('The QEMU project intends to remove support for this host CPU 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.')
1704 endif
1706 if not supported_oses.contains(targetos)
1707   message()
1708   warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1709   message()
1710   message('Host OS ' + targetos + 'support is not currently maintained.')
1711   message('The QEMU project intends to remove support for this host OS in')
1712   message('a future release if nobody volunteers to maintain it and to')
1713   message('provide a build host for our continuous integration setup.')
1714   message('configure has succeeded and you can continue to build, but')
1715   message('if you care about QEMU on this platform you should contact')
1716   message('us upstream at qemu-devel@nongnu.org.')
1717 endif