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