aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-17 11:59:41 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2017-07-04 14:39:28 +0200
commit3b6b75506de44c5070639943c30a0ad5850f5d02 (patch)
treea2c66a74bbde09e90b44e109c7a23e2b3ce719d0 /configure
parentee29bdb6a7878205d41a46aa30f17bb831910b85 (diff)
configure: factor out list of supported Xen/KVM/HAX targets
This will be useful when the functions are called, early in the configure process, to filter out targets that do not support hardware acceleration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure90
1 files changed, 55 insertions, 35 deletions
diff --git a/configure b/configure
index c571ad14e5..0f14e79f86 100755
--- a/configure
+++ b/configure
@@ -163,6 +163,50 @@ have_backend () {
echo "$trace_backends" | grep "$1" >/dev/null
}
+glob() {
+ eval test -z '"${1#'"$2"'}"'
+}
+
+supported_hax_target() {
+ test "$hax" = "yes" || return 1
+ glob "$1" "*-softmmu" || return 1
+ case "${1%-softmmu}" in
+ i386|x86_64)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+supported_kvm_target() {
+ test "$kvm" = "yes" || return 1
+ glob "$1" "*-softmmu" || return 1
+ case "${1%-softmmu}:$cpu" in
+ arm:arm | aarch64:aarch64 | \
+ i386:i386 | i386:x86_64 | i386:x32 | \
+ x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
+ mips:mips | mipsel:mips | \
+ ppc:ppc | ppcemb:ppc | ppc64:ppc | \
+ ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
+ s390x:s390x)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+supported_xen_target() {
+ test "$xen" = "yes" || return 1
+ glob "$1" "*-softmmu" || return 1
+ case "${1%-softmmu}:$cpu" in
+ arm:arm | aarch64:aarch64 | \
+ i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
# default parameters
source_path=$(dirname "$0")
cpu=""
@@ -6178,46 +6222,22 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
if [ "$HOST_VARIANT_DIR" != "" ]; then
echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
fi
-case "$target_name" in
- i386|x86_64)
- if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
- echo "CONFIG_XEN=y" >> $config_target_mak
- if test "$xen_pci_passthrough" = yes; then
+
+if supported_xen_target $target; then
+ echo "CONFIG_XEN=y" >> $config_target_mak
+ if test "$xen_pci_passthrough" = yes; then
echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
- fi
fi
- ;;
- *)
-esac
-case "$target_name" in
- aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
- # Make sure the target and host cpus are compatible
- if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
- \( "$target_name" = "$cpu" -o \
- \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
- \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
- \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
- \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
- \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
- \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
- \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \
- \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \
- \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then
- echo "CONFIG_KVM=y" >> $config_target_mak
- if test "$vhost_net" = "yes" ; then
+fi
+if supported_kvm_target $target; then
+ echo "CONFIG_KVM=y" >> $config_target_mak
+ if test "$vhost_net" = "yes" ; then
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak
- fi
fi
-esac
-if test "$hax" = "yes" ; then
- if test "$target_softmmu" = "yes" ; then
- case "$target_name" in
- i386|x86_64)
- echo "CONFIG_HAX=y" >> $config_target_mak
- ;;
- esac
- fi
+fi
+if supported_hax_target $target; then
+ echo "CONFIG_HAX=y" >> $config_target_mak
fi
if test "$target_bigendian" = "yes" ; then
echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak