project('qemu', ['c'], meson_version: '>=0.58.2',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
- 'b_staticpic=false'],
+ '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'])
+
not_found = dependency('', required: false)
keyval = import('keyval')
ss = import('sourceset')
supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
- 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
+ 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64']
cpu = host_machine.cpu_family()
targetos = host_machine.system()
+if cpu not in supported_cpus
+ host_arch = 'unknown'
+elif cpu == 'x86'
+ host_arch = 'i386'
+elif cpu == 'mips64'
+ host_arch = 'mips'
+else
+ host_arch = cpu
+endif
+
if cpu in ['x86', 'x86_64']
kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
elif cpu == 'aarch64'
endif
endif
-tcg_arch = config_host['ARCH']
+tcg_arch = host_arch
if not get_option('tcg').disabled()
- if cpu not in supported_cpus
+ if host_arch == 'unknown'
if get_option('tcg_interpreter')
warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
else
endif
if get_option('tcg_interpreter')
tcg_arch = 'tci'
- elif config_host['ARCH'] == 'sparc64'
+ elif host_arch == 'sparc64'
tcg_arch = 'sparc'
- elif config_host['ARCH'] in ['x86_64', 'x32']
+ elif host_arch == 'x86_64'
tcg_arch = 'i386'
- elif config_host['ARCH'] == 'ppc64'
+ elif host_arch == 'ppc64'
tcg_arch = 'ppc'
endif
add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
add_project_arguments(config_host['GLIB_CFLAGS'].split(),
native: false, language: ['c', 'cpp', 'objc'])
glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
- link_args: config_host['GLIB_LIBS'].split())
+ link_args: config_host['GLIB_LIBS'].split(),
+ version: config_host['GLIB_VERSION'])
# override glib dep with the configure results (for subprojects)
meson.override_dependency('glib-2.0', glib)
gio = not_found
if 'CONFIG_GIO' in config_host
gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
- link_args: config_host['GIO_LIBS'].split())
+ link_args: config_host['GIO_LIBS'].split(),
+ version: config_host['GLIB_VERSION'])
endif
lttng = not_found
if 'ust' in get_option('trace_backends')
''', dependencies: glusterfs)
endif
endif
+
libssh = not_found
-if 'CONFIG_LIBSSH' in config_host
- libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
- link_args: config_host['LIBSSH_LIBS'].split())
+if not get_option('libssh').auto() or have_block
+ libssh = dependency('libssh', version: '>=0.8.7',
+ method: 'pkg-config',
+ required: get_option('libssh'),
+ kwargs: static_kwargs)
endif
+
libbzip2 = not_found
if not get_option('bzip2').auto() or have_block
libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'],
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
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'))
+config_host_data.set('HOST_' + host_arch.to_upper(), 1)
+
config_host_data.set('CONFIG_ATTR', libattr.found())
config_host_data.set('CONFIG_BRLAPI', brlapi.found())
config_host_data.set('CONFIG_COCOA', cocoa.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_LIBSSH', libssh.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_FUSE', fuse.found())
config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())
+if spice_protocol.found()
+config_host_data.set('CONFIG_SPICE_PROTOCOL_MAJOR', spice_protocol.version().split('.')[0])
+config_host_data.set('CONFIG_SPICE_PROTOCOL_MINOR', spice_protocol.version().split('.')[1])
+config_host_data.set('CONFIG_SPICE_PROTOCOL_MICRO', spice_protocol.version().split('.')[2])
+endif
config_host_data.set('CONFIG_SPICE', spice.found())
config_host_data.set('CONFIG_X11', x11.found())
+config_host_data.set('CONFIG_DBUS_DISPLAY', dbus_display)
config_host_data.set('CONFIG_CFI', get_option('cfi'))
config_host_data.set('CONFIG_SELINUX', selinux.found())
config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
v = '"' + '", "'.join(v.split()) + '", '
endif
config_host_data.set(k, v)
- elif k == 'ARCH'
- config_host_data.set('HOST_' + v.to_upper(), 1)
elif strings.contains(k)
config_host_data.set_quoted(k, v)
elif k.startswith('CONFIG_')
'hppa' : ['CONFIG_HPPA_DIS'],
'i386' : ['CONFIG_I386_DIS'],
'x86_64' : ['CONFIG_I386_DIS'],
- 'x32' : ['CONFIG_I386_DIS'],
'm68k' : ['CONFIG_M68K_DIS'],
'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
'mips' : ['CONFIG_MIPS_DIS'],
endif
foreach k, v: disassemblers
- if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
+ if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
foreach sym: v
config_target += { sym: 'y' }
config_all_disas += { sym: 'y' }
authz_ss = ss.source_set()
blockdev_ss = ss.source_set()
block_ss = ss.source_set()
-bsd_user_ss = ss.source_set()
chardev_ss = ss.source_set()
common_ss = ss.source_set()
+common_user_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()
qom_ss = ss.source_set()
softmmu_ss = ss.source_set()
subdir('fpu')
subdir('accel')
subdir('plugins')
+subdir('ebpf')
+
+common_user_inc = []
+
+subdir('common-user')
subdir('bsd-user')
subdir('linux-user')
-subdir('ebpf')
-specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
+common_user_ss = common_user_ss.apply(config_all, strict: false)
+common_user = static_library('common-user',
+ sources: common_user_ss.sources(),
+ dependencies: common_user_ss.dependencies(),
+ include_directories: common_user_inc,
+ name_suffix: 'fa',
+ build_by_default: false)
+common_user = declare_dependency(link_with: common_user)
-linux_user_ss.add(files('thunk.c'))
-specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
+user_ss.add(common_user)
# needed for fuzzing binaries
subdir('tests/qtest/libqos')
foreach target : target_dirs
config_target = config_target_mak[target]
target_name = config_target['TARGET_NAME']
- arch = config_target['TARGET_BASE_ARCH']
+ target_base_arch = config_target['TARGET_BASE_ARCH']
arch_srcs = [config_target_h[target]]
arch_deps = []
c_args = ['-DNEED_CPU_H',
if target.endswith('-softmmu')
qemu_target_name = 'qemu-system-' + target_name
target_type='system'
- t = target_softmmu_arch[arch].apply(config_target, strict: false)
+ t = target_softmmu_arch[target_base_arch].apply(config_target, strict: false)
arch_srcs += t.sources()
arch_deps += t.dependencies()
- hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
+ hw_dir = target_name == 'sparc64' ? 'sparc64' : target_base_arch
hw = hw_arch[hw_dir].apply(config_target, strict: false)
arch_srcs += hw.sources()
arch_deps += hw.dependencies()
abi = config_target['TARGET_ABI_DIR']
target_type='user'
qemu_target_name = 'qemu-' + target_name
- if arch in target_user_arch
- t = target_user_arch[arch].apply(config_target, strict: false)
+ if target_base_arch in target_user_arch
+ t = target_user_arch[target_base_arch].apply(config_target, strict: false)
arch_srcs += t.sources()
arch_deps += t.dependencies()
endif
if 'CONFIG_LINUX_USER' in config_target
base_dir = 'linux-user'
- target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
+ target_inc += include_directories('linux-user/host/' / host_arch)
endif
if 'CONFIG_BSD_USER' in config_target
base_dir = 'bsd-user'
target_inc += include_directories('bsd-user/' / targetos)
dir = base_dir / abi
- arch_srcs += files(dir / 'target_arch_cpu.c')
+ arch_srcs += files(dir / 'signal.c', dir / 'target_arch_cpu.c')
endif
target_inc += include_directories(
base_dir,
arch_srcs += gdbstub_xml
endif
- t = target_arch[arch].apply(config_target, strict: false)
+ t = target_arch[target_base_arch].apply(config_target, strict: false)
arch_srcs += t.sources()
arch_deps += t.dependencies()
if 'simple' in get_option('trace_backends')
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 += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
summary_info += {'seccomp support': seccomp}
summary_info += {'GlusterFS support': glusterfs}
summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
-summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
+summary_info += {'libssh support': libssh}
summary_info += {'lzo support': lzo}
summary_info += {'snappy support': snappy}
summary_info += {'bzip2 support': libbzip2}