-project('qemu', ['c'], meson_version: '>=0.58.2',
+project('qemu', ['c'], meson_version: '>=0.59.3',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
'b_staticpic=false', 'stdsplit=false'],
version: files('VERSION'))
-add_test_setup('quick', exclude_suites: 'slow', is_default: true)
-add_test_setup('slow', env: ['G_TEST_SLOW=1', 'SPEED=slow'])
+add_test_setup('quick', exclude_suites: ['block', 'slow', 'thorough'], is_default: true)
+add_test_setup('slow', exclude_suites: ['block', 'thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow'])
+add_test_setup('thorough', exclude_suites: ['block'], env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
not_found = dependency('', required: false)
keyval = import('keyval')
config_host_data = configuration_data()
genh = []
+qapi_trace_events = []
+
+bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin']
+supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
+supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
+ 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64']
+
+cpu = host_machine.cpu_family()
+
+# Unify riscv* to a single family.
+if cpu in ['riscv32', 'riscv64']
+ cpu = 'riscv'
+endif
+
+targetos = host_machine.system()
target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false
have_system = have_system or target.endswith('-softmmu')
endforeach
have_user = have_linux_user or have_bsd_user
-have_tools = 'CONFIG_TOOLS' in config_host
+have_tools = get_option('tools') \
+ .disable_auto_if(not have_system) \
+ .allowed()
+have_ga = get_option('guest_agent') \
+ .disable_auto_if(not have_system and not have_tools) \
+ .require(targetos in ['sunos', 'linux', 'windows'],
+ error_message: 'unsupported OS for QEMU guest agent') \
+ .allowed()
have_block = have_system or have_tools
python = import('python').find_installation()
-supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
-supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
- 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64']
-
-cpu = host_machine.cpu_family()
-
-# Unify riscv* to a single family.
-if cpu in ['riscv32', 'riscv64']
- cpu = 'riscv'
-endif
-
-targetos = host_machine.system()
-
if cpu not in supported_cpus
host_arch = 'unknown'
elif cpu == 'x86'
kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
elif cpu in ['mips', 'mips64']
kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu']
+elif cpu in ['riscv']
+ kvm_targets = ['riscv32-softmmu', 'riscv64-softmmu']
else
kvm_targets = []
endif
kvm_targets_c = '""'
-if not get_option('kvm').disabled() and targetos == 'linux'
+if get_option('kvm').allowed() and targetos == 'linux'
kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
endif
config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
# Compiler flags #
##################
+qemu_cflags = config_host['QEMU_CFLAGS'].split()
+qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split()
+qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
+
+if get_option('gprof')
+ qemu_cflags += ['-p']
+ qemu_cxxflags += ['-p']
+ qemu_ldflags += ['-p']
+endif
+
# Specify linker-script with add_project_link_arguments so that it is not placed
# within a linker --start-group/--end-group pair
if get_option('fuzzing')
endif
endif
-add_global_arguments(config_host['QEMU_CFLAGS'].split(),
- native: false, language: ['c', 'objc'])
-add_global_arguments(config_host['QEMU_CXXFLAGS'].split(),
- native: false, language: 'cpp')
-add_global_link_arguments(config_host['QEMU_LDFLAGS'].split(),
- native: false, language: ['c', 'cpp', 'objc'])
+add_global_arguments(qemu_cflags, native: false, language: ['c', 'objc'])
+add_global_arguments(qemu_cxxflags, native: false, language: ['cpp'])
+add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc'])
if targetos == 'linux'
add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
# Target-specific checks and dependencies #
###########################################
+# Fuzzing
if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
not cc.links('''
#include <stdint.h>
error('Your compiler does not support -fsanitize=fuzzer')
endif
+# Tracing backends
if 'ftrace' in get_option('trace_backends') and targetos != 'linux'
error('ftrace is supported only on Linux')
endif
error('syslog is not supported on this system')
endif
-if targetos != 'linux' and get_option('mpath').enabled()
- error('Multipath is supported only on Linux')
-endif
+# Miscellaneous Linux-only features
+get_option('mpath') \
+ .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux')
-if targetos != 'linux' and get_option('multiprocess').enabled()
- error('Multiprocess QEMU is supported only on Linux')
-endif
-multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled()
+multiprocess_allowed = get_option('multiprocess') \
+ .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
+ .allowed()
+have_tpm = get_option('tpm') \
+ .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
+ .allowed()
+
+# Target-specific libraries and flags
libm = cc.find_library('m', required: false)
threads = dependency('threads')
util = cc.find_library('util', required: false)
emulator_link_args = []
nvmm =not_found
hvf = not_found
+midl = not_found
+widl = not_found
host_dsosuf = '.so'
if targetos == 'windows'
+ midl = find_program('midl', required: false)
+ widl = find_program('widl', required: false)
socket = cc.find_library('ws2_32')
winmm = cc.find_library('winmm')
cc.find_library('network'),
cc.find_library('bsd')]
elif targetos == 'openbsd'
- if not get_option('tcg').disabled() and target_dirs.length() > 0
+ if get_option('tcg').allowed() and target_dirs.length() > 0
# Disable OpenBSD W^X if available
emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
endif
endif
+# Target-specific configuration of accelerators
accelerators = []
-if not get_option('kvm').disabled() and targetos == 'linux'
+if get_option('kvm').allowed() and targetos == 'linux'
accelerators += 'CONFIG_KVM'
endif
-if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
+if get_option('xen').allowed() and 'CONFIG_XEN_BACKEND' in config_host
accelerators += 'CONFIG_XEN'
- have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
+ have_xen_pci_passthrough = get_option('xen_pci_passthrough').allowed() and targetos == 'linux'
else
have_xen_pci_passthrough = false
endif
-if not get_option('whpx').disabled() and targetos == 'windows'
+if get_option('whpx').allowed() and targetos == 'windows'
if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
error('WHPX requires 64-bit host')
elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
accelerators += 'CONFIG_WHPX'
endif
endif
-if not get_option('hvf').disabled()
+if get_option('hvf').allowed()
hvf = dependency('appleframeworks', modules: 'Hypervisor',
required: get_option('hvf'))
if hvf.found()
accelerators += 'CONFIG_HVF'
endif
endif
-if not get_option('hax').disabled()
+if get_option('hax').allowed()
if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
accelerators += 'CONFIG_HAX'
endif
endif
tcg_arch = host_arch
-if not get_option('tcg').disabled()
+if get_option('tcg').allowed()
if host_arch == 'unknown'
if get_option('tcg_interpreter')
warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
endif
linux_io_uring = not_found
if not get_option('linux_io_uring').auto() or have_block
- linux_io_uring = dependency('liburing', required: get_option('linux_io_uring'),
+ linux_io_uring = dependency('liburing', version: '>=0.3',
+ required: get_option('linux_io_uring'),
method: 'pkg-config', kwargs: static_kwargs)
endif
-libxml2 = not_found
-if not get_option('libxml2').auto() or have_block
- libxml2 = dependency('libxml-2.0', required: get_option('libxml2'),
- method: 'pkg-config', kwargs: static_kwargs)
-endif
libnfs = not_found
if not get_option('libnfs').auto() or have_block
libnfs = dependency('libnfs', version: '>=1.9.3',
libattr = not_found
have_old_libattr = false
-if not get_option('attr').disabled()
+if get_option('attr').allowed()
if cc.links(libattr_test)
libattr = declare_dependency()
else
method: 'pkg-config', kwargs: static_kwargs)
endif
virgl = not_found
-if not get_option('virglrenderer').auto() or have_system
+
+have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()
+if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
virgl = dependency('virglrenderer',
method: 'pkg-config',
required: get_option('virglrenderer'),
mpathlibs = [libudev]
mpathpersist = not_found
mpathpersist_new_api = false
-if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
+if targetos == 'linux' and have_tools and get_option('mpath').allowed()
mpath_test_source_new = '''
#include <libudev.h>
#include <mpath_persist.h>
iconv = not_found
curses = not_found
-if have_system and not get_option('curses').disabled()
+if have_system and get_option('curses').allowed()
curses_test = '''
#if defined(__APPLE__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE_EXTENDED 1
endforeach
endif
endif
- if not get_option('iconv').disabled()
+ if get_option('iconv').allowed()
foreach link_args : [ ['-liconv'], [] ]
# Programs will be linked with glib and this will bring in libiconv on FreeBSD.
# We need to use libiconv if available because mixing libiconv's headers with
endif
oss = not_found
-if have_system and not get_option('oss').disabled()
+if get_option('oss').allowed() and have_system
if not cc.has_header('sys/soundcard.h')
# not found
elif targetos == 'netbsd'
gbm = dependency('gbm', method: 'pkg-config', required: false,
kwargs: static_kwargs)
endif
+have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and gbm.found()
gnutls = not_found
gnutls_crypto = not_found
png = not_found
jpeg = not_found
sasl = not_found
-if have_system and not get_option('vnc').disabled()
+if get_option('vnc').allowed() and have_system
vnc = declare_dependency() # dummy dependency
png = dependency('libpng', required: get_option('vnc_png'),
method: 'pkg-config', kwargs: static_kwargs)
endif
endif
+numa = not_found
+if not get_option('numa').auto() or have_system or have_tools
+ numa = cc.find_library('numa', has_headers: ['numa.h'],
+ required: get_option('numa'),
+ kwargs: static_kwargs)
+endif
+if numa.found() and not cc.links('''
+ #include <numa.h>
+ int main(void) { return numa_available(); }
+ ''', dependencies: numa)
+ numa = not_found
+ if get_option('numa').enabled()
+ error('could not link numa')
+ else
+ warning('could not link numa, disabling')
+ endif
+endif
+
rdma = not_found
if 'CONFIG_RDMA' in config_host
rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
endif
-numa = not_found
-if 'CONFIG_NUMA' in config_host
- numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
-endif
xen = not_found
if 'CONFIG_XEN_BACKEND' in config_host
xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
malloc = []
if get_option('malloc') == 'system'
has_malloc_trim = \
- not get_option('malloc_trim').disabled() and \
+ get_option('malloc_trim').allowed() and \
cc.links('''#include <malloc.h>
int main(void) { malloc_trim(0); return 0; }''')
else
has_statx = cc.links(statx_test)
-have_vhost_user_blk_server = (targetos == 'linux' and
- 'CONFIG_VHOST_USER' in config_host)
+# Check whether statx() provides mount ID information
-if get_option('vhost_user_blk_server').enabled()
- if targetos != 'linux'
- error('vhost_user_blk_server requires linux')
- elif 'CONFIG_VHOST_USER' not in config_host
- error('vhost_user_blk_server requires vhost-user support')
- endif
-elif get_option('vhost_user_blk_server').disabled() or not have_system
- have_vhost_user_blk_server = false
-endif
+statx_mnt_id_test = gnu_source_prefix + '''
+ #include <sys/stat.h>
+ int main(void) {
+ struct statx statxbuf;
+ statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);
+ return statxbuf.stx_mnt_id;
+ }'''
+
+has_statx_mnt_id = cc.links(statx_mnt_id_test)
+have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
+ .require(targetos == 'linux',
+ error_message: 'vhost_user_blk_server requires linux') \
+ .require('CONFIG_VHOST_USER' in config_host,
+ error_message: 'vhost_user_blk_server requires vhost-user support') \
+ .disable_auto_if(not have_system) \
+ .allowed()
if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
error('Cannot enable fuse-lseek while fuse is disabled')
kwargs: static_kwargs)
fuse_lseek = not_found
-if not get_option('fuse_lseek').disabled()
+if get_option('fuse_lseek').allowed()
if fuse.version().version_compare('>=3.8')
# Dummy dependency
fuse_lseek = declare_dependency()
have_host_block_device = (targetos != 'darwin' or
cc.has_header('IOKit/storage/IOMedia.h'))
-dbus_display = false
-if not get_option('dbus_display').disabled()
- # FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333
- dbus_display = gio.version().version_compare('>=2.64') and config_host.has_key('GDBUS_CODEGEN') and enable_modules
- if get_option('dbus_display').enabled() and not dbus_display
- error('Requirements missing to enable -display dbus (glib>=2.64 && --enable-modules)')
- endif
-endif
-
-have_virtfs = (targetos == 'linux' and
- have_system and
- libattr.found() and
- libcap_ng.found())
-
-have_virtfs_proxy_helper = have_virtfs and have_tools
-
-if get_option('virtfs').enabled()
- if not have_virtfs
- if targetos != 'linux'
- error('virtio-9p (virtfs) requires Linux')
- elif not libcap_ng.found() or not libattr.found()
- error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel')
- elif not have_system
- error('virtio-9p (virtfs) needs system emulation support')
- endif
- endif
-elif get_option('virtfs').disabled()
- have_virtfs = false
-endif
+# FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333
+dbus_display = get_option('dbus_display') \
+ .require(gio.version().version_compare('>=2.64'),
+ error_message: '-display dbus requires glib>=2.64') \
+ .require(enable_modules,
+ error_message: '-display dbus requires --enable-modules') \
+ .require(config_host.has_key('GDBUS_CODEGEN'),
+ error_message: '-display dbus requires gdbus-codegen') \
+ .allowed()
+
+have_virtfs = get_option('virtfs') \
+ .require(targetos == 'linux' or targetos == 'darwin',
+ error_message: 'virtio-9p (virtfs) requires Linux or macOS') \
+ .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'),
+ error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \
+ .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()),
+ error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \
+ .disable_auto_if(not have_tools and not have_system) \
+ .allowed()
+
+have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools
foreach k : get_option('trace_backends')
config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
endforeach
config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
-
+if get_option('iasl') != ''
+ config_host_data.set_quoted('CONFIG_IASL', get_option('iasl'))
+endif
config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir'))
config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir)
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
+have_slirp_smbd = get_option('slirp_smbd') \
+ .require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
+ .allowed()
+if have_slirp_smbd
+ smbd_path = get_option('smbd')
+ if smbd_path == ''
+ smbd_path = (targetos == 'solaris' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
+ endif
+ config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path)
+endif
+
config_host_data.set('HOST_' + host_arch.to_upper(), 1)
config_host_data.set('CONFIG_ATTR', libattr.found())
+config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools'))
config_host_data.set('CONFIG_BRLAPI', brlapi.found())
config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_FUZZ', get_option('fuzzing'))
config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
+config_host_data.set('CONFIG_NUMA', numa.found())
+config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
config_host_data.set('CONFIG_RBD', rbd.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
config_host_data.set('CONFIG_SNAPPY', snappy.found())
+config_host_data.set('CONFIG_TPM', have_tpm)
config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
config_host_data.set('CONFIG_VDE', vde.found())
config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts == 'private')
config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
config_host_data.set('CONFIG_STATX', has_statx)
+config_host_data.set('CONFIG_STATX_MNT_ID', has_statx_mnt_id)
config_host_data.set('CONFIG_ZSTD', zstd.found())
config_host_data.set('CONFIG_FUSE', fuse.found())
config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device)
config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big')
+have_coroutine_pool = get_option('coroutine_pool')
+if get_option('debug_stack_usage') and have_coroutine_pool
+ message('Disabling coroutine pool to measure stack usage')
+ have_coroutine_pool = false
+endif
+config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool)
+config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
+config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
+config_host_data.set('CONFIG_GPROF', get_option('gprof'))
+config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed())
+config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug'))
+config_host_data.set('CONFIG_REPLICATION', get_option('live_block_migration').allowed())
+
# has_header
config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h'))
config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h'))
config_host_data.set('CONFIG_DUP3', cc.has_function('dup3'))
config_host_data.set('CONFIG_FALLOCATE', cc.has_function('fallocate'))
config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
-config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign'))
+# Note that we need to specify prefix: here to avoid incorrectly
+# thinking that Windows has posix_memalign()
+config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix: '#include <stdlib.h>'))
+config_host_data.set('CONFIG_ALIGNED_MALLOC', cc.has_function('_aligned_malloc'))
+config_host_data.set('CONFIG_VALLOC', cc.has_function('valloc'))
+config_host_data.set('CONFIG_MEMALIGN', cc.has_function('memalign'))
config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll'))
config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
+config_host_data.set('CONFIG_PTHREAD_FCHDIR_NP', cc.has_function('pthread_fchdir_np'))
config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwait', dependencies: threads))
config_host_data.set('CONFIG_SENDFILE', cc.has_function('sendfile'))
config_host_data.set('CONFIG_SETNS', cc.has_function('setns') and cc.has_function('unshare'))
}'''))
have_l2tpv3 = false
-if not get_option('l2tpv3').disabled() and have_system
+if get_option('l2tpv3').allowed() and have_system
have_l2tpv3 = cc.has_type('struct mmsghdr',
prefix: gnu_source_prefix + '''
#include <sys/socket.h>
config_host_data.set('CONFIG_L2TPV3', have_l2tpv3)
have_netmap = false
-if not get_option('netmap').disabled() and have_system
+if get_option('netmap').allowed() and have_system
have_netmap = cc.compiles('''
#include <inttypes.h>
#include <net/if.h>
return getauxval(AT_HWCAP) == 0;
}'''))
+have_cpuid_h = cc.links('''
+ #include <cpuid.h>
+ int main(void) {
+ unsigned a, b, c, d;
+ unsigned max = __get_cpuid_max(0, 0);
+
+ if (max >= 1) {
+ __cpuid(1, a, b, c, d);
+ }
+
+ if (max >= 7) {
+ __cpuid_count(7, 0, a, b, c, d);
+ }
+
+ return 0;
+ }''')
+config_host_data.set('CONFIG_CPUID_H', have_cpuid_h)
+
+config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
+ .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX2') \
+ .require(cc.links('''
+ #pragma GCC push_options
+ #pragma GCC target("avx2")
+ #include <cpuid.h>
+ #include <immintrin.h>
+ static int bar(void *a) {
+ __m256i x = *(__m256i *)a;
+ return _mm256_testz_si256(x, x);
+ }
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
+ '''), error_message: 'AVX2 not available').allowed())
+
+config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
+ .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \
+ .require(cc.links('''
+ #pragma GCC push_options
+ #pragma GCC target("avx512f")
+ #include <cpuid.h>
+ #include <immintrin.h>
+ static int bar(void *a) {
+ __m512i x = *(__m512i *)a;
+ return _mm512_test_epi64_mask(x, x);
+ }
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
+ '''), error_message: 'AVX512F not available').allowed())
+
+if get_option('membarrier').disabled()
+ have_membarrier = false
+elif targetos == 'windows'
+ have_membarrier = true
+elif targetos == 'linux'
+ have_membarrier = cc.compiles('''
+ #include <linux/membarrier.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ int main(void) {
+ syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
+ syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
+ exit(0);
+ }''')
+endif
+config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \
+ .require(have_membarrier, error_message: 'membarrier system call not available') \
+ .allowed())
+
+have_afalg = get_option('crypto_afalg') \
+ .require(cc.compiles(gnu_source_prefix + '''
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <linux/if_alg.h>
+ int main(void) {
+ int sock;
+ sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
+ return sock;
+ }
+ '''), error_message: 'AF_ALG requested but could not be detected').allowed()
+config_host_data.set('CONFIG_AF_ALG', have_afalg)
+
config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
#include <errno.h>
#include <sys/types.h>
return -1;
}'''))
+have_vss = false
+if targetos == 'windows' and link_language == 'cpp'
+ have_vss = cxx.compiles('''
+ #define __MIDL_user_allocate_free_DEFINED__
+ #include <inc/win2003/vss.h>
+ int main(void) { return VSS_CTX_BACKUP; }''')
+endif
+
+have_ntddscsi = false
+if targetos == 'windows'
+ have_ntddscsi = cc.compiles('''
+ #include <windows.h>
+ #include <ntddscsi.h>
+ int main(void) {
+ #if !defined(IOCTL_SCSI_GET_ADDRESS)
+ #error Missing required ioctl definitions
+ #endif
+ SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
+ return addr.Lun;
+ }
+''')
+endif
+config_host_data.set('HAVE_NTDDSCSI', have_ntddscsi)
+
ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
-strings = ['CONFIG_IASL']
foreach k, v: config_host
if ignored.contains(k)
# do nothing
v = '"' + '", "'.join(v.split()) + '", '
endif
config_host_data.set(k, v)
- elif strings.contains(k)
- config_host_data.set_quoted(k, v)
elif k.startswith('CONFIG_')
config_host_data.set(k, v == 'y' ? 1 : v)
endif
have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
host_kconfig = \
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
- ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+ (have_tpm ? ['CONFIG_TPM=y'] : []) + \
(spice.found() ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
'CONFIG_ALL': true,
}
+target_configs_h = []
+foreach target: target_dirs
+ target_configs_h += config_target_h[target]
+ target_configs_h += config_devices_h.get(target, [])
+endforeach
+genh += custom_target('config-poison.h',
+ input: [target_configs_h],
+ output: 'config-poison.h',
+ capture: true,
+ command: [find_program('scripts/make-config-poison.sh'),
+ target_configs_h])
+
##############
# Submodules #
##############
endif
fdt = not_found
-fdt_opt = get_option('fdt')
if have_system
+ fdt_opt = get_option('fdt')
if fdt_opt in ['enabled', 'auto', 'system']
have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt')
fdt = cc.find_library('fdt', kwargs: static_kwargs,
if fdt.found() and cc.links('''
#include <libfdt.h>
#include <libfdt_env.h>
- int main(void) { fdt_check_full(NULL, 0); return 0; }''',
+ int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''',
dependencies: fdt)
fdt_opt = 'system'
elif fdt_opt == 'system'
fdt = declare_dependency(link_with: libfdt,
include_directories: fdt_inc)
endif
+else
+ fdt_opt = 'disabled'
endif
if not fdt.found() and fdt_required.length() > 0
error('fdt not available but required by targets ' + ', '.join(fdt_required))
'scripts/tracetool/backend/simple.py',
'scripts/tracetool/backend/syslog.py',
'scripts/tracetool/backend/ust.py',
- 'scripts/tracetool/format/tcg_h.py',
'scripts/tracetool/format/ust_events_c.py',
'scripts/tracetool/format/ust_events_h.py',
'scripts/tracetool/format/__init__.py',
'scripts/tracetool/format/d.py',
- 'scripts/tracetool/format/tcg_helper_c.py',
'scripts/tracetool/format/simpletrace_stap.py',
'scripts/tracetool/format/c.py',
'scripts/tracetool/format/h.py',
- 'scripts/tracetool/format/tcg_helper_h.py',
'scripts/tracetool/format/log_stap.py',
'scripts/tracetool/format/stap.py',
- 'scripts/tracetool/format/tcg_helper_wrapper_h.py',
'scripts/tracetool/__init__.py',
'scripts/tracetool/transform.py',
'scripts/tracetool/vcpu.py'
'monitor',
'util',
]
-if have_user
+if have_linux_user
trace_events_subdirs += [ 'linux-user' ]
endif
+if have_bsd_user
+ trace_events_subdirs += [ 'bsd-user' ]
+endif
if have_block
trace_events_subdirs += [
'authz',
'target/i386',
'target/i386/kvm',
'target/mips/tcg',
+ 'target/nios2',
'target/ppc',
'target/riscv',
'target/s390x',
endif
vhost_user = not_found
-if 'CONFIG_VHOST_USER' in config_host
+if targetos == 'linux' and 'CONFIG_VHOST_USER' in config_host
libvhost_user = subproject('libvhost-user')
vhost_user = libvhost_user.get_variable('vhost_user_dep')
endif
+# NOTE: the trace/ subdirectory needs the qapi_trace_events variable
+# that is filled in by qapi/.
subdir('qapi')
subdir('qobject')
subdir('stubs')
'job.c',
'qemu-io-cmds.c',
))
- block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
+ if config_host_data.get('CONFIG_REPLICATION')
+ block_ss.add(files('replication.c'))
+ endif
subdir('nbd')
subdir('scsi')
# Targets #
###########
+emulator_modules = []
foreach m : block_mods + softmmu_mods
- shared_module(m.name(),
+ emulator_modules += shared_module(m.name(),
+ build_by_default: true,
name_prefix: '',
link_whole: m,
install: true,
if 'CONFIG_BSD_USER' in config_target
base_dir = 'bsd-user'
target_inc += include_directories('bsd-user/' / targetos)
+ target_inc += include_directories('bsd-user/host/' / host_arch)
dir = base_dir / abi
arch_srcs += files(dir / 'signal.c', dir / 'target_arch_cpu.c')
endif
install_input += meson.current_source_dir() / entitlements
endif
+ entitlement = find_program('scripts/entitlement.sh')
emulators += {exe['name'] : custom_target(exe['name'],
input: build_input,
output: exe['name'],
- command: [
- files('scripts/entitlement.sh'),
- '@OUTPUT@',
- '@INPUT@'
- ])
+ command: [entitlement, '@OUTPUT@', '@INPUT@'])
}
- meson.add_install_script('scripts/entitlement.sh', '--install',
+ meson.add_install_script(entitlement, '--install',
get_option('bindir') / exe['name'],
install_input)
else
install_headers('include/qemu/qemu-plugin.h')
endif
-if 'CONFIG_GUEST_AGENT' in config_host
- subdir('qga')
-elif get_option('guest_agent_msi').enabled()
- error('Guest agent MSI requested, but the guest agent is not being built')
-endif
+subdir('qga')
# Don't build qemu-keymap if xkbcommon is not explicitly enabled
# when we don't build tools or system
if config_host.has_key('HAVE_GDB_BIN')
summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
endif
+if get_option('iasl') != ''
+ summary_info += {'iasl': get_option('iasl')}
+else
+ summary_info += {'iasl': false}
+endif
summary_info += {'genisoimage': config_host['GENISOIMAGE']}
-if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT')
+if targetos == 'windows' and have_ga
summary_info += {'wixl': wixl}
endif
-if slirp_opt != 'disabled' and 'CONFIG_SLIRP_SMBD' in config_host
- summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
+if slirp_opt != 'disabled' and have_system
+ summary_info += {'smbd': have_slirp_smbd ? smbd_path : false}
endif
summary(summary_info, bool_yn: true, section: 'Host binaries')
summary_info += {'Trace output file': get_option('trace_file') + '-<pid>'}
endif
summary_info += {'D-Bus display': dbus_display}
-summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
+summary_info += {'QOM debugging': get_option('qom_cast_debug')}
summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
-summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
+summary_info += {'build guest agent': have_ga}
summary(summary_info, bool_yn: true, section: 'Configurable features')
# Compilation information
if targetos == 'darwin'
summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
endif
-if targetos == 'windows'
- if 'WIN_SDK' in config_host
- summary_info += {'Windows SDK': config_host['WIN_SDK']}
- endif
-endif
summary_info += {'CFLAGS': ' '.join(get_option('c_args')
+ ['-O' + get_option('optimization')]
+ (get_option('debug') ? ['-g'] : []))}
endif
summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
-summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
+summary_info += {'profiler': get_option('profiler')}
summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
summary_info += {'PIE': get_option('b_pie')}
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
summary_info += {'malloc trim support': has_malloc_trim}
-summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
-summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
-summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
+summary_info += {'membarrier': have_membarrier}
+summary_info += {'debug stack usage': get_option('debug_stack_usage')}
+summary_info += {'mutex debugging': get_option('debug_mutex')}
summary_info += {'memory allocator': get_option('malloc')}
-summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
-summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
-summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
+summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')}
+summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')}
+summary_info += {'gprof enabled': get_option('gprof')}
summary_info += {'gcov': get_option('b_coverage')}
summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
summary_info += {'CFI support': get_option('cfi')}
# Block layer
summary_info = {}
summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
-summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
+summary_info += {'coroutine pool': have_coroutine_pool}
if have_block
summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
- summary_info += {'Use block whitelist in tools': config_host.has_key('CONFIG_BDRV_WHITELIST_TOOLS')}
+ summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')}
summary_info += {'VirtFS support': have_virtfs}
summary_info += {'build virtiofs daemon': have_virtiofsd}
- summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
- summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
- summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
- summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
- summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
- summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
- summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
- summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
- summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
- summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
+ summary_info += {'Live block migration': config_host_data.get('CONFIG_LIVE_BLOCK_MIGRATION')}
+ summary_info += {'replication support': config_host_data.get('CONFIG_REPLICATION')}
+ summary_info += {'bochs support': get_option('bochs').allowed()}
+ summary_info += {'cloop support': get_option('cloop').allowed()}
+ summary_info += {'dmg support': get_option('dmg').allowed()}
+ summary_info += {'qcow v1 support': get_option('qcow1').allowed()}
+ summary_info += {'vdi support': get_option('vdi').allowed()}
+ summary_info += {'vvfat support': get_option('vvfat').allowed()}
+ summary_info += {'qed support': get_option('qed').allowed()}
+ summary_info += {'parallels support': get_option('parallels').allowed()}
summary_info += {'FUSE exports': fuse}
endif
summary(summary_info, bool_yn: true, section: 'Block layer support')
if nettle.found()
summary_info += {' XTS': xts != 'private'}
endif
-summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
-summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
+summary_info += {'AF_ALG support': have_afalg}
+summary_info += {'rng-none': get_option('rng_none')}
summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
summary(summary_info, bool_yn: true, section: 'Crypto')
summary_info += {'libiscsi support': libiscsi}
summary_info += {'libnfs support': libnfs}
if targetos == 'windows'
- if config_host.has_key('CONFIG_GUEST_AGENT')
- summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
- summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
+ if have_ga
+ summary_info += {'QGA VSS support': have_qga_vss}
+ summary_info += {'QGA w32 disk info': have_ntddscsi}
endif
endif
summary_info += {'seccomp support': seccomp}
summary_info += {'GlusterFS support': glusterfs}
-summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
+summary_info += {'TPM support': have_tpm}
summary_info += {'libssh support': libssh}
summary_info += {'lzo support': lzo}
summary_info += {'snappy support': snappy}
summary_info += {'bzip2 support': libbzip2}
summary_info += {'lzfse support': liblzfse}
summary_info += {'zstd support': zstd}
-summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
-summary_info += {'libxml2': libxml2}
+summary_info += {'NUMA host support': numa}
summary_info += {'capstone': capstone_opt == 'internal' ? capstone_opt : capstone}
summary_info += {'libpmem support': libpmem}
summary_info += {'libdaxctl support': libdaxctl}