blob: 0edde14ad76d9c3bf27a934260038234bb3d1309 [file] [log] [blame]
Paolo Bonzinia5665052019-06-10 12:05:14 +02001project('qemu', ['c'], meson_version: '>=0.55.0',
Gerd Hoffmann90756b22020-08-25 08:43:42 +02002 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
Paolo Bonzini3e0e5192020-09-01 12:48:00 -04003 'b_colorout=auto'],
Paolo Bonzinia5665052019-06-10 12:05:14 +02004 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
Paolo Bonzinib29b40f2020-08-10 18:04:43 +02007if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040012ss = import('sourceset')
Richard Henderson8b18cdb2020-09-13 12:19:25 -070013fs = import('fs')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040014
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010015sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040016cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020017config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040018enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010019enable_static = 'CONFIG_STATIC' in config_host
Yonggang Luoe3667662020-10-16 06:06:25 +080020
21# Temporary directory used for files created while
22# configure runs. Since it is in the build directory
23# we can safely blow away any previous version of it
24# (and we need not jump through hoops to try to delete
25# it when configure exits.)
26tmpdir = meson.current_build_dir() / 'meson-private/temp'
Marc-André Lureau8fe11232020-09-11 14:42:48 +020027
28if get_option('qemu_suffix').startswith('/')
29 error('qemu_suffix cannot start with a /')
30endif
31
Marc-André Lureauab4c0992020-08-26 15:04:16 +040032qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040033qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020034config_host_data = configuration_data()
35genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020036
Paolo Bonzini760e4322020-08-26 08:09:48 +020037target_dirs = config_host['TARGET_DIRS'].split()
38have_user = false
39have_system = false
40foreach target : target_dirs
41 have_user = have_user or target.endswith('-user')
42 have_system = have_system or target.endswith('-softmmu')
43endforeach
44have_tools = 'CONFIG_TOOLS' in config_host
45have_block = have_system or have_tools
46
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040047python = import('python').find_installation()
48
49supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
Sergei Trofimovich61256732020-10-12 18:57:19 +010050supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64',
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040051 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
52
53cpu = host_machine.cpu_family()
54targetos = host_machine.system()
55
Paolo Bonzini8a199802020-09-18 05:37:01 -040056if cpu in ['x86', 'x86_64']
57 kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
58elif cpu == 'aarch64'
59 kvm_targets = ['aarch64-softmmu']
60elif cpu == 's390x'
61 kvm_targets = ['s390x-softmmu']
62elif cpu in ['ppc', 'ppc64']
63 kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
Huacai Chenfbc58842020-10-07 16:39:28 +080064elif cpu in ['mips', 'mips64']
65 kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu']
Paolo Bonzini8a199802020-09-18 05:37:01 -040066else
67 kvm_targets = []
68endif
69
70accelerator_targets = { 'CONFIG_KVM': kvm_targets }
71if cpu in ['x86', 'x86_64']
72 accelerator_targets += {
73 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
74 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
75 'CONFIG_HVF': ['x86_64-softmmu'],
76 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
77 }
78endif
79
Paolo Bonzini201e8ed2020-09-01 07:45:54 -040080##################
81# Compiler flags #
82##################
83
Alexander Bulekovff9ed622020-09-09 18:05:16 -040084# Specify linker-script with add_project_link_arguments so that it is not placed
85# within a linker --start-group/--end-group pair
86if 'CONFIG_FUZZ' in config_host
87 add_project_link_arguments(['-Wl,-T,',
88 (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
89 native: false, language: ['c', 'cpp', 'objc'])
90endif
91
Paolo Bonzinia5665052019-06-10 12:05:14 +020092add_project_arguments(config_host['QEMU_CFLAGS'].split(),
93 native: false, language: ['c', 'objc'])
94add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
95 native: false, language: 'cpp')
96add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
97 native: false, language: ['c', 'cpp', 'objc'])
Paolo Bonzinia5665052019-06-10 12:05:14 +020098
Paolo Bonzini1e6e6162020-10-14 08:45:42 -040099if targetos == 'linux'
100 add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
101 '-isystem', 'linux-headers',
102 language: ['c', 'cpp'])
103endif
104
105if 'CONFIG_TCG_INTERPRETER' in config_host
106 tcg_arch = 'tci'
107elif config_host['ARCH'] == 'sparc64'
108 tcg_arch = 'sparc'
109elif config_host['ARCH'] == 's390x'
110 tcg_arch = 's390'
111elif config_host['ARCH'] in ['x86_64', 'x32']
112 tcg_arch = 'i386'
113elif config_host['ARCH'] == 'ppc64'
114 tcg_arch = 'ppc'
115elif config_host['ARCH'] in ['riscv32', 'riscv64']
116 tcg_arch = 'riscv'
117else
118 tcg_arch = config_host['ARCH']
119endif
120add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
121 '-iquote', '.',
122 '-iquote', meson.current_source_dir(),
123 '-iquote', meson.current_source_dir() / 'accel/tcg',
124 '-iquote', meson.current_source_dir() / 'include',
125 '-iquote', meson.current_source_dir() / 'disas/libvixl',
126 language: ['c', 'cpp', 'objc'])
Alexander Bulekovc46f76d2020-09-02 13:36:50 -0400127
Marc-André Lureaufc929892019-07-13 01:47:54 +0400128link_language = meson.get_external_property('link_language', 'cpp')
129if link_language == 'cpp'
130 add_languages('cpp', required: true, native: false)
131endif
Paolo Bonzinia5665052019-06-10 12:05:14 +0200132if host_machine.system() == 'darwin'
133 add_languages('objc', required: false, native: false)
134endif
135
Paolo Bonzinideb62372020-09-01 07:51:16 -0400136sparse = find_program('cgcc', required: get_option('sparse'))
137if sparse.found()
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100138 run_target('sparse',
139 command: [find_program('scripts/check_sparse.py'),
Paolo Bonzinideb62372020-09-01 07:51:16 -0400140 'compile_commands.json', sparse.full_path(), '-Wbitwise',
141 '-Wno-transparent-union', '-Wno-old-initializer',
142 '-Wno-non-pointer-null'])
Paolo Bonzini968b4db2020-02-03 14:45:33 +0100143endif
144
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200145###########################################
146# Target-specific checks and dependencies #
147###########################################
148
149if targetos != 'linux' and get_option('mpath').enabled()
150 error('Multipath is supported only on Linux')
151endif
152
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400153m = cc.find_library('m', required: false)
154util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +0200155winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400156socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400157version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400158coref = []
159iokit = []
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400160emulator_link_args = []
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400161cocoa = not_found
Paolo Bonzini8a199802020-09-18 05:37:01 -0400162hvf = not_found
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400163if targetos == 'windows'
164 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +0200165 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400166
167 win = import('windows')
168 version_res = win.compile_resources('version.rc',
169 depend_files: files('pc-bios/qemu-nsis.ico'),
170 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +0400171elif targetos == 'darwin'
172 coref = dependency('appleframeworks', modules: 'CoreFoundation')
173 iokit = dependency('appleframeworks', modules: 'IOKit')
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400174 cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
Paolo Bonzinicfad62f2020-08-09 23:47:45 +0200175elif targetos == 'sunos'
176 socket = [cc.find_library('socket'),
177 cc.find_library('nsl'),
178 cc.find_library('resolv')]
179elif targetos == 'haiku'
180 socket = [cc.find_library('posix_error_mapper'),
181 cc.find_library('network'),
182 cc.find_library('bsd')]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -0400183elif targetos == 'openbsd'
184 if not get_option('tcg').disabled() and target_dirs.length() > 0
185 # Disable OpenBSD W^X if available
186 emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
187 endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400188endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200189
Paolo Bonzini8a199802020-09-18 05:37:01 -0400190accelerators = []
191if not get_option('kvm').disabled() and targetos == 'linux'
192 accelerators += 'CONFIG_KVM'
193endif
194if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
195 accelerators += 'CONFIG_XEN'
196 have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
197else
198 have_xen_pci_passthrough = false
199endif
200if not get_option('whpx').disabled() and targetos == 'windows'
201 if get_option('whpx').enabled() and cpu != 'x86_64'
202 error('WHPX requires 64-bit host')
203 elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
204 cc.has_header('WinHvEmulation.h', required: get_option('whpx'))
205 accelerators += 'CONFIG_WHPX'
206 endif
207endif
208if not get_option('hvf').disabled()
209 hvf = dependency('appleframeworks', modules: 'Hypervisor',
210 required: get_option('hvf'))
211 if hvf.found()
212 accelerators += 'CONFIG_HVF'
213 endif
214endif
215if not get_option('hax').disabled()
216 if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
217 accelerators += 'CONFIG_HAX'
218 endif
219endif
220if not get_option('tcg').disabled()
221 if cpu not in supported_cpus
222 if 'CONFIG_TCG_INTERPRETER' in config_host
223 warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
224 else
225 error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
226 endif
227 endif
228 accelerators += 'CONFIG_TCG'
229 config_host += { 'CONFIG_TCG': 'y' }
230endif
231
232if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
233 error('KVM not available on this platform')
234endif
235if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
236 error('HVF not available on this platform')
237endif
238if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
239 error('WHPX not available on this platform')
240endif
241if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
242 if 'CONFIG_XEN' in accelerators
243 error('Xen PCI passthrough not available on this platform')
244 else
245 error('Xen PCI passthrough requested but Xen not enabled')
246 endif
247endif
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400248if not cocoa.found() and get_option('cocoa').enabled()
249 error('Cocoa not available on this platform')
250endif
251
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200252################
253# Dependencies #
254################
255
Paolo Bonzini215b0c22020-09-01 08:41:17 -0400256# The path to glib.h is added to all compilation commands. This was
257# grandfathered in from the QEMU Makefiles.
258add_project_arguments(config_host['GLIB_CFLAGS'].split(),
259 native: false, language: ['c', 'cpp', 'objc'])
260glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400261gio = not_found
262if 'CONFIG_GIO' in config_host
263 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
264 link_args: config_host['GIO_LIBS'].split())
265endif
266lttng = not_found
267if 'CONFIG_TRACE_UST' in config_host
268 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
269endif
270urcubp = not_found
271if 'CONFIG_TRACE_UST' in config_host
272 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
273endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100274gcrypt = not_found
275if 'CONFIG_GCRYPT' in config_host
276 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
277 link_args: config_host['GCRYPT_LIBS'].split())
278endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400279nettle = not_found
280if 'CONFIG_NETTLE' in config_host
281 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
282 link_args: config_host['NETTLE_LIBS'].split())
283endif
284gnutls = not_found
285if 'CONFIG_GNUTLS' in config_host
286 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
287 link_args: config_host['GNUTLS_LIBS'].split())
288endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200289pixman = not_found
290if have_system or have_tools
291 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400292 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200293endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400294pam = not_found
295if 'CONFIG_AUTH_PAM' in config_host
296 pam = cc.find_library('pam')
297endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400298libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200299zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400300linux_io_uring = not_found
301if 'CONFIG_LINUX_IO_URING' in config_host
302 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
303 link_args: config_host['LINUX_IO_URING_LIBS'].split())
304endif
305libxml2 = not_found
306if 'CONFIG_LIBXML2' in config_host
307 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
308 link_args: config_host['LIBXML2_LIBS'].split())
309endif
310libnfs = not_found
311if 'CONFIG_LIBNFS' in config_host
312 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
313endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400314libattr = not_found
315if 'CONFIG_ATTR' in config_host
316 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
317endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100318seccomp = not_found
319if 'CONFIG_SECCOMP' in config_host
320 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
321 link_args: config_host['SECCOMP_LIBS'].split())
322endif
323libcap_ng = not_found
324if 'CONFIG_LIBCAP_NG' in config_host
325 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
326endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400327if get_option('xkbcommon').auto() and not have_system and not have_tools
328 xkbcommon = not_found
329else
330 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400331 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400332endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400333vde = not_found
334if config_host.has_key('CONFIG_VDE')
335 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
336endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200337pulse = not_found
338if 'CONFIG_LIBPULSE' in config_host
339 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
340 link_args: config_host['PULSE_LIBS'].split())
341endif
342alsa = not_found
343if 'CONFIG_ALSA' in config_host
344 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
345 link_args: config_host['ALSA_LIBS'].split())
346endif
347jack = not_found
348if 'CONFIG_LIBJACK' in config_host
349 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
350endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200351spice = not_found
Gerd Hoffmannd72c34c2020-10-14 14:11:18 +0200352spice_headers = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200353if 'CONFIG_SPICE' in config_host
354 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
355 link_args: config_host['SPICE_LIBS'].split())
Gerd Hoffmannd72c34c2020-10-14 14:11:18 +0200356 spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split())
Paolo Bonzini26347332019-07-29 15:40:07 +0200357endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400358rt = cc.find_library('rt', required: false)
Paolo Bonziniccf7afa2020-09-01 06:44:23 -0400359libdl = not_found
360if 'CONFIG_PLUGIN' in config_host
361 libdl = cc.find_library('dl', required: true)
362endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200363libiscsi = not_found
364if 'CONFIG_LIBISCSI' in config_host
365 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
366 link_args: config_host['LIBISCSI_LIBS'].split())
367endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400368zstd = not_found
369if 'CONFIG_ZSTD' in config_host
370 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
371 link_args: config_host['ZSTD_LIBS'].split())
372endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400373gbm = not_found
374if 'CONFIG_GBM' in config_host
375 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
376 link_args: config_host['GBM_LIBS'].split())
377endif
378virgl = not_found
379if 'CONFIG_VIRGL' in config_host
380 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
381 link_args: config_host['VIRGL_LIBS'].split())
382endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400383curl = not_found
384if 'CONFIG_CURL' in config_host
385 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
386 link_args: config_host['CURL_LIBS'].split())
387endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200388libudev = not_found
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200389if targetos == 'linux' and (have_system or have_tools)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200390 libudev = dependency('libudev',
Paolo Bonzini5c530152020-10-15 06:09:27 -0400391 required: get_option('libudev'),
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200392 static: enable_static)
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200393endif
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200394
Paolo Bonzini5c530152020-10-15 06:09:27 -0400395mpathlibs = [libudev]
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200396mpathpersist = not_found
397mpathpersist_new_api = false
398if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
399 mpath_test_source_new = '''
400 #include <libudev.h>
401 #include <mpath_persist.h>
402 unsigned mpath_mx_alloc_len = 1024;
403 int logsink;
404 static struct config *multipath_conf;
405 extern struct udev *udev;
406 extern struct config *get_multipath_config(void);
407 extern void put_multipath_config(struct config *conf);
408 struct udev *udev;
409 struct config *get_multipath_config(void) { return multipath_conf; }
410 void put_multipath_config(struct config *conf) { }
411 int main(void) {
412 udev = udev_new();
413 multipath_conf = mpath_lib_init();
414 return 0;
415 }'''
416 mpath_test_source_old = '''
417 #include <libudev.h>
418 #include <mpath_persist.h>
419 unsigned mpath_mx_alloc_len = 1024;
420 int logsink;
421 int main(void) {
422 struct udev *udev = udev_new();
423 mpath_lib_init(udev);
424 return 0;
425 }'''
Paolo Bonzini5c530152020-10-15 06:09:27 -0400426 libmpathpersist = cc.find_library('mpathpersist',
427 required: get_option('mpath'),
428 static: enable_static)
429 if libmpathpersist.found()
430 mpathlibs += libmpathpersist
431 if enable_static
432 mpathlibs += cc.find_library('devmapper',
433 required: get_option('mpath'),
434 static: enable_static)
Paolo Bonzini43b43a42020-09-17 12:25:09 +0200435 endif
Paolo Bonzini5c530152020-10-15 06:09:27 -0400436 mpathlibs += cc.find_library('multipath',
437 required: get_option('mpath'),
438 static: enable_static)
439 foreach lib: mpathlibs
440 if not lib.found()
441 mpathlibs = []
442 break
443 endif
444 endforeach
445 if mpathlibs.length() == 0
446 msg = 'Dependencies missing for libmpathpersist'
447 elif cc.links(mpath_test_source_new, dependencies: mpathlibs)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200448 mpathpersist = declare_dependency(dependencies: mpathlibs)
449 mpathpersist_new_api = true
450 elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
451 mpathpersist = declare_dependency(dependencies: mpathlibs)
452 else
Paolo Bonzini5c530152020-10-15 06:09:27 -0400453 msg = 'Cannot detect libmpathpersist API'
454 endif
455 if not mpathpersist.found()
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200456 if get_option('mpath').enabled()
Paolo Bonzini5c530152020-10-15 06:09:27 -0400457 error(msg)
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200458 else
Paolo Bonzini5c530152020-10-15 06:09:27 -0400459 warning(msg + ', disabling')
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200460 endif
461 endif
462 endif
463endif
464
Yonggang Luo5285e592020-10-13 07:43:48 +0800465iconv = not_found
Yonggang Luo5285e592020-10-13 07:43:48 +0800466curses = not_found
Paolo Bonzini30fe76b2020-10-15 13:26:50 -0400467if have_system and not get_option('curses').disabled()
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400468 curses_test = '''
469 #include <locale.h>
470 #include <curses.h>
471 #include <wchar.h>
472 int main(void) {
473 wchar_t wch = L'w';
474 setlocale(LC_ALL, "");
475 resize_term(0, 0);
476 addwstr(L"wide chars\n");
477 addnwstr(&wch, 1);
478 add_wch(WACS_DEGREE);
479 return 0;
480 }'''
481
482 curses = dependency((targetos == 'windows' ? 'ncurses' : 'ncursesw'),
483 required: false,
484 method: 'pkg-config',
485 static: enable_static)
486 msg = get_option('curses').enabled() ? 'curses library not found' : ''
487 if curses.found()
488 if cc.links(curses_test, dependencies: [curses])
489 curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses])
490 else
491 msg = 'curses package not usable'
492 curses = not_found
Yonggang Luo5285e592020-10-13 07:43:48 +0800493 endif
494 endif
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400495 if not curses.found()
496 curses_compile_args = ['-DNCURSES_WIDECHAR']
497 has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
498 if targetos != 'windows' and not has_curses_h
499 message('Trying with /usr/include/ncursesw')
500 curses_compile_args += ['-I/usr/include/ncursesw']
501 has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
502 endif
503 if has_curses_h
504 curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw'])
505 foreach curses_libname : curses_libname_list
Yonggang Luo5285e592020-10-13 07:43:48 +0800506 libcurses = cc.find_library(curses_libname,
507 required: false,
Yonggang Luo5285e592020-10-13 07:43:48 +0800508 static: enable_static)
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400509 if libcurses.found()
510 if cc.links(curses_test, args: curses_compile_args, dependencies: libcurses)
511 curses = declare_dependency(compile_args: curses_compile_args,
512 dependencies: [libcurses])
513 break
514 else
515 msg = 'curses library not usable'
516 endif
Yonggang Luo5285e592020-10-13 07:43:48 +0800517 endif
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400518 endforeach
519 endif
520 endif
521 if not get_option('iconv').disabled()
522 foreach link_args : [ ['-liconv'], [] ]
523 # Programs will be linked with glib and this will bring in libiconv on FreeBSD.
524 # We need to use libiconv if available because mixing libiconv's headers with
525 # the system libc does not work.
526 # However, without adding glib to the dependencies -L/usr/local/lib will not be
527 # included in the command line and libiconv will not be found.
528 if cc.links('''
529 #include <iconv.h>
530 int main(void) {
531 iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
532 return conv != (iconv_t) -1;
533 }''', args: config_host['GLIB_CFLAGS'].split() + config_host['GLIB_LIBS'].split() + link_args)
534 iconv = declare_dependency(link_args: link_args, dependencies: glib)
535 break
Yonggang Luo5285e592020-10-13 07:43:48 +0800536 endif
Paolo Bonzini30fe76b2020-10-15 13:26:50 -0400537 endforeach
538 endif
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400539 if curses.found() and not iconv.found()
540 if get_option('iconv').enabled()
541 error('iconv not available')
542 endif
543 msg = 'iconv required for curses UI but not available'
544 curses = not_found
545 endif
546 if not curses.found() and msg != ''
547 if get_option('curses').enabled()
548 error(msg)
Paolo Bonzini30fe76b2020-10-15 13:26:50 -0400549 else
Paolo Bonzini925a40d2020-10-19 04:42:11 -0400550 warning(msg + ', disabling')
Paolo Bonzini30fe76b2020-10-15 13:26:50 -0400551 endif
Yonggang Luo5285e592020-10-13 07:43:48 +0800552 endif
553endif
554
Paolo Bonzini26347332019-07-29 15:40:07 +0200555brlapi = not_found
556if 'CONFIG_BRLAPI' in config_host
557 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
558endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100559
Paolo Bonzini760e4322020-08-26 08:09:48 +0200560sdl = not_found
561if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800562 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200563 sdl_image = not_found
564endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100565if sdl.found()
566 # work around 2.0.8 bug
567 sdl = declare_dependency(compile_args: '-Wno-undef',
568 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200569 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400570 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100571else
572 if get_option('sdl_image').enabled()
Sergei Trofimovicha8dc2ac2020-09-08 08:40:16 +0100573 error('sdl-image required, but SDL was @0@'.format(
574 get_option('sdl').disabled() ? 'disabled' : 'not found'))
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100575 endif
576 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200577endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100578
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400579rbd = not_found
580if 'CONFIG_RBD' in config_host
581 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
582endif
583glusterfs = not_found
584if 'CONFIG_GLUSTERFS' in config_host
585 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
586 link_args: config_host['GLUSTERFS_LIBS'].split())
587endif
588libssh = not_found
589if 'CONFIG_LIBSSH' in config_host
590 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
591 link_args: config_host['LIBSSH_LIBS'].split())
592endif
593libbzip2 = not_found
594if 'CONFIG_BZIP2' in config_host
595 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
596endif
597liblzfse = not_found
598if 'CONFIG_LZFSE' in config_host
599 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
600endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200601oss = not_found
602if 'CONFIG_AUDIO_OSS' in config_host
603 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
604endif
605dsound = not_found
606if 'CONFIG_AUDIO_DSOUND' in config_host
607 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
608endif
609coreaudio = not_found
610if 'CONFIG_AUDIO_COREAUDIO' in config_host
611 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
612endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400613opengl = not_found
614if 'CONFIG_OPENGL' in config_host
Paolo Bonzinide2d3002020-09-01 08:41:17 -0400615 opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
616 link_args: config_host['OPENGL_LIBS'].split())
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400617endif
618gtk = not_found
619if 'CONFIG_GTK' in config_host
620 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
621 link_args: config_host['GTK_LIBS'].split())
622endif
623vte = not_found
624if 'CONFIG_VTE' in config_host
625 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
626 link_args: config_host['VTE_LIBS'].split())
627endif
628x11 = not_found
629if 'CONFIG_X11' in config_host
630 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
631 link_args: config_host['X11_LIBS'].split())
632endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100633vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400634png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400635jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400636sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100637if get_option('vnc').enabled()
638 vnc = declare_dependency() # dummy dependency
639 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400640 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100641 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
642 required: get_option('vnc_jpeg'),
643 static: enable_static)
644 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
645 required: get_option('vnc_sasl'),
646 static: enable_static)
647 if sasl.found()
648 sasl = declare_dependency(dependencies: sasl,
649 compile_args: '-DSTRUCT_IOVEC_DEFINED')
650 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400651endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400652snappy = not_found
653if 'CONFIG_SNAPPY' in config_host
654 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
655endif
656lzo = not_found
657if 'CONFIG_LZO' in config_host
658 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
659endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400660rdma = not_found
661if 'CONFIG_RDMA' in config_host
662 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
663endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400664numa = not_found
665if 'CONFIG_NUMA' in config_host
666 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
667endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400668xen = not_found
669if 'CONFIG_XEN_BACKEND' in config_host
670 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
671 link_args: config_host['XEN_LIBS'].split())
672endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200673cacard = not_found
674if 'CONFIG_SMARTCARD' in config_host
675 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
676 link_args: config_host['SMARTCARD_LIBS'].split())
677endif
César Belley0a40bcb2020-08-26 13:42:04 +0200678u2f = not_found
679if have_system
680 u2f = dependency('u2f-emu', required: get_option('u2f'),
681 method: 'pkg-config',
682 static: enable_static)
683endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200684usbredir = not_found
685if 'CONFIG_USB_REDIR' in config_host
686 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
687 link_args: config_host['USB_REDIR_LIBS'].split())
688endif
689libusb = not_found
690if 'CONFIG_USB_LIBUSB' in config_host
691 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
692 link_args: config_host['LIBUSB_LIBS'].split())
693endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400694libpmem = not_found
695if 'CONFIG_LIBPMEM' in config_host
696 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
697 link_args: config_host['LIBPMEM_LIBS'].split())
698endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600699libdaxctl = not_found
700if 'CONFIG_LIBDAXCTL' in config_host
701 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
702endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400703tasn1 = not_found
704if 'CONFIG_TASN1' in config_host
705 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
706 link_args: config_host['TASN1_LIBS'].split())
707endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400708keyutils = dependency('libkeyutils', required: false,
709 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400710
Marc-André Lureau3909def2020-08-28 15:07:33 +0400711has_gettid = cc.has_function('gettid')
712
Paolo Bonziniaa087962020-09-01 11:15:30 -0400713# Malloc tests
714
715malloc = []
716if get_option('malloc') == 'system'
717 has_malloc_trim = \
718 not get_option('malloc_trim').disabled() and \
719 cc.links('''#include <malloc.h>
720 int main(void) { malloc_trim(0); return 0; }''')
721else
722 has_malloc_trim = false
723 malloc = cc.find_library(get_option('malloc'), required: true)
724endif
725if not has_malloc_trim and get_option('malloc_trim').enabled()
726 if get_option('malloc') == 'system'
727 error('malloc_trim not available on this platform.')
728 else
729 error('malloc_trim not available with non-libc memory allocator')
730 endif
731endif
732
Paolo Bonzinia0c91622020-10-07 11:01:51 -0400733#################
734# config-host.h #
735#################
Paolo Bonzini859aef02020-08-04 18:14:26 +0200736
Paolo Bonzinib4e312e2020-09-01 11:28:59 -0400737config_host_data.set('CONFIG_COCOA', cocoa.found())
Paolo Bonzinif01496a2020-09-16 17:54:14 +0200738config_host_data.set('CONFIG_LIBUDEV', libudev.found())
Paolo Bonzini6ec0e152020-09-16 18:07:29 +0200739config_host_data.set('CONFIG_MPATH', mpathpersist.found())
740config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
Yonggang Luo5285e592020-10-13 07:43:48 +0800741config_host_data.set('CONFIG_CURSES', curses.found())
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100742config_host_data.set('CONFIG_SDL', sdl.found())
743config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100744config_host_data.set('CONFIG_VNC', vnc.found())
745config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
746config_host_data.set('CONFIG_VNC_PNG', png.found())
747config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200748config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400749config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400750config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonziniaa087962020-09-01 11:15:30 -0400751config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200752config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
753config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
754config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
755config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
756
Paolo Bonzini765686d2020-09-18 06:37:21 -0400757ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
Paolo Bonzini859aef02020-08-04 18:14:26 +0200758arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200759strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
Paolo Bonzini859aef02020-08-04 18:14:26 +0200760 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
Paolo Bonzinif4f5ed22020-08-18 11:55:47 +0200761 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200762foreach k, v: config_host
Paolo Bonzini765686d2020-09-18 06:37:21 -0400763 if ignored.contains(k)
764 # do nothing
765 elif arrays.contains(k)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200766 if v != ''
767 v = '"' + '", "'.join(v.split()) + '", '
768 endif
769 config_host_data.set(k, v)
770 elif k == 'ARCH'
771 config_host_data.set('HOST_' + v.to_upper(), 1)
772 elif strings.contains(k)
773 if not k.startswith('CONFIG_')
774 k = 'CONFIG_' + k.to_upper()
775 endif
776 config_host_data.set_quoted(k, v)
777 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
778 config_host_data.set(k, v == 'y' ? 1 : v)
779 endif
780endforeach
Paolo Bonzini859aef02020-08-04 18:14:26 +0200781
Paolo Bonzinia0c91622020-10-07 11:01:51 -0400782########################
783# Target configuration #
784########################
785
Paolo Bonzini2becc362020-02-03 11:42:03 +0100786minikconf = find_program('scripts/minikconf.py')
Paolo Bonzini05512f52020-09-16 15:31:11 -0400787config_all = {}
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400788config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400789config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100790config_devices_mak_list = []
791config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200792config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100793config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400794
795disassemblers = {
796 'alpha' : ['CONFIG_ALPHA_DIS'],
797 'arm' : ['CONFIG_ARM_DIS'],
798 'avr' : ['CONFIG_AVR_DIS'],
799 'cris' : ['CONFIG_CRIS_DIS'],
800 'hppa' : ['CONFIG_HPPA_DIS'],
801 'i386' : ['CONFIG_I386_DIS'],
802 'x86_64' : ['CONFIG_I386_DIS'],
803 'x32' : ['CONFIG_I386_DIS'],
804 'lm32' : ['CONFIG_LM32_DIS'],
805 'm68k' : ['CONFIG_M68K_DIS'],
806 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
807 'mips' : ['CONFIG_MIPS_DIS'],
808 'moxie' : ['CONFIG_MOXIE_DIS'],
809 'nios2' : ['CONFIG_NIOS2_DIS'],
810 'or1k' : ['CONFIG_OPENRISC_DIS'],
811 'ppc' : ['CONFIG_PPC_DIS'],
812 'riscv' : ['CONFIG_RISCV_DIS'],
813 'rx' : ['CONFIG_RX_DIS'],
814 's390' : ['CONFIG_S390_DIS'],
815 'sh4' : ['CONFIG_SH4_DIS'],
816 'sparc' : ['CONFIG_SPARC_DIS'],
817 'xtensa' : ['CONFIG_XTENSA_DIS'],
818}
819if link_language == 'cpp'
820 disassemblers += {
821 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
822 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
823 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
824 }
825endif
826
Paolo Bonzini2becc362020-02-03 11:42:03 +0100827kconfig_external_symbols = [
828 'CONFIG_KVM',
829 'CONFIG_XEN',
830 'CONFIG_TPM',
831 'CONFIG_SPICE',
832 'CONFIG_IVSHMEM',
833 'CONFIG_OPENGL',
834 'CONFIG_X11',
835 'CONFIG_VHOST_USER',
Laurent Vivier40bc0ca2020-09-24 23:00:23 +0200836 'CONFIG_VHOST_VDPA',
Paolo Bonzini2becc362020-02-03 11:42:03 +0100837 'CONFIG_VHOST_KERNEL',
838 'CONFIG_VIRTFS',
839 'CONFIG_LINUX',
840 'CONFIG_PVRDMA',
841]
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400842ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400843
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400844default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
845actual_target_dirs = []
Paolo Bonzinifbb41212020-10-05 11:31:15 +0200846fdt_required = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400847foreach target : target_dirs
Paolo Bonzini765686d2020-09-18 06:37:21 -0400848 config_target = { 'TARGET_NAME': target.split('-')[0] }
849 if target.endswith('linux-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400850 if targetos != 'linux'
851 if default_targets
852 continue
853 endif
854 error('Target @0@ is only available on a Linux host'.format(target))
855 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400856 config_target += { 'CONFIG_LINUX_USER': 'y' }
857 elif target.endswith('bsd-user')
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400858 if 'CONFIG_BSD' not in config_host
859 if default_targets
860 continue
861 endif
862 error('Target @0@ is only available on a BSD host'.format(target))
863 endif
Paolo Bonzini765686d2020-09-18 06:37:21 -0400864 config_target += { 'CONFIG_BSD_USER': 'y' }
865 elif target.endswith('softmmu')
866 config_target += { 'CONFIG_SOFTMMU': 'y' }
867 endif
868 if target.endswith('-user')
869 config_target += {
870 'CONFIG_USER_ONLY': 'y',
871 'CONFIG_QEMU_INTERP_PREFIX':
872 config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
873 }
874 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200875
Paolo Bonzini8a199802020-09-18 05:37:01 -0400876 have_accel = false
877 foreach sym: accelerators
878 if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
879 config_target += { sym: 'y' }
880 config_all += { sym: 'y' }
881 if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
882 config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
883 endif
884 have_accel = true
885 endif
886 endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400887 if not have_accel
888 if default_targets
889 continue
890 endif
891 error('No accelerator available for target @0@'.format(target))
892 endif
Paolo Bonzini8a199802020-09-18 05:37:01 -0400893
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400894 actual_target_dirs += target
Paolo Bonzini765686d2020-09-18 06:37:21 -0400895 config_target += keyval.load('default-configs/targets' / target + '.mak')
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400896 config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
Paolo Bonzini765686d2020-09-18 06:37:21 -0400897
Paolo Bonzinifbb41212020-10-05 11:31:15 +0200898 if 'TARGET_NEED_FDT' in config_target
899 fdt_required += target
900 endif
901
Paolo Bonzinifa731682020-09-21 05:19:07 -0400902 # Add default keys
903 if 'TARGET_BASE_ARCH' not in config_target
904 config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']}
905 endif
906 if 'TARGET_ABI_DIR' not in config_target
907 config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']}
908 endif
Paolo Bonzini859aef02020-08-04 18:14:26 +0200909
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400910 foreach k, v: disassemblers
911 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
912 foreach sym: v
913 config_target += { sym: 'y' }
914 config_all_disas += { sym: 'y' }
915 endforeach
916 endif
917 endforeach
918
Paolo Bonzini859aef02020-08-04 18:14:26 +0200919 config_target_data = configuration_data()
920 foreach k, v: config_target
921 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
922 # do nothing
923 elif ignored.contains(k)
924 # do nothing
925 elif k == 'TARGET_BASE_ARCH'
Paolo Bonzinia9a74902020-09-21 05:11:01 -0400926 # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
927 # not used to select files from sourcesets.
Paolo Bonzini859aef02020-08-04 18:14:26 +0200928 config_target_data.set('TARGET_' + v.to_upper(), 1)
Paolo Bonzini765686d2020-09-18 06:37:21 -0400929 elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX'
Paolo Bonzini859aef02020-08-04 18:14:26 +0200930 config_target_data.set_quoted(k, v)
931 elif v == 'y'
932 config_target_data.set(k, 1)
933 else
934 config_target_data.set(k, v)
935 endif
936 endforeach
937 config_target_h += {target: configure_file(output: target + '-config-target.h',
938 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100939
940 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100941 base_kconfig = []
942 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200943 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100944 base_kconfig += '@0@=y'.format(sym)
945 endif
946 endforeach
947
948 config_devices_mak = target + '-config-devices.mak'
949 config_devices_mak = configure_file(
Paolo Bonzini1bb4cb12020-09-18 06:06:09 -0400950 input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
Paolo Bonzini2becc362020-02-03 11:42:03 +0100951 output: config_devices_mak,
952 depfile: config_devices_mak + '.d',
953 capture: true,
954 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
955 config_devices_mak, '@DEPFILE@', '@INPUT@',
956 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200957
958 config_devices_data = configuration_data()
959 config_devices = keyval.load(config_devices_mak)
960 foreach k, v: config_devices
961 config_devices_data.set(k, 1)
962 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100963 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200964 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
965 configuration: config_devices_data)}
966 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400967 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100968 endif
969 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400970endforeach
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -0400971target_dirs = actual_target_dirs
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400972
Paolo Bonzini2becc362020-02-03 11:42:03 +0100973# This configuration is used to build files that are shared by
974# multiple binaries, and then extracted out of the "common"
975# static_library target.
976#
977# We do not use all_sources()/all_dependencies(), because it would
978# build literally all source files, including devices only used by
979# targets that are not built for this compilation. The CONFIG_ALL
980# pseudo symbol replaces it.
981
Paolo Bonzini05512f52020-09-16 15:31:11 -0400982config_all += config_all_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100983config_all += config_host
984config_all += config_all_disas
985config_all += {
986 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
987 'CONFIG_SOFTMMU': have_system,
988 'CONFIG_USER_ONLY': have_user,
989 'CONFIG_ALL': true,
990}
991
Paolo Bonzinia0c91622020-10-07 11:01:51 -0400992##############
993# Submodules #
994##############
Richard Henderson8b18cdb2020-09-13 12:19:25 -0700995
996capstone = not_found
997capstone_opt = get_option('capstone')
998if capstone_opt in ['enabled', 'auto', 'system']
999 have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile')
Richard Hendersonbcf36862020-09-21 09:46:16 -07001000 capstone = dependency('capstone', version: '>=4.0',
1001 static: enable_static, method: 'pkg-config',
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001002 required: capstone_opt == 'system' or
1003 capstone_opt == 'enabled' and not have_internal)
1004 if capstone.found()
1005 capstone_opt = 'system'
1006 elif have_internal
1007 capstone_opt = 'internal'
1008 else
1009 capstone_opt = 'disabled'
1010 endif
1011endif
1012if capstone_opt == 'internal'
1013 capstone_data = configuration_data()
1014 capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1')
1015
1016 capstone_files = files(
1017 'capstone/cs.c',
1018 'capstone/MCInst.c',
1019 'capstone/MCInstrDesc.c',
1020 'capstone/MCRegisterInfo.c',
1021 'capstone/SStream.c',
1022 'capstone/utils.c'
1023 )
1024
1025 if 'CONFIG_ARM_DIS' in config_all_disas
1026 capstone_data.set('CAPSTONE_HAS_ARM', '1')
1027 capstone_files += files(
1028 'capstone/arch/ARM/ARMDisassembler.c',
1029 'capstone/arch/ARM/ARMInstPrinter.c',
1030 'capstone/arch/ARM/ARMMapping.c',
1031 'capstone/arch/ARM/ARMModule.c'
1032 )
1033 endif
1034
1035 # FIXME: This config entry currently depends on a c++ compiler.
1036 # Which is needed for building libvixl, but not for capstone.
1037 if 'CONFIG_ARM_A64_DIS' in config_all_disas
1038 capstone_data.set('CAPSTONE_HAS_ARM64', '1')
1039 capstone_files += files(
1040 'capstone/arch/AArch64/AArch64BaseInfo.c',
1041 'capstone/arch/AArch64/AArch64Disassembler.c',
1042 'capstone/arch/AArch64/AArch64InstPrinter.c',
1043 'capstone/arch/AArch64/AArch64Mapping.c',
1044 'capstone/arch/AArch64/AArch64Module.c'
1045 )
1046 endif
1047
1048 if 'CONFIG_PPC_DIS' in config_all_disas
1049 capstone_data.set('CAPSTONE_HAS_POWERPC', '1')
1050 capstone_files += files(
1051 'capstone/arch/PowerPC/PPCDisassembler.c',
1052 'capstone/arch/PowerPC/PPCInstPrinter.c',
1053 'capstone/arch/PowerPC/PPCMapping.c',
1054 'capstone/arch/PowerPC/PPCModule.c'
1055 )
1056 endif
1057
Richard Henderson3d562842020-01-04 07:24:59 +10001058 if 'CONFIG_S390_DIS' in config_all_disas
1059 capstone_data.set('CAPSTONE_HAS_SYSZ', '1')
1060 capstone_files += files(
1061 'capstone/arch/SystemZ/SystemZDisassembler.c',
1062 'capstone/arch/SystemZ/SystemZInstPrinter.c',
1063 'capstone/arch/SystemZ/SystemZMapping.c',
1064 'capstone/arch/SystemZ/SystemZModule.c',
1065 'capstone/arch/SystemZ/SystemZMCTargetDesc.c'
1066 )
1067 endif
1068
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001069 if 'CONFIG_I386_DIS' in config_all_disas
1070 capstone_data.set('CAPSTONE_HAS_X86', 1)
1071 capstone_files += files(
1072 'capstone/arch/X86/X86Disassembler.c',
1073 'capstone/arch/X86/X86DisassemblerDecoder.c',
1074 'capstone/arch/X86/X86ATTInstPrinter.c',
1075 'capstone/arch/X86/X86IntelInstPrinter.c',
Richard Hendersoneef20e42020-09-14 16:02:02 -07001076 'capstone/arch/X86/X86InstPrinterCommon.c',
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001077 'capstone/arch/X86/X86Mapping.c',
1078 'capstone/arch/X86/X86Module.c'
1079 )
1080 endif
1081
1082 configure_file(output: 'capstone-defs.h', configuration: capstone_data)
1083
1084 capstone_cargs = [
1085 # FIXME: There does not seem to be a way to completely replace the c_args
1086 # that come from add_project_arguments() -- we can only add to them.
1087 # So: disable all warnings with a big hammer.
1088 '-Wno-error', '-w',
1089
1090 # Include all configuration defines via a header file, which will wind up
1091 # as a dependency on the object file, and thus changes here will result
1092 # in a rebuild.
1093 '-include', 'capstone-defs.h'
1094 ]
1095
1096 libcapstone = static_library('capstone',
1097 sources: capstone_files,
1098 c_args: capstone_cargs,
1099 include_directories: 'capstone/include')
1100 capstone = declare_dependency(link_with: libcapstone,
Richard Hendersoneef20e42020-09-14 16:02:02 -07001101 include_directories: 'capstone/include/capstone')
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001102endif
Paolo Bonzini4d34a862020-10-05 11:31:15 +02001103
1104slirp = not_found
1105slirp_opt = 'disabled'
1106if have_system
1107 slirp_opt = get_option('slirp')
1108 if slirp_opt in ['enabled', 'auto', 'system']
1109 have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
1110 slirp = dependency('slirp', static: enable_static,
1111 method: 'pkg-config',
1112 required: slirp_opt == 'system' or
1113 slirp_opt == 'enabled' and not have_internal)
1114 if slirp.found()
1115 slirp_opt = 'system'
1116 elif have_internal
1117 slirp_opt = 'internal'
1118 else
1119 slirp_opt = 'disabled'
1120 endif
1121 endif
1122 if slirp_opt == 'internal'
1123 slirp_deps = []
1124 if targetos == 'windows'
1125 slirp_deps = cc.find_library('iphlpapi')
1126 endif
1127 slirp_conf = configuration_data()
1128 slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0])
1129 slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1])
1130 slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2])
1131 slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version())
1132 slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"']
1133 slirp_files = [
1134 'slirp/src/arp_table.c',
1135 'slirp/src/bootp.c',
1136 'slirp/src/cksum.c',
1137 'slirp/src/dhcpv6.c',
1138 'slirp/src/dnssearch.c',
1139 'slirp/src/if.c',
1140 'slirp/src/ip6_icmp.c',
1141 'slirp/src/ip6_input.c',
1142 'slirp/src/ip6_output.c',
1143 'slirp/src/ip_icmp.c',
1144 'slirp/src/ip_input.c',
1145 'slirp/src/ip_output.c',
1146 'slirp/src/mbuf.c',
1147 'slirp/src/misc.c',
1148 'slirp/src/ncsi.c',
1149 'slirp/src/ndp_table.c',
1150 'slirp/src/sbuf.c',
1151 'slirp/src/slirp.c',
1152 'slirp/src/socket.c',
1153 'slirp/src/state.c',
1154 'slirp/src/stream.c',
1155 'slirp/src/tcp_input.c',
1156 'slirp/src/tcp_output.c',
1157 'slirp/src/tcp_subr.c',
1158 'slirp/src/tcp_timer.c',
1159 'slirp/src/tftp.c',
1160 'slirp/src/udp.c',
1161 'slirp/src/udp6.c',
1162 'slirp/src/util.c',
1163 'slirp/src/version.c',
1164 'slirp/src/vmstate.c',
1165 ]
1166
1167 configure_file(
1168 input : 'slirp/src/libslirp-version.h.in',
1169 output : 'libslirp-version.h',
1170 configuration: slirp_conf)
1171
1172 slirp_inc = include_directories('slirp', 'slirp/src')
1173 libslirp = static_library('slirp',
1174 sources: slirp_files,
1175 c_args: slirp_cargs,
1176 include_directories: slirp_inc)
1177 slirp = declare_dependency(link_with: libslirp,
1178 dependencies: slirp_deps,
1179 include_directories: slirp_inc)
1180 endif
1181endif
1182
Paolo Bonzinifbb41212020-10-05 11:31:15 +02001183fdt = not_found
1184fdt_opt = get_option('fdt')
1185if have_system
1186 if fdt_opt in ['enabled', 'auto', 'system']
1187 have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt')
1188 fdt = cc.find_library('fdt', static: enable_static,
1189 required: fdt_opt == 'system' or
1190 fdt_opt == 'enabled' and not have_internal)
1191 if fdt.found() and cc.links('''
1192 #include <libfdt.h>
1193 #include <libfdt_env.h>
1194 int main(void) { fdt_check_full(NULL, 0); return 0; }''',
1195 dependencies: fdt)
1196 fdt_opt = 'system'
1197 elif have_internal
1198 fdt_opt = 'internal'
1199 else
1200 fdt_opt = 'disabled'
1201 endif
1202 endif
1203 if fdt_opt == 'internal'
1204 fdt_files = files(
1205 'dtc/libfdt/fdt.c',
1206 'dtc/libfdt/fdt_ro.c',
1207 'dtc/libfdt/fdt_wip.c',
1208 'dtc/libfdt/fdt_sw.c',
1209 'dtc/libfdt/fdt_rw.c',
1210 'dtc/libfdt/fdt_strerror.c',
1211 'dtc/libfdt/fdt_empty_tree.c',
1212 'dtc/libfdt/fdt_addresses.c',
1213 'dtc/libfdt/fdt_overlay.c',
1214 'dtc/libfdt/fdt_check.c',
1215 )
1216
1217 fdt_inc = include_directories('dtc/libfdt')
1218 libfdt = static_library('fdt',
1219 sources: fdt_files,
1220 include_directories: fdt_inc)
1221 fdt = declare_dependency(link_with: libfdt,
1222 include_directories: fdt_inc)
1223 endif
1224endif
1225if not fdt.found() and fdt_required.length() > 0
1226 error('fdt not available but required by targets ' + ', '.join(fdt_required))
1227endif
1228
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001229config_host_data.set('CONFIG_CAPSTONE', capstone.found())
Paolo Bonzinifbb41212020-10-05 11:31:15 +02001230config_host_data.set('CONFIG_FDT', fdt.found())
Paolo Bonzini4d34a862020-10-05 11:31:15 +02001231config_host_data.set('CONFIG_SLIRP', slirp.found())
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001232
Paolo Bonzinia0c91622020-10-07 11:01:51 -04001233#####################
1234# Generated sources #
1235#####################
Richard Henderson8b18cdb2020-09-13 12:19:25 -07001236
Paolo Bonzinia0c91622020-10-07 11:01:51 -04001237genh += configure_file(output: 'config-host.h', configuration: config_host_data)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001238
Marc-André Lureau3f885652019-07-15 18:06:04 +04001239hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +04001240shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001241qapi_gen = find_program('scripts/qapi-gen.py')
1242qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
1243 meson.source_root() / 'scripts/qapi/commands.py',
1244 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001245 meson.source_root() / 'scripts/qapi/error.py',
1246 meson.source_root() / 'scripts/qapi/events.py',
1247 meson.source_root() / 'scripts/qapi/expr.py',
1248 meson.source_root() / 'scripts/qapi/gen.py',
1249 meson.source_root() / 'scripts/qapi/introspect.py',
1250 meson.source_root() / 'scripts/qapi/parser.py',
1251 meson.source_root() / 'scripts/qapi/schema.py',
1252 meson.source_root() / 'scripts/qapi/source.py',
1253 meson.source_root() / 'scripts/qapi/types.py',
1254 meson.source_root() / 'scripts/qapi/visit.py',
1255 meson.source_root() / 'scripts/qapi/common.py',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001256 meson.source_root() / 'scripts/qapi-gen.py'
1257]
1258
1259tracetool = [
1260 python, files('scripts/tracetool.py'),
1261 '--backend=' + config_host['TRACE_BACKENDS']
1262]
1263
Marc-André Lureau2c273f32019-07-15 17:10:19 +04001264qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
1265 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +02001266 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +04001267qemu_version = custom_target('qemu-version.h',
1268 output: 'qemu-version.h',
1269 command: qemu_version_cmd,
1270 capture: true,
1271 build_by_default: true,
1272 build_always_stale: true)
1273genh += qemu_version
1274
Marc-André Lureau3f885652019-07-15 18:06:04 +04001275hxdep = []
1276hx_headers = [
1277 ['qemu-options.hx', 'qemu-options.def'],
1278 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
1279]
1280if have_system
1281 hx_headers += [
1282 ['hmp-commands.hx', 'hmp-commands.h'],
1283 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
1284 ]
1285endif
1286foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001287 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +04001288 input: files(d[0]),
1289 output: d[1],
1290 capture: true,
1291 build_by_default: true, # to be removed when added to a target
1292 command: [hxtool, '-h', '@INPUT0@'])
1293endforeach
1294genh += hxdep
1295
Paolo Bonzinia0c91622020-10-07 11:01:51 -04001296###################
1297# Collect sources #
1298###################
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001299
Philippe Mathieu-Daudé55567892020-10-06 14:56:01 +02001300authz_ss = ss.source_set()
Philippe Mathieu-Daudé7e2b8882020-10-06 14:55:55 +02001301blockdev_ss = ss.source_set()
1302block_ss = ss.source_set()
1303bsd_user_ss = ss.source_set()
Philippe Mathieu-Daudéc2306d72020-10-06 14:55:57 +02001304chardev_ss = ss.source_set()
Philippe Mathieu-Daudé7e2b8882020-10-06 14:55:55 +02001305common_ss = ss.source_set()
Philippe Mathieu-Daudé23893042020-10-06 14:56:00 +02001306crypto_ss = ss.source_set()
Philippe Mathieu-Daudéf78536b2020-10-06 14:55:59 +02001307io_ss = ss.source_set()
Philippe Mathieu-Daudé7e2b8882020-10-06 14:55:55 +02001308linux_user_ss = ss.source_set()
1309qmp_ss = ss.source_set()
Philippe Mathieu-Daudéda33fc02020-10-06 14:56:02 +02001310qom_ss = ss.source_set()
Philippe Mathieu-Daudé7e2b8882020-10-06 14:55:55 +02001311softmmu_ss = ss.source_set()
1312specific_fuzz_ss = ss.source_set()
1313specific_ss = ss.source_set()
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001314stub_ss = ss.source_set()
1315trace_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001316user_ss = ss.source_set()
Philippe Mathieu-Daudé7e2b8882020-10-06 14:55:55 +02001317util_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001318
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001319modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001320hw_arch = {}
1321target_arch = {}
1322target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001323
1324###############
1325# Trace files #
1326###############
1327
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001328# TODO: add each directory to the subdirs from its own meson.build, once
1329# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001330trace_events_subdirs = [
1331 'accel/kvm',
1332 'accel/tcg',
1333 'crypto',
1334 'monitor',
1335]
1336if have_user
1337 trace_events_subdirs += [ 'linux-user' ]
1338endif
1339if have_block
1340 trace_events_subdirs += [
1341 'authz',
1342 'block',
1343 'io',
1344 'nbd',
1345 'scsi',
1346 ]
1347endif
1348if have_system
1349 trace_events_subdirs += [
1350 'audio',
1351 'backends',
1352 'backends/tpm',
1353 'chardev',
1354 'hw/9pfs',
1355 'hw/acpi',
1356 'hw/alpha',
1357 'hw/arm',
1358 'hw/audio',
1359 'hw/block',
1360 'hw/block/dataplane',
1361 'hw/char',
1362 'hw/display',
1363 'hw/dma',
1364 'hw/hppa',
1365 'hw/hyperv',
1366 'hw/i2c',
1367 'hw/i386',
1368 'hw/i386/xen',
1369 'hw/ide',
1370 'hw/input',
1371 'hw/intc',
1372 'hw/isa',
1373 'hw/mem',
1374 'hw/mips',
1375 'hw/misc',
1376 'hw/misc/macio',
1377 'hw/net',
1378 'hw/nvram',
1379 'hw/pci',
1380 'hw/pci-host',
1381 'hw/ppc',
1382 'hw/rdma',
1383 'hw/rdma/vmw',
1384 'hw/rtc',
1385 'hw/s390x',
1386 'hw/scsi',
1387 'hw/sd',
1388 'hw/sparc',
1389 'hw/sparc64',
1390 'hw/ssi',
1391 'hw/timer',
1392 'hw/tpm',
1393 'hw/usb',
1394 'hw/vfio',
1395 'hw/virtio',
1396 'hw/watchdog',
1397 'hw/xen',
1398 'hw/gpio',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001399 'migration',
1400 'net',
Philippe Mathieu-Daudé8b7a5502020-08-05 15:02:20 +02001401 'softmmu',
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001402 'ui',
1403 ]
1404endif
1405trace_events_subdirs += [
1406 'hw/core',
1407 'qapi',
1408 'qom',
1409 'target/arm',
1410 'target/hppa',
1411 'target/i386',
1412 'target/mips',
1413 'target/ppc',
1414 'target/riscv',
1415 'target/s390x',
1416 'target/sparc',
1417 'util',
1418]
1419
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001420subdir('qapi')
1421subdir('qobject')
1422subdir('stubs')
1423subdir('trace')
1424subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +04001425subdir('qom')
1426subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001427subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +04001428subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001429
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001430
1431if enable_modules
1432 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
1433 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
1434endif
1435
Paolo Bonzini2becc362020-02-03 11:42:03 +01001436stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001437
1438util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +01001439util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001440libqemuutil = static_library('qemuutil',
1441 sources: util_ss.sources() + stub_ss.sources() + genh,
Paolo Bonziniaa087962020-09-01 11:15:30 -04001442 dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001443qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +04001444 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -04001445
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001446decodetree = generator(find_program('scripts/decodetree.py'),
1447 output: 'decode-@BASENAME@.c.inc',
1448 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
1449
Paolo Bonzini478e9432020-08-17 12:47:55 +02001450subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +04001451subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +04001452subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001453subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001454subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +04001455subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +04001456subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +04001457
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001458block_ss.add(files(
1459 'block.c',
Kevin Wolf56ee8622020-09-24 17:26:50 +02001460 'blockdev-nbd.c',
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001461 'blockjob.c',
1462 'job.c',
1463 'qemu-io-cmds.c',
1464))
1465block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
1466
1467subdir('nbd')
1468subdir('scsi')
1469subdir('block')
1470
Paolo Bonzini4a963372020-08-03 16:22:28 +02001471blockdev_ss.add(files(
1472 'blockdev.c',
Paolo Bonzini4a963372020-08-03 16:22:28 +02001473 'iothread.c',
1474 'job-qmp.c',
1475))
1476
1477# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
1478# os-win32.c does not
1479blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
1480softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
Paolo Bonzini4a963372020-08-03 16:22:28 +02001481softmmu_ss.add_all(blockdev_ss)
Paolo Bonzini4a963372020-08-03 16:22:28 +02001482
1483common_ss.add(files('cpus-common.c'))
1484
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001485subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001486
Richard Hendersonf3433462020-09-12 10:47:33 -07001487common_ss.add(capstone)
Paolo Bonzinid9f24bf2020-10-06 09:05:29 +02001488specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001489specific_ss.add(files('exec-vary.c'))
1490specific_ss.add(when: 'CONFIG_TCG', if_true: files(
1491 'fpu/softfloat.c',
1492 'tcg/optimize.c',
1493 'tcg/tcg-common.c',
1494 'tcg/tcg-op-gvec.c',
1495 'tcg/tcg-op-vec.c',
1496 'tcg/tcg-op.c',
1497 'tcg/tcg.c',
1498))
1499specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
1500
Marc-André Lureauab318052019-07-24 19:23:16 +04001501subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +04001502subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +04001503subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001504subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +04001505subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +04001506subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +04001507subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +04001508subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001509subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +04001510subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +04001511subdir('linux-user')
1512
Marc-André Lureaub309c322019-08-18 19:20:37 +04001513bsd_user_ss.add(files('gdbstub.c'))
1514specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
1515
Marc-André Lureau3a304462019-08-18 16:13:08 +04001516linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
1517specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +02001518
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001519# needed for fuzzing binaries
1520subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001521subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +02001522
Paolo Bonzinia0c91622020-10-07 11:01:51 -04001523########################
1524# Library dependencies #
1525########################
1526
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001527block_mods = []
1528softmmu_mods = []
1529foreach d, list : modules
1530 foreach m, module_ss : list
1531 if enable_modules and targetos != 'windows'
Gerd Hoffmann3e292c52020-09-14 15:42:20 +02001532 module_ss = module_ss.apply(config_all, strict: false)
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001533 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
1534 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
1535 if d == 'block'
1536 block_mods += sl
1537 else
1538 softmmu_mods += sl
1539 endif
1540 else
1541 if d == 'block'
1542 block_ss.add_all(module_ss)
1543 else
1544 softmmu_ss.add_all(module_ss)
1545 endif
1546 endif
1547 endforeach
1548endforeach
1549
1550nm = find_program('nm')
Yonggang Luo604f3e42020-09-03 01:00:50 +08001551undefsym = find_program('scripts/undefsym.py')
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001552block_syms = custom_target('block.syms', output: 'block.syms',
1553 input: [libqemuutil, block_mods],
1554 capture: true,
1555 command: [undefsym, nm, '@INPUT@'])
1556qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
1557 input: [libqemuutil, softmmu_mods],
1558 capture: true,
1559 command: [undefsym, nm, '@INPUT@'])
1560
Philippe Mathieu-Daudéda33fc02020-10-06 14:56:02 +02001561qom_ss = qom_ss.apply(config_host, strict: false)
1562libqom = static_library('qom', qom_ss.sources() + genh,
1563 dependencies: [qom_ss.dependencies()],
1564 name_suffix: 'fa')
1565
1566qom = declare_dependency(link_whole: libqom)
1567
Philippe Mathieu-Daudé55567892020-10-06 14:56:01 +02001568authz_ss = authz_ss.apply(config_host, strict: false)
1569libauthz = static_library('authz', authz_ss.sources() + genh,
1570 dependencies: [authz_ss.dependencies()],
1571 name_suffix: 'fa',
1572 build_by_default: false)
1573
1574authz = declare_dependency(link_whole: libauthz,
1575 dependencies: qom)
1576
Philippe Mathieu-Daudé23893042020-10-06 14:56:00 +02001577crypto_ss = crypto_ss.apply(config_host, strict: false)
1578libcrypto = static_library('crypto', crypto_ss.sources() + genh,
1579 dependencies: [crypto_ss.dependencies()],
1580 name_suffix: 'fa',
1581 build_by_default: false)
1582
1583crypto = declare_dependency(link_whole: libcrypto,
1584 dependencies: [authz, qom])
1585
Philippe Mathieu-Daudéf78536b2020-10-06 14:55:59 +02001586io_ss = io_ss.apply(config_host, strict: false)
1587libio = static_library('io', io_ss.sources() + genh,
1588 dependencies: [io_ss.dependencies()],
1589 link_with: libqemuutil,
1590 name_suffix: 'fa',
1591 build_by_default: false)
1592
1593io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
1594
Philippe Mathieu-Daudé7e6edef2020-10-06 14:55:58 +02001595libmigration = static_library('migration', sources: migration_files + genh,
1596 name_suffix: 'fa',
1597 build_by_default: false)
1598migration = declare_dependency(link_with: libmigration,
1599 dependencies: [zlib, qom, io])
1600softmmu_ss.add(migration)
1601
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001602block_ss = block_ss.apply(config_host, strict: false)
1603libblock = static_library('block', block_ss.sources() + genh,
1604 dependencies: block_ss.dependencies(),
1605 link_depends: block_syms,
1606 name_suffix: 'fa',
1607 build_by_default: false)
1608
1609block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001610 link_args: '@block.syms',
1611 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +04001612
Paolo Bonziniff219dc2020-08-04 21:14:26 +02001613qmp_ss = qmp_ss.apply(config_host, strict: false)
1614libqmp = static_library('qmp', qmp_ss.sources() + genh,
1615 dependencies: qmp_ss.dependencies(),
1616 name_suffix: 'fa',
1617 build_by_default: false)
1618
1619qmp = declare_dependency(link_whole: [libqmp])
1620
Philippe Mathieu-Daudéc2306d72020-10-06 14:55:57 +02001621libchardev = static_library('chardev', chardev_ss.sources() + genh,
1622 name_suffix: 'fa',
1623 build_by_default: false)
1624
1625chardev = declare_dependency(link_whole: libchardev)
1626
Philippe Mathieu-Daudée28ab092020-10-06 14:55:56 +02001627libhwcore = static_library('hwcore', sources: hwcore_files + genh,
1628 name_suffix: 'fa',
1629 build_by_default: false)
1630hwcore = declare_dependency(link_whole: libhwcore)
1631common_ss.add(hwcore)
1632
Philippe Mathieu-Daudé064f8ee2020-10-06 14:55:54 +02001633###########
1634# Targets #
1635###########
1636
Marc-André Lureau3154fee2019-08-29 22:07:01 +04001637foreach m : block_mods + softmmu_mods
1638 shared_module(m.name(),
1639 name_prefix: '',
1640 link_whole: m,
1641 install: true,
1642 install_dir: config_host['qemu_moddir'])
1643endforeach
1644
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001645softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
1646common_ss.add(qom, qemuutil)
1647
1648common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +01001649common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
1650
1651common_all = common_ss.apply(config_all, strict: false)
1652common_all = static_library('common',
1653 build_by_default: false,
1654 sources: common_all.sources() + genh,
1655 dependencies: common_all.dependencies(),
1656 name_suffix: 'fa')
1657
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001658feature_to_c = find_program('scripts/feature_to_c.sh')
1659
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001660emulators = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +01001661foreach target : target_dirs
1662 config_target = config_target_mak[target]
1663 target_name = config_target['TARGET_NAME']
1664 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +02001665 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001666 arch_deps = []
1667 c_args = ['-DNEED_CPU_H',
1668 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
1669 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
Paolo Bonzinib6c7cfd2020-09-21 04:49:50 -04001670 link_args = emulator_link_args
Paolo Bonzini2becc362020-02-03 11:42:03 +01001671
Paolo Bonzini859aef02020-08-04 18:14:26 +02001672 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +01001673 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
1674 if targetos == 'linux'
1675 target_inc += include_directories('linux-headers', is_system: true)
1676 endif
1677 if target.endswith('-softmmu')
1678 qemu_target_name = 'qemu-system-' + target_name
1679 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001680 t = target_softmmu_arch[arch].apply(config_target, strict: false)
1681 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001682 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001683
Marc-André Lureau2c442202019-08-17 13:55:58 +04001684 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
1685 hw = hw_arch[hw_dir].apply(config_target, strict: false)
1686 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001687 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +04001688
Paolo Bonzini2becc362020-02-03 11:42:03 +01001689 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001690 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001691 else
Marc-André Lureau3a304462019-08-18 16:13:08 +04001692 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001693 target_type='user'
1694 qemu_target_name = 'qemu-' + target_name
1695 if 'CONFIG_LINUX_USER' in config_target
1696 base_dir = 'linux-user'
1697 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1698 else
1699 base_dir = 'bsd-user'
1700 endif
1701 target_inc += include_directories(
1702 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001703 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001704 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001705 if 'CONFIG_LINUX_USER' in config_target
1706 dir = base_dir / abi
1707 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1708 if config_target.has_key('TARGET_SYSTBL_ABI')
1709 arch_srcs += \
1710 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1711 extra_args : config_target['TARGET_SYSTBL_ABI'])
1712 endif
1713 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001714 endif
1715
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001716 if 'TARGET_XML_FILES' in config_target
1717 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1718 output: target + '-gdbstub-xml.c',
1719 input: files(config_target['TARGET_XML_FILES'].split()),
1720 command: [feature_to_c, '@INPUT@'],
1721 capture: true)
1722 arch_srcs += gdbstub_xml
1723 endif
1724
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001725 t = target_arch[arch].apply(config_target, strict: false)
1726 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001727 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001728
Paolo Bonzini2becc362020-02-03 11:42:03 +01001729 target_common = common_ss.apply(config_target, strict: false)
1730 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001731 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001732
Paolo Bonzini2becc362020-02-03 11:42:03 +01001733 target_specific = specific_ss.apply(config_target, strict: false)
1734 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001735 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001736
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001737 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001738 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001739 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001740 objects: objects,
1741 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001742 c_args: c_args,
1743 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001744 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001745
1746 if target.endswith('-softmmu')
1747 execs = [{
1748 'name': 'qemu-system-' + target_name,
1749 'gui': false,
1750 'sources': files('softmmu/main.c'),
1751 'dependencies': []
1752 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001753 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001754 execs += [{
1755 'name': 'qemu-system-' + target_name + 'w',
1756 'gui': true,
1757 'sources': files('softmmu/main.c'),
1758 'dependencies': []
1759 }]
1760 endif
1761 if config_host.has_key('CONFIG_FUZZ')
1762 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1763 execs += [{
1764 'name': 'qemu-fuzz-' + target_name,
1765 'gui': false,
1766 'sources': specific_fuzz.sources(),
1767 'dependencies': specific_fuzz.dependencies(),
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001768 }]
1769 endif
1770 else
1771 execs = [{
1772 'name': 'qemu-' + target_name,
1773 'gui': false,
1774 'sources': [],
1775 'dependencies': []
1776 }]
1777 endif
1778 foreach exe: execs
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001779 emulators += {exe['name']:
1780 executable(exe['name'], exe['sources'],
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001781 install: true,
1782 c_args: c_args,
1783 dependencies: arch_deps + deps + exe['dependencies'],
1784 objects: lib.extract_all_objects(recursive: true),
1785 link_language: link_language,
1786 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1787 link_args: link_args,
1788 gui_app: exe['gui'])
Paolo Bonzinifd5eef82020-09-16 05:00:53 -04001789 }
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001790
1791 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1792 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001793 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1794 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001795 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1796 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1797 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001798 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001799 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001800 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001801 capture: true,
1802 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001803 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001804 command: [
1805 tracetool, '--group=all', '--format=' + stp['fmt'],
1806 '--binary=' + stp['bin'],
1807 '--target-name=' + target_name,
1808 '--target-type=' + target_type,
1809 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1810 '@INPUT@',
1811 ])
1812 endforeach
1813 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001814 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001815endforeach
1816
Paolo Bonzini931049b2020-02-05 09:44:24 +01001817# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001818
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001819if 'CONFIG_PLUGIN' in config_host
1820 install_headers('include/qemu/qemu-plugin.h')
1821endif
1822
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001823if 'CONFIG_GUEST_AGENT' in config_host
1824 subdir('qga')
1825endif
1826
Laurent Vivier9755c942020-08-24 17:24:30 +02001827# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1828# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001829if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001830 # used for the update-keymaps target, so include rules even if !have_tools
1831 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1832 dependencies: [qemuutil, xkbcommon], install: have_tools)
1833endif
1834
Paolo Bonzini931049b2020-02-05 09:44:24 +01001835if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001836 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1837 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1838 qemu_io = executable('qemu-io', files('qemu-io.c'),
1839 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001840 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001841 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001842
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001843 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001844 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001845 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001846
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001847 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1848 dependencies: qemuutil,
1849 install: true)
1850
Paolo Bonzini931049b2020-02-05 09:44:24 +01001851 if 'CONFIG_VHOST_USER' in config_host
1852 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001853 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001854 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001855 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001856 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001857 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001858
1859 if targetos == 'linux'
1860 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1861 dependencies: [qemuutil, libcap_ng],
1862 install: true,
1863 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001864
1865 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1866 dependencies: [authz, crypto, io, qom, qemuutil,
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02001867 libcap_ng, mpathpersist],
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001868 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001869 endif
1870
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001871 if 'CONFIG_IVSHMEM' in config_host
1872 subdir('contrib/ivshmem-client')
1873 subdir('contrib/ivshmem-server')
1874 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001875endif
1876
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001877subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001878subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001879subdir('pc-bios')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001880subdir('docs')
Yonggang Luoe3667662020-10-16 06:06:25 +08001881subdir('tests')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001882if 'CONFIG_GTK' in config_host
1883 subdir('po')
1884endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001885
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001886if host_machine.system() == 'windows'
1887 nsis_cmd = [
1888 find_program('scripts/nsis.py'),
1889 '@OUTPUT@',
1890 get_option('prefix'),
1891 meson.current_source_dir(),
1892 host_machine.cpu_family(),
1893 '--',
1894 '-DDISPLAYVERSION=' + meson.project_version(),
1895 ]
1896 if build_docs
1897 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1898 endif
1899 if 'CONFIG_GTK' in config_host
1900 nsis_cmd += '-DCONFIG_GTK=y'
1901 endif
1902
1903 nsis = custom_target('nsis',
1904 output: 'qemu-setup-' + meson.project_version() + '.exe',
1905 input: files('qemu.nsi'),
1906 build_always_stale: true,
1907 command: nsis_cmd + ['@INPUT@'])
1908 alias_target('installer', nsis)
1909endif
1910
Paolo Bonzinia0c91622020-10-07 11:01:51 -04001911#########################
1912# Configuration summary #
1913#########################
1914
Paolo Bonzinif9332752020-02-03 13:28:38 +01001915summary_info = {}
1916summary_info += {'Install prefix': config_host['prefix']}
1917summary_info += {'BIOS directory': config_host['qemu_datadir']}
1918summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1919summary_info += {'binary directory': config_host['bindir']}
1920summary_info += {'library directory': config_host['libdir']}
1921summary_info += {'module directory': config_host['qemu_moddir']}
1922summary_info += {'libexec directory': config_host['libexecdir']}
1923summary_info += {'include directory': config_host['includedir']}
1924summary_info += {'config directory': config_host['sysconfdir']}
1925if targetos != 'windows'
1926 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001927 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001928else
1929 summary_info += {'local state directory': 'queried at runtime'}
1930endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001931summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001932summary_info += {'Build directory': meson.current_build_dir()}
1933summary_info += {'Source path': meson.current_source_dir()}
1934summary_info += {'GIT binary': config_host['GIT']}
1935summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1936summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1937summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1938if link_language == 'cpp'
1939 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1940else
1941 summary_info += {'C++ compiler': false}
1942endif
1943if targetos == 'darwin'
1944 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1945endif
1946summary_info += {'ARFLAGS': config_host['ARFLAGS']}
Paolo Bonzini47b30832020-09-23 05:26:17 -04001947summary_info += {'CFLAGS': ' '.join(get_option('c_args')
1948 + ['-O' + get_option('optimization')]
1949 + (get_option('debug') ? ['-g'] : []))}
1950if link_language == 'cpp'
1951 summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args')
1952 + ['-O' + get_option('optimization')]
1953 + (get_option('debug') ? ['-g'] : []))}
1954endif
1955link_args = get_option(link_language + '_link_args')
1956if link_args.length() > 0
1957 summary_info += {'LDFLAGS': ' '.join(link_args)}
1958endif
Paolo Bonzinif9332752020-02-03 13:28:38 +01001959summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1960summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1961summary_info += {'make': config_host['MAKE']}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001962summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
Yonggang Luoe3667662020-10-16 06:06:25 +08001963summary_info += {'sphinx-build': sphinx_build.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001964summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1965# TODO: add back version
Paolo Bonzini4d34a862020-10-05 11:31:15 +02001966summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt}
1967if slirp_opt != 'disabled'
Paolo Bonzinif9332752020-02-03 13:28:38 +01001968 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1969endif
1970summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1971if config_host.has_key('CONFIG_MODULES')
1972 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1973endif
1974summary_info += {'host CPU': cpu}
1975summary_info += {'host endianness': build_machine.endian()}
Paolo Bonzinifdb75ae2020-09-21 04:37:49 -04001976summary_info += {'target list': ' '.join(target_dirs)}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001977summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
Paolo Bonzinideb62372020-09-01 07:51:16 -04001978summary_info += {'sparse enabled': sparse.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001979summary_info += {'strip binaries': get_option('strip')}
1980summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
Laurent Vivier3e8529d2020-09-17 16:07:00 +02001981summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001982if targetos == 'darwin'
1983 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1984endif
1985# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001986summary_info += {'SDL support': sdl.found()}
1987summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001988# TODO: add back version
1989summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1990summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001991summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001992# TODO: add back version
1993summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1994summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1995summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1996# TODO: add back version
1997summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1998if config_host.has_key('CONFIG_GCRYPT')
1999 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
2000 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
2001endif
2002# TODO: add back version
2003summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
2004if config_host.has_key('CONFIG_NETTLE')
2005 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
2006endif
2007summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
2008summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
Yonggang Luo5285e592020-10-13 07:43:48 +08002009summary_info += {'iconv support': iconv.found()}
2010summary_info += {'curses support': curses.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002011# TODO: add back version
2012summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
2013summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
2014summary_info += {'mingw32 support': targetos == 'windows'}
2015summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
2016summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
2017summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
2018summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
Paolo Bonzini6ec0e152020-09-16 18:07:29 +02002019summary_info += {'Multipath support': mpathpersist.found()}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01002020summary_info += {'VNC support': vnc.found()}
2021if vnc.found()
2022 summary_info += {'VNC SASL support': sasl.found()}
2023 summary_info += {'VNC JPEG support': jpeg.found()}
2024 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002025endif
2026summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
2027if config_host.has_key('CONFIG_XEN_BACKEND')
2028 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
2029endif
2030summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
Yonggang Luoe3667662020-10-16 06:06:25 +08002031summary_info += {'Documentation': build_docs}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002032summary_info += {'PIE': get_option('b_pie')}
2033summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
2034summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
2035summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
2036summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
2037summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
2038summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
Paolo Bonzini05512f52020-09-16 15:31:11 -04002039summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
2040summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
2041summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
2042summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
2043summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
2044if config_all.has_key('CONFIG_TCG')
2045 summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
2046 summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
2047endif
Paolo Bonziniaa087962020-09-01 11:15:30 -04002048summary_info += {'malloc trim support': has_malloc_trim}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002049summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
2050summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
Paolo Bonzinifbb41212020-10-05 11:31:15 +02002051summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002052summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
2053summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
2054summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
2055summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
2056summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
2057summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
2058summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
2059summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
2060summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
2061summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
2062summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
2063summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
2064summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
2065summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
2066summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
2067if config_host['TRACE_BACKENDS'].split().contains('simple')
2068 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
2069endif
2070# TODO: add back protocol and server version
2071summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
2072summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
2073summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
2074summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02002075summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002076summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
2077summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
2078summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
2079summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
2080summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
2081summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
2082summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
2083if targetos == 'windows'
2084 if 'WIN_SDK' in config_host
2085 summary_info += {'Windows SDK': config_host['WIN_SDK']}
2086 endif
2087 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
2088 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
Stefan Hajnoczi4bad7c32020-09-14 10:52:31 +01002089 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002090endif
2091summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
2092summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
2093summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
2094summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
2095summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
2096summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
2097summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04002098summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002099summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
2100summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
2101summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
2102summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
2103summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
2104summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
2105summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
2106summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
2107summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
2108summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
2109summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
Paolo Bonziniaa087962020-09-01 11:15:30 -04002110summary_info += {'memory allocator': get_option('malloc')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002111summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
2112summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
2113summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
2114summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
2115summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
2116summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
2117summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
2118summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
2119summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
2120summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
2121summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
2122summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
Richard Henderson8b18cdb2020-09-13 12:19:25 -07002123summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002124summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
2125summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
Paolo Bonzinif01496a2020-09-16 17:54:14 +02002126summary_info += {'libudev': libudev.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01002127summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
2128summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
2129summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
2130if config_host.has_key('HAVE_GDB_BIN')
2131 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
2132endif
2133summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
2134summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
2135summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
2136summary(summary_info, bool_yn: true)
2137
2138if not supported_cpus.contains(cpu)
2139 message()
2140 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
2141 message()
2142 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
2143 message('The QEMU project intends to remove support for this host CPU in')
2144 message('a future release if nobody volunteers to maintain it and to')
2145 message('provide a build host for our continuous integration setup.')
2146 message('configure has succeeded and you can continue to build, but')
2147 message('if you care about QEMU on this platform you should contact')
2148 message('us upstream at qemu-devel@nongnu.org.')
2149endif
2150
2151if not supported_oses.contains(targetos)
2152 message()
2153 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
2154 message()
2155 message('Host OS ' + targetos + 'support is not currently maintained.')
2156 message('The QEMU project intends to remove support for this host OS in')
2157 message('a future release if nobody volunteers to maintain it and to')
2158 message('provide a build host for our continuous integration setup.')
2159 message('configure has succeeded and you can continue to build, but')
2160 message('if you care about QEMU on this platform you should contact')
2161 message('us upstream at qemu-devel@nongnu.org.')
2162endif