blob: 5f5d91636472a19e39c0cd8c3625a9febba88cf8 [file] [log] [blame]
Paolo Bonzinia5665052019-06-10 12:05:14 +02001project('qemu', ['c'], meson_version: '>=0.55.0',
Gerd Hoffmann90756b22020-08-25 08:43:42 +02002 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
Paolo Bonzini3e0e5192020-09-01 12:48:00 -04003 'b_colorout=auto'],
Paolo Bonzinia5665052019-06-10 12:05:14 +02004 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
Paolo Bonzinib29b40f2020-08-10 18:04:43 +02007if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040012ss = import('sourceset')
13
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010014sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040015cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020016config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040017enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010018enable_static = 'CONFIG_STATIC' in config_host
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +020019build_docs = 'BUILD_DOCS' in config_host
Marc-André Lureau8fe11232020-09-11 14:42:48 +020020
21if get_option('qemu_suffix').startswith('/')
22 error('qemu_suffix cannot start with a /')
23endif
24
Marc-André Lureauab4c0992020-08-26 15:04:16 +040025qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040026qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020027config_host_data = configuration_data()
28genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020029
Paolo Bonzini760e4322020-08-26 08:09:48 +020030target_dirs = config_host['TARGET_DIRS'].split()
31have_user = false
32have_system = false
33foreach target : target_dirs
34 have_user = have_user or target.endswith('-user')
35 have_system = have_system or target.endswith('-softmmu')
36endforeach
37have_tools = 'CONFIG_TOOLS' in config_host
38have_block = have_system or have_tools
39
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040040python = import('python').find_installation()
41
42supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
43supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
44 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
45
46cpu = host_machine.cpu_family()
47targetos = host_machine.system()
48
49configure_file(input: files('scripts/ninjatool.py'),
50 output: 'ninjatool',
51 configuration: config_host)
52
Paolo Bonzini8a199802020-09-18 05:37:01 -040053if cpu in ['x86', 'x86_64']
54 kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
55elif cpu == 'aarch64'
56 kvm_targets = ['aarch64-softmmu']
57elif cpu == 's390x'
58 kvm_targets = ['s390x-softmmu']
59elif cpu in ['ppc', 'ppc64']
60 kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
61else
62 kvm_targets = []
63endif
64
65accelerator_targets = { 'CONFIG_KVM': kvm_targets }
66if cpu in ['x86', 'x86_64']
67 accelerator_targets += {
68 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
69 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
70 'CONFIG_HVF': ['x86_64-softmmu'],
71 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
72 }
73endif
74
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040075##################
76# Compiler flags #
77##################
78
Alexander Bulekovff9ed622020-09-09 18:05:16 -040079# Specify linker-script with add_project_link_arguments so that it is not placed
80# within a linker --start-group/--end-group pair
81if 'CONFIG_FUZZ' in config_host
82 add_project_link_arguments(['-Wl,-T,',
83 (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
84 native: false, language: ['c', 'cpp', 'objc'])
85endif
86
Paolo Bonzinia5665052019-06-10 12:05:14 +020087add_project_arguments(config_host['QEMU_CFLAGS'].split(),
88 native: false, language: ['c', 'objc'])
89add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
90 native: false, language: 'cpp')
91add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
92 native: false, language: ['c', 'cpp', 'objc'])
93add_project_arguments(config_host['QEMU_INCLUDES'].split(),
94 language: ['c', 'cpp', 'objc'])
95
Alexander Bulekovc46f76d2020-09-02 13:36:50 -040096
Marc-André Lureaufc929892019-07-13 01:47:54 +040097link_language = meson.get_external_property('link_language', 'cpp')
98if link_language == 'cpp'
99 add_languages('cpp', required: true, native: false)
100endif
Paolo Bonzinia5665052019-06-10 12:05:14 +0200101if host_machine.system() == 'darwin'
102 add_languages('objc', required: false, native: false)
103endif
104
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100105if 'SPARSE_CFLAGS' in config_host
106 run_target('sparse',
107 command: [find_program('scripts/check_sparse.py'),
108 config_host['SPARSE_CFLAGS'].split(),
109 'compile_commands.json'])
110endif
111
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200112###########################################
113# Target-specific checks and dependencies #
114###########################################
115
116if targetos != 'linux' and get_option('mpath').enabled()
117 error('Multipath is supported only on Linux')
118endif
119
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400120m = cc.find_library('m', required: false)
121util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200122winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400123socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400124version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400125coref = []
126iokit = []
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400127emulator_link_args = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400128cocoa = not_found
Paolo Bonzini8a199802020-09-18 05:37:01 -0400129hvf = not_found
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400130if targetos == 'windows'
131 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200132 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400133
134 win = import('windows')
135 version_res = win.compile_resources('version.rc',
136 depend_files: files('pc-bios/qemu-nsis.ico'),
137 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400138elif targetos == 'darwin'
139 coref = dependency('appleframeworks', modules: 'CoreFoundation')
140 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400141 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200142elif targetos == 'sunos'
143 socket = [cc.find_library('socket'),
144 cc.find_library('nsl'),
145 cc.find_library('resolv')]
146elif targetos == 'haiku'
147 socket = [cc.find_library('posix_error_mapper'),
148 cc.find_library('network'),
149 cc.find_library('bsd')]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400150elif targetos == 'openbsd'
151 if not get_option('tcg').disabled() and target_dirs.length() > 0
152 # Disable OpenBSD W^X if available
153 emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
154 endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400155endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200156
Paolo Bonzini8a199802020-09-18 05:37:01 -0400157accelerators = []
158if not get_option('kvm').disabled() and targetos == 'linux'
159 accelerators += 'CONFIG_KVM'
160endif
161if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
162 accelerators += 'CONFIG_XEN'
163 have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
164else
165 have_xen_pci_passthrough = false
166endif
167if not get_option('whpx').disabled() and targetos == 'windows'
168 if get_option('whpx').enabled() and cpu != 'x86_64'
169 error('WHPX requires 64-bit host')
170 elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
171 cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
172 accelerators += 'CONFIG_WHPX'
173 endif
174endif
175if not get_option('hvf').disabled()
176 hvf = dependency('appleframeworks', modules: 'Hypervisor',
177 required: get_option('hvf'))
178 if hvf.found()
179 accelerators += 'CONFIG_HVF'
180 endif
181endif
182if not get_option('hax').disabled()
183 if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
184 accelerators += 'CONFIG_HAX'
185 endif
186endif
187if not get_option('tcg').disabled()
188 if cpu not in supported_cpus
189 if 'CONFIG_TCG_INTERPRETER' in config_host
190 warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
191 else
192 error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
193 endif
194 endif
195 accelerators += 'CONFIG_TCG'
196 config_host += { 'CONFIG_TCG': 'y' }
197endif
198
199if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
200 error('KVM not available on this platform')
201endif
202if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
203 error('HVF not available on this platform')
204endif
205if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
206 error('WHPX not available on this platform')
207endif
208if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
209 if 'CONFIG_XEN' in accelerators
210 error('Xen PCI passthrough not available on this platform')
211 else
212 error('Xen PCI passthrough requested but Xen not enabled')
213 endif
214endif
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400215if not cocoa.found() and get_option('cocoa').enabled()
216 error('Cocoa not available on this platform')
217endif
218
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200219################
220# Dependencies #
221################
222
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400223# The path to glib.h is added to all compilation commands. This was
224# grandfathered in from the QEMU Makefiles.
225add_project_arguments(config_host['GLIB_CFLAGS'].split(),
226 native: false, language: ['c', 'cpp', 'objc'])
227glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400228gio = not_found
229if 'CONFIG_GIO' in config_host
230 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
231 link_args: config_host['GIO_LIBS'].split())
232endif
233lttng = not_found
234if 'CONFIG_TRACE_UST' in config_host
235 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
236endif
237urcubp = not_found
238if 'CONFIG_TRACE_UST' in config_host
239 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
240endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100241gcrypt = not_found
242if 'CONFIG_GCRYPT' in config_host
243 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
244 link_args: config_host['GCRYPT_LIBS'].split())
245endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400246nettle = not_found
247if 'CONFIG_NETTLE' in config_host
248 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
249 link_args: config_host['NETTLE_LIBS'].split())
250endif
251gnutls = not_found
252if 'CONFIG_GNUTLS' in config_host
253 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
254 link_args: config_host['GNUTLS_LIBS'].split())
255endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200256pixman = not_found
257if have_system or have_tools
258 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400259 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200260endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400261pam = not_found
262if 'CONFIG_AUTH_PAM' in config_host
263 pam = cc.find_library('pam')
264endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400265libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200266zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400267linux_io_uring = not_found
268if 'CONFIG_LINUX_IO_URING' in config_host
269 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
270 link_args: config_host['LINUX_IO_URING_LIBS'].split())
271endif
272libxml2 = not_found
273if 'CONFIG_LIBXML2' in config_host
274 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
275 link_args: config_host['LIBXML2_LIBS'].split())
276endif
277libnfs = not_found
278if 'CONFIG_LIBNFS' in config_host
279 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
280endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400281libattr = not_found
282if 'CONFIG_ATTR' in config_host
283 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
284endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100285seccomp = not_found
286if 'CONFIG_SECCOMP' in config_host
287 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
288 link_args: config_host['SECCOMP_LIBS'].split())
289endif
290libcap_ng = not_found
291if 'CONFIG_LIBCAP_NG' in config_host
292 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
293endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400294if get_option('xkbcommon').auto() and not have_system and not have_tools
295 xkbcommon = not_found
296else
297 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400298 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400299endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400300slirp = not_found
301if config_host.has_key('CONFIG_SLIRP')
302 slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
303 link_args: config_host['SLIRP_LIBS'].split())
304endif
305vde = not_found
306if config_host.has_key('CONFIG_VDE')
307 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
308endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200309pulse = not_found
310if 'CONFIG_LIBPULSE' in config_host
311 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
312 link_args: config_host['PULSE_LIBS'].split())
313endif
314alsa = not_found
315if 'CONFIG_ALSA' in config_host
316 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
317 link_args: config_host['ALSA_LIBS'].split())
318endif
319jack = not_found
320if 'CONFIG_LIBJACK' in config_host
321 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
322endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200323spice = not_found
324if 'CONFIG_SPICE' in config_host
325 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
326 link_args: config_host['SPICE_LIBS'].split())
327endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400328rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400329libdl = not_found
330if 'CONFIG_PLUGIN' in config_host
331 libdl = cc.find_library('dl', required: true)
332endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200333libiscsi = not_found
334if 'CONFIG_LIBISCSI' in config_host
335 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
336 link_args: config_host['LIBISCSI_LIBS'].split())
337endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400338zstd = not_found
339if 'CONFIG_ZSTD' in config_host
340 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
341 link_args: config_host['ZSTD_LIBS'].split())
342endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400343gbm = not_found
344if 'CONFIG_GBM' in config_host
345 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
346 link_args: config_host['GBM_LIBS'].split())
347endif
348virgl = not_found
349if 'CONFIG_VIRGL' in config_host
350 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
351 link_args: config_host['VIRGL_LIBS'].split())
352endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400353curl = not_found
354if 'CONFIG_CURL' in config_host
355 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
356 link_args: config_host['CURL_LIBS'].split())
357endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200358libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200359if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200360 libudev = dependency('libudev',
361 required: get_option('mpath').enabled(),
362 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200363endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200364
365mpathpersist = not_found
366mpathpersist_new_api = false
367if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
368 mpath_test_source_new = '''
369 #include <libudev.h>
370 #include <mpath_persist.h>
371 unsigned mpath_mx_alloc_len = 1024;
372 int logsink;
373 static struct config *multipath_conf;
374 extern struct udev *udev;
375 extern struct config *get_multipath_config(void);
376 extern void put_multipath_config(struct config *conf);
377 struct udev *udev;
378 struct config *get_multipath_config(void) { return multipath_conf; }
379 void put_multipath_config(struct config *conf) { }
380 int main(void) {
381 udev = udev_new();
382 multipath_conf = mpath_lib_init();
383 return 0;
384 }'''
385 mpath_test_source_old = '''
386 #include <libudev.h>
387 #include <mpath_persist.h>
388 unsigned mpath_mx_alloc_len = 1024;
389 int logsink;
390 int main(void) {
391 struct udev *udev = udev_new();
392 mpath_lib_init(udev);
393 return 0;
394 }'''
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200395 mpathlibs = [libudev]
396 if enable_static
397 mpathlibs += cc.find_library('devmapper',
398 required: get_option('mpath'),
399 static: enable_static)
400 endif
401 mpathlibs += cc.find_library('multipath',
402 required: get_option('mpath'),
403 static: enable_static)
404 mpathlibs += cc.find_library('mpathpersist',
405 required: get_option('mpath'),
406 static: enable_static)
407 foreach lib: mpathlibs
408 if not lib.found()
409 mpathlibs = []
410 break
411 endif
412 endforeach
413 if mpathlibs.length() > 0
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200414 if cc.links(mpath_test_source_new, dependencies: mpathlibs)
415 mpathpersist = declare_dependency(dependencies: mpathlibs)
416 mpathpersist_new_api = true
417 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
418 mpathpersist = declare_dependency(dependencies: mpathlibs)
419 else
420 if get_option('mpath').enabled()
421 error('Cannot detect libmpathpersist API')
422 else
423 warning('Cannot detect libmpathpersist API, disabling')
424 endif
425 endif
426 endif
427endif
428
Paolo Bonzini26347332019-07-29 15:40:07 +0200429brlapi = not_found
430if 'CONFIG_BRLAPI' in config_host
431 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
432endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100433
Paolo Bonzini760e4322020-08-26 08:09:48 +0200434sdl = not_found
435if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800436 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200437 sdl_image = not_found
438endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100439if sdl.found()
440 # work around 2.0.8 bug
441 sdl = declare_dependency(compile_args: '-Wno-undef',
442 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200443 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400444 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100445else
446 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100447 error('sdl-image required, but SDL was @0@'.format(
448 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100449 endif
450 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200451endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100452
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400453rbd = not_found
454if 'CONFIG_RBD' in config_host
455 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
456endif
457glusterfs = not_found
458if 'CONFIG_GLUSTERFS' in config_host
459 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
460 link_args: config_host['GLUSTERFS_LIBS'].split())
461endif
462libssh = not_found
463if 'CONFIG_LIBSSH' in config_host
464 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
465 link_args: config_host['LIBSSH_LIBS'].split())
466endif
467libbzip2 = not_found
468if 'CONFIG_BZIP2' in config_host
469 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
470endif
471liblzfse = not_found
472if 'CONFIG_LZFSE' in config_host
473 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
474endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200475oss = not_found
476if 'CONFIG_AUDIO_OSS' in config_host
477 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
478endif
479dsound = not_found
480if 'CONFIG_AUDIO_DSOUND' in config_host
481 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
482endif
483coreaudio = not_found
484if 'CONFIG_AUDIO_COREAUDIO' in config_host
485 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
486endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400487opengl = not_found
488if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400489 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
490 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400491endif
492gtk = not_found
493if 'CONFIG_GTK' in config_host
494 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
495 link_args: config_host['GTK_LIBS'].split())
496endif
497vte = not_found
498if 'CONFIG_VTE' in config_host
499 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
500 link_args: config_host['VTE_LIBS'].split())
501endif
502x11 = not_found
503if 'CONFIG_X11' in config_host
504 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
505 link_args: config_host['X11_LIBS'].split())
506endif
507curses = not_found
508if 'CONFIG_CURSES' in config_host
509 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
510 link_args: config_host['CURSES_LIBS'].split())
511endif
512iconv = not_found
513if 'CONFIG_ICONV' in config_host
514 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
515 link_args: config_host['ICONV_LIBS'].split())
516endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100517vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400518png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400519jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400520sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100521if get_option('vnc').enabled()
522 vnc = declare_dependency() # dummy dependency
523 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400524 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100525 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
526 required: get_option('vnc_jpeg'),
527 static: enable_static)
528 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
529 required: get_option('vnc_sasl'),
530 static: enable_static)
531 if sasl.found()
532 sasl = declare_dependency(dependencies: sasl,
533 compile_args: '-DSTRUCT_IOVEC_DEFINED')
534 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400535endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200536fdt = not_found
537if 'CONFIG_FDT' in config_host
538 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
539 link_args: config_host['FDT_LIBS'].split())
540endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400541snappy = not_found
542if 'CONFIG_SNAPPY' in config_host
543 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
544endif
545lzo = not_found
546if 'CONFIG_LZO' in config_host
547 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
548endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400549rdma = not_found
550if 'CONFIG_RDMA' in config_host
551 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
552endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400553numa = not_found
554if 'CONFIG_NUMA' in config_host
555 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
556endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400557xen = not_found
558if 'CONFIG_XEN_BACKEND' in config_host
559 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
560 link_args: config_host['XEN_LIBS'].split())
561endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200562cacard = not_found
563if 'CONFIG_SMARTCARD' in config_host
564 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
565 link_args: config_host['SMARTCARD_LIBS'].split())
566endif
César Belley0a40bcb2020-08-26 13:42:04 +0200567u2f = not_found
568if have_system
569 u2f = dependency('u2f-emu', required: get_option('u2f'),
570 method: 'pkg-config',
571 static: enable_static)
572endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200573usbredir = not_found
574if 'CONFIG_USB_REDIR' in config_host
575 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
576 link_args: config_host['USB_REDIR_LIBS'].split())
577endif
578libusb = not_found
579if 'CONFIG_USB_LIBUSB' in config_host
580 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
581 link_args: config_host['LIBUSB_LIBS'].split())
582endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400583capstone = not_found
584if 'CONFIG_CAPSTONE' in config_host
585 capstone = declare_dependency(compile_args: config_host['CAPSTONE_CFLAGS'].split(),
586 link_args: config_host['CAPSTONE_LIBS'].split())
587endif
588libpmem = not_found
589if 'CONFIG_LIBPMEM' in config_host
590 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
591 link_args: config_host['LIBPMEM_LIBS'].split())
592endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600593libdaxctl = not_found
594if 'CONFIG_LIBDAXCTL' in config_host
595 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
596endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400597tasn1 = not_found
598if 'CONFIG_TASN1' in config_host
599 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
600 link_args: config_host['TASN1_LIBS'].split())
601endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400602keyutils = dependency('libkeyutils', required: false,
603 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400604
Marc-André Lureau3909def2020-08-28 15:07:33 +0400605has_gettid = cc.has_function('gettid')
606
Paolo Bonziniaa087962020-09-01 11:15:30 -0400607# Malloc tests
608
609malloc = []
610if get_option('malloc') == 'system'
611 has_malloc_trim = \
612 not get_option('malloc_trim').disabled() and \
613 cc.links('''#include <malloc.h>
614 int main(void) { malloc_trim(0); return 0; }''')
615else
616 has_malloc_trim = false
617 malloc = cc.find_library(get_option('malloc'), required: true)
618endif
619if not has_malloc_trim and get_option('malloc_trim').enabled()
620 if get_option('malloc') == 'system'
621 error('malloc_trim not available on this platform.')
622 else
623 error('malloc_trim not available with non-libc memory allocator')
624 endif
625endif
626
Paolo Bonzini859aef02020-08-04 18:14:26 +0200627# Create config-host.h
628
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400629config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200630config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200631config_host_data.set('CONFIG_MPATH', mpathpersist.found())
632config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100633config_host_data.set('CONFIG_SDL', sdl.found())
634config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100635config_host_data.set('CONFIG_VNC', vnc.found())
636config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
637config_host_data.set('CONFIG_VNC_PNG', png.found())
638config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200639config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400640config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400641config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400642config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200643config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
644config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
645config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
646config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
647
Paolo Bonzini765686d2020-09-18 06:37:21 -0400648ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
Paolo Bonzini859aef02020-08-04 18:14:26 +0200649arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200650strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200651 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200652 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200653foreach k, v: config_host
Paolo Bonzini765686d2020-09-18 06:37:21 -0400654 if ignored.contains(k)
655 # do nothing
656 elif arrays.contains(k)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200657 if v != ''
658 v = '"' + '", "'.join(v.split()) + '", '
659 endif
660 config_host_data.set(k, v)
661 elif k == 'ARCH'
662 config_host_data.set('HOST_' + v.to_upper(), 1)
663 elif strings.contains(k)
664 if not k.startswith('CONFIG_')
665 k = 'CONFIG_' + k.to_upper()
666 endif
667 config_host_data.set_quoted(k, v)
668 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
669 config_host_data.set(k, v == 'y' ? 1 : v)
670 endif
671endforeach
672genh += configure_file(output: 'config-host.h', configuration: config_host_data)
673
Paolo Bonzini2becc362020-02-03 11:42:03 +0100674minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400675config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400676config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400677config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100678config_devices_mak_list = []
679config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200680config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100681config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400682
683disassemblers = {
684 'alpha' : ['CONFIG_ALPHA_DIS'],
685 'arm' : ['CONFIG_ARM_DIS'],
686 'avr' : ['CONFIG_AVR_DIS'],
687 'cris' : ['CONFIG_CRIS_DIS'],
688 'hppa' : ['CONFIG_HPPA_DIS'],
689 'i386' : ['CONFIG_I386_DIS'],
690 'x86_64' : ['CONFIG_I386_DIS'],
691 'x32' : ['CONFIG_I386_DIS'],
692 'lm32' : ['CONFIG_LM32_DIS'],
693 'm68k' : ['CONFIG_M68K_DIS'],
694 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
695 'mips' : ['CONFIG_MIPS_DIS'],
696 'moxie' : ['CONFIG_MOXIE_DIS'],
697 'nios2' : ['CONFIG_NIOS2_DIS'],
698 'or1k' : ['CONFIG_OPENRISC_DIS'],
699 'ppc' : ['CONFIG_PPC_DIS'],
700 'riscv' : ['CONFIG_RISCV_DIS'],
701 'rx' : ['CONFIG_RX_DIS'],
702 's390' : ['CONFIG_S390_DIS'],
703 'sh4' : ['CONFIG_SH4_DIS'],
704 'sparc' : ['CONFIG_SPARC_DIS'],
705 'xtensa' : ['CONFIG_XTENSA_DIS'],
706}
707if link_language == 'cpp'
708 disassemblers += {
709 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
710 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
711 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
712 }
713endif
714
Paolo Bonzini2becc362020-02-03 11:42:03 +0100715kconfig_external_symbols = [
716 'CONFIG_KVM',
717 'CONFIG_XEN',
718 'CONFIG_TPM',
719 'CONFIG_SPICE',
720 'CONFIG_IVSHMEM',
721 'CONFIG_OPENGL',
722 'CONFIG_X11',
723 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200724 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100725 'CONFIG_VHOST_KERNEL',
726 'CONFIG_VIRTFS',
727 'CONFIG_LINUX',
728 'CONFIG_PVRDMA',
729]
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400730ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400731
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400732default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
733actual_target_dirs = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400734foreach target : target_dirs
Paolo Bonzini765686d2020-09-18 06:37:21 -0400735 config_target = { 'TARGET_NAME': target.split('-')[0] }
736 if target.endswith('linux-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400737 if targetos != 'linux'
738 if default_targets
739 continue
740 endif
741 error('Target @0@ is only available on a Linux host'.format(target))
742 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400743 config_target += { 'CONFIG_LINUX_USER': 'y' }
744 elif target.endswith('bsd-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400745 if 'CONFIG_BSD' not in config_host
746 if default_targets
747 continue
748 endif
749 error('Target @0@ is only available on a BSD host'.format(target))
750 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400751 config_target += { 'CONFIG_BSD_USER': 'y' }
752 elif target.endswith('softmmu')
753 config_target += { 'CONFIG_SOFTMMU': 'y' }
754 endif
755 if target.endswith('-user')
756 config_target += {
757 'CONFIG_USER_ONLY': 'y',
758 'CONFIG_QEMU_INTERP_PREFIX':
759 config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
760 }
761 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200762
Paolo Bonzini8a199802020-09-18 05:37:01 -0400763 have_accel = false
764 foreach sym: accelerators
765 if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
766 config_target += { sym: 'y' }
767 config_all += { sym: 'y' }
768 if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
769 config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
770 endif
771 have_accel = true
772 endif
773 endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400774 if not have_accel
775 if default_targets
776 continue
777 endif
778 error('No accelerator available for target @0@'.format(target))
779 endif
Paolo Bonzini8a199802020-09-18 05:37:01 -0400780
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400781 actual_target_dirs += target
Paolo Bonzini765686d2020-09-18 06:37:21 -0400782 config_target += keyval.load('default-configs/targets' / target + '.mak')
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400783 config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
Paolo Bonzini765686d2020-09-18 06:37:21 -0400784
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
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400867# Generators
868
Marc-André Lureau3f885652019-07-15 18:06:04 +0400869hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +0400870shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400871qapi_gen = find_program('scripts/qapi-gen.py')
872qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
873 meson.source_root() / 'scripts/qapi/commands.py',
874 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400875 meson.source_root() / 'scripts/qapi/error.py',
876 meson.source_root() / 'scripts/qapi/events.py',
877 meson.source_root() / 'scripts/qapi/expr.py',
878 meson.source_root() / 'scripts/qapi/gen.py',
879 meson.source_root() / 'scripts/qapi/introspect.py',
880 meson.source_root() / 'scripts/qapi/parser.py',
881 meson.source_root() / 'scripts/qapi/schema.py',
882 meson.source_root() / 'scripts/qapi/source.py',
883 meson.source_root() / 'scripts/qapi/types.py',
884 meson.source_root() / 'scripts/qapi/visit.py',
885 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400886 meson.source_root() / 'scripts/qapi-gen.py'
887]
888
889tracetool = [
890 python, files('scripts/tracetool.py'),
891 '--backend=' + config_host['TRACE_BACKENDS']
892]
893
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400894qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
895 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +0200896 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400897qemu_version = custom_target('qemu-version.h',
898 output: 'qemu-version.h',
899 command: qemu_version_cmd,
900 capture: true,
901 build_by_default: true,
902 build_always_stale: true)
903genh += qemu_version
904
Marc-André Lureau3f885652019-07-15 18:06:04 +0400905hxdep = []
906hx_headers = [
907 ['qemu-options.hx', 'qemu-options.def'],
908 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
909]
910if have_system
911 hx_headers += [
912 ['hmp-commands.hx', 'hmp-commands.h'],
913 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
914 ]
915endif
916foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400917 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +0400918 input: files(d[0]),
919 output: d[1],
920 capture: true,
921 build_by_default: true, # to be removed when added to a target
922 command: [hxtool, '-h', '@INPUT0@'])
923endforeach
924genh += hxdep
925
Peter Maydelleb937362020-09-25 17:23:08 +0100926SPHINX_ARGS = [config_host['SPHINX_BUILD'],
927 '-Dversion=' + meson.project_version(),
928 '-Drelease=' + config_host['PKGVERSION']]
929
930if get_option('werror')
931 SPHINX_ARGS += [ '-W' ]
932endif
933
Peter Maydellb3f48302020-09-25 17:23:09 +0100934sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
935 meson.source_root() / 'docs/sphinx/hxtool.py',
936 meson.source_root() / 'docs/sphinx/kerneldoc.py',
937 meson.source_root() / 'docs/sphinx/kernellog.py',
938 meson.source_root() / 'docs/sphinx/qapidoc.py',
939 meson.source_root() / 'docs/sphinx/qmp_lexer.py',
940 qapi_gen_depends ]
941
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400942# Collect sourcesets.
943
944util_ss = ss.source_set()
945stub_ss = ss.source_set()
946trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400947block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +0200948blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200949qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100950common_ss = ss.source_set()
951softmmu_ss = ss.source_set()
952user_ss = ss.source_set()
953bsd_user_ss = ss.source_set()
954linux_user_ss = ss.source_set()
955specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200956specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100957
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400958modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100959hw_arch = {}
960target_arch = {}
961target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400962
963###############
964# Trace files #
965###############
966
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400967# TODO: add each directory to the subdirs from its own meson.build, once
968# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400969trace_events_subdirs = [
970 'accel/kvm',
971 'accel/tcg',
972 'crypto',
973 'monitor',
974]
975if have_user
976 trace_events_subdirs += [ 'linux-user' ]
977endif
978if have_block
979 trace_events_subdirs += [
980 'authz',
981 'block',
982 'io',
983 'nbd',
984 'scsi',
985 ]
986endif
987if have_system
988 trace_events_subdirs += [
989 'audio',
990 'backends',
991 'backends/tpm',
992 'chardev',
993 'hw/9pfs',
994 'hw/acpi',
995 'hw/alpha',
996 'hw/arm',
997 'hw/audio',
998 'hw/block',
999 'hw/block/dataplane',
1000 'hw/char',
1001 'hw/display',
1002 'hw/dma',
1003 'hw/hppa',
1004 'hw/hyperv',
1005 'hw/i2c',
1006 'hw/i386',
1007 'hw/i386/xen',
1008 'hw/ide',
1009 'hw/input',
1010 'hw/intc',
1011 'hw/isa',
1012 'hw/mem',
1013 'hw/mips',
1014 'hw/misc',
1015 'hw/misc/macio',
1016 'hw/net',
1017 'hw/nvram',
1018 'hw/pci',
1019 'hw/pci-host',
1020 'hw/ppc',
1021 'hw/rdma',
1022 'hw/rdma/vmw',
1023 'hw/rtc',
1024 'hw/s390x',
1025 'hw/scsi',
1026 'hw/sd',
1027 'hw/sparc',
1028 'hw/sparc64',
1029 'hw/ssi',
1030 'hw/timer',
1031 'hw/tpm',
1032 'hw/usb',
1033 'hw/vfio',
1034 'hw/virtio',
1035 'hw/watchdog',
1036 'hw/xen',
1037 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001038 'migration',
1039 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001040 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001041 'ui',
1042 ]
1043endif
1044trace_events_subdirs += [
1045 'hw/core',
1046 'qapi',
1047 'qom',
1048 'target/arm',
1049 'target/hppa',
1050 'target/i386',
1051 'target/mips',
1052 'target/ppc',
1053 'target/riscv',
1054 'target/s390x',
1055 'target/sparc',
1056 'util',
1057]
1058
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001059subdir('qapi')
1060subdir('qobject')
1061subdir('stubs')
1062subdir('trace')
1063subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001064subdir('qom')
1065subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001066subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001067subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001068
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001069
1070if enable_modules
1071 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1072 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1073endif
1074
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001075# Build targets from sourcesets
1076
Paolo Bonzini2becc362020-02-03 11:42:03 +01001077stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001078
1079util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001080util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001081libqemuutil = static_library('qemuutil',
1082 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001083 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001084qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001085 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001086
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001087decodetree = generator(find_program('scripts/decodetree.py'),
1088 output: 'decode-@BASENAME@.c.inc',
1089 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1090
Paolo Bonzini478e9432020-08-17 12:47:55 +02001091subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001092subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001093subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001094subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001095subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001096subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001097subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001098
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001099block_ss.add(files(
1100 'block.c',
Kevin Wolf56ee8622020-09-24 17:26:50 +02001101 'blockdev-nbd.c',
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001102 'blockjob.c',
1103 'job.c',
1104 'qemu-io-cmds.c',
1105))
1106block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1107
1108subdir('nbd')
1109subdir('scsi')
1110subdir('block')
1111
Paolo Bonzini4a963372020-08-03 16:22:28 +02001112blockdev_ss.add(files(
1113 'blockdev.c',
Paolo Bonzini4a963372020-08-03 16:22:28 +02001114 'iothread.c',
1115 'job-qmp.c',
1116))
1117
1118# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1119# os-win32.c does not
1120blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1121softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
1122
1123softmmu_ss.add_all(blockdev_ss)
1124softmmu_ss.add(files(
1125 'bootdevice.c',
1126 'dma-helpers.c',
1127 'qdev-monitor.c',
1128), sdl)
1129
1130softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
1131softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
1132softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
1133
1134common_ss.add(files('cpus-common.c'))
1135
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001136subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001137
Bruce Rogersc7c91a72020-08-24 09:52:12 -06001138specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001139specific_ss.add(files('exec-vary.c'))
1140specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1141 'fpu/softfloat.c',
1142 'tcg/optimize.c',
1143 'tcg/tcg-common.c',
1144 'tcg/tcg-op-gvec.c',
1145 'tcg/tcg-op-vec.c',
1146 'tcg/tcg-op.c',
1147 'tcg/tcg.c',
1148))
1149specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1150
Marc-André Lureauab318052019-07-24 19:23:16 +04001151subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001152subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001153subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001154subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001155subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001156subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001157subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001158subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001159subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001160subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001161subdir('linux-user')
1162
Marc-André Lureaub309c322019-08-18 19:20:37 +04001163bsd_user_ss.add(files('gdbstub.c'))
1164specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1165
Marc-André Lureau3a304462019-08-18 16:13:08 +04001166linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1167specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001168
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001169# needed for fuzzing binaries
1170subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001171subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001172
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001173block_mods = []
1174softmmu_mods = []
1175foreach d, list : modules
1176 foreach m, module_ss : list
1177 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001178 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001179 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1180 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1181 if d == 'block'
1182 block_mods += sl
1183 else
1184 softmmu_mods += sl
1185 endif
1186 else
1187 if d == 'block'
1188 block_ss.add_all(module_ss)
1189 else
1190 softmmu_ss.add_all(module_ss)
1191 endif
1192 endif
1193 endforeach
1194endforeach
1195
1196nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001197undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001198block_syms = custom_target('block.syms', output: 'block.syms',
1199 input: [libqemuutil, block_mods],
1200 capture: true,
1201 command: [undefsym, nm, '@INPUT@'])
1202qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1203 input: [libqemuutil, softmmu_mods],
1204 capture: true,
1205 command: [undefsym, nm, '@INPUT@'])
1206
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001207block_ss = block_ss.apply(config_host, strict: false)
1208libblock = static_library('block', block_ss.sources() + genh,
1209 dependencies: block_ss.dependencies(),
1210 link_depends: block_syms,
1211 name_suffix: 'fa',
1212 build_by_default: false)
1213
1214block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001215 link_args: '@block.syms',
1216 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001217
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001218qmp_ss = qmp_ss.apply(config_host, strict: false)
1219libqmp = static_library('qmp', qmp_ss.sources() + genh,
1220 dependencies: qmp_ss.dependencies(),
1221 name_suffix: 'fa',
1222 build_by_default: false)
1223
1224qmp = declare_dependency(link_whole: [libqmp])
1225
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001226foreach m : block_mods + softmmu_mods
1227 shared_module(m.name(),
1228 name_prefix: '',
1229 link_whole: m,
1230 install: true,
1231 install_dir: config_host['qemu_moddir'])
1232endforeach
1233
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001234softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1235common_ss.add(qom, qemuutil)
1236
1237common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001238common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1239
1240common_all = common_ss.apply(config_all, strict: false)
1241common_all = static_library('common',
1242 build_by_default: false,
1243 sources: common_all.sources() + genh,
1244 dependencies: common_all.dependencies(),
1245 name_suffix: 'fa')
1246
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001247feature_to_c = find_program('scripts/feature_to_c.sh')
1248
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001249emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001250foreach target : target_dirs
1251 config_target = config_target_mak[target]
1252 target_name = config_target['TARGET_NAME']
1253 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001254 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001255 arch_deps = []
1256 c_args = ['-DNEED_CPU_H',
1257 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1258 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -04001259 link_args = emulator_link_args
Paolo Bonzini2becc362020-02-03 11:42:03 +01001260
Paolo Bonzini859aef02020-08-04 18:14:26 +02001261 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001262 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1263 if targetos == 'linux'
1264 target_inc += include_directories('linux-headers', is_system: true)
1265 endif
1266 if target.endswith('-softmmu')
1267 qemu_target_name = 'qemu-system-' + target_name
1268 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001269 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1270 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001271 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001272
Marc-André Lureau2c442202019-08-17 13:55:58 +04001273 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1274 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1275 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001276 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001277
Paolo Bonzini2becc362020-02-03 11:42:03 +01001278 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001279 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001280 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001281 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001282 target_type='user'
1283 qemu_target_name = 'qemu-' + target_name
1284 if 'CONFIG_LINUX_USER' in config_target
1285 base_dir = 'linux-user'
1286 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1287 else
1288 base_dir = 'bsd-user'
1289 endif
1290 target_inc += include_directories(
1291 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001292 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001293 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001294 if 'CONFIG_LINUX_USER' in config_target
1295 dir = base_dir / abi
1296 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1297 if config_target.has_key('TARGET_SYSTBL_ABI')
1298 arch_srcs += \
1299 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1300 extra_args : config_target['TARGET_SYSTBL_ABI'])
1301 endif
1302 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001303 endif
1304
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001305 if 'TARGET_XML_FILES' in config_target
1306 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1307 output: target + '-gdbstub-xml.c',
1308 input: files(config_target['TARGET_XML_FILES'].split()),
1309 command: [feature_to_c, '@INPUT@'],
1310 capture: true)
1311 arch_srcs += gdbstub_xml
1312 endif
1313
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001314 t = target_arch[arch].apply(config_target, strict: false)
1315 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001316 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001317
Paolo Bonzini2becc362020-02-03 11:42:03 +01001318 target_common = common_ss.apply(config_target, strict: false)
1319 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001320 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001321
Paolo Bonzini2becc362020-02-03 11:42:03 +01001322 target_specific = specific_ss.apply(config_target, strict: false)
1323 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001324 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001325
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001326 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001327 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001328 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001329 objects: objects,
1330 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001331 c_args: c_args,
1332 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001333 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001334
1335 if target.endswith('-softmmu')
1336 execs = [{
1337 'name': 'qemu-system-' + target_name,
1338 'gui': false,
1339 'sources': files('softmmu/main.c'),
1340 'dependencies': []
1341 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001342 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001343 execs += [{
1344 'name': 'qemu-system-' + target_name + 'w',
1345 'gui': true,
1346 'sources': files('softmmu/main.c'),
1347 'dependencies': []
1348 }]
1349 endif
1350 if config_host.has_key('CONFIG_FUZZ')
1351 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1352 execs += [{
1353 'name': 'qemu-fuzz-' + target_name,
1354 'gui': false,
1355 'sources': specific_fuzz.sources(),
1356 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001357 }]
1358 endif
1359 else
1360 execs = [{
1361 'name': 'qemu-' + target_name,
1362 'gui': false,
1363 'sources': [],
1364 'dependencies': []
1365 }]
1366 endif
1367 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001368 emulators += {exe['name']:
1369 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001370 install: true,
1371 c_args: c_args,
1372 dependencies: arch_deps + deps + exe['dependencies'],
1373 objects: lib.extract_all_objects(recursive: true),
1374 link_language: link_language,
1375 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1376 link_args: link_args,
1377 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001378 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001379
1380 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1381 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001382 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1383 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001384 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1385 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1386 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001387 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001388 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001389 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001390 capture: true,
1391 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001392 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001393 command: [
1394 tracetool, '--group=all', '--format=' + stp['fmt'],
1395 '--binary=' + stp['bin'],
1396 '--target-name=' + target_name,
1397 '--target-type=' + target_type,
1398 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1399 '@INPUT@',
1400 ])
1401 endforeach
1402 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001403 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001404endforeach
1405
Paolo Bonzini931049b2020-02-05 09:44:24 +01001406# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001407
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001408if 'CONFIG_PLUGIN' in config_host
1409 install_headers('include/qemu/qemu-plugin.h')
1410endif
1411
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001412if 'CONFIG_GUEST_AGENT' in config_host
1413 subdir('qga')
1414endif
1415
Laurent Vivier9755c942020-08-24 17:24:30 +02001416# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1417# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001418if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001419 # used for the update-keymaps target, so include rules even if !have_tools
1420 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1421 dependencies: [qemuutil, xkbcommon], install: have_tools)
1422endif
1423
Paolo Bonzini931049b2020-02-05 09:44:24 +01001424if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001425 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1426 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1427 qemu_io = executable('qemu-io', files('qemu-io.c'),
1428 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001429 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001430 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001431
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001432 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001433 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001434 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001435
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001436 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1437 dependencies: qemuutil,
1438 install: true)
1439
Paolo Bonzini931049b2020-02-05 09:44:24 +01001440 if 'CONFIG_VHOST_USER' in config_host
1441 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001442 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001443 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001444 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001445 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001446 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001447
1448 if targetos == 'linux'
1449 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1450 dependencies: [qemuutil, libcap_ng],
1451 install: true,
1452 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001453
1454 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1455 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001456 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001457 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001458 endif
1459
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001460 if 'CONFIG_IVSHMEM' in config_host
1461 subdir('contrib/ivshmem-client')
1462 subdir('contrib/ivshmem-server')
1463 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001464endif
1465
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001466subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001467subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001468subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001469subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001470subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001471if 'CONFIG_GTK' in config_host
1472 subdir('po')
1473endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001474
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001475if host_machine.system() == 'windows'
1476 nsis_cmd = [
1477 find_program('scripts/nsis.py'),
1478 '@OUTPUT@',
1479 get_option('prefix'),
1480 meson.current_source_dir(),
1481 host_machine.cpu_family(),
1482 '--',
1483 '-DDISPLAYVERSION=' + meson.project_version(),
1484 ]
1485 if build_docs
1486 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1487 endif
1488 if 'CONFIG_GTK' in config_host
1489 nsis_cmd += '-DCONFIG_GTK=y'
1490 endif
1491
1492 nsis = custom_target('nsis',
1493 output: 'qemu-setup-' + meson.project_version() + '.exe',
1494 input: files('qemu.nsi'),
1495 build_always_stale: true,
1496 command: nsis_cmd + ['@INPUT@'])
1497 alias_target('installer', nsis)
1498endif
1499
Paolo Bonzinif9332752020-02-03 13:28:38 +01001500summary_info = {}
1501summary_info += {'Install prefix': config_host['prefix']}
1502summary_info += {'BIOS directory': config_host['qemu_datadir']}
1503summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1504summary_info += {'binary directory': config_host['bindir']}
1505summary_info += {'library directory': config_host['libdir']}
1506summary_info += {'module directory': config_host['qemu_moddir']}
1507summary_info += {'libexec directory': config_host['libexecdir']}
1508summary_info += {'include directory': config_host['includedir']}
1509summary_info += {'config directory': config_host['sysconfdir']}
1510if targetos != 'windows'
1511 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001512 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001513else
1514 summary_info += {'local state directory': 'queried at runtime'}
1515endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001516summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001517summary_info += {'Build directory': meson.current_build_dir()}
1518summary_info += {'Source path': meson.current_source_dir()}
1519summary_info += {'GIT binary': config_host['GIT']}
1520summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1521summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1522summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1523if link_language == 'cpp'
1524 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1525else
1526 summary_info += {'C++ compiler': false}
1527endif
1528if targetos == 'darwin'
1529 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1530endif
1531summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1532summary_info += {'CFLAGS': config_host['CFLAGS']}
1533summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1534summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1535summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001536summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1537summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1538summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1539# TODO: add back version
1540summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1541if config_host.has_key('CONFIG_SLIRP')
1542 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1543endif
1544summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1545if config_host.has_key('CONFIG_MODULES')
1546 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1547endif
1548summary_info += {'host CPU': cpu}
1549summary_info += {'host endianness': build_machine.endian()}
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -04001550summary_info += {'target list': ' '.join(target_dirs)}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001551summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1552summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1553summary_info += {'strip binaries': get_option('strip')}
1554summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001555summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001556if targetos == 'darwin'
1557 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1558endif
1559# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001560summary_info += {'SDL support': sdl.found()}
1561summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001562# TODO: add back version
1563summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1564summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001565summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001566# TODO: add back version
1567summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1568summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1569summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1570# TODO: add back version
1571summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1572if config_host.has_key('CONFIG_GCRYPT')
1573 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1574 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1575endif
1576# TODO: add back version
1577summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1578if config_host.has_key('CONFIG_NETTLE')
1579 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1580endif
1581summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1582summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1583summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1584summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1585# TODO: add back version
1586summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1587summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1588summary_info += {'mingw32 support': targetos == 'windows'}
1589summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1590summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1591summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1592summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001593summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001594summary_info += {'VNC support': vnc.found()}
1595if vnc.found()
1596 summary_info += {'VNC SASL support': sasl.found()}
1597 summary_info += {'VNC JPEG support': jpeg.found()}
1598 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001599endif
1600summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1601if config_host.has_key('CONFIG_XEN_BACKEND')
1602 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1603endif
1604summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1605summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1606summary_info += {'PIE': get_option('b_pie')}
1607summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1608summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1609summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1610summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1611summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1612summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04001613summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
1614summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
1615summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
1616summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
1617summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
1618if config_all.has_key('CONFIG_TCG')
1619 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1620 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1621endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04001622summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001623summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1624summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1625summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1626summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1627summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1628summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1629summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1630summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1631summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1632summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1633summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1634summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1635summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1636summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1637summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1638summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1639summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1640summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1641if config_host['TRACE_BACKENDS'].split().contains('simple')
1642 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1643endif
1644# TODO: add back protocol and server version
1645summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1646summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1647summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1648summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001649summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001650summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1651summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1652summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1653summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1654summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1655summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1656summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1657if targetos == 'windows'
1658 if 'WIN_SDK' in config_host
1659 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1660 endif
1661 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1662 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01001663 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001664endif
1665summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1666summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1667summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1668summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1669summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1670summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1671summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001672summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001673summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1674summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1675summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1676summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1677summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1678summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1679summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1680summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1681summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1682summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1683summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04001684summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001685summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1686summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1687summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1688summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1689summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1690summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1691summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1692summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1693summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1694summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1695summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1696summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
1697summary_info += {'capstone': config_host.has_key('CONFIG_CAPSTONE')}
1698summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1699summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02001700summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001701summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1702summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1703summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1704if config_host.has_key('HAVE_GDB_BIN')
1705 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1706endif
1707summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1708summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1709summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1710summary(summary_info, bool_yn: true)
1711
1712if not supported_cpus.contains(cpu)
1713 message()
1714 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1715 message()
1716 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1717 message('The QEMU project intends to remove support for this host CPU in')
1718 message('a future release if nobody volunteers to maintain it and to')
1719 message('provide a build host for our continuous integration setup.')
1720 message('configure has succeeded and you can continue to build, but')
1721 message('if you care about QEMU on this platform you should contact')
1722 message('us upstream at qemu-devel@nongnu.org.')
1723endif
1724
1725if not supported_oses.contains(targetos)
1726 message()
1727 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1728 message()
1729 message('Host OS ' + targetos + 'support is not currently maintained.')
1730 message('The QEMU project intends to remove support for this host OS in')
1731 message('a future release if nobody volunteers to maintain it and to')
1732 message('provide a build host for our continuous integration setup.')
1733 message('configure has succeeded and you can continue to build, but')
1734 message('if you care about QEMU on this platform you should contact')
1735 message('us upstream at qemu-devel@nongnu.org.')
1736endif