blob: 4de1524941be55aa0fcdc50ea95c0ff1ac43b327 [file] [log] [blame]
Paolo Bonzinia5665052019-06-10 12:05:14 +02001project('qemu', ['c'], meson_version: '>=0.55.0',
Gerd Hoffmann90756b22020-08-25 08:43:42 +02002 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
Paolo Bonzini3e0e5192020-09-01 12:48:00 -04003 'b_colorout=auto'],
Paolo Bonzinia5665052019-06-10 12:05:14 +02004 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
Paolo Bonzinib29b40f2020-08-10 18:04:43 +02007if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040012ss = import('sourceset')
13
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010014sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040015cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020016config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040017enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010018enable_static = 'CONFIG_STATIC' in config_host
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +020019build_docs = 'BUILD_DOCS' in config_host
Marc-André Lureau8fe11232020-09-11 14:42:48 +020020
21if get_option('qemu_suffix').startswith('/')
22 error('qemu_suffix cannot start with a /')
23endif
24
Marc-André Lureauab4c0992020-08-26 15:04:16 +040025qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040026qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020027config_host_data = configuration_data()
28genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020029
Paolo Bonzini760e4322020-08-26 08:09:48 +020030target_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
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040040python = 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
Paolo Bonzini8a199802020-09-18 05:37:01 -040053if 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
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040075##################
76# Compiler flags #
77##################
78
Alexander Bulekovff9ed622020-09-09 18:05:16 -040079# 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
Paolo Bonzinia5665052019-06-10 12:05:14 +020087add_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
Alexander Bulekovc46f76d2020-09-02 13:36:50 -040096
Marc-André Lureaufc929892019-07-13 01:47:54 +040097link_language = meson.get_external_property('link_language', 'cpp')
98if link_language == 'cpp'
99 add_languages('cpp', required: true, native: false)
100endif
Paolo Bonzinia5665052019-06-10 12:05:14 +0200101if host_machine.system() == 'darwin'
102 add_languages('objc', required: false, native: false)
103endif
104
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100105if '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
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200112###########################################
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
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400120m = cc.find_library('m', required: false)
121util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200122winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400123socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400124version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400125coref = []
126iokit = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400127cocoa = not_found
Paolo Bonzini8a199802020-09-18 05:37:01 -0400128hvf = not_found
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400129if targetos == 'windows'
130 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200131 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400132
133 win = import('windows')
134 version_res = win.compile_resources('version.rc',
135 depend_files: files('pc-bios/qemu-nsis.ico'),
136 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400137elif targetos == 'darwin'
138 coref = dependency('appleframeworks', modules: 'CoreFoundation')
139 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400140 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200141elif targetos == 'sunos'
142 socket = [cc.find_library('socket'),
143 cc.find_library('nsl'),
144 cc.find_library('resolv')]
145elif targetos == 'haiku'
146 socket = [cc.find_library('posix_error_mapper'),
147 cc.find_library('network'),
148 cc.find_library('bsd')]
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400149endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200150
Paolo Bonzini8a199802020-09-18 05:37:01 -0400151accelerators = []
152if not get_option('kvm').disabled() and targetos == 'linux'
153 accelerators += 'CONFIG_KVM'
154endif
155if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
156 accelerators += 'CONFIG_XEN'
157 have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
158else
159 have_xen_pci_passthrough = false
160endif
161if not get_option('whpx').disabled() and targetos == 'windows'
162 if get_option('whpx').enabled() and cpu != 'x86_64'
163 error('WHPX requires 64-bit host')
164 elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
165 cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
166 accelerators += 'CONFIG_WHPX'
167 endif
168endif
169if not get_option('hvf').disabled()
170 hvf = dependency('appleframeworks', modules: 'Hypervisor',
171 required: get_option('hvf'))
172 if hvf.found()
173 accelerators += 'CONFIG_HVF'
174 endif
175endif
176if not get_option('hax').disabled()
177 if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
178 accelerators += 'CONFIG_HAX'
179 endif
180endif
181if not get_option('tcg').disabled()
182 if cpu not in supported_cpus
183 if 'CONFIG_TCG_INTERPRETER' in config_host
184 warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
185 else
186 error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
187 endif
188 endif
189 accelerators += 'CONFIG_TCG'
190 config_host += { 'CONFIG_TCG': 'y' }
191endif
192
193if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
194 error('KVM not available on this platform')
195endif
196if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
197 error('HVF not available on this platform')
198endif
199if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
200 error('WHPX not available on this platform')
201endif
202if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
203 if 'CONFIG_XEN' in accelerators
204 error('Xen PCI passthrough not available on this platform')
205 else
206 error('Xen PCI passthrough requested but Xen not enabled')
207 endif
208endif
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400209if not cocoa.found() and get_option('cocoa').enabled()
210 error('Cocoa not available on this platform')
211endif
212
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200213################
214# Dependencies #
215################
216
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400217# The path to glib.h is added to all compilation commands. This was
218# grandfathered in from the QEMU Makefiles.
219add_project_arguments(config_host['GLIB_CFLAGS'].split(),
220 native: false, language: ['c', 'cpp', 'objc'])
221glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400222gio = not_found
223if 'CONFIG_GIO' in config_host
224 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
225 link_args: config_host['GIO_LIBS'].split())
226endif
227lttng = not_found
228if 'CONFIG_TRACE_UST' in config_host
229 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
230endif
231urcubp = not_found
232if 'CONFIG_TRACE_UST' in config_host
233 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
234endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100235gcrypt = not_found
236if 'CONFIG_GCRYPT' in config_host
237 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
238 link_args: config_host['GCRYPT_LIBS'].split())
239endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400240nettle = not_found
241if 'CONFIG_NETTLE' in config_host
242 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
243 link_args: config_host['NETTLE_LIBS'].split())
244endif
245gnutls = not_found
246if 'CONFIG_GNUTLS' in config_host
247 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
248 link_args: config_host['GNUTLS_LIBS'].split())
249endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200250pixman = not_found
251if have_system or have_tools
252 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400253 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200254endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400255pam = not_found
256if 'CONFIG_AUTH_PAM' in config_host
257 pam = cc.find_library('pam')
258endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400259libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200260zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400261linux_io_uring = not_found
262if 'CONFIG_LINUX_IO_URING' in config_host
263 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
264 link_args: config_host['LINUX_IO_URING_LIBS'].split())
265endif
266libxml2 = not_found
267if 'CONFIG_LIBXML2' in config_host
268 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
269 link_args: config_host['LIBXML2_LIBS'].split())
270endif
271libnfs = not_found
272if 'CONFIG_LIBNFS' in config_host
273 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
274endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400275libattr = not_found
276if 'CONFIG_ATTR' in config_host
277 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
278endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100279seccomp = not_found
280if 'CONFIG_SECCOMP' in config_host
281 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
282 link_args: config_host['SECCOMP_LIBS'].split())
283endif
284libcap_ng = not_found
285if 'CONFIG_LIBCAP_NG' in config_host
286 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
287endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400288if get_option('xkbcommon').auto() and not have_system and not have_tools
289 xkbcommon = not_found
290else
291 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400292 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400293endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400294slirp = not_found
295if config_host.has_key('CONFIG_SLIRP')
296 slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
297 link_args: config_host['SLIRP_LIBS'].split())
298endif
299vde = not_found
300if config_host.has_key('CONFIG_VDE')
301 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
302endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200303pulse = not_found
304if 'CONFIG_LIBPULSE' in config_host
305 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
306 link_args: config_host['PULSE_LIBS'].split())
307endif
308alsa = not_found
309if 'CONFIG_ALSA' in config_host
310 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
311 link_args: config_host['ALSA_LIBS'].split())
312endif
313jack = not_found
314if 'CONFIG_LIBJACK' in config_host
315 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
316endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200317spice = not_found
318if 'CONFIG_SPICE' in config_host
319 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
320 link_args: config_host['SPICE_LIBS'].split())
321endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400322rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400323libdl = not_found
324if 'CONFIG_PLUGIN' in config_host
325 libdl = cc.find_library('dl', required: true)
326endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200327libiscsi = not_found
328if 'CONFIG_LIBISCSI' in config_host
329 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
330 link_args: config_host['LIBISCSI_LIBS'].split())
331endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400332zstd = not_found
333if 'CONFIG_ZSTD' in config_host
334 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
335 link_args: config_host['ZSTD_LIBS'].split())
336endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400337gbm = not_found
338if 'CONFIG_GBM' in config_host
339 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
340 link_args: config_host['GBM_LIBS'].split())
341endif
342virgl = not_found
343if 'CONFIG_VIRGL' in config_host
344 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
345 link_args: config_host['VIRGL_LIBS'].split())
346endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400347curl = not_found
348if 'CONFIG_CURL' in config_host
349 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
350 link_args: config_host['CURL_LIBS'].split())
351endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200352libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200353if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200354 libudev = dependency('libudev',
355 required: get_option('mpath').enabled(),
356 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200357endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200358
359mpathpersist = not_found
360mpathpersist_new_api = false
361if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
362 mpath_test_source_new = '''
363 #include <libudev.h>
364 #include <mpath_persist.h>
365 unsigned mpath_mx_alloc_len = 1024;
366 int logsink;
367 static struct config *multipath_conf;
368 extern struct udev *udev;
369 extern struct config *get_multipath_config(void);
370 extern void put_multipath_config(struct config *conf);
371 struct udev *udev;
372 struct config *get_multipath_config(void) { return multipath_conf; }
373 void put_multipath_config(struct config *conf) { }
374 int main(void) {
375 udev = udev_new();
376 multipath_conf = mpath_lib_init();
377 return 0;
378 }'''
379 mpath_test_source_old = '''
380 #include <libudev.h>
381 #include <mpath_persist.h>
382 unsigned mpath_mx_alloc_len = 1024;
383 int logsink;
384 int main(void) {
385 struct udev *udev = udev_new();
386 mpath_lib_init(udev);
387 return 0;
388 }'''
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200389 mpathlibs = [libudev]
390 if enable_static
391 mpathlibs += cc.find_library('devmapper',
392 required: get_option('mpath'),
393 static: enable_static)
394 endif
395 mpathlibs += cc.find_library('multipath',
396 required: get_option('mpath'),
397 static: enable_static)
398 mpathlibs += cc.find_library('mpathpersist',
399 required: get_option('mpath'),
400 static: enable_static)
401 foreach lib: mpathlibs
402 if not lib.found()
403 mpathlibs = []
404 break
405 endif
406 endforeach
407 if mpathlibs.length() > 0
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200408 if cc.links(mpath_test_source_new, dependencies: mpathlibs)
409 mpathpersist = declare_dependency(dependencies: mpathlibs)
410 mpathpersist_new_api = true
411 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
412 mpathpersist = declare_dependency(dependencies: mpathlibs)
413 else
414 if get_option('mpath').enabled()
415 error('Cannot detect libmpathpersist API')
416 else
417 warning('Cannot detect libmpathpersist API, disabling')
418 endif
419 endif
420 endif
421endif
422
Paolo Bonzini26347332019-07-29 15:40:07 +0200423brlapi = not_found
424if 'CONFIG_BRLAPI' in config_host
425 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
426endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100427
Paolo Bonzini760e4322020-08-26 08:09:48 +0200428sdl = not_found
429if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800430 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200431 sdl_image = not_found
432endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100433if sdl.found()
434 # work around 2.0.8 bug
435 sdl = declare_dependency(compile_args: '-Wno-undef',
436 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200437 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400438 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100439else
440 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100441 error('sdl-image required, but SDL was @0@'.format(
442 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100443 endif
444 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200445endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100446
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400447rbd = not_found
448if 'CONFIG_RBD' in config_host
449 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
450endif
451glusterfs = not_found
452if 'CONFIG_GLUSTERFS' in config_host
453 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
454 link_args: config_host['GLUSTERFS_LIBS'].split())
455endif
456libssh = not_found
457if 'CONFIG_LIBSSH' in config_host
458 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
459 link_args: config_host['LIBSSH_LIBS'].split())
460endif
461libbzip2 = not_found
462if 'CONFIG_BZIP2' in config_host
463 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
464endif
465liblzfse = not_found
466if 'CONFIG_LZFSE' in config_host
467 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
468endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200469oss = not_found
470if 'CONFIG_AUDIO_OSS' in config_host
471 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
472endif
473dsound = not_found
474if 'CONFIG_AUDIO_DSOUND' in config_host
475 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
476endif
477coreaudio = not_found
478if 'CONFIG_AUDIO_COREAUDIO' in config_host
479 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
480endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400481opengl = not_found
482if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400483 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
484 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400485endif
486gtk = not_found
487if 'CONFIG_GTK' in config_host
488 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
489 link_args: config_host['GTK_LIBS'].split())
490endif
491vte = not_found
492if 'CONFIG_VTE' in config_host
493 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
494 link_args: config_host['VTE_LIBS'].split())
495endif
496x11 = not_found
497if 'CONFIG_X11' in config_host
498 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
499 link_args: config_host['X11_LIBS'].split())
500endif
501curses = not_found
502if 'CONFIG_CURSES' in config_host
503 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
504 link_args: config_host['CURSES_LIBS'].split())
505endif
506iconv = not_found
507if 'CONFIG_ICONV' in config_host
508 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
509 link_args: config_host['ICONV_LIBS'].split())
510endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100511vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400512png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400513jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400514sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100515if get_option('vnc').enabled()
516 vnc = declare_dependency() # dummy dependency
517 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400518 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100519 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
520 required: get_option('vnc_jpeg'),
521 static: enable_static)
522 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
523 required: get_option('vnc_sasl'),
524 static: enable_static)
525 if sasl.found()
526 sasl = declare_dependency(dependencies: sasl,
527 compile_args: '-DSTRUCT_IOVEC_DEFINED')
528 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400529endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200530fdt = not_found
531if 'CONFIG_FDT' in config_host
532 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
533 link_args: config_host['FDT_LIBS'].split())
534endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400535snappy = not_found
536if 'CONFIG_SNAPPY' in config_host
537 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
538endif
539lzo = not_found
540if 'CONFIG_LZO' in config_host
541 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
542endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400543rdma = not_found
544if 'CONFIG_RDMA' in config_host
545 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
546endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400547numa = not_found
548if 'CONFIG_NUMA' in config_host
549 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
550endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400551xen = not_found
552if 'CONFIG_XEN_BACKEND' in config_host
553 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
554 link_args: config_host['XEN_LIBS'].split())
555endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200556cacard = not_found
557if 'CONFIG_SMARTCARD' in config_host
558 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
559 link_args: config_host['SMARTCARD_LIBS'].split())
560endif
César Belley0a40bcb2020-08-26 13:42:04 +0200561u2f = not_found
562if have_system
563 u2f = dependency('u2f-emu', required: get_option('u2f'),
564 method: 'pkg-config',
565 static: enable_static)
566endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200567usbredir = not_found
568if 'CONFIG_USB_REDIR' in config_host
569 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
570 link_args: config_host['USB_REDIR_LIBS'].split())
571endif
572libusb = not_found
573if 'CONFIG_USB_LIBUSB' in config_host
574 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
575 link_args: config_host['LIBUSB_LIBS'].split())
576endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400577capstone = not_found
578if 'CONFIG_CAPSTONE' in config_host
579 capstone = declare_dependency(compile_args: config_host['CAPSTONE_CFLAGS'].split(),
580 link_args: config_host['CAPSTONE_LIBS'].split())
581endif
582libpmem = not_found
583if 'CONFIG_LIBPMEM' in config_host
584 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
585 link_args: config_host['LIBPMEM_LIBS'].split())
586endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600587libdaxctl = not_found
588if 'CONFIG_LIBDAXCTL' in config_host
589 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
590endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400591tasn1 = not_found
592if 'CONFIG_TASN1' in config_host
593 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
594 link_args: config_host['TASN1_LIBS'].split())
595endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400596keyutils = dependency('libkeyutils', required: false,
597 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400598
Marc-André Lureau3909def2020-08-28 15:07:33 +0400599has_gettid = cc.has_function('gettid')
600
Paolo Bonziniaa087962020-09-01 11:15:30 -0400601# Malloc tests
602
603malloc = []
604if get_option('malloc') == 'system'
605 has_malloc_trim = \
606 not get_option('malloc_trim').disabled() and \
607 cc.links('''#include <malloc.h>
608 int main(void) { malloc_trim(0); return 0; }''')
609else
610 has_malloc_trim = false
611 malloc = cc.find_library(get_option('malloc'), required: true)
612endif
613if not has_malloc_trim and get_option('malloc_trim').enabled()
614 if get_option('malloc') == 'system'
615 error('malloc_trim not available on this platform.')
616 else
617 error('malloc_trim not available with non-libc memory allocator')
618 endif
619endif
620
Paolo Bonzini859aef02020-08-04 18:14:26 +0200621# Create config-host.h
622
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400623config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200624config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200625config_host_data.set('CONFIG_MPATH', mpathpersist.found())
626config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100627config_host_data.set('CONFIG_SDL', sdl.found())
628config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100629config_host_data.set('CONFIG_VNC', vnc.found())
630config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
631config_host_data.set('CONFIG_VNC_PNG', png.found())
632config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200633config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400634config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400635config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400636config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200637config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
638config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
639config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
640config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
641
Paolo Bonzini765686d2020-09-18 06:37:21 -0400642ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
Paolo Bonzini859aef02020-08-04 18:14:26 +0200643arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200644strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200645 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200646 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200647foreach k, v: config_host
Paolo Bonzini765686d2020-09-18 06:37:21 -0400648 if ignored.contains(k)
649 # do nothing
650 elif arrays.contains(k)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200651 if v != ''
652 v = '"' + '", "'.join(v.split()) + '", '
653 endif
654 config_host_data.set(k, v)
655 elif k == 'ARCH'
656 config_host_data.set('HOST_' + v.to_upper(), 1)
657 elif strings.contains(k)
658 if not k.startswith('CONFIG_')
659 k = 'CONFIG_' + k.to_upper()
660 endif
661 config_host_data.set_quoted(k, v)
662 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
663 config_host_data.set(k, v == 'y' ? 1 : v)
664 endif
665endforeach
666genh += configure_file(output: 'config-host.h', configuration: config_host_data)
667
Paolo Bonzini2becc362020-02-03 11:42:03 +0100668minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400669config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400670config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400671config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100672config_devices_mak_list = []
673config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200674config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100675config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400676
677disassemblers = {
678 'alpha' : ['CONFIG_ALPHA_DIS'],
679 'arm' : ['CONFIG_ARM_DIS'],
680 'avr' : ['CONFIG_AVR_DIS'],
681 'cris' : ['CONFIG_CRIS_DIS'],
682 'hppa' : ['CONFIG_HPPA_DIS'],
683 'i386' : ['CONFIG_I386_DIS'],
684 'x86_64' : ['CONFIG_I386_DIS'],
685 'x32' : ['CONFIG_I386_DIS'],
686 'lm32' : ['CONFIG_LM32_DIS'],
687 'm68k' : ['CONFIG_M68K_DIS'],
688 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
689 'mips' : ['CONFIG_MIPS_DIS'],
690 'moxie' : ['CONFIG_MOXIE_DIS'],
691 'nios2' : ['CONFIG_NIOS2_DIS'],
692 'or1k' : ['CONFIG_OPENRISC_DIS'],
693 'ppc' : ['CONFIG_PPC_DIS'],
694 'riscv' : ['CONFIG_RISCV_DIS'],
695 'rx' : ['CONFIG_RX_DIS'],
696 's390' : ['CONFIG_S390_DIS'],
697 'sh4' : ['CONFIG_SH4_DIS'],
698 'sparc' : ['CONFIG_SPARC_DIS'],
699 'xtensa' : ['CONFIG_XTENSA_DIS'],
700}
701if link_language == 'cpp'
702 disassemblers += {
703 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
704 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
705 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
706 }
707endif
708
Paolo Bonzini2becc362020-02-03 11:42:03 +0100709kconfig_external_symbols = [
710 'CONFIG_KVM',
711 'CONFIG_XEN',
712 'CONFIG_TPM',
713 'CONFIG_SPICE',
714 'CONFIG_IVSHMEM',
715 'CONFIG_OPENGL',
716 'CONFIG_X11',
717 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200718 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100719 'CONFIG_VHOST_KERNEL',
720 'CONFIG_VIRTFS',
721 'CONFIG_LINUX',
722 'CONFIG_PVRDMA',
723]
Paolo Bonzini859aef02020-08-04 18:14:26 +0200724ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400725
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400726foreach target : target_dirs
Paolo Bonzini765686d2020-09-18 06:37:21 -0400727 config_target = { 'TARGET_NAME': target.split('-')[0] }
728 if target.endswith('linux-user')
729 assert(targetos == 'linux')
730 config_target += { 'CONFIG_LINUX_USER': 'y' }
731 elif target.endswith('bsd-user')
732 assert('CONFIG_BSD' in config_host)
733 config_target += { 'CONFIG_BSD_USER': 'y' }
734 elif target.endswith('softmmu')
735 config_target += { 'CONFIG_SOFTMMU': 'y' }
736 endif
737 if target.endswith('-user')
738 config_target += {
739 'CONFIG_USER_ONLY': 'y',
740 'CONFIG_QEMU_INTERP_PREFIX':
741 config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
742 }
743 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200744
Paolo Bonzini8a199802020-09-18 05:37:01 -0400745 have_accel = false
746 foreach sym: accelerators
747 if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
748 config_target += { sym: 'y' }
749 config_all += { sym: 'y' }
750 if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
751 config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
752 endif
753 have_accel = true
754 endif
755 endforeach
756 assert(have_accel)
757
Paolo Bonzini765686d2020-09-18 06:37:21 -0400758 config_target += keyval.load('default-configs/targets' / target + '.mak')
759
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400760 foreach k, v: disassemblers
761 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
762 foreach sym: v
763 config_target += { sym: 'y' }
764 config_all_disas += { sym: 'y' }
765 endforeach
766 endif
767 endforeach
768
Paolo Bonzini859aef02020-08-04 18:14:26 +0200769 config_target_data = configuration_data()
770 foreach k, v: config_target
771 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
772 # do nothing
773 elif ignored.contains(k)
774 # do nothing
775 elif k == 'TARGET_BASE_ARCH'
776 config_target_data.set('TARGET_' + v.to_upper(), 1)
Paolo Bonzini765686d2020-09-18 06:37:21 -0400777 elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
Paolo Bonzini859aef02020-08-04 18:14:26 +0200778 config_target_data.set_quoted(k, v)
779 elif v == 'y'
780 config_target_data.set(k, 1)
781 else
782 config_target_data.set(k, v)
783 endif
784 endforeach
785 config_target_h += {target: configure_file(output: target + '-config-target.h',
786 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100787
788 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100789 base_kconfig = []
790 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200791 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100792 base_kconfig += '@0@=y'.format(sym)
793 endif
794 endforeach
795
796 config_devices_mak = target + '-config-devices.mak'
797 config_devices_mak = configure_file(
Paolo Bonzini1bb4cb12020-09-18 06:06:09 -0400798 input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
Paolo Bonzini2becc362020-02-03 11:42:03 +0100799 output: config_devices_mak,
800 depfile: config_devices_mak + '.d',
801 capture: true,
802 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
803 config_devices_mak, '@DEPFILE@', '@INPUT@',
804 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200805
806 config_devices_data = configuration_data()
807 config_devices = keyval.load(config_devices_mak)
808 foreach k, v: config_devices
809 config_devices_data.set(k, 1)
810 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100811 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200812 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
813 configuration: config_devices_data)}
814 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400815 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100816 endif
817 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400818endforeach
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400819
Paolo Bonzini2becc362020-02-03 11:42:03 +0100820# This configuration is used to build files that are shared by
821# multiple binaries, and then extracted out of the "common"
822# static_library target.
823#
824# We do not use all_sources()/all_dependencies(), because it would
825# build literally all source files, including devices only used by
826# targets that are not built for this compilation. The CONFIG_ALL
827# pseudo symbol replaces it.
828
Paolo Bonzini05512f52020-09-16 15:31:11 -0400829config_all += config_all_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100830config_all += config_host
831config_all += config_all_disas
832config_all += {
833 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
834 'CONFIG_SOFTMMU': have_system,
835 'CONFIG_USER_ONLY': have_user,
836 'CONFIG_ALL': true,
837}
838
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400839# Generators
840
Marc-André Lureau3f885652019-07-15 18:06:04 +0400841hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +0400842shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400843qapi_gen = find_program('scripts/qapi-gen.py')
844qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
845 meson.source_root() / 'scripts/qapi/commands.py',
846 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400847 meson.source_root() / 'scripts/qapi/error.py',
848 meson.source_root() / 'scripts/qapi/events.py',
849 meson.source_root() / 'scripts/qapi/expr.py',
850 meson.source_root() / 'scripts/qapi/gen.py',
851 meson.source_root() / 'scripts/qapi/introspect.py',
852 meson.source_root() / 'scripts/qapi/parser.py',
853 meson.source_root() / 'scripts/qapi/schema.py',
854 meson.source_root() / 'scripts/qapi/source.py',
855 meson.source_root() / 'scripts/qapi/types.py',
856 meson.source_root() / 'scripts/qapi/visit.py',
857 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400858 meson.source_root() / 'scripts/qapi-gen.py'
859]
860
861tracetool = [
862 python, files('scripts/tracetool.py'),
863 '--backend=' + config_host['TRACE_BACKENDS']
864]
865
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400866qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
867 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +0200868 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400869qemu_version = custom_target('qemu-version.h',
870 output: 'qemu-version.h',
871 command: qemu_version_cmd,
872 capture: true,
873 build_by_default: true,
874 build_always_stale: true)
875genh += qemu_version
876
Marc-André Lureau3f885652019-07-15 18:06:04 +0400877hxdep = []
878hx_headers = [
879 ['qemu-options.hx', 'qemu-options.def'],
880 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
881]
882if have_system
883 hx_headers += [
884 ['hmp-commands.hx', 'hmp-commands.h'],
885 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
886 ]
887endif
888foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400889 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +0400890 input: files(d[0]),
891 output: d[1],
892 capture: true,
893 build_by_default: true, # to be removed when added to a target
894 command: [hxtool, '-h', '@INPUT0@'])
895endforeach
896genh += hxdep
897
Peter Maydelleb937362020-09-25 17:23:08 +0100898SPHINX_ARGS = [config_host['SPHINX_BUILD'],
899 '-Dversion=' + meson.project_version(),
900 '-Drelease=' + config_host['PKGVERSION']]
901
902if get_option('werror')
903 SPHINX_ARGS += [ '-W' ]
904endif
905
Peter Maydellb3f48302020-09-25 17:23:09 +0100906sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
907 meson.source_root() / 'docs/sphinx/hxtool.py',
908 meson.source_root() / 'docs/sphinx/kerneldoc.py',
909 meson.source_root() / 'docs/sphinx/kernellog.py',
910 meson.source_root() / 'docs/sphinx/qapidoc.py',
911 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
912 qapi_gen_depends ]
913
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400914# Collect sourcesets.
915
916util_ss = ss.source_set()
917stub_ss = ss.source_set()
918trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400919block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +0200920blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200921qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100922common_ss = ss.source_set()
923softmmu_ss = ss.source_set()
924user_ss = ss.source_set()
925bsd_user_ss = ss.source_set()
926linux_user_ss = ss.source_set()
927specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200928specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100929
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400930modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100931hw_arch = {}
932target_arch = {}
933target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400934
935###############
936# Trace files #
937###############
938
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400939# TODO: add each directory to the subdirs from its own meson.build, once
940# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400941trace_events_subdirs = [
942 'accel/kvm',
943 'accel/tcg',
944 'crypto',
945 'monitor',
946]
947if have_user
948 trace_events_subdirs += [ 'linux-user' ]
949endif
950if have_block
951 trace_events_subdirs += [
952 'authz',
953 'block',
954 'io',
955 'nbd',
956 'scsi',
957 ]
958endif
959if have_system
960 trace_events_subdirs += [
961 'audio',
962 'backends',
963 'backends/tpm',
964 'chardev',
965 'hw/9pfs',
966 'hw/acpi',
967 'hw/alpha',
968 'hw/arm',
969 'hw/audio',
970 'hw/block',
971 'hw/block/dataplane',
972 'hw/char',
973 'hw/display',
974 'hw/dma',
975 'hw/hppa',
976 'hw/hyperv',
977 'hw/i2c',
978 'hw/i386',
979 'hw/i386/xen',
980 'hw/ide',
981 'hw/input',
982 'hw/intc',
983 'hw/isa',
984 'hw/mem',
985 'hw/mips',
986 'hw/misc',
987 'hw/misc/macio',
988 'hw/net',
989 'hw/nvram',
990 'hw/pci',
991 'hw/pci-host',
992 'hw/ppc',
993 'hw/rdma',
994 'hw/rdma/vmw',
995 'hw/rtc',
996 'hw/s390x',
997 'hw/scsi',
998 'hw/sd',
999 'hw/sparc',
1000 'hw/sparc64',
1001 'hw/ssi',
1002 'hw/timer',
1003 'hw/tpm',
1004 'hw/usb',
1005 'hw/vfio',
1006 'hw/virtio',
1007 'hw/watchdog',
1008 'hw/xen',
1009 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001010 'migration',
1011 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001012 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001013 'ui',
1014 ]
1015endif
1016trace_events_subdirs += [
1017 'hw/core',
1018 'qapi',
1019 'qom',
1020 'target/arm',
1021 'target/hppa',
1022 'target/i386',
1023 'target/mips',
1024 'target/ppc',
1025 'target/riscv',
1026 'target/s390x',
1027 'target/sparc',
1028 'util',
1029]
1030
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001031subdir('qapi')
1032subdir('qobject')
1033subdir('stubs')
1034subdir('trace')
1035subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001036subdir('qom')
1037subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001038subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001039subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001040
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001041
1042if enable_modules
1043 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1044 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1045endif
1046
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001047# Build targets from sourcesets
1048
Paolo Bonzini2becc362020-02-03 11:42:03 +01001049stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001050
1051util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001052util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001053libqemuutil = static_library('qemuutil',
1054 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001055 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001056qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001057 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001058
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001059decodetree = generator(find_program('scripts/decodetree.py'),
1060 output: 'decode-@BASENAME@.c.inc',
1061 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1062
Paolo Bonzini478e9432020-08-17 12:47:55 +02001063subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001064subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001065subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001066subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001067subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001068subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001069subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001070
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001071block_ss.add(files(
1072 'block.c',
Kevin Wolf56ee8622020-09-24 17:26:50 +02001073 'blockdev-nbd.c',
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001074 'blockjob.c',
1075 'job.c',
1076 'qemu-io-cmds.c',
1077))
1078block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1079
1080subdir('nbd')
1081subdir('scsi')
1082subdir('block')
1083
Paolo Bonzini4a963372020-08-03 16:22:28 +02001084blockdev_ss.add(files(
1085 'blockdev.c',
Paolo Bonzini4a963372020-08-03 16:22:28 +02001086 'iothread.c',
1087 'job-qmp.c',
1088))
1089
1090# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1091# os-win32.c does not
1092blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1093softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1094
1095softmmu_ss.add_all(blockdev_ss)
1096softmmu_ss.add(files(
1097 'bootdevice.c',
1098 'dma-helpers.c',
1099 'qdev-monitor.c',
1100), sdl)
1101
1102softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1103softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1104softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1105
1106common_ss.add(files('cpus-common.c'))
1107
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001108subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001109
Bruce Rogersc7c91a72020-08-24 09:52:12 -06001110specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001111specific_ss.add(files('exec-vary.c'))
1112specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1113 'fpu/softfloat.c',
1114 'tcg/optimize.c',
1115 'tcg/tcg-common.c',
1116 'tcg/tcg-op-gvec.c',
1117 'tcg/tcg-op-vec.c',
1118 'tcg/tcg-op.c',
1119 'tcg/tcg.c',
1120))
1121specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1122
Marc-André Lureauab318052019-07-24 19:23:16 +04001123subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001124subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001125subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001126subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001127subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001128subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001129subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001130subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001131subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001132subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001133subdir('linux-user')
1134
Marc-André Lureaub309c322019-08-18 19:20:37 +04001135bsd_user_ss.add(files('gdbstub.c'))
1136specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1137
Marc-André Lureau3a304462019-08-18 16:13:08 +04001138linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1139specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001140
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001141# needed for fuzzing binaries
1142subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001143subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001144
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001145block_mods = []
1146softmmu_mods = []
1147foreach d, list : modules
1148 foreach m, module_ss : list
1149 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001150 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001151 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1152 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1153 if d == 'block'
1154 block_mods += sl
1155 else
1156 softmmu_mods += sl
1157 endif
1158 else
1159 if d == 'block'
1160 block_ss.add_all(module_ss)
1161 else
1162 softmmu_ss.add_all(module_ss)
1163 endif
1164 endif
1165 endforeach
1166endforeach
1167
1168nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001169undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001170block_syms = custom_target('block.syms', output: 'block.syms',
1171 input: [libqemuutil, block_mods],
1172 capture: true,
1173 command: [undefsym, nm, '@INPUT@'])
1174qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1175 input: [libqemuutil, softmmu_mods],
1176 capture: true,
1177 command: [undefsym, nm, '@INPUT@'])
1178
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001179block_ss = block_ss.apply(config_host, strict: false)
1180libblock = static_library('block', block_ss.sources() + genh,
1181 dependencies: block_ss.dependencies(),
1182 link_depends: block_syms,
1183 name_suffix: 'fa',
1184 build_by_default: false)
1185
1186block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001187 link_args: '@block.syms',
1188 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001189
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001190qmp_ss = qmp_ss.apply(config_host, strict: false)
1191libqmp = static_library('qmp', qmp_ss.sources() + genh,
1192 dependencies: qmp_ss.dependencies(),
1193 name_suffix: 'fa',
1194 build_by_default: false)
1195
1196qmp = declare_dependency(link_whole: [libqmp])
1197
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001198foreach m : block_mods + softmmu_mods
1199 shared_module(m.name(),
1200 name_prefix: '',
1201 link_whole: m,
1202 install: true,
1203 install_dir: config_host['qemu_moddir'])
1204endforeach
1205
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001206softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1207common_ss.add(qom, qemuutil)
1208
1209common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001210common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1211
1212common_all = common_ss.apply(config_all, strict: false)
1213common_all = static_library('common',
1214 build_by_default: false,
1215 sources: common_all.sources() + genh,
1216 dependencies: common_all.dependencies(),
1217 name_suffix: 'fa')
1218
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001219feature_to_c = find_program('scripts/feature_to_c.sh')
1220
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001221emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001222foreach target : target_dirs
1223 config_target = config_target_mak[target]
1224 target_name = config_target['TARGET_NAME']
1225 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001226 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001227 arch_deps = []
1228 c_args = ['-DNEED_CPU_H',
1229 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1230 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
1231 link_args = []
Paolo Bonzini2becc362020-02-03 11:42:03 +01001232
Paolo Bonzini859aef02020-08-04 18:14:26 +02001233 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001234 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1235 if targetos == 'linux'
1236 target_inc += include_directories('linux-headers', is_system: true)
1237 endif
1238 if target.endswith('-softmmu')
1239 qemu_target_name = 'qemu-system-' + target_name
1240 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001241 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1242 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001243 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001244
Marc-André Lureau2c442202019-08-17 13:55:58 +04001245 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1246 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1247 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001248 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001249
Paolo Bonzini2becc362020-02-03 11:42:03 +01001250 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001251 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001252 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001253 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001254 target_type='user'
1255 qemu_target_name = 'qemu-' + target_name
1256 if 'CONFIG_LINUX_USER' in config_target
1257 base_dir = 'linux-user'
1258 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1259 else
1260 base_dir = 'bsd-user'
1261 endif
1262 target_inc += include_directories(
1263 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001264 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001265 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001266 if 'CONFIG_LINUX_USER' in config_target
1267 dir = base_dir / abi
1268 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1269 if config_target.has_key('TARGET_SYSTBL_ABI')
1270 arch_srcs += \
1271 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1272 extra_args : config_target['TARGET_SYSTBL_ABI'])
1273 endif
1274 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001275 endif
1276
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001277 if 'TARGET_XML_FILES' in config_target
1278 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1279 output: target + '-gdbstub-xml.c',
1280 input: files(config_target['TARGET_XML_FILES'].split()),
1281 command: [feature_to_c, '@INPUT@'],
1282 capture: true)
1283 arch_srcs += gdbstub_xml
1284 endif
1285
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001286 t = target_arch[arch].apply(config_target, strict: false)
1287 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001288 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001289
Paolo Bonzini2becc362020-02-03 11:42:03 +01001290 target_common = common_ss.apply(config_target, strict: false)
1291 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001292 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001293
Paolo Bonzini2becc362020-02-03 11:42:03 +01001294 target_specific = specific_ss.apply(config_target, strict: false)
1295 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001296 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001297
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001298 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001299 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001300 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001301 objects: objects,
1302 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001303 c_args: c_args,
1304 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001305 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001306
1307 if target.endswith('-softmmu')
1308 execs = [{
1309 'name': 'qemu-system-' + target_name,
1310 'gui': false,
1311 'sources': files('softmmu/main.c'),
1312 'dependencies': []
1313 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001314 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001315 execs += [{
1316 'name': 'qemu-system-' + target_name + 'w',
1317 'gui': true,
1318 'sources': files('softmmu/main.c'),
1319 'dependencies': []
1320 }]
1321 endif
1322 if config_host.has_key('CONFIG_FUZZ')
1323 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1324 execs += [{
1325 'name': 'qemu-fuzz-' + target_name,
1326 'gui': false,
1327 'sources': specific_fuzz.sources(),
1328 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001329 }]
1330 endif
1331 else
1332 execs = [{
1333 'name': 'qemu-' + target_name,
1334 'gui': false,
1335 'sources': [],
1336 'dependencies': []
1337 }]
1338 endif
1339 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001340 emulators += {exe['name']:
1341 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001342 install: true,
1343 c_args: c_args,
1344 dependencies: arch_deps + deps + exe['dependencies'],
1345 objects: lib.extract_all_objects(recursive: true),
1346 link_language: link_language,
1347 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1348 link_args: link_args,
1349 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001350 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001351
1352 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1353 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001354 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1355 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001356 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1357 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1358 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001359 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001360 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001361 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001362 capture: true,
1363 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001364 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001365 command: [
1366 tracetool, '--group=all', '--format=' + stp['fmt'],
1367 '--binary=' + stp['bin'],
1368 '--target-name=' + target_name,
1369 '--target-type=' + target_type,
1370 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1371 '@INPUT@',
1372 ])
1373 endforeach
1374 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001375 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001376endforeach
1377
Paolo Bonzini931049b2020-02-05 09:44:24 +01001378# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001379
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001380if 'CONFIG_PLUGIN' in config_host
1381 install_headers('include/qemu/qemu-plugin.h')
1382endif
1383
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001384if 'CONFIG_GUEST_AGENT' in config_host
1385 subdir('qga')
1386endif
1387
Laurent Vivier9755c942020-08-24 17:24:30 +02001388# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1389# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001390if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001391 # used for the update-keymaps target, so include rules even if !have_tools
1392 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1393 dependencies: [qemuutil, xkbcommon], install: have_tools)
1394endif
1395
Paolo Bonzini931049b2020-02-05 09:44:24 +01001396if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001397 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1398 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1399 qemu_io = executable('qemu-io', files('qemu-io.c'),
1400 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001401 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001402 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001403
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001404 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001405 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001406 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001407
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001408 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1409 dependencies: qemuutil,
1410 install: true)
1411
Paolo Bonzini931049b2020-02-05 09:44:24 +01001412 if 'CONFIG_VHOST_USER' in config_host
1413 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001414 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001415 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001416 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001417 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001418 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001419
1420 if targetos == 'linux'
1421 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1422 dependencies: [qemuutil, libcap_ng],
1423 install: true,
1424 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001425
1426 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1427 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001428 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001429 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001430 endif
1431
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001432 if 'CONFIG_IVSHMEM' in config_host
1433 subdir('contrib/ivshmem-client')
1434 subdir('contrib/ivshmem-server')
1435 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001436endif
1437
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001438subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001439subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001440subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001441subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001442subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001443if 'CONFIG_GTK' in config_host
1444 subdir('po')
1445endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001446
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001447if host_machine.system() == 'windows'
1448 nsis_cmd = [
1449 find_program('scripts/nsis.py'),
1450 '@OUTPUT@',
1451 get_option('prefix'),
1452 meson.current_source_dir(),
1453 host_machine.cpu_family(),
1454 '--',
1455 '-DDISPLAYVERSION=' + meson.project_version(),
1456 ]
1457 if build_docs
1458 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1459 endif
1460 if 'CONFIG_GTK' in config_host
1461 nsis_cmd += '-DCONFIG_GTK=y'
1462 endif
1463
1464 nsis = custom_target('nsis',
1465 output: 'qemu-setup-' + meson.project_version() + '.exe',
1466 input: files('qemu.nsi'),
1467 build_always_stale: true,
1468 command: nsis_cmd + ['@INPUT@'])
1469 alias_target('installer', nsis)
1470endif
1471
Paolo Bonzinif9332752020-02-03 13:28:38 +01001472summary_info = {}
1473summary_info += {'Install prefix': config_host['prefix']}
1474summary_info += {'BIOS directory': config_host['qemu_datadir']}
1475summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1476summary_info += {'binary directory': config_host['bindir']}
1477summary_info += {'library directory': config_host['libdir']}
1478summary_info += {'module directory': config_host['qemu_moddir']}
1479summary_info += {'libexec directory': config_host['libexecdir']}
1480summary_info += {'include directory': config_host['includedir']}
1481summary_info += {'config directory': config_host['sysconfdir']}
1482if targetos != 'windows'
1483 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001484 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001485else
1486 summary_info += {'local state directory': 'queried at runtime'}
1487endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001488summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001489summary_info += {'Build directory': meson.current_build_dir()}
1490summary_info += {'Source path': meson.current_source_dir()}
1491summary_info += {'GIT binary': config_host['GIT']}
1492summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1493summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1494summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1495if link_language == 'cpp'
1496 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1497else
1498 summary_info += {'C++ compiler': false}
1499endif
1500if targetos == 'darwin'
1501 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1502endif
1503summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1504summary_info += {'CFLAGS': config_host['CFLAGS']}
1505summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1506summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1507summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001508summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1509summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1510summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1511# TODO: add back version
1512summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1513if config_host.has_key('CONFIG_SLIRP')
1514 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1515endif
1516summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1517if config_host.has_key('CONFIG_MODULES')
1518 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1519endif
1520summary_info += {'host CPU': cpu}
1521summary_info += {'host endianness': build_machine.endian()}
1522summary_info += {'target list': config_host['TARGET_DIRS']}
1523summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1524summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1525summary_info += {'strip binaries': get_option('strip')}
1526summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001527summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001528if targetos == 'darwin'
1529 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1530endif
1531# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001532summary_info += {'SDL support': sdl.found()}
1533summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001534# TODO: add back version
1535summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1536summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001537summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001538# TODO: add back version
1539summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1540summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1541summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1542# TODO: add back version
1543summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1544if config_host.has_key('CONFIG_GCRYPT')
1545 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1546 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1547endif
1548# TODO: add back version
1549summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1550if config_host.has_key('CONFIG_NETTLE')
1551 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1552endif
1553summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1554summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1555summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1556summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1557# TODO: add back version
1558summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1559summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1560summary_info += {'mingw32 support': targetos == 'windows'}
1561summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1562summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1563summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1564summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001565summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001566summary_info += {'VNC support': vnc.found()}
1567if vnc.found()
1568 summary_info += {'VNC SASL support': sasl.found()}
1569 summary_info += {'VNC JPEG support': jpeg.found()}
1570 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001571endif
1572summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1573if config_host.has_key('CONFIG_XEN_BACKEND')
1574 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1575endif
1576summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1577summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1578summary_info += {'PIE': get_option('b_pie')}
1579summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1580summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1581summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1582summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1583summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1584summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04001585summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1586summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1587summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1588summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1589summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1590if config_all.has_key('CONFIG_TCG')
1591 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1592 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1593endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04001594summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001595summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1596summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1597summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1598summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1599summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1600summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1601summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1602summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1603summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1604summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1605summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1606summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1607summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1608summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1609summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1610summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1611summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1612summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1613if config_host['TRACE_BACKENDS'].split().contains('simple')
1614 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1615endif
1616# TODO: add back protocol and server version
1617summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1618summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1619summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1620summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001621summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001622summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1623summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1624summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1625summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1626summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1627summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1628summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1629if targetos == 'windows'
1630 if 'WIN_SDK' in config_host
1631 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1632 endif
1633 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1634 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01001635 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001636endif
1637summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1638summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1639summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1640summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1641summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1642summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1643summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001644summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001645summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1646summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1647summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1648summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1649summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1650summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1651summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1652summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1653summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1654summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1655summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04001656summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001657summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1658summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1659summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1660summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1661summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1662summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1663summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1664summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1665summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1666summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1667summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1668summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
1669summary_info += {'capstone': config_host.has_key('CONFIG_CAPSTONE')}
1670summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1671summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02001672summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001673summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1674summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1675summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1676if config_host.has_key('HAVE_GDB_BIN')
1677 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1678endif
1679summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1680summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1681summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1682summary(summary_info, bool_yn: true)
1683
1684if not supported_cpus.contains(cpu)
1685 message()
1686 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1687 message()
1688 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1689 message('The QEMU project intends to remove support for this host CPU in')
1690 message('a future release if nobody volunteers to maintain it and to')
1691 message('provide a build host for our continuous integration setup.')
1692 message('configure has succeeded and you can continue to build, but')
1693 message('if you care about QEMU on this platform you should contact')
1694 message('us upstream at qemu-devel@nongnu.org.')
1695endif
1696
1697if not supported_oses.contains(targetos)
1698 message()
1699 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1700 message()
1701 message('Host OS ' + targetos + 'support is not currently maintained.')
1702 message('The QEMU project intends to remove support for this host OS in')
1703 message('a future release if nobody volunteers to maintain it and to')
1704 message('provide a build host for our continuous integration setup.')
1705 message('configure has succeeded and you can continue to build, but')
1706 message('if you care about QEMU on this platform you should contact')
1707 message('us upstream at qemu-devel@nongnu.org.')
1708endif