configure kvm in a single place

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/configure b/configure
index 4b3ee9b..f96b9da 100755
--- a/configure
+++ b/configure
@@ -1964,19 +1964,6 @@
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
 gdb_xml_files=""
-target_kvm="$kvm"
-
-# Make sure the target and host cpus are compatible
-if test ! \( "$target_arch2" = "$cpu" -o \
-  \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
-  \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
-  \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
-  target_kvm="no"
-fi
-# Disable KVM for linux-user
-if test "$target_softmmu" = "no" ; then
-  target_kvm="no"
-fi
 
 case "$target_arch2" in
   i386)
@@ -1988,11 +1975,6 @@
       echo "CONFIG_KQEMU=y" >> $config_mak
       echo "#define CONFIG_KQEMU 1" >> $config_h
     fi
-    if test "$target_kvm" = "yes" ; then
-      echo "CONFIG_KVM=y" >> $config_mak
-      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
-      echo "#define CONFIG_KVM 1" >> $config_h
-    fi
     target_phys_bits=32
   ;;
   x86_64)
@@ -2006,11 +1988,6 @@
       echo "CONFIG_KQEMU=y" >> $config_mak
       echo "#define CONFIG_KQEMU 1" >> $config_h
     fi
-    if test "$target_kvm" = "yes" ; then
-      echo "CONFIG_KVM=y" >> $config_mak
-      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
-      echo "#define CONFIG_KVM 1" >> $config_h
-    fi
     target_phys_bits=64
   ;;
   alpha)
@@ -2094,11 +2071,6 @@
     echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPCEMB 1" >> $config_h
-    if test "$target_kvm" = "yes" ; then
-      echo "CONFIG_KVM=y" >> $config_mak
-      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
-      echo "#define CONFIG_KVM 1" >> $config_h
-    fi
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
@@ -2174,6 +2146,19 @@
       echo "#define CONFIG_XEN 1" >> $config_h
     fi
 esac
+case "$target_arch2" in
+  i386|x86_64|ppcemb)
+    # Make sure the target and host cpus are compatible
+    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
+      \( "$target_arch2" = "$cpu" -o \
+      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
+      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
+      echo "CONFIG_KVM=y" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
+esac
 echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
 echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak