genh = []
target_dirs = config_host['TARGET_DIRS'].split()
-have_user = false
+have_linux_user = false
+have_bsd_user = false
have_system = false
foreach target : target_dirs
- have_user = have_user or target.endswith('-user')
+ have_linux_user = have_linux_user or target.endswith('linux-user')
+ have_bsd_user = have_bsd_user or target.endswith('bsd-user')
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_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', 'riscv32', 'riscv64', 'x86', 'x86_64',
+supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
cpu = host_machine.cpu_family()
kvm_targets = []
endif
+kvm_targets_c = '""'
+if not get_option('kvm').disabled() and targetos == 'linux'
+ kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
+endif
+config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
+
accelerator_targets = { 'CONFIG_KVM': kvm_targets }
if cpu in ['aarch64']
endif
endforeach
+dtrace = not_found
+stap = not_found
+if 'dtrace' in get_option('trace_backends')
+ dtrace = find_program('dtrace', required: true)
+ stap = find_program('stap', required: false)
+ if stap.found()
+ # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol
+ # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility
+ # instead. QEMU --enable-modules depends on this because the SystemTap
+ # semaphores are linked into the main binary and not the module's shared
+ # object.
+ add_global_arguments('-DSTAP_SDT_V2',
+ native: false, language: ['c', 'cpp', 'objc'])
+ endif
+endif
+
##################
# Compiler flags #
##################
link_language = meson.get_external_property('link_language', 'cpp')
if link_language == 'cpp'
add_languages('cpp', required: true, native: false)
+ cxx = meson.get_compiler('cpp')
+ linker = cxx
+else
+ linker = cc
endif
if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
error('Your compiler does not support -fsanitize=fuzzer')
endif
+if 'ftrace' in get_option('trace_backends') and targetos != 'linux'
+ error('ftrace is supported only on Linux')
+endif
+if 'syslog' in get_option('trace_backends') and not cc.compiles('''
+ #include <syslog.h>
+ int main(void) {
+ openlog("qemu", LOG_PID, LOG_DAEMON);
+ syslog(LOG_INFO, "configure");
+ return 0;
+ }''')
+ 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
emulator_link_args = []
nvmm =not_found
hvf = not_found
+host_dsosuf = '.so'
if targetos == 'windows'
socket = cc.find_library('ws2_32')
winmm = cc.find_library('winmm')
version_res = win.compile_resources('version.rc',
depend_files: files('pc-bios/qemu-nsis.ico'),
include_directories: include_directories('.'))
+ host_dsosuf = '.dll'
elif targetos == 'darwin'
coref = dependency('appleframeworks', modules: 'CoreFoundation')
iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
+ host_dsosuf = '.dylib'
elif targetos == 'sunos'
socket = [cc.find_library('socket'),
cc.find_library('nsl'),
error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
endif
elif get_option('tcg_interpreter')
- warning('Use of the TCG interpretor is not recommended on this host')
+ warning('Use of the TCG interpreter is not recommended on this host')
warning('architecture. There is a native TCG execution backend available')
warning('which provides substantially better performance and reliability.')
warning('It is strongly recommended to remove the --enable-tcg-interpreter')
tcg_arch = 'i386'
elif config_host['ARCH'] == 'ppc64'
tcg_arch = 'ppc'
- elif config_host['ARCH'] in ['riscv32', 'riscv64']
- tcg_arch = 'riscv'
endif
add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
language: ['c', 'cpp', 'objc'])
link_args: config_host['GIO_LIBS'].split())
endif
lttng = not_found
-if 'CONFIG_TRACE_UST' in config_host
- lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
+if 'ust' in get_option('trace_backends')
+ lttng = dependency('lttng-ust', required: true, method: 'pkg-config',
+ kwargs: static_kwargs)
endif
pixman = not_found
if have_system or have_tools
pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
method: 'pkg-config', kwargs: static_kwargs)
endif
-libaio = cc.find_library('aio', required: false)
zlib = dependency('zlib', required: true, kwargs: static_kwargs)
+libaio = not_found
+if not get_option('linux_aio').auto() or have_block
+ libaio = cc.find_library('aio', has_headers: ['libaio.h'],
+ required: get_option('linux_aio'),
+ kwargs: static_kwargs)
+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'),
xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
method: 'pkg-config', kwargs: static_kwargs)
endif
+
vde = not_found
-if config_host.has_key('CONFIG_VDE')
- vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
+if not get_option('vde').auto() or have_system or have_tools
+ vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'],
+ required: get_option('vde'),
+ kwargs: static_kwargs)
+endif
+if vde.found() and not cc.links('''
+ #include <libvdeplug.h>
+ int main(void)
+ {
+ struct vde_open_args a = {0, 0, 0};
+ char s[] = "";
+ vde_open(s, s, &a);
+ return 0;
+ }''', dependencies: vde)
+ vde = not_found
+ if get_option('cap_ng').enabled()
+ error('could not link libvdeplug')
+ else
+ warning('could not link libvdeplug, disabling')
+ endif
endif
pulse = not_found
method: 'pkg-config', kwargs: static_kwargs)
endif
-spice = not_found
-spice_headers = not_found
spice_protocol = not_found
-if 'CONFIG_SPICE' in config_host
- spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
- link_args: config_host['SPICE_LIBS'].split())
- spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split())
+if not get_option('spice_protocol').auto() or have_system
+ spice_protocol = dependency('spice-protocol', version: '>=0.12.3',
+ required: get_option('spice_protocol'),
+ method: 'pkg-config', kwargs: static_kwargs)
endif
-if 'CONFIG_SPICE_PROTOCOL' in config_host
- spice_protocol = declare_dependency(compile_args: config_host['SPICE_PROTOCOL_CFLAGS'].split())
+spice = not_found
+if not get_option('spice').auto() or have_system
+ spice = dependency('spice-server', version: '>=0.12.5',
+ required: get_option('spice'),
+ method: 'pkg-config', kwargs: static_kwargs)
endif
+spice_headers = spice.partial_dependency(compile_args: true, includes: true)
+
rt = cc.find_library('rt', required: false)
libdl = not_found
if 'CONFIG_PLUGIN' in config_host
endif
oss = not_found
-if not get_option('oss').auto() or have_system
+if have_system and not get_option('oss').disabled()
if not cc.has_header('sys/soundcard.h')
# not found
elif targetos == 'netbsd'
if not oss.found()
if get_option('oss').enabled()
error('OSS not found')
- else
- warning('OSS not found, disabling')
endif
endif
endif
if not dsound.found()
if get_option('dsound').enabled()
error('DirectSound not found')
- else
- warning('DirectSound not found, disabling')
endif
endif
endif
if not get_option('coreaudio').auto() or (targetos == 'darwin' and have_system)
coreaudio = dependency('appleframeworks', modules: 'CoreAudio',
required: get_option('coreaudio'))
- if coreaudio.found() and not cc.links('''
- #include <CoreAudio/CoreAudio.h>
- int main(void)
- {
- return (int)AudioGetCurrentHostTime();
- }''')
- coreaudio = not_found
- endif
-
- if not coreaudio.found()
- if get_option('coreaudio').enabled()
- error('CoreAudio not found')
- else
- warning('CoreAudio not found, disabling')
- endif
- endif
endif
opengl = not_found
required: get_option('snappy'),
kwargs: static_kwargs)
endif
-if snappy.found() and not cc.links('''
+if snappy.found() and not linker.links('''
#include <snappy-c.h>
int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
snappy = not_found
have_virtfs = false
endif
+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'))
+
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('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_GCOV', get_option('b_coverage'))
config_host_data.set('CONFIG_LIBUDEV', libudev.found())
config_host_data.set('CONFIG_LZO', lzo.found())
config_host_data.set('CONFIG_MPATH', mpathpersist.found())
config_host_data.set('CONFIG_LIBDAXCTL', libdaxctl.found())
config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
config_host_data.set('CONFIG_LIBNFS', libnfs.found())
+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_RBD', rbd.found())
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
config_host_data.set('CONFIG_SNAPPY', snappy.found())
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_VNC', vnc.found())
config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
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('CONFIG_SPICE_PROTOCOL', spice_protocol.found())
+config_host_data.set('CONFIG_SPICE', spice.found())
config_host_data.set('CONFIG_X11', x11.found())
config_host_data.set('CONFIG_CFI', get_option('cfi'))
config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
+config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf)
config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device)
+config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big')
# has_header
config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h'))
config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util))
config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul'))
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
+if rdma.found()
+ config_host_data.set('HAVE_IBV_ADVISE_MR',
+ cc.has_function('ibv_advise_mr',
+ args: config_host['RDMA_LIBS'].split(),
+ prefix: '#include <infiniband/verbs.h>'))
+endif
# has_header_symbol
config_host_data.set('CONFIG_BYTESWAP_H',
cc.has_header_symbol('sys/inotify.h', 'inotify_init'))
config_host_data.set('CONFIG_INOTIFY1',
cc.has_header_symbol('sys/inotify.h', 'inotify_init1'))
+config_host_data.set('CONFIG_IOVEC',
+ cc.has_header_symbol('sys/uio.h', 'struct iovec'))
config_host_data.set('CONFIG_MACHINE_BSWAP_H',
cc.has_header_symbol('machine/bswap.h', 'bswap32',
prefix: '''#include <sys/endian.h>
#include <sys/mman.h>
#include <stddef.h>
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }'''))
+
+config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links('''
+ #include <pthread.h>
+
+ static void *f(void *p) { return NULL; }
+ int main(void)
+ {
+ pthread_t thread;
+ pthread_create(&thread, 0, f, 0);
+ pthread_setname_np(thread, "QEMU");
+ return 0;
+ }''', dependencies: threads))
+config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links('''
+ #include <pthread.h>
+
+ static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; }
+ int main(void)
+ {
+ pthread_t thread;
+ pthread_create(&thread, 0, f, 0);
+ return 0;
+ }''', dependencies: threads))
+
config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + '''
#include <sys/signalfd.h>
#include <stddef.h>
return 0;
}'''))
+config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
+ #include <sys/mman.h>
+ int main(int argc, char *argv[]) {
+ return mlockall(MCL_FUTURE);
+ }'''))
+
+have_l2tpv3 = false
+if not get_option('l2tpv3').disabled() and have_system
+ have_l2tpv3 = (cc.has_header_symbol('sys/socket.h', 'struct mmsghdr')
+ and cc.has_header('linux/ip.h'))
+endif
+config_host_data.set('CONFIG_L2TPV3', have_l2tpv3)
+
+have_netmap = false
+if not get_option('netmap').disabled() and have_system
+ have_netmap = cc.compiles('''
+ #include <inttypes.h>
+ #include <net/if.h>
+ #include <net/netmap.h>
+ #include <net/netmap_user.h>
+ #if (NETMAP_API < 11) || (NETMAP_API > 15)
+ #error
+ #endif
+ int main(void) { return 0; }''')
+ if not have_netmap and get_option('netmap').enabled()
+ error('Netmap headers not available')
+ endif
+endif
+config_host_data.set('CONFIG_NETMAP', have_netmap)
+
+# Work around a system header bug with some kernel/XFS header
+# versions where they both try to define 'struct fsxattr':
+# xfs headers will not try to redefine structs from linux headers
+# if this macro is set.
+config_host_data.set('HAVE_FSXATTR', cc.links('''
+ #include <linux/fs.h>'
+ struct fsxattr foo;
+ int main(void) {
+ return 0;
+ }'''))
+
# Some versions of Mac OS X incorrectly define SIZE_MAX
config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
#include <stdint.h>
return printf("%zu", SIZE_MAX);
}''', args: ['-Werror']))
+# See if 64-bit atomic operations are supported.
+# Note that without __atomic builtins, we can only
+# assume atomic loads/stores max at pointer size.
+config_host_data.set('CONFIG_ATOMIC64', cc.links('''
+ #include <stdint.h>
+ int main(void)
+ {
+ uint64_t x = 0, y = 0;
+ y = __atomic_load_n(&x, __ATOMIC_RELAXED);
+ __atomic_store_n(&x, y, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+ __atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
+ return 0;
+ }'''))
+
+config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
+ #include <sys/auxv.h>
+ int main(void) {
+ return getauxval(AT_HWCAP) == 0;
+ }'''))
+
+config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #if !defined(AF_VSOCK)
+ # error missing AF_VSOCK flag
+ #endif
+ #include <linux/vm_sockets.h>
+ int main(void) {
+ int sock, ret;
+ struct sockaddr_vm svm;
+ socklen_t len = sizeof(svm);
+ sock = socket(AF_VSOCK, SOCK_STREAM, 0);
+ ret = getpeername(sock, (struct sockaddr *)&svm, &len);
+ if ((ret == -1) && (errno == ENOTCONN)) {
+ return 0;
+ }
+ return -1;
+ }'''))
-ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
+ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
+ 'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
-strings = ['HOST_DSOSUF', 'CONFIG_IASL']
+strings = ['CONFIG_IASL']
foreach k, v: config_host
if ignored.contains(k)
# do nothing
elif k == 'ARCH'
config_host_data.set('HOST_' + v.to_upper(), 1)
elif strings.contains(k)
- if not k.startswith('CONFIG_')
- k = 'CONFIG_' + k.to_upper()
- endif
config_host_data.set_quoted(k, v)
- elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
+ elif k.startswith('CONFIG_')
config_host_data.set(k, v == 'y' ? 1 : v)
endif
endforeach
host_kconfig = \
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
- ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+ (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
(x11.found() ? ['CONFIG_X11=y'] : []) + \
tracetool = [
python, files('scripts/tracetool.py'),
- '--backend=' + config_host['TRACE_BACKENDS']
+ '--backend=' + ','.join(get_option('trace_backends'))
]
tracetool_depends = files(
'scripts/tracetool/backend/log.py',
chardev_ss = ss.source_set()
common_ss = ss.source_set()
crypto_ss = ss.source_set()
+hwcore_ss = ss.source_set()
io_ss = ss.source_set()
linux_user_ss = ss.source_set()
qmp_ss = ss.source_set()
'hw/s390x',
'hw/scsi',
'hw/sd',
+ 'hw/sh4',
'hw/sparc',
'hw/sparc64',
'hw/ssi',
subdir('linux-user')
subdir('ebpf')
-bsd_user_ss.add(files('gdbstub.c'))
specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
-linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
+linux_user_ss.add(files('thunk.c'))
specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
# needed for fuzzing binaries
chardev = declare_dependency(link_whole: libchardev)
-libhwcore = static_library('hwcore', sources: hwcore_files + genh,
+hwcore_ss = hwcore_ss.apply(config_host, strict: false)
+libhwcore = static_library('hwcore', sources: hwcore_ss.sources() + genh,
name_suffix: 'fa',
build_by_default: false)
hwcore = declare_dependency(link_whole: libhwcore)
emulators += {exe['name']: emulator}
endif
- if 'CONFIG_TRACE_SYSTEMTAP' in config_host
+ if stap.found()
foreach stp: [
{'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
{'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
if have_system
summary_info += {'Audio drivers': ' '.join(audio_drivers_selected)}
endif
-summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
-if config_host['TRACE_BACKENDS'].split().contains('simple')
- summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
+summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
+if 'simple' in get_option('trace_backends')
+ summary_info += {'Trace output file': get_option('trace_file') + '-<pid>'}
endif
summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
endif
summary_info += {'JACK support': jack}
summary_info += {'brlapi support': brlapi}
-summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
-summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
-summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
+summary_info += {'vde support': vde}
+summary_info += {'netmap support': have_netmap}
+summary_info += {'l2tpv3 support': have_l2tpv3}
+summary_info += {'Linux AIO support': libaio}
summary_info += {'Linux io_uring support': linux_io_uring}
summary_info += {'ATTR/XATTR support': libattr}
summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
summary_info += {'libcap-ng support': libcap_ng}
summary_info += {'bpf support': libbpf}
-# TODO: add back protocol and server version
-summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
+summary_info += {'spice protocol support': spice_protocol}
+if spice_protocol.found()
+ summary_info += {' spice server support': spice}
+endif
summary_info += {'rbd support': rbd}
summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
summary_info += {'smartcard support': cacard}