configure, meson: replace VSS SDK checks and options with --enable-vss-sdk

The VSS headers are part of standard MS VS SDK, at least since version
15, and probably before that.

They are also included with MinGW, although currently broken.

Let's streamline a bit the options, by not making it so special, and
instead rely on proper system headers configuration or user
--extra-cxxflags. This still requires some extra step to cross-build
with MinGW as described in the meson.build file now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Use a "feature"-type option. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-02-01 16:53:43 +04:00 committed by Paolo Bonzini
parent 61fb0bd1f6
commit 8821a389b1
5 changed files with 33 additions and 50 deletions

47
configure vendored
View File

@ -317,7 +317,6 @@ pie=""
trace_backends="log"
trace_file="trace"
opengl="$default_feature"
vss_win32_sdk="$default_feature"
coroutine=""
tls_priority="NORMAL"
plugins="$default_feature"
@ -957,12 +956,6 @@ for opt do
;;
--disable-zlib-test)
;;
--with-vss-sdk) vss_win32_sdk=""
;;
--with-vss-sdk=*) vss_win32_sdk="$optarg"
;;
--without-vss-sdk) vss_win32_sdk="no"
;;
--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
;;
@ -1225,8 +1218,6 @@ Advanced options (experts only):
--with-coroutine=BACKEND coroutine backend. Supported options:
ucontext, sigaltstack, windows
--enable-gcov enable test coverage analysis with gcov
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
--tls-priority default TLS protocol/cipher priority string
--enable-plugins
enable plugins via shared library loading
@ -2311,41 +2302,6 @@ EOF
fi
fi
##########################################
# check if we have VSS SDK headers for win
guest_agent_with_vss="no"
if test "$mingw32" = "yes" && \
test "$vss_win32_sdk" != "no" ; then
case "$vss_win32_sdk" in
"") vss_win32_include="-isystem $source_path" ;;
*\ *) # The SDK is installed in "Program Files" by default, but we cannot
# handle path with spaces. So we symlink the headers into ".sdk/vss".
vss_win32_include="-isystem $source_path/.sdk/vss"
symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
;;
*) vss_win32_include="-isystem $vss_win32_sdk"
esac
cat > $TMPC << EOF
#define __MIDL_user_allocate_free_DEFINED__
#include <inc/win2003/vss.h>
int main(void) { return VSS_CTX_BACKUP; }
EOF
if compile_prog "$vss_win32_include" "" ; then
guest_agent_with_vss="yes"
QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
else
if test "$vss_win32_sdk" != "" ; then
echo "ERROR: Please download and install Microsoft VSS SDK:"
echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
echo "ERROR: The headers are extracted in the directory \`inc'."
feature_not_found "VSS support"
fi
fi
fi
##########################################
# check if mingw environment provides a recent ntddscsi.h
guest_agent_ntddscsi="no"
@ -2875,9 +2831,6 @@ if test "$debug_tcg" = "yes" ; then
fi
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=y" >> $config_host_mak
if test "$guest_agent_with_vss" = "yes" ; then
echo "CONFIG_QGA_VSS=y" >> $config_host_mak
fi
if test "$guest_agent_ntddscsi" = "yes" ; then
echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
fi

View File

@ -1926,6 +1926,14 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
return -1;
}'''))
have_vss = false
if targetos == 'windows' and link_language == 'cpp'
have_vss = cxx.compiles('''
#define __MIDL_user_allocate_free_DEFINED__
#include <inc/win2003/vss.h>
int main(void) { return VSS_CTX_BACKUP; }''')
endif
ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
@ -3592,7 +3600,7 @@ summary_info += {'libiscsi support': libiscsi}
summary_info += {'libnfs support': libnfs}
if targetos == 'windows'
if have_ga
summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
summary_info += {'QGA VSS support': have_qga_vss}
summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
endif
endif

View File

@ -42,6 +42,8 @@ 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('qga_vss', type : 'feature', value: 'auto',
description: 'build QGA VSS support (broken with MinGW)')
option('malloc_trim', type : 'feature', value : 'auto',
description: 'enable libc malloc_trim() for memory optimization')

View File

@ -2,9 +2,26 @@ 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
have_qga_vss = false
subdir_done()
endif
have_qga_vss = get_option('qga_vss') \
.require(targetos == 'windows',
error_message: 'VSS support requires Windows') \
.require(link_language == 'cpp',
error_message: 'VSS support requires a C++ compiler') \
.require(have_vss, error_message: '''VSS support requires VSS headers.
If your Visual Studio installation doesn't have the VSS headers,
Please download and install Microsoft VSS SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=23490
On POSIX-systems, MinGW doesn't yet provide working headers.
you can extract the SDK headers by:
$ scripts/extract-vsssdk-headers setup.exe
The headers are extracted in the directory 'inc/win2003'.
Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \
.allowed()
all_qga = []
qga_qapi_outputs = [
@ -63,7 +80,7 @@ gen_tlb = []
qga_libs = []
if targetos == 'windows'
qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32']
if 'CONFIG_QGA_VSS' in config_host
if have_qga_vss
qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup']
subdir('vss-win32')
endif
@ -93,7 +110,7 @@ if targetos == 'windows'
if wixl.found()
deps = [gen_tlb, qga]
qemu_ga_msi_vss = []
if 'CONFIG_QGA_VSS' in config_host
if have_qga_vss
qemu_ga_msi_vss = ['-D', 'InstallVss']
deps += qga_vss
endif

View File

@ -20,6 +20,7 @@ meson_options_help() {
printf "%s\n" ' --enable-malloc=CHOICE choose memory allocator to use [system] (choices:'
printf "%s\n" ' jemalloc/system/tcmalloc)'
printf "%s\n" ' --enable-profiler profiler support'
printf "%s\n" ' --enable-qga-vss build QGA VSS support'
printf "%s\n" ' --enable-qom-cast-debug cast debugging support'
printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and'
printf "%s\n" ' getrandom()'
@ -282,6 +283,8 @@ _meson_option_parse() {
--disable-qcow1) printf "%s" -Dqcow1=disabled ;;
--enable-qed) printf "%s" -Dqed=enabled ;;
--disable-qed) printf "%s" -Dqed=disabled ;;
--enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
--disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
--enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
--disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
--enable-rbd) printf "%s" -Drbd=enabled ;;