configure: move accelerator logic to meson
[qemu/kevin.git] / meson.build
blob43ce1272b9749f03fc7aab12eb0d0c5b479431de
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')
14 sh = find_program('sh')
15 cc = meson.get_compiler('c')
16 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
17 enable_modules = 'CONFIG_MODULES' in config_host
18 enable_static = 'CONFIG_STATIC' in config_host
19 build_docs = 'BUILD_DOCS' in config_host
21 if get_option('qemu_suffix').startswith('/')
22   error('qemu_suffix cannot start with a /')
23 endif
25 qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
26 qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
27 config_host_data = configuration_data()
28 genh = []
30 target_dirs = config_host['TARGET_DIRS'].split()
31 have_user = false
32 have_system = false
33 foreach target : target_dirs
34   have_user = have_user or target.endswith('-user')
35   have_system = have_system or target.endswith('-softmmu')
36 endforeach
37 have_tools = 'CONFIG_TOOLS' in config_host
38 have_block = have_system or have_tools
40 python = import('python').find_installation()
42 supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
43 supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
44   'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
46 cpu = host_machine.cpu_family()
47 targetos = host_machine.system()
49 configure_file(input: files('scripts/ninjatool.py'),
50                output: 'ninjatool',
51                configuration: config_host)
53 if cpu in ['x86', 'x86_64']
54   kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
55 elif cpu == 'aarch64'
56   kvm_targets = ['aarch64-softmmu']
57 elif cpu == 's390x'
58   kvm_targets = ['s390x-softmmu']
59 elif cpu in ['ppc', 'ppc64']
60   kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
61 else
62   kvm_targets = []
63 endif
65 accelerator_targets = { 'CONFIG_KVM': kvm_targets }
66 if cpu in ['x86', 'x86_64']
67   accelerator_targets += {
68     'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
69     'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
70     'CONFIG_HVF': ['x86_64-softmmu'],
71     'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
72   }
73 endif
75 ##################
76 # Compiler flags #
77 ##################
79 # Specify linker-script with add_project_link_arguments so that it is not placed
80 # within a linker --start-group/--end-group pair
81 if 'CONFIG_FUZZ' in config_host
82    add_project_link_arguments(['-Wl,-T,',
83                                (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
84                               native: false, language: ['c', 'cpp', 'objc'])
85 endif
87 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
88                       native: false, language: ['c', 'objc'])
89 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
90                       native: false, language: 'cpp')
91 add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
92                            native: false, language: ['c', 'cpp', 'objc'])
93 add_project_arguments(config_host['QEMU_INCLUDES'].split(),
94                       language: ['c', 'cpp', 'objc'])
97 link_language = meson.get_external_property('link_language', 'cpp')
98 if link_language == 'cpp'
99   add_languages('cpp', required: true, native: false)
100 endif
101 if host_machine.system() == 'darwin'
102   add_languages('objc', required: false, native: false)
103 endif
105 if 'SPARSE_CFLAGS' in config_host
106   run_target('sparse',
107              command: [find_program('scripts/check_sparse.py'),
108                        config_host['SPARSE_CFLAGS'].split(),
109                        'compile_commands.json'])
110 endif
112 ###########################################
113 # Target-specific checks and dependencies #
114 ###########################################
116 if targetos != 'linux' and get_option('mpath').enabled()
117   error('Multipath is supported only on Linux')
118 endif
120 m = cc.find_library('m', required: false)
121 util = cc.find_library('util', required: false)
122 winmm = []
123 socket = []
124 version_res = []
125 coref = []
126 iokit = []
127 cocoa = not_found
128 hvf = not_found
129 if targetos == 'windows'
130   socket = cc.find_library('ws2_32')
131   winmm = cc.find_library('winmm')
133   win = import('windows')
134   version_res = win.compile_resources('version.rc',
135                                       depend_files: files('pc-bios/qemu-nsis.ico'),
136                                       include_directories: include_directories('.'))
137 elif targetos == 'darwin'
138   coref = dependency('appleframeworks', modules: 'CoreFoundation')
139   iokit = dependency('appleframeworks', modules: 'IOKit')
140   cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
141 elif targetos == 'sunos'
142   socket = [cc.find_library('socket'),
143             cc.find_library('nsl'),
144             cc.find_library('resolv')]
145 elif targetos == 'haiku'
146   socket = [cc.find_library('posix_error_mapper'),
147             cc.find_library('network'),
148             cc.find_library('bsd')]
149 endif
151 accelerators = []
152 if not get_option('kvm').disabled() and targetos == 'linux'
153   accelerators += 'CONFIG_KVM'
154 endif
155 if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
156   accelerators += 'CONFIG_XEN'
157   have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
158 else
159   have_xen_pci_passthrough = false
160 endif
161 if not get_option('whpx').disabled() and targetos == 'windows'
162   if get_option('whpx').enabled() and cpu != 'x86_64'
163     error('WHPX requires 64-bit host')
164   elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
165        cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
166     accelerators += 'CONFIG_WHPX'
167   endif
168 endif
169 if not get_option('hvf').disabled()
170   hvf = dependency('appleframeworks', modules: 'Hypervisor',
171                    required: get_option('hvf'))
172   if hvf.found()
173     accelerators += 'CONFIG_HVF'
174   endif
175 endif
176 if not get_option('hax').disabled()
177   if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
178     accelerators += 'CONFIG_HAX'
179   endif
180 endif
181 if not get_option('tcg').disabled()
182   if cpu not in supported_cpus
183     if 'CONFIG_TCG_INTERPRETER' in config_host
184       warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
185     else
186       error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
187     endif
188   endif
189   accelerators += 'CONFIG_TCG'
190   config_host += { 'CONFIG_TCG': 'y' }
191 endif
193 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
194   error('KVM not available on this platform')
195 endif
196 if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
197   error('HVF not available on this platform')
198 endif
199 if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
200   error('WHPX not available on this platform')
201 endif
202 if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
203   if 'CONFIG_XEN' in accelerators
204     error('Xen PCI passthrough not available on this platform')
205   else
206     error('Xen PCI passthrough requested but Xen not enabled')
207   endif
208 endif
209 if not cocoa.found() and get_option('cocoa').enabled()
210   error('Cocoa not available on this platform')
211 endif
213 ################
214 # Dependencies #
215 ################
217 # The path to glib.h is added to all compilation commands.  This was
218 # grandfathered in from the QEMU Makefiles.
219 add_project_arguments(config_host['GLIB_CFLAGS'].split(),
220                       native: false, language: ['c', 'cpp', 'objc'])
221 glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
222 gio = not_found
223 if 'CONFIG_GIO' in config_host
224   gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
225                            link_args: config_host['GIO_LIBS'].split())
226 endif
227 lttng = not_found
228 if 'CONFIG_TRACE_UST' in config_host
229   lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
230 endif
231 urcubp = not_found
232 if 'CONFIG_TRACE_UST' in config_host
233   urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
234 endif
235 gcrypt = not_found
236 if 'CONFIG_GCRYPT' in config_host
237   gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
238                               link_args: config_host['GCRYPT_LIBS'].split())
239 endif
240 nettle = not_found
241 if 'CONFIG_NETTLE' in config_host
242   nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
243                               link_args: config_host['NETTLE_LIBS'].split())
244 endif
245 gnutls = not_found
246 if 'CONFIG_GNUTLS' in config_host
247   gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
248                               link_args: config_host['GNUTLS_LIBS'].split())
249 endif
250 pixman = not_found
251 if have_system or have_tools
252   pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
253                       method: 'pkg-config', static: enable_static)
254 endif
255 pam = not_found
256 if 'CONFIG_AUTH_PAM' in config_host
257   pam = cc.find_library('pam')
258 endif
259 libaio = cc.find_library('aio', required: false)
260 zlib = dependency('zlib', required: true, static: enable_static)
261 linux_io_uring = not_found
262 if 'CONFIG_LINUX_IO_URING' in config_host
263   linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
264                                       link_args: config_host['LINUX_IO_URING_LIBS'].split())
265 endif
266 libxml2 = not_found
267 if 'CONFIG_LIBXML2' in config_host
268   libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
269                                link_args: config_host['LIBXML2_LIBS'].split())
270 endif
271 libnfs = not_found
272 if 'CONFIG_LIBNFS' in config_host
273   libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
274 endif
275 libattr = not_found
276 if 'CONFIG_ATTR' in config_host
277   libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
278 endif
279 seccomp = not_found
280 if 'CONFIG_SECCOMP' in config_host
281   seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
282                                link_args: config_host['SECCOMP_LIBS'].split())
283 endif
284 libcap_ng = not_found
285 if 'CONFIG_LIBCAP_NG' in config_host
286   libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
287 endif
288 if get_option('xkbcommon').auto() and not have_system and not have_tools
289   xkbcommon = not_found
290 else
291   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
292                          method: 'pkg-config', static: enable_static)
293 endif
294 slirp = not_found
295 if config_host.has_key('CONFIG_SLIRP')
296   slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
297                              link_args: config_host['SLIRP_LIBS'].split())
298 endif
299 vde = not_found
300 if config_host.has_key('CONFIG_VDE')
301   vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
302 endif
303 pulse = not_found
304 if 'CONFIG_LIBPULSE' in config_host
305   pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
306                              link_args: config_host['PULSE_LIBS'].split())
307 endif
308 alsa = not_found
309 if 'CONFIG_ALSA' in config_host
310   alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
311                             link_args: config_host['ALSA_LIBS'].split())
312 endif
313 jack = not_found
314 if 'CONFIG_LIBJACK' in config_host
315   jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
316 endif
317 spice = not_found
318 if 'CONFIG_SPICE' in config_host
319   spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
320                              link_args: config_host['SPICE_LIBS'].split())
321 endif
322 rt = cc.find_library('rt', required: false)
323 libdl = not_found
324 if 'CONFIG_PLUGIN' in config_host
325   libdl = cc.find_library('dl', required: true)
326 endif
327 libiscsi = not_found
328 if 'CONFIG_LIBISCSI' in config_host
329   libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
330                                 link_args: config_host['LIBISCSI_LIBS'].split())
331 endif
332 zstd = not_found
333 if 'CONFIG_ZSTD' in config_host
334   zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
335                             link_args: config_host['ZSTD_LIBS'].split())
336 endif
337 gbm = not_found
338 if 'CONFIG_GBM' in config_host
339   gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
340                            link_args: config_host['GBM_LIBS'].split())
341 endif
342 virgl = not_found
343 if 'CONFIG_VIRGL' in config_host
344   virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
345                              link_args: config_host['VIRGL_LIBS'].split())
346 endif
347 curl = not_found
348 if 'CONFIG_CURL' in config_host
349   curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
350                             link_args: config_host['CURL_LIBS'].split())
351 endif
352 libudev = not_found
353 if targetos == 'linux' and (have_system or have_tools)
354   libudev = dependency('libudev',
355                        required: get_option('mpath').enabled(),
356                        static: enable_static)
357 endif
359 mpathpersist = not_found
360 mpathpersist_new_api = false
361 if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
362   mpath_test_source_new = '''
363     #include <libudev.h>
364     #include <mpath_persist.h>
365     unsigned mpath_mx_alloc_len = 1024;
366     int logsink;
367     static struct config *multipath_conf;
368     extern struct udev *udev;
369     extern struct config *get_multipath_config(void);
370     extern void put_multipath_config(struct config *conf);
371     struct udev *udev;
372     struct config *get_multipath_config(void) { return multipath_conf; }
373     void put_multipath_config(struct config *conf) { }
374     int main(void) {
375         udev = udev_new();
376         multipath_conf = mpath_lib_init();
377         return 0;
378     }'''
379   mpath_test_source_old = '''
380       #include <libudev.h>
381       #include <mpath_persist.h>
382       unsigned mpath_mx_alloc_len = 1024;
383       int logsink;
384       int main(void) {
385           struct udev *udev = udev_new();
386           mpath_lib_init(udev);
387           return 0;
388       }'''
389   mpathlibs = [libudev]
390   if enable_static
391     mpathlibs += cc.find_library('devmapper',
392                                    required: get_option('mpath'),
393                                    static: enable_static)
394   endif
395   mpathlibs += cc.find_library('multipath',
396                                required: get_option('mpath'),
397                                static: enable_static)
398   mpathlibs += cc.find_library('mpathpersist',
399                                required: get_option('mpath'),
400                                static: enable_static)
401   foreach lib: mpathlibs
402     if not lib.found()
403       mpathlibs = []
404       break
405     endif
406   endforeach
407   if mpathlibs.length() > 0
408     if cc.links(mpath_test_source_new, dependencies: mpathlibs)
409       mpathpersist = declare_dependency(dependencies: mpathlibs)
410       mpathpersist_new_api = true
411     elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
412       mpathpersist = declare_dependency(dependencies: mpathlibs)
413     else
414       if get_option('mpath').enabled()
415         error('Cannot detect libmpathpersist API')
416       else
417         warning('Cannot detect libmpathpersist API, disabling')
418       endif
419     endif
420   endif
421 endif
423 brlapi = not_found
424 if 'CONFIG_BRLAPI' in config_host
425   brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
426 endif
428 sdl = not_found
429 if have_system
430   sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
431   sdl_image = not_found
432 endif
433 if sdl.found()
434   # work around 2.0.8 bug
435   sdl = declare_dependency(compile_args: '-Wno-undef',
436                            dependencies: sdl)
437   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
438                          method: 'pkg-config', static: enable_static)
439 else
440   if get_option('sdl_image').enabled()
441     error('sdl-image required, but SDL was @0@'.format(
442           get_option('sdl').disabled() ? 'disabled' : 'not found'))
443   endif
444   sdl_image = not_found
445 endif
447 rbd = not_found
448 if 'CONFIG_RBD' in config_host
449   rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
450 endif
451 glusterfs = not_found
452 if 'CONFIG_GLUSTERFS' in config_host
453   glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
454                                  link_args: config_host['GLUSTERFS_LIBS'].split())
455 endif
456 libssh = not_found
457 if 'CONFIG_LIBSSH' in config_host
458   libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
459                               link_args: config_host['LIBSSH_LIBS'].split())
460 endif
461 libbzip2 = not_found
462 if 'CONFIG_BZIP2' in config_host
463   libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
464 endif
465 liblzfse = not_found
466 if 'CONFIG_LZFSE' in config_host
467   liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
468 endif
469 oss = not_found
470 if 'CONFIG_AUDIO_OSS' in config_host
471   oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
472 endif
473 dsound = not_found
474 if 'CONFIG_AUDIO_DSOUND' in config_host
475   dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
476 endif
477 coreaudio = not_found
478 if 'CONFIG_AUDIO_COREAUDIO' in config_host
479   coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
480 endif
481 opengl = not_found
482 if 'CONFIG_OPENGL' in config_host
483   opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
484                               link_args: config_host['OPENGL_LIBS'].split())
485 endif
486 gtk = not_found
487 if 'CONFIG_GTK' in config_host
488   gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
489                               link_args: config_host['GTK_LIBS'].split())
490 endif
491 vte = not_found
492 if 'CONFIG_VTE' in config_host
493   vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
494                            link_args: config_host['VTE_LIBS'].split())
495 endif
496 x11 = not_found
497 if 'CONFIG_X11' in config_host
498   x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
499                            link_args: config_host['X11_LIBS'].split())
500 endif
501 curses = not_found
502 if 'CONFIG_CURSES' in config_host
503   curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
504                               link_args: config_host['CURSES_LIBS'].split())
505 endif
506 iconv = not_found
507 if 'CONFIG_ICONV' in config_host
508   iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
509                              link_args: config_host['ICONV_LIBS'].split())
510 endif
511 vnc = not_found
512 png = not_found
513 jpeg = not_found
514 sasl = not_found
515 if get_option('vnc').enabled()
516   vnc = declare_dependency() # dummy dependency
517   png = dependency('libpng', required: get_option('vnc_png'),
518                    method: 'pkg-config', static: enable_static)
519   jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
520                          required: get_option('vnc_jpeg'),
521                          static: enable_static)
522   sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
523                          required: get_option('vnc_sasl'),
524                          static: enable_static)
525   if sasl.found()
526     sasl = declare_dependency(dependencies: sasl,
527                               compile_args: '-DSTRUCT_IOVEC_DEFINED')
528   endif
529 endif
530 fdt = not_found
531 if 'CONFIG_FDT' in config_host
532   fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
533                            link_args: config_host['FDT_LIBS'].split())
534 endif
535 snappy = not_found
536 if 'CONFIG_SNAPPY' in config_host
537   snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
538 endif
539 lzo = not_found
540 if 'CONFIG_LZO' in config_host
541   lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
542 endif
543 rdma = not_found
544 if 'CONFIG_RDMA' in config_host
545   rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
546 endif
547 numa = not_found
548 if 'CONFIG_NUMA' in config_host
549   numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
550 endif
551 xen = not_found
552 if 'CONFIG_XEN_BACKEND' in config_host
553   xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
554                            link_args: config_host['XEN_LIBS'].split())
555 endif
556 cacard = not_found
557 if 'CONFIG_SMARTCARD' in config_host
558   cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
559                               link_args: config_host['SMARTCARD_LIBS'].split())
560 endif
561 u2f = not_found
562 if have_system
563   u2f = dependency('u2f-emu', required: get_option('u2f'),
564                    method: 'pkg-config',
565                    static: enable_static)
566 endif
567 usbredir = not_found
568 if 'CONFIG_USB_REDIR' in config_host
569   usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
570                                 link_args: config_host['USB_REDIR_LIBS'].split())
571 endif
572 libusb = not_found
573 if 'CONFIG_USB_LIBUSB' in config_host
574   libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
575                               link_args: config_host['LIBUSB_LIBS'].split())
576 endif
577 capstone = not_found
578 if 'CONFIG_CAPSTONE' in config_host
579   capstone = declare_dependency(compile_args: config_host['CAPSTONE_CFLAGS'].split(),
580                                 link_args: config_host['CAPSTONE_LIBS'].split())
581 endif
582 libpmem = not_found
583 if 'CONFIG_LIBPMEM' in config_host
584   libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
585                                link_args: config_host['LIBPMEM_LIBS'].split())
586 endif
587 libdaxctl = not_found
588 if 'CONFIG_LIBDAXCTL' in config_host
589   libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
590 endif
591 tasn1 = not_found
592 if 'CONFIG_TASN1' in config_host
593   tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
594                              link_args: config_host['TASN1_LIBS'].split())
595 endif
596 keyutils = dependency('libkeyutils', required: false,
597                       method: 'pkg-config', static: enable_static)
599 has_gettid = cc.has_function('gettid')
601 # Malloc tests
603 malloc = []
604 if get_option('malloc') == 'system'
605   has_malloc_trim = \
606     not get_option('malloc_trim').disabled() and \
607     cc.links('''#include <malloc.h>
608                 int main(void) { malloc_trim(0); return 0; }''')
609 else
610   has_malloc_trim = false
611   malloc = cc.find_library(get_option('malloc'), required: true)
612 endif
613 if not has_malloc_trim and get_option('malloc_trim').enabled()
614   if get_option('malloc') == 'system'
615     error('malloc_trim not available on this platform.')
616   else
617     error('malloc_trim not available with non-libc memory allocator')
618   endif
619 endif
621 # Create config-host.h
623 config_host_data.set('CONFIG_COCOA', cocoa.found())
624 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
625 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
626 config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
627 config_host_data.set('CONFIG_SDL', sdl.found())
628 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
629 config_host_data.set('CONFIG_VNC', vnc.found())
630 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
631 config_host_data.set('CONFIG_VNC_PNG', png.found())
632 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
633 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
634 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
635 config_host_data.set('CONFIG_GETTID', has_gettid)
636 config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
637 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
638 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
639 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
640 config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
642 arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
643 strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
644            'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
645            'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
646 foreach k, v: config_host
647   if arrays.contains(k)
648     if v != ''
649       v = '"' + '", "'.join(v.split()) + '", '
650     endif
651     config_host_data.set(k, v)
652   elif k == 'ARCH'
653     config_host_data.set('HOST_' + v.to_upper(), 1)
654   elif strings.contains(k)
655     if not k.startswith('CONFIG_')
656       k = 'CONFIG_' + k.to_upper()
657     endif
658     config_host_data.set_quoted(k, v)
659   elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
660     config_host_data.set(k, v == 'y' ? 1 : v)
661   endif
662 endforeach
663 genh += configure_file(output: 'config-host.h', configuration: config_host_data)
665 minikconf = find_program('scripts/minikconf.py')
666 config_all = {}
667 config_all_devices = {}
668 config_all_disas = {}
669 config_devices_mak_list = []
670 config_devices_h = {}
671 config_target_h = {}
672 config_target_mak = {}
674 disassemblers = {
675   'alpha' : ['CONFIG_ALPHA_DIS'],
676   'arm' : ['CONFIG_ARM_DIS'],
677   'avr' : ['CONFIG_AVR_DIS'],
678   'cris' : ['CONFIG_CRIS_DIS'],
679   'hppa' : ['CONFIG_HPPA_DIS'],
680   'i386' : ['CONFIG_I386_DIS'],
681   'x86_64' : ['CONFIG_I386_DIS'],
682   'x32' : ['CONFIG_I386_DIS'],
683   'lm32' : ['CONFIG_LM32_DIS'],
684   'm68k' : ['CONFIG_M68K_DIS'],
685   'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
686   'mips' : ['CONFIG_MIPS_DIS'],
687   'moxie' : ['CONFIG_MOXIE_DIS'],
688   'nios2' : ['CONFIG_NIOS2_DIS'],
689   'or1k' : ['CONFIG_OPENRISC_DIS'],
690   'ppc' : ['CONFIG_PPC_DIS'],
691   'riscv' : ['CONFIG_RISCV_DIS'],
692   'rx' : ['CONFIG_RX_DIS'],
693   's390' : ['CONFIG_S390_DIS'],
694   'sh4' : ['CONFIG_SH4_DIS'],
695   'sparc' : ['CONFIG_SPARC_DIS'],
696   'xtensa' : ['CONFIG_XTENSA_DIS'],
698 if link_language == 'cpp'
699   disassemblers += {
700     'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
701     'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
702     'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
703   }
704 endif
706 kconfig_external_symbols = [
707   'CONFIG_KVM',
708   'CONFIG_XEN',
709   'CONFIG_TPM',
710   'CONFIG_SPICE',
711   'CONFIG_IVSHMEM',
712   'CONFIG_OPENGL',
713   'CONFIG_X11',
714   'CONFIG_VHOST_USER',
715   'CONFIG_VHOST_VDPA',
716   'CONFIG_VHOST_KERNEL',
717   'CONFIG_VIRTFS',
718   'CONFIG_LINUX',
719   'CONFIG_PVRDMA',
721 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
723 foreach target : target_dirs
724   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
726   have_accel = false
727   foreach sym: accelerators
728     if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
729       config_target += { sym: 'y' }
730       config_all += { sym: 'y' }
731       if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
732         config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
733       endif
734       have_accel = true
735     endif
736   endforeach
737   assert(have_accel)
739   foreach k, v: disassemblers
740     if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
741       foreach sym: v
742         config_target += { sym: 'y' }
743         config_all_disas += { sym: 'y' }
744       endforeach
745     endif
746   endforeach
748   config_target_data = configuration_data()
749   foreach k, v: config_target
750     if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
751       # do nothing
752     elif ignored.contains(k)
753       # do nothing
754     elif k == 'TARGET_BASE_ARCH'
755       config_target_data.set('TARGET_' + v.to_upper(), 1)
756     elif k == 'TARGET_NAME'
757       config_target_data.set_quoted(k, v)
758     elif v == 'y'
759       config_target_data.set(k, 1)
760     else
761       config_target_data.set(k, v)
762     endif
763   endforeach
764   config_target_h += {target: configure_file(output: target + '-config-target.h',
765                                                configuration: config_target_data)}
767   if target.endswith('-softmmu')
768     base_kconfig = []
769     foreach sym : kconfig_external_symbols
770       if sym in config_target or sym in config_host
771         base_kconfig += '@0@=y'.format(sym)
772       endif
773     endforeach
775     config_devices_mak = target + '-config-devices.mak'
776     config_devices_mak = configure_file(
777       input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
778       output: config_devices_mak,
779       depfile: config_devices_mak + '.d',
780       capture: true,
781       command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
782                 config_devices_mak, '@DEPFILE@', '@INPUT@',
783                 base_kconfig])
785     config_devices_data = configuration_data()
786     config_devices = keyval.load(config_devices_mak)
787     foreach k, v: config_devices
788       config_devices_data.set(k, 1)
789     endforeach
790     config_devices_mak_list += config_devices_mak
791     config_devices_h += {target: configure_file(output: target + '-config-devices.h',
792                                                 configuration: config_devices_data)}
793     config_target += config_devices
794     config_all_devices += config_devices
795   endif
796   config_target_mak += {target: config_target}
797 endforeach
799 # This configuration is used to build files that are shared by
800 # multiple binaries, and then extracted out of the "common"
801 # static_library target.
803 # We do not use all_sources()/all_dependencies(), because it would
804 # build literally all source files, including devices only used by
805 # targets that are not built for this compilation.  The CONFIG_ALL
806 # pseudo symbol replaces it.
808 config_all += config_all_devices
809 config_all += config_host
810 config_all += config_all_disas
811 config_all += {
812   'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
813   'CONFIG_SOFTMMU': have_system,
814   'CONFIG_USER_ONLY': have_user,
815   'CONFIG_ALL': true,
818 # Generators
820 hxtool = find_program('scripts/hxtool')
821 shaderinclude = find_program('scripts/shaderinclude.pl')
822 qapi_gen = find_program('scripts/qapi-gen.py')
823 qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
824                      meson.source_root() / 'scripts/qapi/commands.py',
825                      meson.source_root() / 'scripts/qapi/common.py',
826                      meson.source_root() / 'scripts/qapi/error.py',
827                      meson.source_root() / 'scripts/qapi/events.py',
828                      meson.source_root() / 'scripts/qapi/expr.py',
829                      meson.source_root() / 'scripts/qapi/gen.py',
830                      meson.source_root() / 'scripts/qapi/introspect.py',
831                      meson.source_root() / 'scripts/qapi/parser.py',
832                      meson.source_root() / 'scripts/qapi/schema.py',
833                      meson.source_root() / 'scripts/qapi/source.py',
834                      meson.source_root() / 'scripts/qapi/types.py',
835                      meson.source_root() / 'scripts/qapi/visit.py',
836                      meson.source_root() / 'scripts/qapi/common.py',
837                      meson.source_root() / 'scripts/qapi-gen.py'
840 tracetool = [
841   python, files('scripts/tracetool.py'),
842    '--backend=' + config_host['TRACE_BACKENDS']
845 qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
846                     meson.current_source_dir(),
847                     config_host['PKGVERSION'], meson.project_version()]
848 qemu_version = custom_target('qemu-version.h',
849                              output: 'qemu-version.h',
850                              command: qemu_version_cmd,
851                              capture: true,
852                              build_by_default: true,
853                              build_always_stale: true)
854 genh += qemu_version
856 hxdep = []
857 hx_headers = [
858   ['qemu-options.hx', 'qemu-options.def'],
859   ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
861 if have_system
862   hx_headers += [
863     ['hmp-commands.hx', 'hmp-commands.h'],
864     ['hmp-commands-info.hx', 'hmp-commands-info.h'],
865   ]
866 endif
867 foreach d : hx_headers
868   hxdep += custom_target(d[1],
869                 input: files(d[0]),
870                 output: d[1],
871                 capture: true,
872                 build_by_default: true, # to be removed when added to a target
873                 command: [hxtool, '-h', '@INPUT0@'])
874 endforeach
875 genh += hxdep
877 SPHINX_ARGS = [config_host['SPHINX_BUILD'],
878                '-Dversion=' + meson.project_version(),
879                '-Drelease=' + config_host['PKGVERSION']]
881 if get_option('werror')
882   SPHINX_ARGS += [ '-W' ]
883 endif
885 sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
886                         meson.source_root() / 'docs/sphinx/hxtool.py',
887                         meson.source_root() / 'docs/sphinx/kerneldoc.py',
888                         meson.source_root() / 'docs/sphinx/kernellog.py',
889                         meson.source_root() / 'docs/sphinx/qapidoc.py',
890                         meson.source_root() / 'docs/sphinx/qmp_lexer.py',
891                         qapi_gen_depends ]
893 # Collect sourcesets.
895 util_ss = ss.source_set()
896 stub_ss = ss.source_set()
897 trace_ss = ss.source_set()
898 block_ss = ss.source_set()
899 blockdev_ss = ss.source_set()
900 qmp_ss = ss.source_set()
901 common_ss = ss.source_set()
902 softmmu_ss = ss.source_set()
903 user_ss = ss.source_set()
904 bsd_user_ss = ss.source_set()
905 linux_user_ss = ss.source_set()
906 specific_ss = ss.source_set()
907 specific_fuzz_ss = ss.source_set()
909 modules = {}
910 hw_arch = {}
911 target_arch = {}
912 target_softmmu_arch = {}
914 ###############
915 # Trace files #
916 ###############
918 # TODO: add each directory to the subdirs from its own meson.build, once
919 # we have those
920 trace_events_subdirs = [
921   'accel/kvm',
922   'accel/tcg',
923   'crypto',
924   'monitor',
926 if have_user
927   trace_events_subdirs += [ 'linux-user' ]
928 endif
929 if have_block
930   trace_events_subdirs += [
931     'authz',
932     'block',
933     'io',
934     'nbd',
935     'scsi',
936   ]
937 endif
938 if have_system
939   trace_events_subdirs += [
940     'audio',
941     'backends',
942     'backends/tpm',
943     'chardev',
944     'hw/9pfs',
945     'hw/acpi',
946     'hw/alpha',
947     'hw/arm',
948     'hw/audio',
949     'hw/block',
950     'hw/block/dataplane',
951     'hw/char',
952     'hw/display',
953     'hw/dma',
954     'hw/hppa',
955     'hw/hyperv',
956     'hw/i2c',
957     'hw/i386',
958     'hw/i386/xen',
959     'hw/ide',
960     'hw/input',
961     'hw/intc',
962     'hw/isa',
963     'hw/mem',
964     'hw/mips',
965     'hw/misc',
966     'hw/misc/macio',
967     'hw/net',
968     'hw/nvram',
969     'hw/pci',
970     'hw/pci-host',
971     'hw/ppc',
972     'hw/rdma',
973     'hw/rdma/vmw',
974     'hw/rtc',
975     'hw/s390x',
976     'hw/scsi',
977     'hw/sd',
978     'hw/sparc',
979     'hw/sparc64',
980     'hw/ssi',
981     'hw/timer',
982     'hw/tpm',
983     'hw/usb',
984     'hw/vfio',
985     'hw/virtio',
986     'hw/watchdog',
987     'hw/xen',
988     'hw/gpio',
989     'migration',
990     'net',
991     'softmmu',
992     'ui',
993   ]
994 endif
995 trace_events_subdirs += [
996   'hw/core',
997   'qapi',
998   'qom',
999   'target/arm',
1000   'target/hppa',
1001   'target/i386',
1002   'target/mips',
1003   'target/ppc',
1004   'target/riscv',
1005   'target/s390x',
1006   'target/sparc',
1007   'util',
1010 subdir('qapi')
1011 subdir('qobject')
1012 subdir('stubs')
1013 subdir('trace')
1014 subdir('util')
1015 subdir('qom')
1016 subdir('authz')
1017 subdir('crypto')
1018 subdir('ui')
1021 if enable_modules
1022   libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1023   modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1024 endif
1026 # Build targets from sourcesets
1028 stub_ss = stub_ss.apply(config_all, strict: false)
1030 util_ss.add_all(trace_ss)
1031 util_ss = util_ss.apply(config_all, strict: false)
1032 libqemuutil = static_library('qemuutil',
1033                              sources: util_ss.sources() + stub_ss.sources() + genh,
1034                              dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
1035 qemuutil = declare_dependency(link_with: libqemuutil,
1036                               sources: genh + version_res)
1038 decodetree = generator(find_program('scripts/decodetree.py'),
1039                        output: 'decode-@BASENAME@.c.inc',
1040                        arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1042 subdir('audio')
1043 subdir('io')
1044 subdir('chardev')
1045 subdir('fsdev')
1046 subdir('libdecnumber')
1047 subdir('target')
1048 subdir('dump')
1050 block_ss.add(files(
1051   'block.c',
1052   'blockdev-nbd.c',
1053   'blockjob.c',
1054   'job.c',
1055   'qemu-io-cmds.c',
1057 block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1059 subdir('nbd')
1060 subdir('scsi')
1061 subdir('block')
1063 blockdev_ss.add(files(
1064   'blockdev.c',
1065   'iothread.c',
1066   'job-qmp.c',
1069 # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1070 # os-win32.c does not
1071 blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1072 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1074 softmmu_ss.add_all(blockdev_ss)
1075 softmmu_ss.add(files(
1076   'bootdevice.c',
1077   'dma-helpers.c',
1078   'qdev-monitor.c',
1079 ), sdl)
1081 softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1082 softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1083 softmmu_ss.add(when: ['CONFIG_FDT', fdt],  if_true: [files('device_tree.c')])
1085 common_ss.add(files('cpus-common.c'))
1087 subdir('softmmu')
1089 specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
1090 specific_ss.add(files('exec-vary.c'))
1091 specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1092   'fpu/softfloat.c',
1093   'tcg/optimize.c',
1094   'tcg/tcg-common.c',
1095   'tcg/tcg-op-gvec.c',
1096   'tcg/tcg-op-vec.c',
1097   'tcg/tcg-op.c',
1098   'tcg/tcg.c',
1100 specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1102 subdir('backends')
1103 subdir('disas')
1104 subdir('migration')
1105 subdir('monitor')
1106 subdir('net')
1107 subdir('replay')
1108 subdir('hw')
1109 subdir('accel')
1110 subdir('plugins')
1111 subdir('bsd-user')
1112 subdir('linux-user')
1114 bsd_user_ss.add(files('gdbstub.c'))
1115 specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1117 linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1118 specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
1120 # needed for fuzzing binaries
1121 subdir('tests/qtest/libqos')
1122 subdir('tests/qtest/fuzz')
1124 block_mods = []
1125 softmmu_mods = []
1126 foreach d, list : modules
1127   foreach m, module_ss : list
1128     if enable_modules and targetos != 'windows'
1129       module_ss = module_ss.apply(config_all, strict: false)
1130       sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1131                           dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1132       if d == 'block'
1133         block_mods += sl
1134       else
1135         softmmu_mods += sl
1136       endif
1137     else
1138       if d == 'block'
1139         block_ss.add_all(module_ss)
1140       else
1141         softmmu_ss.add_all(module_ss)
1142       endif
1143     endif
1144   endforeach
1145 endforeach
1147 nm = find_program('nm')
1148 undefsym = find_program('scripts/undefsym.py')
1149 block_syms = custom_target('block.syms', output: 'block.syms',
1150                              input: [libqemuutil, block_mods],
1151                              capture: true,
1152                              command: [undefsym, nm, '@INPUT@'])
1153 qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1154                              input: [libqemuutil, softmmu_mods],
1155                              capture: true,
1156                              command: [undefsym, nm, '@INPUT@'])
1158 block_ss = block_ss.apply(config_host, strict: false)
1159 libblock = static_library('block', block_ss.sources() + genh,
1160                           dependencies: block_ss.dependencies(),
1161                           link_depends: block_syms,
1162                           name_suffix: 'fa',
1163                           build_by_default: false)
1165 block = declare_dependency(link_whole: [libblock],
1166                            link_args: '@block.syms',
1167                            dependencies: [crypto, io])
1169 qmp_ss = qmp_ss.apply(config_host, strict: false)
1170 libqmp = static_library('qmp', qmp_ss.sources() + genh,
1171                         dependencies: qmp_ss.dependencies(),
1172                         name_suffix: 'fa',
1173                         build_by_default: false)
1175 qmp = declare_dependency(link_whole: [libqmp])
1177 foreach m : block_mods + softmmu_mods
1178   shared_module(m.name(),
1179                 name_prefix: '',
1180                 link_whole: m,
1181                 install: true,
1182                 install_dir: config_host['qemu_moddir'])
1183 endforeach
1185 softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1186 common_ss.add(qom, qemuutil)
1188 common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
1189 common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1191 common_all = common_ss.apply(config_all, strict: false)
1192 common_all = static_library('common',
1193                             build_by_default: false,
1194                             sources: common_all.sources() + genh,
1195                             dependencies: common_all.dependencies(),
1196                             name_suffix: 'fa')
1198 feature_to_c = find_program('scripts/feature_to_c.sh')
1200 emulators = {}
1201 foreach target : target_dirs
1202   config_target = config_target_mak[target]
1203   target_name = config_target['TARGET_NAME']
1204   arch = config_target['TARGET_BASE_ARCH']
1205   arch_srcs = [config_target_h[target]]
1206   arch_deps = []
1207   c_args = ['-DNEED_CPU_H',
1208             '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1209             '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
1210   link_args = []
1212   config_target += config_host
1213   target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1214   if targetos == 'linux'
1215     target_inc += include_directories('linux-headers', is_system: true)
1216   endif
1217   if target.endswith('-softmmu')
1218     qemu_target_name = 'qemu-system-' + target_name
1219     target_type='system'
1220     t = target_softmmu_arch[arch].apply(config_target, strict: false)
1221     arch_srcs += t.sources()
1222     arch_deps += t.dependencies()
1224     hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1225     hw = hw_arch[hw_dir].apply(config_target, strict: false)
1226     arch_srcs += hw.sources()
1227     arch_deps += hw.dependencies()
1229     arch_srcs += config_devices_h[target]
1230     link_args += ['@block.syms', '@qemu.syms']
1231   else
1232     abi = config_target['TARGET_ABI_DIR']
1233     target_type='user'
1234     qemu_target_name = 'qemu-' + target_name
1235     if 'CONFIG_LINUX_USER' in config_target
1236       base_dir = 'linux-user'
1237       target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1238     else
1239       base_dir = 'bsd-user'
1240     endif
1241     target_inc += include_directories(
1242       base_dir,
1243       base_dir / abi,
1244     )
1245     if 'CONFIG_LINUX_USER' in config_target
1246       dir = base_dir / abi
1247       arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1248       if config_target.has_key('TARGET_SYSTBL_ABI')
1249         arch_srcs += \
1250           syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1251                                              extra_args : config_target['TARGET_SYSTBL_ABI'])
1252       endif
1253     endif
1254   endif
1256   if 'TARGET_XML_FILES' in config_target
1257     gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1258                                 output: target + '-gdbstub-xml.c',
1259                                 input: files(config_target['TARGET_XML_FILES'].split()),
1260                                 command: [feature_to_c, '@INPUT@'],
1261                                 capture: true)
1262     arch_srcs += gdbstub_xml
1263   endif
1265   t = target_arch[arch].apply(config_target, strict: false)
1266   arch_srcs += t.sources()
1267   arch_deps += t.dependencies()
1269   target_common = common_ss.apply(config_target, strict: false)
1270   objects = common_all.extract_objects(target_common.sources())
1271   deps = target_common.dependencies()
1273   target_specific = specific_ss.apply(config_target, strict: false)
1274   arch_srcs += target_specific.sources()
1275   arch_deps += target_specific.dependencies()
1277   lib = static_library('qemu-' + target,
1278                  sources: arch_srcs + genh,
1279                  dependencies: arch_deps,
1280                  objects: objects,
1281                  include_directories: target_inc,
1282                  c_args: c_args,
1283                  build_by_default: false,
1284                  name_suffix: 'fa')
1286   if target.endswith('-softmmu')
1287     execs = [{
1288       'name': 'qemu-system-' + target_name,
1289       'gui': false,
1290       'sources': files('softmmu/main.c'),
1291       'dependencies': []
1292     }]
1293     if targetos == 'windows' and (sdl.found() or gtk.found())
1294       execs += [{
1295         'name': 'qemu-system-' + target_name + 'w',
1296         'gui': true,
1297         'sources': files('softmmu/main.c'),
1298         'dependencies': []
1299       }]
1300     endif
1301     if config_host.has_key('CONFIG_FUZZ')
1302       specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1303       execs += [{
1304         'name': 'qemu-fuzz-' + target_name,
1305         'gui': false,
1306         'sources': specific_fuzz.sources(),
1307         'dependencies': specific_fuzz.dependencies(),
1308       }]
1309     endif
1310   else
1311     execs = [{
1312       'name': 'qemu-' + target_name,
1313       'gui': false,
1314       'sources': [],
1315       'dependencies': []
1316     }]
1317   endif
1318   foreach exe: execs
1319     emulators += {exe['name']:
1320          executable(exe['name'], exe['sources'],
1321                install: true,
1322                c_args: c_args,
1323                dependencies: arch_deps + deps + exe['dependencies'],
1324                objects: lib.extract_all_objects(recursive: true),
1325                link_language: link_language,
1326                link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1327                link_args: link_args,
1328                gui_app: exe['gui'])
1329     }
1331     if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1332       foreach stp: [
1333         {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1334         {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
1335         {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1336         {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1337       ]
1338         custom_target(exe['name'] + stp['ext'],
1339                       input: trace_events_all,
1340                       output: exe['name'] + stp['ext'],
1341                       capture: true,
1342                       install: stp['install'],
1343                       install_dir: qemu_datadir / '../systemtap/tapset',
1344                       command: [
1345                         tracetool, '--group=all', '--format=' + stp['fmt'],
1346                         '--binary=' + stp['bin'],
1347                         '--target-name=' + target_name,
1348                         '--target-type=' + target_type,
1349                         '--probe-prefix=qemu.' + target_type + '.' + target_name,
1350                         '@INPUT@',
1351                       ])
1352       endforeach
1353     endif
1354   endforeach
1355 endforeach
1357 # Other build targets
1359 if 'CONFIG_PLUGIN' in config_host
1360   install_headers('include/qemu/qemu-plugin.h')
1361 endif
1363 if 'CONFIG_GUEST_AGENT' in config_host
1364   subdir('qga')
1365 endif
1367 # Don't build qemu-keymap if xkbcommon is not explicitly enabled
1368 # when we don't build tools or system
1369 if xkbcommon.found()
1370   # used for the update-keymaps target, so include rules even if !have_tools
1371   qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1372                            dependencies: [qemuutil, xkbcommon], install: have_tools)
1373 endif
1375 if have_tools
1376   qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1377              dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1378   qemu_io = executable('qemu-io', files('qemu-io.c'),
1379              dependencies: [block, qemuutil], install: true)
1380   qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
1381                dependencies: [block, qemuutil], install: true)
1383   subdir('storage-daemon')
1384   subdir('contrib/rdmacm-mux')
1385   subdir('contrib/elf2dmp')
1387   executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1388              dependencies: qemuutil,
1389              install: true)
1391   if 'CONFIG_VHOST_USER' in config_host
1392     subdir('contrib/libvhost-user')
1393     subdir('contrib/vhost-user-blk')
1394     subdir('contrib/vhost-user-gpu')
1395     subdir('contrib/vhost-user-input')
1396     subdir('contrib/vhost-user-scsi')
1397   endif
1399   if targetos == 'linux'
1400     executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1401                dependencies: [qemuutil, libcap_ng],
1402                install: true,
1403                install_dir: get_option('libexecdir'))
1405     executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1406                dependencies: [authz, crypto, io, qom, qemuutil,
1407                               libcap_ng, mpathpersist],
1408                install: true)
1409   endif
1411   if 'CONFIG_IVSHMEM' in config_host
1412     subdir('contrib/ivshmem-client')
1413     subdir('contrib/ivshmem-server')
1414   endif
1415 endif
1417 subdir('scripts')
1418 subdir('tools')
1419 subdir('pc-bios')
1420 subdir('tests')
1421 subdir('docs')
1422 if 'CONFIG_GTK' in config_host
1423   subdir('po')
1424 endif
1426 if host_machine.system() == 'windows'
1427   nsis_cmd = [
1428     find_program('scripts/nsis.py'),
1429     '@OUTPUT@',
1430     get_option('prefix'),
1431     meson.current_source_dir(),
1432     host_machine.cpu_family(),
1433     '--',
1434     '-DDISPLAYVERSION=' + meson.project_version(),
1435   ]
1436   if build_docs
1437     nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1438   endif
1439   if 'CONFIG_GTK' in config_host
1440     nsis_cmd += '-DCONFIG_GTK=y'
1441   endif
1443   nsis = custom_target('nsis',
1444                        output: 'qemu-setup-' + meson.project_version() + '.exe',
1445                        input: files('qemu.nsi'),
1446                        build_always_stale: true,
1447                        command: nsis_cmd + ['@INPUT@'])
1448   alias_target('installer', nsis)
1449 endif
1451 summary_info = {}
1452 summary_info += {'Install prefix':    config_host['prefix']}
1453 summary_info += {'BIOS directory':    config_host['qemu_datadir']}
1454 summary_info += {'firmware path':     config_host['qemu_firmwarepath']}
1455 summary_info += {'binary directory':  config_host['bindir']}
1456 summary_info += {'library directory': config_host['libdir']}
1457 summary_info += {'module directory':  config_host['qemu_moddir']}
1458 summary_info += {'libexec directory': config_host['libexecdir']}
1459 summary_info += {'include directory': config_host['includedir']}
1460 summary_info += {'config directory':  config_host['sysconfdir']}
1461 if targetos != 'windows'
1462   summary_info += {'local state directory': config_host['qemu_localstatedir']}
1463   summary_info += {'Manual directory':      get_option('mandir')}
1464 else
1465   summary_info += {'local state directory': 'queried at runtime'}
1466 endif
1467 summary_info += {'Doc directory':     get_option('docdir')}
1468 summary_info += {'Build directory':   meson.current_build_dir()}
1469 summary_info += {'Source path':       meson.current_source_dir()}
1470 summary_info += {'GIT binary':        config_host['GIT']}
1471 summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
1472 summary_info += {'C compiler':        meson.get_compiler('c').cmd_array()[0]}
1473 summary_info += {'Host C compiler':   meson.get_compiler('c', native: true).cmd_array()[0]}
1474 if link_language == 'cpp'
1475   summary_info += {'C++ compiler':      meson.get_compiler('cpp').cmd_array()[0]}
1476 else
1477   summary_info += {'C++ compiler':      false}
1478 endif
1479 if targetos == 'darwin'
1480   summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1481 endif
1482 summary_info += {'ARFLAGS':           config_host['ARFLAGS']}
1483 summary_info += {'CFLAGS':            config_host['CFLAGS']}
1484 summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
1485 summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
1486 summary_info += {'make':              config_host['MAKE']}
1487 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1488 summary_info += {'sphinx-build':      config_host['SPHINX_BUILD']}
1489 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
1490 # TODO: add back version
1491 summary_info += {'slirp support':     config_host.has_key('CONFIG_SLIRP')}
1492 if config_host.has_key('CONFIG_SLIRP')
1493   summary_info += {'smbd':            config_host['CONFIG_SMBD_COMMAND']}
1494 endif
1495 summary_info += {'module support':    config_host.has_key('CONFIG_MODULES')}
1496 if config_host.has_key('CONFIG_MODULES')
1497   summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1498 endif
1499 summary_info += {'host CPU':          cpu}
1500 summary_info += {'host endianness':   build_machine.endian()}
1501 summary_info += {'target list':       config_host['TARGET_DIRS']}
1502 summary_info += {'gprof enabled':     config_host.has_key('CONFIG_GPROF')}
1503 summary_info += {'sparse enabled':    meson.get_compiler('c').cmd_array().contains('cgcc')}
1504 summary_info += {'strip binaries':    get_option('strip')}
1505 summary_info += {'profiler':          config_host.has_key('CONFIG_PROFILER')}
1506 summary_info += {'static build':      config_host.has_key('CONFIG_STATIC')}
1507 if targetos == 'darwin'
1508   summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1509 endif
1510 # TODO: add back version
1511 summary_info += {'SDL support':       sdl.found()}
1512 summary_info += {'SDL image support': sdl_image.found()}
1513 # TODO: add back version
1514 summary_info += {'GTK support':       config_host.has_key('CONFIG_GTK')}
1515 summary_info += {'GTK GL support':    config_host.has_key('CONFIG_GTK_GL')}
1516 summary_info += {'pixman':            pixman.found()}
1517 # TODO: add back version
1518 summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
1519 summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
1520 summary_info += {'GNUTLS support':    config_host.has_key('CONFIG_GNUTLS')}
1521 # TODO: add back version
1522 summary_info += {'libgcrypt':         config_host.has_key('CONFIG_GCRYPT')}
1523 if config_host.has_key('CONFIG_GCRYPT')
1524    summary_info += {'  hmac':            config_host.has_key('CONFIG_GCRYPT_HMAC')}
1525    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1526 endif
1527 # TODO: add back version
1528 summary_info += {'nettle':            config_host.has_key('CONFIG_NETTLE')}
1529 if config_host.has_key('CONFIG_NETTLE')
1530    summary_info += {'  XTS':             not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1531 endif
1532 summary_info += {'libtasn1':          config_host.has_key('CONFIG_TASN1')}
1533 summary_info += {'PAM':               config_host.has_key('CONFIG_AUTH_PAM')}
1534 summary_info += {'iconv support':     config_host.has_key('CONFIG_ICONV')}
1535 summary_info += {'curses support':    config_host.has_key('CONFIG_CURSES')}
1536 # TODO: add back version
1537 summary_info += {'virgl support':     config_host.has_key('CONFIG_VIRGL')}
1538 summary_info += {'curl support':      config_host.has_key('CONFIG_CURL')}
1539 summary_info += {'mingw32 support':   targetos == 'windows'}
1540 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
1541 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1542 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1543 summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
1544 summary_info += {'Multipath support': mpathpersist.found()}
1545 summary_info += {'VNC support':       vnc.found()}
1546 if vnc.found()
1547   summary_info += {'VNC SASL support':  sasl.found()}
1548   summary_info += {'VNC JPEG support':  jpeg.found()}
1549   summary_info += {'VNC PNG support':   png.found()}
1550 endif
1551 summary_info += {'xen support':       config_host.has_key('CONFIG_XEN_BACKEND')}
1552 if config_host.has_key('CONFIG_XEN_BACKEND')
1553   summary_info += {'xen ctrl version':  config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1554 endif
1555 summary_info += {'brlapi support':    config_host.has_key('CONFIG_BRLAPI')}
1556 summary_info += {'Documentation':     config_host.has_key('BUILD_DOCS')}
1557 summary_info += {'PIE':               get_option('b_pie')}
1558 summary_info += {'vde support':       config_host.has_key('CONFIG_VDE')}
1559 summary_info += {'netmap support':    config_host.has_key('CONFIG_NETMAP')}
1560 summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1561 summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1562 summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1563 summary_info += {'Install blobs':     config_host.has_key('INSTALL_BLOBS')}
1564 summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
1565 summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
1566 summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
1567 summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
1568 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
1569 if config_all.has_key('CONFIG_TCG')
1570   summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1571   summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
1572 endif
1573 summary_info += {'malloc trim support': has_malloc_trim}
1574 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
1575 summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
1576 summary_info += {'fdt support':       config_host.has_key('CONFIG_FDT')}
1577 summary_info += {'membarrier':        config_host.has_key('CONFIG_MEMBARRIER')}
1578 summary_info += {'preadv support':    config_host.has_key('CONFIG_PREADV')}
1579 summary_info += {'fdatasync':         config_host.has_key('CONFIG_FDATASYNC')}
1580 summary_info += {'madvise':           config_host.has_key('CONFIG_MADVISE')}
1581 summary_info += {'posix_madvise':     config_host.has_key('CONFIG_POSIX_MADVISE')}
1582 summary_info += {'posix_memalign':    config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1583 summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1584 summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1585 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1586 summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1587 summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1588 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1589 summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1590 summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1591 summary_info += {'Trace backends':    config_host['TRACE_BACKENDS']}
1592 if config_host['TRACE_BACKENDS'].split().contains('simple')
1593   summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1594 endif
1595 # TODO: add back protocol and server version
1596 summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
1597 summary_info += {'rbd support':       config_host.has_key('CONFIG_RBD')}
1598 summary_info += {'xfsctl support':    config_host.has_key('CONFIG_XFS')}
1599 summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
1600 summary_info += {'U2F support':       u2f.found()}
1601 summary_info += {'libusb':            config_host.has_key('CONFIG_USB_LIBUSB')}
1602 summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
1603 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
1604 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
1605 summary_info += {'libiscsi support':  config_host.has_key('CONFIG_LIBISCSI')}
1606 summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
1607 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1608 if targetos == 'windows'
1609   if 'WIN_SDK' in config_host
1610     summary_info += {'Windows SDK':       config_host['WIN_SDK']}
1611   endif
1612   summary_info += {'QGA VSS support':   config_host.has_key('CONFIG_QGA_VSS')}
1613   summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
1614   summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI')}
1615 endif
1616 summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
1617 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1618 summary_info += {'coroutine pool':    config_host['CONFIG_COROUTINE_POOL'] == '1'}
1619 summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1620 summary_info += {'mutex debugging':   config_host.has_key('CONFIG_DEBUG_MUTEX')}
1621 summary_info += {'crypto afalg':      config_host.has_key('CONFIG_AF_ALG')}
1622 summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
1623 summary_info += {'gcov':              get_option('b_coverage')}
1624 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
1625 summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
1626 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1627 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1628 summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
1629 summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
1630 summary_info += {'bzip2 support':     config_host.has_key('CONFIG_BZIP2')}
1631 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
1632 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
1633 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1634 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
1635 summary_info += {'memory allocator':  get_option('malloc')}
1636 summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1637 summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1638 summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1639 summary_info += {'bochs support':     config_host.has_key('CONFIG_BOCHS')}
1640 summary_info += {'cloop support':     config_host.has_key('CONFIG_CLOOP')}
1641 summary_info += {'dmg support':       config_host.has_key('CONFIG_DMG')}
1642 summary_info += {'qcow v1 support':   config_host.has_key('CONFIG_QCOW1')}
1643 summary_info += {'vdi support':       config_host.has_key('CONFIG_VDI')}
1644 summary_info += {'vvfat support':     config_host.has_key('CONFIG_VVFAT')}
1645 summary_info += {'qed support':       config_host.has_key('CONFIG_QED')}
1646 summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1647 summary_info += {'sheepdog support':  config_host.has_key('CONFIG_SHEEPDOG')}
1648 summary_info += {'capstone':          config_host.has_key('CONFIG_CAPSTONE')}
1649 summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
1650 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
1651 summary_info += {'libudev':           libudev.found()}
1652 summary_info += {'default devices':   config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1653 summary_info += {'plugin support':    config_host.has_key('CONFIG_PLUGIN')}
1654 summary_info += {'fuzzing support':   config_host.has_key('CONFIG_FUZZ')}
1655 if config_host.has_key('HAVE_GDB_BIN')
1656   summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
1657 endif
1658 summary_info += {'thread sanitizer':  config_host.has_key('CONFIG_TSAN')}
1659 summary_info += {'rng-none':          config_host.has_key('CONFIG_RNG_NONE')}
1660 summary_info += {'Linux keyring':     config_host.has_key('CONFIG_SECRET_KEYRING')}
1661 summary(summary_info, bool_yn: true)
1663 if not supported_cpus.contains(cpu)
1664   message()
1665   warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1666   message()
1667   message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1668   message('The QEMU project intends to remove support for this host CPU in')
1669   message('a future release if nobody volunteers to maintain it and to')
1670   message('provide a build host for our continuous integration setup.')
1671   message('configure has succeeded and you can continue to build, but')
1672   message('if you care about QEMU on this platform you should contact')
1673   message('us upstream at qemu-devel@nongnu.org.')
1674 endif
1676 if not supported_oses.contains(targetos)
1677   message()
1678   warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1679   message()
1680   message('Host OS ' + targetos + 'support is not currently maintained.')
1681   message('The QEMU project intends to remove support for this host OS in')
1682   message('a future release if nobody volunteers to maintain it and to')
1683   message('provide a build host for our continuous integration setup.')
1684   message('configure has succeeded and you can continue to build, but')
1685   message('if you care about QEMU on this platform you should contact')
1686   message('us upstream at qemu-devel@nongnu.org.')
1687 endif