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