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