]> git.ipfire.org Git - thirdparty/qemu.git/blame - meson.build
configure: move OpenBSD W^X test to meson
[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]
859aef02 730ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
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
PB
782 config_target += keyval.load('default-configs/targets' / target + '.mak')
783
ca0fc784
PB
784 foreach k, v: disassemblers
785 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
786 foreach sym: v
787 config_target += { sym: 'y' }
788 config_all_disas += { sym: 'y' }
789 endforeach
790 endif
791 endforeach
792
859aef02
PB
793 config_target_data = configuration_data()
794 foreach k, v: config_target
795 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
796 # do nothing
797 elif ignored.contains(k)
798 # do nothing
799 elif k == 'TARGET_BASE_ARCH'
800 config_target_data.set('TARGET_' + v.to_upper(), 1)
765686d6 801 elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
859aef02
PB
802 config_target_data.set_quoted(k, v)
803 elif v == 'y'
804 config_target_data.set(k, 1)
805 else
806 config_target_data.set(k, v)
807 endif
808 endforeach
809 config_target_h += {target: configure_file(output: target + '-config-target.h',
810 configuration: config_target_data)}
2becc36a
PB
811
812 if target.endswith('-softmmu')
2becc36a
PB
813 base_kconfig = []
814 foreach sym : kconfig_external_symbols
859aef02 815 if sym in config_target or sym in config_host
2becc36a
PB
816 base_kconfig += '@0@=y'.format(sym)
817 endif
818 endforeach
819
820 config_devices_mak = target + '-config-devices.mak'
821 config_devices_mak = configure_file(
1bb4cb1c 822 input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
2becc36a
PB
823 output: config_devices_mak,
824 depfile: config_devices_mak + '.d',
825 capture: true,
826 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
827 config_devices_mak, '@DEPFILE@', '@INPUT@',
828 base_kconfig])
859aef02
PB
829
830 config_devices_data = configuration_data()
831 config_devices = keyval.load(config_devices_mak)
832 foreach k, v: config_devices
833 config_devices_data.set(k, 1)
834 endforeach
2becc36a 835 config_devices_mak_list += config_devices_mak
859aef02
PB
836 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
837 configuration: config_devices_data)}
838 config_target += config_devices
a98006bc 839 config_all_devices += config_devices
2becc36a
PB
840 endif
841 config_target_mak += {target: config_target}
a81df1b6 842endforeach
fdb75aef 843target_dirs = actual_target_dirs
a81df1b6 844
2becc36a
PB
845# This configuration is used to build files that are shared by
846# multiple binaries, and then extracted out of the "common"
847# static_library target.
848#
849# We do not use all_sources()/all_dependencies(), because it would
850# build literally all source files, including devices only used by
851# targets that are not built for this compilation. The CONFIG_ALL
852# pseudo symbol replaces it.
853
05512f55 854config_all += config_all_devices
2becc36a
PB
855config_all += config_host
856config_all += config_all_disas
857config_all += {
858 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
859 'CONFIG_SOFTMMU': have_system,
860 'CONFIG_USER_ONLY': have_user,
861 'CONFIG_ALL': true,
862}
863
a81df1b6
PB
864# Generators
865
3f885659 866hxtool = find_program('scripts/hxtool')
650b5d54 867shaderinclude = find_program('scripts/shaderinclude.pl')
a81df1b6
PB
868qapi_gen = find_program('scripts/qapi-gen.py')
869qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
870 meson.source_root() / 'scripts/qapi/commands.py',
871 meson.source_root() / 'scripts/qapi/common.py',
a81df1b6
PB
872 meson.source_root() / 'scripts/qapi/error.py',
873 meson.source_root() / 'scripts/qapi/events.py',
874 meson.source_root() / 'scripts/qapi/expr.py',
875 meson.source_root() / 'scripts/qapi/gen.py',
876 meson.source_root() / 'scripts/qapi/introspect.py',
877 meson.source_root() / 'scripts/qapi/parser.py',
878 meson.source_root() / 'scripts/qapi/schema.py',
879 meson.source_root() / 'scripts/qapi/source.py',
880 meson.source_root() / 'scripts/qapi/types.py',
881 meson.source_root() / 'scripts/qapi/visit.py',
882 meson.source_root() / 'scripts/qapi/common.py',
a81df1b6
PB
883 meson.source_root() / 'scripts/qapi-gen.py'
884]
885
886tracetool = [
887 python, files('scripts/tracetool.py'),
888 '--backend=' + config_host['TRACE_BACKENDS']
889]
890
2c273f32
MAL
891qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
892 meson.current_source_dir(),
859aef02 893 config_host['PKGVERSION'], meson.project_version()]
2c273f32
MAL
894qemu_version = custom_target('qemu-version.h',
895 output: 'qemu-version.h',
896 command: qemu_version_cmd,
897 capture: true,
898 build_by_default: true,
899 build_always_stale: true)
900genh += qemu_version
901
3f885659
MAL
902hxdep = []
903hx_headers = [
904 ['qemu-options.hx', 'qemu-options.def'],
905 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
906]
907if have_system
908 hx_headers += [
909 ['hmp-commands.hx', 'hmp-commands.h'],
910 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
911 ]
912endif
913foreach d : hx_headers
b7c70bf2 914 hxdep += custom_target(d[1],
3f885659
MAL
915 input: files(d[0]),
916 output: d[1],
917 capture: true,
918 build_by_default: true, # to be removed when added to a target
919 command: [hxtool, '-h', '@INPUT0@'])
920endforeach
921genh += hxdep
922
eb937365
PM
923SPHINX_ARGS = [config_host['SPHINX_BUILD'],
924 '-Dversion=' + meson.project_version(),
925 '-Drelease=' + config_host['PKGVERSION']]
926
927if get_option('werror')
928 SPHINX_ARGS += [ '-W' ]
929endif
930
b3f4830a
PM
931sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
932 meson.source_root() / 'docs/sphinx/hxtool.py',
933 meson.source_root() / 'docs/sphinx/kerneldoc.py',
934 meson.source_root() / 'docs/sphinx/kernellog.py',
935 meson.source_root() / 'docs/sphinx/qapidoc.py',
936 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
937 qapi_gen_depends ]
938
a81df1b6
PB
939# Collect sourcesets.
940
941util_ss = ss.source_set()
942stub_ss = ss.source_set()
943trace_ss = ss.source_set()
3154fee4 944block_ss = ss.source_set()
4a96337d 945blockdev_ss = ss.source_set()
ff219dca 946qmp_ss = ss.source_set()
2becc36a
PB
947common_ss = ss.source_set()
948softmmu_ss = ss.source_set()
949user_ss = ss.source_set()
950bsd_user_ss = ss.source_set()
951linux_user_ss = ss.source_set()
952specific_ss = ss.source_set()
64ed6f92 953specific_fuzz_ss = ss.source_set()
2becc36a 954
3154fee4 955modules = {}
2becc36a
PB
956hw_arch = {}
957target_arch = {}
958target_softmmu_arch = {}
a81df1b6
PB
959
960###############
961# Trace files #
962###############
963
c9322ab5
MAL
964# TODO: add each directory to the subdirs from its own meson.build, once
965# we have those
a81df1b6
PB
966trace_events_subdirs = [
967 'accel/kvm',
968 'accel/tcg',
969 'crypto',
970 'monitor',
971]
972if have_user
973 trace_events_subdirs += [ 'linux-user' ]
974endif
975if have_block
976 trace_events_subdirs += [
977 'authz',
978 'block',
979 'io',
980 'nbd',
981 'scsi',
982 ]
983endif
984if have_system
985 trace_events_subdirs += [
986 'audio',
987 'backends',
988 'backends/tpm',
989 'chardev',
990 'hw/9pfs',
991 'hw/acpi',
992 'hw/alpha',
993 'hw/arm',
994 'hw/audio',
995 'hw/block',
996 'hw/block/dataplane',
997 'hw/char',
998 'hw/display',
999 'hw/dma',
1000 'hw/hppa',
1001 'hw/hyperv',
1002 'hw/i2c',
1003 'hw/i386',
1004 'hw/i386/xen',
1005 'hw/ide',
1006 'hw/input',
1007 'hw/intc',
1008 'hw/isa',
1009 'hw/mem',
1010 'hw/mips',
1011 'hw/misc',
1012 'hw/misc/macio',
1013 'hw/net',
1014 'hw/nvram',
1015 'hw/pci',
1016 'hw/pci-host',
1017 'hw/ppc',
1018 'hw/rdma',
1019 'hw/rdma/vmw',
1020 'hw/rtc',
1021 'hw/s390x',
1022 'hw/scsi',
1023 'hw/sd',
1024 'hw/sparc',
1025 'hw/sparc64',
1026 'hw/ssi',
1027 'hw/timer',
1028 'hw/tpm',
1029 'hw/usb',
1030 'hw/vfio',
1031 'hw/virtio',
1032 'hw/watchdog',
1033 'hw/xen',
1034 'hw/gpio',
a81df1b6
PB
1035 'migration',
1036 'net',
8b7a5507 1037 'softmmu',
a81df1b6
PB
1038 'ui',
1039 ]
1040endif
1041trace_events_subdirs += [
1042 'hw/core',
1043 'qapi',
1044 'qom',
1045 'target/arm',
1046 'target/hppa',
1047 'target/i386',
1048 'target/mips',
1049 'target/ppc',
1050 'target/riscv',
1051 'target/s390x',
1052 'target/sparc',
1053 'util',
1054]
1055
a81df1b6
PB
1056subdir('qapi')
1057subdir('qobject')
1058subdir('stubs')
1059subdir('trace')
1060subdir('util')
5582c58f
MAL
1061subdir('qom')
1062subdir('authz')
a81df1b6 1063subdir('crypto')
2d78b56e 1064subdir('ui')
a81df1b6 1065
3154fee4
MAL
1066
1067if enable_modules
1068 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1069 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1070endif
1071
a81df1b6
PB
1072# Build targets from sourcesets
1073
2becc36a 1074stub_ss = stub_ss.apply(config_all, strict: false)
a81df1b6
PB
1075
1076util_ss.add_all(trace_ss)
2becc36a 1077util_ss = util_ss.apply(config_all, strict: false)
a81df1b6
PB
1078libqemuutil = static_library('qemuutil',
1079 sources: util_ss.sources() + stub_ss.sources() + genh,
aa087962 1080 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
a81df1b6 1081qemuutil = declare_dependency(link_with: libqemuutil,
04c6f1e7 1082 sources: genh + version_res)
a81df1b6 1083
abff1abf
PB
1084decodetree = generator(find_program('scripts/decodetree.py'),
1085 output: 'decode-@BASENAME@.c.inc',
1086 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1087
478e943f 1088subdir('audio')
7fcfd456 1089subdir('io')
848e8ff6 1090subdir('chardev')
ec0d5893 1091subdir('fsdev')
abff1abf 1092subdir('libdecnumber')
d3b18480 1093subdir('target')
708eab42 1094subdir('dump')
ec0d5893 1095
5e5733e5
MAL
1096block_ss.add(files(
1097 'block.c',
56ee8626 1098 'blockdev-nbd.c',
5e5733e5
MAL
1099 'blockjob.c',
1100 'job.c',
1101 'qemu-io-cmds.c',
1102))
1103block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1104
1105subdir('nbd')
1106subdir('scsi')
1107subdir('block')
1108
4a96337d
PB
1109blockdev_ss.add(files(
1110 'blockdev.c',
4a96337d
PB
1111 'iothread.c',
1112 'job-qmp.c',
1113))
1114
1115# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1116# os-win32.c does not
1117blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1118softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1119
1120softmmu_ss.add_all(blockdev_ss)
1121softmmu_ss.add(files(
1122 'bootdevice.c',
1123 'dma-helpers.c',
1124 'qdev-monitor.c',
1125), sdl)
1126
1127softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1128softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1129softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1130
1131common_ss.add(files('cpus-common.c'))
1132
5d3ea0e1 1133subdir('softmmu')
c9322ab5 1134
c7c91a74 1135specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
c9322ab5
MAL
1136specific_ss.add(files('exec-vary.c'))
1137specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1138 'fpu/softfloat.c',
1139 'tcg/optimize.c',
1140 'tcg/tcg-common.c',
1141 'tcg/tcg-op-gvec.c',
1142 'tcg/tcg-op-vec.c',
1143 'tcg/tcg-op.c',
1144 'tcg/tcg.c',
1145))
1146specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1147
ab318051 1148subdir('backends')
c574e161 1149subdir('disas')
55166230 1150subdir('migration')
ff219dca 1151subdir('monitor')
cdaf0722 1152subdir('net')
17ef2af6 1153subdir('replay')
582ea95f 1154subdir('hw')
1a82878a 1155subdir('accel')
f556b4a1 1156subdir('plugins')
b309c321 1157subdir('bsd-user')
3a30446a
MAL
1158subdir('linux-user')
1159
b309c321
MAL
1160bsd_user_ss.add(files('gdbstub.c'))
1161specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1162
3a30446a
MAL
1163linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1164specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
5d3ea0e1 1165
a2ce7dbd
PB
1166# needed for fuzzing binaries
1167subdir('tests/qtest/libqos')
64ed6f92 1168subdir('tests/qtest/fuzz')
a2ce7dbd 1169
3154fee4
MAL
1170block_mods = []
1171softmmu_mods = []
1172foreach d, list : modules
1173 foreach m, module_ss : list
1174 if enable_modules and targetos != 'windows'
3e292c51 1175 module_ss = module_ss.apply(config_all, strict: false)
3154fee4
MAL
1176 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1177 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1178 if d == 'block'
1179 block_mods += sl
1180 else
1181 softmmu_mods += sl
1182 endif
1183 else
1184 if d == 'block'
1185 block_ss.add_all(module_ss)
1186 else
1187 softmmu_ss.add_all(module_ss)
1188 endif
1189 endif
1190 endforeach
1191endforeach
1192
1193nm = find_program('nm')
604f3e4e 1194undefsym = find_program('scripts/undefsym.py')
3154fee4
MAL
1195block_syms = custom_target('block.syms', output: 'block.syms',
1196 input: [libqemuutil, block_mods],
1197 capture: true,
1198 command: [undefsym, nm, '@INPUT@'])
1199qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1200 input: [libqemuutil, softmmu_mods],
1201 capture: true,
1202 command: [undefsym, nm, '@INPUT@'])
1203
5e5733e5
MAL
1204block_ss = block_ss.apply(config_host, strict: false)
1205libblock = static_library('block', block_ss.sources() + genh,
1206 dependencies: block_ss.dependencies(),
1207 link_depends: block_syms,
1208 name_suffix: 'fa',
1209 build_by_default: false)
1210
1211block = declare_dependency(link_whole: [libblock],
b7c70bf2
MAL
1212 link_args: '@block.syms',
1213 dependencies: [crypto, io])
5e5733e5 1214
ff219dca
PB
1215qmp_ss = qmp_ss.apply(config_host, strict: false)
1216libqmp = static_library('qmp', qmp_ss.sources() + genh,
1217 dependencies: qmp_ss.dependencies(),
1218 name_suffix: 'fa',
1219 build_by_default: false)
1220
1221qmp = declare_dependency(link_whole: [libqmp])
1222
3154fee4
MAL
1223foreach m : block_mods + softmmu_mods
1224 shared_module(m.name(),
1225 name_prefix: '',
1226 link_whole: m,
1227 install: true,
1228 install_dir: config_host['qemu_moddir'])
1229endforeach
1230
64ed6f92
PB
1231softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1232common_ss.add(qom, qemuutil)
1233
1234common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
2becc36a
PB
1235common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1236
1237common_all = common_ss.apply(config_all, strict: false)
1238common_all = static_library('common',
1239 build_by_default: false,
1240 sources: common_all.sources() + genh,
1241 dependencies: common_all.dependencies(),
1242 name_suffix: 'fa')
1243
c9322ab5
MAL
1244feature_to_c = find_program('scripts/feature_to_c.sh')
1245
fd5eef85 1246emulators = {}
2becc36a
PB
1247foreach target : target_dirs
1248 config_target = config_target_mak[target]
1249 target_name = config_target['TARGET_NAME']
1250 arch = config_target['TARGET_BASE_ARCH']
859aef02 1251 arch_srcs = [config_target_h[target]]
64ed6f92
PB
1252 arch_deps = []
1253 c_args = ['-DNEED_CPU_H',
1254 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1255 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
b6c7cfd4 1256 link_args = emulator_link_args
2becc36a 1257
859aef02 1258 config_target += config_host
2becc36a
PB
1259 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1260 if targetos == 'linux'
1261 target_inc += include_directories('linux-headers', is_system: true)
1262 endif
1263 if target.endswith('-softmmu')
1264 qemu_target_name = 'qemu-system-' + target_name
1265 target_type='system'
abff1abf
PB
1266 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1267 arch_srcs += t.sources()
64ed6f92 1268 arch_deps += t.dependencies()
abff1abf 1269
2c44220d
MAL
1270 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1271 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1272 arch_srcs += hw.sources()
64ed6f92 1273 arch_deps += hw.dependencies()
2c44220d 1274
2becc36a 1275 arch_srcs += config_devices_h[target]
64ed6f92 1276 link_args += ['@block.syms', '@qemu.syms']
2becc36a 1277 else
3a30446a 1278 abi = config_target['TARGET_ABI_DIR']
2becc36a
PB
1279 target_type='user'
1280 qemu_target_name = 'qemu-' + target_name
1281 if 'CONFIG_LINUX_USER' in config_target
1282 base_dir = 'linux-user'
1283 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1284 else
1285 base_dir = 'bsd-user'
1286 endif
1287 target_inc += include_directories(
1288 base_dir,
3a30446a 1289 base_dir / abi,
2becc36a 1290 )
3a30446a
MAL
1291 if 'CONFIG_LINUX_USER' in config_target
1292 dir = base_dir / abi
1293 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1294 if config_target.has_key('TARGET_SYSTBL_ABI')
1295 arch_srcs += \
1296 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1297 extra_args : config_target['TARGET_SYSTBL_ABI'])
1298 endif
1299 endif
2becc36a
PB
1300 endif
1301
c9322ab5
MAL
1302 if 'TARGET_XML_FILES' in config_target
1303 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1304 output: target + '-gdbstub-xml.c',
1305 input: files(config_target['TARGET_XML_FILES'].split()),
1306 command: [feature_to_c, '@INPUT@'],
1307 capture: true)
1308 arch_srcs += gdbstub_xml
1309 endif
1310
abff1abf
PB
1311 t = target_arch[arch].apply(config_target, strict: false)
1312 arch_srcs += t.sources()
64ed6f92 1313 arch_deps += t.dependencies()
abff1abf 1314
2becc36a
PB
1315 target_common = common_ss.apply(config_target, strict: false)
1316 objects = common_all.extract_objects(target_common.sources())
64ed6f92 1317 deps = target_common.dependencies()
2becc36a 1318
2becc36a
PB
1319 target_specific = specific_ss.apply(config_target, strict: false)
1320 arch_srcs += target_specific.sources()
64ed6f92 1321 arch_deps += target_specific.dependencies()
2becc36a 1322
64ed6f92 1323 lib = static_library('qemu-' + target,
859aef02 1324 sources: arch_srcs + genh,
b7612f45 1325 dependencies: arch_deps,
2becc36a
PB
1326 objects: objects,
1327 include_directories: target_inc,
64ed6f92
PB
1328 c_args: c_args,
1329 build_by_default: false,
2becc36a 1330 name_suffix: 'fa')
64ed6f92
PB
1331
1332 if target.endswith('-softmmu')
1333 execs = [{
1334 'name': 'qemu-system-' + target_name,
1335 'gui': false,
1336 'sources': files('softmmu/main.c'),
1337 'dependencies': []
1338 }]
35be72ba 1339 if targetos == 'windows' and (sdl.found() or gtk.found())
64ed6f92
PB
1340 execs += [{
1341 'name': 'qemu-system-' + target_name + 'w',
1342 'gui': true,
1343 'sources': files('softmmu/main.c'),
1344 'dependencies': []
1345 }]
1346 endif
1347 if config_host.has_key('CONFIG_FUZZ')
1348 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1349 execs += [{
1350 'name': 'qemu-fuzz-' + target_name,
1351 'gui': false,
1352 'sources': specific_fuzz.sources(),
1353 'dependencies': specific_fuzz.dependencies(),
64ed6f92
PB
1354 }]
1355 endif
1356 else
1357 execs = [{
1358 'name': 'qemu-' + target_name,
1359 'gui': false,
1360 'sources': [],
1361 'dependencies': []
1362 }]
1363 endif
1364 foreach exe: execs
fd5eef85
PB
1365 emulators += {exe['name']:
1366 executable(exe['name'], exe['sources'],
64ed6f92
PB
1367 install: true,
1368 c_args: c_args,
1369 dependencies: arch_deps + deps + exe['dependencies'],
1370 objects: lib.extract_all_objects(recursive: true),
1371 link_language: link_language,
1372 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1373 link_args: link_args,
1374 gui_app: exe['gui'])
fd5eef85 1375 }
10e1d263
MAL
1376
1377 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1378 foreach stp: [
bd5f973a
SH
1379 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1380 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
10e1d263
MAL
1381 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1382 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1383 ]
bd5f973a 1384 custom_target(exe['name'] + stp['ext'],
10e1d263 1385 input: trace_events_all,
bd5f973a 1386 output: exe['name'] + stp['ext'],
10e1d263
MAL
1387 capture: true,
1388 install: stp['install'],
ab4c0996 1389 install_dir: qemu_datadir / '../systemtap/tapset',
10e1d263
MAL
1390 command: [
1391 tracetool, '--group=all', '--format=' + stp['fmt'],
1392 '--binary=' + stp['bin'],
1393 '--target-name=' + target_name,
1394 '--target-type=' + target_type,
1395 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1396 '@INPUT@',
1397 ])
1398 endforeach
1399 endif
64ed6f92 1400 endforeach
2becc36a
PB
1401endforeach
1402
931049b4 1403# Other build targets
897b5afa 1404
f556b4a1
PB
1405if 'CONFIG_PLUGIN' in config_host
1406 install_headers('include/qemu/qemu-plugin.h')
1407endif
1408
f15bff25
PB
1409if 'CONFIG_GUEST_AGENT' in config_host
1410 subdir('qga')
1411endif
1412
9755c94a
LV
1413# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1414# when we don't build tools or system
4113f4cf 1415if xkbcommon.found()
28742467
MAL
1416 # used for the update-keymaps target, so include rules even if !have_tools
1417 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1418 dependencies: [qemuutil, xkbcommon], install: have_tools)
1419endif
1420
931049b4 1421if have_tools
b7c70bf2
MAL
1422 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1423 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1424 qemu_io = executable('qemu-io', files('qemu-io.c'),
1425 dependencies: [block, qemuutil], install: true)
eb705985 1426 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
b7c70bf2 1427 dependencies: [block, qemuutil], install: true)
b7c70bf2 1428
7c58bb76 1429 subdir('storage-daemon')
a9c9727c 1430 subdir('contrib/rdmacm-mux')
1d7bb6ab 1431 subdir('contrib/elf2dmp')
a9c9727c 1432
157e7b13
MAL
1433 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1434 dependencies: qemuutil,
1435 install: true)
1436
931049b4
PB
1437 if 'CONFIG_VHOST_USER' in config_host
1438 subdir('contrib/libvhost-user')
2d7ac0af 1439 subdir('contrib/vhost-user-blk')
b7612f45 1440 subdir('contrib/vhost-user-gpu')
32fcc624 1441 subdir('contrib/vhost-user-input')
99650b62 1442 subdir('contrib/vhost-user-scsi')
931049b4 1443 endif
8f51e01c
MAL
1444
1445 if targetos == 'linux'
1446 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1447 dependencies: [qemuutil, libcap_ng],
1448 install: true,
1449 install_dir: get_option('libexecdir'))
897b5afa
MAL
1450
1451 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1452 dependencies: [authz, crypto, io, qom, qemuutil,
6ec0e15d 1453 libcap_ng, mpathpersist],
897b5afa 1454 install: true)
8f51e01c
MAL
1455 endif
1456
5ee24e78
MAL
1457 if 'CONFIG_IVSHMEM' in config_host
1458 subdir('contrib/ivshmem-client')
1459 subdir('contrib/ivshmem-server')
1460 endif
931049b4
PB
1461endif
1462
f5aa6320 1463subdir('scripts')
3f99cf57 1464subdir('tools')
bdcbea7a 1465subdir('pc-bios')
ce1c1e7a 1466subdir('tests')
f8aa24ea 1467subdir('docs')
e8f3bd71
MAL
1468if 'CONFIG_GTK' in config_host
1469 subdir('po')
1470endif
3f99cf57 1471
8adfeba9
MAL
1472if host_machine.system() == 'windows'
1473 nsis_cmd = [
1474 find_program('scripts/nsis.py'),
1475 '@OUTPUT@',
1476 get_option('prefix'),
1477 meson.current_source_dir(),
1478 host_machine.cpu_family(),
1479 '--',
1480 '-DDISPLAYVERSION=' + meson.project_version(),
1481 ]
1482 if build_docs
1483 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1484 endif
1485 if 'CONFIG_GTK' in config_host
1486 nsis_cmd += '-DCONFIG_GTK=y'
1487 endif
1488
1489 nsis = custom_target('nsis',
1490 output: 'qemu-setup-' + meson.project_version() + '.exe',
1491 input: files('qemu.nsi'),
1492 build_always_stale: true,
1493 command: nsis_cmd + ['@INPUT@'])
1494 alias_target('installer', nsis)
1495endif
1496
f9332757
PB
1497summary_info = {}
1498summary_info += {'Install prefix': config_host['prefix']}
1499summary_info += {'BIOS directory': config_host['qemu_datadir']}
1500summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1501summary_info += {'binary directory': config_host['bindir']}
1502summary_info += {'library directory': config_host['libdir']}
1503summary_info += {'module directory': config_host['qemu_moddir']}
1504summary_info += {'libexec directory': config_host['libexecdir']}
1505summary_info += {'include directory': config_host['includedir']}
1506summary_info += {'config directory': config_host['sysconfdir']}
1507if targetos != 'windows'
1508 summary_info += {'local state directory': config_host['qemu_localstatedir']}
b81efab7 1509 summary_info += {'Manual directory': get_option('mandir')}
f9332757
PB
1510else
1511 summary_info += {'local state directory': 'queried at runtime'}
1512endif
491e74c1 1513summary_info += {'Doc directory': get_option('docdir')}
f9332757
PB
1514summary_info += {'Build directory': meson.current_build_dir()}
1515summary_info += {'Source path': meson.current_source_dir()}
1516summary_info += {'GIT binary': config_host['GIT']}
1517summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1518summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1519summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1520if link_language == 'cpp'
1521 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1522else
1523 summary_info += {'C++ compiler': false}
1524endif
1525if targetos == 'darwin'
1526 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1527endif
1528summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1529summary_info += {'CFLAGS': config_host['CFLAGS']}
1530summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1531summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1532summary_info += {'make': config_host['MAKE']}
f9332757
PB
1533summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1534summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1535summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1536# TODO: add back version
1537summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1538if config_host.has_key('CONFIG_SLIRP')
1539 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1540endif
1541summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1542if config_host.has_key('CONFIG_MODULES')
1543 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1544endif
1545summary_info += {'host CPU': cpu}
1546summary_info += {'host endianness': build_machine.endian()}
fdb75aef 1547summary_info += {'target list': ' '.join(target_dirs)}
f9332757
PB
1548summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1549summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1550summary_info += {'strip binaries': get_option('strip')}
1551summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
3e8529dd 1552summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
f9332757
PB
1553if targetos == 'darwin'
1554 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1555endif
1556# TODO: add back version
35be72ba
PB
1557summary_info += {'SDL support': sdl.found()}
1558summary_info += {'SDL image support': sdl_image.found()}
f9332757
PB
1559# TODO: add back version
1560summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1561summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
b7612f45 1562summary_info += {'pixman': pixman.found()}
f9332757
PB
1563# TODO: add back version
1564summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1565summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1566summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1567# TODO: add back version
1568summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1569if config_host.has_key('CONFIG_GCRYPT')
1570 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1571 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1572endif
1573# TODO: add back version
1574summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1575if config_host.has_key('CONFIG_NETTLE')
1576 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1577endif
1578summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1579summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1580summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1581summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1582# TODO: add back version
1583summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1584summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1585summary_info += {'mingw32 support': targetos == 'windows'}
1586summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1587summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1588summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1589summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
6ec0e15d 1590summary_info += {'Multipath support': mpathpersist.found()}
a0b93237
PB
1591summary_info += {'VNC support': vnc.found()}
1592if vnc.found()
1593 summary_info += {'VNC SASL support': sasl.found()}
1594 summary_info += {'VNC JPEG support': jpeg.found()}
1595 summary_info += {'VNC PNG support': png.found()}
f9332757
PB
1596endif
1597summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1598if config_host.has_key('CONFIG_XEN_BACKEND')
1599 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1600endif
1601summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1602summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1603summary_info += {'PIE': get_option('b_pie')}
1604summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1605summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1606summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1607summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1608summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1609summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
05512f55
PB
1610summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1611summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1612summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1613summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1614summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1615if config_all.has_key('CONFIG_TCG')
1616 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1617 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1618endif
aa087962 1619summary_info += {'malloc trim support': has_malloc_trim}
f9332757
PB
1620summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1621summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1622summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1623summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1624summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1625summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1626summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1627summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1628summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1629summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1630summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1631summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1632summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1633summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1634summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1635summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1636summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1637summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1638if config_host['TRACE_BACKENDS'].split().contains('simple')
1639 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1640endif
1641# TODO: add back protocol and server version
1642summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1643summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1644summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1645summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
0a40bcb7 1646summary_info += {'U2F support': u2f.found()}
f9332757
PB
1647summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1648summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1649summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1650summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1651summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1652summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1653summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1654if targetos == 'windows'
1655 if 'WIN_SDK' in config_host
1656 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1657 endif
1658 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1659 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
4bad7c3b 1660 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
f9332757
PB
1661endif
1662summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1663summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1664summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1665summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1666summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1667summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1668summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
bf0e56a3 1669summary_info += {'gcov': get_option('b_coverage')}
f9332757
PB
1670summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1671summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1672summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1673summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1674summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1675summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1676summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1677summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1678summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1679summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1680summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
aa087962 1681summary_info += {'memory allocator': get_option('malloc')}
f9332757
PB
1682summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1683summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1684summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1685summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1686summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1687summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1688summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1689summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1690summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1691summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1692summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1693summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
1694summary_info += {'capstone': config_host.has_key('CONFIG_CAPSTONE')}
1695summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1696summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
f01496a3 1697summary_info += {'libudev': libudev.found()}
f9332757
PB
1698summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1699summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1700summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1701if config_host.has_key('HAVE_GDB_BIN')
1702 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1703endif
1704summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1705summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1706summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1707summary(summary_info, bool_yn: true)
1708
1709if not supported_cpus.contains(cpu)
1710 message()
1711 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1712 message()
1713 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1714 message('The QEMU project intends to remove support for this host CPU in')
1715 message('a future release if nobody volunteers to maintain it and to')
1716 message('provide a build host for our continuous integration setup.')
1717 message('configure has succeeded and you can continue to build, but')
1718 message('if you care about QEMU on this platform you should contact')
1719 message('us upstream at qemu-devel@nongnu.org.')
1720endif
1721
1722if not supported_oses.contains(targetos)
1723 message()
1724 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1725 message()
1726 message('Host OS ' + targetos + 'support is not currently maintained.')
1727 message('The QEMU project intends to remove support for this host OS in')
1728 message('a future release if nobody volunteers to maintain it and to')
1729 message('provide a build host for our continuous integration setup.')
1730 message('configure has succeeded and you can continue to build, but')
1731 message('if you care about QEMU on this platform you should contact')
1732 message('us upstream at qemu-devel@nongnu.org.')
1733endif