Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 1 | project('qemu', ['c'], meson_version: '>=0.55.0', |
Gerd Hoffmann | 90756b2 | 2020-08-25 08:43:42 +0200 | [diff] [blame] | 2 | default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', |
Paolo Bonzini | 3e0e519 | 2020-09-01 12:48:00 -0400 | [diff] [blame] | 3 | 'b_colorout=auto'], |
Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 4 | version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) |
| 5 | |
| 6 | not_found = dependency('', required: false) |
Paolo Bonzini | b29b40f | 2020-08-10 18:04:43 +0200 | [diff] [blame] | 7 | if meson.version().version_compare('>=0.56.0') |
| 8 | keyval = import('keyval') |
| 9 | else |
| 10 | keyval = import('unstable-keyval') |
| 11 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 12 | ss = import('sourceset') |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 13 | fs = import('fs') |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 14 | |
Paolo Bonzini | ce1c1e7 | 2020-01-28 16:41:44 +0100 | [diff] [blame] | 15 | sh = find_program('sh') |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 16 | cc = meson.get_compiler('c') |
Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 17 | config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 18 | enable_modules = 'CONFIG_MODULES' in config_host |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 19 | enable_static = 'CONFIG_STATIC' in config_host |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 20 | build_docs = 'BUILD_DOCS' in config_host |
Marc-André Lureau | 8fe1123 | 2020-09-11 14:42:48 +0200 | [diff] [blame] | 21 | |
| 22 | if get_option('qemu_suffix').startswith('/') |
| 23 | error('qemu_suffix cannot start with a /') |
| 24 | endif |
| 25 | |
Marc-André Lureau | ab4c099 | 2020-08-26 15:04:16 +0400 | [diff] [blame] | 26 | qemu_datadir = get_option('datadir') / get_option('qemu_suffix') |
Marc-André Lureau | 491e74c | 2020-08-26 15:04:17 +0400 | [diff] [blame] | 27 | qemu_docdir = get_option('docdir') / get_option('qemu_suffix') |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 28 | config_host_data = configuration_data() |
| 29 | genh = [] |
Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 30 | |
Paolo Bonzini | 760e432 | 2020-08-26 08:09:48 +0200 | [diff] [blame] | 31 | target_dirs = config_host['TARGET_DIRS'].split() |
| 32 | have_user = false |
| 33 | have_system = false |
| 34 | foreach target : target_dirs |
| 35 | have_user = have_user or target.endswith('-user') |
| 36 | have_system = have_system or target.endswith('-softmmu') |
| 37 | endforeach |
| 38 | have_tools = 'CONFIG_TOOLS' in config_host |
| 39 | have_block = have_system or have_tools |
| 40 | |
Paolo Bonzini | 201e8ed | 2020-09-01 07:45:54 -0400 | [diff] [blame] | 41 | python = import('python').find_installation() |
| 42 | |
| 43 | supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux'] |
| 44 | supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64', |
| 45 | 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64'] |
| 46 | |
| 47 | cpu = host_machine.cpu_family() |
| 48 | targetos = host_machine.system() |
| 49 | |
| 50 | configure_file(input: files('scripts/ninjatool.py'), |
| 51 | output: 'ninjatool', |
| 52 | configuration: config_host) |
| 53 | |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 54 | if cpu in ['x86', 'x86_64'] |
| 55 | kvm_targets = ['i386-softmmu', 'x86_64-softmmu'] |
| 56 | elif cpu == 'aarch64' |
| 57 | kvm_targets = ['aarch64-softmmu'] |
| 58 | elif cpu == 's390x' |
| 59 | kvm_targets = ['s390x-softmmu'] |
| 60 | elif cpu in ['ppc', 'ppc64'] |
| 61 | kvm_targets = ['ppc-softmmu', 'ppc64-softmmu'] |
Huacai Chen | fbc5884 | 2020-10-07 16:39:28 +0800 | [diff] [blame^] | 62 | elif cpu in ['mips', 'mips64'] |
| 63 | kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu'] |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 64 | else |
| 65 | kvm_targets = [] |
| 66 | endif |
| 67 | |
| 68 | accelerator_targets = { 'CONFIG_KVM': kvm_targets } |
| 69 | if cpu in ['x86', 'x86_64'] |
| 70 | accelerator_targets += { |
| 71 | 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], |
| 72 | 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], |
| 73 | 'CONFIG_HVF': ['x86_64-softmmu'], |
| 74 | 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], |
| 75 | } |
| 76 | endif |
| 77 | |
Paolo Bonzini | 201e8ed | 2020-09-01 07:45:54 -0400 | [diff] [blame] | 78 | ################## |
| 79 | # Compiler flags # |
| 80 | ################## |
| 81 | |
Alexander Bulekov | ff9ed62 | 2020-09-09 18:05:16 -0400 | [diff] [blame] | 82 | # Specify linker-script with add_project_link_arguments so that it is not placed |
| 83 | # within a linker --start-group/--end-group pair |
| 84 | if 'CONFIG_FUZZ' in config_host |
| 85 | add_project_link_arguments(['-Wl,-T,', |
| 86 | (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], |
| 87 | native: false, language: ['c', 'cpp', 'objc']) |
| 88 | endif |
| 89 | |
Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 90 | add_project_arguments(config_host['QEMU_CFLAGS'].split(), |
| 91 | native: false, language: ['c', 'objc']) |
| 92 | add_project_arguments(config_host['QEMU_CXXFLAGS'].split(), |
| 93 | native: false, language: 'cpp') |
| 94 | add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(), |
| 95 | native: false, language: ['c', 'cpp', 'objc']) |
| 96 | add_project_arguments(config_host['QEMU_INCLUDES'].split(), |
| 97 | language: ['c', 'cpp', 'objc']) |
| 98 | |
Alexander Bulekov | c46f76d | 2020-09-02 13:36:50 -0400 | [diff] [blame] | 99 | |
Marc-André Lureau | fc92989 | 2019-07-13 01:47:54 +0400 | [diff] [blame] | 100 | link_language = meson.get_external_property('link_language', 'cpp') |
| 101 | if link_language == 'cpp' |
| 102 | add_languages('cpp', required: true, native: false) |
| 103 | endif |
Paolo Bonzini | a566505 | 2019-06-10 12:05:14 +0200 | [diff] [blame] | 104 | if host_machine.system() == 'darwin' |
| 105 | add_languages('objc', required: false, native: false) |
| 106 | endif |
| 107 | |
Paolo Bonzini | deb6237 | 2020-09-01 07:51:16 -0400 | [diff] [blame] | 108 | sparse = find_program('cgcc', required: get_option('sparse')) |
| 109 | if sparse.found() |
Paolo Bonzini | 968b4db | 2020-02-03 14:45:33 +0100 | [diff] [blame] | 110 | run_target('sparse', |
| 111 | command: [find_program('scripts/check_sparse.py'), |
Paolo Bonzini | deb6237 | 2020-09-01 07:51:16 -0400 | [diff] [blame] | 112 | 'compile_commands.json', sparse.full_path(), '-Wbitwise', |
| 113 | '-Wno-transparent-union', '-Wno-old-initializer', |
| 114 | '-Wno-non-pointer-null']) |
Paolo Bonzini | 968b4db | 2020-02-03 14:45:33 +0100 | [diff] [blame] | 115 | endif |
| 116 | |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 117 | ########################################### |
| 118 | # Target-specific checks and dependencies # |
| 119 | ########################################### |
| 120 | |
| 121 | if targetos != 'linux' and get_option('mpath').enabled() |
| 122 | error('Multipath is supported only on Linux') |
| 123 | endif |
| 124 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 125 | m = cc.find_library('m', required: false) |
| 126 | util = cc.find_library('util', required: false) |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 127 | winmm = [] |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 128 | socket = [] |
Marc-André Lureau | 04c6f1e | 2019-07-18 00:31:05 +0400 | [diff] [blame] | 129 | version_res = [] |
Marc-André Lureau | d92989a | 2019-08-20 19:48:59 +0400 | [diff] [blame] | 130 | coref = [] |
| 131 | iokit = [] |
Paolo Bonzini | b6c7cfd | 2020-09-21 04:49:50 -0400 | [diff] [blame] | 132 | emulator_link_args = [] |
Paolo Bonzini | b4e312e | 2020-09-01 11:28:59 -0400 | [diff] [blame] | 133 | cocoa = not_found |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 134 | hvf = not_found |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 135 | if targetos == 'windows' |
| 136 | socket = cc.find_library('ws2_32') |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 137 | winmm = cc.find_library('winmm') |
Marc-André Lureau | 04c6f1e | 2019-07-18 00:31:05 +0400 | [diff] [blame] | 138 | |
| 139 | win = import('windows') |
| 140 | version_res = win.compile_resources('version.rc', |
| 141 | depend_files: files('pc-bios/qemu-nsis.ico'), |
| 142 | include_directories: include_directories('.')) |
Marc-André Lureau | d92989a | 2019-08-20 19:48:59 +0400 | [diff] [blame] | 143 | elif targetos == 'darwin' |
| 144 | coref = dependency('appleframeworks', modules: 'CoreFoundation') |
| 145 | iokit = dependency('appleframeworks', modules: 'IOKit') |
Paolo Bonzini | b4e312e | 2020-09-01 11:28:59 -0400 | [diff] [blame] | 146 | cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) |
Paolo Bonzini | cfad62f | 2020-08-09 23:47:45 +0200 | [diff] [blame] | 147 | elif targetos == 'sunos' |
| 148 | socket = [cc.find_library('socket'), |
| 149 | cc.find_library('nsl'), |
| 150 | cc.find_library('resolv')] |
| 151 | elif targetos == 'haiku' |
| 152 | socket = [cc.find_library('posix_error_mapper'), |
| 153 | cc.find_library('network'), |
| 154 | cc.find_library('bsd')] |
Paolo Bonzini | b6c7cfd | 2020-09-21 04:49:50 -0400 | [diff] [blame] | 155 | elif targetos == 'openbsd' |
| 156 | if not get_option('tcg').disabled() and target_dirs.length() > 0 |
| 157 | # Disable OpenBSD W^X if available |
| 158 | emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded') |
| 159 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 160 | endif |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 161 | |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 162 | accelerators = [] |
| 163 | if not get_option('kvm').disabled() and targetos == 'linux' |
| 164 | accelerators += 'CONFIG_KVM' |
| 165 | endif |
| 166 | if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host |
| 167 | accelerators += 'CONFIG_XEN' |
| 168 | have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux' |
| 169 | else |
| 170 | have_xen_pci_passthrough = false |
| 171 | endif |
| 172 | if not get_option('whpx').disabled() and targetos == 'windows' |
| 173 | if get_option('whpx').enabled() and cpu != 'x86_64' |
| 174 | error('WHPX requires 64-bit host') |
| 175 | elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \ |
| 176 | cc.has_header('WinHvEmulation.h', required: get_option('whpx')) |
| 177 | accelerators += 'CONFIG_WHPX' |
| 178 | endif |
| 179 | endif |
| 180 | if not get_option('hvf').disabled() |
| 181 | hvf = dependency('appleframeworks', modules: 'Hypervisor', |
| 182 | required: get_option('hvf')) |
| 183 | if hvf.found() |
| 184 | accelerators += 'CONFIG_HVF' |
| 185 | endif |
| 186 | endif |
| 187 | if not get_option('hax').disabled() |
| 188 | if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd'] |
| 189 | accelerators += 'CONFIG_HAX' |
| 190 | endif |
| 191 | endif |
| 192 | if not get_option('tcg').disabled() |
| 193 | if cpu not in supported_cpus |
| 194 | if 'CONFIG_TCG_INTERPRETER' in config_host |
| 195 | warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu)) |
| 196 | else |
| 197 | error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu)) |
| 198 | endif |
| 199 | endif |
| 200 | accelerators += 'CONFIG_TCG' |
| 201 | config_host += { 'CONFIG_TCG': 'y' } |
| 202 | endif |
| 203 | |
| 204 | if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled() |
| 205 | error('KVM not available on this platform') |
| 206 | endif |
| 207 | if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled() |
| 208 | error('HVF not available on this platform') |
| 209 | endif |
| 210 | if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled() |
| 211 | error('WHPX not available on this platform') |
| 212 | endif |
| 213 | if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() |
| 214 | if 'CONFIG_XEN' in accelerators |
| 215 | error('Xen PCI passthrough not available on this platform') |
| 216 | else |
| 217 | error('Xen PCI passthrough requested but Xen not enabled') |
| 218 | endif |
| 219 | endif |
Paolo Bonzini | b4e312e | 2020-09-01 11:28:59 -0400 | [diff] [blame] | 220 | if not cocoa.found() and get_option('cocoa').enabled() |
| 221 | error('Cocoa not available on this platform') |
| 222 | endif |
| 223 | |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 224 | ################ |
| 225 | # Dependencies # |
| 226 | ################ |
| 227 | |
Paolo Bonzini | 215b0c2 | 2020-09-01 08:41:17 -0400 | [diff] [blame] | 228 | # The path to glib.h is added to all compilation commands. This was |
| 229 | # grandfathered in from the QEMU Makefiles. |
| 230 | add_project_arguments(config_host['GLIB_CFLAGS'].split(), |
| 231 | native: false, language: ['c', 'cpp', 'objc']) |
| 232 | glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split()) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 233 | gio = not_found |
| 234 | if 'CONFIG_GIO' in config_host |
| 235 | gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(), |
| 236 | link_args: config_host['GIO_LIBS'].split()) |
| 237 | endif |
| 238 | lttng = not_found |
| 239 | if 'CONFIG_TRACE_UST' in config_host |
| 240 | lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split()) |
| 241 | endif |
| 242 | urcubp = not_found |
| 243 | if 'CONFIG_TRACE_UST' in config_host |
| 244 | urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split()) |
| 245 | endif |
Daniel P. Berrangé | 46859d9 | 2020-09-01 14:30:49 +0100 | [diff] [blame] | 246 | gcrypt = not_found |
| 247 | if 'CONFIG_GCRYPT' in config_host |
| 248 | gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(), |
| 249 | link_args: config_host['GCRYPT_LIBS'].split()) |
| 250 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 251 | nettle = not_found |
| 252 | if 'CONFIG_NETTLE' in config_host |
| 253 | nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(), |
| 254 | link_args: config_host['NETTLE_LIBS'].split()) |
| 255 | endif |
| 256 | gnutls = not_found |
| 257 | if 'CONFIG_GNUTLS' in config_host |
| 258 | gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(), |
| 259 | link_args: config_host['GNUTLS_LIBS'].split()) |
| 260 | endif |
Paolo Bonzini | b7612f4 | 2020-08-26 08:22:58 +0200 | [diff] [blame] | 261 | pixman = not_found |
| 262 | if have_system or have_tools |
| 263 | pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', |
Paolo Bonzini | 1a94933 | 2020-08-31 06:27:00 -0400 | [diff] [blame] | 264 | method: 'pkg-config', static: enable_static) |
Paolo Bonzini | b7612f4 | 2020-08-26 08:22:58 +0200 | [diff] [blame] | 265 | endif |
Marc-André Lureau | 5e7fbd2 | 2019-07-15 22:54:34 +0400 | [diff] [blame] | 266 | pam = not_found |
| 267 | if 'CONFIG_AUTH_PAM' in config_host |
| 268 | pam = cc.find_library('pam') |
| 269 | endif |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 270 | libaio = cc.find_library('aio', required: false) |
Paolo Bonzini | 1ffb3bb | 2020-08-28 19:33:54 +0200 | [diff] [blame] | 271 | zlib = dependency('zlib', required: true, static: enable_static) |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 272 | linux_io_uring = not_found |
| 273 | if 'CONFIG_LINUX_IO_URING' in config_host |
| 274 | linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(), |
| 275 | link_args: config_host['LINUX_IO_URING_LIBS'].split()) |
| 276 | endif |
| 277 | libxml2 = not_found |
| 278 | if 'CONFIG_LIBXML2' in config_host |
| 279 | libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(), |
| 280 | link_args: config_host['LIBXML2_LIBS'].split()) |
| 281 | endif |
| 282 | libnfs = not_found |
| 283 | if 'CONFIG_LIBNFS' in config_host |
| 284 | libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split()) |
| 285 | endif |
Marc-André Lureau | ec0d589 | 2019-07-15 15:04:49 +0400 | [diff] [blame] | 286 | libattr = not_found |
| 287 | if 'CONFIG_ATTR' in config_host |
| 288 | libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split()) |
| 289 | endif |
Paolo Bonzini | 3f99cf5 | 2020-02-05 09:45:39 +0100 | [diff] [blame] | 290 | seccomp = not_found |
| 291 | if 'CONFIG_SECCOMP' in config_host |
| 292 | seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(), |
| 293 | link_args: config_host['SECCOMP_LIBS'].split()) |
| 294 | endif |
| 295 | libcap_ng = not_found |
| 296 | if 'CONFIG_LIBCAP_NG' in config_host |
| 297 | libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split()) |
| 298 | endif |
Paolo Bonzini | 1917ec6 | 2020-08-26 03:24:11 -0400 | [diff] [blame] | 299 | if get_option('xkbcommon').auto() and not have_system and not have_tools |
| 300 | xkbcommon = not_found |
| 301 | else |
| 302 | xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), |
Paolo Bonzini | 1a94933 | 2020-08-31 06:27:00 -0400 | [diff] [blame] | 303 | method: 'pkg-config', static: enable_static) |
Marc-André Lureau | ade60d4 | 2019-07-15 14:48:31 +0400 | [diff] [blame] | 304 | endif |
Marc-André Lureau | cdaf072 | 2019-07-22 23:47:50 +0400 | [diff] [blame] | 305 | vde = not_found |
| 306 | if config_host.has_key('CONFIG_VDE') |
| 307 | vde = declare_dependency(link_args: config_host['VDE_LIBS'].split()) |
| 308 | endif |
Paolo Bonzini | 478e943 | 2020-08-17 12:47:55 +0200 | [diff] [blame] | 309 | pulse = not_found |
| 310 | if 'CONFIG_LIBPULSE' in config_host |
| 311 | pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(), |
| 312 | link_args: config_host['PULSE_LIBS'].split()) |
| 313 | endif |
| 314 | alsa = not_found |
| 315 | if 'CONFIG_ALSA' in config_host |
| 316 | alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(), |
| 317 | link_args: config_host['ALSA_LIBS'].split()) |
| 318 | endif |
| 319 | jack = not_found |
| 320 | if 'CONFIG_LIBJACK' in config_host |
| 321 | jack = declare_dependency(link_args: config_host['JACK_LIBS'].split()) |
| 322 | endif |
Paolo Bonzini | 2634733 | 2019-07-29 15:40:07 +0200 | [diff] [blame] | 323 | spice = not_found |
| 324 | if 'CONFIG_SPICE' in config_host |
| 325 | spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(), |
| 326 | link_args: config_host['SPICE_LIBS'].split()) |
| 327 | endif |
Marc-André Lureau | 5ee24e7 | 2019-07-12 23:16:54 +0400 | [diff] [blame] | 328 | rt = cc.find_library('rt', required: false) |
Paolo Bonzini | ccf7afa | 2020-09-01 06:44:23 -0400 | [diff] [blame] | 329 | libdl = not_found |
| 330 | if 'CONFIG_PLUGIN' in config_host |
| 331 | libdl = cc.find_library('dl', required: true) |
| 332 | endif |
Paolo Bonzini | 99650b6 | 2019-06-10 12:21:14 +0200 | [diff] [blame] | 333 | libiscsi = not_found |
| 334 | if 'CONFIG_LIBISCSI' in config_host |
| 335 | libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(), |
| 336 | link_args: config_host['LIBISCSI_LIBS'].split()) |
| 337 | endif |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 338 | zstd = not_found |
| 339 | if 'CONFIG_ZSTD' in config_host |
| 340 | zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(), |
| 341 | link_args: config_host['ZSTD_LIBS'].split()) |
| 342 | endif |
Marc-André Lureau | ea45896 | 2019-07-12 22:23:46 +0400 | [diff] [blame] | 343 | gbm = not_found |
| 344 | if 'CONFIG_GBM' in config_host |
| 345 | gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(), |
| 346 | link_args: config_host['GBM_LIBS'].split()) |
| 347 | endif |
| 348 | virgl = not_found |
| 349 | if 'CONFIG_VIRGL' in config_host |
| 350 | virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(), |
| 351 | link_args: config_host['VIRGL_LIBS'].split()) |
| 352 | endif |
Marc-André Lureau | 1d7bb6a | 2019-07-12 23:47:06 +0400 | [diff] [blame] | 353 | curl = not_found |
| 354 | if 'CONFIG_CURL' in config_host |
| 355 | curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(), |
| 356 | link_args: config_host['CURL_LIBS'].split()) |
| 357 | endif |
Paolo Bonzini | f15bff2 | 2019-07-18 13:19:02 +0200 | [diff] [blame] | 358 | libudev = not_found |
Paolo Bonzini | f01496a | 2020-09-16 17:54:14 +0200 | [diff] [blame] | 359 | if targetos == 'linux' and (have_system or have_tools) |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 360 | libudev = dependency('libudev', |
| 361 | required: get_option('mpath').enabled(), |
| 362 | static: enable_static) |
Paolo Bonzini | f15bff2 | 2019-07-18 13:19:02 +0200 | [diff] [blame] | 363 | endif |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 364 | |
| 365 | mpathpersist = not_found |
| 366 | mpathpersist_new_api = false |
| 367 | if targetos == 'linux' and have_tools and not get_option('mpath').disabled() |
| 368 | mpath_test_source_new = ''' |
| 369 | #include <libudev.h> |
| 370 | #include <mpath_persist.h> |
| 371 | unsigned mpath_mx_alloc_len = 1024; |
| 372 | int logsink; |
| 373 | static struct config *multipath_conf; |
| 374 | extern struct udev *udev; |
| 375 | extern struct config *get_multipath_config(void); |
| 376 | extern void put_multipath_config(struct config *conf); |
| 377 | struct udev *udev; |
| 378 | struct config *get_multipath_config(void) { return multipath_conf; } |
| 379 | void put_multipath_config(struct config *conf) { } |
| 380 | int main(void) { |
| 381 | udev = udev_new(); |
| 382 | multipath_conf = mpath_lib_init(); |
| 383 | return 0; |
| 384 | }''' |
| 385 | mpath_test_source_old = ''' |
| 386 | #include <libudev.h> |
| 387 | #include <mpath_persist.h> |
| 388 | unsigned mpath_mx_alloc_len = 1024; |
| 389 | int logsink; |
| 390 | int main(void) { |
| 391 | struct udev *udev = udev_new(); |
| 392 | mpath_lib_init(udev); |
| 393 | return 0; |
| 394 | }''' |
Paolo Bonzini | 43b43a4 | 2020-09-17 12:25:09 +0200 | [diff] [blame] | 395 | mpathlibs = [libudev] |
| 396 | if enable_static |
| 397 | mpathlibs += cc.find_library('devmapper', |
| 398 | required: get_option('mpath'), |
| 399 | static: enable_static) |
| 400 | endif |
| 401 | mpathlibs += cc.find_library('multipath', |
| 402 | required: get_option('mpath'), |
| 403 | static: enable_static) |
| 404 | mpathlibs += cc.find_library('mpathpersist', |
| 405 | required: get_option('mpath'), |
| 406 | static: enable_static) |
| 407 | foreach lib: mpathlibs |
| 408 | if not lib.found() |
| 409 | mpathlibs = [] |
| 410 | break |
| 411 | endif |
| 412 | endforeach |
| 413 | if mpathlibs.length() > 0 |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 414 | if cc.links(mpath_test_source_new, dependencies: mpathlibs) |
| 415 | mpathpersist = declare_dependency(dependencies: mpathlibs) |
| 416 | mpathpersist_new_api = true |
| 417 | elif cc.links(mpath_test_source_old, dependencies: mpathlibs) |
| 418 | mpathpersist = declare_dependency(dependencies: mpathlibs) |
| 419 | else |
| 420 | if get_option('mpath').enabled() |
| 421 | error('Cannot detect libmpathpersist API') |
| 422 | else |
| 423 | warning('Cannot detect libmpathpersist API, disabling') |
| 424 | endif |
| 425 | endif |
| 426 | endif |
| 427 | endif |
| 428 | |
Paolo Bonzini | 2634733 | 2019-07-29 15:40:07 +0200 | [diff] [blame] | 429 | brlapi = not_found |
| 430 | if 'CONFIG_BRLAPI' in config_host |
| 431 | brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split()) |
| 432 | endif |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 433 | |
Paolo Bonzini | 760e432 | 2020-08-26 08:09:48 +0200 | [diff] [blame] | 434 | sdl = not_found |
| 435 | if have_system |
Yonggang Luo | 363743d | 2020-08-26 23:10:03 +0800 | [diff] [blame] | 436 | sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) |
Paolo Bonzini | 760e432 | 2020-08-26 08:09:48 +0200 | [diff] [blame] | 437 | sdl_image = not_found |
| 438 | endif |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 439 | if sdl.found() |
| 440 | # work around 2.0.8 bug |
| 441 | sdl = declare_dependency(compile_args: '-Wno-undef', |
| 442 | dependencies: sdl) |
Volker Rümelin | 7161a43 | 2020-08-29 12:41:58 +0200 | [diff] [blame] | 443 | sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), |
Paolo Bonzini | 1a94933 | 2020-08-31 06:27:00 -0400 | [diff] [blame] | 444 | method: 'pkg-config', static: enable_static) |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 445 | else |
| 446 | if get_option('sdl_image').enabled() |
Sergei Trofimovich | a8dc2ac | 2020-09-08 08:40:16 +0100 | [diff] [blame] | 447 | error('sdl-image required, but SDL was @0@'.format( |
| 448 | get_option('sdl').disabled() ? 'disabled' : 'not found')) |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 449 | endif |
| 450 | sdl_image = not_found |
Paolo Bonzini | 2634733 | 2019-07-29 15:40:07 +0200 | [diff] [blame] | 451 | endif |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 452 | |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 453 | rbd = not_found |
| 454 | if 'CONFIG_RBD' in config_host |
| 455 | rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split()) |
| 456 | endif |
| 457 | glusterfs = not_found |
| 458 | if 'CONFIG_GLUSTERFS' in config_host |
| 459 | glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(), |
| 460 | link_args: config_host['GLUSTERFS_LIBS'].split()) |
| 461 | endif |
| 462 | libssh = not_found |
| 463 | if 'CONFIG_LIBSSH' in config_host |
| 464 | libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(), |
| 465 | link_args: config_host['LIBSSH_LIBS'].split()) |
| 466 | endif |
| 467 | libbzip2 = not_found |
| 468 | if 'CONFIG_BZIP2' in config_host |
| 469 | libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split()) |
| 470 | endif |
| 471 | liblzfse = not_found |
| 472 | if 'CONFIG_LZFSE' in config_host |
| 473 | liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split()) |
| 474 | endif |
Paolo Bonzini | 478e943 | 2020-08-17 12:47:55 +0200 | [diff] [blame] | 475 | oss = not_found |
| 476 | if 'CONFIG_AUDIO_OSS' in config_host |
| 477 | oss = declare_dependency(link_args: config_host['OSS_LIBS'].split()) |
| 478 | endif |
| 479 | dsound = not_found |
| 480 | if 'CONFIG_AUDIO_DSOUND' in config_host |
| 481 | dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split()) |
| 482 | endif |
| 483 | coreaudio = not_found |
| 484 | if 'CONFIG_AUDIO_COREAUDIO' in config_host |
| 485 | coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split()) |
| 486 | endif |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 487 | opengl = not_found |
| 488 | if 'CONFIG_OPENGL' in config_host |
Paolo Bonzini | de2d300 | 2020-09-01 08:41:17 -0400 | [diff] [blame] | 489 | opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), |
| 490 | link_args: config_host['OPENGL_LIBS'].split()) |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 491 | endif |
| 492 | gtk = not_found |
| 493 | if 'CONFIG_GTK' in config_host |
| 494 | gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), |
| 495 | link_args: config_host['GTK_LIBS'].split()) |
| 496 | endif |
| 497 | vte = not_found |
| 498 | if 'CONFIG_VTE' in config_host |
| 499 | vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), |
| 500 | link_args: config_host['VTE_LIBS'].split()) |
| 501 | endif |
| 502 | x11 = not_found |
| 503 | if 'CONFIG_X11' in config_host |
| 504 | x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), |
| 505 | link_args: config_host['X11_LIBS'].split()) |
| 506 | endif |
| 507 | curses = not_found |
| 508 | if 'CONFIG_CURSES' in config_host |
| 509 | curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(), |
| 510 | link_args: config_host['CURSES_LIBS'].split()) |
| 511 | endif |
| 512 | iconv = not_found |
| 513 | if 'CONFIG_ICONV' in config_host |
| 514 | iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(), |
| 515 | link_args: config_host['ICONV_LIBS'].split()) |
| 516 | endif |
Paolo Bonzini | a0b9323 | 2020-02-06 15:48:52 +0100 | [diff] [blame] | 517 | vnc = not_found |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 518 | png = not_found |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 519 | jpeg = not_found |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 520 | sasl = not_found |
Paolo Bonzini | a0b9323 | 2020-02-06 15:48:52 +0100 | [diff] [blame] | 521 | if get_option('vnc').enabled() |
| 522 | vnc = declare_dependency() # dummy dependency |
| 523 | png = dependency('libpng', required: get_option('vnc_png'), |
Paolo Bonzini | 1a94933 | 2020-08-31 06:27:00 -0400 | [diff] [blame] | 524 | method: 'pkg-config', static: enable_static) |
Paolo Bonzini | a0b9323 | 2020-02-06 15:48:52 +0100 | [diff] [blame] | 525 | jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'], |
| 526 | required: get_option('vnc_jpeg'), |
| 527 | static: enable_static) |
| 528 | sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], |
| 529 | required: get_option('vnc_sasl'), |
| 530 | static: enable_static) |
| 531 | if sasl.found() |
| 532 | sasl = declare_dependency(dependencies: sasl, |
| 533 | compile_args: '-DSTRUCT_IOVEC_DEFINED') |
| 534 | endif |
Marc-André Lureau | 2b1ccdf | 2019-07-16 23:21:02 +0400 | [diff] [blame] | 535 | endif |
Marc-André Lureau | 708eab4 | 2019-09-03 16:59:33 +0400 | [diff] [blame] | 536 | snappy = not_found |
| 537 | if 'CONFIG_SNAPPY' in config_host |
| 538 | snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split()) |
| 539 | endif |
| 540 | lzo = not_found |
| 541 | if 'CONFIG_LZO' in config_host |
| 542 | lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split()) |
| 543 | endif |
Marc-André Lureau | 5516623 | 2019-07-24 19:16:22 +0400 | [diff] [blame] | 544 | rdma = not_found |
| 545 | if 'CONFIG_RDMA' in config_host |
| 546 | rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split()) |
| 547 | endif |
Marc-André Lureau | ab31805 | 2019-07-24 19:23:16 +0400 | [diff] [blame] | 548 | numa = not_found |
| 549 | if 'CONFIG_NUMA' in config_host |
| 550 | numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split()) |
| 551 | endif |
Marc-André Lureau | 582ea95 | 2019-08-15 15:15:32 +0400 | [diff] [blame] | 552 | xen = not_found |
| 553 | if 'CONFIG_XEN_BACKEND' in config_host |
| 554 | xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(), |
| 555 | link_args: config_host['XEN_LIBS'].split()) |
| 556 | endif |
Paolo Bonzini | 06677ce | 2020-08-06 13:07:39 +0200 | [diff] [blame] | 557 | cacard = not_found |
| 558 | if 'CONFIG_SMARTCARD' in config_host |
| 559 | cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(), |
| 560 | link_args: config_host['SMARTCARD_LIBS'].split()) |
| 561 | endif |
César Belley | 0a40bcb | 2020-08-26 13:42:04 +0200 | [diff] [blame] | 562 | u2f = not_found |
| 563 | if have_system |
| 564 | u2f = dependency('u2f-emu', required: get_option('u2f'), |
| 565 | method: 'pkg-config', |
| 566 | static: enable_static) |
| 567 | endif |
Paolo Bonzini | 06677ce | 2020-08-06 13:07:39 +0200 | [diff] [blame] | 568 | usbredir = not_found |
| 569 | if 'CONFIG_USB_REDIR' in config_host |
| 570 | usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(), |
| 571 | link_args: config_host['USB_REDIR_LIBS'].split()) |
| 572 | endif |
| 573 | libusb = not_found |
| 574 | if 'CONFIG_USB_LIBUSB' in config_host |
| 575 | libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(), |
| 576 | link_args: config_host['LIBUSB_LIBS'].split()) |
| 577 | endif |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 578 | libpmem = not_found |
| 579 | if 'CONFIG_LIBPMEM' in config_host |
| 580 | libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(), |
| 581 | link_args: config_host['LIBPMEM_LIBS'].split()) |
| 582 | endif |
Bruce Rogers | c7c91a7 | 2020-08-24 09:52:12 -0600 | [diff] [blame] | 583 | libdaxctl = not_found |
| 584 | if 'CONFIG_LIBDAXCTL' in config_host |
| 585 | libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split()) |
| 586 | endif |
Marc-André Lureau | 8ce0a45 | 2020-08-28 15:07:20 +0400 | [diff] [blame] | 587 | tasn1 = not_found |
| 588 | if 'CONFIG_TASN1' in config_host |
| 589 | tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(), |
| 590 | link_args: config_host['TASN1_LIBS'].split()) |
| 591 | endif |
Marc-André Lureau | af04e89 | 2020-08-28 15:07:25 +0400 | [diff] [blame] | 592 | keyutils = dependency('libkeyutils', required: false, |
| 593 | method: 'pkg-config', static: enable_static) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 594 | |
Marc-André Lureau | 3909def | 2020-08-28 15:07:33 +0400 | [diff] [blame] | 595 | has_gettid = cc.has_function('gettid') |
| 596 | |
Paolo Bonzini | aa08796 | 2020-09-01 11:15:30 -0400 | [diff] [blame] | 597 | # Malloc tests |
| 598 | |
| 599 | malloc = [] |
| 600 | if get_option('malloc') == 'system' |
| 601 | has_malloc_trim = \ |
| 602 | not get_option('malloc_trim').disabled() and \ |
| 603 | cc.links('''#include <malloc.h> |
| 604 | int main(void) { malloc_trim(0); return 0; }''') |
| 605 | else |
| 606 | has_malloc_trim = false |
| 607 | malloc = cc.find_library(get_option('malloc'), required: true) |
| 608 | endif |
| 609 | if not has_malloc_trim and get_option('malloc_trim').enabled() |
| 610 | if get_option('malloc') == 'system' |
| 611 | error('malloc_trim not available on this platform.') |
| 612 | else |
| 613 | error('malloc_trim not available with non-libc memory allocator') |
| 614 | endif |
| 615 | endif |
| 616 | |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 617 | # Create config-host.h |
| 618 | |
Paolo Bonzini | b4e312e | 2020-09-01 11:28:59 -0400 | [diff] [blame] | 619 | config_host_data.set('CONFIG_COCOA', cocoa.found()) |
Paolo Bonzini | f01496a | 2020-09-16 17:54:14 +0200 | [diff] [blame] | 620 | config_host_data.set('CONFIG_LIBUDEV', libudev.found()) |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 621 | config_host_data.set('CONFIG_MPATH', mpathpersist.found()) |
| 622 | config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 623 | config_host_data.set('CONFIG_SDL', sdl.found()) |
| 624 | config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) |
Paolo Bonzini | a0b9323 | 2020-02-06 15:48:52 +0100 | [diff] [blame] | 625 | config_host_data.set('CONFIG_VNC', vnc.found()) |
| 626 | config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) |
| 627 | config_host_data.set('CONFIG_VNC_PNG', png.found()) |
| 628 | config_host_data.set('CONFIG_VNC_SASL', sasl.found()) |
Laurent Vivier | 4113f4c | 2020-08-24 17:24:29 +0200 | [diff] [blame] | 629 | config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) |
Marc-André Lureau | af04e89 | 2020-08-28 15:07:25 +0400 | [diff] [blame] | 630 | config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) |
Marc-André Lureau | 3909def | 2020-08-28 15:07:33 +0400 | [diff] [blame] | 631 | config_host_data.set('CONFIG_GETTID', has_gettid) |
Paolo Bonzini | aa08796 | 2020-09-01 11:15:30 -0400 | [diff] [blame] | 632 | config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 633 | config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) |
| 634 | config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) |
| 635 | config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) |
| 636 | config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) |
| 637 | |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 638 | ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 639 | arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] |
Paolo Bonzini | f4f5ed2 | 2020-08-18 11:55:47 +0200 | [diff] [blame] | 640 | strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir', |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 641 | 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir', |
Paolo Bonzini | f4f5ed2 | 2020-08-18 11:55:47 +0200 | [diff] [blame] | 642 | 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir'] |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 643 | foreach k, v: config_host |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 644 | if ignored.contains(k) |
| 645 | # do nothing |
| 646 | elif arrays.contains(k) |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 647 | if v != '' |
| 648 | v = '"' + '", "'.join(v.split()) + '", ' |
| 649 | endif |
| 650 | config_host_data.set(k, v) |
| 651 | elif k == 'ARCH' |
| 652 | config_host_data.set('HOST_' + v.to_upper(), 1) |
| 653 | elif strings.contains(k) |
| 654 | if not k.startswith('CONFIG_') |
| 655 | k = 'CONFIG_' + k.to_upper() |
| 656 | endif |
| 657 | config_host_data.set_quoted(k, v) |
| 658 | elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_') |
| 659 | config_host_data.set(k, v == 'y' ? 1 : v) |
| 660 | endif |
| 661 | endforeach |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 662 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 663 | minikconf = find_program('scripts/minikconf.py') |
Paolo Bonzini | 05512f5 | 2020-09-16 15:31:11 -0400 | [diff] [blame] | 664 | config_all = {} |
Paolo Bonzini | a98006b | 2020-09-01 05:32:23 -0400 | [diff] [blame] | 665 | config_all_devices = {} |
Paolo Bonzini | ca0fc78 | 2020-09-01 06:04:28 -0400 | [diff] [blame] | 666 | config_all_disas = {} |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 667 | config_devices_mak_list = [] |
| 668 | config_devices_h = {} |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 669 | config_target_h = {} |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 670 | config_target_mak = {} |
Paolo Bonzini | ca0fc78 | 2020-09-01 06:04:28 -0400 | [diff] [blame] | 671 | |
| 672 | disassemblers = { |
| 673 | 'alpha' : ['CONFIG_ALPHA_DIS'], |
| 674 | 'arm' : ['CONFIG_ARM_DIS'], |
| 675 | 'avr' : ['CONFIG_AVR_DIS'], |
| 676 | 'cris' : ['CONFIG_CRIS_DIS'], |
| 677 | 'hppa' : ['CONFIG_HPPA_DIS'], |
| 678 | 'i386' : ['CONFIG_I386_DIS'], |
| 679 | 'x86_64' : ['CONFIG_I386_DIS'], |
| 680 | 'x32' : ['CONFIG_I386_DIS'], |
| 681 | 'lm32' : ['CONFIG_LM32_DIS'], |
| 682 | 'm68k' : ['CONFIG_M68K_DIS'], |
| 683 | 'microblaze' : ['CONFIG_MICROBLAZE_DIS'], |
| 684 | 'mips' : ['CONFIG_MIPS_DIS'], |
| 685 | 'moxie' : ['CONFIG_MOXIE_DIS'], |
| 686 | 'nios2' : ['CONFIG_NIOS2_DIS'], |
| 687 | 'or1k' : ['CONFIG_OPENRISC_DIS'], |
| 688 | 'ppc' : ['CONFIG_PPC_DIS'], |
| 689 | 'riscv' : ['CONFIG_RISCV_DIS'], |
| 690 | 'rx' : ['CONFIG_RX_DIS'], |
| 691 | 's390' : ['CONFIG_S390_DIS'], |
| 692 | 'sh4' : ['CONFIG_SH4_DIS'], |
| 693 | 'sparc' : ['CONFIG_SPARC_DIS'], |
| 694 | 'xtensa' : ['CONFIG_XTENSA_DIS'], |
| 695 | } |
| 696 | if link_language == 'cpp' |
| 697 | disassemblers += { |
| 698 | 'aarch64' : [ 'CONFIG_ARM_A64_DIS'], |
| 699 | 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'], |
| 700 | 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'], |
| 701 | } |
| 702 | endif |
| 703 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 704 | kconfig_external_symbols = [ |
| 705 | 'CONFIG_KVM', |
| 706 | 'CONFIG_XEN', |
| 707 | 'CONFIG_TPM', |
| 708 | 'CONFIG_SPICE', |
| 709 | 'CONFIG_IVSHMEM', |
| 710 | 'CONFIG_OPENGL', |
| 711 | 'CONFIG_X11', |
| 712 | 'CONFIG_VHOST_USER', |
Laurent Vivier | 40bc0ca | 2020-09-24 23:00:23 +0200 | [diff] [blame] | 713 | 'CONFIG_VHOST_VDPA', |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 714 | 'CONFIG_VHOST_KERNEL', |
| 715 | 'CONFIG_VIRTFS', |
| 716 | 'CONFIG_LINUX', |
| 717 | 'CONFIG_PVRDMA', |
| 718 | ] |
Paolo Bonzini | a9a7490 | 2020-09-21 05:11:01 -0400 | [diff] [blame] | 719 | ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] |
Paolo Bonzini | ca0fc78 | 2020-09-01 06:04:28 -0400 | [diff] [blame] | 720 | |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 721 | default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host |
| 722 | actual_target_dirs = [] |
Paolo Bonzini | fbb4121 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 723 | fdt_required = [] |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 724 | foreach target : target_dirs |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 725 | config_target = { 'TARGET_NAME': target.split('-')[0] } |
| 726 | if target.endswith('linux-user') |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 727 | if targetos != 'linux' |
| 728 | if default_targets |
| 729 | continue |
| 730 | endif |
| 731 | error('Target @0@ is only available on a Linux host'.format(target)) |
| 732 | endif |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 733 | config_target += { 'CONFIG_LINUX_USER': 'y' } |
| 734 | elif target.endswith('bsd-user') |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 735 | if 'CONFIG_BSD' not in config_host |
| 736 | if default_targets |
| 737 | continue |
| 738 | endif |
| 739 | error('Target @0@ is only available on a BSD host'.format(target)) |
| 740 | endif |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 741 | config_target += { 'CONFIG_BSD_USER': 'y' } |
| 742 | elif target.endswith('softmmu') |
| 743 | config_target += { 'CONFIG_SOFTMMU': 'y' } |
| 744 | endif |
| 745 | if target.endswith('-user') |
| 746 | config_target += { |
| 747 | 'CONFIG_USER_ONLY': 'y', |
| 748 | 'CONFIG_QEMU_INTERP_PREFIX': |
| 749 | config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME']) |
| 750 | } |
| 751 | endif |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 752 | |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 753 | have_accel = false |
| 754 | foreach sym: accelerators |
| 755 | if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) |
| 756 | config_target += { sym: 'y' } |
| 757 | config_all += { sym: 'y' } |
| 758 | if sym == 'CONFIG_XEN' and have_xen_pci_passthrough |
| 759 | config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } |
| 760 | endif |
| 761 | have_accel = true |
| 762 | endif |
| 763 | endforeach |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 764 | if not have_accel |
| 765 | if default_targets |
| 766 | continue |
| 767 | endif |
| 768 | error('No accelerator available for target @0@'.format(target)) |
| 769 | endif |
Paolo Bonzini | 8a19980 | 2020-09-18 05:37:01 -0400 | [diff] [blame] | 770 | |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 771 | actual_target_dirs += target |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 772 | config_target += keyval.load('default-configs/targets' / target + '.mak') |
Paolo Bonzini | a9a7490 | 2020-09-21 05:11:01 -0400 | [diff] [blame] | 773 | config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' } |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 774 | |
Paolo Bonzini | fbb4121 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 775 | if 'TARGET_NEED_FDT' in config_target |
| 776 | fdt_required += target |
| 777 | endif |
| 778 | |
Paolo Bonzini | fa73168 | 2020-09-21 05:19:07 -0400 | [diff] [blame] | 779 | # Add default keys |
| 780 | if 'TARGET_BASE_ARCH' not in config_target |
| 781 | config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']} |
| 782 | endif |
| 783 | if 'TARGET_ABI_DIR' not in config_target |
| 784 | config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']} |
| 785 | endif |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 786 | |
Paolo Bonzini | ca0fc78 | 2020-09-01 06:04:28 -0400 | [diff] [blame] | 787 | foreach k, v: disassemblers |
| 788 | if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) |
| 789 | foreach sym: v |
| 790 | config_target += { sym: 'y' } |
| 791 | config_all_disas += { sym: 'y' } |
| 792 | endforeach |
| 793 | endif |
| 794 | endforeach |
| 795 | |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 796 | config_target_data = configuration_data() |
| 797 | foreach k, v: config_target |
| 798 | if not k.startswith('TARGET_') and not k.startswith('CONFIG_') |
| 799 | # do nothing |
| 800 | elif ignored.contains(k) |
| 801 | # do nothing |
| 802 | elif k == 'TARGET_BASE_ARCH' |
Paolo Bonzini | a9a7490 | 2020-09-21 05:11:01 -0400 | [diff] [blame] | 803 | # Note that TARGET_BASE_ARCH ends up in config-target.h but it is |
| 804 | # not used to select files from sourcesets. |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 805 | config_target_data.set('TARGET_' + v.to_upper(), 1) |
Paolo Bonzini | 765686d | 2020-09-18 06:37:21 -0400 | [diff] [blame] | 806 | elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX' |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 807 | config_target_data.set_quoted(k, v) |
| 808 | elif v == 'y' |
| 809 | config_target_data.set(k, 1) |
| 810 | else |
| 811 | config_target_data.set(k, v) |
| 812 | endif |
| 813 | endforeach |
| 814 | config_target_h += {target: configure_file(output: target + '-config-target.h', |
| 815 | configuration: config_target_data)} |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 816 | |
| 817 | if target.endswith('-softmmu') |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 818 | base_kconfig = [] |
| 819 | foreach sym : kconfig_external_symbols |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 820 | if sym in config_target or sym in config_host |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 821 | base_kconfig += '@0@=y'.format(sym) |
| 822 | endif |
| 823 | endforeach |
| 824 | |
| 825 | config_devices_mak = target + '-config-devices.mak' |
| 826 | config_devices_mak = configure_file( |
Paolo Bonzini | 1bb4cb1 | 2020-09-18 06:06:09 -0400 | [diff] [blame] | 827 | input: ['default-configs/devices' / target + '.mak', 'Kconfig'], |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 828 | output: config_devices_mak, |
| 829 | depfile: config_devices_mak + '.d', |
| 830 | capture: true, |
| 831 | command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], |
| 832 | config_devices_mak, '@DEPFILE@', '@INPUT@', |
| 833 | base_kconfig]) |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 834 | |
| 835 | config_devices_data = configuration_data() |
| 836 | config_devices = keyval.load(config_devices_mak) |
| 837 | foreach k, v: config_devices |
| 838 | config_devices_data.set(k, 1) |
| 839 | endforeach |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 840 | config_devices_mak_list += config_devices_mak |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 841 | config_devices_h += {target: configure_file(output: target + '-config-devices.h', |
| 842 | configuration: config_devices_data)} |
| 843 | config_target += config_devices |
Paolo Bonzini | a98006b | 2020-09-01 05:32:23 -0400 | [diff] [blame] | 844 | config_all_devices += config_devices |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 845 | endif |
| 846 | config_target_mak += {target: config_target} |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 847 | endforeach |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 848 | target_dirs = actual_target_dirs |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 849 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 850 | # This configuration is used to build files that are shared by |
| 851 | # multiple binaries, and then extracted out of the "common" |
| 852 | # static_library target. |
| 853 | # |
| 854 | # We do not use all_sources()/all_dependencies(), because it would |
| 855 | # build literally all source files, including devices only used by |
| 856 | # targets that are not built for this compilation. The CONFIG_ALL |
| 857 | # pseudo symbol replaces it. |
| 858 | |
Paolo Bonzini | 05512f5 | 2020-09-16 15:31:11 -0400 | [diff] [blame] | 859 | config_all += config_all_devices |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 860 | config_all += config_host |
| 861 | config_all += config_all_disas |
| 862 | config_all += { |
| 863 | 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'), |
| 864 | 'CONFIG_SOFTMMU': have_system, |
| 865 | 'CONFIG_USER_ONLY': have_user, |
| 866 | 'CONFIG_ALL': true, |
| 867 | } |
| 868 | |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 869 | # Submodules |
| 870 | |
| 871 | capstone = not_found |
| 872 | capstone_opt = get_option('capstone') |
| 873 | if capstone_opt in ['enabled', 'auto', 'system'] |
| 874 | have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile') |
Richard Henderson | bcf3686 | 2020-09-21 09:46:16 -0700 | [diff] [blame] | 875 | capstone = dependency('capstone', version: '>=4.0', |
| 876 | static: enable_static, method: 'pkg-config', |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 877 | required: capstone_opt == 'system' or |
| 878 | capstone_opt == 'enabled' and not have_internal) |
| 879 | if capstone.found() |
| 880 | capstone_opt = 'system' |
| 881 | elif have_internal |
| 882 | capstone_opt = 'internal' |
| 883 | else |
| 884 | capstone_opt = 'disabled' |
| 885 | endif |
| 886 | endif |
| 887 | if capstone_opt == 'internal' |
| 888 | capstone_data = configuration_data() |
| 889 | capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1') |
| 890 | |
| 891 | capstone_files = files( |
| 892 | 'capstone/cs.c', |
| 893 | 'capstone/MCInst.c', |
| 894 | 'capstone/MCInstrDesc.c', |
| 895 | 'capstone/MCRegisterInfo.c', |
| 896 | 'capstone/SStream.c', |
| 897 | 'capstone/utils.c' |
| 898 | ) |
| 899 | |
| 900 | if 'CONFIG_ARM_DIS' in config_all_disas |
| 901 | capstone_data.set('CAPSTONE_HAS_ARM', '1') |
| 902 | capstone_files += files( |
| 903 | 'capstone/arch/ARM/ARMDisassembler.c', |
| 904 | 'capstone/arch/ARM/ARMInstPrinter.c', |
| 905 | 'capstone/arch/ARM/ARMMapping.c', |
| 906 | 'capstone/arch/ARM/ARMModule.c' |
| 907 | ) |
| 908 | endif |
| 909 | |
| 910 | # FIXME: This config entry currently depends on a c++ compiler. |
| 911 | # Which is needed for building libvixl, but not for capstone. |
| 912 | if 'CONFIG_ARM_A64_DIS' in config_all_disas |
| 913 | capstone_data.set('CAPSTONE_HAS_ARM64', '1') |
| 914 | capstone_files += files( |
| 915 | 'capstone/arch/AArch64/AArch64BaseInfo.c', |
| 916 | 'capstone/arch/AArch64/AArch64Disassembler.c', |
| 917 | 'capstone/arch/AArch64/AArch64InstPrinter.c', |
| 918 | 'capstone/arch/AArch64/AArch64Mapping.c', |
| 919 | 'capstone/arch/AArch64/AArch64Module.c' |
| 920 | ) |
| 921 | endif |
| 922 | |
| 923 | if 'CONFIG_PPC_DIS' in config_all_disas |
| 924 | capstone_data.set('CAPSTONE_HAS_POWERPC', '1') |
| 925 | capstone_files += files( |
| 926 | 'capstone/arch/PowerPC/PPCDisassembler.c', |
| 927 | 'capstone/arch/PowerPC/PPCInstPrinter.c', |
| 928 | 'capstone/arch/PowerPC/PPCMapping.c', |
| 929 | 'capstone/arch/PowerPC/PPCModule.c' |
| 930 | ) |
| 931 | endif |
| 932 | |
Richard Henderson | 3d56284 | 2020-01-04 07:24:59 +1000 | [diff] [blame] | 933 | if 'CONFIG_S390_DIS' in config_all_disas |
| 934 | capstone_data.set('CAPSTONE_HAS_SYSZ', '1') |
| 935 | capstone_files += files( |
| 936 | 'capstone/arch/SystemZ/SystemZDisassembler.c', |
| 937 | 'capstone/arch/SystemZ/SystemZInstPrinter.c', |
| 938 | 'capstone/arch/SystemZ/SystemZMapping.c', |
| 939 | 'capstone/arch/SystemZ/SystemZModule.c', |
| 940 | 'capstone/arch/SystemZ/SystemZMCTargetDesc.c' |
| 941 | ) |
| 942 | endif |
| 943 | |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 944 | if 'CONFIG_I386_DIS' in config_all_disas |
| 945 | capstone_data.set('CAPSTONE_HAS_X86', 1) |
| 946 | capstone_files += files( |
| 947 | 'capstone/arch/X86/X86Disassembler.c', |
| 948 | 'capstone/arch/X86/X86DisassemblerDecoder.c', |
| 949 | 'capstone/arch/X86/X86ATTInstPrinter.c', |
| 950 | 'capstone/arch/X86/X86IntelInstPrinter.c', |
Richard Henderson | eef20e4 | 2020-09-14 16:02:02 -0700 | [diff] [blame] | 951 | 'capstone/arch/X86/X86InstPrinterCommon.c', |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 952 | 'capstone/arch/X86/X86Mapping.c', |
| 953 | 'capstone/arch/X86/X86Module.c' |
| 954 | ) |
| 955 | endif |
| 956 | |
| 957 | configure_file(output: 'capstone-defs.h', configuration: capstone_data) |
| 958 | |
| 959 | capstone_cargs = [ |
| 960 | # FIXME: There does not seem to be a way to completely replace the c_args |
| 961 | # that come from add_project_arguments() -- we can only add to them. |
| 962 | # So: disable all warnings with a big hammer. |
| 963 | '-Wno-error', '-w', |
| 964 | |
| 965 | # Include all configuration defines via a header file, which will wind up |
| 966 | # as a dependency on the object file, and thus changes here will result |
| 967 | # in a rebuild. |
| 968 | '-include', 'capstone-defs.h' |
| 969 | ] |
| 970 | |
| 971 | libcapstone = static_library('capstone', |
| 972 | sources: capstone_files, |
| 973 | c_args: capstone_cargs, |
| 974 | include_directories: 'capstone/include') |
| 975 | capstone = declare_dependency(link_with: libcapstone, |
Richard Henderson | eef20e4 | 2020-09-14 16:02:02 -0700 | [diff] [blame] | 976 | include_directories: 'capstone/include/capstone') |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 977 | endif |
Paolo Bonzini | 4d34a86 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 978 | |
| 979 | slirp = not_found |
| 980 | slirp_opt = 'disabled' |
| 981 | if have_system |
| 982 | slirp_opt = get_option('slirp') |
| 983 | if slirp_opt in ['enabled', 'auto', 'system'] |
| 984 | have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build') |
| 985 | slirp = dependency('slirp', static: enable_static, |
| 986 | method: 'pkg-config', |
| 987 | required: slirp_opt == 'system' or |
| 988 | slirp_opt == 'enabled' and not have_internal) |
| 989 | if slirp.found() |
| 990 | slirp_opt = 'system' |
| 991 | elif have_internal |
| 992 | slirp_opt = 'internal' |
| 993 | else |
| 994 | slirp_opt = 'disabled' |
| 995 | endif |
| 996 | endif |
| 997 | if slirp_opt == 'internal' |
| 998 | slirp_deps = [] |
| 999 | if targetos == 'windows' |
| 1000 | slirp_deps = cc.find_library('iphlpapi') |
| 1001 | endif |
| 1002 | slirp_conf = configuration_data() |
| 1003 | slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0]) |
| 1004 | slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1]) |
| 1005 | slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2]) |
| 1006 | slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version()) |
| 1007 | slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"'] |
| 1008 | slirp_files = [ |
| 1009 | 'slirp/src/arp_table.c', |
| 1010 | 'slirp/src/bootp.c', |
| 1011 | 'slirp/src/cksum.c', |
| 1012 | 'slirp/src/dhcpv6.c', |
| 1013 | 'slirp/src/dnssearch.c', |
| 1014 | 'slirp/src/if.c', |
| 1015 | 'slirp/src/ip6_icmp.c', |
| 1016 | 'slirp/src/ip6_input.c', |
| 1017 | 'slirp/src/ip6_output.c', |
| 1018 | 'slirp/src/ip_icmp.c', |
| 1019 | 'slirp/src/ip_input.c', |
| 1020 | 'slirp/src/ip_output.c', |
| 1021 | 'slirp/src/mbuf.c', |
| 1022 | 'slirp/src/misc.c', |
| 1023 | 'slirp/src/ncsi.c', |
| 1024 | 'slirp/src/ndp_table.c', |
| 1025 | 'slirp/src/sbuf.c', |
| 1026 | 'slirp/src/slirp.c', |
| 1027 | 'slirp/src/socket.c', |
| 1028 | 'slirp/src/state.c', |
| 1029 | 'slirp/src/stream.c', |
| 1030 | 'slirp/src/tcp_input.c', |
| 1031 | 'slirp/src/tcp_output.c', |
| 1032 | 'slirp/src/tcp_subr.c', |
| 1033 | 'slirp/src/tcp_timer.c', |
| 1034 | 'slirp/src/tftp.c', |
| 1035 | 'slirp/src/udp.c', |
| 1036 | 'slirp/src/udp6.c', |
| 1037 | 'slirp/src/util.c', |
| 1038 | 'slirp/src/version.c', |
| 1039 | 'slirp/src/vmstate.c', |
| 1040 | ] |
| 1041 | |
| 1042 | configure_file( |
| 1043 | input : 'slirp/src/libslirp-version.h.in', |
| 1044 | output : 'libslirp-version.h', |
| 1045 | configuration: slirp_conf) |
| 1046 | |
| 1047 | slirp_inc = include_directories('slirp', 'slirp/src') |
| 1048 | libslirp = static_library('slirp', |
| 1049 | sources: slirp_files, |
| 1050 | c_args: slirp_cargs, |
| 1051 | include_directories: slirp_inc) |
| 1052 | slirp = declare_dependency(link_with: libslirp, |
| 1053 | dependencies: slirp_deps, |
| 1054 | include_directories: slirp_inc) |
| 1055 | endif |
| 1056 | endif |
| 1057 | |
Paolo Bonzini | fbb4121 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 1058 | fdt = not_found |
| 1059 | fdt_opt = get_option('fdt') |
| 1060 | if have_system |
| 1061 | if fdt_opt in ['enabled', 'auto', 'system'] |
| 1062 | have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt') |
| 1063 | fdt = cc.find_library('fdt', static: enable_static, |
| 1064 | required: fdt_opt == 'system' or |
| 1065 | fdt_opt == 'enabled' and not have_internal) |
| 1066 | if fdt.found() and cc.links(''' |
| 1067 | #include <libfdt.h> |
| 1068 | #include <libfdt_env.h> |
| 1069 | int main(void) { fdt_check_full(NULL, 0); return 0; }''', |
| 1070 | dependencies: fdt) |
| 1071 | fdt_opt = 'system' |
| 1072 | elif have_internal |
| 1073 | fdt_opt = 'internal' |
| 1074 | else |
| 1075 | fdt_opt = 'disabled' |
| 1076 | endif |
| 1077 | endif |
| 1078 | if fdt_opt == 'internal' |
| 1079 | fdt_files = files( |
| 1080 | 'dtc/libfdt/fdt.c', |
| 1081 | 'dtc/libfdt/fdt_ro.c', |
| 1082 | 'dtc/libfdt/fdt_wip.c', |
| 1083 | 'dtc/libfdt/fdt_sw.c', |
| 1084 | 'dtc/libfdt/fdt_rw.c', |
| 1085 | 'dtc/libfdt/fdt_strerror.c', |
| 1086 | 'dtc/libfdt/fdt_empty_tree.c', |
| 1087 | 'dtc/libfdt/fdt_addresses.c', |
| 1088 | 'dtc/libfdt/fdt_overlay.c', |
| 1089 | 'dtc/libfdt/fdt_check.c', |
| 1090 | ) |
| 1091 | |
| 1092 | fdt_inc = include_directories('dtc/libfdt') |
| 1093 | libfdt = static_library('fdt', |
| 1094 | sources: fdt_files, |
| 1095 | include_directories: fdt_inc) |
| 1096 | fdt = declare_dependency(link_with: libfdt, |
| 1097 | include_directories: fdt_inc) |
| 1098 | endif |
| 1099 | endif |
| 1100 | if not fdt.found() and fdt_required.length() > 0 |
| 1101 | error('fdt not available but required by targets ' + ', '.join(fdt_required)) |
| 1102 | endif |
| 1103 | |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 1104 | config_host_data.set('CONFIG_CAPSTONE', capstone.found()) |
Paolo Bonzini | fbb4121 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 1105 | config_host_data.set('CONFIG_FDT', fdt.found()) |
Paolo Bonzini | 4d34a86 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 1106 | config_host_data.set('CONFIG_SLIRP', slirp.found()) |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 1107 | |
| 1108 | genh += configure_file(output: 'config-host.h', configuration: config_host_data) |
| 1109 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1110 | # Generators |
| 1111 | |
Marc-André Lureau | 3f88565 | 2019-07-15 18:06:04 +0400 | [diff] [blame] | 1112 | hxtool = find_program('scripts/hxtool') |
Marc-André Lureau | 650b5d5 | 2019-07-15 17:36:47 +0400 | [diff] [blame] | 1113 | shaderinclude = find_program('scripts/shaderinclude.pl') |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1114 | qapi_gen = find_program('scripts/qapi-gen.py') |
| 1115 | qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py', |
| 1116 | meson.source_root() / 'scripts/qapi/commands.py', |
| 1117 | meson.source_root() / 'scripts/qapi/common.py', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1118 | meson.source_root() / 'scripts/qapi/error.py', |
| 1119 | meson.source_root() / 'scripts/qapi/events.py', |
| 1120 | meson.source_root() / 'scripts/qapi/expr.py', |
| 1121 | meson.source_root() / 'scripts/qapi/gen.py', |
| 1122 | meson.source_root() / 'scripts/qapi/introspect.py', |
| 1123 | meson.source_root() / 'scripts/qapi/parser.py', |
| 1124 | meson.source_root() / 'scripts/qapi/schema.py', |
| 1125 | meson.source_root() / 'scripts/qapi/source.py', |
| 1126 | meson.source_root() / 'scripts/qapi/types.py', |
| 1127 | meson.source_root() / 'scripts/qapi/visit.py', |
| 1128 | meson.source_root() / 'scripts/qapi/common.py', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1129 | meson.source_root() / 'scripts/qapi-gen.py' |
| 1130 | ] |
| 1131 | |
| 1132 | tracetool = [ |
| 1133 | python, files('scripts/tracetool.py'), |
| 1134 | '--backend=' + config_host['TRACE_BACKENDS'] |
| 1135 | ] |
| 1136 | |
Marc-André Lureau | 2c273f3 | 2019-07-15 17:10:19 +0400 | [diff] [blame] | 1137 | qemu_version_cmd = [find_program('scripts/qemu-version.sh'), |
| 1138 | meson.current_source_dir(), |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 1139 | config_host['PKGVERSION'], meson.project_version()] |
Marc-André Lureau | 2c273f3 | 2019-07-15 17:10:19 +0400 | [diff] [blame] | 1140 | qemu_version = custom_target('qemu-version.h', |
| 1141 | output: 'qemu-version.h', |
| 1142 | command: qemu_version_cmd, |
| 1143 | capture: true, |
| 1144 | build_by_default: true, |
| 1145 | build_always_stale: true) |
| 1146 | genh += qemu_version |
| 1147 | |
Marc-André Lureau | 3f88565 | 2019-07-15 18:06:04 +0400 | [diff] [blame] | 1148 | hxdep = [] |
| 1149 | hx_headers = [ |
| 1150 | ['qemu-options.hx', 'qemu-options.def'], |
| 1151 | ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], |
| 1152 | ] |
| 1153 | if have_system |
| 1154 | hx_headers += [ |
| 1155 | ['hmp-commands.hx', 'hmp-commands.h'], |
| 1156 | ['hmp-commands-info.hx', 'hmp-commands-info.h'], |
| 1157 | ] |
| 1158 | endif |
| 1159 | foreach d : hx_headers |
Marc-André Lureau | b7c70bf | 2019-07-16 21:37:25 +0400 | [diff] [blame] | 1160 | hxdep += custom_target(d[1], |
Marc-André Lureau | 3f88565 | 2019-07-15 18:06:04 +0400 | [diff] [blame] | 1161 | input: files(d[0]), |
| 1162 | output: d[1], |
| 1163 | capture: true, |
| 1164 | build_by_default: true, # to be removed when added to a target |
| 1165 | command: [hxtool, '-h', '@INPUT0@']) |
| 1166 | endforeach |
| 1167 | genh += hxdep |
| 1168 | |
Peter Maydell | eb93736 | 2020-09-25 17:23:08 +0100 | [diff] [blame] | 1169 | SPHINX_ARGS = [config_host['SPHINX_BUILD'], |
| 1170 | '-Dversion=' + meson.project_version(), |
| 1171 | '-Drelease=' + config_host['PKGVERSION']] |
| 1172 | |
| 1173 | if get_option('werror') |
| 1174 | SPHINX_ARGS += [ '-W' ] |
| 1175 | endif |
| 1176 | |
Peter Maydell | b3f4830 | 2020-09-25 17:23:09 +0100 | [diff] [blame] | 1177 | sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py', |
| 1178 | meson.source_root() / 'docs/sphinx/hxtool.py', |
| 1179 | meson.source_root() / 'docs/sphinx/kerneldoc.py', |
| 1180 | meson.source_root() / 'docs/sphinx/kernellog.py', |
| 1181 | meson.source_root() / 'docs/sphinx/qapidoc.py', |
| 1182 | meson.source_root() / 'docs/sphinx/qmp_lexer.py', |
| 1183 | qapi_gen_depends ] |
| 1184 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1185 | # Collect sourcesets. |
| 1186 | |
Philippe Mathieu-Daudé | 5556789 | 2020-10-06 14:56:01 +0200 | [diff] [blame] | 1187 | authz_ss = ss.source_set() |
Philippe Mathieu-Daudé | 7e2b888 | 2020-10-06 14:55:55 +0200 | [diff] [blame] | 1188 | blockdev_ss = ss.source_set() |
| 1189 | block_ss = ss.source_set() |
| 1190 | bsd_user_ss = ss.source_set() |
Philippe Mathieu-Daudé | c2306d7 | 2020-10-06 14:55:57 +0200 | [diff] [blame] | 1191 | chardev_ss = ss.source_set() |
Philippe Mathieu-Daudé | 7e2b888 | 2020-10-06 14:55:55 +0200 | [diff] [blame] | 1192 | common_ss = ss.source_set() |
Philippe Mathieu-Daudé | 2389304 | 2020-10-06 14:56:00 +0200 | [diff] [blame] | 1193 | crypto_ss = ss.source_set() |
Philippe Mathieu-Daudé | f78536b | 2020-10-06 14:55:59 +0200 | [diff] [blame] | 1194 | io_ss = ss.source_set() |
Philippe Mathieu-Daudé | 7e2b888 | 2020-10-06 14:55:55 +0200 | [diff] [blame] | 1195 | linux_user_ss = ss.source_set() |
| 1196 | qmp_ss = ss.source_set() |
Philippe Mathieu-Daudé | da33fc0 | 2020-10-06 14:56:02 +0200 | [diff] [blame] | 1197 | qom_ss = ss.source_set() |
Philippe Mathieu-Daudé | 7e2b888 | 2020-10-06 14:55:55 +0200 | [diff] [blame] | 1198 | softmmu_ss = ss.source_set() |
| 1199 | specific_fuzz_ss = ss.source_set() |
| 1200 | specific_ss = ss.source_set() |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1201 | stub_ss = ss.source_set() |
| 1202 | trace_ss = ss.source_set() |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1203 | user_ss = ss.source_set() |
Philippe Mathieu-Daudé | 7e2b888 | 2020-10-06 14:55:55 +0200 | [diff] [blame] | 1204 | util_ss = ss.source_set() |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1205 | |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1206 | modules = {} |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1207 | hw_arch = {} |
| 1208 | target_arch = {} |
| 1209 | target_softmmu_arch = {} |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1210 | |
| 1211 | ############### |
| 1212 | # Trace files # |
| 1213 | ############### |
| 1214 | |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 1215 | # TODO: add each directory to the subdirs from its own meson.build, once |
| 1216 | # we have those |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1217 | trace_events_subdirs = [ |
| 1218 | 'accel/kvm', |
| 1219 | 'accel/tcg', |
| 1220 | 'crypto', |
| 1221 | 'monitor', |
| 1222 | ] |
| 1223 | if have_user |
| 1224 | trace_events_subdirs += [ 'linux-user' ] |
| 1225 | endif |
| 1226 | if have_block |
| 1227 | trace_events_subdirs += [ |
| 1228 | 'authz', |
| 1229 | 'block', |
| 1230 | 'io', |
| 1231 | 'nbd', |
| 1232 | 'scsi', |
| 1233 | ] |
| 1234 | endif |
| 1235 | if have_system |
| 1236 | trace_events_subdirs += [ |
| 1237 | 'audio', |
| 1238 | 'backends', |
| 1239 | 'backends/tpm', |
| 1240 | 'chardev', |
| 1241 | 'hw/9pfs', |
| 1242 | 'hw/acpi', |
| 1243 | 'hw/alpha', |
| 1244 | 'hw/arm', |
| 1245 | 'hw/audio', |
| 1246 | 'hw/block', |
| 1247 | 'hw/block/dataplane', |
| 1248 | 'hw/char', |
| 1249 | 'hw/display', |
| 1250 | 'hw/dma', |
| 1251 | 'hw/hppa', |
| 1252 | 'hw/hyperv', |
| 1253 | 'hw/i2c', |
| 1254 | 'hw/i386', |
| 1255 | 'hw/i386/xen', |
| 1256 | 'hw/ide', |
| 1257 | 'hw/input', |
| 1258 | 'hw/intc', |
| 1259 | 'hw/isa', |
| 1260 | 'hw/mem', |
| 1261 | 'hw/mips', |
| 1262 | 'hw/misc', |
| 1263 | 'hw/misc/macio', |
| 1264 | 'hw/net', |
| 1265 | 'hw/nvram', |
| 1266 | 'hw/pci', |
| 1267 | 'hw/pci-host', |
| 1268 | 'hw/ppc', |
| 1269 | 'hw/rdma', |
| 1270 | 'hw/rdma/vmw', |
| 1271 | 'hw/rtc', |
| 1272 | 'hw/s390x', |
| 1273 | 'hw/scsi', |
| 1274 | 'hw/sd', |
| 1275 | 'hw/sparc', |
| 1276 | 'hw/sparc64', |
| 1277 | 'hw/ssi', |
| 1278 | 'hw/timer', |
| 1279 | 'hw/tpm', |
| 1280 | 'hw/usb', |
| 1281 | 'hw/vfio', |
| 1282 | 'hw/virtio', |
| 1283 | 'hw/watchdog', |
| 1284 | 'hw/xen', |
| 1285 | 'hw/gpio', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1286 | 'migration', |
| 1287 | 'net', |
Philippe Mathieu-Daudé | 8b7a550 | 2020-08-05 15:02:20 +0200 | [diff] [blame] | 1288 | 'softmmu', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1289 | 'ui', |
| 1290 | ] |
| 1291 | endif |
| 1292 | trace_events_subdirs += [ |
| 1293 | 'hw/core', |
| 1294 | 'qapi', |
| 1295 | 'qom', |
| 1296 | 'target/arm', |
| 1297 | 'target/hppa', |
| 1298 | 'target/i386', |
| 1299 | 'target/mips', |
| 1300 | 'target/ppc', |
| 1301 | 'target/riscv', |
| 1302 | 'target/s390x', |
| 1303 | 'target/sparc', |
| 1304 | 'util', |
| 1305 | ] |
| 1306 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1307 | subdir('qapi') |
| 1308 | subdir('qobject') |
| 1309 | subdir('stubs') |
| 1310 | subdir('trace') |
| 1311 | subdir('util') |
Marc-André Lureau | 5582c58 | 2019-07-16 19:28:54 +0400 | [diff] [blame] | 1312 | subdir('qom') |
| 1313 | subdir('authz') |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1314 | subdir('crypto') |
Marc-André Lureau | 2d78b56 | 2019-07-15 16:00:36 +0400 | [diff] [blame] | 1315 | subdir('ui') |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1316 | |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1317 | |
| 1318 | if enable_modules |
| 1319 | libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO') |
| 1320 | modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO') |
| 1321 | endif |
| 1322 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1323 | # Build targets from sourcesets |
| 1324 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1325 | stub_ss = stub_ss.apply(config_all, strict: false) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1326 | |
| 1327 | util_ss.add_all(trace_ss) |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1328 | util_ss = util_ss.apply(config_all, strict: false) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1329 | libqemuutil = static_library('qemuutil', |
| 1330 | sources: util_ss.sources() + stub_ss.sources() + genh, |
Paolo Bonzini | aa08796 | 2020-09-01 11:15:30 -0400 | [diff] [blame] | 1331 | dependencies: [util_ss.dependencies(), m, glib, socket, malloc]) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1332 | qemuutil = declare_dependency(link_with: libqemuutil, |
Marc-André Lureau | 04c6f1e | 2019-07-18 00:31:05 +0400 | [diff] [blame] | 1333 | sources: genh + version_res) |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1334 | |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1335 | decodetree = generator(find_program('scripts/decodetree.py'), |
| 1336 | output: 'decode-@BASENAME@.c.inc', |
| 1337 | arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@']) |
| 1338 | |
Paolo Bonzini | 478e943 | 2020-08-17 12:47:55 +0200 | [diff] [blame] | 1339 | subdir('audio') |
Marc-André Lureau | 7fcfd45 | 2019-07-16 19:33:55 +0400 | [diff] [blame] | 1340 | subdir('io') |
Marc-André Lureau | 848e8ff | 2019-07-15 23:18:07 +0400 | [diff] [blame] | 1341 | subdir('chardev') |
Marc-André Lureau | ec0d589 | 2019-07-15 15:04:49 +0400 | [diff] [blame] | 1342 | subdir('fsdev') |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1343 | subdir('libdecnumber') |
Marc-André Lureau | d3b1848 | 2019-08-17 14:55:32 +0400 | [diff] [blame] | 1344 | subdir('target') |
Marc-André Lureau | 708eab4 | 2019-09-03 16:59:33 +0400 | [diff] [blame] | 1345 | subdir('dump') |
Marc-André Lureau | ec0d589 | 2019-07-15 15:04:49 +0400 | [diff] [blame] | 1346 | |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 1347 | block_ss.add(files( |
| 1348 | 'block.c', |
Kevin Wolf | 56ee862 | 2020-09-24 17:26:50 +0200 | [diff] [blame] | 1349 | 'blockdev-nbd.c', |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 1350 | 'blockjob.c', |
| 1351 | 'job.c', |
| 1352 | 'qemu-io-cmds.c', |
| 1353 | )) |
| 1354 | block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c')) |
| 1355 | |
| 1356 | subdir('nbd') |
| 1357 | subdir('scsi') |
| 1358 | subdir('block') |
| 1359 | |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 1360 | blockdev_ss.add(files( |
| 1361 | 'blockdev.c', |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 1362 | 'iothread.c', |
| 1363 | 'job-qmp.c', |
| 1364 | )) |
| 1365 | |
| 1366 | # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, |
| 1367 | # os-win32.c does not |
| 1368 | blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) |
| 1369 | softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 1370 | softmmu_ss.add_all(blockdev_ss) |
Paolo Bonzini | 4a96337 | 2020-08-03 16:22:28 +0200 | [diff] [blame] | 1371 | |
| 1372 | common_ss.add(files('cpus-common.c')) |
| 1373 | |
Paolo Bonzini | 5d3ea0e | 2020-08-06 13:40:26 +0200 | [diff] [blame] | 1374 | subdir('softmmu') |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 1375 | |
Richard Henderson | f343346 | 2020-09-12 10:47:33 -0700 | [diff] [blame] | 1376 | common_ss.add(capstone) |
Paolo Bonzini | d9f24bf | 2020-10-06 09:05:29 +0200 | [diff] [blame] | 1377 | specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone) |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 1378 | specific_ss.add(files('exec-vary.c')) |
| 1379 | specific_ss.add(when: 'CONFIG_TCG', if_true: files( |
| 1380 | 'fpu/softfloat.c', |
| 1381 | 'tcg/optimize.c', |
| 1382 | 'tcg/tcg-common.c', |
| 1383 | 'tcg/tcg-op-gvec.c', |
| 1384 | 'tcg/tcg-op-vec.c', |
| 1385 | 'tcg/tcg-op.c', |
| 1386 | 'tcg/tcg.c', |
| 1387 | )) |
| 1388 | specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c')) |
| 1389 | |
Marc-André Lureau | ab31805 | 2019-07-24 19:23:16 +0400 | [diff] [blame] | 1390 | subdir('backends') |
Marc-André Lureau | c574e16 | 2019-07-26 12:02:31 +0400 | [diff] [blame] | 1391 | subdir('disas') |
Marc-André Lureau | 5516623 | 2019-07-24 19:16:22 +0400 | [diff] [blame] | 1392 | subdir('migration') |
Paolo Bonzini | ff219dc | 2020-08-04 21:14:26 +0200 | [diff] [blame] | 1393 | subdir('monitor') |
Marc-André Lureau | cdaf072 | 2019-07-22 23:47:50 +0400 | [diff] [blame] | 1394 | subdir('net') |
Marc-André Lureau | 17ef2af | 2019-07-22 23:40:45 +0400 | [diff] [blame] | 1395 | subdir('replay') |
Marc-André Lureau | 582ea95 | 2019-08-15 15:15:32 +0400 | [diff] [blame] | 1396 | subdir('hw') |
Marc-André Lureau | 1a82878 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1397 | subdir('accel') |
Paolo Bonzini | f556b4a | 2020-01-24 13:08:01 +0100 | [diff] [blame] | 1398 | subdir('plugins') |
Marc-André Lureau | b309c32 | 2019-08-18 19:20:37 +0400 | [diff] [blame] | 1399 | subdir('bsd-user') |
Marc-André Lureau | 3a30446 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1400 | subdir('linux-user') |
| 1401 | |
Marc-André Lureau | b309c32 | 2019-08-18 19:20:37 +0400 | [diff] [blame] | 1402 | bsd_user_ss.add(files('gdbstub.c')) |
| 1403 | specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) |
| 1404 | |
Marc-André Lureau | 3a30446 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1405 | linux_user_ss.add(files('gdbstub.c', 'thunk.c')) |
| 1406 | specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) |
Paolo Bonzini | 5d3ea0e | 2020-08-06 13:40:26 +0200 | [diff] [blame] | 1407 | |
Paolo Bonzini | a2ce7db | 2020-08-04 20:00:40 +0200 | [diff] [blame] | 1408 | # needed for fuzzing binaries |
| 1409 | subdir('tests/qtest/libqos') |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1410 | subdir('tests/qtest/fuzz') |
Paolo Bonzini | a2ce7db | 2020-08-04 20:00:40 +0200 | [diff] [blame] | 1411 | |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1412 | block_mods = [] |
| 1413 | softmmu_mods = [] |
| 1414 | foreach d, list : modules |
| 1415 | foreach m, module_ss : list |
| 1416 | if enable_modules and targetos != 'windows' |
Gerd Hoffmann | 3e292c5 | 2020-09-14 15:42:20 +0200 | [diff] [blame] | 1417 | module_ss = module_ss.apply(config_all, strict: false) |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1418 | sl = static_library(d + '-' + m, [genh, module_ss.sources()], |
| 1419 | dependencies: [modulecommon, module_ss.dependencies()], pic: true) |
| 1420 | if d == 'block' |
| 1421 | block_mods += sl |
| 1422 | else |
| 1423 | softmmu_mods += sl |
| 1424 | endif |
| 1425 | else |
| 1426 | if d == 'block' |
| 1427 | block_ss.add_all(module_ss) |
| 1428 | else |
| 1429 | softmmu_ss.add_all(module_ss) |
| 1430 | endif |
| 1431 | endif |
| 1432 | endforeach |
| 1433 | endforeach |
| 1434 | |
| 1435 | nm = find_program('nm') |
Yonggang Luo | 604f3e4 | 2020-09-03 01:00:50 +0800 | [diff] [blame] | 1436 | undefsym = find_program('scripts/undefsym.py') |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1437 | block_syms = custom_target('block.syms', output: 'block.syms', |
| 1438 | input: [libqemuutil, block_mods], |
| 1439 | capture: true, |
| 1440 | command: [undefsym, nm, '@INPUT@']) |
| 1441 | qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', |
| 1442 | input: [libqemuutil, softmmu_mods], |
| 1443 | capture: true, |
| 1444 | command: [undefsym, nm, '@INPUT@']) |
| 1445 | |
Philippe Mathieu-Daudé | 064f8ee | 2020-10-06 14:55:54 +0200 | [diff] [blame] | 1446 | ######################## |
| 1447 | # Library dependencies # |
| 1448 | ######################## |
| 1449 | |
Philippe Mathieu-Daudé | da33fc0 | 2020-10-06 14:56:02 +0200 | [diff] [blame] | 1450 | qom_ss = qom_ss.apply(config_host, strict: false) |
| 1451 | libqom = static_library('qom', qom_ss.sources() + genh, |
| 1452 | dependencies: [qom_ss.dependencies()], |
| 1453 | name_suffix: 'fa') |
| 1454 | |
| 1455 | qom = declare_dependency(link_whole: libqom) |
| 1456 | |
Philippe Mathieu-Daudé | 5556789 | 2020-10-06 14:56:01 +0200 | [diff] [blame] | 1457 | authz_ss = authz_ss.apply(config_host, strict: false) |
| 1458 | libauthz = static_library('authz', authz_ss.sources() + genh, |
| 1459 | dependencies: [authz_ss.dependencies()], |
| 1460 | name_suffix: 'fa', |
| 1461 | build_by_default: false) |
| 1462 | |
| 1463 | authz = declare_dependency(link_whole: libauthz, |
| 1464 | dependencies: qom) |
| 1465 | |
Philippe Mathieu-Daudé | 2389304 | 2020-10-06 14:56:00 +0200 | [diff] [blame] | 1466 | crypto_ss = crypto_ss.apply(config_host, strict: false) |
| 1467 | libcrypto = static_library('crypto', crypto_ss.sources() + genh, |
| 1468 | dependencies: [crypto_ss.dependencies()], |
| 1469 | name_suffix: 'fa', |
| 1470 | build_by_default: false) |
| 1471 | |
| 1472 | crypto = declare_dependency(link_whole: libcrypto, |
| 1473 | dependencies: [authz, qom]) |
| 1474 | |
Philippe Mathieu-Daudé | f78536b | 2020-10-06 14:55:59 +0200 | [diff] [blame] | 1475 | io_ss = io_ss.apply(config_host, strict: false) |
| 1476 | libio = static_library('io', io_ss.sources() + genh, |
| 1477 | dependencies: [io_ss.dependencies()], |
| 1478 | link_with: libqemuutil, |
| 1479 | name_suffix: 'fa', |
| 1480 | build_by_default: false) |
| 1481 | |
| 1482 | io = declare_dependency(link_whole: libio, dependencies: [crypto, qom]) |
| 1483 | |
Philippe Mathieu-Daudé | 7e6edef | 2020-10-06 14:55:58 +0200 | [diff] [blame] | 1484 | libmigration = static_library('migration', sources: migration_files + genh, |
| 1485 | name_suffix: 'fa', |
| 1486 | build_by_default: false) |
| 1487 | migration = declare_dependency(link_with: libmigration, |
| 1488 | dependencies: [zlib, qom, io]) |
| 1489 | softmmu_ss.add(migration) |
| 1490 | |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 1491 | block_ss = block_ss.apply(config_host, strict: false) |
| 1492 | libblock = static_library('block', block_ss.sources() + genh, |
| 1493 | dependencies: block_ss.dependencies(), |
| 1494 | link_depends: block_syms, |
| 1495 | name_suffix: 'fa', |
| 1496 | build_by_default: false) |
| 1497 | |
| 1498 | block = declare_dependency(link_whole: [libblock], |
Marc-André Lureau | b7c70bf | 2019-07-16 21:37:25 +0400 | [diff] [blame] | 1499 | link_args: '@block.syms', |
| 1500 | dependencies: [crypto, io]) |
Marc-André Lureau | 5e5733e | 2019-08-29 22:34:43 +0400 | [diff] [blame] | 1501 | |
Paolo Bonzini | ff219dc | 2020-08-04 21:14:26 +0200 | [diff] [blame] | 1502 | qmp_ss = qmp_ss.apply(config_host, strict: false) |
| 1503 | libqmp = static_library('qmp', qmp_ss.sources() + genh, |
| 1504 | dependencies: qmp_ss.dependencies(), |
| 1505 | name_suffix: 'fa', |
| 1506 | build_by_default: false) |
| 1507 | |
| 1508 | qmp = declare_dependency(link_whole: [libqmp]) |
| 1509 | |
Philippe Mathieu-Daudé | c2306d7 | 2020-10-06 14:55:57 +0200 | [diff] [blame] | 1510 | libchardev = static_library('chardev', chardev_ss.sources() + genh, |
| 1511 | name_suffix: 'fa', |
| 1512 | build_by_default: false) |
| 1513 | |
| 1514 | chardev = declare_dependency(link_whole: libchardev) |
| 1515 | |
Philippe Mathieu-Daudé | e28ab09 | 2020-10-06 14:55:56 +0200 | [diff] [blame] | 1516 | libhwcore = static_library('hwcore', sources: hwcore_files + genh, |
| 1517 | name_suffix: 'fa', |
| 1518 | build_by_default: false) |
| 1519 | hwcore = declare_dependency(link_whole: libhwcore) |
| 1520 | common_ss.add(hwcore) |
| 1521 | |
Philippe Mathieu-Daudé | 064f8ee | 2020-10-06 14:55:54 +0200 | [diff] [blame] | 1522 | ########### |
| 1523 | # Targets # |
| 1524 | ########### |
| 1525 | |
Marc-André Lureau | 3154fee | 2019-08-29 22:07:01 +0400 | [diff] [blame] | 1526 | foreach m : block_mods + softmmu_mods |
| 1527 | shared_module(m.name(), |
| 1528 | name_prefix: '', |
| 1529 | link_whole: m, |
| 1530 | install: true, |
| 1531 | install_dir: config_host['qemu_moddir']) |
| 1532 | endforeach |
| 1533 | |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1534 | softmmu_ss.add(authz, block, chardev, crypto, io, qmp) |
| 1535 | common_ss.add(qom, qemuutil) |
| 1536 | |
| 1537 | common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss]) |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1538 | common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) |
| 1539 | |
| 1540 | common_all = common_ss.apply(config_all, strict: false) |
| 1541 | common_all = static_library('common', |
| 1542 | build_by_default: false, |
| 1543 | sources: common_all.sources() + genh, |
| 1544 | dependencies: common_all.dependencies(), |
| 1545 | name_suffix: 'fa') |
| 1546 | |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 1547 | feature_to_c = find_program('scripts/feature_to_c.sh') |
| 1548 | |
Paolo Bonzini | fd5eef8 | 2020-09-16 05:00:53 -0400 | [diff] [blame] | 1549 | emulators = {} |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1550 | foreach target : target_dirs |
| 1551 | config_target = config_target_mak[target] |
| 1552 | target_name = config_target['TARGET_NAME'] |
| 1553 | arch = config_target['TARGET_BASE_ARCH'] |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 1554 | arch_srcs = [config_target_h[target]] |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1555 | arch_deps = [] |
| 1556 | c_args = ['-DNEED_CPU_H', |
| 1557 | '-DCONFIG_TARGET="@0@-config-target.h"'.format(target), |
| 1558 | '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)] |
Paolo Bonzini | b6c7cfd | 2020-09-21 04:49:50 -0400 | [diff] [blame] | 1559 | link_args = emulator_link_args |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1560 | |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 1561 | config_target += config_host |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1562 | target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])] |
| 1563 | if targetos == 'linux' |
| 1564 | target_inc += include_directories('linux-headers', is_system: true) |
| 1565 | endif |
| 1566 | if target.endswith('-softmmu') |
| 1567 | qemu_target_name = 'qemu-system-' + target_name |
| 1568 | target_type='system' |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1569 | t = target_softmmu_arch[arch].apply(config_target, strict: false) |
| 1570 | arch_srcs += t.sources() |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1571 | arch_deps += t.dependencies() |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1572 | |
Marc-André Lureau | 2c44220 | 2019-08-17 13:55:58 +0400 | [diff] [blame] | 1573 | hw_dir = target_name == 'sparc64' ? 'sparc64' : arch |
| 1574 | hw = hw_arch[hw_dir].apply(config_target, strict: false) |
| 1575 | arch_srcs += hw.sources() |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1576 | arch_deps += hw.dependencies() |
Marc-André Lureau | 2c44220 | 2019-08-17 13:55:58 +0400 | [diff] [blame] | 1577 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1578 | arch_srcs += config_devices_h[target] |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1579 | link_args += ['@block.syms', '@qemu.syms'] |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1580 | else |
Marc-André Lureau | 3a30446 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1581 | abi = config_target['TARGET_ABI_DIR'] |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1582 | target_type='user' |
| 1583 | qemu_target_name = 'qemu-' + target_name |
| 1584 | if 'CONFIG_LINUX_USER' in config_target |
| 1585 | base_dir = 'linux-user' |
| 1586 | target_inc += include_directories('linux-user/host/' / config_host['ARCH']) |
| 1587 | else |
| 1588 | base_dir = 'bsd-user' |
| 1589 | endif |
| 1590 | target_inc += include_directories( |
| 1591 | base_dir, |
Marc-André Lureau | 3a30446 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1592 | base_dir / abi, |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1593 | ) |
Marc-André Lureau | 3a30446 | 2019-08-18 16:13:08 +0400 | [diff] [blame] | 1594 | if 'CONFIG_LINUX_USER' in config_target |
| 1595 | dir = base_dir / abi |
| 1596 | arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c') |
| 1597 | if config_target.has_key('TARGET_SYSTBL_ABI') |
| 1598 | arch_srcs += \ |
| 1599 | syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'], |
| 1600 | extra_args : config_target['TARGET_SYSTBL_ABI']) |
| 1601 | endif |
| 1602 | endif |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1603 | endif |
| 1604 | |
Marc-André Lureau | c9322ab | 2019-08-18 19:51:17 +0400 | [diff] [blame] | 1605 | if 'TARGET_XML_FILES' in config_target |
| 1606 | gdbstub_xml = custom_target(target + '-gdbstub-xml.c', |
| 1607 | output: target + '-gdbstub-xml.c', |
| 1608 | input: files(config_target['TARGET_XML_FILES'].split()), |
| 1609 | command: [feature_to_c, '@INPUT@'], |
| 1610 | capture: true) |
| 1611 | arch_srcs += gdbstub_xml |
| 1612 | endif |
| 1613 | |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1614 | t = target_arch[arch].apply(config_target, strict: false) |
| 1615 | arch_srcs += t.sources() |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1616 | arch_deps += t.dependencies() |
Paolo Bonzini | abff1ab | 2020-08-07 12:10:23 +0200 | [diff] [blame] | 1617 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1618 | target_common = common_ss.apply(config_target, strict: false) |
| 1619 | objects = common_all.extract_objects(target_common.sources()) |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1620 | deps = target_common.dependencies() |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1621 | |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1622 | target_specific = specific_ss.apply(config_target, strict: false) |
| 1623 | arch_srcs += target_specific.sources() |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1624 | arch_deps += target_specific.dependencies() |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1625 | |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1626 | lib = static_library('qemu-' + target, |
Paolo Bonzini | 859aef0 | 2020-08-04 18:14:26 +0200 | [diff] [blame] | 1627 | sources: arch_srcs + genh, |
Paolo Bonzini | b7612f4 | 2020-08-26 08:22:58 +0200 | [diff] [blame] | 1628 | dependencies: arch_deps, |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1629 | objects: objects, |
| 1630 | include_directories: target_inc, |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1631 | c_args: c_args, |
| 1632 | build_by_default: false, |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1633 | name_suffix: 'fa') |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1634 | |
| 1635 | if target.endswith('-softmmu') |
| 1636 | execs = [{ |
| 1637 | 'name': 'qemu-system-' + target_name, |
| 1638 | 'gui': false, |
| 1639 | 'sources': files('softmmu/main.c'), |
| 1640 | 'dependencies': [] |
| 1641 | }] |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 1642 | if targetos == 'windows' and (sdl.found() or gtk.found()) |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1643 | execs += [{ |
| 1644 | 'name': 'qemu-system-' + target_name + 'w', |
| 1645 | 'gui': true, |
| 1646 | 'sources': files('softmmu/main.c'), |
| 1647 | 'dependencies': [] |
| 1648 | }] |
| 1649 | endif |
| 1650 | if config_host.has_key('CONFIG_FUZZ') |
| 1651 | specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false) |
| 1652 | execs += [{ |
| 1653 | 'name': 'qemu-fuzz-' + target_name, |
| 1654 | 'gui': false, |
| 1655 | 'sources': specific_fuzz.sources(), |
| 1656 | 'dependencies': specific_fuzz.dependencies(), |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1657 | }] |
| 1658 | endif |
| 1659 | else |
| 1660 | execs = [{ |
| 1661 | 'name': 'qemu-' + target_name, |
| 1662 | 'gui': false, |
| 1663 | 'sources': [], |
| 1664 | 'dependencies': [] |
| 1665 | }] |
| 1666 | endif |
| 1667 | foreach exe: execs |
Paolo Bonzini | fd5eef8 | 2020-09-16 05:00:53 -0400 | [diff] [blame] | 1668 | emulators += {exe['name']: |
| 1669 | executable(exe['name'], exe['sources'], |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1670 | install: true, |
| 1671 | c_args: c_args, |
| 1672 | dependencies: arch_deps + deps + exe['dependencies'], |
| 1673 | objects: lib.extract_all_objects(recursive: true), |
| 1674 | link_language: link_language, |
| 1675 | link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), |
| 1676 | link_args: link_args, |
| 1677 | gui_app: exe['gui']) |
Paolo Bonzini | fd5eef8 | 2020-09-16 05:00:53 -0400 | [diff] [blame] | 1678 | } |
Marc-André Lureau | 10e1d26 | 2019-08-20 12:29:52 +0400 | [diff] [blame] | 1679 | |
| 1680 | if 'CONFIG_TRACE_SYSTEMTAP' in config_host |
| 1681 | foreach stp: [ |
Stefan Hajnoczi | bd5f973 | 2020-08-25 08:49:53 +0200 | [diff] [blame] | 1682 | {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false}, |
| 1683 | {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true}, |
Marc-André Lureau | 10e1d26 | 2019-08-20 12:29:52 +0400 | [diff] [blame] | 1684 | {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true}, |
| 1685 | {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true}, |
| 1686 | ] |
Stefan Hajnoczi | bd5f973 | 2020-08-25 08:49:53 +0200 | [diff] [blame] | 1687 | custom_target(exe['name'] + stp['ext'], |
Marc-André Lureau | 10e1d26 | 2019-08-20 12:29:52 +0400 | [diff] [blame] | 1688 | input: trace_events_all, |
Stefan Hajnoczi | bd5f973 | 2020-08-25 08:49:53 +0200 | [diff] [blame] | 1689 | output: exe['name'] + stp['ext'], |
Marc-André Lureau | 10e1d26 | 2019-08-20 12:29:52 +0400 | [diff] [blame] | 1690 | capture: true, |
| 1691 | install: stp['install'], |
Marc-André Lureau | ab4c099 | 2020-08-26 15:04:16 +0400 | [diff] [blame] | 1692 | install_dir: qemu_datadir / '../systemtap/tapset', |
Marc-André Lureau | 10e1d26 | 2019-08-20 12:29:52 +0400 | [diff] [blame] | 1693 | command: [ |
| 1694 | tracetool, '--group=all', '--format=' + stp['fmt'], |
| 1695 | '--binary=' + stp['bin'], |
| 1696 | '--target-name=' + target_name, |
| 1697 | '--target-type=' + target_type, |
| 1698 | '--probe-prefix=qemu.' + target_type + '.' + target_name, |
| 1699 | '@INPUT@', |
| 1700 | ]) |
| 1701 | endforeach |
| 1702 | endif |
Paolo Bonzini | 64ed6f9 | 2020-08-03 17:04:25 +0200 | [diff] [blame] | 1703 | endforeach |
Paolo Bonzini | 2becc36 | 2020-02-03 11:42:03 +0100 | [diff] [blame] | 1704 | endforeach |
| 1705 | |
Paolo Bonzini | 931049b | 2020-02-05 09:44:24 +0100 | [diff] [blame] | 1706 | # Other build targets |
Marc-André Lureau | 897b5af | 2019-07-16 21:54:15 +0400 | [diff] [blame] | 1707 | |
Paolo Bonzini | f556b4a | 2020-01-24 13:08:01 +0100 | [diff] [blame] | 1708 | if 'CONFIG_PLUGIN' in config_host |
| 1709 | install_headers('include/qemu/qemu-plugin.h') |
| 1710 | endif |
| 1711 | |
Paolo Bonzini | f15bff2 | 2019-07-18 13:19:02 +0200 | [diff] [blame] | 1712 | if 'CONFIG_GUEST_AGENT' in config_host |
| 1713 | subdir('qga') |
| 1714 | endif |
| 1715 | |
Laurent Vivier | 9755c94 | 2020-08-24 17:24:30 +0200 | [diff] [blame] | 1716 | # Don't build qemu-keymap if xkbcommon is not explicitly enabled |
| 1717 | # when we don't build tools or system |
Laurent Vivier | 4113f4c | 2020-08-24 17:24:29 +0200 | [diff] [blame] | 1718 | if xkbcommon.found() |
Marc-André Lureau | 2874246 | 2019-09-19 20:24:43 +0400 | [diff] [blame] | 1719 | # used for the update-keymaps target, so include rules even if !have_tools |
| 1720 | qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh, |
| 1721 | dependencies: [qemuutil, xkbcommon], install: have_tools) |
| 1722 | endif |
| 1723 | |
Paolo Bonzini | 931049b | 2020-02-05 09:44:24 +0100 | [diff] [blame] | 1724 | if have_tools |
Marc-André Lureau | b7c70bf | 2019-07-16 21:37:25 +0400 | [diff] [blame] | 1725 | qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep], |
| 1726 | dependencies: [authz, block, crypto, io, qom, qemuutil], install: true) |
| 1727 | qemu_io = executable('qemu-io', files('qemu-io.c'), |
| 1728 | dependencies: [block, qemuutil], install: true) |
Daniel P. Berrangé | eb70598 | 2020-08-25 11:38:50 +0100 | [diff] [blame] | 1729 | qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), |
Marc-André Lureau | b7c70bf | 2019-07-16 21:37:25 +0400 | [diff] [blame] | 1730 | dependencies: [block, qemuutil], install: true) |
Marc-André Lureau | b7c70bf | 2019-07-16 21:37:25 +0400 | [diff] [blame] | 1731 | |
Paolo Bonzini | 7c58bb7 | 2020-08-04 20:18:36 +0200 | [diff] [blame] | 1732 | subdir('storage-daemon') |
Paolo Bonzini | a9c9727 | 2019-06-10 12:27:52 +0200 | [diff] [blame] | 1733 | subdir('contrib/rdmacm-mux') |
Marc-André Lureau | 1d7bb6a | 2019-07-12 23:47:06 +0400 | [diff] [blame] | 1734 | subdir('contrib/elf2dmp') |
Paolo Bonzini | a9c9727 | 2019-06-10 12:27:52 +0200 | [diff] [blame] | 1735 | |
Marc-André Lureau | 157e7b1 | 2019-07-15 14:50:58 +0400 | [diff] [blame] | 1736 | executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'), |
| 1737 | dependencies: qemuutil, |
| 1738 | install: true) |
| 1739 | |
Paolo Bonzini | 931049b | 2020-02-05 09:44:24 +0100 | [diff] [blame] | 1740 | if 'CONFIG_VHOST_USER' in config_host |
| 1741 | subdir('contrib/libvhost-user') |
Paolo Bonzini | 2d7ac0a | 2019-06-10 12:18:02 +0200 | [diff] [blame] | 1742 | subdir('contrib/vhost-user-blk') |
Paolo Bonzini | b7612f4 | 2020-08-26 08:22:58 +0200 | [diff] [blame] | 1743 | subdir('contrib/vhost-user-gpu') |
Marc-André Lureau | 32fcc62 | 2019-07-12 22:11:20 +0400 | [diff] [blame] | 1744 | subdir('contrib/vhost-user-input') |
Paolo Bonzini | 99650b6 | 2019-06-10 12:21:14 +0200 | [diff] [blame] | 1745 | subdir('contrib/vhost-user-scsi') |
Paolo Bonzini | 931049b | 2020-02-05 09:44:24 +0100 | [diff] [blame] | 1746 | endif |
Marc-André Lureau | 8f51e01 | 2019-07-15 14:39:25 +0400 | [diff] [blame] | 1747 | |
| 1748 | if targetos == 'linux' |
| 1749 | executable('qemu-bridge-helper', files('qemu-bridge-helper.c'), |
| 1750 | dependencies: [qemuutil, libcap_ng], |
| 1751 | install: true, |
| 1752 | install_dir: get_option('libexecdir')) |
Marc-André Lureau | 897b5af | 2019-07-16 21:54:15 +0400 | [diff] [blame] | 1753 | |
| 1754 | executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'), |
| 1755 | dependencies: [authz, crypto, io, qom, qemuutil, |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 1756 | libcap_ng, mpathpersist], |
Marc-André Lureau | 897b5af | 2019-07-16 21:54:15 +0400 | [diff] [blame] | 1757 | install: true) |
Marc-André Lureau | 8f51e01 | 2019-07-15 14:39:25 +0400 | [diff] [blame] | 1758 | endif |
| 1759 | |
Marc-André Lureau | 5ee24e7 | 2019-07-12 23:16:54 +0400 | [diff] [blame] | 1760 | if 'CONFIG_IVSHMEM' in config_host |
| 1761 | subdir('contrib/ivshmem-client') |
| 1762 | subdir('contrib/ivshmem-server') |
| 1763 | endif |
Paolo Bonzini | 931049b | 2020-02-05 09:44:24 +0100 | [diff] [blame] | 1764 | endif |
| 1765 | |
Marc-André Lureau | f5aa632 | 2020-08-26 17:06:18 +0400 | [diff] [blame] | 1766 | subdir('scripts') |
Paolo Bonzini | 3f99cf5 | 2020-02-05 09:45:39 +0100 | [diff] [blame] | 1767 | subdir('tools') |
Marc-André Lureau | bdcbea7 | 2019-07-15 21:22:31 +0400 | [diff] [blame] | 1768 | subdir('pc-bios') |
Paolo Bonzini | ce1c1e7 | 2020-01-28 16:41:44 +0100 | [diff] [blame] | 1769 | subdir('tests') |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 1770 | subdir('docs') |
Marc-André Lureau | e8f3bd7 | 2019-09-19 21:02:09 +0400 | [diff] [blame] | 1771 | if 'CONFIG_GTK' in config_host |
| 1772 | subdir('po') |
| 1773 | endif |
Paolo Bonzini | 3f99cf5 | 2020-02-05 09:45:39 +0100 | [diff] [blame] | 1774 | |
Marc-André Lureau | 8adfeba | 2020-08-26 15:04:19 +0400 | [diff] [blame] | 1775 | if host_machine.system() == 'windows' |
| 1776 | nsis_cmd = [ |
| 1777 | find_program('scripts/nsis.py'), |
| 1778 | '@OUTPUT@', |
| 1779 | get_option('prefix'), |
| 1780 | meson.current_source_dir(), |
| 1781 | host_machine.cpu_family(), |
| 1782 | '--', |
| 1783 | '-DDISPLAYVERSION=' + meson.project_version(), |
| 1784 | ] |
| 1785 | if build_docs |
| 1786 | nsis_cmd += '-DCONFIG_DOCUMENTATION=y' |
| 1787 | endif |
| 1788 | if 'CONFIG_GTK' in config_host |
| 1789 | nsis_cmd += '-DCONFIG_GTK=y' |
| 1790 | endif |
| 1791 | |
| 1792 | nsis = custom_target('nsis', |
| 1793 | output: 'qemu-setup-' + meson.project_version() + '.exe', |
| 1794 | input: files('qemu.nsi'), |
| 1795 | build_always_stale: true, |
| 1796 | command: nsis_cmd + ['@INPUT@']) |
| 1797 | alias_target('installer', nsis) |
| 1798 | endif |
| 1799 | |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1800 | summary_info = {} |
| 1801 | summary_info += {'Install prefix': config_host['prefix']} |
| 1802 | summary_info += {'BIOS directory': config_host['qemu_datadir']} |
| 1803 | summary_info += {'firmware path': config_host['qemu_firmwarepath']} |
| 1804 | summary_info += {'binary directory': config_host['bindir']} |
| 1805 | summary_info += {'library directory': config_host['libdir']} |
| 1806 | summary_info += {'module directory': config_host['qemu_moddir']} |
| 1807 | summary_info += {'libexec directory': config_host['libexecdir']} |
| 1808 | summary_info += {'include directory': config_host['includedir']} |
| 1809 | summary_info += {'config directory': config_host['sysconfdir']} |
| 1810 | if targetos != 'windows' |
| 1811 | summary_info += {'local state directory': config_host['qemu_localstatedir']} |
Marc-André Lureau | b81efab | 2020-08-26 15:04:18 +0400 | [diff] [blame] | 1812 | summary_info += {'Manual directory': get_option('mandir')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1813 | else |
| 1814 | summary_info += {'local state directory': 'queried at runtime'} |
| 1815 | endif |
Marc-André Lureau | 491e74c | 2020-08-26 15:04:17 +0400 | [diff] [blame] | 1816 | summary_info += {'Doc directory': get_option('docdir')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1817 | summary_info += {'Build directory': meson.current_build_dir()} |
| 1818 | summary_info += {'Source path': meson.current_source_dir()} |
| 1819 | summary_info += {'GIT binary': config_host['GIT']} |
| 1820 | summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']} |
| 1821 | summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]} |
| 1822 | summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]} |
| 1823 | if link_language == 'cpp' |
| 1824 | summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]} |
| 1825 | else |
| 1826 | summary_info += {'C++ compiler': false} |
| 1827 | endif |
| 1828 | if targetos == 'darwin' |
| 1829 | summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]} |
| 1830 | endif |
| 1831 | summary_info += {'ARFLAGS': config_host['ARFLAGS']} |
Paolo Bonzini | 47b3083 | 2020-09-23 05:26:17 -0400 | [diff] [blame] | 1832 | summary_info += {'CFLAGS': ' '.join(get_option('c_args') |
| 1833 | + ['-O' + get_option('optimization')] |
| 1834 | + (get_option('debug') ? ['-g'] : []))} |
| 1835 | if link_language == 'cpp' |
| 1836 | summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') |
| 1837 | + ['-O' + get_option('optimization')] |
| 1838 | + (get_option('debug') ? ['-g'] : []))} |
| 1839 | endif |
| 1840 | link_args = get_option(link_language + '_link_args') |
| 1841 | if link_args.length() > 0 |
| 1842 | summary_info += {'LDFLAGS': ' '.join(link_args)} |
| 1843 | endif |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1844 | summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} |
| 1845 | summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} |
| 1846 | summary_info += {'make': config_host['MAKE']} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1847 | summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())} |
| 1848 | summary_info += {'sphinx-build': config_host['SPHINX_BUILD']} |
| 1849 | summary_info += {'genisoimage': config_host['GENISOIMAGE']} |
| 1850 | # TODO: add back version |
Paolo Bonzini | 4d34a86 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 1851 | summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt} |
| 1852 | if slirp_opt != 'disabled' |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1853 | summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']} |
| 1854 | endif |
| 1855 | summary_info += {'module support': config_host.has_key('CONFIG_MODULES')} |
| 1856 | if config_host.has_key('CONFIG_MODULES') |
| 1857 | summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')} |
| 1858 | endif |
| 1859 | summary_info += {'host CPU': cpu} |
| 1860 | summary_info += {'host endianness': build_machine.endian()} |
Paolo Bonzini | fdb75ae | 2020-09-21 04:37:49 -0400 | [diff] [blame] | 1861 | summary_info += {'target list': ' '.join(target_dirs)} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1862 | summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} |
Paolo Bonzini | deb6237 | 2020-09-01 07:51:16 -0400 | [diff] [blame] | 1863 | summary_info += {'sparse enabled': sparse.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1864 | summary_info += {'strip binaries': get_option('strip')} |
| 1865 | summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} |
Laurent Vivier | 3e8529d | 2020-09-17 16:07:00 +0200 | [diff] [blame] | 1866 | summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1867 | if targetos == 'darwin' |
| 1868 | summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')} |
| 1869 | endif |
| 1870 | # TODO: add back version |
Paolo Bonzini | 35be72b | 2020-02-06 14:17:15 +0100 | [diff] [blame] | 1871 | summary_info += {'SDL support': sdl.found()} |
| 1872 | summary_info += {'SDL image support': sdl_image.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1873 | # TODO: add back version |
| 1874 | summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} |
| 1875 | summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} |
Paolo Bonzini | b7612f4 | 2020-08-26 08:22:58 +0200 | [diff] [blame] | 1876 | summary_info += {'pixman': pixman.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1877 | # TODO: add back version |
| 1878 | summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} |
| 1879 | summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']} |
| 1880 | summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')} |
| 1881 | # TODO: add back version |
| 1882 | summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')} |
| 1883 | if config_host.has_key('CONFIG_GCRYPT') |
| 1884 | summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')} |
| 1885 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} |
| 1886 | endif |
| 1887 | # TODO: add back version |
| 1888 | summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')} |
| 1889 | if config_host.has_key('CONFIG_NETTLE') |
| 1890 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} |
| 1891 | endif |
| 1892 | summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')} |
| 1893 | summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} |
| 1894 | summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')} |
| 1895 | summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')} |
| 1896 | # TODO: add back version |
| 1897 | summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')} |
| 1898 | summary_info += {'curl support': config_host.has_key('CONFIG_CURL')} |
| 1899 | summary_info += {'mingw32 support': targetos == 'windows'} |
| 1900 | summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']} |
| 1901 | summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} |
| 1902 | summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} |
| 1903 | summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')} |
Paolo Bonzini | 6ec0e15 | 2020-09-16 18:07:29 +0200 | [diff] [blame] | 1904 | summary_info += {'Multipath support': mpathpersist.found()} |
Paolo Bonzini | a0b9323 | 2020-02-06 15:48:52 +0100 | [diff] [blame] | 1905 | summary_info += {'VNC support': vnc.found()} |
| 1906 | if vnc.found() |
| 1907 | summary_info += {'VNC SASL support': sasl.found()} |
| 1908 | summary_info += {'VNC JPEG support': jpeg.found()} |
| 1909 | summary_info += {'VNC PNG support': png.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1910 | endif |
| 1911 | summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} |
| 1912 | if config_host.has_key('CONFIG_XEN_BACKEND') |
| 1913 | summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} |
| 1914 | endif |
| 1915 | summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')} |
| 1916 | summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')} |
| 1917 | summary_info += {'PIE': get_option('b_pie')} |
| 1918 | summary_info += {'vde support': config_host.has_key('CONFIG_VDE')} |
| 1919 | summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')} |
| 1920 | summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')} |
| 1921 | summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')} |
| 1922 | summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} |
| 1923 | summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')} |
Paolo Bonzini | 05512f5 | 2020-09-16 15:31:11 -0400 | [diff] [blame] | 1924 | summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} |
| 1925 | summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} |
| 1926 | summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} |
| 1927 | summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')} |
| 1928 | summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')} |
| 1929 | if config_all.has_key('CONFIG_TCG') |
| 1930 | summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')} |
| 1931 | summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')} |
| 1932 | endif |
Paolo Bonzini | aa08796 | 2020-09-01 11:15:30 -0400 | [diff] [blame] | 1933 | summary_info += {'malloc trim support': has_malloc_trim} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1934 | summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')} |
| 1935 | summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')} |
Paolo Bonzini | fbb4121 | 2020-10-05 11:31:15 +0200 | [diff] [blame] | 1936 | summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1937 | summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} |
| 1938 | summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')} |
| 1939 | summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} |
| 1940 | summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} |
| 1941 | summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} |
| 1942 | summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')} |
| 1943 | summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')} |
| 1944 | summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')} |
| 1945 | summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')} |
| 1946 | summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')} |
| 1947 | summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')} |
| 1948 | summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')} |
| 1949 | summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')} |
| 1950 | summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')} |
| 1951 | summary_info += {'Trace backends': config_host['TRACE_BACKENDS']} |
| 1952 | if config_host['TRACE_BACKENDS'].split().contains('simple') |
| 1953 | summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'} |
| 1954 | endif |
| 1955 | # TODO: add back protocol and server version |
| 1956 | summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} |
| 1957 | summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')} |
| 1958 | summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} |
| 1959 | summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} |
César Belley | 0a40bcb | 2020-08-26 13:42:04 +0200 | [diff] [blame] | 1960 | summary_info += {'U2F support': u2f.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1961 | summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')} |
| 1962 | summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} |
| 1963 | summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} |
| 1964 | summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')} |
| 1965 | summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')} |
| 1966 | summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')} |
| 1967 | summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')} |
| 1968 | if targetos == 'windows' |
| 1969 | if 'WIN_SDK' in config_host |
| 1970 | summary_info += {'Windows SDK': config_host['WIN_SDK']} |
| 1971 | endif |
| 1972 | summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')} |
| 1973 | summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} |
Stefan Hajnoczi | 4bad7c3 | 2020-09-14 10:52:31 +0100 | [diff] [blame] | 1974 | summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1975 | endif |
| 1976 | summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')} |
| 1977 | summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} |
| 1978 | summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'} |
| 1979 | summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} |
| 1980 | summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} |
| 1981 | summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} |
| 1982 | summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')} |
Marc-André Lureau | bf0e56a | 2019-10-04 17:35:16 +0400 | [diff] [blame] | 1983 | summary_info += {'gcov': get_option('b_coverage')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1984 | summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')} |
| 1985 | summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')} |
| 1986 | summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')} |
| 1987 | summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} |
| 1988 | summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')} |
| 1989 | summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')} |
| 1990 | summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')} |
| 1991 | summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')} |
| 1992 | summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')} |
| 1993 | summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} |
| 1994 | summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')} |
Paolo Bonzini | aa08796 | 2020-09-01 11:15:30 -0400 | [diff] [blame] | 1995 | summary_info += {'memory allocator': get_option('malloc')} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 1996 | summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')} |
| 1997 | summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')} |
| 1998 | summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')} |
| 1999 | summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')} |
| 2000 | summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')} |
| 2001 | summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')} |
| 2002 | summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')} |
| 2003 | summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')} |
| 2004 | summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')} |
| 2005 | summary_info += {'qed support': config_host.has_key('CONFIG_QED')} |
| 2006 | summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')} |
| 2007 | summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')} |
Richard Henderson | 8b18cdb | 2020-09-13 12:19:25 -0700 | [diff] [blame] | 2008 | summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 2009 | summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')} |
| 2010 | summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')} |
Paolo Bonzini | f01496a | 2020-09-16 17:54:14 +0200 | [diff] [blame] | 2011 | summary_info += {'libudev': libudev.found()} |
Paolo Bonzini | f933275 | 2020-02-03 13:28:38 +0100 | [diff] [blame] | 2012 | summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'} |
| 2013 | summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')} |
| 2014 | summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')} |
| 2015 | if config_host.has_key('HAVE_GDB_BIN') |
| 2016 | summary_info += {'gdb': config_host['HAVE_GDB_BIN']} |
| 2017 | endif |
| 2018 | summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} |
| 2019 | summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} |
| 2020 | summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} |
| 2021 | summary(summary_info, bool_yn: true) |
| 2022 | |
| 2023 | if not supported_cpus.contains(cpu) |
| 2024 | message() |
| 2025 | warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!') |
| 2026 | message() |
| 2027 | message('CPU host architecture ' + cpu + ' support is not currently maintained.') |
| 2028 | message('The QEMU project intends to remove support for this host CPU in') |
| 2029 | message('a future release if nobody volunteers to maintain it and to') |
| 2030 | message('provide a build host for our continuous integration setup.') |
| 2031 | message('configure has succeeded and you can continue to build, but') |
| 2032 | message('if you care about QEMU on this platform you should contact') |
| 2033 | message('us upstream at qemu-devel@nongnu.org.') |
| 2034 | endif |
| 2035 | |
| 2036 | if not supported_oses.contains(targetos) |
| 2037 | message() |
| 2038 | warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!') |
| 2039 | message() |
| 2040 | message('Host OS ' + targetos + 'support is not currently maintained.') |
| 2041 | message('The QEMU project intends to remove support for this host OS in') |
| 2042 | message('a future release if nobody volunteers to maintain it and to') |
| 2043 | message('provide a build host for our continuous integration setup.') |
| 2044 | message('configure has succeeded and you can continue to build, but') |
| 2045 | message('if you care about QEMU on this platform you should contact') |
| 2046 | message('us upstream at qemu-devel@nongnu.org.') |
| 2047 | endif |