blob: 165716ddad79cb30f6663f8169464286ae33a49d [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')
Richard Henderson8b18cdb2020-09-13 12:19:25 -070013fs = import('fs')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040014
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010015sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040016cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020017config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040018enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010019enable_static = 'CONFIG_STATIC' in config_host
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +020020build_docs = 'BUILD_DOCS' in config_host
Marc-André Lureau8fe11232020-09-11 14:42:48 +020021
22if get_option('qemu_suffix').startswith('/')
23 error('qemu_suffix cannot start with a /')
24endif
25
Marc-André Lureauab4c0992020-08-26 15:04:16 +040026qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040027qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020028config_host_data = configuration_data()
29genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020030
Paolo Bonzini760e4322020-08-26 08:09:48 +020031target_dirs = config_host['TARGET_DIRS'].split()
32have_user = false
33have_system = false
34foreach target : target_dirs
35 have_user = have_user or target.endswith('-user')
36 have_system = have_system or target.endswith('-softmmu')
37endforeach
38have_tools = 'CONFIG_TOOLS' in config_host
39have_block = have_system or have_tools
40
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040041python = import('python').find_installation()
42
43supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
44supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
45 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
46
47cpu = host_machine.cpu_family()
48targetos = host_machine.system()
49
50configure_file(input: files('scripts/ninjatool.py'),
51 output: 'ninjatool',
52 configuration: config_host)
53
Paolo Bonzini8a199802020-09-18 05:37:01 -040054if cpu in ['x86', 'x86_64']
55 kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
56elif cpu == 'aarch64'
57 kvm_targets = ['aarch64-softmmu']
58elif cpu == 's390x'
59 kvm_targets = ['s390x-softmmu']
60elif cpu in ['ppc', 'ppc64']
61 kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
62else
63 kvm_targets = []
64endif
65
66accelerator_targets = { 'CONFIG_KVM': kvm_targets }
67if cpu in ['x86', 'x86_64']
68 accelerator_targets += {
69 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
70 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
71 'CONFIG_HVF': ['x86_64-softmmu'],
72 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
73 }
74endif
75
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040076##################
77# Compiler flags #
78##################
79
Alexander Bulekovff9ed622020-09-09 18:05:16 -040080# Specify linker-script with add_project_link_arguments so that it is not placed
81# within a linker --start-group/--end-group pair
82if 'CONFIG_FUZZ' in config_host
83 add_project_link_arguments(['-Wl,-T,',
84 (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
85 native: false, language: ['c', 'cpp', 'objc'])
86endif
87
Paolo Bonzinia5665052019-06-10 12:05:14 +020088add_project_arguments(config_host['QEMU_CFLAGS'].split(),
89 native: false, language: ['c', 'objc'])
90add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
91 native: false, language: 'cpp')
92add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
93 native: false, language: ['c', 'cpp', 'objc'])
94add_project_arguments(config_host['QEMU_INCLUDES'].split(),
95 language: ['c', 'cpp', 'objc'])
96
Alexander Bulekovc46f76d2020-09-02 13:36:50 -040097
Marc-André Lureaufc929892019-07-13 01:47:54 +040098link_language = meson.get_external_property('link_language', 'cpp')
99if link_language == 'cpp'
100 add_languages('cpp', required: true, native: false)
101endif
Paolo Bonzinia5665052019-06-10 12:05:14 +0200102if host_machine.system() == 'darwin'
103 add_languages('objc', required: false, native: false)
104endif
105
Paolo Bonzinideb62372020-09-01 07:51:16 -0400106sparse = find_program('cgcc', required: get_option('sparse'))
107if sparse.found()
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100108 run_target('sparse',
109 command: [find_program('scripts/check_sparse.py'),
Paolo Bonzinideb62372020-09-01 07:51:16 -0400110 'compile_commands.json', sparse.full_path(), '-Wbitwise',
111 '-Wno-transparent-union', '-Wno-old-initializer',
112 '-Wno-non-pointer-null'])
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100113endif
114
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200115###########################################
116# Target-specific checks and dependencies #
117###########################################
118
119if targetos != 'linux' and get_option('mpath').enabled()
120 error('Multipath is supported only on Linux')
121endif
122
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400123m = cc.find_library('m', required: false)
124util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200125winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400126socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400127version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400128coref = []
129iokit = []
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400130emulator_link_args = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400131cocoa = not_found
Paolo Bonzini8a199802020-09-18 05:37:01 -0400132hvf = not_found
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400133if targetos == 'windows'
134 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200135 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400136
137 win = import('windows')
138 version_res = win.compile_resources('version.rc',
139 depend_files: files('pc-bios/qemu-nsis.ico'),
140 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400141elif targetos == 'darwin'
142 coref = dependency('appleframeworks', modules: 'CoreFoundation')
143 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400144 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200145elif targetos == 'sunos'
146 socket = [cc.find_library('socket'),
147 cc.find_library('nsl'),
148 cc.find_library('resolv')]
149elif targetos == 'haiku'
150 socket = [cc.find_library('posix_error_mapper'),
151 cc.find_library('network'),
152 cc.find_library('bsd')]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400153elif targetos == 'openbsd'
154 if not get_option('tcg').disabled() and target_dirs.length() > 0
155 # Disable OpenBSD W^X if available
156 emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
157 endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400158endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200159
Paolo Bonzini8a199802020-09-18 05:37:01 -0400160accelerators = []
161if not get_option('kvm').disabled() and targetos == 'linux'
162 accelerators += 'CONFIG_KVM'
163endif
164if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
165 accelerators += 'CONFIG_XEN'
166 have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
167else
168 have_xen_pci_passthrough = false
169endif
170if not get_option('whpx').disabled() and targetos == 'windows'
171 if get_option('whpx').enabled() and cpu != 'x86_64'
172 error('WHPX requires 64-bit host')
173 elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
174 cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
175 accelerators += 'CONFIG_WHPX'
176 endif
177endif
178if not get_option('hvf').disabled()
179 hvf = dependency('appleframeworks', modules: 'Hypervisor',
180 required: get_option('hvf'))
181 if hvf.found()
182 accelerators += 'CONFIG_HVF'
183 endif
184endif
185if not get_option('hax').disabled()
186 if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
187 accelerators += 'CONFIG_HAX'
188 endif
189endif
190if not get_option('tcg').disabled()
191 if cpu not in supported_cpus
192 if 'CONFIG_TCG_INTERPRETER' in config_host
193 warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
194 else
195 error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
196 endif
197 endif
198 accelerators += 'CONFIG_TCG'
199 config_host += { 'CONFIG_TCG': 'y' }
200endif
201
202if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
203 error('KVM not available on this platform')
204endif
205if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
206 error('HVF not available on this platform')
207endif
208if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
209 error('WHPX not available on this platform')
210endif
211if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
212 if 'CONFIG_XEN' in accelerators
213 error('Xen PCI passthrough not available on this platform')
214 else
215 error('Xen PCI passthrough requested but Xen not enabled')
216 endif
217endif
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400218if not cocoa.found() and get_option('cocoa').enabled()
219 error('Cocoa not available on this platform')
220endif
221
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200222################
223# Dependencies #
224################
225
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400226# The path to glib.h is added to all compilation commands. This was
227# grandfathered in from the QEMU Makefiles.
228add_project_arguments(config_host['GLIB_CFLAGS'].split(),
229 native: false, language: ['c', 'cpp', 'objc'])
230glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400231gio = not_found
232if 'CONFIG_GIO' in config_host
233 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
234 link_args: config_host['GIO_LIBS'].split())
235endif
236lttng = not_found
237if 'CONFIG_TRACE_UST' in config_host
238 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
239endif
240urcubp = not_found
241if 'CONFIG_TRACE_UST' in config_host
242 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
243endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100244gcrypt = not_found
245if 'CONFIG_GCRYPT' in config_host
246 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
247 link_args: config_host['GCRYPT_LIBS'].split())
248endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400249nettle = not_found
250if 'CONFIG_NETTLE' in config_host
251 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
252 link_args: config_host['NETTLE_LIBS'].split())
253endif
254gnutls = not_found
255if 'CONFIG_GNUTLS' in config_host
256 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
257 link_args: config_host['GNUTLS_LIBS'].split())
258endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200259pixman = not_found
260if have_system or have_tools
261 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400262 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200263endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400264pam = not_found
265if 'CONFIG_AUTH_PAM' in config_host
266 pam = cc.find_library('pam')
267endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400268libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200269zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400270linux_io_uring = not_found
271if 'CONFIG_LINUX_IO_URING' in config_host
272 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
273 link_args: config_host['LINUX_IO_URING_LIBS'].split())
274endif
275libxml2 = not_found
276if 'CONFIG_LIBXML2' in config_host
277 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
278 link_args: config_host['LIBXML2_LIBS'].split())
279endif
280libnfs = not_found
281if 'CONFIG_LIBNFS' in config_host
282 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
283endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400284libattr = not_found
285if 'CONFIG_ATTR' in config_host
286 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
287endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100288seccomp = not_found
289if 'CONFIG_SECCOMP' in config_host
290 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
291 link_args: config_host['SECCOMP_LIBS'].split())
292endif
293libcap_ng = not_found
294if 'CONFIG_LIBCAP_NG' in config_host
295 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
296endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400297if get_option('xkbcommon').auto() and not have_system and not have_tools
298 xkbcommon = not_found
299else
300 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400301 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400302endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400303vde = not_found
304if config_host.has_key('CONFIG_VDE')
305 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
306endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200307pulse = not_found
308if 'CONFIG_LIBPULSE' in config_host
309 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
310 link_args: config_host['PULSE_LIBS'].split())
311endif
312alsa = not_found
313if 'CONFIG_ALSA' in config_host
314 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
315 link_args: config_host['ALSA_LIBS'].split())
316endif
317jack = not_found
318if 'CONFIG_LIBJACK' in config_host
319 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
320endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200321spice = not_found
322if 'CONFIG_SPICE' in config_host
323 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
324 link_args: config_host['SPICE_LIBS'].split())
325endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400326rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400327libdl = not_found
328if 'CONFIG_PLUGIN' in config_host
329 libdl = cc.find_library('dl', required: true)
330endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200331libiscsi = not_found
332if 'CONFIG_LIBISCSI' in config_host
333 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
334 link_args: config_host['LIBISCSI_LIBS'].split())
335endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400336zstd = not_found
337if 'CONFIG_ZSTD' in config_host
338 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
339 link_args: config_host['ZSTD_LIBS'].split())
340endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400341gbm = not_found
342if 'CONFIG_GBM' in config_host
343 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
344 link_args: config_host['GBM_LIBS'].split())
345endif
346virgl = not_found
347if 'CONFIG_VIRGL' in config_host
348 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
349 link_args: config_host['VIRGL_LIBS'].split())
350endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400351curl = not_found
352if 'CONFIG_CURL' in config_host
353 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
354 link_args: config_host['CURL_LIBS'].split())
355endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200356libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200357if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200358 libudev = dependency('libudev',
359 required: get_option('mpath').enabled(),
360 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200361endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200362
363mpathpersist = not_found
364mpathpersist_new_api = false
365if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
366 mpath_test_source_new = '''
367 #include <libudev.h>
368 #include <mpath_persist.h>
369 unsigned mpath_mx_alloc_len = 1024;
370 int logsink;
371 static struct config *multipath_conf;
372 extern struct udev *udev;
373 extern struct config *get_multipath_config(void);
374 extern void put_multipath_config(struct config *conf);
375 struct udev *udev;
376 struct config *get_multipath_config(void) { return multipath_conf; }
377 void put_multipath_config(struct config *conf) { }
378 int main(void) {
379 udev = udev_new();
380 multipath_conf = mpath_lib_init();
381 return 0;
382 }'''
383 mpath_test_source_old = '''
384 #include <libudev.h>
385 #include <mpath_persist.h>
386 unsigned mpath_mx_alloc_len = 1024;
387 int logsink;
388 int main(void) {
389 struct udev *udev = udev_new();
390 mpath_lib_init(udev);
391 return 0;
392 }'''
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200393 mpathlibs = [libudev]
394 if enable_static
395 mpathlibs += cc.find_library('devmapper',
396 required: get_option('mpath'),
397 static: enable_static)
398 endif
399 mpathlibs += cc.find_library('multipath',
400 required: get_option('mpath'),
401 static: enable_static)
402 mpathlibs += cc.find_library('mpathpersist',
403 required: get_option('mpath'),
404 static: enable_static)
405 foreach lib: mpathlibs
406 if not lib.found()
407 mpathlibs = []
408 break
409 endif
410 endforeach
411 if mpathlibs.length() > 0
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200412 if cc.links(mpath_test_source_new, dependencies: mpathlibs)
413 mpathpersist = declare_dependency(dependencies: mpathlibs)
414 mpathpersist_new_api = true
415 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
416 mpathpersist = declare_dependency(dependencies: mpathlibs)
417 else
418 if get_option('mpath').enabled()
419 error('Cannot detect libmpathpersist API')
420 else
421 warning('Cannot detect libmpathpersist API, disabling')
422 endif
423 endif
424 endif
425endif
426
Paolo Bonzini26347332019-07-29 15:40:07 +0200427brlapi = not_found
428if 'CONFIG_BRLAPI' in config_host
429 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
430endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100431
Paolo Bonzini760e4322020-08-26 08:09:48 +0200432sdl = not_found
433if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800434 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200435 sdl_image = not_found
436endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100437if sdl.found()
438 # work around 2.0.8 bug
439 sdl = declare_dependency(compile_args: '-Wno-undef',
440 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200441 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400442 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100443else
444 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100445 error('sdl-image required, but SDL was @0@'.format(
446 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100447 endif
448 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200449endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100450
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400451rbd = not_found
452if 'CONFIG_RBD' in config_host
453 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
454endif
455glusterfs = not_found
456if 'CONFIG_GLUSTERFS' in config_host
457 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
458 link_args: config_host['GLUSTERFS_LIBS'].split())
459endif
460libssh = not_found
461if 'CONFIG_LIBSSH' in config_host
462 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
463 link_args: config_host['LIBSSH_LIBS'].split())
464endif
465libbzip2 = not_found
466if 'CONFIG_BZIP2' in config_host
467 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
468endif
469liblzfse = not_found
470if 'CONFIG_LZFSE' in config_host
471 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
472endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200473oss = not_found
474if 'CONFIG_AUDIO_OSS' in config_host
475 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
476endif
477dsound = not_found
478if 'CONFIG_AUDIO_DSOUND' in config_host
479 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
480endif
481coreaudio = not_found
482if 'CONFIG_AUDIO_COREAUDIO' in config_host
483 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
484endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400485opengl = not_found
486if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400487 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
488 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400489endif
490gtk = not_found
491if 'CONFIG_GTK' in config_host
492 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
493 link_args: config_host['GTK_LIBS'].split())
494endif
495vte = not_found
496if 'CONFIG_VTE' in config_host
497 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
498 link_args: config_host['VTE_LIBS'].split())
499endif
500x11 = not_found
501if 'CONFIG_X11' in config_host
502 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
503 link_args: config_host['X11_LIBS'].split())
504endif
505curses = not_found
506if 'CONFIG_CURSES' in config_host
507 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
508 link_args: config_host['CURSES_LIBS'].split())
509endif
510iconv = not_found
511if 'CONFIG_ICONV' in config_host
512 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
513 link_args: config_host['ICONV_LIBS'].split())
514endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100515vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400516png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400517jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400518sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100519if get_option('vnc').enabled()
520 vnc = declare_dependency() # dummy dependency
521 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400522 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100523 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
524 required: get_option('vnc_jpeg'),
525 static: enable_static)
526 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
527 required: get_option('vnc_sasl'),
528 static: enable_static)
529 if sasl.found()
530 sasl = declare_dependency(dependencies: sasl,
531 compile_args: '-DSTRUCT_IOVEC_DEFINED')
532 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400533endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200534fdt = not_found
535if 'CONFIG_FDT' in config_host
536 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
537 link_args: config_host['FDT_LIBS'].split())
538endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400539snappy = not_found
540if 'CONFIG_SNAPPY' in config_host
541 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
542endif
543lzo = not_found
544if 'CONFIG_LZO' in config_host
545 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
546endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400547rdma = not_found
548if 'CONFIG_RDMA' in config_host
549 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
550endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400551numa = not_found
552if 'CONFIG_NUMA' in config_host
553 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
554endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400555xen = not_found
556if 'CONFIG_XEN_BACKEND' in config_host
557 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
558 link_args: config_host['XEN_LIBS'].split())
559endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200560cacard = not_found
561if 'CONFIG_SMARTCARD' in config_host
562 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
563 link_args: config_host['SMARTCARD_LIBS'].split())
564endif
César Belley0a40bcb2020-08-26 13:42:04 +0200565u2f = not_found
566if have_system
567 u2f = dependency('u2f-emu', required: get_option('u2f'),
568 method: 'pkg-config',
569 static: enable_static)
570endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200571usbredir = not_found
572if 'CONFIG_USB_REDIR' in config_host
573 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
574 link_args: config_host['USB_REDIR_LIBS'].split())
575endif
576libusb = not_found
577if 'CONFIG_USB_LIBUSB' in config_host
578 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
579 link_args: config_host['LIBUSB_LIBS'].split())
580endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400581libpmem = not_found
582if 'CONFIG_LIBPMEM' in config_host
583 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
584 link_args: config_host['LIBPMEM_LIBS'].split())
585endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600586libdaxctl = not_found
587if 'CONFIG_LIBDAXCTL' in config_host
588 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
589endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400590tasn1 = not_found
591if 'CONFIG_TASN1' in config_host
592 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
593 link_args: config_host['TASN1_LIBS'].split())
594endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400595keyutils = dependency('libkeyutils', required: false,
596 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400597
Marc-André Lureau3909def2020-08-28 15:07:33 +0400598has_gettid = cc.has_function('gettid')
599
Paolo Bonziniaa087962020-09-01 11:15:30 -0400600# Malloc tests
601
602malloc = []
603if get_option('malloc') == 'system'
604 has_malloc_trim = \
605 not get_option('malloc_trim').disabled() and \
606 cc.links('''#include <malloc.h>
607 int main(void) { malloc_trim(0); return 0; }''')
608else
609 has_malloc_trim = false
610 malloc = cc.find_library(get_option('malloc'), required: true)
611endif
612if not has_malloc_trim and get_option('malloc_trim').enabled()
613 if get_option('malloc') == 'system'
614 error('malloc_trim not available on this platform.')
615 else
616 error('malloc_trim not available with non-libc memory allocator')
617 endif
618endif
619
Paolo Bonzini859aef02020-08-04 18:14:26 +0200620# Create config-host.h
621
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400622config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200623config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200624config_host_data.set('CONFIG_MPATH', mpathpersist.found())
625config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100626config_host_data.set('CONFIG_SDL', sdl.found())
627config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100628config_host_data.set('CONFIG_VNC', vnc.found())
629config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
630config_host_data.set('CONFIG_VNC_PNG', png.found())
631config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200632config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400633config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400634config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400635config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200636config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
637config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
638config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
639config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
640
Paolo Bonzini765686d2020-09-18 06:37:21 -0400641ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
Paolo Bonzini859aef02020-08-04 18:14:26 +0200642arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200643strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200644 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200645 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200646foreach k, v: config_host
Paolo Bonzini765686d2020-09-18 06:37:21 -0400647 if ignored.contains(k)
648 # do nothing
649 elif arrays.contains(k)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200650 if v != ''
651 v = '"' + '", "'.join(v.split()) + '", '
652 endif
653 config_host_data.set(k, v)
654 elif k == 'ARCH'
655 config_host_data.set('HOST_' + v.to_upper(), 1)
656 elif strings.contains(k)
657 if not k.startswith('CONFIG_')
658 k = 'CONFIG_' + k.to_upper()
659 endif
660 config_host_data.set_quoted(k, v)
661 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
662 config_host_data.set(k, v == 'y' ? 1 : v)
663 endif
664endforeach
Paolo Bonzini859aef02020-08-04 18:14:26 +0200665
Paolo Bonzini2becc362020-02-03 11:42:03 +0100666minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400667config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400668config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400669config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100670config_devices_mak_list = []
671config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200672config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100673config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400674
675disassemblers = {
676 'alpha' : ['CONFIG_ALPHA_DIS'],
677 'arm' : ['CONFIG_ARM_DIS'],
678 'avr' : ['CONFIG_AVR_DIS'],
679 'cris' : ['CONFIG_CRIS_DIS'],
680 'hppa' : ['CONFIG_HPPA_DIS'],
681 'i386' : ['CONFIG_I386_DIS'],
682 'x86_64' : ['CONFIG_I386_DIS'],
683 'x32' : ['CONFIG_I386_DIS'],
684 'lm32' : ['CONFIG_LM32_DIS'],
685 'm68k' : ['CONFIG_M68K_DIS'],
686 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
687 'mips' : ['CONFIG_MIPS_DIS'],
688 'moxie' : ['CONFIG_MOXIE_DIS'],
689 'nios2' : ['CONFIG_NIOS2_DIS'],
690 'or1k' : ['CONFIG_OPENRISC_DIS'],
691 'ppc' : ['CONFIG_PPC_DIS'],
692 'riscv' : ['CONFIG_RISCV_DIS'],
693 'rx' : ['CONFIG_RX_DIS'],
694 's390' : ['CONFIG_S390_DIS'],
695 'sh4' : ['CONFIG_SH4_DIS'],
696 'sparc' : ['CONFIG_SPARC_DIS'],
697 'xtensa' : ['CONFIG_XTENSA_DIS'],
698}
699if link_language == 'cpp'
700 disassemblers += {
701 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
702 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
703 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
704 }
705endif
706
Paolo Bonzini2becc362020-02-03 11:42:03 +0100707kconfig_external_symbols = [
708 'CONFIG_KVM',
709 'CONFIG_XEN',
710 'CONFIG_TPM',
711 'CONFIG_SPICE',
712 'CONFIG_IVSHMEM',
713 'CONFIG_OPENGL',
714 'CONFIG_X11',
715 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200716 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100717 'CONFIG_VHOST_KERNEL',
718 'CONFIG_VIRTFS',
719 'CONFIG_LINUX',
720 'CONFIG_PVRDMA',
721]
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400722ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400723
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400724default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
725actual_target_dirs = []
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')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400729 if targetos != 'linux'
730 if default_targets
731 continue
732 endif
733 error('Target @0@ is only available on a Linux host'.format(target))
734 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400735 config_target += { 'CONFIG_LINUX_USER': 'y' }
736 elif target.endswith('bsd-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400737 if 'CONFIG_BSD' not in config_host
738 if default_targets
739 continue
740 endif
741 error('Target @0@ is only available on a BSD host'.format(target))
742 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400743 config_target += { 'CONFIG_BSD_USER': 'y' }
744 elif target.endswith('softmmu')
745 config_target += { 'CONFIG_SOFTMMU': 'y' }
746 endif
747 if target.endswith('-user')
748 config_target += {
749 'CONFIG_USER_ONLY': 'y',
750 'CONFIG_QEMU_INTERP_PREFIX':
751 config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
752 }
753 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200754
Paolo Bonzini8a199802020-09-18 05:37:01 -0400755 have_accel = false
756 foreach sym: accelerators
757 if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
758 config_target += { sym: 'y' }
759 config_all += { sym: 'y' }
760 if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
761 config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
762 endif
763 have_accel = true
764 endif
765 endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400766 if not have_accel
767 if default_targets
768 continue
769 endif
770 error('No accelerator available for target @0@'.format(target))
771 endif
Paolo Bonzini8a199802020-09-18 05:37:01 -0400772
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400773 actual_target_dirs += target
Paolo Bonzini765686d2020-09-18 06:37:21 -0400774 config_target += keyval.load('default-configs/targets' / target + '.mak')
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400775 config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
Paolo Bonzini765686d2020-09-18 06:37:21 -0400776
Paolo Bonzinifa731682020-09-21 05:19:07 -0400777 # Add default keys
778 if 'TARGET_BASE_ARCH' not in config_target
779 config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']}
780 endif
781 if 'TARGET_ABI_DIR' not in config_target
782 config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']}
783 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200784
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400785 foreach k, v: disassemblers
786 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
787 foreach sym: v
788 config_target += { sym: 'y' }
789 config_all_disas += { sym: 'y' }
790 endforeach
791 endif
792 endforeach
793
Paolo Bonzini859aef02020-08-04 18:14:26 +0200794 config_target_data = configuration_data()
795 foreach k, v: config_target
796 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
797 # do nothing
798 elif ignored.contains(k)
799 # do nothing
800 elif k == 'TARGET_BASE_ARCH'
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400801 # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
802 # not used to select files from sourcesets.
Paolo Bonzini859aef02020-08-04 18:14:26 +0200803 config_target_data.set('TARGET_' + v.to_upper(), 1)
Paolo Bonzini765686d2020-09-18 06:37:21 -0400804 elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
Paolo Bonzini859aef02020-08-04 18:14:26 +0200805 config_target_data.set_quoted(k, v)
806 elif v == 'y'
807 config_target_data.set(k, 1)
808 else
809 config_target_data.set(k, v)
810 endif
811 endforeach
812 config_target_h += {target: configure_file(output: target + '-config-target.h',
813 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100814
815 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100816 base_kconfig = []
817 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200818 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100819 base_kconfig += '@0@=y'.format(sym)
820 endif
821 endforeach
822
823 config_devices_mak = target + '-config-devices.mak'
824 config_devices_mak = configure_file(
Paolo Bonzini1bb4cb12020-09-18 06:06:09 -0400825 input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
Paolo Bonzini2becc362020-02-03 11:42:03 +0100826 output: config_devices_mak,
827 depfile: config_devices_mak + '.d',
828 capture: true,
829 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
830 config_devices_mak, '@DEPFILE@', '@INPUT@',
831 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200832
833 config_devices_data = configuration_data()
834 config_devices = keyval.load(config_devices_mak)
835 foreach k, v: config_devices
836 config_devices_data.set(k, 1)
837 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100838 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200839 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
840 configuration: config_devices_data)}
841 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400842 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100843 endif
844 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400845endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400846target_dirs = actual_target_dirs
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400847
Paolo Bonzini2becc362020-02-03 11:42:03 +0100848# This configuration is used to build files that are shared by
849# multiple binaries, and then extracted out of the "common"
850# static_library target.
851#
852# We do not use all_sources()/all_dependencies(), because it would
853# build literally all source files, including devices only used by
854# targets that are not built for this compilation. The CONFIG_ALL
855# pseudo symbol replaces it.
856
Paolo Bonzini05512f52020-09-16 15:31:11 -0400857config_all += config_all_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100858config_all += config_host
859config_all += config_all_disas
860config_all += {
861 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
862 'CONFIG_SOFTMMU': have_system,
863 'CONFIG_USER_ONLY': have_user,
864 'CONFIG_ALL': true,
865}
866
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700867# Submodules
868
869capstone = not_found
870capstone_opt = get_option('capstone')
871if capstone_opt in ['enabled', 'auto', 'system']
872 have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile')
Richard Hendersonbcf36862020-09-21 09:46:16 -0700873 capstone = dependency('capstone', version: '>=4.0',
874 static: enable_static, method: 'pkg-config',
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700875 required: capstone_opt == 'system' or
876 capstone_opt == 'enabled' and not have_internal)
877 if capstone.found()
878 capstone_opt = 'system'
879 elif have_internal
880 capstone_opt = 'internal'
881 else
882 capstone_opt = 'disabled'
883 endif
884endif
885if capstone_opt == 'internal'
886 capstone_data = configuration_data()
887 capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1')
888
889 capstone_files = files(
890 'capstone/cs.c',
891 'capstone/MCInst.c',
892 'capstone/MCInstrDesc.c',
893 'capstone/MCRegisterInfo.c',
894 'capstone/SStream.c',
895 'capstone/utils.c'
896 )
897
898 if 'CONFIG_ARM_DIS' in config_all_disas
899 capstone_data.set('CAPSTONE_HAS_ARM', '1')
900 capstone_files += files(
901 'capstone/arch/ARM/ARMDisassembler.c',
902 'capstone/arch/ARM/ARMInstPrinter.c',
903 'capstone/arch/ARM/ARMMapping.c',
904 'capstone/arch/ARM/ARMModule.c'
905 )
906 endif
907
908 # FIXME: This config entry currently depends on a c++ compiler.
909 # Which is needed for building libvixl, but not for capstone.
910 if 'CONFIG_ARM_A64_DIS' in config_all_disas
911 capstone_data.set('CAPSTONE_HAS_ARM64', '1')
912 capstone_files += files(
913 'capstone/arch/AArch64/AArch64BaseInfo.c',
914 'capstone/arch/AArch64/AArch64Disassembler.c',
915 'capstone/arch/AArch64/AArch64InstPrinter.c',
916 'capstone/arch/AArch64/AArch64Mapping.c',
917 'capstone/arch/AArch64/AArch64Module.c'
918 )
919 endif
920
921 if 'CONFIG_PPC_DIS' in config_all_disas
922 capstone_data.set('CAPSTONE_HAS_POWERPC', '1')
923 capstone_files += files(
924 'capstone/arch/PowerPC/PPCDisassembler.c',
925 'capstone/arch/PowerPC/PPCInstPrinter.c',
926 'capstone/arch/PowerPC/PPCMapping.c',
927 'capstone/arch/PowerPC/PPCModule.c'
928 )
929 endif
930
Richard Henderson3d562842020-01-04 07:24:59 +1000931 if 'CONFIG_S390_DIS' in config_all_disas
932 capstone_data.set('CAPSTONE_HAS_SYSZ', '1')
933 capstone_files += files(
934 'capstone/arch/SystemZ/SystemZDisassembler.c',
935 'capstone/arch/SystemZ/SystemZInstPrinter.c',
936 'capstone/arch/SystemZ/SystemZMapping.c',
937 'capstone/arch/SystemZ/SystemZModule.c',
938 'capstone/arch/SystemZ/SystemZMCTargetDesc.c'
939 )
940 endif
941
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700942 if 'CONFIG_I386_DIS' in config_all_disas
943 capstone_data.set('CAPSTONE_HAS_X86', 1)
944 capstone_files += files(
945 'capstone/arch/X86/X86Disassembler.c',
946 'capstone/arch/X86/X86DisassemblerDecoder.c',
947 'capstone/arch/X86/X86ATTInstPrinter.c',
948 'capstone/arch/X86/X86IntelInstPrinter.c',
Richard Hendersoneef20e42020-09-14 16:02:02 -0700949 'capstone/arch/X86/X86InstPrinterCommon.c',
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700950 'capstone/arch/X86/X86Mapping.c',
951 'capstone/arch/X86/X86Module.c'
952 )
953 endif
954
955 configure_file(output: 'capstone-defs.h', configuration: capstone_data)
956
957 capstone_cargs = [
958 # FIXME: There does not seem to be a way to completely replace the c_args
959 # that come from add_project_arguments() -- we can only add to them.
960 # So: disable all warnings with a big hammer.
961 '-Wno-error', '-w',
962
963 # Include all configuration defines via a header file, which will wind up
964 # as a dependency on the object file, and thus changes here will result
965 # in a rebuild.
966 '-include', 'capstone-defs.h'
967 ]
968
969 libcapstone = static_library('capstone',
970 sources: capstone_files,
971 c_args: capstone_cargs,
972 include_directories: 'capstone/include')
973 capstone = declare_dependency(link_with: libcapstone,
Richard Hendersoneef20e42020-09-14 16:02:02 -0700974 include_directories: 'capstone/include/capstone')
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700975endif
Paolo Bonzini4d34a862020-10-05 11:31:15 +0200976
977slirp = not_found
978slirp_opt = 'disabled'
979if have_system
980 slirp_opt = get_option('slirp')
981 if slirp_opt in ['enabled', 'auto', 'system']
982 have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
983 slirp = dependency('slirp', static: enable_static,
984 method: 'pkg-config',
985 required: slirp_opt == 'system' or
986 slirp_opt == 'enabled' and not have_internal)
987 if slirp.found()
988 slirp_opt = 'system'
989 elif have_internal
990 slirp_opt = 'internal'
991 else
992 slirp_opt = 'disabled'
993 endif
994 endif
995 if slirp_opt == 'internal'
996 slirp_deps = []
997 if targetos == 'windows'
998 slirp_deps = cc.find_library('iphlpapi')
999 endif
1000 slirp_conf = configuration_data()
1001 slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0])
1002 slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1])
1003 slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2])
1004 slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version())
1005 slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"']
1006 slirp_files = [
1007 'slirp/src/arp_table.c',
1008 'slirp/src/bootp.c',
1009 'slirp/src/cksum.c',
1010 'slirp/src/dhcpv6.c',
1011 'slirp/src/dnssearch.c',
1012 'slirp/src/if.c',
1013 'slirp/src/ip6_icmp.c',
1014 'slirp/src/ip6_input.c',
1015 'slirp/src/ip6_output.c',
1016 'slirp/src/ip_icmp.c',
1017 'slirp/src/ip_input.c',
1018 'slirp/src/ip_output.c',
1019 'slirp/src/mbuf.c',
1020 'slirp/src/misc.c',
1021 'slirp/src/ncsi.c',
1022 'slirp/src/ndp_table.c',
1023 'slirp/src/sbuf.c',
1024 'slirp/src/slirp.c',
1025 'slirp/src/socket.c',
1026 'slirp/src/state.c',
1027 'slirp/src/stream.c',
1028 'slirp/src/tcp_input.c',
1029 'slirp/src/tcp_output.c',
1030 'slirp/src/tcp_subr.c',
1031 'slirp/src/tcp_timer.c',
1032 'slirp/src/tftp.c',
1033 'slirp/src/udp.c',
1034 'slirp/src/udp6.c',
1035 'slirp/src/util.c',
1036 'slirp/src/version.c',
1037 'slirp/src/vmstate.c',
1038 ]
1039
1040 configure_file(
1041 input : 'slirp/src/libslirp-version.h.in',
1042 output : 'libslirp-version.h',
1043 configuration: slirp_conf)
1044
1045 slirp_inc = include_directories('slirp', 'slirp/src')
1046 libslirp = static_library('slirp',
1047 sources: slirp_files,
1048 c_args: slirp_cargs,
1049 include_directories: slirp_inc)
1050 slirp = declare_dependency(link_with: libslirp,
1051 dependencies: slirp_deps,
1052 include_directories: slirp_inc)
1053 endif
1054endif
1055
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001056config_host_data.set('CONFIG_CAPSTONE', capstone.found())
Paolo Bonzini4d34a862020-10-05 11:31:15 +02001057config_host_data.set('CONFIG_SLIRP', slirp.found())
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001058
1059genh += configure_file(output: 'config-host.h', configuration: config_host_data)
1060
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001061# Generators
1062
Marc-André Lureau3f885652019-07-15 18:06:04 +04001063hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +04001064shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001065qapi_gen = find_program('scripts/qapi-gen.py')
1066qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
1067 meson.source_root() / 'scripts/qapi/commands.py',
1068 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001069 meson.source_root() / 'scripts/qapi/error.py',
1070 meson.source_root() / 'scripts/qapi/events.py',
1071 meson.source_root() / 'scripts/qapi/expr.py',
1072 meson.source_root() / 'scripts/qapi/gen.py',
1073 meson.source_root() / 'scripts/qapi/introspect.py',
1074 meson.source_root() / 'scripts/qapi/parser.py',
1075 meson.source_root() / 'scripts/qapi/schema.py',
1076 meson.source_root() / 'scripts/qapi/source.py',
1077 meson.source_root() / 'scripts/qapi/types.py',
1078 meson.source_root() / 'scripts/qapi/visit.py',
1079 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001080 meson.source_root() / 'scripts/qapi-gen.py'
1081]
1082
1083tracetool = [
1084 python, files('scripts/tracetool.py'),
1085 '--backend=' + config_host['TRACE_BACKENDS']
1086]
1087
Marc-André Lureau2c273f32019-07-15 17:10:19 +04001088qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
1089 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +02001090 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +04001091qemu_version = custom_target('qemu-version.h',
1092 output: 'qemu-version.h',
1093 command: qemu_version_cmd,
1094 capture: true,
1095 build_by_default: true,
1096 build_always_stale: true)
1097genh += qemu_version
1098
Marc-André Lureau3f885652019-07-15 18:06:04 +04001099hxdep = []
1100hx_headers = [
1101 ['qemu-options.hx', 'qemu-options.def'],
1102 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
1103]
1104if have_system
1105 hx_headers += [
1106 ['hmp-commands.hx', 'hmp-commands.h'],
1107 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
1108 ]
1109endif
1110foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001111 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +04001112 input: files(d[0]),
1113 output: d[1],
1114 capture: true,
1115 build_by_default: true, # to be removed when added to a target
1116 command: [hxtool, '-h', '@INPUT0@'])
1117endforeach
1118genh += hxdep
1119
Peter Maydelleb937362020-09-25 17:23:08 +01001120SPHINX_ARGS = [config_host['SPHINX_BUILD'],
1121 '-Dversion=' + meson.project_version(),
1122 '-Drelease=' + config_host['PKGVERSION']]
1123
1124if get_option('werror')
1125 SPHINX_ARGS += [ '-W' ]
1126endif
1127
Peter Maydellb3f48302020-09-25 17:23:09 +01001128sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
1129 meson.source_root() / 'docs/sphinx/hxtool.py',
1130 meson.source_root() / 'docs/sphinx/kerneldoc.py',
1131 meson.source_root() / 'docs/sphinx/kernellog.py',
1132 meson.source_root() / 'docs/sphinx/qapidoc.py',
1133 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
1134 qapi_gen_depends ]
1135
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001136# Collect sourcesets.
1137
1138util_ss = ss.source_set()
1139stub_ss = ss.source_set()
1140trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001141block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +02001142blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001143qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001144common_ss = ss.source_set()
1145softmmu_ss = ss.source_set()
1146user_ss = ss.source_set()
1147bsd_user_ss = ss.source_set()
1148linux_user_ss = ss.source_set()
1149specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001150specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001151
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001152modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001153hw_arch = {}
1154target_arch = {}
1155target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001156
1157###############
1158# Trace files #
1159###############
1160
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001161# TODO: add each directory to the subdirs from its own meson.build, once
1162# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001163trace_events_subdirs = [
1164 'accel/kvm',
1165 'accel/tcg',
1166 'crypto',
1167 'monitor',
1168]
1169if have_user
1170 trace_events_subdirs += [ 'linux-user' ]
1171endif
1172if have_block
1173 trace_events_subdirs += [
1174 'authz',
1175 'block',
1176 'io',
1177 'nbd',
1178 'scsi',
1179 ]
1180endif
1181if have_system
1182 trace_events_subdirs += [
1183 'audio',
1184 'backends',
1185 'backends/tpm',
1186 'chardev',
1187 'hw/9pfs',
1188 'hw/acpi',
1189 'hw/alpha',
1190 'hw/arm',
1191 'hw/audio',
1192 'hw/block',
1193 'hw/block/dataplane',
1194 'hw/char',
1195 'hw/display',
1196 'hw/dma',
1197 'hw/hppa',
1198 'hw/hyperv',
1199 'hw/i2c',
1200 'hw/i386',
1201 'hw/i386/xen',
1202 'hw/ide',
1203 'hw/input',
1204 'hw/intc',
1205 'hw/isa',
1206 'hw/mem',
1207 'hw/mips',
1208 'hw/misc',
1209 'hw/misc/macio',
1210 'hw/net',
1211 'hw/nvram',
1212 'hw/pci',
1213 'hw/pci-host',
1214 'hw/ppc',
1215 'hw/rdma',
1216 'hw/rdma/vmw',
1217 'hw/rtc',
1218 'hw/s390x',
1219 'hw/scsi',
1220 'hw/sd',
1221 'hw/sparc',
1222 'hw/sparc64',
1223 'hw/ssi',
1224 'hw/timer',
1225 'hw/tpm',
1226 'hw/usb',
1227 'hw/vfio',
1228 'hw/virtio',
1229 'hw/watchdog',
1230 'hw/xen',
1231 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001232 'migration',
1233 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001234 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001235 'ui',
1236 ]
1237endif
1238trace_events_subdirs += [
1239 'hw/core',
1240 'qapi',
1241 'qom',
1242 'target/arm',
1243 'target/hppa',
1244 'target/i386',
1245 'target/mips',
1246 'target/ppc',
1247 'target/riscv',
1248 'target/s390x',
1249 'target/sparc',
1250 'util',
1251]
1252
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001253subdir('qapi')
1254subdir('qobject')
1255subdir('stubs')
1256subdir('trace')
1257subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001258subdir('qom')
1259subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001260subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001261subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001262
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001263
1264if enable_modules
1265 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1266 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1267endif
1268
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001269# Build targets from sourcesets
1270
Paolo Bonzini2becc362020-02-03 11:42:03 +01001271stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001272
1273util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001274util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001275libqemuutil = static_library('qemuutil',
1276 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001277 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001278qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001279 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001280
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001281decodetree = generator(find_program('scripts/decodetree.py'),
1282 output: 'decode-@BASENAME@.c.inc',
1283 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1284
Paolo Bonzini478e9432020-08-17 12:47:55 +02001285subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001286subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001287subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001288subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001289subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001290subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001291subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001292
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001293block_ss.add(files(
1294 'block.c',
Kevin Wolf56ee8622020-09-24 17:26:50 +02001295 'blockdev-nbd.c',
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001296 'blockjob.c',
1297 'job.c',
1298 'qemu-io-cmds.c',
1299))
1300block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1301
1302subdir('nbd')
1303subdir('scsi')
1304subdir('block')
1305
Paolo Bonzini4a963372020-08-03 16:22:28 +02001306blockdev_ss.add(files(
1307 'blockdev.c',
Paolo Bonzini4a963372020-08-03 16:22:28 +02001308 'iothread.c',
1309 'job-qmp.c',
1310))
1311
1312# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1313# os-win32.c does not
1314blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1315softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1316
1317softmmu_ss.add_all(blockdev_ss)
1318softmmu_ss.add(files(
1319 'bootdevice.c',
1320 'dma-helpers.c',
1321 'qdev-monitor.c',
1322), sdl)
1323
1324softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1325softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1326softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1327
1328common_ss.add(files('cpus-common.c'))
1329
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001330subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001331
Richard Hendersonf3433462020-09-12 10:47:33 -07001332common_ss.add(capstone)
Bruce Rogersc7c91a72020-08-24 09:52:12 -06001333specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001334specific_ss.add(files('exec-vary.c'))
1335specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1336 'fpu/softfloat.c',
1337 'tcg/optimize.c',
1338 'tcg/tcg-common.c',
1339 'tcg/tcg-op-gvec.c',
1340 'tcg/tcg-op-vec.c',
1341 'tcg/tcg-op.c',
1342 'tcg/tcg.c',
1343))
1344specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1345
Marc-André Lureauab318052019-07-24 19:23:16 +04001346subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001347subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001348subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001349subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001350subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001351subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001352subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001353subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001354subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001355subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001356subdir('linux-user')
1357
Marc-André Lureaub309c322019-08-18 19:20:37 +04001358bsd_user_ss.add(files('gdbstub.c'))
1359specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1360
Marc-André Lureau3a304462019-08-18 16:13:08 +04001361linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1362specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001363
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001364# needed for fuzzing binaries
1365subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001366subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001367
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001368block_mods = []
1369softmmu_mods = []
1370foreach d, list : modules
1371 foreach m, module_ss : list
1372 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001373 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001374 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1375 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1376 if d == 'block'
1377 block_mods += sl
1378 else
1379 softmmu_mods += sl
1380 endif
1381 else
1382 if d == 'block'
1383 block_ss.add_all(module_ss)
1384 else
1385 softmmu_ss.add_all(module_ss)
1386 endif
1387 endif
1388 endforeach
1389endforeach
1390
1391nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001392undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001393block_syms = custom_target('block.syms', output: 'block.syms',
1394 input: [libqemuutil, block_mods],
1395 capture: true,
1396 command: [undefsym, nm, '@INPUT@'])
1397qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1398 input: [libqemuutil, softmmu_mods],
1399 capture: true,
1400 command: [undefsym, nm, '@INPUT@'])
1401
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001402block_ss = block_ss.apply(config_host, strict: false)
1403libblock = static_library('block', block_ss.sources() + genh,
1404 dependencies: block_ss.dependencies(),
1405 link_depends: block_syms,
1406 name_suffix: 'fa',
1407 build_by_default: false)
1408
1409block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001410 link_args: '@block.syms',
1411 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001412
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001413qmp_ss = qmp_ss.apply(config_host, strict: false)
1414libqmp = static_library('qmp', qmp_ss.sources() + genh,
1415 dependencies: qmp_ss.dependencies(),
1416 name_suffix: 'fa',
1417 build_by_default: false)
1418
1419qmp = declare_dependency(link_whole: [libqmp])
1420
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001421foreach m : block_mods + softmmu_mods
1422 shared_module(m.name(),
1423 name_prefix: '',
1424 link_whole: m,
1425 install: true,
1426 install_dir: config_host['qemu_moddir'])
1427endforeach
1428
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001429softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1430common_ss.add(qom, qemuutil)
1431
1432common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001433common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1434
1435common_all = common_ss.apply(config_all, strict: false)
1436common_all = static_library('common',
1437 build_by_default: false,
1438 sources: common_all.sources() + genh,
1439 dependencies: common_all.dependencies(),
1440 name_suffix: 'fa')
1441
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001442feature_to_c = find_program('scripts/feature_to_c.sh')
1443
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001444emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001445foreach target : target_dirs
1446 config_target = config_target_mak[target]
1447 target_name = config_target['TARGET_NAME']
1448 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001449 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001450 arch_deps = []
1451 c_args = ['-DNEED_CPU_H',
1452 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1453 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -04001454 link_args = emulator_link_args
Paolo Bonzini2becc362020-02-03 11:42:03 +01001455
Paolo Bonzini859aef02020-08-04 18:14:26 +02001456 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001457 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1458 if targetos == 'linux'
1459 target_inc += include_directories('linux-headers', is_system: true)
1460 endif
1461 if target.endswith('-softmmu')
1462 qemu_target_name = 'qemu-system-' + target_name
1463 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001464 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1465 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001466 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001467
Marc-André Lureau2c442202019-08-17 13:55:58 +04001468 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1469 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1470 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001471 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001472
Paolo Bonzini2becc362020-02-03 11:42:03 +01001473 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001474 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001475 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001476 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001477 target_type='user'
1478 qemu_target_name = 'qemu-' + target_name
1479 if 'CONFIG_LINUX_USER' in config_target
1480 base_dir = 'linux-user'
1481 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1482 else
1483 base_dir = 'bsd-user'
1484 endif
1485 target_inc += include_directories(
1486 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001487 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001488 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001489 if 'CONFIG_LINUX_USER' in config_target
1490 dir = base_dir / abi
1491 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1492 if config_target.has_key('TARGET_SYSTBL_ABI')
1493 arch_srcs += \
1494 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1495 extra_args : config_target['TARGET_SYSTBL_ABI'])
1496 endif
1497 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001498 endif
1499
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001500 if 'TARGET_XML_FILES' in config_target
1501 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1502 output: target + '-gdbstub-xml.c',
1503 input: files(config_target['TARGET_XML_FILES'].split()),
1504 command: [feature_to_c, '@INPUT@'],
1505 capture: true)
1506 arch_srcs += gdbstub_xml
1507 endif
1508
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001509 t = target_arch[arch].apply(config_target, strict: false)
1510 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001511 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001512
Paolo Bonzini2becc362020-02-03 11:42:03 +01001513 target_common = common_ss.apply(config_target, strict: false)
1514 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001515 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001516
Paolo Bonzini2becc362020-02-03 11:42:03 +01001517 target_specific = specific_ss.apply(config_target, strict: false)
1518 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001519 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001520
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001521 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001522 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001523 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001524 objects: objects,
1525 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001526 c_args: c_args,
1527 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001528 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001529
1530 if target.endswith('-softmmu')
1531 execs = [{
1532 'name': 'qemu-system-' + target_name,
1533 'gui': false,
1534 'sources': files('softmmu/main.c'),
1535 'dependencies': []
1536 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001537 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001538 execs += [{
1539 'name': 'qemu-system-' + target_name + 'w',
1540 'gui': true,
1541 'sources': files('softmmu/main.c'),
1542 'dependencies': []
1543 }]
1544 endif
1545 if config_host.has_key('CONFIG_FUZZ')
1546 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1547 execs += [{
1548 'name': 'qemu-fuzz-' + target_name,
1549 'gui': false,
1550 'sources': specific_fuzz.sources(),
1551 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001552 }]
1553 endif
1554 else
1555 execs = [{
1556 'name': 'qemu-' + target_name,
1557 'gui': false,
1558 'sources': [],
1559 'dependencies': []
1560 }]
1561 endif
1562 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001563 emulators += {exe['name']:
1564 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001565 install: true,
1566 c_args: c_args,
1567 dependencies: arch_deps + deps + exe['dependencies'],
1568 objects: lib.extract_all_objects(recursive: true),
1569 link_language: link_language,
1570 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1571 link_args: link_args,
1572 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001573 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001574
1575 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1576 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001577 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1578 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001579 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1580 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1581 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001582 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001583 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001584 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001585 capture: true,
1586 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001587 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001588 command: [
1589 tracetool, '--group=all', '--format=' + stp['fmt'],
1590 '--binary=' + stp['bin'],
1591 '--target-name=' + target_name,
1592 '--target-type=' + target_type,
1593 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1594 '@INPUT@',
1595 ])
1596 endforeach
1597 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001598 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001599endforeach
1600
Paolo Bonzini931049b2020-02-05 09:44:24 +01001601# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001602
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001603if 'CONFIG_PLUGIN' in config_host
1604 install_headers('include/qemu/qemu-plugin.h')
1605endif
1606
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001607if 'CONFIG_GUEST_AGENT' in config_host
1608 subdir('qga')
1609endif
1610
Laurent Vivier9755c942020-08-24 17:24:30 +02001611# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1612# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001613if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001614 # used for the update-keymaps target, so include rules even if !have_tools
1615 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1616 dependencies: [qemuutil, xkbcommon], install: have_tools)
1617endif
1618
Paolo Bonzini931049b2020-02-05 09:44:24 +01001619if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001620 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1621 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1622 qemu_io = executable('qemu-io', files('qemu-io.c'),
1623 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001624 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001625 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001626
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001627 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001628 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001629 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001630
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001631 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1632 dependencies: qemuutil,
1633 install: true)
1634
Paolo Bonzini931049b2020-02-05 09:44:24 +01001635 if 'CONFIG_VHOST_USER' in config_host
1636 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001637 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001638 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001639 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001640 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001641 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001642
1643 if targetos == 'linux'
1644 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1645 dependencies: [qemuutil, libcap_ng],
1646 install: true,
1647 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001648
1649 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1650 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001651 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001652 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001653 endif
1654
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001655 if 'CONFIG_IVSHMEM' in config_host
1656 subdir('contrib/ivshmem-client')
1657 subdir('contrib/ivshmem-server')
1658 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001659endif
1660
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001661subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001662subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001663subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001664subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001665subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001666if 'CONFIG_GTK' in config_host
1667 subdir('po')
1668endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001669
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001670if host_machine.system() == 'windows'
1671 nsis_cmd = [
1672 find_program('scripts/nsis.py'),
1673 '@OUTPUT@',
1674 get_option('prefix'),
1675 meson.current_source_dir(),
1676 host_machine.cpu_family(),
1677 '--',
1678 '-DDISPLAYVERSION=' + meson.project_version(),
1679 ]
1680 if build_docs
1681 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1682 endif
1683 if 'CONFIG_GTK' in config_host
1684 nsis_cmd += '-DCONFIG_GTK=y'
1685 endif
1686
1687 nsis = custom_target('nsis',
1688 output: 'qemu-setup-' + meson.project_version() + '.exe',
1689 input: files('qemu.nsi'),
1690 build_always_stale: true,
1691 command: nsis_cmd + ['@INPUT@'])
1692 alias_target('installer', nsis)
1693endif
1694
Paolo Bonzinif9332752020-02-03 13:28:38 +01001695summary_info = {}
1696summary_info += {'Install prefix': config_host['prefix']}
1697summary_info += {'BIOS directory': config_host['qemu_datadir']}
1698summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1699summary_info += {'binary directory': config_host['bindir']}
1700summary_info += {'library directory': config_host['libdir']}
1701summary_info += {'module directory': config_host['qemu_moddir']}
1702summary_info += {'libexec directory': config_host['libexecdir']}
1703summary_info += {'include directory': config_host['includedir']}
1704summary_info += {'config directory': config_host['sysconfdir']}
1705if targetos != 'windows'
1706 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001707 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001708else
1709 summary_info += {'local state directory': 'queried at runtime'}
1710endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001711summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001712summary_info += {'Build directory': meson.current_build_dir()}
1713summary_info += {'Source path': meson.current_source_dir()}
1714summary_info += {'GIT binary': config_host['GIT']}
1715summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1716summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1717summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1718if link_language == 'cpp'
1719 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1720else
1721 summary_info += {'C++ compiler': false}
1722endif
1723if targetos == 'darwin'
1724 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1725endif
1726summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1727summary_info += {'CFLAGS': config_host['CFLAGS']}
1728summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1729summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1730summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001731summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1732summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1733summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1734# TODO: add back version
Paolo Bonzini4d34a862020-10-05 11:31:15 +02001735summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt}
1736if slirp_opt != 'disabled'
Paolo Bonzinif9332752020-02-03 13:28:38 +01001737 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1738endif
1739summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1740if config_host.has_key('CONFIG_MODULES')
1741 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1742endif
1743summary_info += {'host CPU': cpu}
1744summary_info += {'host endianness': build_machine.endian()}
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -04001745summary_info += {'target list': ' '.join(target_dirs)}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001746summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
Paolo Bonzinideb62372020-09-01 07:51:16 -04001747summary_info += {'sparse enabled': sparse.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001748summary_info += {'strip binaries': get_option('strip')}
1749summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001750summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001751if targetos == 'darwin'
1752 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1753endif
1754# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001755summary_info += {'SDL support': sdl.found()}
1756summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001757# TODO: add back version
1758summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1759summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001760summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001761# TODO: add back version
1762summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1763summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1764summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1765# TODO: add back version
1766summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1767if config_host.has_key('CONFIG_GCRYPT')
1768 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1769 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1770endif
1771# TODO: add back version
1772summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1773if config_host.has_key('CONFIG_NETTLE')
1774 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1775endif
1776summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1777summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1778summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1779summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1780# TODO: add back version
1781summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1782summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1783summary_info += {'mingw32 support': targetos == 'windows'}
1784summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1785summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1786summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1787summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001788summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001789summary_info += {'VNC support': vnc.found()}
1790if vnc.found()
1791 summary_info += {'VNC SASL support': sasl.found()}
1792 summary_info += {'VNC JPEG support': jpeg.found()}
1793 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001794endif
1795summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1796if config_host.has_key('CONFIG_XEN_BACKEND')
1797 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1798endif
1799summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1800summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1801summary_info += {'PIE': get_option('b_pie')}
1802summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1803summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1804summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1805summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1806summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1807summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04001808summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1809summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1810summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1811summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1812summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1813if config_all.has_key('CONFIG_TCG')
1814 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1815 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1816endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04001817summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001818summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1819summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1820summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1821summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1822summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1823summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1824summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1825summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1826summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1827summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1828summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1829summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1830summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1831summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1832summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1833summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1834summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1835summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1836if config_host['TRACE_BACKENDS'].split().contains('simple')
1837 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1838endif
1839# TODO: add back protocol and server version
1840summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1841summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1842summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1843summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001844summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001845summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1846summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1847summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1848summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1849summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1850summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1851summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1852if targetos == 'windows'
1853 if 'WIN_SDK' in config_host
1854 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1855 endif
1856 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1857 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01001858 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001859endif
1860summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1861summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1862summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1863summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1864summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1865summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1866summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001867summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001868summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1869summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1870summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1871summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1872summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1873summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1874summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1875summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1876summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1877summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1878summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04001879summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001880summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1881summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1882summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1883summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1884summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1885summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1886summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1887summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1888summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1889summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1890summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1891summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001892summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001893summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1894summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02001895summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001896summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1897summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1898summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1899if config_host.has_key('HAVE_GDB_BIN')
1900 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1901endif
1902summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1903summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1904summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1905summary(summary_info, bool_yn: true)
1906
1907if not supported_cpus.contains(cpu)
1908 message()
1909 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1910 message()
1911 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1912 message('The QEMU project intends to remove support for this host CPU in')
1913 message('a future release if nobody volunteers to maintain it and to')
1914 message('provide a build host for our continuous integration setup.')
1915 message('configure has succeeded and you can continue to build, but')
1916 message('if you care about QEMU on this platform you should contact')
1917 message('us upstream at qemu-devel@nongnu.org.')
1918endif
1919
1920if not supported_oses.contains(targetos)
1921 message()
1922 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1923 message()
1924 message('Host OS ' + targetos + 'support is not currently maintained.')
1925 message('The QEMU project intends to remove support for this host OS in')
1926 message('a future release if nobody volunteers to maintain it and to')
1927 message('provide a build host for our continuous integration setup.')
1928 message('configure has succeeded and you can continue to build, but')
1929 message('if you care about QEMU on this platform you should contact')
1930 message('us upstream at qemu-devel@nongnu.org.')
1931endif