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']
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('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'])
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
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('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>
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
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
'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
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'] : []) + \
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)
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}