configure: rewrite accelerator defaults as tests

Prepare to process "auto" in meson rather than configure: standardize the
shape of the code that changes "auto" to enabled/disabled, to ease the review
when it will be moved to meson.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-09-18 05:22:37 -04:00
parent 1badb709cf
commit 3bd40ec7ae
1 changed files with 38 additions and 20 deletions

58
configure vendored
View File

@ -428,10 +428,10 @@ vhost_scsi=""
vhost_vsock="" vhost_vsock=""
vhost_user="" vhost_user=""
vhost_user_fs="" vhost_user_fs=""
kvm="disabled" kvm="auto"
hax="disabled" hax="auto"
hvf="disabled" hvf="auto"
whpx="disabled" whpx="auto"
rdma="" rdma=""
pvrdma="" pvrdma=""
gprof="no" gprof="no"
@ -817,8 +817,6 @@ HOST_VARIANT_DIR=""
case $targetos in case $targetos in
MINGW32*) MINGW32*)
mingw32="yes" mingw32="yes"
hax="enabled"
whpx="auto"
vhost_user="no" vhost_user="no"
audio_possible_drivers="dsound sdl" audio_possible_drivers="dsound sdl"
if check_include dsound.h; then if check_include dsound.h; then
@ -852,7 +850,6 @@ DragonFly)
;; ;;
NetBSD) NetBSD)
bsd="yes" bsd="yes"
hax="enabled"
make="${MAKE-gmake}" make="${MAKE-gmake}"
audio_drv_list="oss try-sdl" audio_drv_list="oss try-sdl"
audio_possible_drivers="oss sdl" audio_possible_drivers="oss sdl"
@ -869,8 +866,6 @@ OpenBSD)
Darwin) Darwin)
bsd="yes" bsd="yes"
darwin="yes" darwin="yes"
hax="enabled"
hvf="auto"
if [ "$cpu" = "x86_64" ] ; then if [ "$cpu" = "x86_64" ] ; then
QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
@ -906,7 +901,6 @@ Linux)
audio_possible_drivers="oss alsa sdl pa" audio_possible_drivers="oss alsa sdl pa"
linux="yes" linux="yes"
linux_user="yes" linux_user="yes"
kvm="enabled"
QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES" QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES"
;; ;;
esac esac
@ -2665,6 +2659,29 @@ if test "$seccomp" != "no" ; then
seccomp="no" seccomp="no"
fi fi
fi fi
##########################################
# simple accelerator probes
if test "$kvm" != "disabled" ; then
if test "$linux" = yes ; then
kvm=enabled
else
if test "$kvm" = "enabled" ; then
feature_not_found "kvm" "KVM is only available on Linux"
fi
kvm=disabled
fi
fi
if test "$hax" = "auto" ; then
if test "$mingw" = yes || test "$darwin" = yes || test "$targetos" = NetBSD; then
hax=enabled
else
hax=disabled
fi
fi
########################################## ##########################################
# xen probe # xen probe
@ -2985,14 +3002,15 @@ fi
########################################## ##########################################
# Windows Hypervisor Platform accelerator (WHPX) check # Windows Hypervisor Platform accelerator (WHPX) check
if test "$whpx" = "enabled" && test "$ARCH" != "x86_64"; then if test "$whpx" != "disabled"; then
error_exit "WHPX requires 64-bit host" if test "$mingw32" = yes && test "$ARCH" = "x86_64" &&
fi check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
if test "$whpx" != "disabled" && test "$ARCH" = "x86_64"; then whpx="enabled"
if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
whpx="yes"
else else
if test "$whpx" = "auto"; then if test "$whpx" = "enabled"; then
if test "$ARCH" != "x86_64"; then
error_exit "WHPX requires 64-bit host"
fi
feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
fi fi
whpx="disabled" whpx="disabled"
@ -5828,13 +5846,13 @@ if [ "$hvf" != "disabled" ] ; then
#include <Hypervisor/hv.h> #include <Hypervisor/hv.h>
int main() { return 0;} int main() { return 0;}
EOF EOF
if ! compile_object ""; then if test "$darwin" = yes && compile_object ""; then
hvf='enabled'
else
if test "$hvf" = "enabled"; then if test "$hvf" = "enabled"; then
error_exit "Hypervisor.framework not available" error_exit "Hypervisor.framework not available"
fi fi
hvf='disabled' hvf='disabled'
else
hvf='enabled'
fi fi
fi fi