configure: convert accelerator variables to meson options

Prepare for moving the tests to meson.  For now they only have
enabled/disabled as the possible values when meson is invoked,
but "auto" will be a possibility later, when configure will only
parse the command line options.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-09-18 04:57:25 -04:00
parent 1bb4cb1c33
commit 1badb709cf
3 changed files with 83 additions and 66 deletions

132
configure vendored
View File

@ -220,7 +220,7 @@ glob() {
} }
supported_hax_target() { supported_hax_target() {
test "$hax" = "yes" || return 1 test "$hax" = "enabled" || return 1
glob "$1" "*-softmmu" || return 1 glob "$1" "*-softmmu" || return 1
case "${1%-softmmu}" in case "${1%-softmmu}" in
i386|x86_64) i386|x86_64)
@ -231,7 +231,7 @@ supported_hax_target() {
} }
supported_kvm_target() { supported_kvm_target() {
test "$kvm" = "yes" || return 1 test "$kvm" = "enabled" || return 1
glob "$1" "*-softmmu" || return 1 glob "$1" "*-softmmu" || return 1
case "${1%-softmmu}:$cpu" in case "${1%-softmmu}:$cpu" in
aarch64:aarch64 | \ aarch64:aarch64 | \
@ -247,7 +247,7 @@ supported_kvm_target() {
} }
supported_xen_target() { supported_xen_target() {
test "$xen" = "yes" || return 1 test "$xen" = "enabled" || return 1
glob "$1" "*-softmmu" || return 1 glob "$1" "*-softmmu" || return 1
# Only i386 and x86_64 provide the xenpv machine. # Only i386 and x86_64 provide the xenpv machine.
case "${1%-softmmu}" in case "${1%-softmmu}" in
@ -259,7 +259,7 @@ supported_xen_target() {
} }
supported_hvf_target() { supported_hvf_target() {
test "$hvf" = "yes" || return 1 test "$hvf" = "enabled" || return 1
glob "$1" "*-softmmu" || return 1 glob "$1" "*-softmmu" || return 1
case "${1%-softmmu}" in case "${1%-softmmu}" in
x86_64) x86_64)
@ -270,7 +270,7 @@ supported_hvf_target() {
} }
supported_whpx_target() { supported_whpx_target() {
test "$whpx" = "yes" || return 1 test "$whpx" = "enabled" || return 1
glob "$1" "*-softmmu" || return 1 glob "$1" "*-softmmu" || return 1
case "${1%-softmmu}" in case "${1%-softmmu}" in
i386|x86_64) i386|x86_64)
@ -310,7 +310,7 @@ supported_target() {
add_to deprecated_features $1 add_to deprecated_features $1
fi fi
test "$tcg" = "yes" && return 0 test "$tcg" = "enabled" && return 0
supported_kvm_target "$1" && return 0 supported_kvm_target "$1" && return 0
supported_xen_target "$1" && return 0 supported_xen_target "$1" && return 0
supported_hax_target "$1" && return 0 supported_hax_target "$1" && return 0
@ -413,14 +413,14 @@ vnc_png="auto"
xkbcommon="auto" xkbcommon="auto"
xen="" xen=""
xen_ctrl_version="" xen_ctrl_version=""
xen_pci_passthrough="" xen_pci_passthrough="auto"
linux_aio="" linux_aio=""
linux_io_uring="" linux_io_uring=""
cap_ng="" cap_ng=""
attr="" attr=""
libattr="" libattr=""
xfs="" xfs=""
tcg="yes" tcg="enabled"
membarrier="" membarrier=""
vhost_net="" vhost_net=""
vhost_crypto="" vhost_crypto=""
@ -428,10 +428,10 @@ vhost_scsi=""
vhost_vsock="" vhost_vsock=""
vhost_user="" vhost_user=""
vhost_user_fs="" vhost_user_fs=""
kvm="no" kvm="disabled"
hax="no" hax="disabled"
hvf="no" hvf="disabled"
whpx="no" whpx="disabled"
rdma="" rdma=""
pvrdma="" pvrdma=""
gprof="no" gprof="no"
@ -817,8 +817,8 @@ HOST_VARIANT_DIR=""
case $targetos in case $targetos in
MINGW32*) MINGW32*)
mingw32="yes" mingw32="yes"
hax="yes" hax="enabled"
whpx="" 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 +852,7 @@ DragonFly)
;; ;;
NetBSD) NetBSD)
bsd="yes" bsd="yes"
hax="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 +869,8 @@ OpenBSD)
Darwin) Darwin)
bsd="yes" bsd="yes"
darwin="yes" darwin="yes"
hax="yes" hax="enabled"
hvf="" 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 +906,7 @@ 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="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
@ -1188,33 +1188,33 @@ for opt do
;; ;;
--enable-netmap) netmap="yes" --enable-netmap) netmap="yes"
;; ;;
--disable-xen) xen="no" --disable-xen) xen="disabled"
;; ;;
--enable-xen) xen="yes" --enable-xen) xen="enabled"
;; ;;
--disable-xen-pci-passthrough) xen_pci_passthrough="no" --disable-xen-pci-passthrough) xen_pci_passthrough="disabled"
;; ;;
--enable-xen-pci-passthrough) xen_pci_passthrough="yes" --enable-xen-pci-passthrough) xen_pci_passthrough="enabled"
;; ;;
--disable-brlapi) brlapi="no" --disable-brlapi) brlapi="no"
;; ;;
--enable-brlapi) brlapi="yes" --enable-brlapi) brlapi="yes"
;; ;;
--disable-kvm) kvm="no" --disable-kvm) kvm="disabled"
;; ;;
--enable-kvm) kvm="yes" --enable-kvm) kvm="enabled"
;; ;;
--disable-hax) hax="no" --disable-hax) hax="disabled"
;; ;;
--enable-hax) hax="yes" --enable-hax) hax="enabled"
;; ;;
--disable-hvf) hvf="no" --disable-hvf) hvf="disabled"
;; ;;
--enable-hvf) hvf="yes" --enable-hvf) hvf="enabled"
;; ;;
--disable-whpx) whpx="no" --disable-whpx) whpx="disabled"
;; ;;
--enable-whpx) whpx="yes" --enable-whpx) whpx="enabled"
;; ;;
--disable-tcg-interpreter) tcg_interpreter="no" --disable-tcg-interpreter) tcg_interpreter="no"
;; ;;
@ -1224,9 +1224,9 @@ for opt do
;; ;;
--enable-cap-ng) cap_ng="yes" --enable-cap-ng) cap_ng="yes"
;; ;;
--disable-tcg) tcg="no" --disable-tcg) tcg="disabled"
;; ;;
--enable-tcg) tcg="yes" --enable-tcg) tcg="enabled"
;; ;;
--disable-malloc-trim) malloc_trim="disabled" --disable-malloc-trim) malloc_trim="disabled"
;; ;;
@ -1711,7 +1711,7 @@ if [ "$ARCH" = "unknown" ]; then
fi fi
if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then
tcg="no" tcg="disabled"
fi fi
default_target_list="" default_target_list=""
@ -2668,7 +2668,7 @@ fi
########################################## ##########################################
# xen probe # xen probe
if test "$xen" != "no" ; then if test "$xen" != "disabled" ; then
# Check whether Xen library path is specified via --extra-ldflags to avoid # Check whether Xen library path is specified via --extra-ldflags to avoid
# overriding this setting with pkg-config output. If not, try pkg-config # overriding this setting with pkg-config output. If not, try pkg-config
# to obtain all needed flags. # to obtain all needed flags.
@ -2677,7 +2677,7 @@ if test "$xen" != "no" ; then
$pkg_config --exists xencontrol ; then $pkg_config --exists xencontrol ; then
xen_ctrl_version="$(printf '%d%02d%02d' \ xen_ctrl_version="$(printf '%d%02d%02d' \
$($pkg_config --modversion xencontrol | sed 's/\./ /g') )" $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
xen=yes xen=enabled
xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
xen_pc="$xen_pc xenevtchn xendevicemodel" xen_pc="$xen_pc xenevtchn xendevicemodel"
if $pkg_config --exists xentoolcore; then if $pkg_config --exists xentoolcore; then
@ -2703,10 +2703,10 @@ int main(void) {
EOF EOF
if ! compile_prog "" "$xen_libs" ; then if ! compile_prog "" "$xen_libs" ; then
# Xen not found # Xen not found
if test "$xen" = "yes" ; then if test "$xen" = "enabled" ; then
feature_not_found "xen" "Install xen devel" feature_not_found "xen" "Install xen devel"
fi fi
xen=no xen=disabled
# Xen unstable # Xen unstable
elif elif
@ -2732,7 +2732,7 @@ EOF
then then
xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
xen_ctrl_version=41100 xen_ctrl_version=41100
xen=yes xen=enabled
elif elif
cat > $TMPC <<EOF && cat > $TMPC <<EOF &&
#undef XC_WANT_COMPAT_MAP_FOREIGN_API #undef XC_WANT_COMPAT_MAP_FOREIGN_API
@ -2752,7 +2752,7 @@ EOF
then then
xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
xen_ctrl_version=41000 xen_ctrl_version=41000
xen=yes xen=enabled
elif elif
cat > $TMPC <<EOF && cat > $TMPC <<EOF &&
#undef XC_WANT_COMPAT_DEVICEMODEL_API #undef XC_WANT_COMPAT_DEVICEMODEL_API
@ -2771,7 +2771,7 @@ EOF
then then
xen_stable_libs="-lxendevicemodel $xen_stable_libs" xen_stable_libs="-lxendevicemodel $xen_stable_libs"
xen_ctrl_version=40900 xen_ctrl_version=40900
xen=yes xen=enabled
elif elif
cat > $TMPC <<EOF && cat > $TMPC <<EOF &&
/* /*
@ -2824,7 +2824,7 @@ EOF
compile_prog "" "$xen_libs $xen_stable_libs" compile_prog "" "$xen_libs $xen_stable_libs"
then then
xen_ctrl_version=40800 xen_ctrl_version=40800
xen=yes xen=enabled
elif elif
cat > $TMPC <<EOF && cat > $TMPC <<EOF &&
/* /*
@ -2873,7 +2873,7 @@ EOF
compile_prog "" "$xen_libs $xen_stable_libs" compile_prog "" "$xen_libs $xen_stable_libs"
then then
xen_ctrl_version=40701 xen_ctrl_version=40701
xen=yes xen=enabled
# Xen 4.6 # Xen 4.6
elif elif
@ -2901,7 +2901,7 @@ EOF
compile_prog "" "$xen_libs" compile_prog "" "$xen_libs"
then then
xen_ctrl_version=40600 xen_ctrl_version=40600
xen=yes xen=enabled
# Xen 4.5 # Xen 4.5
elif elif
@ -2928,7 +2928,7 @@ EOF
compile_prog "" "$xen_libs" compile_prog "" "$xen_libs"
then then
xen_ctrl_version=40500 xen_ctrl_version=40500
xen=yes xen=enabled
elif elif
cat > $TMPC <<EOF && cat > $TMPC <<EOF &&
@ -2953,17 +2953,17 @@ EOF
compile_prog "" "$xen_libs" compile_prog "" "$xen_libs"
then then
xen_ctrl_version=40200 xen_ctrl_version=40200
xen=yes xen=enabled
else else
if test "$xen" = "yes" ; then if test "$xen" = "enabled" ; then
feature_not_found "xen (unsupported version)" \ feature_not_found "xen (unsupported version)" \
"Install a supported xen (xen 4.2 or newer)" "Install a supported xen (xen 4.2 or newer)"
fi fi
xen=no xen=disabled
fi fi
if test "$xen" = yes; then if test "$xen" = enabled; then
if test $xen_ctrl_version -ge 40701 ; then if test $xen_ctrl_version -ge 40701 ; then
xen_libs="$xen_libs $xen_stable_libs " xen_libs="$xen_libs $xen_stable_libs "
fi fi
@ -2971,31 +2971,31 @@ EOF
fi fi
fi fi
if test "$xen_pci_passthrough" != "no"; then if test "$xen_pci_passthrough" != "disabled"; then
if test "$xen" = "yes" && test "$linux" = "yes"; then if test "$xen" = "enabled" && test "$linux" = "yes"; then
xen_pci_passthrough=yes xen_pci_passthrough=enabled
else else
if test "$xen_pci_passthrough" = "yes"; then if test "$xen_pci_passthrough" = "enabled"; then
error_exit "User requested feature Xen PCI Passthrough" \ error_exit "User requested feature Xen PCI Passthrough" \
" but this feature requires /sys from Linux" " but this feature requires /sys from Linux"
fi fi
xen_pci_passthrough=no xen_pci_passthrough=disabled
fi fi
fi fi
########################################## ##########################################
# Windows Hypervisor Platform accelerator (WHPX) check # Windows Hypervisor Platform accelerator (WHPX) check
if test "$whpx" = "yes" && test "$ARCH" != "x86_64"; then if test "$whpx" = "enabled" && test "$ARCH" != "x86_64"; then
error_exit "WHPX requires 64-bit host" error_exit "WHPX requires 64-bit host"
fi fi
if test "$whpx" != "no" && test "$ARCH" = "x86_64"; then if test "$whpx" != "disabled" && test "$ARCH" = "x86_64"; then
if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
whpx="yes" whpx="yes"
else else
if test "$whpx" = "yes"; then if test "$whpx" = "auto"; then
feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
fi fi
whpx="no" whpx="disabled"
fi fi
fi fi
@ -5823,18 +5823,18 @@ fi
################################################# #################################################
# Check to see if we have the Hypervisor framework # Check to see if we have the Hypervisor framework
if [ "$hvf" != "no" ] ; then if [ "$hvf" != "disabled" ] ; then
cat > $TMPC << EOF cat > $TMPC << EOF
#include <Hypervisor/hv.h> #include <Hypervisor/hv.h>
int main() { return 0;} int main() { return 0;}
EOF EOF
if ! compile_object ""; then if ! compile_object ""; then
if test "$hvf" = "yes"; then if test "$hvf" = "enabled"; then
error_exit "Hypervisor.framework not available" error_exit "Hypervisor.framework not available"
fi fi
hvf='no' hvf='disabled'
else else
hvf='yes' hvf='enabled'
fi fi
fi fi
@ -6192,7 +6192,7 @@ if test "$mingw32" = "yes" ; then
fi fi
# Disable OpenBSD W^X if available # Disable OpenBSD W^X if available
if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then if test "$tcg" = "enabled" && test "$targetos" = "OpenBSD"; then
cat > $TMPC <<EOF cat > $TMPC <<EOF
int main(void) { return 0; } int main(void) { return 0; }
EOF EOF
@ -6743,7 +6743,7 @@ if test "$virglrenderer" = "yes" ; then
echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
fi fi
if test "$xen" = "yes" ; then if test "$xen" = "enabled" ; then
echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
@ -6823,7 +6823,7 @@ fi
if test "$optreset" = "yes" ; then if test "$optreset" = "yes" ; then
echo "HAVE_OPTRESET=y" >> $config_host_mak echo "HAVE_OPTRESET=y" >> $config_host_mak
fi fi
if test "$tcg" = "yes"; then if test "$tcg" = "enabled"; then
echo "CONFIG_TCG=y" >> $config_host_mak echo "CONFIG_TCG=y" >> $config_host_mak
if test "$tcg_interpreter" = "yes" ; then if test "$tcg_interpreter" = "yes" ; then
echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
@ -7606,7 +7606,7 @@ fi
if supported_xen_target $target; then if supported_xen_target $target; then
echo "CONFIG_XEN=y" >> $config_target_mak echo "CONFIG_XEN=y" >> $config_target_mak
if test "$xen_pci_passthrough" = yes; then if test "$xen_pci_passthrough" = enabled; then
echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
fi fi
fi fi
@ -7844,6 +7844,8 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \
-Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
-Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
-Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\

View File

@ -11,6 +11,21 @@ option('malloc_trim', type : 'feature', value : 'auto',
option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'], option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
value: 'system', description: 'choose memory allocator to use') value: 'system', description: 'choose memory allocator to use')
option('kvm', type: 'feature', value: 'auto',
description: 'KVM acceleration support')
option('hax', type: 'feature', value: 'auto',
description: 'HAX acceleration support')
option('whpx', type: 'feature', value: 'auto',
description: 'WHPX acceleration support')
option('hvf', type: 'feature', value: 'auto',
description: 'HVF acceleration support')
option('xen', type: 'feature', value: 'auto',
description: 'Xen backend support')
option('xen_pci_passthrough', type: 'feature', value: 'auto',
description: 'Xen PCI passthrough support')
option('tcg', type: 'feature', value: 'auto',
description: 'TCG support')
option('cocoa', type : 'feature', value : 'auto', option('cocoa', type : 'feature', value : 'auto',
description: 'Cocoa user interface (macOS only)') description: 'Cocoa user interface (macOS only)')
option('mpath', type : 'feature', value : 'auto', option('mpath', type : 'feature', value : 'auto',

View File

@ -269,7 +269,7 @@ test('decodetree', sh,
subdir('fp') subdir('fp')
if 'CONFIG_TCG' in config_host if not get_option('tcg').disabled()
if 'CONFIG_PLUGIN' in config_host if 'CONFIG_PLUGIN' in config_host
subdir('plugin') subdir('plugin')
endif endif