blob: 1dd3f4901146150f4b010c6b46af59d0dba86cc0 [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 Bonzinideb62372020-09-01 07:51:16 -0400105sparse = find_program('cgcc', required: get_option('sparse'))
106if sparse.found()
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100107 run_target('sparse',
108 command: [find_program('scripts/check_sparse.py'),
Paolo Bonzinideb62372020-09-01 07:51:16 -0400109 'compile_commands.json', sparse.full_path(), '-Wbitwise',
110 '-Wno-transparent-union', '-Wno-old-initializer',
111 '-Wno-non-pointer-null'])
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100112endif
113
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200114###########################################
115# Target-specific checks and dependencies #
116###########################################
117
118if targetos != 'linux' and get_option('mpath').enabled()
119 error('Multipath is supported only on Linux')
120endif
121
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400122m = cc.find_library('m', required: false)
123util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200124winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400125socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400126version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400127coref = []
128iokit = []
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400129emulator_link_args = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400130cocoa = not_found
Paolo Bonzini8a199802020-09-18 05:37:01 -0400131hvf = not_found
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400132if targetos == 'windows'
133 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200134 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400135
136 win = import('windows')
137 version_res = win.compile_resources('version.rc',
138 depend_files: files('pc-bios/qemu-nsis.ico'),
139 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400140elif targetos == 'darwin'
141 coref = dependency('appleframeworks', modules: 'CoreFoundation')
142 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400143 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200144elif targetos == 'sunos'
145 socket = [cc.find_library('socket'),
146 cc.find_library('nsl'),
147 cc.find_library('resolv')]
148elif targetos == 'haiku'
149 socket = [cc.find_library('posix_error_mapper'),
150 cc.find_library('network'),
151 cc.find_library('bsd')]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400152elif targetos == 'openbsd'
153 if not get_option('tcg').disabled() and target_dirs.length() > 0
154 # Disable OpenBSD W^X if available
155 emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
156 endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400157endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200158
Paolo Bonzini8a199802020-09-18 05:37:01 -0400159accelerators = []
160if not get_option('kvm').disabled() and targetos == 'linux'
161 accelerators += 'CONFIG_KVM'
162endif
163if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
164 accelerators += 'CONFIG_XEN'
165 have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
166else
167 have_xen_pci_passthrough = false
168endif
169if not get_option('whpx').disabled() and targetos == 'windows'
170 if get_option('whpx').enabled() and cpu != 'x86_64'
171 error('WHPX requires 64-bit host')
172 elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
173 cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
174 accelerators += 'CONFIG_WHPX'
175 endif
176endif
177if not get_option('hvf').disabled()
178 hvf = dependency('appleframeworks', modules: 'Hypervisor',
179 required: get_option('hvf'))
180 if hvf.found()
181 accelerators += 'CONFIG_HVF'
182 endif
183endif
184if not get_option('hax').disabled()
185 if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
186 accelerators += 'CONFIG_HAX'
187 endif
188endif
189if not get_option('tcg').disabled()
190 if cpu not in supported_cpus
191 if 'CONFIG_TCG_INTERPRETER' in config_host
192 warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
193 else
194 error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
195 endif
196 endif
197 accelerators += 'CONFIG_TCG'
198 config_host += { 'CONFIG_TCG': 'y' }
199endif
200
201if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
202 error('KVM not available on this platform')
203endif
204if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
205 error('HVF not available on this platform')
206endif
207if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
208 error('WHPX not available on this platform')
209endif
210if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
211 if 'CONFIG_XEN' in accelerators
212 error('Xen PCI passthrough not available on this platform')
213 else
214 error('Xen PCI passthrough requested but Xen not enabled')
215 endif
216endif
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400217if not cocoa.found() and get_option('cocoa').enabled()
218 error('Cocoa not available on this platform')
219endif
220
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200221################
222# Dependencies #
223################
224
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400225# The path to glib.h is added to all compilation commands. This was
226# grandfathered in from the QEMU Makefiles.
227add_project_arguments(config_host['GLIB_CFLAGS'].split(),
228 native: false, language: ['c', 'cpp', 'objc'])
229glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400230gio = not_found
231if 'CONFIG_GIO' in config_host
232 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
233 link_args: config_host['GIO_LIBS'].split())
234endif
235lttng = not_found
236if 'CONFIG_TRACE_UST' in config_host
237 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
238endif
239urcubp = not_found
240if 'CONFIG_TRACE_UST' in config_host
241 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
242endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100243gcrypt = not_found
244if 'CONFIG_GCRYPT' in config_host
245 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
246 link_args: config_host['GCRYPT_LIBS'].split())
247endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400248nettle = not_found
249if 'CONFIG_NETTLE' in config_host
250 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
251 link_args: config_host['NETTLE_LIBS'].split())
252endif
253gnutls = not_found
254if 'CONFIG_GNUTLS' in config_host
255 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
256 link_args: config_host['GNUTLS_LIBS'].split())
257endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200258pixman = not_found
259if have_system or have_tools
260 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400261 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200262endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400263pam = not_found
264if 'CONFIG_AUTH_PAM' in config_host
265 pam = cc.find_library('pam')
266endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400267libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200268zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400269linux_io_uring = not_found
270if 'CONFIG_LINUX_IO_URING' in config_host
271 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
272 link_args: config_host['LINUX_IO_URING_LIBS'].split())
273endif
274libxml2 = not_found
275if 'CONFIG_LIBXML2' in config_host
276 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
277 link_args: config_host['LIBXML2_LIBS'].split())
278endif
279libnfs = not_found
280if 'CONFIG_LIBNFS' in config_host
281 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
282endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400283libattr = not_found
284if 'CONFIG_ATTR' in config_host
285 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
286endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100287seccomp = not_found
288if 'CONFIG_SECCOMP' in config_host
289 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
290 link_args: config_host['SECCOMP_LIBS'].split())
291endif
292libcap_ng = not_found
293if 'CONFIG_LIBCAP_NG' in config_host
294 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
295endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400296if get_option('xkbcommon').auto() and not have_system and not have_tools
297 xkbcommon = not_found
298else
299 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400300 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400301endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400302slirp = not_found
303if config_host.has_key('CONFIG_SLIRP')
304 slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
305 link_args: config_host['SLIRP_LIBS'].split())
306endif
307vde = not_found
308if config_host.has_key('CONFIG_VDE')
309 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
310endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200311pulse = not_found
312if 'CONFIG_LIBPULSE' in config_host
313 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
314 link_args: config_host['PULSE_LIBS'].split())
315endif
316alsa = not_found
317if 'CONFIG_ALSA' in config_host
318 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
319 link_args: config_host['ALSA_LIBS'].split())
320endif
321jack = not_found
322if 'CONFIG_LIBJACK' in config_host
323 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
324endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200325spice = not_found
326if 'CONFIG_SPICE' in config_host
327 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
328 link_args: config_host['SPICE_LIBS'].split())
329endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400330rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400331libdl = not_found
332if 'CONFIG_PLUGIN' in config_host
333 libdl = cc.find_library('dl', required: true)
334endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200335libiscsi = not_found
336if 'CONFIG_LIBISCSI' in config_host
337 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
338 link_args: config_host['LIBISCSI_LIBS'].split())
339endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400340zstd = not_found
341if 'CONFIG_ZSTD' in config_host
342 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
343 link_args: config_host['ZSTD_LIBS'].split())
344endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400345gbm = not_found
346if 'CONFIG_GBM' in config_host
347 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
348 link_args: config_host['GBM_LIBS'].split())
349endif
350virgl = not_found
351if 'CONFIG_VIRGL' in config_host
352 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
353 link_args: config_host['VIRGL_LIBS'].split())
354endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400355curl = not_found
356if 'CONFIG_CURL' in config_host
357 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
358 link_args: config_host['CURL_LIBS'].split())
359endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200360libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200361if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200362 libudev = dependency('libudev',
363 required: get_option('mpath').enabled(),
364 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200365endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200366
367mpathpersist = not_found
368mpathpersist_new_api = false
369if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
370 mpath_test_source_new = '''
371 #include <libudev.h>
372 #include <mpath_persist.h>
373 unsigned mpath_mx_alloc_len = 1024;
374 int logsink;
375 static struct config *multipath_conf;
376 extern struct udev *udev;
377 extern struct config *get_multipath_config(void);
378 extern void put_multipath_config(struct config *conf);
379 struct udev *udev;
380 struct config *get_multipath_config(void) { return multipath_conf; }
381 void put_multipath_config(struct config *conf) { }
382 int main(void) {
383 udev = udev_new();
384 multipath_conf = mpath_lib_init();
385 return 0;
386 }'''
387 mpath_test_source_old = '''
388 #include <libudev.h>
389 #include <mpath_persist.h>
390 unsigned mpath_mx_alloc_len = 1024;
391 int logsink;
392 int main(void) {
393 struct udev *udev = udev_new();
394 mpath_lib_init(udev);
395 return 0;
396 }'''
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200397 mpathlibs = [libudev]
398 if enable_static
399 mpathlibs += cc.find_library('devmapper',
400 required: get_option('mpath'),
401 static: enable_static)
402 endif
403 mpathlibs += cc.find_library('multipath',
404 required: get_option('mpath'),
405 static: enable_static)
406 mpathlibs += cc.find_library('mpathpersist',
407 required: get_option('mpath'),
408 static: enable_static)
409 foreach lib: mpathlibs
410 if not lib.found()
411 mpathlibs = []
412 break
413 endif
414 endforeach
415 if mpathlibs.length() > 0
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200416 if cc.links(mpath_test_source_new, dependencies: mpathlibs)
417 mpathpersist = declare_dependency(dependencies: mpathlibs)
418 mpathpersist_new_api = true
419 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
420 mpathpersist = declare_dependency(dependencies: mpathlibs)
421 else
422 if get_option('mpath').enabled()
423 error('Cannot detect libmpathpersist API')
424 else
425 warning('Cannot detect libmpathpersist API, disabling')
426 endif
427 endif
428 endif
429endif
430
Paolo Bonzini26347332019-07-29 15:40:07 +0200431brlapi = not_found
432if 'CONFIG_BRLAPI' in config_host
433 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
434endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100435
Paolo Bonzini760e4322020-08-26 08:09:48 +0200436sdl = not_found
437if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800438 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200439 sdl_image = not_found
440endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100441if sdl.found()
442 # work around 2.0.8 bug
443 sdl = declare_dependency(compile_args: '-Wno-undef',
444 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200445 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400446 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100447else
448 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100449 error('sdl-image required, but SDL was @0@'.format(
450 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100451 endif
452 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200453endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100454
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400455rbd = not_found
456if 'CONFIG_RBD' in config_host
457 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
458endif
459glusterfs = not_found
460if 'CONFIG_GLUSTERFS' in config_host
461 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
462 link_args: config_host['GLUSTERFS_LIBS'].split())
463endif
464libssh = not_found
465if 'CONFIG_LIBSSH' in config_host
466 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
467 link_args: config_host['LIBSSH_LIBS'].split())
468endif
469libbzip2 = not_found
470if 'CONFIG_BZIP2' in config_host
471 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
472endif
473liblzfse = not_found
474if 'CONFIG_LZFSE' in config_host
475 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
476endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200477oss = not_found
478if 'CONFIG_AUDIO_OSS' in config_host
479 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
480endif
481dsound = not_found
482if 'CONFIG_AUDIO_DSOUND' in config_host
483 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
484endif
485coreaudio = not_found
486if 'CONFIG_AUDIO_COREAUDIO' in config_host
487 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
488endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400489opengl = not_found
490if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400491 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
492 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400493endif
494gtk = not_found
495if 'CONFIG_GTK' in config_host
496 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
497 link_args: config_host['GTK_LIBS'].split())
498endif
499vte = not_found
500if 'CONFIG_VTE' in config_host
501 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
502 link_args: config_host['VTE_LIBS'].split())
503endif
504x11 = not_found
505if 'CONFIG_X11' in config_host
506 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
507 link_args: config_host['X11_LIBS'].split())
508endif
509curses = not_found
510if 'CONFIG_CURSES' in config_host
511 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
512 link_args: config_host['CURSES_LIBS'].split())
513endif
514iconv = not_found
515if 'CONFIG_ICONV' in config_host
516 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
517 link_args: config_host['ICONV_LIBS'].split())
518endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100519vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400520png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400521jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400522sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100523if get_option('vnc').enabled()
524 vnc = declare_dependency() # dummy dependency
525 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400526 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100527 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
528 required: get_option('vnc_jpeg'),
529 static: enable_static)
530 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
531 required: get_option('vnc_sasl'),
532 static: enable_static)
533 if sasl.found()
534 sasl = declare_dependency(dependencies: sasl,
535 compile_args: '-DSTRUCT_IOVEC_DEFINED')
536 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400537endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200538fdt = not_found
539if 'CONFIG_FDT' in config_host
540 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
541 link_args: config_host['FDT_LIBS'].split())
542endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400543snappy = not_found
544if 'CONFIG_SNAPPY' in config_host
545 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
546endif
547lzo = not_found
548if 'CONFIG_LZO' in config_host
549 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
550endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400551rdma = not_found
552if 'CONFIG_RDMA' in config_host
553 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
554endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400555numa = not_found
556if 'CONFIG_NUMA' in config_host
557 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
558endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400559xen = not_found
560if 'CONFIG_XEN_BACKEND' in config_host
561 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
562 link_args: config_host['XEN_LIBS'].split())
563endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200564cacard = not_found
565if 'CONFIG_SMARTCARD' in config_host
566 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
567 link_args: config_host['SMARTCARD_LIBS'].split())
568endif
César Belley0a40bcb2020-08-26 13:42:04 +0200569u2f = not_found
570if have_system
571 u2f = dependency('u2f-emu', required: get_option('u2f'),
572 method: 'pkg-config',
573 static: enable_static)
574endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200575usbredir = not_found
576if 'CONFIG_USB_REDIR' in config_host
577 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
578 link_args: config_host['USB_REDIR_LIBS'].split())
579endif
580libusb = not_found
581if 'CONFIG_USB_LIBUSB' in config_host
582 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
583 link_args: config_host['LIBUSB_LIBS'].split())
584endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400585capstone = not_found
586if 'CONFIG_CAPSTONE' in config_host
587 capstone = declare_dependency(compile_args: config_host['CAPSTONE_CFLAGS'].split(),
588 link_args: config_host['CAPSTONE_LIBS'].split())
589endif
590libpmem = not_found
591if 'CONFIG_LIBPMEM' in config_host
592 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
593 link_args: config_host['LIBPMEM_LIBS'].split())
594endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600595libdaxctl = not_found
596if 'CONFIG_LIBDAXCTL' in config_host
597 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
598endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400599tasn1 = not_found
600if 'CONFIG_TASN1' in config_host
601 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
602 link_args: config_host['TASN1_LIBS'].split())
603endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400604keyutils = dependency('libkeyutils', required: false,
605 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400606
Marc-André Lureau3909def2020-08-28 15:07:33 +0400607has_gettid = cc.has_function('gettid')
608
Paolo Bonziniaa087962020-09-01 11:15:30 -0400609# Malloc tests
610
611malloc = []
612if get_option('malloc') == 'system'
613 has_malloc_trim = \
614 not get_option('malloc_trim').disabled() and \
615 cc.links('''#include <malloc.h>
616 int main(void) { malloc_trim(0); return 0; }''')
617else
618 has_malloc_trim = false
619 malloc = cc.find_library(get_option('malloc'), required: true)
620endif
621if not has_malloc_trim and get_option('malloc_trim').enabled()
622 if get_option('malloc') == 'system'
623 error('malloc_trim not available on this platform.')
624 else
625 error('malloc_trim not available with non-libc memory allocator')
626 endif
627endif
628
Paolo Bonzini859aef02020-08-04 18:14:26 +0200629# Create config-host.h
630
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400631config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200632config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200633config_host_data.set('CONFIG_MPATH', mpathpersist.found())
634config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100635config_host_data.set('CONFIG_SDL', sdl.found())
636config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100637config_host_data.set('CONFIG_VNC', vnc.found())
638config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
639config_host_data.set('CONFIG_VNC_PNG', png.found())
640config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200641config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400642config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400643config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400644config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200645config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
646config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
647config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
648config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
649
Paolo Bonzini765686d2020-09-18 06:37:21 -0400650ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
Paolo Bonzini859aef02020-08-04 18:14:26 +0200651arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200652strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200653 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200654 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200655foreach k, v: config_host
Paolo Bonzini765686d2020-09-18 06:37:21 -0400656 if ignored.contains(k)
657 # do nothing
658 elif arrays.contains(k)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200659 if v != ''
660 v = '"' + '", "'.join(v.split()) + '", '
661 endif
662 config_host_data.set(k, v)
663 elif k == 'ARCH'
664 config_host_data.set('HOST_' + v.to_upper(), 1)
665 elif strings.contains(k)
666 if not k.startswith('CONFIG_')
667 k = 'CONFIG_' + k.to_upper()
668 endif
669 config_host_data.set_quoted(k, v)
670 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
671 config_host_data.set(k, v == 'y' ? 1 : v)
672 endif
673endforeach
674genh += configure_file(output: 'config-host.h', configuration: config_host_data)
675
Paolo Bonzini2becc362020-02-03 11:42:03 +0100676minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400677config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400678config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400679config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100680config_devices_mak_list = []
681config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200682config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100683config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400684
685disassemblers = {
686 'alpha' : ['CONFIG_ALPHA_DIS'],
687 'arm' : ['CONFIG_ARM_DIS'],
688 'avr' : ['CONFIG_AVR_DIS'],
689 'cris' : ['CONFIG_CRIS_DIS'],
690 'hppa' : ['CONFIG_HPPA_DIS'],
691 'i386' : ['CONFIG_I386_DIS'],
692 'x86_64' : ['CONFIG_I386_DIS'],
693 'x32' : ['CONFIG_I386_DIS'],
694 'lm32' : ['CONFIG_LM32_DIS'],
695 'm68k' : ['CONFIG_M68K_DIS'],
696 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
697 'mips' : ['CONFIG_MIPS_DIS'],
698 'moxie' : ['CONFIG_MOXIE_DIS'],
699 'nios2' : ['CONFIG_NIOS2_DIS'],
700 'or1k' : ['CONFIG_OPENRISC_DIS'],
701 'ppc' : ['CONFIG_PPC_DIS'],
702 'riscv' : ['CONFIG_RISCV_DIS'],
703 'rx' : ['CONFIG_RX_DIS'],
704 's390' : ['CONFIG_S390_DIS'],
705 'sh4' : ['CONFIG_SH4_DIS'],
706 'sparc' : ['CONFIG_SPARC_DIS'],
707 'xtensa' : ['CONFIG_XTENSA_DIS'],
708}
709if link_language == 'cpp'
710 disassemblers += {
711 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
712 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
713 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
714 }
715endif
716
Paolo Bonzini2becc362020-02-03 11:42:03 +0100717kconfig_external_symbols = [
718 'CONFIG_KVM',
719 'CONFIG_XEN',
720 'CONFIG_TPM',
721 'CONFIG_SPICE',
722 'CONFIG_IVSHMEM',
723 'CONFIG_OPENGL',
724 'CONFIG_X11',
725 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200726 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100727 'CONFIG_VHOST_KERNEL',
728 'CONFIG_VIRTFS',
729 'CONFIG_LINUX',
730 'CONFIG_PVRDMA',
731]
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400732ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400733
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400734default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
735actual_target_dirs = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400736foreach target : target_dirs
Paolo Bonzini765686d2020-09-18 06:37:21 -0400737 config_target = { 'TARGET_NAME': target.split('-')[0] }
738 if target.endswith('linux-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400739 if targetos != 'linux'
740 if default_targets
741 continue
742 endif
743 error('Target @0@ is only available on a Linux host'.format(target))
744 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400745 config_target += { 'CONFIG_LINUX_USER': 'y' }
746 elif target.endswith('bsd-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400747 if 'CONFIG_BSD' not in config_host
748 if default_targets
749 continue
750 endif
751 error('Target @0@ is only available on a BSD host'.format(target))
752 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400753 config_target += { 'CONFIG_BSD_USER': 'y' }
754 elif target.endswith('softmmu')
755 config_target += { 'CONFIG_SOFTMMU': 'y' }
756 endif
757 if target.endswith('-user')
758 config_target += {
759 'CONFIG_USER_ONLY': 'y',
760 'CONFIG_QEMU_INTERP_PREFIX':
761 config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
762 }
763 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200764
Paolo Bonzini8a199802020-09-18 05:37:01 -0400765 have_accel = false
766 foreach sym: accelerators
767 if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
768 config_target += { sym: 'y' }
769 config_all += { sym: 'y' }
770 if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
771 config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
772 endif
773 have_accel = true
774 endif
775 endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400776 if not have_accel
777 if default_targets
778 continue
779 endif
780 error('No accelerator available for target @0@'.format(target))
781 endif
Paolo Bonzini8a199802020-09-18 05:37:01 -0400782
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400783 actual_target_dirs += target
Paolo Bonzini765686d2020-09-18 06:37:21 -0400784 config_target += keyval.load('default-configs/targets' / target + '.mak')
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400785 config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
Paolo Bonzini765686d2020-09-18 06:37:21 -0400786
Paolo Bonzinifa731682020-09-21 05:19:07 -0400787 # Add default keys
788 if 'TARGET_BASE_ARCH' not in config_target
789 config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']}
790 endif
791 if 'TARGET_ABI_DIR' not in config_target
792 config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']}
793 endif
794
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400795 foreach k, v: disassemblers
796 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
797 foreach sym: v
798 config_target += { sym: 'y' }
799 config_all_disas += { sym: 'y' }
800 endforeach
801 endif
802 endforeach
803
Paolo Bonzini859aef02020-08-04 18:14:26 +0200804 config_target_data = configuration_data()
805 foreach k, v: config_target
806 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
807 # do nothing
808 elif ignored.contains(k)
809 # do nothing
810 elif k == 'TARGET_BASE_ARCH'
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400811 # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
812 # not used to select files from sourcesets.
Paolo Bonzini859aef02020-08-04 18:14:26 +0200813 config_target_data.set('TARGET_' + v.to_upper(), 1)
Paolo Bonzini765686d2020-09-18 06:37:21 -0400814 elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
Paolo Bonzini859aef02020-08-04 18:14:26 +0200815 config_target_data.set_quoted(k, v)
816 elif v == 'y'
817 config_target_data.set(k, 1)
818 else
819 config_target_data.set(k, v)
820 endif
821 endforeach
822 config_target_h += {target: configure_file(output: target + '-config-target.h',
823 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100824
825 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100826 base_kconfig = []
827 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200828 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100829 base_kconfig += '@0@=y'.format(sym)
830 endif
831 endforeach
832
833 config_devices_mak = target + '-config-devices.mak'
834 config_devices_mak = configure_file(
Paolo Bonzini1bb4cb12020-09-18 06:06:09 -0400835 input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
Paolo Bonzini2becc362020-02-03 11:42:03 +0100836 output: config_devices_mak,
837 depfile: config_devices_mak + '.d',
838 capture: true,
839 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
840 config_devices_mak, '@DEPFILE@', '@INPUT@',
841 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200842
843 config_devices_data = configuration_data()
844 config_devices = keyval.load(config_devices_mak)
845 foreach k, v: config_devices
846 config_devices_data.set(k, 1)
847 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100848 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200849 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
850 configuration: config_devices_data)}
851 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400852 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100853 endif
854 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400855endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400856target_dirs = actual_target_dirs
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400857
Paolo Bonzini2becc362020-02-03 11:42:03 +0100858# This configuration is used to build files that are shared by
859# multiple binaries, and then extracted out of the "common"
860# static_library target.
861#
862# We do not use all_sources()/all_dependencies(), because it would
863# build literally all source files, including devices only used by
864# targets that are not built for this compilation. The CONFIG_ALL
865# pseudo symbol replaces it.
866
Paolo Bonzini05512f52020-09-16 15:31:11 -0400867config_all += config_all_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100868config_all += config_host
869config_all += config_all_disas
870config_all += {
871 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
872 'CONFIG_SOFTMMU': have_system,
873 'CONFIG_USER_ONLY': have_user,
874 'CONFIG_ALL': true,
875}
876
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400877# Generators
878
Marc-André Lureau3f885652019-07-15 18:06:04 +0400879hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +0400880shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400881qapi_gen = find_program('scripts/qapi-gen.py')
882qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
883 meson.source_root() / 'scripts/qapi/commands.py',
884 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400885 meson.source_root() / 'scripts/qapi/error.py',
886 meson.source_root() / 'scripts/qapi/events.py',
887 meson.source_root() / 'scripts/qapi/expr.py',
888 meson.source_root() / 'scripts/qapi/gen.py',
889 meson.source_root() / 'scripts/qapi/introspect.py',
890 meson.source_root() / 'scripts/qapi/parser.py',
891 meson.source_root() / 'scripts/qapi/schema.py',
892 meson.source_root() / 'scripts/qapi/source.py',
893 meson.source_root() / 'scripts/qapi/types.py',
894 meson.source_root() / 'scripts/qapi/visit.py',
895 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400896 meson.source_root() / 'scripts/qapi-gen.py'
897]
898
899tracetool = [
900 python, files('scripts/tracetool.py'),
901 '--backend=' + config_host['TRACE_BACKENDS']
902]
903
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400904qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
905 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +0200906 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400907qemu_version = custom_target('qemu-version.h',
908 output: 'qemu-version.h',
909 command: qemu_version_cmd,
910 capture: true,
911 build_by_default: true,
912 build_always_stale: true)
913genh += qemu_version
914
Marc-André Lureau3f885652019-07-15 18:06:04 +0400915hxdep = []
916hx_headers = [
917 ['qemu-options.hx', 'qemu-options.def'],
918 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
919]
920if have_system
921 hx_headers += [
922 ['hmp-commands.hx', 'hmp-commands.h'],
923 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
924 ]
925endif
926foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400927 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +0400928 input: files(d[0]),
929 output: d[1],
930 capture: true,
931 build_by_default: true, # to be removed when added to a target
932 command: [hxtool, '-h', '@INPUT0@'])
933endforeach
934genh += hxdep
935
Peter Maydelleb937362020-09-25 17:23:08 +0100936SPHINX_ARGS = [config_host['SPHINX_BUILD'],
937 '-Dversion=' + meson.project_version(),
938 '-Drelease=' + config_host['PKGVERSION']]
939
940if get_option('werror')
941 SPHINX_ARGS += [ '-W' ]
942endif
943
Peter Maydellb3f48302020-09-25 17:23:09 +0100944sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
945 meson.source_root() / 'docs/sphinx/hxtool.py',
946 meson.source_root() / 'docs/sphinx/kerneldoc.py',
947 meson.source_root() / 'docs/sphinx/kernellog.py',
948 meson.source_root() / 'docs/sphinx/qapidoc.py',
949 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
950 qapi_gen_depends ]
951
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400952# Collect sourcesets.
953
954util_ss = ss.source_set()
955stub_ss = ss.source_set()
956trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400957block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +0200958blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200959qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100960common_ss = ss.source_set()
961softmmu_ss = ss.source_set()
962user_ss = ss.source_set()
963bsd_user_ss = ss.source_set()
964linux_user_ss = ss.source_set()
965specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200966specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100967
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400968modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100969hw_arch = {}
970target_arch = {}
971target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400972
973###############
974# Trace files #
975###############
976
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400977# TODO: add each directory to the subdirs from its own meson.build, once
978# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400979trace_events_subdirs = [
980 'accel/kvm',
981 'accel/tcg',
982 'crypto',
983 'monitor',
984]
985if have_user
986 trace_events_subdirs += [ 'linux-user' ]
987endif
988if have_block
989 trace_events_subdirs += [
990 'authz',
991 'block',
992 'io',
993 'nbd',
994 'scsi',
995 ]
996endif
997if have_system
998 trace_events_subdirs += [
999 'audio',
1000 'backends',
1001 'backends/tpm',
1002 'chardev',
1003 'hw/9pfs',
1004 'hw/acpi',
1005 'hw/alpha',
1006 'hw/arm',
1007 'hw/audio',
1008 'hw/block',
1009 'hw/block/dataplane',
1010 'hw/char',
1011 'hw/display',
1012 'hw/dma',
1013 'hw/hppa',
1014 'hw/hyperv',
1015 'hw/i2c',
1016 'hw/i386',
1017 'hw/i386/xen',
1018 'hw/ide',
1019 'hw/input',
1020 'hw/intc',
1021 'hw/isa',
1022 'hw/mem',
1023 'hw/mips',
1024 'hw/misc',
1025 'hw/misc/macio',
1026 'hw/net',
1027 'hw/nvram',
1028 'hw/pci',
1029 'hw/pci-host',
1030 'hw/ppc',
1031 'hw/rdma',
1032 'hw/rdma/vmw',
1033 'hw/rtc',
1034 'hw/s390x',
1035 'hw/scsi',
1036 'hw/sd',
1037 'hw/sparc',
1038 'hw/sparc64',
1039 'hw/ssi',
1040 'hw/timer',
1041 'hw/tpm',
1042 'hw/usb',
1043 'hw/vfio',
1044 'hw/virtio',
1045 'hw/watchdog',
1046 'hw/xen',
1047 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001048 'migration',
1049 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001050 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001051 'ui',
1052 ]
1053endif
1054trace_events_subdirs += [
1055 'hw/core',
1056 'qapi',
1057 'qom',
1058 'target/arm',
1059 'target/hppa',
1060 'target/i386',
1061 'target/mips',
1062 'target/ppc',
1063 'target/riscv',
1064 'target/s390x',
1065 'target/sparc',
1066 'util',
1067]
1068
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001069subdir('qapi')
1070subdir('qobject')
1071subdir('stubs')
1072subdir('trace')
1073subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001074subdir('qom')
1075subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001076subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001077subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001078
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001079
1080if enable_modules
1081 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1082 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1083endif
1084
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001085# Build targets from sourcesets
1086
Paolo Bonzini2becc362020-02-03 11:42:03 +01001087stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001088
1089util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001090util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001091libqemuutil = static_library('qemuutil',
1092 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001093 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001094qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001095 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001096
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001097decodetree = generator(find_program('scripts/decodetree.py'),
1098 output: 'decode-@BASENAME@.c.inc',
1099 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1100
Paolo Bonzini478e9432020-08-17 12:47:55 +02001101subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001102subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001103subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001104subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001105subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001106subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001107subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001108
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001109block_ss.add(files(
1110 'block.c',
Kevin Wolf56ee8622020-09-24 17:26:50 +02001111 'blockdev-nbd.c',
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001112 'blockjob.c',
1113 'job.c',
1114 'qemu-io-cmds.c',
1115))
1116block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1117
1118subdir('nbd')
1119subdir('scsi')
1120subdir('block')
1121
Paolo Bonzini4a963372020-08-03 16:22:28 +02001122blockdev_ss.add(files(
1123 'blockdev.c',
Paolo Bonzini4a963372020-08-03 16:22:28 +02001124 'iothread.c',
1125 'job-qmp.c',
1126))
1127
1128# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1129# os-win32.c does not
1130blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1131softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1132
1133softmmu_ss.add_all(blockdev_ss)
1134softmmu_ss.add(files(
1135 'bootdevice.c',
1136 'dma-helpers.c',
1137 'qdev-monitor.c',
1138), sdl)
1139
1140softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1141softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1142softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1143
1144common_ss.add(files('cpus-common.c'))
1145
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001146subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001147
Bruce Rogersc7c91a72020-08-24 09:52:12 -06001148specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001149specific_ss.add(files('exec-vary.c'))
1150specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1151 'fpu/softfloat.c',
1152 'tcg/optimize.c',
1153 'tcg/tcg-common.c',
1154 'tcg/tcg-op-gvec.c',
1155 'tcg/tcg-op-vec.c',
1156 'tcg/tcg-op.c',
1157 'tcg/tcg.c',
1158))
1159specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1160
Marc-André Lureauab318052019-07-24 19:23:16 +04001161subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001162subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001163subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001164subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001165subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001166subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001167subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001168subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001169subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001170subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001171subdir('linux-user')
1172
Marc-André Lureaub309c322019-08-18 19:20:37 +04001173bsd_user_ss.add(files('gdbstub.c'))
1174specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1175
Marc-André Lureau3a304462019-08-18 16:13:08 +04001176linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1177specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001178
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001179# needed for fuzzing binaries
1180subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001181subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001182
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001183block_mods = []
1184softmmu_mods = []
1185foreach d, list : modules
1186 foreach m, module_ss : list
1187 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001188 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001189 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1190 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1191 if d == 'block'
1192 block_mods += sl
1193 else
1194 softmmu_mods += sl
1195 endif
1196 else
1197 if d == 'block'
1198 block_ss.add_all(module_ss)
1199 else
1200 softmmu_ss.add_all(module_ss)
1201 endif
1202 endif
1203 endforeach
1204endforeach
1205
1206nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001207undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001208block_syms = custom_target('block.syms', output: 'block.syms',
1209 input: [libqemuutil, block_mods],
1210 capture: true,
1211 command: [undefsym, nm, '@INPUT@'])
1212qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1213 input: [libqemuutil, softmmu_mods],
1214 capture: true,
1215 command: [undefsym, nm, '@INPUT@'])
1216
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001217block_ss = block_ss.apply(config_host, strict: false)
1218libblock = static_library('block', block_ss.sources() + genh,
1219 dependencies: block_ss.dependencies(),
1220 link_depends: block_syms,
1221 name_suffix: 'fa',
1222 build_by_default: false)
1223
1224block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001225 link_args: '@block.syms',
1226 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001227
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001228qmp_ss = qmp_ss.apply(config_host, strict: false)
1229libqmp = static_library('qmp', qmp_ss.sources() + genh,
1230 dependencies: qmp_ss.dependencies(),
1231 name_suffix: 'fa',
1232 build_by_default: false)
1233
1234qmp = declare_dependency(link_whole: [libqmp])
1235
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001236foreach m : block_mods + softmmu_mods
1237 shared_module(m.name(),
1238 name_prefix: '',
1239 link_whole: m,
1240 install: true,
1241 install_dir: config_host['qemu_moddir'])
1242endforeach
1243
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001244softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1245common_ss.add(qom, qemuutil)
1246
1247common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001248common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1249
1250common_all = common_ss.apply(config_all, strict: false)
1251common_all = static_library('common',
1252 build_by_default: false,
1253 sources: common_all.sources() + genh,
1254 dependencies: common_all.dependencies(),
1255 name_suffix: 'fa')
1256
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001257feature_to_c = find_program('scripts/feature_to_c.sh')
1258
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001259emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001260foreach target : target_dirs
1261 config_target = config_target_mak[target]
1262 target_name = config_target['TARGET_NAME']
1263 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001264 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001265 arch_deps = []
1266 c_args = ['-DNEED_CPU_H',
1267 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1268 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -04001269 link_args = emulator_link_args
Paolo Bonzini2becc362020-02-03 11:42:03 +01001270
Paolo Bonzini859aef02020-08-04 18:14:26 +02001271 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001272 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1273 if targetos == 'linux'
1274 target_inc += include_directories('linux-headers', is_system: true)
1275 endif
1276 if target.endswith('-softmmu')
1277 qemu_target_name = 'qemu-system-' + target_name
1278 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001279 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1280 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001281 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001282
Marc-André Lureau2c442202019-08-17 13:55:58 +04001283 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1284 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1285 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001286 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001287
Paolo Bonzini2becc362020-02-03 11:42:03 +01001288 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001289 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001290 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001291 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001292 target_type='user'
1293 qemu_target_name = 'qemu-' + target_name
1294 if 'CONFIG_LINUX_USER' in config_target
1295 base_dir = 'linux-user'
1296 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1297 else
1298 base_dir = 'bsd-user'
1299 endif
1300 target_inc += include_directories(
1301 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001302 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001303 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001304 if 'CONFIG_LINUX_USER' in config_target
1305 dir = base_dir / abi
1306 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1307 if config_target.has_key('TARGET_SYSTBL_ABI')
1308 arch_srcs += \
1309 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1310 extra_args : config_target['TARGET_SYSTBL_ABI'])
1311 endif
1312 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001313 endif
1314
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001315 if 'TARGET_XML_FILES' in config_target
1316 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1317 output: target + '-gdbstub-xml.c',
1318 input: files(config_target['TARGET_XML_FILES'].split()),
1319 command: [feature_to_c, '@INPUT@'],
1320 capture: true)
1321 arch_srcs += gdbstub_xml
1322 endif
1323
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001324 t = target_arch[arch].apply(config_target, strict: false)
1325 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001326 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001327
Paolo Bonzini2becc362020-02-03 11:42:03 +01001328 target_common = common_ss.apply(config_target, strict: false)
1329 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001330 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001331
Paolo Bonzini2becc362020-02-03 11:42:03 +01001332 target_specific = specific_ss.apply(config_target, strict: false)
1333 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001334 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001335
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001336 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001337 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001338 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001339 objects: objects,
1340 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001341 c_args: c_args,
1342 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001343 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001344
1345 if target.endswith('-softmmu')
1346 execs = [{
1347 'name': 'qemu-system-' + target_name,
1348 'gui': false,
1349 'sources': files('softmmu/main.c'),
1350 'dependencies': []
1351 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001352 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001353 execs += [{
1354 'name': 'qemu-system-' + target_name + 'w',
1355 'gui': true,
1356 'sources': files('softmmu/main.c'),
1357 'dependencies': []
1358 }]
1359 endif
1360 if config_host.has_key('CONFIG_FUZZ')
1361 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1362 execs += [{
1363 'name': 'qemu-fuzz-' + target_name,
1364 'gui': false,
1365 'sources': specific_fuzz.sources(),
1366 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001367 }]
1368 endif
1369 else
1370 execs = [{
1371 'name': 'qemu-' + target_name,
1372 'gui': false,
1373 'sources': [],
1374 'dependencies': []
1375 }]
1376 endif
1377 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001378 emulators += {exe['name']:
1379 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001380 install: true,
1381 c_args: c_args,
1382 dependencies: arch_deps + deps + exe['dependencies'],
1383 objects: lib.extract_all_objects(recursive: true),
1384 link_language: link_language,
1385 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1386 link_args: link_args,
1387 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001388 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001389
1390 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1391 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001392 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1393 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001394 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1395 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1396 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001397 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001398 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001399 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001400 capture: true,
1401 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001402 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001403 command: [
1404 tracetool, '--group=all', '--format=' + stp['fmt'],
1405 '--binary=' + stp['bin'],
1406 '--target-name=' + target_name,
1407 '--target-type=' + target_type,
1408 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1409 '@INPUT@',
1410 ])
1411 endforeach
1412 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001413 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001414endforeach
1415
Paolo Bonzini931049b2020-02-05 09:44:24 +01001416# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001417
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001418if 'CONFIG_PLUGIN' in config_host
1419 install_headers('include/qemu/qemu-plugin.h')
1420endif
1421
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001422if 'CONFIG_GUEST_AGENT' in config_host
1423 subdir('qga')
1424endif
1425
Laurent Vivier9755c942020-08-24 17:24:30 +02001426# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1427# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001428if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001429 # used for the update-keymaps target, so include rules even if !have_tools
1430 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1431 dependencies: [qemuutil, xkbcommon], install: have_tools)
1432endif
1433
Paolo Bonzini931049b2020-02-05 09:44:24 +01001434if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001435 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1436 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1437 qemu_io = executable('qemu-io', files('qemu-io.c'),
1438 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001439 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001440 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001441
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001442 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001443 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001444 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001445
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001446 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1447 dependencies: qemuutil,
1448 install: true)
1449
Paolo Bonzini931049b2020-02-05 09:44:24 +01001450 if 'CONFIG_VHOST_USER' in config_host
1451 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001452 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001453 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001454 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001455 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001456 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001457
1458 if targetos == 'linux'
1459 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1460 dependencies: [qemuutil, libcap_ng],
1461 install: true,
1462 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001463
1464 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1465 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001466 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001467 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001468 endif
1469
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001470 if 'CONFIG_IVSHMEM' in config_host
1471 subdir('contrib/ivshmem-client')
1472 subdir('contrib/ivshmem-server')
1473 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001474endif
1475
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001476subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001477subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001478subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001479subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001480subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001481if 'CONFIG_GTK' in config_host
1482 subdir('po')
1483endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001484
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001485if host_machine.system() == 'windows'
1486 nsis_cmd = [
1487 find_program('scripts/nsis.py'),
1488 '@OUTPUT@',
1489 get_option('prefix'),
1490 meson.current_source_dir(),
1491 host_machine.cpu_family(),
1492 '--',
1493 '-DDISPLAYVERSION=' + meson.project_version(),
1494 ]
1495 if build_docs
1496 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1497 endif
1498 if 'CONFIG_GTK' in config_host
1499 nsis_cmd += '-DCONFIG_GTK=y'
1500 endif
1501
1502 nsis = custom_target('nsis',
1503 output: 'qemu-setup-' + meson.project_version() + '.exe',
1504 input: files('qemu.nsi'),
1505 build_always_stale: true,
1506 command: nsis_cmd + ['@INPUT@'])
1507 alias_target('installer', nsis)
1508endif
1509
Paolo Bonzinif9332752020-02-03 13:28:38 +01001510summary_info = {}
1511summary_info += {'Install prefix': config_host['prefix']}
1512summary_info += {'BIOS directory': config_host['qemu_datadir']}
1513summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1514summary_info += {'binary directory': config_host['bindir']}
1515summary_info += {'library directory': config_host['libdir']}
1516summary_info += {'module directory': config_host['qemu_moddir']}
1517summary_info += {'libexec directory': config_host['libexecdir']}
1518summary_info += {'include directory': config_host['includedir']}
1519summary_info += {'config directory': config_host['sysconfdir']}
1520if targetos != 'windows'
1521 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001522 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001523else
1524 summary_info += {'local state directory': 'queried at runtime'}
1525endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001526summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001527summary_info += {'Build directory': meson.current_build_dir()}
1528summary_info += {'Source path': meson.current_source_dir()}
1529summary_info += {'GIT binary': config_host['GIT']}
1530summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1531summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1532summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1533if link_language == 'cpp'
1534 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1535else
1536 summary_info += {'C++ compiler': false}
1537endif
1538if targetos == 'darwin'
1539 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1540endif
1541summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1542summary_info += {'CFLAGS': config_host['CFLAGS']}
1543summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1544summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1545summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001546summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1547summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1548summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1549# TODO: add back version
1550summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1551if config_host.has_key('CONFIG_SLIRP')
1552 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1553endif
1554summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1555if config_host.has_key('CONFIG_MODULES')
1556 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1557endif
1558summary_info += {'host CPU': cpu}
1559summary_info += {'host endianness': build_machine.endian()}
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -04001560summary_info += {'target list': ' '.join(target_dirs)}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001561summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
Paolo Bonzinideb62372020-09-01 07:51:16 -04001562summary_info += {'sparse enabled': sparse.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001563summary_info += {'strip binaries': get_option('strip')}
1564summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001565summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001566if targetos == 'darwin'
1567 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1568endif
1569# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001570summary_info += {'SDL support': sdl.found()}
1571summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001572# TODO: add back version
1573summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1574summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001575summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001576# TODO: add back version
1577summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1578summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1579summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1580# TODO: add back version
1581summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1582if config_host.has_key('CONFIG_GCRYPT')
1583 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1584 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1585endif
1586# TODO: add back version
1587summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1588if config_host.has_key('CONFIG_NETTLE')
1589 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1590endif
1591summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1592summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1593summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1594summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1595# TODO: add back version
1596summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1597summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1598summary_info += {'mingw32 support': targetos == 'windows'}
1599summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1600summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1601summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1602summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001603summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001604summary_info += {'VNC support': vnc.found()}
1605if vnc.found()
1606 summary_info += {'VNC SASL support': sasl.found()}
1607 summary_info += {'VNC JPEG support': jpeg.found()}
1608 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001609endif
1610summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1611if config_host.has_key('CONFIG_XEN_BACKEND')
1612 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1613endif
1614summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1615summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1616summary_info += {'PIE': get_option('b_pie')}
1617summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1618summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1619summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1620summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1621summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1622summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04001623summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1624summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1625summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1626summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1627summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1628if config_all.has_key('CONFIG_TCG')
1629 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1630 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1631endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04001632summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001633summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1634summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1635summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1636summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1637summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1638summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1639summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1640summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1641summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1642summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1643summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1644summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1645summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1646summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1647summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1648summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1649summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1650summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1651if config_host['TRACE_BACKENDS'].split().contains('simple')
1652 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1653endif
1654# TODO: add back protocol and server version
1655summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1656summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1657summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1658summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001659summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001660summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1661summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1662summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1663summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1664summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1665summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1666summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1667if targetos == 'windows'
1668 if 'WIN_SDK' in config_host
1669 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1670 endif
1671 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1672 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01001673 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001674endif
1675summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1676summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1677summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1678summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1679summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1680summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1681summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001682summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001683summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1684summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1685summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1686summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1687summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1688summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1689summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1690summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1691summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1692summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1693summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04001694summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001695summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1696summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1697summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1698summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1699summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1700summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1701summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1702summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1703summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1704summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1705summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1706summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
1707summary_info += {'capstone': config_host.has_key('CONFIG_CAPSTONE')}
1708summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1709summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02001710summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001711summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1712summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1713summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1714if config_host.has_key('HAVE_GDB_BIN')
1715 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1716endif
1717summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1718summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1719summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1720summary(summary_info, bool_yn: true)
1721
1722if not supported_cpus.contains(cpu)
1723 message()
1724 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1725 message()
1726 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1727 message('The QEMU project intends to remove support for this host CPU in')
1728 message('a future release if nobody volunteers to maintain it and to')
1729 message('provide a build host for our continuous integration setup.')
1730 message('configure has succeeded and you can continue to build, but')
1731 message('if you care about QEMU on this platform you should contact')
1732 message('us upstream at qemu-devel@nongnu.org.')
1733endif
1734
1735if not supported_oses.contains(targetos)
1736 message()
1737 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1738 message()
1739 message('Host OS ' + targetos + 'support is not currently maintained.')
1740 message('The QEMU project intends to remove support for this host OS in')
1741 message('a future release if nobody volunteers to maintain it and to')
1742 message('provide a build host for our continuous integration setup.')
1743 message('configure has succeeded and you can continue to build, but')
1744 message('if you care about QEMU on this platform you should contact')
1745 message('us upstream at qemu-devel@nongnu.org.')
1746endif