]>
Commit | Line | Data |
---|---|---|
a5665051 | 1 | project('qemu', ['c'], meson_version: '>=0.55.0', |
a5cb7c5a PB |
2 | default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto'] + |
3 | (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []), | |
a5665051 PB |
4 | version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) |
5 | ||
6 | not_found = dependency('', required: false) | |
b29b40f4 PB |
7 | if meson.version().version_compare('>=0.56.0') |
8 | keyval = import('keyval') | |
9 | else | |
10 | keyval = import('unstable-keyval') | |
11 | endif | |
a81df1b6 | 12 | ss = import('sourceset') |
8b18cdbf | 13 | fs = import('fs') |
a81df1b6 | 14 | |
ce1c1e7a | 15 | sh = find_program('sh') |
a81df1b6 | 16 | cc = meson.get_compiler('c') |
a5665051 | 17 | config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') |
3154fee4 | 18 | enable_modules = 'CONFIG_MODULES' in config_host |
35be72ba | 19 | enable_static = 'CONFIG_STATIC' in config_host |
e3667660 YL |
20 | |
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.) | |
26 | tmpdir = meson.current_build_dir() / 'meson-private/temp' | |
8fe11232 MAL |
27 | |
28 | if get_option('qemu_suffix').startswith('/') | |
29 | error('qemu_suffix cannot start with a /') | |
30 | endif | |
31 | ||
16bf7a33 | 32 | qemu_confdir = get_option('sysconfdir') / get_option('qemu_suffix') |
ab4c0996 | 33 | qemu_datadir = get_option('datadir') / get_option('qemu_suffix') |
491e74c1 | 34 | qemu_docdir = get_option('docdir') / get_option('qemu_suffix') |
16bf7a33 PB |
35 | qemu_moddir = get_option('libdir') / get_option('qemu_suffix') |
36 | ||
37 | qemu_desktopdir = get_option('datadir') / 'applications' | |
38 | qemu_icondir = get_option('datadir') / 'icons' | |
39 | ||
859aef02 PB |
40 | config_host_data = configuration_data() |
41 | genh = [] | |
a5665051 | 42 | |
760e4327 PB |
43 | target_dirs = config_host['TARGET_DIRS'].split() |
44 | have_user = false | |
45 | have_system = false | |
46 | foreach target : target_dirs | |
47 | have_user = have_user or target.endswith('-user') | |
48 | have_system = have_system or target.endswith('-softmmu') | |
49 | endforeach | |
50 | have_tools = 'CONFIG_TOOLS' in config_host | |
51 | have_block = have_system or have_tools | |
52 | ||
201e8ed7 PB |
53 | python = import('python').find_installation() |
54 | ||
55 | supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux'] | |
6125673e | 56 | supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64', |
201e8ed7 PB |
57 | 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64'] |
58 | ||
59 | cpu = host_machine.cpu_family() | |
60 | targetos = host_machine.system() | |
61 | ||
8a19980e PB |
62 | if cpu in ['x86', 'x86_64'] |
63 | kvm_targets = ['i386-softmmu', 'x86_64-softmmu'] | |
64 | elif cpu == 'aarch64' | |
65 | kvm_targets = ['aarch64-softmmu'] | |
66 | elif cpu == 's390x' | |
67 | kvm_targets = ['s390x-softmmu'] | |
68 | elif cpu in ['ppc', 'ppc64'] | |
69 | kvm_targets = ['ppc-softmmu', 'ppc64-softmmu'] | |
fbc5884c HC |
70 | elif cpu in ['mips', 'mips64'] |
71 | kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu'] | |
8a19980e PB |
72 | else |
73 | kvm_targets = [] | |
74 | endif | |
75 | ||
76 | accelerator_targets = { 'CONFIG_KVM': kvm_targets } | |
0c3e41d4 AB |
77 | if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] |
78 | # i368 emulator provides xenpv machine type for multiple architectures | |
79 | accelerator_targets += { | |
80 | 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], | |
81 | } | |
82 | endif | |
8a19980e PB |
83 | if cpu in ['x86', 'x86_64'] |
84 | accelerator_targets += { | |
85 | 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], | |
8a19980e PB |
86 | 'CONFIG_HVF': ['x86_64-softmmu'], |
87 | 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], | |
88 | } | |
89 | endif | |
90 | ||
201e8ed7 PB |
91 | ################## |
92 | # Compiler flags # | |
93 | ################## | |
94 | ||
ff9ed62b AB |
95 | # Specify linker-script with add_project_link_arguments so that it is not placed |
96 | # within a linker --start-group/--end-group pair | |
97 | if 'CONFIG_FUZZ' in config_host | |
98 | add_project_link_arguments(['-Wl,-T,', | |
99 | (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], | |
100 | native: false, language: ['c', 'cpp', 'objc']) | |
101 | endif | |
102 | ||
a5665051 PB |
103 | add_project_arguments(config_host['QEMU_CFLAGS'].split(), |
104 | native: false, language: ['c', 'objc']) | |
105 | add_project_arguments(config_host['QEMU_CXXFLAGS'].split(), | |
106 | native: false, language: 'cpp') | |
107 | add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(), | |
108 | native: false, language: ['c', 'cpp', 'objc']) | |
a5665051 | 109 | |
1e6e616d PB |
110 | if targetos == 'linux' |
111 | add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers', | |
112 | '-isystem', 'linux-headers', | |
113 | language: ['c', 'cpp']) | |
114 | endif | |
115 | ||
116 | if 'CONFIG_TCG_INTERPRETER' in config_host | |
117 | tcg_arch = 'tci' | |
118 | elif config_host['ARCH'] == 'sparc64' | |
119 | tcg_arch = 'sparc' | |
120 | elif config_host['ARCH'] == 's390x' | |
121 | tcg_arch = 's390' | |
122 | elif config_host['ARCH'] in ['x86_64', 'x32'] | |
123 | tcg_arch = 'i386' | |
124 | elif config_host['ARCH'] == 'ppc64' | |
125 | tcg_arch = 'ppc' | |
126 | elif config_host['ARCH'] in ['riscv32', 'riscv64'] | |
127 | tcg_arch = 'riscv' | |
128 | else | |
129 | tcg_arch = config_host['ARCH'] | |
130 | endif | |
131 | add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, | |
132 | '-iquote', '.', | |
133 | '-iquote', meson.current_source_dir(), | |
134 | '-iquote', meson.current_source_dir() / 'accel/tcg', | |
135 | '-iquote', meson.current_source_dir() / 'include', | |
136 | '-iquote', meson.current_source_dir() / 'disas/libvixl', | |
137 | language: ['c', 'cpp', 'objc']) | |
c46f76d1 | 138 | |
fc929892 MAL |
139 | link_language = meson.get_external_property('link_language', 'cpp') |
140 | if link_language == 'cpp' | |
141 | add_languages('cpp', required: true, native: false) | |
142 | endif | |
a5665051 PB |
143 | if host_machine.system() == 'darwin' |
144 | add_languages('objc', required: false, native: false) | |
145 | endif | |
146 | ||
deb62371 PB |
147 | sparse = find_program('cgcc', required: get_option('sparse')) |
148 | if sparse.found() | |
968b4db3 PB |
149 | run_target('sparse', |
150 | command: [find_program('scripts/check_sparse.py'), | |
deb62371 PB |
151 | 'compile_commands.json', sparse.full_path(), '-Wbitwise', |
152 | '-Wno-transparent-union', '-Wno-old-initializer', | |
153 | '-Wno-non-pointer-null']) | |
968b4db3 PB |
154 | endif |
155 | ||
6ec0e15d PB |
156 | ########################################### |
157 | # Target-specific checks and dependencies # | |
158 | ########################################### | |
159 | ||
160 | if targetos != 'linux' and get_option('mpath').enabled() | |
161 | error('Multipath is supported only on Linux') | |
162 | endif | |
163 | ||
a81df1b6 PB |
164 | m = cc.find_library('m', required: false) |
165 | util = cc.find_library('util', required: false) | |
4a96337d | 166 | winmm = [] |
a81df1b6 | 167 | socket = [] |
04c6f1e7 | 168 | version_res = [] |
d92989aa MAL |
169 | coref = [] |
170 | iokit = [] | |
b6c7cfd4 | 171 | emulator_link_args = [] |
b4e312e9 | 172 | cocoa = not_found |
8a19980e | 173 | hvf = not_found |
a81df1b6 PB |
174 | if targetos == 'windows' |
175 | socket = cc.find_library('ws2_32') | |
4a96337d | 176 | winmm = cc.find_library('winmm') |
04c6f1e7 MAL |
177 | |
178 | win = import('windows') | |
179 | version_res = win.compile_resources('version.rc', | |
180 | depend_files: files('pc-bios/qemu-nsis.ico'), | |
181 | include_directories: include_directories('.')) | |
d92989aa MAL |
182 | elif targetos == 'darwin' |
183 | coref = dependency('appleframeworks', modules: 'CoreFoundation') | |
184 | iokit = dependency('appleframeworks', modules: 'IOKit') | |
b4e312e9 | 185 | cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) |
cfad62f1 PB |
186 | elif targetos == 'sunos' |
187 | socket = [cc.find_library('socket'), | |
188 | cc.find_library('nsl'), | |
189 | cc.find_library('resolv')] | |
190 | elif targetos == 'haiku' | |
191 | socket = [cc.find_library('posix_error_mapper'), | |
192 | cc.find_library('network'), | |
193 | cc.find_library('bsd')] | |
b6c7cfd4 PB |
194 | elif targetos == 'openbsd' |
195 | if not get_option('tcg').disabled() and target_dirs.length() > 0 | |
196 | # Disable OpenBSD W^X if available | |
197 | emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded') | |
198 | endif | |
a81df1b6 | 199 | endif |
6ec0e15d | 200 | |
8a19980e PB |
201 | accelerators = [] |
202 | if not get_option('kvm').disabled() and targetos == 'linux' | |
203 | accelerators += 'CONFIG_KVM' | |
204 | endif | |
205 | if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host | |
206 | accelerators += 'CONFIG_XEN' | |
207 | have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux' | |
208 | else | |
209 | have_xen_pci_passthrough = false | |
210 | endif | |
211 | if not get_option('whpx').disabled() and targetos == 'windows' | |
57e2a1f8 | 212 | if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64' |
8a19980e PB |
213 | error('WHPX requires 64-bit host') |
214 | elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \ | |
215 | cc.has_header('WinHvEmulation.h', required: get_option('whpx')) | |
216 | accelerators += 'CONFIG_WHPX' | |
217 | endif | |
218 | endif | |
219 | if not get_option('hvf').disabled() | |
220 | hvf = dependency('appleframeworks', modules: 'Hypervisor', | |
221 | required: get_option('hvf')) | |
222 | if hvf.found() | |
223 | accelerators += 'CONFIG_HVF' | |
224 | endif | |
225 | endif | |
226 | if not get_option('hax').disabled() | |
227 | if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd'] | |
228 | accelerators += 'CONFIG_HAX' | |
229 | endif | |
230 | endif | |
231 | if not get_option('tcg').disabled() | |
232 | if cpu not in supported_cpus | |
233 | if 'CONFIG_TCG_INTERPRETER' in config_host | |
234 | warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu)) | |
235 | else | |
236 | error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu)) | |
237 | endif | |
238 | endif | |
239 | accelerators += 'CONFIG_TCG' | |
240 | config_host += { 'CONFIG_TCG': 'y' } | |
241 | endif | |
242 | ||
243 | if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled() | |
244 | error('KVM not available on this platform') | |
245 | endif | |
246 | if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled() | |
247 | error('HVF not available on this platform') | |
248 | endif | |
249 | if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled() | |
250 | error('WHPX not available on this platform') | |
251 | endif | |
252 | if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() | |
253 | if 'CONFIG_XEN' in accelerators | |
254 | error('Xen PCI passthrough not available on this platform') | |
255 | else | |
256 | error('Xen PCI passthrough requested but Xen not enabled') | |
257 | endif | |
258 | endif | |
b4e312e9 PB |
259 | if not cocoa.found() and get_option('cocoa').enabled() |
260 | error('Cocoa not available on this platform') | |
261 | endif | |
262 | ||
6ec0e15d PB |
263 | ################ |
264 | # Dependencies # | |
265 | ################ | |
266 | ||
215b0c2f PB |
267 | # The path to glib.h is added to all compilation commands. This was |
268 | # grandfathered in from the QEMU Makefiles. | |
269 | add_project_arguments(config_host['GLIB_CFLAGS'].split(), | |
270 | native: false, language: ['c', 'cpp', 'objc']) | |
953d5a9e MAL |
271 | glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(), |
272 | link_args: config_host['GLIB_LIBS'].split()) | |
273 | # override glib dep with the configure results (for subprojects) | |
274 | meson.override_dependency('glib-2.0', glib) | |
275 | ||
a81df1b6 PB |
276 | gio = not_found |
277 | if 'CONFIG_GIO' in config_host | |
278 | gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(), | |
279 | link_args: config_host['GIO_LIBS'].split()) | |
280 | endif | |
281 | lttng = not_found | |
282 | if 'CONFIG_TRACE_UST' in config_host | |
283 | lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split()) | |
284 | endif | |
285 | urcubp = not_found | |
286 | if 'CONFIG_TRACE_UST' in config_host | |
287 | urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split()) | |
288 | endif | |
46859d93 DB |
289 | gcrypt = not_found |
290 | if 'CONFIG_GCRYPT' in config_host | |
291 | gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(), | |
292 | link_args: config_host['GCRYPT_LIBS'].split()) | |
293 | endif | |
a81df1b6 PB |
294 | nettle = not_found |
295 | if 'CONFIG_NETTLE' in config_host | |
296 | nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(), | |
297 | link_args: config_host['NETTLE_LIBS'].split()) | |
298 | endif | |
299 | gnutls = not_found | |
300 | if 'CONFIG_GNUTLS' in config_host | |
301 | gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(), | |
302 | link_args: config_host['GNUTLS_LIBS'].split()) | |
303 | endif | |
b7612f45 PB |
304 | pixman = not_found |
305 | if have_system or have_tools | |
306 | pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', | |
1a94933f | 307 | method: 'pkg-config', static: enable_static) |
b7612f45 | 308 | endif |
5e7fbd25 MAL |
309 | pam = not_found |
310 | if 'CONFIG_AUTH_PAM' in config_host | |
311 | pam = cc.find_library('pam') | |
312 | endif | |
5e5733e5 | 313 | libaio = cc.find_library('aio', required: false) |
1ffb3bbb | 314 | zlib = dependency('zlib', required: true, static: enable_static) |
5e5733e5 MAL |
315 | linux_io_uring = not_found |
316 | if 'CONFIG_LINUX_IO_URING' in config_host | |
317 | linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(), | |
318 | link_args: config_host['LINUX_IO_URING_LIBS'].split()) | |
319 | endif | |
320 | libxml2 = not_found | |
321 | if 'CONFIG_LIBXML2' in config_host | |
322 | libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(), | |
323 | link_args: config_host['LIBXML2_LIBS'].split()) | |
324 | endif | |
325 | libnfs = not_found | |
30045c05 PB |
326 | if not get_option('libnfs').auto() or have_block |
327 | libnfs = dependency('libnfs', version: '>=1.9.3', | |
328 | required: get_option('libnfs'), | |
329 | method: 'pkg-config', static: enable_static) | |
5e5733e5 | 330 | endif |
ec0d5893 MAL |
331 | libattr = not_found |
332 | if 'CONFIG_ATTR' in config_host | |
333 | libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split()) | |
334 | endif | |
3f99cf57 | 335 | seccomp = not_found |
90835c2b PB |
336 | if not get_option('seccomp').auto() or have_system or have_tools |
337 | seccomp = dependency('libseccomp', version: '>=2.3.0', | |
338 | required: get_option('seccomp'), | |
339 | method: 'pkg-config', static: enable_static) | |
3f99cf57 PB |
340 | endif |
341 | libcap_ng = not_found | |
342 | if 'CONFIG_LIBCAP_NG' in config_host | |
343 | libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split()) | |
344 | endif | |
1917ec6d PB |
345 | if get_option('xkbcommon').auto() and not have_system and not have_tools |
346 | xkbcommon = not_found | |
347 | else | |
348 | xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), | |
1a94933f | 349 | method: 'pkg-config', static: enable_static) |
ade60d4f | 350 | endif |
cdaf0722 MAL |
351 | vde = not_found |
352 | if config_host.has_key('CONFIG_VDE') | |
353 | vde = declare_dependency(link_args: config_host['VDE_LIBS'].split()) | |
354 | endif | |
478e943f PB |
355 | pulse = not_found |
356 | if 'CONFIG_LIBPULSE' in config_host | |
357 | pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(), | |
358 | link_args: config_host['PULSE_LIBS'].split()) | |
359 | endif | |
360 | alsa = not_found | |
361 | if 'CONFIG_ALSA' in config_host | |
362 | alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(), | |
363 | link_args: config_host['ALSA_LIBS'].split()) | |
364 | endif | |
365 | jack = not_found | |
366 | if 'CONFIG_LIBJACK' in config_host | |
367 | jack = declare_dependency(link_args: config_host['JACK_LIBS'].split()) | |
368 | endif | |
2634733c | 369 | spice = not_found |
d72c34cc | 370 | spice_headers = not_found |
2634733c PB |
371 | if 'CONFIG_SPICE' in config_host |
372 | spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(), | |
373 | link_args: config_host['SPICE_LIBS'].split()) | |
d72c34cc | 374 | spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split()) |
2634733c | 375 | endif |
5ee24e78 | 376 | rt = cc.find_library('rt', required: false) |
ccf7afa5 PB |
377 | libdl = not_found |
378 | if 'CONFIG_PLUGIN' in config_host | |
379 | libdl = cc.find_library('dl', required: true) | |
380 | endif | |
99650b62 | 381 | libiscsi = not_found |
9db405a3 PB |
382 | if not get_option('libiscsi').auto() or have_block |
383 | libiscsi = dependency('libiscsi', version: '>=1.9.0', | |
384 | required: get_option('libiscsi'), | |
385 | method: 'pkg-config', static: enable_static) | |
99650b62 | 386 | endif |
5e5733e5 | 387 | zstd = not_found |
b1def33d PB |
388 | if not get_option('zstd').auto() or have_block |
389 | zstd = dependency('libzstd', version: '>=1.4.0', | |
390 | required: get_option('zstd'), | |
391 | method: 'pkg-config', static: enable_static) | |
5e5733e5 | 392 | endif |
ea458960 MAL |
393 | gbm = not_found |
394 | if 'CONFIG_GBM' in config_host | |
395 | gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(), | |
396 | link_args: config_host['GBM_LIBS'].split()) | |
397 | endif | |
398 | virgl = not_found | |
399 | if 'CONFIG_VIRGL' in config_host | |
400 | virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(), | |
401 | link_args: config_host['VIRGL_LIBS'].split()) | |
402 | endif | |
1d7bb6ab | 403 | curl = not_found |
f9cd86fe PB |
404 | if not get_option('curl').auto() or have_block |
405 | curl = dependency('libcurl', version: '>=7.29.0', | |
406 | method: 'pkg-config', | |
407 | required: get_option('curl'), | |
408 | static: enable_static) | |
1d7bb6ab | 409 | endif |
f15bff25 | 410 | libudev = not_found |
f01496a3 | 411 | if targetos == 'linux' and (have_system or have_tools) |
6ec0e15d | 412 | libudev = dependency('libudev', |
a0fbbb6e | 413 | method: 'pkg-config', |
5c53015a | 414 | required: get_option('libudev'), |
6ec0e15d PB |
415 | static: enable_static) |
416 | endif | |
417 | ||
5c53015a | 418 | mpathlibs = [libudev] |
6ec0e15d PB |
419 | mpathpersist = not_found |
420 | mpathpersist_new_api = false | |
421 | if targetos == 'linux' and have_tools and not get_option('mpath').disabled() | |
422 | mpath_test_source_new = ''' | |
423 | #include <libudev.h> | |
424 | #include <mpath_persist.h> | |
425 | unsigned mpath_mx_alloc_len = 1024; | |
426 | int logsink; | |
427 | static struct config *multipath_conf; | |
428 | extern struct udev *udev; | |
429 | extern struct config *get_multipath_config(void); | |
430 | extern void put_multipath_config(struct config *conf); | |
431 | struct udev *udev; | |
432 | struct config *get_multipath_config(void) { return multipath_conf; } | |
433 | void put_multipath_config(struct config *conf) { } | |
434 | int main(void) { | |
435 | udev = udev_new(); | |
436 | multipath_conf = mpath_lib_init(); | |
437 | return 0; | |
438 | }''' | |
439 | mpath_test_source_old = ''' | |
440 | #include <libudev.h> | |
441 | #include <mpath_persist.h> | |
442 | unsigned mpath_mx_alloc_len = 1024; | |
443 | int logsink; | |
444 | int main(void) { | |
445 | struct udev *udev = udev_new(); | |
446 | mpath_lib_init(udev); | |
447 | return 0; | |
448 | }''' | |
5c53015a PB |
449 | libmpathpersist = cc.find_library('mpathpersist', |
450 | required: get_option('mpath'), | |
451 | static: enable_static) | |
452 | if libmpathpersist.found() | |
453 | mpathlibs += libmpathpersist | |
454 | if enable_static | |
455 | mpathlibs += cc.find_library('devmapper', | |
456 | required: get_option('mpath'), | |
457 | static: enable_static) | |
43b43a40 | 458 | endif |
5c53015a PB |
459 | mpathlibs += cc.find_library('multipath', |
460 | required: get_option('mpath'), | |
461 | static: enable_static) | |
462 | foreach lib: mpathlibs | |
463 | if not lib.found() | |
464 | mpathlibs = [] | |
465 | break | |
466 | endif | |
467 | endforeach | |
468 | if mpathlibs.length() == 0 | |
469 | msg = 'Dependencies missing for libmpathpersist' | |
470 | elif cc.links(mpath_test_source_new, dependencies: mpathlibs) | |
6ec0e15d PB |
471 | mpathpersist = declare_dependency(dependencies: mpathlibs) |
472 | mpathpersist_new_api = true | |
473 | elif cc.links(mpath_test_source_old, dependencies: mpathlibs) | |
474 | mpathpersist = declare_dependency(dependencies: mpathlibs) | |
475 | else | |
5c53015a PB |
476 | msg = 'Cannot detect libmpathpersist API' |
477 | endif | |
478 | if not mpathpersist.found() | |
6ec0e15d | 479 | if get_option('mpath').enabled() |
5c53015a | 480 | error(msg) |
6ec0e15d | 481 | else |
5c53015a | 482 | warning(msg + ', disabling') |
6ec0e15d PB |
483 | endif |
484 | endif | |
485 | endif | |
f15bff25 | 486 | endif |
6ec0e15d | 487 | |
5285e593 | 488 | iconv = not_found |
5285e593 | 489 | curses = not_found |
30fe76b1 | 490 | if have_system and not get_option('curses').disabled() |
925a40df PB |
491 | curses_test = ''' |
492 | #include <locale.h> | |
493 | #include <curses.h> | |
494 | #include <wchar.h> | |
495 | int main(void) { | |
496 | wchar_t wch = L'w'; | |
497 | setlocale(LC_ALL, ""); | |
498 | resize_term(0, 0); | |
499 | addwstr(L"wide chars\n"); | |
500 | addnwstr(&wch, 1); | |
501 | add_wch(WACS_DEGREE); | |
502 | return 0; | |
503 | }''' | |
504 | ||
ca31e307 YL |
505 | curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw'] |
506 | foreach curses_dep : curses_dep_list | |
507 | if not curses.found() | |
508 | curses = dependency(curses_dep, | |
509 | required: false, | |
510 | method: 'pkg-config', | |
511 | static: enable_static) | |
512 | endif | |
513 | endforeach | |
925a40df | 514 | msg = get_option('curses').enabled() ? 'curses library not found' : '' |
0dbce6ef | 515 | curses_compile_args = ['-DNCURSES_WIDECHAR'] |
925a40df | 516 | if curses.found() |
0dbce6ef PB |
517 | if cc.links(curses_test, args: curses_compile_args, dependencies: [curses]) |
518 | curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses]) | |
925a40df PB |
519 | else |
520 | msg = 'curses package not usable' | |
521 | curses = not_found | |
5285e593 YL |
522 | endif |
523 | endif | |
925a40df | 524 | if not curses.found() |
925a40df PB |
525 | has_curses_h = cc.has_header('curses.h', args: curses_compile_args) |
526 | if targetos != 'windows' and not has_curses_h | |
527 | message('Trying with /usr/include/ncursesw') | |
528 | curses_compile_args += ['-I/usr/include/ncursesw'] | |
529 | has_curses_h = cc.has_header('curses.h', args: curses_compile_args) | |
530 | endif | |
531 | if has_curses_h | |
532 | curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw']) | |
533 | foreach curses_libname : curses_libname_list | |
5285e593 YL |
534 | libcurses = cc.find_library(curses_libname, |
535 | required: false, | |
5285e593 | 536 | static: enable_static) |
925a40df PB |
537 | if libcurses.found() |
538 | if cc.links(curses_test, args: curses_compile_args, dependencies: libcurses) | |
539 | curses = declare_dependency(compile_args: curses_compile_args, | |
540 | dependencies: [libcurses]) | |
541 | break | |
542 | else | |
543 | msg = 'curses library not usable' | |
544 | endif | |
5285e593 | 545 | endif |
925a40df PB |
546 | endforeach |
547 | endif | |
548 | endif | |
549 | if not get_option('iconv').disabled() | |
550 | foreach link_args : [ ['-liconv'], [] ] | |
551 | # Programs will be linked with glib and this will bring in libiconv on FreeBSD. | |
552 | # We need to use libiconv if available because mixing libiconv's headers with | |
553 | # the system libc does not work. | |
554 | # However, without adding glib to the dependencies -L/usr/local/lib will not be | |
555 | # included in the command line and libiconv will not be found. | |
556 | if cc.links(''' | |
557 | #include <iconv.h> | |
558 | int main(void) { | |
559 | iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); | |
560 | return conv != (iconv_t) -1; | |
561 | }''', args: config_host['GLIB_CFLAGS'].split() + config_host['GLIB_LIBS'].split() + link_args) | |
562 | iconv = declare_dependency(link_args: link_args, dependencies: glib) | |
563 | break | |
5285e593 | 564 | endif |
30fe76b1 PB |
565 | endforeach |
566 | endif | |
925a40df PB |
567 | if curses.found() and not iconv.found() |
568 | if get_option('iconv').enabled() | |
569 | error('iconv not available') | |
570 | endif | |
571 | msg = 'iconv required for curses UI but not available' | |
572 | curses = not_found | |
573 | endif | |
574 | if not curses.found() and msg != '' | |
575 | if get_option('curses').enabled() | |
576 | error(msg) | |
30fe76b1 | 577 | else |
925a40df | 578 | warning(msg + ', disabling') |
30fe76b1 | 579 | endif |
5285e593 YL |
580 | endif |
581 | endif | |
582 | ||
2634733c | 583 | brlapi = not_found |
8c6d4ff4 PB |
584 | if not get_option('brlapi').auto() or have_system |
585 | brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'], | |
586 | required: get_option('brlapi'), | |
587 | static: enable_static) | |
588 | if brlapi.found() and not cc.links(''' | |
589 | #include <brlapi.h> | |
590 | #include <stddef.h> | |
591 | int main(void) { return brlapi__openConnection (NULL, NULL, NULL); }''', dependencies: brlapi) | |
592 | brlapi = not_found | |
593 | if get_option('brlapi').enabled() | |
594 | error('could not link brlapi') | |
595 | else | |
596 | warning('could not link brlapi, disabling') | |
597 | endif | |
598 | endif | |
2634733c | 599 | endif |
35be72ba | 600 | |
760e4327 PB |
601 | sdl = not_found |
602 | if have_system | |
363743da | 603 | sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) |
760e4327 PB |
604 | sdl_image = not_found |
605 | endif | |
35be72ba PB |
606 | if sdl.found() |
607 | # work around 2.0.8 bug | |
608 | sdl = declare_dependency(compile_args: '-Wno-undef', | |
609 | dependencies: sdl) | |
7161a433 | 610 | sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), |
1a94933f | 611 | method: 'pkg-config', static: enable_static) |
35be72ba PB |
612 | else |
613 | if get_option('sdl_image').enabled() | |
a8dc2ace ST |
614 | error('sdl-image required, but SDL was @0@'.format( |
615 | get_option('sdl').disabled() ? 'disabled' : 'not found')) | |
35be72ba PB |
616 | endif |
617 | sdl_image = not_found | |
2634733c | 618 | endif |
35be72ba | 619 | |
5e5733e5 | 620 | rbd = not_found |
fabd1e93 PB |
621 | if not get_option('rbd').auto() or have_block |
622 | librados = cc.find_library('rados', required: get_option('rbd'), | |
623 | static: enable_static) | |
624 | librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'], | |
625 | required: get_option('rbd'), | |
626 | static: enable_static) | |
627 | if librados.found() and librbd.found() and cc.links(''' | |
628 | #include <stdio.h> | |
629 | #include <rbd/librbd.h> | |
630 | int main(void) { | |
631 | rados_t cluster; | |
632 | rados_create(&cluster, NULL); | |
633 | return 0; | |
634 | }''', dependencies: [librbd, librados]) | |
635 | rbd = declare_dependency(dependencies: [librbd, librados]) | |
636 | endif | |
5e5733e5 | 637 | endif |
fabd1e93 | 638 | |
5e5733e5 | 639 | glusterfs = not_found |
08821ca2 PB |
640 | glusterfs_ftruncate_has_stat = false |
641 | glusterfs_iocb_has_stat = false | |
642 | if not get_option('glusterfs').auto() or have_block | |
643 | glusterfs = dependency('glusterfs-api', version: '>=3', | |
644 | required: get_option('glusterfs'), | |
645 | method: 'pkg-config', static: enable_static) | |
646 | if glusterfs.found() | |
647 | glusterfs_ftruncate_has_stat = cc.links(''' | |
648 | #include <glusterfs/api/glfs.h> | |
649 | ||
650 | int | |
651 | main(void) | |
652 | { | |
653 | /* new glfs_ftruncate() passes two additional args */ | |
654 | return glfs_ftruncate(NULL, 0, NULL, NULL); | |
655 | } | |
656 | ''', dependencies: glusterfs) | |
657 | glusterfs_iocb_has_stat = cc.links(''' | |
658 | #include <glusterfs/api/glfs.h> | |
659 | ||
660 | /* new glfs_io_cbk() passes two additional glfs_stat structs */ | |
661 | static void | |
662 | glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) | |
663 | {} | |
664 | ||
665 | int | |
666 | main(void) | |
667 | { | |
668 | glfs_io_cbk iocb = &glusterfs_iocb; | |
669 | iocb(NULL, 0 , NULL, NULL, NULL); | |
670 | return 0; | |
671 | } | |
672 | ''', dependencies: glusterfs) | |
673 | endif | |
5e5733e5 MAL |
674 | endif |
675 | libssh = not_found | |
676 | if 'CONFIG_LIBSSH' in config_host | |
677 | libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(), | |
678 | link_args: config_host['LIBSSH_LIBS'].split()) | |
679 | endif | |
680 | libbzip2 = not_found | |
29ba6116 PB |
681 | if not get_option('bzip2').auto() or have_block |
682 | libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'], | |
683 | required: get_option('bzip2'), | |
684 | static: enable_static) | |
685 | if libbzip2.found() and not cc.links(''' | |
686 | #include <bzlib.h> | |
687 | int main(void) { BZ2_bzlibVersion(); return 0; }''', dependencies: libbzip2) | |
688 | libbzip2 = not_found | |
689 | if get_option('bzip2').enabled() | |
690 | error('could not link libbzip2') | |
691 | else | |
692 | warning('could not link libbzip2, disabling') | |
693 | endif | |
694 | endif | |
5e5733e5 | 695 | endif |
ecea3696 | 696 | |
5e5733e5 | 697 | liblzfse = not_found |
ecea3696 PB |
698 | if not get_option('lzfse').auto() or have_block |
699 | liblzfse = cc.find_library('lzfse', has_headers: ['lzfse.h'], | |
700 | required: get_option('lzfse'), | |
701 | static: enable_static) | |
702 | endif | |
703 | if liblzfse.found() and not cc.links(''' | |
704 | #include <lzfse.h> | |
705 | int main(void) { lzfse_decode_scratch_size(); return 0; }''', dependencies: liblzfse) | |
706 | liblzfse = not_found | |
707 | if get_option('lzfse').enabled() | |
708 | error('could not link liblzfse') | |
709 | else | |
710 | warning('could not link liblzfse, disabling') | |
711 | endif | |
5e5733e5 | 712 | endif |
ecea3696 | 713 | |
478e943f PB |
714 | oss = not_found |
715 | if 'CONFIG_AUDIO_OSS' in config_host | |
716 | oss = declare_dependency(link_args: config_host['OSS_LIBS'].split()) | |
717 | endif | |
718 | dsound = not_found | |
719 | if 'CONFIG_AUDIO_DSOUND' in config_host | |
720 | dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split()) | |
721 | endif | |
722 | coreaudio = not_found | |
723 | if 'CONFIG_AUDIO_COREAUDIO' in config_host | |
724 | coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split()) | |
2b1ccdf4 MAL |
725 | endif |
726 | opengl = not_found | |
727 | if 'CONFIG_OPENGL' in config_host | |
de2d3005 PB |
728 | opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), |
729 | link_args: config_host['OPENGL_LIBS'].split()) | |
2b1ccdf4 MAL |
730 | endif |
731 | gtk = not_found | |
732 | if 'CONFIG_GTK' in config_host | |
733 | gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), | |
734 | link_args: config_host['GTK_LIBS'].split()) | |
735 | endif | |
736 | vte = not_found | |
737 | if 'CONFIG_VTE' in config_host | |
738 | vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), | |
739 | link_args: config_host['VTE_LIBS'].split()) | |
740 | endif | |
741 | x11 = not_found | |
742 | if 'CONFIG_X11' in config_host | |
743 | x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), | |
744 | link_args: config_host['X11_LIBS'].split()) | |
745 | endif | |
a0b93237 | 746 | vnc = not_found |
2b1ccdf4 | 747 | png = not_found |
2b1ccdf4 | 748 | jpeg = not_found |
2b1ccdf4 | 749 | sasl = not_found |
a0b93237 PB |
750 | if get_option('vnc').enabled() |
751 | vnc = declare_dependency() # dummy dependency | |
752 | png = dependency('libpng', required: get_option('vnc_png'), | |
1a94933f | 753 | method: 'pkg-config', static: enable_static) |
8e242b3c PB |
754 | jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'), |
755 | method: 'pkg-config', static: enable_static) | |
a0b93237 PB |
756 | sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], |
757 | required: get_option('vnc_sasl'), | |
758 | static: enable_static) | |
759 | if sasl.found() | |
760 | sasl = declare_dependency(dependencies: sasl, | |
761 | compile_args: '-DSTRUCT_IOVEC_DEFINED') | |
762 | endif | |
478e943f | 763 | endif |
241611ea | 764 | |
708eab42 | 765 | snappy = not_found |
241611ea PB |
766 | if not get_option('snappy').auto() or have_system |
767 | snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'], | |
768 | required: get_option('snappy'), | |
769 | static: enable_static) | |
770 | endif | |
771 | if snappy.found() and not cc.links(''' | |
772 | #include <snappy-c.h> | |
773 | int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy) | |
774 | snappy = not_found | |
775 | if get_option('snappy').enabled() | |
776 | error('could not link libsnappy') | |
777 | else | |
778 | warning('could not link libsnappy, disabling') | |
779 | endif | |
708eab42 | 780 | endif |
0c32a0ae | 781 | |
708eab42 | 782 | lzo = not_found |
0c32a0ae PB |
783 | if not get_option('lzo').auto() or have_system |
784 | lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'], | |
785 | required: get_option('lzo'), | |
786 | static: enable_static) | |
787 | endif | |
788 | if lzo.found() and not cc.links(''' | |
789 | #include <lzo/lzo1x.h> | |
790 | int main(void) { lzo_version(); return 0; }''', dependencies: lzo) | |
791 | lzo = not_found | |
792 | if get_option('lzo').enabled() | |
793 | error('could not link liblzo2') | |
794 | else | |
795 | warning('could not link liblzo2, disabling') | |
796 | endif | |
708eab42 | 797 | endif |
0c32a0ae | 798 | |
55166230 MAL |
799 | rdma = not_found |
800 | if 'CONFIG_RDMA' in config_host | |
801 | rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split()) | |
802 | endif | |
ab318051 MAL |
803 | numa = not_found |
804 | if 'CONFIG_NUMA' in config_host | |
805 | numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split()) | |
806 | endif | |
582ea95f MAL |
807 | xen = not_found |
808 | if 'CONFIG_XEN_BACKEND' in config_host | |
809 | xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(), | |
810 | link_args: config_host['XEN_LIBS'].split()) | |
811 | endif | |
06677ce1 PB |
812 | cacard = not_found |
813 | if 'CONFIG_SMARTCARD' in config_host | |
814 | cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(), | |
815 | link_args: config_host['SMARTCARD_LIBS'].split()) | |
816 | endif | |
0a40bcb7 CB |
817 | u2f = not_found |
818 | if have_system | |
819 | u2f = dependency('u2f-emu', required: get_option('u2f'), | |
820 | method: 'pkg-config', | |
821 | static: enable_static) | |
822 | endif | |
06677ce1 PB |
823 | usbredir = not_found |
824 | if 'CONFIG_USB_REDIR' in config_host | |
825 | usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(), | |
826 | link_args: config_host['USB_REDIR_LIBS'].split()) | |
827 | endif | |
828 | libusb = not_found | |
829 | if 'CONFIG_USB_LIBUSB' in config_host | |
830 | libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(), | |
831 | link_args: config_host['LIBUSB_LIBS'].split()) | |
832 | endif | |
c9322ab5 MAL |
833 | libpmem = not_found |
834 | if 'CONFIG_LIBPMEM' in config_host | |
835 | libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(), | |
836 | link_args: config_host['LIBPMEM_LIBS'].split()) | |
837 | endif | |
c7c91a74 BR |
838 | libdaxctl = not_found |
839 | if 'CONFIG_LIBDAXCTL' in config_host | |
840 | libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split()) | |
841 | endif | |
8ce0a45f MAL |
842 | tasn1 = not_found |
843 | if 'CONFIG_TASN1' in config_host | |
844 | tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(), | |
845 | link_args: config_host['TASN1_LIBS'].split()) | |
846 | endif | |
af04e89d MAL |
847 | keyutils = dependency('libkeyutils', required: false, |
848 | method: 'pkg-config', static: enable_static) | |
a81df1b6 | 849 | |
3909def8 MAL |
850 | has_gettid = cc.has_function('gettid') |
851 | ||
aa087962 PB |
852 | # Malloc tests |
853 | ||
854 | malloc = [] | |
855 | if get_option('malloc') == 'system' | |
856 | has_malloc_trim = \ | |
857 | not get_option('malloc_trim').disabled() and \ | |
858 | cc.links('''#include <malloc.h> | |
859 | int main(void) { malloc_trim(0); return 0; }''') | |
860 | else | |
861 | has_malloc_trim = false | |
862 | malloc = cc.find_library(get_option('malloc'), required: true) | |
863 | endif | |
864 | if not has_malloc_trim and get_option('malloc_trim').enabled() | |
865 | if get_option('malloc') == 'system' | |
866 | error('malloc_trim not available on this platform.') | |
867 | else | |
868 | error('malloc_trim not available with non-libc memory allocator') | |
869 | endif | |
870 | endif | |
871 | ||
84e319a5 HR |
872 | # Check whether the glibc provides statx() |
873 | ||
874 | statx_test = ''' | |
875 | #ifndef _GNU_SOURCE | |
876 | #define _GNU_SOURCE | |
877 | #endif | |
878 | #include <sys/stat.h> | |
879 | int main(void) { | |
880 | struct statx statxbuf; | |
881 | statx(0, "", 0, STATX_BASIC_STATS, &statxbuf); | |
882 | return 0; | |
883 | }''' | |
884 | ||
885 | has_statx = cc.links(statx_test) | |
886 | ||
eb6a3886 SH |
887 | have_vhost_user_blk_server = (targetos == 'linux' and |
888 | 'CONFIG_VHOST_USER' in config_host) | |
e5e856c1 SH |
889 | |
890 | if get_option('vhost_user_blk_server').enabled() | |
891 | if targetos != 'linux' | |
892 | error('vhost_user_blk_server requires linux') | |
eb6a3886 SH |
893 | elif 'CONFIG_VHOST_USER' not in config_host |
894 | error('vhost_user_blk_server requires vhost-user support') | |
e5e856c1 SH |
895 | endif |
896 | elif get_option('vhost_user_blk_server').disabled() or not have_system | |
897 | have_vhost_user_blk_server = false | |
898 | endif | |
899 | ||
9e62ba48 | 900 | |
df4ea709 HR |
901 | if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() |
902 | error('Cannot enable fuse-lseek while fuse is disabled') | |
903 | endif | |
904 | ||
a484a719 HR |
905 | fuse = dependency('fuse3', required: get_option('fuse'), |
906 | version: '>=3.1', method: 'pkg-config', | |
907 | static: enable_static) | |
908 | ||
df4ea709 HR |
909 | fuse_lseek = not_found |
910 | if not get_option('fuse_lseek').disabled() | |
911 | if fuse.version().version_compare('>=3.8') | |
912 | # Dummy dependency | |
913 | fuse_lseek = declare_dependency() | |
914 | elif get_option('fuse_lseek').enabled() | |
915 | if fuse.found() | |
916 | error('fuse-lseek requires libfuse >=3.8, found ' + fuse.version()) | |
917 | else | |
918 | error('fuse-lseek requires libfuse, which was not found') | |
919 | endif | |
920 | endif | |
921 | endif | |
922 | ||
9e62ba48 DB |
923 | if get_option('cfi') |
924 | cfi_flags=[] | |
925 | # Check for dependency on LTO | |
926 | if not get_option('b_lto') | |
927 | error('Selected Control-Flow Integrity but LTO is disabled') | |
928 | endif | |
929 | if config_host.has_key('CONFIG_MODULES') | |
930 | error('Selected Control-Flow Integrity is not compatible with modules') | |
931 | endif | |
932 | # Check for cfi flags. CFI requires LTO so we can't use | |
933 | # get_supported_arguments, but need a more complex "compiles" which allows | |
934 | # custom arguments | |
935 | if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall', | |
936 | args: ['-flto', '-fsanitize=cfi-icall'] ) | |
937 | cfi_flags += '-fsanitize=cfi-icall' | |
938 | else | |
939 | error('-fsanitize=cfi-icall is not supported by the compiler') | |
940 | endif | |
941 | if cc.compiles('int main () { return 0; }', | |
942 | name: '-fsanitize-cfi-icall-generalize-pointers', | |
943 | args: ['-flto', '-fsanitize=cfi-icall', | |
944 | '-fsanitize-cfi-icall-generalize-pointers'] ) | |
945 | cfi_flags += '-fsanitize-cfi-icall-generalize-pointers' | |
946 | else | |
947 | error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler') | |
948 | endif | |
949 | if get_option('cfi_debug') | |
950 | if cc.compiles('int main () { return 0; }', | |
951 | name: '-fno-sanitize-trap=cfi-icall', | |
952 | args: ['-flto', '-fsanitize=cfi-icall', | |
953 | '-fno-sanitize-trap=cfi-icall'] ) | |
954 | cfi_flags += '-fno-sanitize-trap=cfi-icall' | |
955 | else | |
956 | error('-fno-sanitize-trap=cfi-icall is not supported by the compiler') | |
957 | endif | |
958 | endif | |
959 | add_project_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) | |
960 | add_project_link_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) | |
961 | endif | |
962 | ||
a0c9162c PB |
963 | ################# |
964 | # config-host.h # | |
965 | ################# | |
859aef02 | 966 | |
16bf7a33 PB |
967 | config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir')) |
968 | config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix')) | |
969 | config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir) | |
970 | config_host_data.set_quoted('CONFIG_QEMU_DATADIR', get_option('prefix') / qemu_datadir) | |
971 | config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix') / qemu_desktopdir) | |
972 | config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_firmwarepath')) | |
973 | config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') / get_option('libexecdir')) | |
974 | config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') / qemu_icondir) | |
975 | config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') / get_option('localedir')) | |
976 | config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') / get_option('localstatedir')) | |
977 | config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) | |
978 | config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) | |
979 | ||
8c6d4ff4 | 980 | config_host_data.set('CONFIG_BRLAPI', brlapi.found()) |
b4e312e9 | 981 | config_host_data.set('CONFIG_COCOA', cocoa.found()) |
f01496a3 | 982 | config_host_data.set('CONFIG_LIBUDEV', libudev.found()) |
0c32a0ae | 983 | config_host_data.set('CONFIG_LZO', lzo.found()) |
6ec0e15d PB |
984 | config_host_data.set('CONFIG_MPATH', mpathpersist.found()) |
985 | config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) | |
f9cd86fe | 986 | config_host_data.set('CONFIG_CURL', curl.found()) |
5285e593 | 987 | config_host_data.set('CONFIG_CURSES', curses.found()) |
08821ca2 PB |
988 | config_host_data.set('CONFIG_GLUSTERFS', glusterfs.found()) |
989 | if glusterfs.found() | |
990 | config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT', glusterfs.version().version_compare('>=4')) | |
991 | config_host_data.set('CONFIG_GLUSTERFS_DISCARD', glusterfs.version().version_compare('>=5')) | |
992 | config_host_data.set('CONFIG_GLUSTERFS_FALLOCATE', glusterfs.version().version_compare('>=6')) | |
993 | config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL', glusterfs.version().version_compare('>=6')) | |
994 | config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat) | |
995 | config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat) | |
996 | endif | |
9db405a3 | 997 | config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) |
30045c05 | 998 | config_host_data.set('CONFIG_LIBNFS', libnfs.found()) |
fabd1e93 | 999 | config_host_data.set('CONFIG_RBD', rbd.found()) |
35be72ba PB |
1000 | config_host_data.set('CONFIG_SDL', sdl.found()) |
1001 | config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) | |
90835c2b | 1002 | config_host_data.set('CONFIG_SECCOMP', seccomp.found()) |
241611ea | 1003 | config_host_data.set('CONFIG_SNAPPY', snappy.found()) |
e5e856c1 | 1004 | config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) |
a0b93237 PB |
1005 | config_host_data.set('CONFIG_VNC', vnc.found()) |
1006 | config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) | |
1007 | config_host_data.set('CONFIG_VNC_PNG', png.found()) | |
1008 | config_host_data.set('CONFIG_VNC_SASL', sasl.found()) | |
4113f4cf | 1009 | config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) |
af04e89d | 1010 | config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) |
3909def8 | 1011 | config_host_data.set('CONFIG_GETTID', has_gettid) |
aa087962 | 1012 | config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) |
84e319a5 | 1013 | config_host_data.set('CONFIG_STATX', has_statx) |
b1def33d | 1014 | config_host_data.set('CONFIG_ZSTD', zstd.found()) |
a484a719 | 1015 | config_host_data.set('CONFIG_FUSE', fuse.found()) |
df4ea709 | 1016 | config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) |
9e62ba48 | 1017 | config_host_data.set('CONFIG_CFI', get_option('cfi')) |
859aef02 PB |
1018 | config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) |
1019 | config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) | |
1020 | config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) | |
1021 | config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) | |
1022 | ||
48f670ec | 1023 | config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) |
2964be52 | 1024 | config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) |
2802d91d | 1025 | config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) |
ded5d78c | 1026 | config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) |
4a9d5f89 | 1027 | config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) |
88c78f16 | 1028 | config_host_data.set('HAVE_SYS_SIGNAL_H', cc.has_header('sys/signal.h')) |
ded5d78c | 1029 | |
765686d6 | 1030 | ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target |
859aef02 | 1031 | arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] |
16bf7a33 | 1032 | strings = ['HOST_DSOSUF', 'CONFIG_IASL'] |
859aef02 | 1033 | foreach k, v: config_host |
765686d6 PB |
1034 | if ignored.contains(k) |
1035 | # do nothing | |
1036 | elif arrays.contains(k) | |
859aef02 PB |
1037 | if v != '' |
1038 | v = '"' + '", "'.join(v.split()) + '", ' | |
1039 | endif | |
1040 | config_host_data.set(k, v) | |
1041 | elif k == 'ARCH' | |
1042 | config_host_data.set('HOST_' + v.to_upper(), 1) | |
1043 | elif strings.contains(k) | |
1044 | if not k.startswith('CONFIG_') | |
1045 | k = 'CONFIG_' + k.to_upper() | |
1046 | endif | |
1047 | config_host_data.set_quoted(k, v) | |
1048 | elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_') | |
1049 | config_host_data.set(k, v == 'y' ? 1 : v) | |
1050 | endif | |
1051 | endforeach | |
859aef02 | 1052 | |
a0c9162c PB |
1053 | ######################## |
1054 | # Target configuration # | |
1055 | ######################## | |
1056 | ||
2becc36a | 1057 | minikconf = find_program('scripts/minikconf.py') |
05512f55 | 1058 | config_all = {} |
a98006bc | 1059 | config_all_devices = {} |
ca0fc784 | 1060 | config_all_disas = {} |
2becc36a PB |
1061 | config_devices_mak_list = [] |
1062 | config_devices_h = {} | |
859aef02 | 1063 | config_target_h = {} |
2becc36a | 1064 | config_target_mak = {} |
ca0fc784 PB |
1065 | |
1066 | disassemblers = { | |
1067 | 'alpha' : ['CONFIG_ALPHA_DIS'], | |
1068 | 'arm' : ['CONFIG_ARM_DIS'], | |
1069 | 'avr' : ['CONFIG_AVR_DIS'], | |
1070 | 'cris' : ['CONFIG_CRIS_DIS'], | |
1071 | 'hppa' : ['CONFIG_HPPA_DIS'], | |
1072 | 'i386' : ['CONFIG_I386_DIS'], | |
1073 | 'x86_64' : ['CONFIG_I386_DIS'], | |
1074 | 'x32' : ['CONFIG_I386_DIS'], | |
1075 | 'lm32' : ['CONFIG_LM32_DIS'], | |
1076 | 'm68k' : ['CONFIG_M68K_DIS'], | |
1077 | 'microblaze' : ['CONFIG_MICROBLAZE_DIS'], | |
1078 | 'mips' : ['CONFIG_MIPS_DIS'], | |
1079 | 'moxie' : ['CONFIG_MOXIE_DIS'], | |
1080 | 'nios2' : ['CONFIG_NIOS2_DIS'], | |
1081 | 'or1k' : ['CONFIG_OPENRISC_DIS'], | |
1082 | 'ppc' : ['CONFIG_PPC_DIS'], | |
1083 | 'riscv' : ['CONFIG_RISCV_DIS'], | |
1084 | 'rx' : ['CONFIG_RX_DIS'], | |
1085 | 's390' : ['CONFIG_S390_DIS'], | |
1086 | 'sh4' : ['CONFIG_SH4_DIS'], | |
1087 | 'sparc' : ['CONFIG_SPARC_DIS'], | |
1088 | 'xtensa' : ['CONFIG_XTENSA_DIS'], | |
1089 | } | |
1090 | if link_language == 'cpp' | |
1091 | disassemblers += { | |
1092 | 'aarch64' : [ 'CONFIG_ARM_A64_DIS'], | |
1093 | 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'], | |
1094 | 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'], | |
1095 | } | |
1096 | endif | |
1097 | ||
0a189110 PB |
1098 | host_kconfig = \ |
1099 | ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ | |
1100 | ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ | |
1101 | ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \ | |
1102 | ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ | |
1103 | ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \ | |
1104 | ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \ | |
1105 | ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \ | |
1106 | ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \ | |
1107 | ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \ | |
1108 | ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \ | |
1109 | ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) | |
1110 | ||
a9a74907 | 1111 | ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] |
05512f55 | 1112 | |
fdb75aef PB |
1113 | default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host |
1114 | actual_target_dirs = [] | |
fbb4121d | 1115 | fdt_required = [] |
a81df1b6 | 1116 | foreach target : target_dirs |
765686d6 PB |
1117 | config_target = { 'TARGET_NAME': target.split('-')[0] } |
1118 | if target.endswith('linux-user') | |
fdb75aef PB |
1119 | if targetos != 'linux' |
1120 | if default_targets | |
1121 | continue | |
1122 | endif | |
1123 | error('Target @0@ is only available on a Linux host'.format(target)) | |
1124 | endif | |
765686d6 PB |
1125 | config_target += { 'CONFIG_LINUX_USER': 'y' } |
1126 | elif target.endswith('bsd-user') | |
fdb75aef PB |
1127 | if 'CONFIG_BSD' not in config_host |
1128 | if default_targets | |
1129 | continue | |
1130 | endif | |
1131 | error('Target @0@ is only available on a BSD host'.format(target)) | |
1132 | endif | |
765686d6 PB |
1133 | config_target += { 'CONFIG_BSD_USER': 'y' } |
1134 | elif target.endswith('softmmu') | |
1135 | config_target += { 'CONFIG_SOFTMMU': 'y' } | |
1136 | endif | |
1137 | if target.endswith('-user') | |
1138 | config_target += { | |
1139 | 'CONFIG_USER_ONLY': 'y', | |
1140 | 'CONFIG_QEMU_INTERP_PREFIX': | |
1141 | config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME']) | |
1142 | } | |
1143 | endif | |
859aef02 | 1144 | |
0a189110 | 1145 | accel_kconfig = [] |
8a19980e PB |
1146 | foreach sym: accelerators |
1147 | if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) | |
1148 | config_target += { sym: 'y' } | |
1149 | config_all += { sym: 'y' } | |
1150 | if sym == 'CONFIG_XEN' and have_xen_pci_passthrough | |
1151 | config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } | |
1152 | endif | |
0a189110 | 1153 | accel_kconfig += [ sym + '=y' ] |
8a19980e PB |
1154 | endif |
1155 | endforeach | |
0a189110 | 1156 | if accel_kconfig.length() == 0 |
fdb75aef PB |
1157 | if default_targets |
1158 | continue | |
1159 | endif | |
1160 | error('No accelerator available for target @0@'.format(target)) | |
1161 | endif | |
8a19980e | 1162 | |
fdb75aef | 1163 | actual_target_dirs += target |
765686d6 | 1164 | config_target += keyval.load('default-configs/targets' / target + '.mak') |
a9a74907 | 1165 | config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' } |
765686d6 | 1166 | |
fbb4121d PB |
1167 | if 'TARGET_NEED_FDT' in config_target |
1168 | fdt_required += target | |
1169 | endif | |
1170 | ||
fa73168b PB |
1171 | # Add default keys |
1172 | if 'TARGET_BASE_ARCH' not in config_target | |
1173 | config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']} | |
1174 | endif | |
1175 | if 'TARGET_ABI_DIR' not in config_target | |
1176 | config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']} | |
1177 | endif | |
859aef02 | 1178 | |
ca0fc784 PB |
1179 | foreach k, v: disassemblers |
1180 | if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) | |
1181 | foreach sym: v | |
1182 | config_target += { sym: 'y' } | |
1183 | config_all_disas += { sym: 'y' } | |
1184 | endforeach | |
1185 | endif | |
1186 | endforeach | |
1187 | ||
859aef02 PB |
1188 | config_target_data = configuration_data() |
1189 | foreach k, v: config_target | |
1190 | if not k.startswith('TARGET_') and not k.startswith('CONFIG_') | |
1191 | # do nothing | |
1192 | elif ignored.contains(k) | |
1193 | # do nothing | |
1194 | elif k == 'TARGET_BASE_ARCH' | |
a9a74907 PB |
1195 | # Note that TARGET_BASE_ARCH ends up in config-target.h but it is |
1196 | # not used to select files from sourcesets. | |
859aef02 | 1197 | config_target_data.set('TARGET_' + v.to_upper(), 1) |
765686d6 | 1198 | elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX' |
859aef02 PB |
1199 | config_target_data.set_quoted(k, v) |
1200 | elif v == 'y' | |
1201 | config_target_data.set(k, 1) | |
1202 | else | |
1203 | config_target_data.set(k, v) | |
1204 | endif | |
1205 | endforeach | |
1206 | config_target_h += {target: configure_file(output: target + '-config-target.h', | |
1207 | configuration: config_target_data)} | |
2becc36a PB |
1208 | |
1209 | if target.endswith('-softmmu') | |
2becc36a PB |
1210 | config_devices_mak = target + '-config-devices.mak' |
1211 | config_devices_mak = configure_file( | |
1bb4cb1c | 1212 | input: ['default-configs/devices' / target + '.mak', 'Kconfig'], |
2becc36a PB |
1213 | output: config_devices_mak, |
1214 | depfile: config_devices_mak + '.d', | |
1215 | capture: true, | |
1216 | command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], | |
1217 | config_devices_mak, '@DEPFILE@', '@INPUT@', | |
0a189110 | 1218 | host_kconfig, accel_kconfig]) |
859aef02 PB |
1219 | |
1220 | config_devices_data = configuration_data() | |
1221 | config_devices = keyval.load(config_devices_mak) | |
1222 | foreach k, v: config_devices | |
1223 | config_devices_data.set(k, 1) | |
1224 | endforeach | |
2becc36a | 1225 | config_devices_mak_list += config_devices_mak |
859aef02 PB |
1226 | config_devices_h += {target: configure_file(output: target + '-config-devices.h', |
1227 | configuration: config_devices_data)} | |
1228 | config_target += config_devices | |
a98006bc | 1229 | config_all_devices += config_devices |
2becc36a PB |
1230 | endif |
1231 | config_target_mak += {target: config_target} | |
a81df1b6 | 1232 | endforeach |
fdb75aef | 1233 | target_dirs = actual_target_dirs |
a81df1b6 | 1234 | |
2becc36a PB |
1235 | # This configuration is used to build files that are shared by |
1236 | # multiple binaries, and then extracted out of the "common" | |
1237 | # static_library target. | |
1238 | # | |
1239 | # We do not use all_sources()/all_dependencies(), because it would | |
1240 | # build literally all source files, including devices only used by | |
1241 | # targets that are not built for this compilation. The CONFIG_ALL | |
1242 | # pseudo symbol replaces it. | |
1243 | ||
05512f55 | 1244 | config_all += config_all_devices |
2becc36a PB |
1245 | config_all += config_host |
1246 | config_all += config_all_disas | |
1247 | config_all += { | |
1248 | 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'), | |
1249 | 'CONFIG_SOFTMMU': have_system, | |
1250 | 'CONFIG_USER_ONLY': have_user, | |
1251 | 'CONFIG_ALL': true, | |
1252 | } | |
1253 | ||
a0c9162c PB |
1254 | ############## |
1255 | # Submodules # | |
1256 | ############## | |
8b18cdbf RH |
1257 | |
1258 | capstone = not_found | |
1259 | capstone_opt = get_option('capstone') | |
1260 | if capstone_opt in ['enabled', 'auto', 'system'] | |
1261 | have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile') | |
bcf36862 RH |
1262 | capstone = dependency('capstone', version: '>=4.0', |
1263 | static: enable_static, method: 'pkg-config', | |
8b18cdbf RH |
1264 | required: capstone_opt == 'system' or |
1265 | capstone_opt == 'enabled' and not have_internal) | |
1266 | if capstone.found() | |
1267 | capstone_opt = 'system' | |
1268 | elif have_internal | |
1269 | capstone_opt = 'internal' | |
1270 | else | |
1271 | capstone_opt = 'disabled' | |
1272 | endif | |
1273 | endif | |
1274 | if capstone_opt == 'internal' | |
1275 | capstone_data = configuration_data() | |
1276 | capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1') | |
1277 | ||
1278 | capstone_files = files( | |
1279 | 'capstone/cs.c', | |
1280 | 'capstone/MCInst.c', | |
1281 | 'capstone/MCInstrDesc.c', | |
1282 | 'capstone/MCRegisterInfo.c', | |
1283 | 'capstone/SStream.c', | |
1284 | 'capstone/utils.c' | |
1285 | ) | |
1286 | ||
1287 | if 'CONFIG_ARM_DIS' in config_all_disas | |
1288 | capstone_data.set('CAPSTONE_HAS_ARM', '1') | |
1289 | capstone_files += files( | |
1290 | 'capstone/arch/ARM/ARMDisassembler.c', | |
1291 | 'capstone/arch/ARM/ARMInstPrinter.c', | |
1292 | 'capstone/arch/ARM/ARMMapping.c', | |
1293 | 'capstone/arch/ARM/ARMModule.c' | |
1294 | ) | |
1295 | endif | |
1296 | ||
1297 | # FIXME: This config entry currently depends on a c++ compiler. | |
1298 | # Which is needed for building libvixl, but not for capstone. | |
1299 | if 'CONFIG_ARM_A64_DIS' in config_all_disas | |
1300 | capstone_data.set('CAPSTONE_HAS_ARM64', '1') | |
1301 | capstone_files += files( | |
1302 | 'capstone/arch/AArch64/AArch64BaseInfo.c', | |
1303 | 'capstone/arch/AArch64/AArch64Disassembler.c', | |
1304 | 'capstone/arch/AArch64/AArch64InstPrinter.c', | |
1305 | 'capstone/arch/AArch64/AArch64Mapping.c', | |
1306 | 'capstone/arch/AArch64/AArch64Module.c' | |
1307 | ) | |
1308 | endif | |
1309 | ||
1310 | if 'CONFIG_PPC_DIS' in config_all_disas | |
1311 | capstone_data.set('CAPSTONE_HAS_POWERPC', '1') | |
1312 | capstone_files += files( | |
1313 | 'capstone/arch/PowerPC/PPCDisassembler.c', | |
1314 | 'capstone/arch/PowerPC/PPCInstPrinter.c', | |
1315 | 'capstone/arch/PowerPC/PPCMapping.c', | |
1316 | 'capstone/arch/PowerPC/PPCModule.c' | |
1317 | ) | |
1318 | endif | |
1319 | ||
3d562845 RH |
1320 | if 'CONFIG_S390_DIS' in config_all_disas |
1321 | capstone_data.set('CAPSTONE_HAS_SYSZ', '1') | |
1322 | capstone_files += files( | |
1323 | 'capstone/arch/SystemZ/SystemZDisassembler.c', | |
1324 | 'capstone/arch/SystemZ/SystemZInstPrinter.c', | |
1325 | 'capstone/arch/SystemZ/SystemZMapping.c', | |
1326 | 'capstone/arch/SystemZ/SystemZModule.c', | |
1327 | 'capstone/arch/SystemZ/SystemZMCTargetDesc.c' | |
1328 | ) | |
1329 | endif | |
1330 | ||
8b18cdbf RH |
1331 | if 'CONFIG_I386_DIS' in config_all_disas |
1332 | capstone_data.set('CAPSTONE_HAS_X86', 1) | |
1333 | capstone_files += files( | |
1334 | 'capstone/arch/X86/X86Disassembler.c', | |
1335 | 'capstone/arch/X86/X86DisassemblerDecoder.c', | |
1336 | 'capstone/arch/X86/X86ATTInstPrinter.c', | |
1337 | 'capstone/arch/X86/X86IntelInstPrinter.c', | |
eef20e40 | 1338 | 'capstone/arch/X86/X86InstPrinterCommon.c', |
8b18cdbf RH |
1339 | 'capstone/arch/X86/X86Mapping.c', |
1340 | 'capstone/arch/X86/X86Module.c' | |
1341 | ) | |
1342 | endif | |
1343 | ||
1344 | configure_file(output: 'capstone-defs.h', configuration: capstone_data) | |
1345 | ||
1346 | capstone_cargs = [ | |
1347 | # FIXME: There does not seem to be a way to completely replace the c_args | |
1348 | # that come from add_project_arguments() -- we can only add to them. | |
1349 | # So: disable all warnings with a big hammer. | |
1350 | '-Wno-error', '-w', | |
1351 | ||
1352 | # Include all configuration defines via a header file, which will wind up | |
1353 | # as a dependency on the object file, and thus changes here will result | |
1354 | # in a rebuild. | |
1355 | '-include', 'capstone-defs.h' | |
1356 | ] | |
1357 | ||
1358 | libcapstone = static_library('capstone', | |
1359 | sources: capstone_files, | |
1360 | c_args: capstone_cargs, | |
1361 | include_directories: 'capstone/include') | |
1362 | capstone = declare_dependency(link_with: libcapstone, | |
eef20e40 | 1363 | include_directories: 'capstone/include/capstone') |
8b18cdbf | 1364 | endif |
4d34a86b PB |
1365 | |
1366 | slirp = not_found | |
1367 | slirp_opt = 'disabled' | |
1368 | if have_system | |
1369 | slirp_opt = get_option('slirp') | |
1370 | if slirp_opt in ['enabled', 'auto', 'system'] | |
1371 | have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build') | |
1372 | slirp = dependency('slirp', static: enable_static, | |
1373 | method: 'pkg-config', | |
1374 | required: slirp_opt == 'system' or | |
1375 | slirp_opt == 'enabled' and not have_internal) | |
1376 | if slirp.found() | |
1377 | slirp_opt = 'system' | |
1378 | elif have_internal | |
1379 | slirp_opt = 'internal' | |
1380 | else | |
1381 | slirp_opt = 'disabled' | |
1382 | endif | |
1383 | endif | |
1384 | if slirp_opt == 'internal' | |
1385 | slirp_deps = [] | |
1386 | if targetos == 'windows' | |
1387 | slirp_deps = cc.find_library('iphlpapi') | |
1388 | endif | |
1389 | slirp_conf = configuration_data() | |
1390 | slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0]) | |
1391 | slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1]) | |
1392 | slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2]) | |
1393 | slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version()) | |
1394 | slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"'] | |
1395 | slirp_files = [ | |
1396 | 'slirp/src/arp_table.c', | |
1397 | 'slirp/src/bootp.c', | |
1398 | 'slirp/src/cksum.c', | |
1399 | 'slirp/src/dhcpv6.c', | |
1400 | 'slirp/src/dnssearch.c', | |
1401 | 'slirp/src/if.c', | |
1402 | 'slirp/src/ip6_icmp.c', | |
1403 | 'slirp/src/ip6_input.c', | |
1404 | 'slirp/src/ip6_output.c', | |
1405 | 'slirp/src/ip_icmp.c', | |
1406 | 'slirp/src/ip_input.c', | |
1407 | 'slirp/src/ip_output.c', | |
1408 | 'slirp/src/mbuf.c', | |
1409 | 'slirp/src/misc.c', | |
1410 | 'slirp/src/ncsi.c', | |
1411 | 'slirp/src/ndp_table.c', | |
1412 | 'slirp/src/sbuf.c', | |
1413 | 'slirp/src/slirp.c', | |
1414 | 'slirp/src/socket.c', | |
1415 | 'slirp/src/state.c', | |
1416 | 'slirp/src/stream.c', | |
1417 | 'slirp/src/tcp_input.c', | |
1418 | 'slirp/src/tcp_output.c', | |
1419 | 'slirp/src/tcp_subr.c', | |
1420 | 'slirp/src/tcp_timer.c', | |
1421 | 'slirp/src/tftp.c', | |
1422 | 'slirp/src/udp.c', | |
1423 | 'slirp/src/udp6.c', | |
1424 | 'slirp/src/util.c', | |
1425 | 'slirp/src/version.c', | |
1426 | 'slirp/src/vmstate.c', | |
1427 | ] | |
1428 | ||
1429 | configure_file( | |
1430 | input : 'slirp/src/libslirp-version.h.in', | |
1431 | output : 'libslirp-version.h', | |
1432 | configuration: slirp_conf) | |
1433 | ||
1434 | slirp_inc = include_directories('slirp', 'slirp/src') | |
1435 | libslirp = static_library('slirp', | |
1436 | sources: slirp_files, | |
1437 | c_args: slirp_cargs, | |
1438 | include_directories: slirp_inc) | |
1439 | slirp = declare_dependency(link_with: libslirp, | |
1440 | dependencies: slirp_deps, | |
1441 | include_directories: slirp_inc) | |
1442 | endif | |
1443 | endif | |
1444 | ||
fbb4121d PB |
1445 | fdt = not_found |
1446 | fdt_opt = get_option('fdt') | |
1447 | if have_system | |
1448 | if fdt_opt in ['enabled', 'auto', 'system'] | |
1449 | have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt') | |
1450 | fdt = cc.find_library('fdt', static: enable_static, | |
1451 | required: fdt_opt == 'system' or | |
1452 | fdt_opt == 'enabled' and not have_internal) | |
1453 | if fdt.found() and cc.links(''' | |
1454 | #include <libfdt.h> | |
1455 | #include <libfdt_env.h> | |
1456 | int main(void) { fdt_check_full(NULL, 0); return 0; }''', | |
1457 | dependencies: fdt) | |
1458 | fdt_opt = 'system' | |
1459 | elif have_internal | |
1460 | fdt_opt = 'internal' | |
1461 | else | |
1462 | fdt_opt = 'disabled' | |
1463 | endif | |
1464 | endif | |
1465 | if fdt_opt == 'internal' | |
1466 | fdt_files = files( | |
1467 | 'dtc/libfdt/fdt.c', | |
1468 | 'dtc/libfdt/fdt_ro.c', | |
1469 | 'dtc/libfdt/fdt_wip.c', | |
1470 | 'dtc/libfdt/fdt_sw.c', | |
1471 | 'dtc/libfdt/fdt_rw.c', | |
1472 | 'dtc/libfdt/fdt_strerror.c', | |
1473 | 'dtc/libfdt/fdt_empty_tree.c', | |
1474 | 'dtc/libfdt/fdt_addresses.c', | |
1475 | 'dtc/libfdt/fdt_overlay.c', | |
1476 | 'dtc/libfdt/fdt_check.c', | |
1477 | ) | |
1478 | ||
1479 | fdt_inc = include_directories('dtc/libfdt') | |
1480 | libfdt = static_library('fdt', | |
1481 | sources: fdt_files, | |
1482 | include_directories: fdt_inc) | |
1483 | fdt = declare_dependency(link_with: libfdt, | |
1484 | include_directories: fdt_inc) | |
1485 | endif | |
1486 | endif | |
1487 | if not fdt.found() and fdt_required.length() > 0 | |
1488 | error('fdt not available but required by targets ' + ', '.join(fdt_required)) | |
1489 | endif | |
1490 | ||
8b18cdbf | 1491 | config_host_data.set('CONFIG_CAPSTONE', capstone.found()) |
fbb4121d | 1492 | config_host_data.set('CONFIG_FDT', fdt.found()) |
4d34a86b | 1493 | config_host_data.set('CONFIG_SLIRP', slirp.found()) |
8b18cdbf | 1494 | |
a0c9162c PB |
1495 | ##################### |
1496 | # Generated sources # | |
1497 | ##################### | |
8b18cdbf | 1498 | |
a0c9162c | 1499 | genh += configure_file(output: 'config-host.h', configuration: config_host_data) |
a81df1b6 | 1500 | |
3f885659 | 1501 | hxtool = find_program('scripts/hxtool') |
650b5d54 | 1502 | shaderinclude = find_program('scripts/shaderinclude.pl') |
a81df1b6 PB |
1503 | qapi_gen = find_program('scripts/qapi-gen.py') |
1504 | qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py', | |
1505 | meson.source_root() / 'scripts/qapi/commands.py', | |
1506 | meson.source_root() / 'scripts/qapi/common.py', | |
a81df1b6 PB |
1507 | meson.source_root() / 'scripts/qapi/error.py', |
1508 | meson.source_root() / 'scripts/qapi/events.py', | |
1509 | meson.source_root() / 'scripts/qapi/expr.py', | |
1510 | meson.source_root() / 'scripts/qapi/gen.py', | |
1511 | meson.source_root() / 'scripts/qapi/introspect.py', | |
1512 | meson.source_root() / 'scripts/qapi/parser.py', | |
1513 | meson.source_root() / 'scripts/qapi/schema.py', | |
1514 | meson.source_root() / 'scripts/qapi/source.py', | |
1515 | meson.source_root() / 'scripts/qapi/types.py', | |
1516 | meson.source_root() / 'scripts/qapi/visit.py', | |
1517 | meson.source_root() / 'scripts/qapi/common.py', | |
a81df1b6 PB |
1518 | meson.source_root() / 'scripts/qapi-gen.py' |
1519 | ] | |
1520 | ||
1521 | tracetool = [ | |
1522 | python, files('scripts/tracetool.py'), | |
1523 | '--backend=' + config_host['TRACE_BACKENDS'] | |
1524 | ] | |
1525 | ||
2c273f32 MAL |
1526 | qemu_version_cmd = [find_program('scripts/qemu-version.sh'), |
1527 | meson.current_source_dir(), | |
859aef02 | 1528 | config_host['PKGVERSION'], meson.project_version()] |
2c273f32 MAL |
1529 | qemu_version = custom_target('qemu-version.h', |
1530 | output: 'qemu-version.h', | |
1531 | command: qemu_version_cmd, | |
1532 | capture: true, | |
1533 | build_by_default: true, | |
1534 | build_always_stale: true) | |
1535 | genh += qemu_version | |
1536 | ||
3f885659 MAL |
1537 | hxdep = [] |
1538 | hx_headers = [ | |
1539 | ['qemu-options.hx', 'qemu-options.def'], | |
1540 | ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], | |
1541 | ] | |
1542 | if have_system | |
1543 | hx_headers += [ | |
1544 | ['hmp-commands.hx', 'hmp-commands.h'], | |
1545 | ['hmp-commands-info.hx', 'hmp-commands-info.h'], | |
1546 | ] | |
1547 | endif | |
1548 | foreach d : hx_headers | |
b7c70bf2 | 1549 | hxdep += custom_target(d[1], |
3f885659 MAL |
1550 | input: files(d[0]), |
1551 | output: d[1], | |
1552 | capture: true, | |
1553 | build_by_default: true, # to be removed when added to a target | |
1554 | command: [hxtool, '-h', '@INPUT0@']) | |
1555 | endforeach | |
1556 | genh += hxdep | |
1557 | ||
a0c9162c PB |
1558 | ################### |
1559 | # Collect sources # | |
1560 | ################### | |
a81df1b6 | 1561 | |
55567891 | 1562 | authz_ss = ss.source_set() |
4a96337d | 1563 | blockdev_ss = ss.source_set() |
7e2b888f | 1564 | block_ss = ss.source_set() |
2becc36a | 1565 | bsd_user_ss = ss.source_set() |
c2306d71 | 1566 | chardev_ss = ss.source_set() |
7e2b888f | 1567 | common_ss = ss.source_set() |
2389304a | 1568 | crypto_ss = ss.source_set() |
f78536b1 | 1569 | io_ss = ss.source_set() |
2becc36a | 1570 | linux_user_ss = ss.source_set() |
7e2b888f | 1571 | qmp_ss = ss.source_set() |
da33fc09 | 1572 | qom_ss = ss.source_set() |
7e2b888f | 1573 | softmmu_ss = ss.source_set() |
64ed6f92 | 1574 | specific_fuzz_ss = ss.source_set() |
7e2b888f PMD |
1575 | specific_ss = ss.source_set() |
1576 | stub_ss = ss.source_set() | |
1577 | trace_ss = ss.source_set() | |
1578 | user_ss = ss.source_set() | |
1579 | util_ss = ss.source_set() | |
2becc36a | 1580 | |
3154fee4 | 1581 | modules = {} |
2becc36a PB |
1582 | hw_arch = {} |
1583 | target_arch = {} | |
1584 | target_softmmu_arch = {} | |
a81df1b6 PB |
1585 | |
1586 | ############### | |
1587 | # Trace files # | |
1588 | ############### | |
1589 | ||
c9322ab5 MAL |
1590 | # TODO: add each directory to the subdirs from its own meson.build, once |
1591 | # we have those | |
a81df1b6 PB |
1592 | trace_events_subdirs = [ |
1593 | 'accel/kvm', | |
1594 | 'accel/tcg', | |
1595 | 'crypto', | |
1596 | 'monitor', | |
1597 | ] | |
1598 | if have_user | |
1599 | trace_events_subdirs += [ 'linux-user' ] | |
1600 | endif | |
1601 | if have_block | |
1602 | trace_events_subdirs += [ | |
1603 | 'authz', | |
1604 | 'block', | |
1605 | 'io', | |
1606 | 'nbd', | |
1607 | 'scsi', | |
1608 | ] | |
1609 | endif | |
1610 | if have_system | |
1611 | trace_events_subdirs += [ | |
1612 | 'audio', | |
1613 | 'backends', | |
1614 | 'backends/tpm', | |
1615 | 'chardev', | |
1616 | 'hw/9pfs', | |
1617 | 'hw/acpi', | |
1618 | 'hw/alpha', | |
1619 | 'hw/arm', | |
1620 | 'hw/audio', | |
1621 | 'hw/block', | |
1622 | 'hw/block/dataplane', | |
1623 | 'hw/char', | |
1624 | 'hw/display', | |
1625 | 'hw/dma', | |
1626 | 'hw/hppa', | |
1627 | 'hw/hyperv', | |
1628 | 'hw/i2c', | |
1629 | 'hw/i386', | |
1630 | 'hw/i386/xen', | |
1631 | 'hw/ide', | |
1632 | 'hw/input', | |
1633 | 'hw/intc', | |
1634 | 'hw/isa', | |
1635 | 'hw/mem', | |
1636 | 'hw/mips', | |
1637 | 'hw/misc', | |
1638 | 'hw/misc/macio', | |
1639 | 'hw/net', | |
98e5d7a2 | 1640 | 'hw/net/can', |
a81df1b6 PB |
1641 | 'hw/nvram', |
1642 | 'hw/pci', | |
1643 | 'hw/pci-host', | |
1644 | 'hw/ppc', | |
1645 | 'hw/rdma', | |
1646 | 'hw/rdma/vmw', | |
1647 | 'hw/rtc', | |
1648 | 'hw/s390x', | |
1649 | 'hw/scsi', | |
1650 | 'hw/sd', | |
1651 | 'hw/sparc', | |
1652 | 'hw/sparc64', | |
1653 | 'hw/ssi', | |
1654 | 'hw/timer', | |
1655 | 'hw/tpm', | |
1656 | 'hw/usb', | |
1657 | 'hw/vfio', | |
1658 | 'hw/virtio', | |
1659 | 'hw/watchdog', | |
1660 | 'hw/xen', | |
1661 | 'hw/gpio', | |
a81df1b6 PB |
1662 | 'migration', |
1663 | 'net', | |
8b7a5507 | 1664 | 'softmmu', |
a81df1b6 PB |
1665 | 'ui', |
1666 | ] | |
1667 | endif | |
1668 | trace_events_subdirs += [ | |
1669 | 'hw/core', | |
1670 | 'qapi', | |
1671 | 'qom', | |
1672 | 'target/arm', | |
1673 | 'target/hppa', | |
1674 | 'target/i386', | |
a9dc68d9 | 1675 | 'target/i386/kvm', |
a81df1b6 PB |
1676 | 'target/mips', |
1677 | 'target/ppc', | |
1678 | 'target/riscv', | |
1679 | 'target/s390x', | |
1680 | 'target/sparc', | |
1681 | 'util', | |
1682 | ] | |
1683 | ||
0df750e9 MAL |
1684 | vhost_user = not_found |
1685 | if 'CONFIG_VHOST_USER' in config_host | |
1686 | libvhost_user = subproject('libvhost-user') | |
1687 | vhost_user = libvhost_user.get_variable('vhost_user_dep') | |
1688 | endif | |
1689 | ||
a81df1b6 PB |
1690 | subdir('qapi') |
1691 | subdir('qobject') | |
1692 | subdir('stubs') | |
1693 | subdir('trace') | |
1694 | subdir('util') | |
5582c58f MAL |
1695 | subdir('qom') |
1696 | subdir('authz') | |
a81df1b6 | 1697 | subdir('crypto') |
2d78b56e | 1698 | subdir('ui') |
a81df1b6 | 1699 | |
3154fee4 MAL |
1700 | |
1701 | if enable_modules | |
1702 | libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO') | |
1703 | modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO') | |
1704 | endif | |
1705 | ||
2becc36a | 1706 | stub_ss = stub_ss.apply(config_all, strict: false) |
a81df1b6 PB |
1707 | |
1708 | util_ss.add_all(trace_ss) | |
2becc36a | 1709 | util_ss = util_ss.apply(config_all, strict: false) |
a81df1b6 PB |
1710 | libqemuutil = static_library('qemuutil', |
1711 | sources: util_ss.sources() + stub_ss.sources() + genh, | |
aa087962 | 1712 | dependencies: [util_ss.dependencies(), m, glib, socket, malloc]) |
a81df1b6 | 1713 | qemuutil = declare_dependency(link_with: libqemuutil, |
04c6f1e7 | 1714 | sources: genh + version_res) |
a81df1b6 | 1715 | |
abff1abf PB |
1716 | decodetree = generator(find_program('scripts/decodetree.py'), |
1717 | output: 'decode-@[email protected]', | |
1718 | arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@']) | |
1719 | ||
478e943f | 1720 | subdir('audio') |
7fcfd456 | 1721 | subdir('io') |
848e8ff6 | 1722 | subdir('chardev') |
ec0d5893 | 1723 | subdir('fsdev') |
abff1abf | 1724 | subdir('libdecnumber') |
d3b18480 | 1725 | subdir('target') |
708eab42 | 1726 | subdir('dump') |
ec0d5893 | 1727 | |
5e5733e5 MAL |
1728 | block_ss.add(files( |
1729 | 'block.c', | |
1730 | 'blockjob.c', | |
1731 | 'job.c', | |
1732 | 'qemu-io-cmds.c', | |
1733 | )) | |
1734 | block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c')) | |
1735 | ||
1736 | subdir('nbd') | |
1737 | subdir('scsi') | |
1738 | subdir('block') | |
1739 | ||
4a96337d PB |
1740 | blockdev_ss.add(files( |
1741 | 'blockdev.c', | |
cbc20bfb | 1742 | 'blockdev-nbd.c', |
4a96337d PB |
1743 | 'iothread.c', |
1744 | 'job-qmp.c', | |
1745 | )) | |
1746 | ||
1747 | # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, | |
1748 | # os-win32.c does not | |
1749 | blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) | |
1750 | softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) | |
4a96337d PB |
1751 | |
1752 | common_ss.add(files('cpus-common.c')) | |
1753 | ||
5d3ea0e1 | 1754 | subdir('softmmu') |
c9322ab5 | 1755 | |
f343346b | 1756 | common_ss.add(capstone) |
d9f24bf5 | 1757 | specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone) |
c9322ab5 MAL |
1758 | specific_ss.add(files('exec-vary.c')) |
1759 | specific_ss.add(when: 'CONFIG_TCG', if_true: files( | |
1760 | 'fpu/softfloat.c', | |
1761 | 'tcg/optimize.c', | |
1762 | 'tcg/tcg-common.c', | |
1763 | 'tcg/tcg-op-gvec.c', | |
1764 | 'tcg/tcg-op-vec.c', | |
1765 | 'tcg/tcg-op.c', | |
1766 | 'tcg/tcg.c', | |
1767 | )) | |
1768 | specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c')) | |
1769 | ||
ab318051 | 1770 | subdir('backends') |
c574e161 | 1771 | subdir('disas') |
55166230 | 1772 | subdir('migration') |
ff219dca | 1773 | subdir('monitor') |
cdaf0722 | 1774 | subdir('net') |
17ef2af6 | 1775 | subdir('replay') |
582ea95f | 1776 | subdir('hw') |
1a82878a | 1777 | subdir('accel') |
f556b4a1 | 1778 | subdir('plugins') |
b309c321 | 1779 | subdir('bsd-user') |
3a30446a MAL |
1780 | subdir('linux-user') |
1781 | ||
b309c321 MAL |
1782 | bsd_user_ss.add(files('gdbstub.c')) |
1783 | specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) | |
1784 | ||
3a30446a MAL |
1785 | linux_user_ss.add(files('gdbstub.c', 'thunk.c')) |
1786 | specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) | |
5d3ea0e1 | 1787 | |
a2ce7dbd PB |
1788 | # needed for fuzzing binaries |
1789 | subdir('tests/qtest/libqos') | |
64ed6f92 | 1790 | subdir('tests/qtest/fuzz') |
a2ce7dbd | 1791 | |
a0c9162c PB |
1792 | ######################## |
1793 | # Library dependencies # | |
1794 | ######################## | |
1795 | ||
3154fee4 MAL |
1796 | block_mods = [] |
1797 | softmmu_mods = [] | |
1798 | foreach d, list : modules | |
1799 | foreach m, module_ss : list | |
1800 | if enable_modules and targetos != 'windows' | |
3e292c51 | 1801 | module_ss = module_ss.apply(config_all, strict: false) |
3154fee4 MAL |
1802 | sl = static_library(d + '-' + m, [genh, module_ss.sources()], |
1803 | dependencies: [modulecommon, module_ss.dependencies()], pic: true) | |
1804 | if d == 'block' | |
1805 | block_mods += sl | |
1806 | else | |
1807 | softmmu_mods += sl | |
1808 | endif | |
1809 | else | |
1810 | if d == 'block' | |
1811 | block_ss.add_all(module_ss) | |
1812 | else | |
1813 | softmmu_ss.add_all(module_ss) | |
1814 | endif | |
1815 | endif | |
1816 | endforeach | |
1817 | endforeach | |
1818 | ||
1819 | nm = find_program('nm') | |
604f3e4e | 1820 | undefsym = find_program('scripts/undefsym.py') |
3154fee4 MAL |
1821 | block_syms = custom_target('block.syms', output: 'block.syms', |
1822 | input: [libqemuutil, block_mods], | |
1823 | capture: true, | |
1824 | command: [undefsym, nm, '@INPUT@']) | |
1825 | qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', | |
1826 | input: [libqemuutil, softmmu_mods], | |
1827 | capture: true, | |
1828 | command: [undefsym, nm, '@INPUT@']) | |
1829 | ||
da33fc09 PMD |
1830 | qom_ss = qom_ss.apply(config_host, strict: false) |
1831 | libqom = static_library('qom', qom_ss.sources() + genh, | |
1832 | dependencies: [qom_ss.dependencies()], | |
1833 | name_suffix: 'fa') | |
1834 | ||
1835 | qom = declare_dependency(link_whole: libqom) | |
1836 | ||
55567891 PMD |
1837 | authz_ss = authz_ss.apply(config_host, strict: false) |
1838 | libauthz = static_library('authz', authz_ss.sources() + genh, | |
1839 | dependencies: [authz_ss.dependencies()], | |
1840 | name_suffix: 'fa', | |
1841 | build_by_default: false) | |
1842 | ||
1843 | authz = declare_dependency(link_whole: libauthz, | |
1844 | dependencies: qom) | |
1845 | ||
2389304a PMD |
1846 | crypto_ss = crypto_ss.apply(config_host, strict: false) |
1847 | libcrypto = static_library('crypto', crypto_ss.sources() + genh, | |
1848 | dependencies: [crypto_ss.dependencies()], | |
1849 | name_suffix: 'fa', | |
1850 | build_by_default: false) | |
1851 | ||
1852 | crypto = declare_dependency(link_whole: libcrypto, | |
1853 | dependencies: [authz, qom]) | |
1854 | ||
f78536b1 PMD |
1855 | io_ss = io_ss.apply(config_host, strict: false) |
1856 | libio = static_library('io', io_ss.sources() + genh, | |
1857 | dependencies: [io_ss.dependencies()], | |
1858 | link_with: libqemuutil, | |
1859 | name_suffix: 'fa', | |
1860 | build_by_default: false) | |
1861 | ||
1862 | io = declare_dependency(link_whole: libio, dependencies: [crypto, qom]) | |
1863 | ||
7e6edef3 PMD |
1864 | libmigration = static_library('migration', sources: migration_files + genh, |
1865 | name_suffix: 'fa', | |
1866 | build_by_default: false) | |
1867 | migration = declare_dependency(link_with: libmigration, | |
1868 | dependencies: [zlib, qom, io]) | |
1869 | softmmu_ss.add(migration) | |
1870 | ||
5e5733e5 MAL |
1871 | block_ss = block_ss.apply(config_host, strict: false) |
1872 | libblock = static_library('block', block_ss.sources() + genh, | |
1873 | dependencies: block_ss.dependencies(), | |
1874 | link_depends: block_syms, | |
1875 | name_suffix: 'fa', | |
1876 | build_by_default: false) | |
1877 | ||
1878 | block = declare_dependency(link_whole: [libblock], | |
b7c70bf2 MAL |
1879 | link_args: '@block.syms', |
1880 | dependencies: [crypto, io]) | |
5e5733e5 | 1881 | |
4fb9071f SH |
1882 | blockdev_ss = blockdev_ss.apply(config_host, strict: false) |
1883 | libblockdev = static_library('blockdev', blockdev_ss.sources() + genh, | |
1884 | dependencies: blockdev_ss.dependencies(), | |
1885 | name_suffix: 'fa', | |
1886 | build_by_default: false) | |
1887 | ||
1888 | blockdev = declare_dependency(link_whole: [libblockdev], | |
1889 | dependencies: [block]) | |
1890 | ||
ff219dca PB |
1891 | qmp_ss = qmp_ss.apply(config_host, strict: false) |
1892 | libqmp = static_library('qmp', qmp_ss.sources() + genh, | |
1893 | dependencies: qmp_ss.dependencies(), | |
1894 | name_suffix: 'fa', | |
1895 | build_by_default: false) | |
1896 | ||
1897 | qmp = declare_dependency(link_whole: [libqmp]) | |
1898 | ||
c2306d71 PMD |
1899 | libchardev = static_library('chardev', chardev_ss.sources() + genh, |
1900 | name_suffix: 'fa', | |
1901 | build_by_default: false) | |
1902 | ||
1903 | chardev = declare_dependency(link_whole: libchardev) | |
1904 | ||
e28ab096 PMD |
1905 | libhwcore = static_library('hwcore', sources: hwcore_files + genh, |
1906 | name_suffix: 'fa', | |
1907 | build_by_default: false) | |
1908 | hwcore = declare_dependency(link_whole: libhwcore) | |
1909 | common_ss.add(hwcore) | |
1910 | ||
064f8ee7 PMD |
1911 | ########### |
1912 | # Targets # | |
1913 | ########### | |
1914 | ||
3154fee4 MAL |
1915 | foreach m : block_mods + softmmu_mods |
1916 | shared_module(m.name(), | |
1917 | name_prefix: '', | |
1918 | link_whole: m, | |
1919 | install: true, | |
16bf7a33 | 1920 | install_dir: qemu_moddir) |
3154fee4 MAL |
1921 | endforeach |
1922 | ||
4fb9071f | 1923 | softmmu_ss.add(authz, blockdev, chardev, crypto, io, qmp) |
64ed6f92 PB |
1924 | common_ss.add(qom, qemuutil) |
1925 | ||
1926 | common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss]) | |
2becc36a PB |
1927 | common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) |
1928 | ||
1929 | common_all = common_ss.apply(config_all, strict: false) | |
1930 | common_all = static_library('common', | |
1931 | build_by_default: false, | |
1932 | sources: common_all.sources() + genh, | |
1933 | dependencies: common_all.dependencies(), | |
1934 | name_suffix: 'fa') | |
1935 | ||
c9322ab5 MAL |
1936 | feature_to_c = find_program('scripts/feature_to_c.sh') |
1937 | ||
fd5eef85 | 1938 | emulators = {} |
2becc36a PB |
1939 | foreach target : target_dirs |
1940 | config_target = config_target_mak[target] | |
1941 | target_name = config_target['TARGET_NAME'] | |
1942 | arch = config_target['TARGET_BASE_ARCH'] | |
859aef02 | 1943 | arch_srcs = [config_target_h[target]] |
64ed6f92 PB |
1944 | arch_deps = [] |
1945 | c_args = ['-DNEED_CPU_H', | |
1946 | '-DCONFIG_TARGET="@[email protected]"'.format(target), | |
1947 | '-DCONFIG_DEVICES="@[email protected]"'.format(target)] | |
b6c7cfd4 | 1948 | link_args = emulator_link_args |
2becc36a | 1949 | |
859aef02 | 1950 | config_target += config_host |
2becc36a PB |
1951 | target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])] |
1952 | if targetos == 'linux' | |
1953 | target_inc += include_directories('linux-headers', is_system: true) | |
1954 | endif | |
1955 | if target.endswith('-softmmu') | |
1956 | qemu_target_name = 'qemu-system-' + target_name | |
1957 | target_type='system' | |
abff1abf PB |
1958 | t = target_softmmu_arch[arch].apply(config_target, strict: false) |
1959 | arch_srcs += t.sources() | |
64ed6f92 | 1960 | arch_deps += t.dependencies() |
abff1abf | 1961 | |
2c44220d MAL |
1962 | hw_dir = target_name == 'sparc64' ? 'sparc64' : arch |
1963 | hw = hw_arch[hw_dir].apply(config_target, strict: false) | |
1964 | arch_srcs += hw.sources() | |
64ed6f92 | 1965 | arch_deps += hw.dependencies() |
2c44220d | 1966 | |
2becc36a | 1967 | arch_srcs += config_devices_h[target] |
64ed6f92 | 1968 | link_args += ['@block.syms', '@qemu.syms'] |
2becc36a | 1969 | else |
3a30446a | 1970 | abi = config_target['TARGET_ABI_DIR'] |
2becc36a PB |
1971 | target_type='user' |
1972 | qemu_target_name = 'qemu-' + target_name | |
1973 | if 'CONFIG_LINUX_USER' in config_target | |
1974 | base_dir = 'linux-user' | |
1975 | target_inc += include_directories('linux-user/host/' / config_host['ARCH']) | |
1976 | else | |
1977 | base_dir = 'bsd-user' | |
1978 | endif | |
1979 | target_inc += include_directories( | |
1980 | base_dir, | |
3a30446a | 1981 | base_dir / abi, |
2becc36a | 1982 | ) |
3a30446a MAL |
1983 | if 'CONFIG_LINUX_USER' in config_target |
1984 | dir = base_dir / abi | |
1985 | arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c') | |
1986 | if config_target.has_key('TARGET_SYSTBL_ABI') | |
1987 | arch_srcs += \ | |
1988 | syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'], | |
1989 | extra_args : config_target['TARGET_SYSTBL_ABI']) | |
1990 | endif | |
1991 | endif | |
2becc36a PB |
1992 | endif |
1993 | ||
c9322ab5 MAL |
1994 | if 'TARGET_XML_FILES' in config_target |
1995 | gdbstub_xml = custom_target(target + '-gdbstub-xml.c', | |
1996 | output: target + '-gdbstub-xml.c', | |
1997 | input: files(config_target['TARGET_XML_FILES'].split()), | |
1998 | command: [feature_to_c, '@INPUT@'], | |
1999 | capture: true) | |
2000 | arch_srcs += gdbstub_xml | |
2001 | endif | |
2002 | ||
abff1abf PB |
2003 | t = target_arch[arch].apply(config_target, strict: false) |
2004 | arch_srcs += t.sources() | |
64ed6f92 | 2005 | arch_deps += t.dependencies() |
abff1abf | 2006 | |
2becc36a PB |
2007 | target_common = common_ss.apply(config_target, strict: false) |
2008 | objects = common_all.extract_objects(target_common.sources()) | |
64ed6f92 | 2009 | deps = target_common.dependencies() |
2becc36a | 2010 | |
2becc36a PB |
2011 | target_specific = specific_ss.apply(config_target, strict: false) |
2012 | arch_srcs += target_specific.sources() | |
64ed6f92 | 2013 | arch_deps += target_specific.dependencies() |
2becc36a | 2014 | |
64ed6f92 | 2015 | lib = static_library('qemu-' + target, |
859aef02 | 2016 | sources: arch_srcs + genh, |
b7612f45 | 2017 | dependencies: arch_deps, |
2becc36a PB |
2018 | objects: objects, |
2019 | include_directories: target_inc, | |
64ed6f92 PB |
2020 | c_args: c_args, |
2021 | build_by_default: false, | |
2becc36a | 2022 | name_suffix: 'fa') |
64ed6f92 PB |
2023 | |
2024 | if target.endswith('-softmmu') | |
2025 | execs = [{ | |
2026 | 'name': 'qemu-system-' + target_name, | |
2027 | 'gui': false, | |
2028 | 'sources': files('softmmu/main.c'), | |
2029 | 'dependencies': [] | |
2030 | }] | |
35be72ba | 2031 | if targetos == 'windows' and (sdl.found() or gtk.found()) |
64ed6f92 PB |
2032 | execs += [{ |
2033 | 'name': 'qemu-system-' + target_name + 'w', | |
2034 | 'gui': true, | |
2035 | 'sources': files('softmmu/main.c'), | |
2036 | 'dependencies': [] | |
2037 | }] | |
2038 | endif | |
2039 | if config_host.has_key('CONFIG_FUZZ') | |
2040 | specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false) | |
2041 | execs += [{ | |
2042 | 'name': 'qemu-fuzz-' + target_name, | |
2043 | 'gui': false, | |
2044 | 'sources': specific_fuzz.sources(), | |
2045 | 'dependencies': specific_fuzz.dependencies(), | |
64ed6f92 PB |
2046 | }] |
2047 | endif | |
2048 | else | |
2049 | execs = [{ | |
2050 | 'name': 'qemu-' + target_name, | |
2051 | 'gui': false, | |
2052 | 'sources': [], | |
2053 | 'dependencies': [] | |
2054 | }] | |
2055 | endif | |
2056 | foreach exe: execs | |
fd5eef85 PB |
2057 | emulators += {exe['name']: |
2058 | executable(exe['name'], exe['sources'], | |
64ed6f92 PB |
2059 | install: true, |
2060 | c_args: c_args, | |
2061 | dependencies: arch_deps + deps + exe['dependencies'], | |
2062 | objects: lib.extract_all_objects(recursive: true), | |
2063 | link_language: link_language, | |
2064 | link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), | |
2065 | link_args: link_args, | |
2066 | gui_app: exe['gui']) | |
fd5eef85 | 2067 | } |
10e1d263 MAL |
2068 | |
2069 | if 'CONFIG_TRACE_SYSTEMTAP' in config_host | |
2070 | foreach stp: [ | |
bd5f973a SH |
2071 | {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false}, |
2072 | {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true}, | |
10e1d263 MAL |
2073 | {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true}, |
2074 | {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true}, | |
2075 | ] | |
bd5f973a | 2076 | custom_target(exe['name'] + stp['ext'], |
10e1d263 | 2077 | input: trace_events_all, |
bd5f973a | 2078 | output: exe['name'] + stp['ext'], |
10e1d263 MAL |
2079 | capture: true, |
2080 | install: stp['install'], | |
16bf7a33 | 2081 | install_dir: get_option('datadir') / 'systemtap/tapset', |
10e1d263 MAL |
2082 | command: [ |
2083 | tracetool, '--group=all', '--format=' + stp['fmt'], | |
2084 | '--binary=' + stp['bin'], | |
2085 | '--target-name=' + target_name, | |
2086 | '--target-type=' + target_type, | |
2087 | '--probe-prefix=qemu.' + target_type + '.' + target_name, | |
2088 | '@INPUT@', | |
2089 | ]) | |
2090 | endforeach | |
2091 | endif | |
64ed6f92 | 2092 | endforeach |
2becc36a PB |
2093 | endforeach |
2094 | ||
931049b4 | 2095 | # Other build targets |
897b5afa | 2096 | |
f556b4a1 PB |
2097 | if 'CONFIG_PLUGIN' in config_host |
2098 | install_headers('include/qemu/qemu-plugin.h') | |
2099 | endif | |
2100 | ||
f15bff25 PB |
2101 | if 'CONFIG_GUEST_AGENT' in config_host |
2102 | subdir('qga') | |
2103 | endif | |
2104 | ||
9755c94a LV |
2105 | # Don't build qemu-keymap if xkbcommon is not explicitly enabled |
2106 | # when we don't build tools or system | |
4113f4cf | 2107 | if xkbcommon.found() |
28742467 MAL |
2108 | # used for the update-keymaps target, so include rules even if !have_tools |
2109 | qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh, | |
2110 | dependencies: [qemuutil, xkbcommon], install: have_tools) | |
2111 | endif | |
2112 | ||
931049b4 | 2113 | if have_tools |
b7c70bf2 MAL |
2114 | qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep], |
2115 | dependencies: [authz, block, crypto, io, qom, qemuutil], install: true) | |
2116 | qemu_io = executable('qemu-io', files('qemu-io.c'), | |
2117 | dependencies: [block, qemuutil], install: true) | |
eb705985 | 2118 | qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), |
cbc20bfb | 2119 | dependencies: [blockdev, qemuutil], install: true) |
b7c70bf2 | 2120 | |
7c58bb76 | 2121 | subdir('storage-daemon') |
a9c9727c | 2122 | subdir('contrib/rdmacm-mux') |
1d7bb6ab | 2123 | subdir('contrib/elf2dmp') |
a9c9727c | 2124 | |
157e7b13 MAL |
2125 | executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'), |
2126 | dependencies: qemuutil, | |
2127 | install: true) | |
2128 | ||
931049b4 | 2129 | if 'CONFIG_VHOST_USER' in config_host |
2d7ac0af | 2130 | subdir('contrib/vhost-user-blk') |
b7612f45 | 2131 | subdir('contrib/vhost-user-gpu') |
32fcc624 | 2132 | subdir('contrib/vhost-user-input') |
99650b62 | 2133 | subdir('contrib/vhost-user-scsi') |
931049b4 | 2134 | endif |
8f51e01c MAL |
2135 | |
2136 | if targetos == 'linux' | |
2137 | executable('qemu-bridge-helper', files('qemu-bridge-helper.c'), | |
2138 | dependencies: [qemuutil, libcap_ng], | |
2139 | install: true, | |
2140 | install_dir: get_option('libexecdir')) | |
897b5afa MAL |
2141 | |
2142 | executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'), | |
2143 | dependencies: [authz, crypto, io, qom, qemuutil, | |
6ec0e15d | 2144 | libcap_ng, mpathpersist], |
897b5afa | 2145 | install: true) |
8f51e01c MAL |
2146 | endif |
2147 | ||
5ee24e78 MAL |
2148 | if 'CONFIG_IVSHMEM' in config_host |
2149 | subdir('contrib/ivshmem-client') | |
2150 | subdir('contrib/ivshmem-server') | |
2151 | endif | |
931049b4 PB |
2152 | endif |
2153 | ||
f5aa6320 | 2154 | subdir('scripts') |
3f99cf57 | 2155 | subdir('tools') |
bdcbea7a | 2156 | subdir('pc-bios') |
f8aa24ea | 2157 | subdir('docs') |
e3667660 | 2158 | subdir('tests') |
e8f3bd71 MAL |
2159 | if 'CONFIG_GTK' in config_host |
2160 | subdir('po') | |
2161 | endif | |
3f99cf57 | 2162 | |
8adfeba9 MAL |
2163 | if host_machine.system() == 'windows' |
2164 | nsis_cmd = [ | |
2165 | find_program('scripts/nsis.py'), | |
2166 | '@OUTPUT@', | |
2167 | get_option('prefix'), | |
2168 | meson.current_source_dir(), | |
24bdcc96 | 2169 | host_machine.cpu(), |
8adfeba9 MAL |
2170 | '--', |
2171 | '-DDISPLAYVERSION=' + meson.project_version(), | |
2172 | ] | |
2173 | if build_docs | |
2174 | nsis_cmd += '-DCONFIG_DOCUMENTATION=y' | |
2175 | endif | |
2176 | if 'CONFIG_GTK' in config_host | |
2177 | nsis_cmd += '-DCONFIG_GTK=y' | |
2178 | endif | |
2179 | ||
2180 | nsis = custom_target('nsis', | |
2181 | output: 'qemu-setup-' + meson.project_version() + '.exe', | |
2182 | input: files('qemu.nsi'), | |
2183 | build_always_stale: true, | |
2184 | command: nsis_cmd + ['@INPUT@']) | |
2185 | alias_target('installer', nsis) | |
2186 | endif | |
2187 | ||
a0c9162c PB |
2188 | ######################### |
2189 | # Configuration summary # | |
2190 | ######################### | |
2191 | ||
f9332757 | 2192 | summary_info = {} |
16bf7a33 PB |
2193 | summary_info += {'Install prefix': get_option('prefix')} |
2194 | summary_info += {'BIOS directory': qemu_datadir} | |
2195 | summary_info += {'firmware path': get_option('qemu_firmwarepath')} | |
2196 | summary_info += {'binary directory': get_option('bindir')} | |
2197 | summary_info += {'library directory': get_option('libdir')} | |
2198 | summary_info += {'module directory': qemu_moddir} | |
2199 | summary_info += {'libexec directory': get_option('libexecdir')} | |
2200 | summary_info += {'include directory': get_option('includedir')} | |
2201 | summary_info += {'config directory': get_option('sysconfdir')} | |
f9332757 | 2202 | if targetos != 'windows' |
16bf7a33 | 2203 | summary_info += {'local state directory': get_option('localstatedir')} |
b81efab7 | 2204 | summary_info += {'Manual directory': get_option('mandir')} |
f9332757 PB |
2205 | else |
2206 | summary_info += {'local state directory': 'queried at runtime'} | |
2207 | endif | |
491e74c1 | 2208 | summary_info += {'Doc directory': get_option('docdir')} |
f9332757 PB |
2209 | summary_info += {'Build directory': meson.current_build_dir()} |
2210 | summary_info += {'Source path': meson.current_source_dir()} | |
2211 | summary_info += {'GIT binary': config_host['GIT']} | |
2212 | summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']} | |
2213 | summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]} | |
2214 | summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]} | |
2215 | if link_language == 'cpp' | |
2216 | summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]} | |
2217 | else | |
2218 | summary_info += {'C++ compiler': false} | |
2219 | endif | |
2220 | if targetos == 'darwin' | |
2221 | summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]} | |
2222 | endif | |
2223 | summary_info += {'ARFLAGS': config_host['ARFLAGS']} | |
47b30835 PB |
2224 | summary_info += {'CFLAGS': ' '.join(get_option('c_args') |
2225 | + ['-O' + get_option('optimization')] | |
2226 | + (get_option('debug') ? ['-g'] : []))} | |
2227 | if link_language == 'cpp' | |
2228 | summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') | |
2229 | + ['-O' + get_option('optimization')] | |
2230 | + (get_option('debug') ? ['-g'] : []))} | |
2231 | endif | |
2232 | link_args = get_option(link_language + '_link_args') | |
2233 | if link_args.length() > 0 | |
2234 | summary_info += {'LDFLAGS': ' '.join(link_args)} | |
2235 | endif | |
f9332757 PB |
2236 | summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} |
2237 | summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} | |
2238 | summary_info += {'make': config_host['MAKE']} | |
f9332757 | 2239 | summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())} |
e3667660 | 2240 | summary_info += {'sphinx-build': sphinx_build.found()} |
f9332757 PB |
2241 | summary_info += {'genisoimage': config_host['GENISOIMAGE']} |
2242 | # TODO: add back version | |
4d34a86b PB |
2243 | summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt} |
2244 | if slirp_opt != 'disabled' | |
f9332757 PB |
2245 | summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']} |
2246 | endif | |
2247 | summary_info += {'module support': config_host.has_key('CONFIG_MODULES')} | |
2248 | if config_host.has_key('CONFIG_MODULES') | |
2249 | summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')} | |
2250 | endif | |
2251 | summary_info += {'host CPU': cpu} | |
2252 | summary_info += {'host endianness': build_machine.endian()} | |
fdb75aef | 2253 | summary_info += {'target list': ' '.join(target_dirs)} |
f9332757 | 2254 | summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} |
deb62371 | 2255 | summary_info += {'sparse enabled': sparse.found()} |
f9332757 PB |
2256 | summary_info += {'strip binaries': get_option('strip')} |
2257 | summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} | |
cdad781d | 2258 | summary_info += {'link-time optimization (LTO)': get_option('b_lto')} |
3e8529dd | 2259 | summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} |
f9332757 PB |
2260 | if targetos == 'darwin' |
2261 | summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')} | |
2262 | endif | |
2263 | # TODO: add back version | |
35be72ba PB |
2264 | summary_info += {'SDL support': sdl.found()} |
2265 | summary_info += {'SDL image support': sdl_image.found()} | |
f9332757 PB |
2266 | # TODO: add back version |
2267 | summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} | |
2268 | summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} | |
b7612f45 | 2269 | summary_info += {'pixman': pixman.found()} |
f9332757 PB |
2270 | # TODO: add back version |
2271 | summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} | |
2272 | summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']} | |
2273 | summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')} | |
2274 | # TODO: add back version | |
2275 | summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')} | |
2276 | if config_host.has_key('CONFIG_GCRYPT') | |
2277 | summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')} | |
2278 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} | |
2279 | endif | |
2280 | # TODO: add back version | |
2281 | summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')} | |
2282 | if config_host.has_key('CONFIG_NETTLE') | |
2283 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} | |
2284 | endif | |
2285 | summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')} | |
2286 | summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} | |
5285e593 YL |
2287 | summary_info += {'iconv support': iconv.found()} |
2288 | summary_info += {'curses support': curses.found()} | |
f9332757 PB |
2289 | # TODO: add back version |
2290 | summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')} | |
f9cd86fe | 2291 | summary_info += {'curl support': curl.found()} |
f9332757 PB |
2292 | summary_info += {'mingw32 support': targetos == 'windows'} |
2293 | summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']} | |
2294 | summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} | |
2295 | summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} | |
2296 | summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')} | |
cece116c | 2297 | summary_info += {'build virtiofs daemon': have_virtiofsd} |
6ec0e15d | 2298 | summary_info += {'Multipath support': mpathpersist.found()} |
a0b93237 PB |
2299 | summary_info += {'VNC support': vnc.found()} |
2300 | if vnc.found() | |
2301 | summary_info += {'VNC SASL support': sasl.found()} | |
2302 | summary_info += {'VNC JPEG support': jpeg.found()} | |
2303 | summary_info += {'VNC PNG support': png.found()} | |
f9332757 PB |
2304 | endif |
2305 | summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} | |
2306 | if config_host.has_key('CONFIG_XEN_BACKEND') | |
2307 | summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} | |
2308 | endif | |
8c6d4ff4 | 2309 | summary_info += {'brlapi support': brlapi.found()} |
e3667660 | 2310 | summary_info += {'Documentation': build_docs} |
f9332757 PB |
2311 | summary_info += {'PIE': get_option('b_pie')} |
2312 | summary_info += {'vde support': config_host.has_key('CONFIG_VDE')} | |
2313 | summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')} | |
2314 | summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')} | |
2315 | summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')} | |
2316 | summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} | |
c8d5450b | 2317 | summary_info += {'Install blobs': get_option('install_blobs')} |
05512f55 PB |
2318 | summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} |
2319 | summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} | |
2320 | summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} | |
2321 | summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')} | |
2322 | summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')} | |
2323 | if config_all.has_key('CONFIG_TCG') | |
2324 | summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')} | |
2325 | summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')} | |
2326 | endif | |
aa087962 | 2327 | summary_info += {'malloc trim support': has_malloc_trim} |
f9332757 PB |
2328 | summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')} |
2329 | summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')} | |
fbb4121d | 2330 | summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt} |
f9332757 PB |
2331 | summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} |
2332 | summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')} | |
2333 | summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} | |
2334 | summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} | |
2335 | summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} | |
2336 | summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')} | |
2337 | summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')} | |
b54b82df | 2338 | summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')} |
f9332757 PB |
2339 | summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')} |
2340 | summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')} | |
2341 | summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')} | |
2342 | summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')} | |
b54b82df | 2343 | summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')} |
e5e856c1 | 2344 | summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} |
f9332757 PB |
2345 | summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')} |
2346 | summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')} | |
2347 | summary_info += {'Trace backends': config_host['TRACE_BACKENDS']} | |
2348 | if config_host['TRACE_BACKENDS'].split().contains('simple') | |
2349 | summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'} | |
2350 | endif | |
2351 | # TODO: add back protocol and server version | |
2352 | summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} | |
fabd1e93 | 2353 | summary_info += {'rbd support': rbd.found()} |
f9332757 PB |
2354 | summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} |
2355 | summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} | |
0a40bcb7 | 2356 | summary_info += {'U2F support': u2f.found()} |
f9332757 PB |
2357 | summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')} |
2358 | summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} | |
2359 | summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} | |
2360 | summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')} | |
9db405a3 | 2361 | summary_info += {'libiscsi support': libiscsi.found()} |
30045c05 | 2362 | summary_info += {'libnfs support': libnfs.found()} |
f9332757 PB |
2363 | summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')} |
2364 | if targetos == 'windows' | |
2365 | if 'WIN_SDK' in config_host | |
2366 | summary_info += {'Windows SDK': config_host['WIN_SDK']} | |
2367 | endif | |
2368 | summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')} | |
2369 | summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} | |
4bad7c3b | 2370 | summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')} |
f9332757 | 2371 | endif |
90835c2b | 2372 | summary_info += {'seccomp support': seccomp.found()} |
9e62ba48 DB |
2373 | summary_info += {'CFI support': get_option('cfi')} |
2374 | summary_info += {'CFI debug support': get_option('cfi_debug')} | |
f9332757 PB |
2375 | summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} |
2376 | summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'} | |
2377 | summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} | |
2378 | summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} | |
2379 | summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} | |
08821ca2 | 2380 | summary_info += {'GlusterFS support': glusterfs.found()} |
bf0e56a3 | 2381 | summary_info += {'gcov': get_option('b_coverage')} |
f9332757 PB |
2382 | summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')} |
2383 | summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')} | |
2384 | summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')} | |
2385 | summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} | |
0c32a0ae | 2386 | summary_info += {'lzo support': lzo.found()} |
241611ea | 2387 | summary_info += {'snappy support': snappy.found()} |
29ba6116 | 2388 | summary_info += {'bzip2 support': libbzip2.found()} |
ecea3696 | 2389 | summary_info += {'lzfse support': liblzfse.found()} |
b1def33d | 2390 | summary_info += {'zstd support': zstd.found()} |
f9332757 PB |
2391 | summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} |
2392 | summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')} | |
aa087962 | 2393 | summary_info += {'memory allocator': get_option('malloc')} |
f9332757 PB |
2394 | summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')} |
2395 | summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')} | |
2396 | summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')} | |
2397 | summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')} | |
2398 | summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')} | |
2399 | summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')} | |
2400 | summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')} | |
2401 | summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')} | |
2402 | summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')} | |
2403 | summary_info += {'qed support': config_host.has_key('CONFIG_QED')} | |
2404 | summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')} | |
2405 | summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')} | |
8b18cdbf | 2406 | summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt} |
f9332757 PB |
2407 | summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')} |
2408 | summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')} | |
f01496a3 | 2409 | summary_info += {'libudev': libudev.found()} |
f9332757 PB |
2410 | summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'} |
2411 | summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')} | |
2412 | summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')} | |
2413 | if config_host.has_key('HAVE_GDB_BIN') | |
2414 | summary_info += {'gdb': config_host['HAVE_GDB_BIN']} | |
2415 | endif | |
2416 | summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} | |
2417 | summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} | |
2418 | summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} | |
a484a719 | 2419 | summary_info += {'FUSE exports': fuse.found()} |
df4ea709 | 2420 | summary_info += {'FUSE lseek': fuse_lseek.found()} |
f9332757 PB |
2421 | summary(summary_info, bool_yn: true) |
2422 | ||
2423 | if not supported_cpus.contains(cpu) | |
2424 | message() | |
2425 | warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!') | |
2426 | message() | |
2427 | message('CPU host architecture ' + cpu + ' support is not currently maintained.') | |
2428 | message('The QEMU project intends to remove support for this host CPU in') | |
2429 | message('a future release if nobody volunteers to maintain it and to') | |
2430 | message('provide a build host for our continuous integration setup.') | |
2431 | message('configure has succeeded and you can continue to build, but') | |
2432 | message('if you care about QEMU on this platform you should contact') | |
2433 | message('us upstream at [email protected].') | |
2434 | endif | |
2435 | ||
2436 | if not supported_oses.contains(targetos) | |
2437 | message() | |
2438 | warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!') | |
2439 | message() | |
2440 | message('Host OS ' + targetos + 'support is not currently maintained.') | |
2441 | message('The QEMU project intends to remove support for this host OS in') | |
2442 | message('a future release if nobody volunteers to maintain it and to') | |
2443 | message('provide a build host for our continuous integration setup.') | |
2444 | message('configure has succeeded and you can continue to build, but') | |
2445 | message('if you care about QEMU on this platform you should contact') | |
2446 | message('us upstream at [email protected].') | |
2447 | endif |