simplify TARGET_BASE_ARCH generation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/configure b/configure
index e3ddfbc..c3b2cff 100755
--- a/configure
+++ b/configure
@@ -1892,14 +1892,14 @@
 gdb_xml_files=""
 
 TARGET_ARCH="$target_arch2"
+TARGET_BASE_ARCH=""
 
 case "$target_arch2" in
   i386)
     target_phys_bits=32
   ;;
   x86_64)
-    echo "TARGET_BASE_ARCH=i386" >> $config_mak
-    echo "#define TARGET_I386 1" >> $config_h
+    TARGET_BASE_ARCH=i386
     target_phys_bits=64
   ;;
   alpha)
@@ -1937,16 +1937,14 @@
   mipsn32|mipsn32el)
     TARGET_ARCH=mipsn32
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "TARGET_BASE_ARCH=mips" >> $config_mak
-    echo "#define TARGET_MIPS 1" >> $config_h
+    TARGET_BASE_ARCH=mips
     echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
     target_phys_bits=64
   ;;
   mips64|mips64el)
     TARGET_ARCH=mips64
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "TARGET_BASE_ARCH=mips" >> $config_mak
-    echo "#define TARGET_MIPS 1" >> $config_h
+    TARGET_BASE_ARCH=mips
     echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
     target_phys_bits=64
   ;;
@@ -1955,25 +1953,22 @@
     target_phys_bits=32
   ;;
   ppcemb)
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
   ppc64)
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
   ppc64abi32)
     TARGET_ARCH=ppc64
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
     echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
@@ -1989,17 +1984,15 @@
     target_phys_bits=64
   ;;
   sparc64)
-    echo "TARGET_BASE_ARCH=sparc" >> $config_mak
-    echo "#define TARGET_SPARC 1" >> $config_h
+    TARGET_BASE_ARCH=sparc
     elfload32="yes"
     target_phys_bits=64
   ;;
   sparc32plus)
     TARGET_ARCH=sparc64
-    echo "TARGET_BASE_ARCH=sparc" >> $config_mak
+    TARGET_BASE_ARCH=sparc
     echo "TARGET_ABI_DIR=sparc" >> $config_mak
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "#define TARGET_SPARC 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     target_phys_bits=64
   ;;
@@ -2012,7 +2005,13 @@
 echo "#define TARGET_ARCH \"$TARGET_ARCH\"" >> $config_h
 target_arch_name=`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`
 echo "#define TARGET_$target_arch_name 1" >> $config_h
-
+if [ "$TARGET_BASE_ARCH" = "" ]; then
+  TARGET_BASE_ARCH=$TARGET_ARCH
+else
+  target_base_arch_name=`echo $TARGET_BASE_ARCH | tr '[:lower:]' '[:upper:]'`
+  echo "#define TARGET_$target_base_arch_name 1" >> $config_h
+fi
+echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
 if [ $target_phys_bits -lt $hostlongbits ] ; then
   target_phys_bits=$hostlongbits
 fi