X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=meson.build;h=1f12c43765ea2dc8dcfa7f3236b9e7e6f60096fd;hb=c1ec49415c300cc539efdb88bb3f72078fb43c24;hp=f5175010dfad628a1426edfa94527785806f17ca;hpb=a47c284a7cf8f6e98df974b1009bf412653ce01e;p=mirror_qemu.git diff --git a/meson.build b/meson.build index f5175010df..1f12c43765 100644 --- a/meson.build +++ b/meson.build @@ -74,10 +74,15 @@ else endif accelerator_targets = { 'CONFIG_KVM': kvm_targets } +if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] + # i368 emulator provides xenpv machine type for multiple architectures + accelerator_targets += { + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + } +endif if cpu in ['x86', 'x86_64'] accelerator_targets += { 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], - 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], } @@ -164,7 +169,6 @@ version_res = [] coref = [] iokit = [] emulator_link_args = [] -cocoa = not_found hvf = not_found if targetos == 'windows' socket = cc.find_library('ws2_32') @@ -177,7 +181,6 @@ if targetos == 'windows' elif targetos == 'darwin' coref = dependency('appleframeworks', modules: 'CoreFoundation') iokit = dependency('appleframeworks', modules: 'IOKit') - cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) elif targetos == 'sunos' socket = [cc.find_library('socket'), cc.find_library('nsl'), @@ -251,9 +254,6 @@ if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() error('Xen PCI passthrough requested but Xen not enabled') endif endif -if not cocoa.found() and get_option('cocoa').enabled() - error('Cocoa not available on this platform') -endif ################ # Dependencies # @@ -263,7 +263,11 @@ endif # grandfathered in from the QEMU Makefiles. add_project_arguments(config_host['GLIB_CFLAGS'].split(), native: false, language: ['c', 'cpp', 'objc']) -glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split()) +glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(), + link_args: config_host['GLIB_LIBS'].split()) +# 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(), @@ -314,22 +318,81 @@ if 'CONFIG_LIBXML2' in config_host link_args: config_host['LIBXML2_LIBS'].split()) endif libnfs = not_found -if 'CONFIG_LIBNFS' in config_host - libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split()) +if not get_option('libnfs').auto() or have_block + libnfs = dependency('libnfs', version: '>=1.9.3', + required: get_option('libnfs'), + method: 'pkg-config', static: enable_static) endif + +libattr_test = ''' + #include + #include + #ifdef CONFIG_LIBATTR + #include + #else + #include + #endif + int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }''' + libattr = not_found -if 'CONFIG_ATTR' in config_host - libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split()) +have_old_libattr = false +if not get_option('attr').disabled() + if cc.links(libattr_test) + libattr = declare_dependency() + else + libattr = cc.find_library('attr', has_headers: ['attr/xattr.h'], + required: get_option('attr'), + static: enable_static) + if libattr.found() and not \ + cc.links(libattr_test, dependencies: libattr, args: '-DCONFIG_LIBATTR') + libattr = not_found + if get_option('attr').enabled() + error('could not link libattr') + else + warning('could not link libattr, disabling') + endif + else + have_old_libattr = libattr.found() + endif + endif +endif + +cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) +if cocoa.found() and get_option('sdl').enabled() + error('Cocoa and SDL cannot be enabled at the same time') endif +if cocoa.found() and get_option('gtk').enabled() + error('Cocoa and GTK+ cannot be enabled at the same time') +endif + seccomp = not_found -if 'CONFIG_SECCOMP' in config_host - seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(), - link_args: config_host['SECCOMP_LIBS'].split()) +if not get_option('seccomp').auto() or have_system or have_tools + seccomp = dependency('libseccomp', version: '>=2.3.0', + required: get_option('seccomp'), + method: 'pkg-config', static: enable_static) endif + libcap_ng = not_found -if 'CONFIG_LIBCAP_NG' in config_host - libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split()) +if not get_option('cap_ng').auto() or have_system or have_tools + libcap_ng = cc.find_library('cap-ng', has_headers: ['cap-ng.h'], + required: get_option('cap_ng'), + static: enable_static) +endif +if libcap_ng.found() and not cc.links(''' + #include + int main(void) + { + capng_capability_to_name(CAPNG_EFFECTIVE); + return 0; + }''', dependencies: libcap_ng) + libcap_ng = not_found + if get_option('cap_ng').enabled() + error('could not link libcap-ng') + else + warning('could not link libcap-ng, disabling') + endif endif + if get_option('xkbcommon').auto() and not have_system and not have_tools xkbcommon = not_found else @@ -367,14 +430,16 @@ if 'CONFIG_PLUGIN' in config_host libdl = cc.find_library('dl', required: true) endif libiscsi = not_found -if 'CONFIG_LIBISCSI' in config_host - libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(), - link_args: config_host['LIBISCSI_LIBS'].split()) +if not get_option('libiscsi').auto() or have_block + libiscsi = dependency('libiscsi', version: '>=1.9.0', + required: get_option('libiscsi'), + method: 'pkg-config', static: enable_static) endif zstd = not_found -if 'CONFIG_ZSTD' in config_host - zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(), - link_args: config_host['ZSTD_LIBS'].split()) +if not get_option('zstd').auto() or have_block + zstd = dependency('libzstd', version: '>=1.4.0', + required: get_option('zstd'), + method: 'pkg-config', static: enable_static) endif gbm = not_found if 'CONFIG_GBM' in config_host @@ -387,13 +452,16 @@ if 'CONFIG_VIRGL' in config_host link_args: config_host['VIRGL_LIBS'].split()) endif curl = not_found -if 'CONFIG_CURL' in config_host - curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(), - link_args: config_host['CURL_LIBS'].split()) +if not get_option('curl').auto() or have_block + curl = dependency('libcurl', version: '>=7.29.0', + method: 'pkg-config', + required: get_option('curl'), + static: enable_static) endif libudev = not_found if targetos == 'linux' and (have_system or have_tools) libudev = dependency('libudev', + method: 'pkg-config', required: get_option('libudev'), static: enable_static) endif @@ -485,21 +553,26 @@ if have_system and not get_option('curses').disabled() return 0; }''' - curses = dependency((targetos == 'windows' ? 'ncurses' : 'ncursesw'), - required: false, - method: 'pkg-config', - static: enable_static) + curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw'] + foreach curses_dep : curses_dep_list + if not curses.found() + curses = dependency(curses_dep, + required: false, + method: 'pkg-config', + static: enable_static) + endif + endforeach msg = get_option('curses').enabled() ? 'curses library not found' : '' + curses_compile_args = ['-DNCURSES_WIDECHAR'] if curses.found() - if cc.links(curses_test, dependencies: [curses]) - curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses]) + if cc.links(curses_test, args: curses_compile_args, dependencies: [curses]) + curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses]) else msg = 'curses package not usable' curses = not_found endif endif if not curses.found() - curses_compile_args = ['-DNCURSES_WIDECHAR'] has_curses_h = cc.has_header('curses.h', args: curses_compile_args) if targetos != 'windows' and not has_curses_h message('Trying with /usr/include/ncursesw') @@ -559,12 +632,25 @@ if have_system and not get_option('curses').disabled() endif brlapi = not_found -if 'CONFIG_BRLAPI' in config_host - brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split()) +if not get_option('brlapi').auto() or have_system + brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'], + required: get_option('brlapi'), + static: enable_static) + if brlapi.found() and not cc.links(''' + #include + #include + int main(void) { return brlapi__openConnection (NULL, NULL, NULL); }''', dependencies: brlapi) + brlapi = not_found + if get_option('brlapi').enabled() + error('could not link brlapi') + else + warning('could not link brlapi, disabling') + endif + endif endif sdl = not_found -if have_system +if not get_option('sdl').auto() or (have_system and not cocoa.found()) sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) sdl_image = not_found endif @@ -583,13 +669,59 @@ else endif rbd = not_found -if 'CONFIG_RBD' in config_host - rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split()) +if not get_option('rbd').auto() or have_block + librados = cc.find_library('rados', required: get_option('rbd'), + static: enable_static) + librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'], + required: get_option('rbd'), + static: enable_static) + if librados.found() and librbd.found() and cc.links(''' + #include + #include + int main(void) { + rados_t cluster; + rados_create(&cluster, NULL); + return 0; + }''', dependencies: [librbd, librados]) + rbd = declare_dependency(dependencies: [librbd, librados]) + endif endif + glusterfs = not_found -if 'CONFIG_GLUSTERFS' in config_host - glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(), - link_args: config_host['GLUSTERFS_LIBS'].split()) +glusterfs_ftruncate_has_stat = false +glusterfs_iocb_has_stat = false +if not get_option('glusterfs').auto() or have_block + glusterfs = dependency('glusterfs-api', version: '>=3', + required: get_option('glusterfs'), + method: 'pkg-config', static: enable_static) + if glusterfs.found() + glusterfs_ftruncate_has_stat = cc.links(''' + #include + + int + main(void) + { + /* new glfs_ftruncate() passes two additional args */ + return glfs_ftruncate(NULL, 0, NULL, NULL); + } + ''', dependencies: glusterfs) + glusterfs_iocb_has_stat = cc.links(''' + #include + + /* new glfs_io_cbk() passes two additional glfs_stat structs */ + static void + glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) + {} + + int + main(void) + { + glfs_io_cbk iocb = &glusterfs_iocb; + iocb(NULL, 0 , NULL, NULL, NULL); + return 0; + } + ''', dependencies: glusterfs) + endif endif libssh = not_found if 'CONFIG_LIBSSH' in config_host @@ -597,13 +729,39 @@ if 'CONFIG_LIBSSH' in config_host link_args: config_host['LIBSSH_LIBS'].split()) endif libbzip2 = not_found -if 'CONFIG_BZIP2' in config_host - libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split()) +if not get_option('bzip2').auto() or have_block + libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'], + required: get_option('bzip2'), + static: enable_static) + if libbzip2.found() and not cc.links(''' + #include + int main(void) { BZ2_bzlibVersion(); return 0; }''', dependencies: libbzip2) + libbzip2 = not_found + if get_option('bzip2').enabled() + error('could not link libbzip2') + else + warning('could not link libbzip2, disabling') + endif + endif endif + liblzfse = not_found -if 'CONFIG_LZFSE' in config_host - liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split()) +if not get_option('lzfse').auto() or have_block + liblzfse = cc.find_library('lzfse', has_headers: ['lzfse.h'], + required: get_option('lzfse'), + static: enable_static) +endif +if liblzfse.found() and not cc.links(''' + #include + int main(void) { lzfse_decode_scratch_size(); return 0; }''', dependencies: liblzfse) + liblzfse = not_found + if get_option('lzfse').enabled() + error('could not link liblzfse') + else + warning('could not link liblzfse, disabling') + endif endif + oss = not_found if 'CONFIG_AUDIO_OSS' in config_host oss = declare_dependency(link_args: config_host['OSS_LIBS'].split()) @@ -621,20 +779,32 @@ if 'CONFIG_OPENGL' in config_host opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), link_args: config_host['OPENGL_LIBS'].split()) endif + gtk = not_found -if 'CONFIG_GTK' in config_host - gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), - link_args: config_host['GTK_LIBS'].split()) +gtkx11 = not_found +if not get_option('gtk').auto() or (have_system and not cocoa.found()) + gtk = dependency('gtk+-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: get_option('gtk'), + static: enable_static) + if gtk.found() + gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: false, + static: enable_static) + gtk = declare_dependency(dependencies: [gtk, gtkx11]) + endif endif + vte = not_found if 'CONFIG_VTE' in config_host vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), link_args: config_host['VTE_LIBS'].split()) endif x11 = not_found -if 'CONFIG_X11' in config_host - x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), - link_args: config_host['X11_LIBS'].split()) +if gtkx11.found() or 'lm32-softmmu' in target_dirs + x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(), + static: enable_static) endif vnc = not_found png = not_found @@ -644,9 +814,8 @@ if get_option('vnc').enabled() vnc = declare_dependency() # dummy dependency png = dependency('libpng', required: get_option('vnc_png'), method: 'pkg-config', static: enable_static) - jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'], - required: get_option('vnc_jpeg'), - static: enable_static) + jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'), + method: 'pkg-config', static: enable_static) sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], required: get_option('vnc_sasl'), static: enable_static) @@ -655,14 +824,41 @@ if get_option('vnc').enabled() compile_args: '-DSTRUCT_IOVEC_DEFINED') endif endif + snappy = not_found -if 'CONFIG_SNAPPY' in config_host - snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split()) +if not get_option('snappy').auto() or have_system + snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'], + required: get_option('snappy'), + static: enable_static) +endif +if snappy.found() and not cc.links(''' + #include + int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy) + snappy = not_found + if get_option('snappy').enabled() + error('could not link libsnappy') + else + warning('could not link libsnappy, disabling') + endif endif + lzo = not_found -if 'CONFIG_LZO' in config_host - lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split()) +if not get_option('lzo').auto() or have_system + lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'], + required: get_option('lzo'), + static: enable_static) +endif +if lzo.found() and not cc.links(''' + #include + int main(void) { lzo_version(); return 0; }''', dependencies: lzo) + lzo = not_found + if get_option('lzo').enabled() + error('could not link liblzo2') + else + warning('could not link liblzo2, disabling') + endif endif + rdma = not_found if 'CONFIG_RDMA' in config_host rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split()) @@ -751,10 +947,105 @@ statx_test = ''' has_statx = cc.links(statx_test) +have_vhost_user_blk_server = (targetos == 'linux' and + 'CONFIG_VHOST_USER' in config_host) + +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 + + +if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() + error('Cannot enable fuse-lseek while fuse is disabled') +endif + +fuse = dependency('fuse3', required: get_option('fuse'), + version: '>=3.1', method: 'pkg-config', + static: enable_static) + +fuse_lseek = not_found +if not get_option('fuse_lseek').disabled() + if fuse.version().version_compare('>=3.8') + # Dummy dependency + fuse_lseek = declare_dependency() + elif get_option('fuse_lseek').enabled() + if fuse.found() + error('fuse-lseek requires libfuse >=3.8, found ' + fuse.version()) + else + error('fuse-lseek requires libfuse, which was not found') + endif + endif +endif + +if get_option('cfi') + cfi_flags=[] + # Check for dependency on LTO + if not get_option('b_lto') + error('Selected Control-Flow Integrity but LTO is disabled') + endif + if config_host.has_key('CONFIG_MODULES') + error('Selected Control-Flow Integrity is not compatible with modules') + endif + # Check for cfi flags. CFI requires LTO so we can't use + # get_supported_arguments, but need a more complex "compiles" which allows + # custom arguments + if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall', + args: ['-flto', '-fsanitize=cfi-icall'] ) + cfi_flags += '-fsanitize=cfi-icall' + else + error('-fsanitize=cfi-icall is not supported by the compiler') + endif + if cc.compiles('int main () { return 0; }', + name: '-fsanitize-cfi-icall-generalize-pointers', + args: ['-flto', '-fsanitize=cfi-icall', + '-fsanitize-cfi-icall-generalize-pointers'] ) + cfi_flags += '-fsanitize-cfi-icall-generalize-pointers' + else + error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler') + endif + if get_option('cfi_debug') + if cc.compiles('int main () { return 0; }', + name: '-fno-sanitize-trap=cfi-icall', + args: ['-flto', '-fsanitize=cfi-icall', + '-fno-sanitize-trap=cfi-icall'] ) + cfi_flags += '-fno-sanitize-trap=cfi-icall' + else + error('-fno-sanitize-trap=cfi-icall is not supported by the compiler') + endif + endif + add_project_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) + add_project_link_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) +endif + ################# # config-host.h # ################# +have_virtfs = (targetos == 'linux' and + have_system and + libattr.found() and + libcap_ng.found()) + +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 + 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) @@ -768,27 +1059,62 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') / 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('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_LIBUDEV', libudev.found()) +config_host_data.set('CONFIG_LZO', lzo.found()) config_host_data.set('CONFIG_MPATH', mpathpersist.found()) config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) +config_host_data.set('CONFIG_CURL', curl.found()) config_host_data.set('CONFIG_CURSES', curses.found()) +config_host_data.set('CONFIG_GLUSTERFS', glusterfs.found()) +if glusterfs.found() + config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT', glusterfs.version().version_compare('>=4')) + config_host_data.set('CONFIG_GLUSTERFS_DISCARD', glusterfs.version().version_compare('>=5')) + config_host_data.set('CONFIG_GLUSTERFS_FALLOCATE', glusterfs.version().version_compare('>=6')) + config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL', glusterfs.version().version_compare('>=6')) + config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat) + config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat) +endif +config_host_data.set('CONFIG_GTK', gtk.found()) +config_host_data.set('CONFIG_LIBATTR', have_old_libattr) +config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) +config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) +config_host_data.set('CONFIG_LIBNFS', libnfs.found()) +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_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_VNC_PNG', png.found()) config_host_data.set('CONFIG_VNC_SASL', sasl.found()) +config_host_data.set('CONFIG_VIRTFS', have_virtfs) config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) config_host_data.set('CONFIG_GETTID', has_gettid) config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) config_host_data.set('CONFIG_STATX', has_statx) +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_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_MAJOR', meson.project_version().split('.')[0]) 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('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) +config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) +config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) +config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) +config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) +config_host_data.set('HAVE_SYS_SIGNAL_H', cc.has_header('sys/signal.h')) + ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] strings = ['HOST_DSOSUF', 'CONFIG_IASL'] @@ -857,21 +1183,19 @@ if link_language == 'cpp' } endif -kconfig_external_symbols = [ - 'CONFIG_KVM', - 'CONFIG_XEN', - 'CONFIG_TPM', - 'CONFIG_SPICE', - 'CONFIG_IVSHMEM', - 'CONFIG_OPENGL', - 'CONFIG_X11', - 'CONFIG_VHOST_USER', - 'CONFIG_VHOST_VDPA', - 'CONFIG_VHOST_KERNEL', - 'CONFIG_VIRTFS', - 'CONFIG_LINUX', - 'CONFIG_PVRDMA', -] +host_kconfig = \ + ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ + ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ + ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \ + ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ + (x11.found() ? ['CONFIG_X11=y'] : []) + \ + ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \ + ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \ + ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \ + (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \ + ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \ + ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host @@ -906,7 +1230,7 @@ foreach target : target_dirs } endif - have_accel = false + accel_kconfig = [] foreach sym: accelerators if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) config_target += { sym: 'y' } @@ -914,10 +1238,10 @@ foreach target : target_dirs if sym == 'CONFIG_XEN' and have_xen_pci_passthrough config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } endif - have_accel = true + accel_kconfig += [ sym + '=y' ] endif endforeach - if not have_accel + if accel_kconfig.length() == 0 if default_targets continue endif @@ -971,22 +1295,16 @@ foreach target : target_dirs configuration: config_target_data)} if target.endswith('-softmmu') - base_kconfig = [] - foreach sym : kconfig_external_symbols - if sym in config_target or sym in config_host - base_kconfig += '@0@=y'.format(sym) - endif - endforeach - config_devices_mak = target + '-config-devices.mak' config_devices_mak = configure_file( input: ['default-configs/devices' / target + '.mak', 'Kconfig'], output: config_devices_mak, depfile: config_devices_mak + '.d', capture: true, - command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], + command: [minikconf, + get_option('default_devices') ? '--defconfig' : '--allnoconfig', config_devices_mak, '@DEPFILE@', '@INPUT@', - base_kconfig]) + host_kconfig, accel_kconfig]) config_devices_data = configuration_data() config_devices = keyval.load(config_devices_mak) @@ -1408,6 +1726,7 @@ if have_system 'hw/misc', 'hw/misc/macio', 'hw/net', + 'hw/net/can', 'hw/nvram', 'hw/pci', 'hw/pci-host', @@ -1442,6 +1761,7 @@ trace_events_subdirs += [ 'target/arm', 'target/hppa', 'target/i386', + 'target/i386/kvm', 'target/mips', 'target/ppc', 'target/riscv', @@ -1452,7 +1772,8 @@ trace_events_subdirs += [ vhost_user = not_found if 'CONFIG_VHOST_USER' in config_host - subdir('contrib/libvhost-user') + libvhost_user = subproject('libvhost-user') + vhost_user = libvhost_user.get_variable('vhost_user_dep') endif subdir('qapi') @@ -1510,7 +1831,7 @@ blockdev_ss.add(files( 'blockdev-nbd.c', 'iothread.c', 'job-qmp.c', -)) +), gnutls) # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, # os-win32.c does not @@ -1666,6 +1987,7 @@ qmp = declare_dependency(link_whole: [libqmp]) libchardev = static_library('chardev', chardev_ss.sources() + genh, name_suffix: 'fa', + dependencies: [gnutls], build_by_default: false) chardev = declare_dependency(link_whole: libchardev) @@ -1743,6 +2065,7 @@ foreach target : target_dirs target_inc += include_directories('linux-user/host/' / config_host['ARCH']) else base_dir = 'bsd-user' + target_inc += include_directories('bsd-user/freebsd') endif target_inc += include_directories( base_dir, @@ -1844,7 +2167,6 @@ foreach target : target_dirs custom_target(exe['name'] + stp['ext'], input: trace_events_all, output: exe['name'] + stp['ext'], - capture: true, install: stp['install'], install_dir: get_option('datadir') / 'systemtap/tapset', command: [ @@ -1853,7 +2175,7 @@ foreach target : target_dirs '--target-name=' + target_name, '--target-type=' + target_type, '--probe-prefix=qemu.' + target_type + '.' + target_name, - '@INPUT@', + '@INPUT@', '@OUTPUT@' ]) endforeach endif @@ -1884,7 +2206,7 @@ if have_tools qemu_io = executable('qemu-io', files('qemu-io.c'), dependencies: [block, qemuutil], install: true) qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), - dependencies: [blockdev, qemuutil], install: true) + dependencies: [blockdev, qemuutil, gnutls], install: true) subdir('storage-daemon') subdir('contrib/rdmacm-mux') @@ -1924,7 +2246,7 @@ subdir('tools') subdir('pc-bios') subdir('docs') subdir('tests') -if 'CONFIG_GTK' in config_host +if gtk.found() subdir('po') endif @@ -1934,14 +2256,14 @@ if host_machine.system() == 'windows' '@OUTPUT@', get_option('prefix'), meson.current_source_dir(), - host_machine.cpu_family(), + host_machine.cpu(), '--', '-DDISPLAYVERSION=' + meson.project_version(), ] if build_docs nsis_cmd += '-DCONFIG_DOCUMENTATION=y' endif - if 'CONFIG_GTK' in config_host + if gtk.found() nsis_cmd += '-DCONFIG_GTK=y' endif @@ -2023,16 +2345,16 @@ summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} summary_info += {'sparse enabled': sparse.found()} summary_info += {'strip binaries': get_option('strip')} summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} +summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} if targetos == 'darwin' - summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')} + summary_info += {'Cocoa support': cocoa.found()} endif # TODO: add back version summary_info += {'SDL support': sdl.found()} summary_info += {'SDL image support': sdl_image.found()} # TODO: add back version -summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} -summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} +summary_info += {'GTK support': gtk.found()} summary_info += {'pixman': pixman.found()} # TODO: add back version summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} @@ -2055,12 +2377,12 @@ summary_info += {'iconv support': iconv.found()} summary_info += {'curses support': curses.found()} # TODO: add back version summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')} -summary_info += {'curl support': config_host.has_key('CONFIG_CURL')} +summary_info += {'curl support': curl.found()} summary_info += {'mingw32 support': targetos == 'windows'} summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']} summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} -summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')} +summary_info += {'VirtFS support': have_virtfs} summary_info += {'build virtiofs daemon': have_virtiofsd} summary_info += {'Multipath support': mpathpersist.found()} summary_info += {'VNC support': vnc.found()} @@ -2073,14 +2395,14 @@ summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} if config_host.has_key('CONFIG_XEN_BACKEND') summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} endif -summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')} +summary_info += {'brlapi support': brlapi.found()} summary_info += {'Documentation': build_docs} summary_info += {'PIE': get_option('b_pie')} 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 += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')} -summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} +summary_info += {'ATTR/XATTR support': libattr.found()} summary_info += {'Install blobs': get_option('install_blobs')} summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} @@ -2101,12 +2423,14 @@ summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')} -summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')} +summary_info += {'libcap-ng support': libcap_ng.found()} +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-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')} summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')} -summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')} +summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')} +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 += {'Trace backends': config_host['TRACE_BACKENDS']} @@ -2115,7 +2439,7 @@ if config_host['TRACE_BACKENDS'].split().contains('simple') endif # TODO: add back protocol and server version summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} -summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')} +summary_info += {'rbd support': rbd.found()} summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} summary_info += {'U2F support': u2f.found()} @@ -2123,8 +2447,8 @@ summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')} summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')} -summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')} -summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')} +summary_info += {'libiscsi support': libiscsi.found()} +summary_info += {'libnfs support': libnfs.found()} summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')} if targetos == 'windows' if 'WIN_SDK' in config_host @@ -2134,23 +2458,25 @@ if targetos == 'windows' summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')} endif -summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')} +summary_info += {'seccomp support': seccomp.found()} +summary_info += {'CFI support': get_option('cfi')} +summary_info += {'CFI debug support': get_option('cfi_debug')} summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'} 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 += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} -summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')} +summary_info += {'GlusterFS support': glusterfs.found()} summary_info += {'gcov': get_option('b_coverage')} summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')} summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')} summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')} summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} -summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')} -summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')} -summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')} -summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')} -summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')} +summary_info += {'lzo support': lzo.found()} +summary_info += {'snappy support': snappy.found()} +summary_info += {'bzip2 support': libbzip2.found()} +summary_info += {'lzfse support': liblzfse.found()} +summary_info += {'zstd support': zstd.found()} summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')} summary_info += {'memory allocator': get_option('malloc')} @@ -2170,7 +2496,7 @@ summary_info += {'capstone': capstone_opt == 'disabled' ? false : capst summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')} summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')} summary_info += {'libudev': libudev.found()} -summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'} +summary_info += {'default devices': get_option('default_devices')} summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')} summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')} if config_host.has_key('HAVE_GDB_BIN') @@ -2179,6 +2505,8 @@ endif summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} +summary_info += {'FUSE exports': fuse.found()} +summary_info += {'FUSE lseek': fuse_lseek.found()} summary(summary_info, bool_yn: true) if not supported_cpus.contains(cpu)