From 20cf5cb487021dd1bec1eec326af138a8b15d987 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 15 Oct 2021 16:47:43 +0200 Subject: configure, meson: move guest-agent, tools to meson Signed-off-by: Paolo Bonzini --- configure | 48 +++----------------------------------- contrib/vhost-user-gpu/meson.build | 2 +- docs/meson.build | 2 -- meson.build | 48 +++++++++++++++++++++----------------- meson_options.txt | 4 ++++ qga/meson.build | 7 ++++++ scripts/meson-buildoptions.sh | 6 +++++ tests/Makefile.include | 2 +- tests/unit/meson.build | 4 +--- 9 files changed, 49 insertions(+), 74 deletions(-) diff --git a/configure b/configure index 9230ebd4a8..a66e2c0d71 100755 --- a/configure +++ b/configure @@ -317,10 +317,8 @@ pie="" trace_backends="log" trace_file="trace" opengl="$default_feature" -guest_agent="$default_feature" vss_win32_sdk="$default_feature" win_sdk="no" -want_tools="$default_feature" coroutine="" tls_priority="NORMAL" plugins="$default_feature" @@ -960,10 +958,6 @@ for opt do ;; --disable-zlib-test) ;; - --enable-guest-agent) guest_agent="yes" - ;; - --disable-guest-agent) guest_agent="no" - ;; --with-vss-sdk) vss_win32_sdk="" ;; --with-vss-sdk=*) vss_win32_sdk="$optarg" @@ -976,10 +970,6 @@ for opt do ;; --without-win-sdk) win_sdk="no" ;; - --enable-tools) want_tools="yes" - ;; - --disable-tools) want_tools="no" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -1256,7 +1246,6 @@ cat << EOF user supported user emulation targets linux-user all linux usermode emulation targets bsd-user all BSD usermode emulation targets - guest-agent build the QEMU Guest Agent pie Position Independent Executables modules modules support (non-Windows) module-upgrades try to load modules from alternate paths for upgrades @@ -1275,7 +1264,6 @@ cat << EOF vhost-user vhost-user backend support vhost-vdpa vhost-vdpa kernel backend support opengl opengl support - tools build qemu-io, qemu-nbd and qemu-img tools gio libgio support NOTE: The object files are built at the place where configure is launched @@ -1678,16 +1666,6 @@ else exit 1 fi -########################################## -# system tools -if test -z "$want_tools"; then - if test "$softmmu" = "no"; then - want_tools=no - else - want_tools=yes - fi -fi - ######################################### # vhost interdependencies and host support @@ -2344,7 +2322,7 @@ fi # check if we have VSS SDK headers for win guest_agent_with_vss="no" -if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ +if test "$mingw32" = "yes" && \ test "$vss_win32_sdk" != "no" ; then case "$vss_win32_sdk" in "") vss_win32_include="-isystem $source_path" ;; @@ -2381,7 +2359,7 @@ fi # VSS provider from the source. It is usually unnecessary because the # pre-compiled .tlb file is included. -if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ +if test "$mingw32" = "yes" && \ test "$guest_agent_with_vss" = "yes" ; then if test -z "$win_sdk"; then programfiles="$PROGRAMFILES" @@ -2399,7 +2377,7 @@ fi ########################################## # check if mingw environment provides a recent ntddscsi.h guest_agent_ntddscsi="no" -if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then +if test "$mingw32" = "yes"; then cat > $TMPC << EOF #include #include @@ -2825,20 +2803,6 @@ if test "$mingw32" = "yes" ; then done fi -# Probe for guest agent support/options - -if [ "$guest_agent" != "no" ]; then - if [ "$softmmu" = no -a "$want_tools" = no ] ; then - guest_agent=no - elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then - guest_agent=yes - elif [ "$guest_agent" != yes ]; then - guest_agent=no - else - error_exit "Guest agent is not supported on this platform" - fi -fi - # Guest agent Windows MSI package if test "$QEMU_GA_MANUFACTURER" = ""; then @@ -2968,12 +2932,6 @@ fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak fi -if test "$want_tools" = "yes" ; then - echo "CONFIG_TOOLS=y" >> $config_host_mak -fi -if test "$guest_agent" = "yes" ; then - echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak -fi echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak qemu_version=$(head $source_path/VERSION) diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build index 92c8f3a86a..b4e26045da 100644 --- a/contrib/vhost-user-gpu/meson.build +++ b/contrib/vhost-user-gpu/meson.build @@ -1,4 +1,4 @@ -if 'CONFIG_TOOLS' in config_host and virgl.found() and gbm.found() \ +if have_tools and virgl.found() and gbm.found() \ and 'CONFIG_LINUX' in config_host and pixman.found() executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'), dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl], diff --git a/docs/meson.build b/docs/meson.build index 57b28a3146..831d4aea2b 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -37,8 +37,6 @@ endif if build_docs SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']] - have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT') - man_pages = { 'qemu-ga.8': (have_ga ? 'man8' : ''), 'qemu-ga-ref.7': (have_ga ? 'man7' : ''), diff --git a/meson.build b/meson.build index 7b3cfb6316..b9bedf928a 100644 --- a/meson.build +++ b/meson.build @@ -44,6 +44,20 @@ 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_bsd_user = false @@ -54,24 +68,18 @@ foreach target : target_dirs 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' @@ -3214,11 +3222,7 @@ if 'CONFIG_PLUGIN' in config_host 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 @@ -3341,7 +3345,7 @@ if config_host.has_key('HAVE_GDB_BIN') summary_info += {'gdb': config_host['HAVE_GDB_BIN']} 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 have_system @@ -3379,7 +3383,7 @@ 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 += {'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 @@ -3589,7 +3593,7 @@ summary_info += {'GBM': gbm} summary_info += {'libiscsi support': libiscsi} summary_info += {'libnfs support': libnfs} if targetos == 'windows' - if config_host.has_key('CONFIG_GUEST_AGENT') + if have_ga 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')} endif diff --git a/meson_options.txt b/meson_options.txt index 368b2cf783..be7778b3a2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -36,8 +36,12 @@ option('install_blobs', type : 'boolean', value : true, description: 'install provided firmware blobs') option('sparse', type : 'feature', value : 'auto', description: 'sparse checker') +option('guest_agent', type : 'feature', value : 'auto', + description: 'Build QEMU Guest Agent') option('guest_agent_msi', type : 'feature', value : 'auto', description: 'Build MSI package for the QEMU Guest Agent') +option('tools', type : 'feature', value : 'auto', + description: 'build support utilities that come with QEMU') option('malloc_trim', type : 'feature', value : 'auto', description: 'enable libc malloc_trim() for memory optimization') diff --git a/qga/meson.build b/qga/meson.build index 56fb6539e5..97cc391fe1 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -1,3 +1,10 @@ +if not have_ga + if get_option('guest_agent_msi').enabled() + error('Guest agent MSI requested, but the guest agent is not being built') + endif + subdir_done() +endif + all_qga = [] qga_qapi_outputs = [ diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index fb8812693c..4edc611273 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -62,6 +62,7 @@ meson_options_help() { printf "%s\n" ' glusterfs Glusterfs block device driver' printf "%s\n" ' gnutls GNUTLS cryptography support' printf "%s\n" ' gtk GTK+ user interface' + printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' printf "%s\n" ' hax HAX acceleration support' printf "%s\n" ' hvf HVF acceleration support' @@ -108,6 +109,7 @@ meson_options_help() { printf "%s\n" ' spice Spice server support' printf "%s\n" ' spice-protocol Spice protocol support' printf "%s\n" ' tcg TCG support' + printf "%s\n" ' tools build support utilities that come with QEMU' printf "%s\n" ' tpm TPM support' printf "%s\n" ' u2f U2F emulation support' printf "%s\n" ' usb-redir libusbredir support' @@ -209,6 +211,8 @@ _meson_option_parse() { --disable-gprof) printf "%s" -Dgprof=false ;; --enable-gtk) printf "%s" -Dgtk=enabled ;; --disable-gtk) printf "%s" -Dgtk=disabled ;; + --enable-guest-agent) printf "%s" -Dguest_agent=enabled ;; + --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;; --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;; --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;; --enable-hax) printf "%s" -Dhax=enabled ;; @@ -315,6 +319,8 @@ _meson_option_parse() { --disable-tcg) printf "%s" -Dtcg=disabled ;; --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;; --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;; + --enable-tools) printf "%s" -Dtools=enabled ;; + --disable-tools) printf "%s" -Dtools=disabled ;; --enable-tpm) printf "%s" -Dtpm=enabled ;; --disable-tpm) printf "%s" -Dtpm=disabled ;; --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;; diff --git a/tests/Makefile.include b/tests/Makefile.include index 646c8b1334..e7153c8e91 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -150,7 +150,7 @@ check-acceptance: check-acceptance-deprecated-warning | check-avocado .PHONY: check-block check check-clean get-vm-images check: -ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy) +ifneq ($(.check-block.deps),) check: check-block check-block: run-ninja $(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \ diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 0959061faf..3a51759ebc 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -149,9 +149,7 @@ if have_system endif endif -if 'CONFIG_TSAN' not in config_host and \ - 'CONFIG_GUEST_AGENT' in config_host and \ - 'CONFIG_LINUX' in config_host +if have_ga and targetos == 'linux' and 'CONFIG_TSAN' not in config_host tests += {'test-qga': ['../qtest/libqtest.c']} test_deps += {'test-qga': qga} endif -- cgit v1.2.3-55-g7522