CRIS: helper_dummy no longer needed as barrier for qemu_ld/st.
[qemu] / configure
index 3df08ab..c1ab850 100755 (executable)
--- a/configure
+++ b/configure
@@ -35,17 +35,29 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
   ;;
+  x86_64|amd64)
+    cpu="x86_64"
+  ;;
+  alpha)
+    cpu="alpha"
+  ;;
   armv*b)
     cpu="armv4b"
   ;;
   armv*l)
     cpu="armv4l"
   ;;
-  alpha)
-    cpu="alpha"
+  cris)
+    cpu="cris"
   ;;
-  "Power Macintosh"|ppc|ppc64)
-    cpu="powerpc"
+  parisc|parisc64)
+    cpu="hppa"
+  ;;
+  ia64)
+    cpu="ia64"
+  ;;
+  m68k)
+    cpu="m68k"
   ;;
   mips)
     cpu="mips"
@@ -53,8 +65,8 @@ case "$cpu" in
   mips64)
     cpu="mips64"
   ;;
-  cris)
-    cpu="cris"
+  "Power Macintosh"|ppc|ppc64)
+    cpu="powerpc"
   ;;
   s390*)
     cpu="s390"
@@ -65,15 +77,6 @@ case "$cpu" in
   sparc64)
     cpu="sparc64"
   ;;
-  ia64)
-    cpu="ia64"
-  ;;
-  m68k)
-    cpu="m68k"
-  ;;
-  x86_64|amd64)
-    cpu="x86_64"
-  ;;
   *)
     cpu="unknown"
   ;;
@@ -286,6 +289,8 @@ for opt do
   ;;
   --disable-kqemu) kqemu="no"
   ;;
+  --disable-brlapi) brlapi="no"
+  ;;
   --enable-profiler) profiler="yes"
   ;;
   --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
@@ -416,7 +421,9 @@ echo "  --enable-alsa            enable ALSA audio driver"
 echo "  --enable-esd             enable EsoundD audio driver"
 echo "  --enable-fmod            enable FMOD audio driver"
 echo "  --enable-dsound          enable DirectSound audio driver"
+echo "  --disable-brlapi         disable BrlAPI"
 echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
+echo "  --disable-curses         disable curses output"
 echo "  --enable-system          enable all system emulation targets"
 echo "  --disable-system         disable all system emulation targets"
 echo "  --enable-linux-user      enable all linux usermode emulation targets"
@@ -532,15 +539,49 @@ fi
 if test -z "$target_list" ; then
 # these targets are portable
     if [ "$softmmu" = "yes" ] ; then
-        target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu"
+        target_list="\
+i386-softmmu \
+x86_64-softmmu \
+arm-softmmu \
+cris-softmmu \
+m68k-softmmu \
+mips-softmmu \
+mipsel-softmmu \
+mips64-softmmu \
+mips64el-softmmu \
+ppc-softmmu \
+ppcemb-softmmu \
+ppc64-softmmu \
+sh4-softmmu \
+sh4eb-softmmu \
+sparc-softmmu \
+"
     fi
 # the following are Linux specific
     if [ "$linux_user" = "yes" ] ; then
-        target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user sh4eb-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list"
+        target_list="${target_list}\
+i386-linux-user \
+x86_64-linux-user \
+alpha-linux-user \
+arm-linux-user \
+armeb-linux-user \
+cris-linux-user \
+m68k-linux-user \
+mips-linux-user \
+mipsel-linux-user \
+ppc-linux-user \
+ppc64-linux-user \
+ppc64abi32-linux-user \
+sh4-linux-user \
+sh4eb-linux-user \
+sparc-linux-user \
+sparc64-linux-user \
+sparc32plus-linux-user \
+"
     fi
 # the following are Darwin specific
     if [ "$darwin_user" = "yes" ] ; then
-        target_list="i386-darwin-user ppc-darwin-user $target_list"
+        target_list="$target_list i386-darwin-user ppc-darwin-user"
     fi
 else
     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
@@ -571,7 +612,15 @@ fi
 else
 
 # if cross compiling, cannot launch a program, so make a static guess
-if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
+if test "$cpu" = "armv4b" \
+     -o "$cpu" = "hppa" \
+     -o "$cpu" = "m68k" \
+     -o "$cpu" = "mips" \
+     -o "$cpu" = "mips64" \
+     -o "$cpu" = "powerpc" \
+     -o "$cpu" = "s390" \
+     -o "$cpu" = "sparc" \
+     -o "$cpu" = "sparc64"; then
     bigendian="yes"
 fi
 
@@ -579,7 +628,10 @@ fi
 
 # host long bits test
 hostlongbits="32"
-if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
+if test "$cpu" = "x86_64" \
+     -o "$cpu" = "alpha" \
+     -o "$cpu" = "ia64" \
+     -o "$cpu" = "sparc64"; then
     hostlongbits="64"
 fi
 
@@ -673,6 +725,20 @@ EOF
 fi
 
 ##########################################
+# BrlAPI probe
+
+if test -z "$brlapi" ; then
+    brlapi=no
+cat > $TMPC << EOF
+#include <brlapi.h>
+int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
+EOF
+    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
+           brlapi=yes
+    fi # brlapi compile test
+fi # -z $brlapi
+
+##########################################
 # curses probe
 
 if test "$curses" = "yes" ; then
@@ -681,7 +747,7 @@ if test "$curses" = "yes" ; then
 #include <curses.h>
 int main(void) { return curses_version(); }
 EOF
-  if $cc -o $TMPE $TMPC -lcurses 2> /dev/null ; then
+  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
     curses=yes
   fi
 fi # test "$curses"
@@ -769,6 +835,7 @@ if test -n "$sparc_cpu"; then
     echo "Target Sparc Arch $sparc_cpu"
 fi
 echo "kqemu support     $kqemu"
+echo "brlapi support    $brlapi"
 echo "Documentation     $build_docs"
 [ ! -z "$uname_release" ] && \
 echo "uname -r          $uname_release"
@@ -818,52 +885,72 @@ echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak
 echo "AIOLIBS=$AIOLIBS" >> $config_mak
-if test "$cpu" = "i386" ; then
-  echo "ARCH=i386" >> $config_mak
-  echo "#define HOST_I386 1" >> $config_h
-elif test "$cpu" = "x86_64" ; then
-  echo "ARCH=x86_64" >> $config_mak
-  echo "#define HOST_X86_64 1" >> $config_h
-elif test "$cpu" = "armv4b" ; then
-  echo "ARCH=arm" >> $config_mak
-  echo "#define HOST_ARM 1" >> $config_h
-elif test "$cpu" = "armv4l" ; then
-  echo "ARCH=arm" >> $config_mak
-  echo "#define HOST_ARM 1" >> $config_h
-elif test "$cpu" = "powerpc" ; then
-  echo "ARCH=ppc" >> $config_mak
-  echo "#define HOST_PPC 1" >> $config_h
-elif test "$cpu" = "mips" ; then
-  echo "ARCH=mips" >> $config_mak
-  echo "#define HOST_MIPS 1" >> $config_h
-elif test "$cpu" = "mips64" ; then
-  echo "ARCH=mips64" >> $config_mak
-  echo "#define HOST_MIPS64 1" >> $config_h
-elif test "$cpu" = "cris" ; then
-  echo "ARCH=cris" >> $config_mak
-  echo "#define HOST_CRIS 1" >> $config_h
-elif test "$cpu" = "s390" ; then
-  echo "ARCH=s390" >> $config_mak
-  echo "#define HOST_S390 1" >> $config_h
-elif test "$cpu" = "alpha" ; then
-  echo "ARCH=alpha" >> $config_mak
-  echo "#define HOST_ALPHA 1" >> $config_h
-elif test "$cpu" = "sparc" ; then
-  echo "ARCH=sparc" >> $config_mak
-  echo "#define HOST_SPARC 1" >> $config_h
-elif test "$cpu" = "sparc64" ; then
-  echo "ARCH=sparc64" >> $config_mak
-  echo "#define HOST_SPARC64 1" >> $config_h
-elif test "$cpu" = "ia64" ; then
-  echo "ARCH=ia64" >> $config_mak
-  echo "#define HOST_IA64 1" >> $config_h
-elif test "$cpu" = "m68k" ; then
-  echo "ARCH=m68k" >> $config_mak
-  echo "#define HOST_M68K 1" >> $config_h
-else
-  echo "Unsupported CPU = $cpu"
-  exit 1
-fi
+case "$cpu" in
+  i386)
+    echo "ARCH=i386" >> $config_mak
+    echo "#define HOST_I386 1" >> $config_h
+  ;;
+  x86_64)
+    echo "ARCH=x86_64" >> $config_mak
+    echo "#define HOST_X86_64 1" >> $config_h
+  ;;
+  alpha)
+    echo "ARCH=alpha" >> $config_mak
+    echo "#define HOST_ALPHA 1" >> $config_h
+  ;;
+  armv4b)
+    echo "ARCH=arm" >> $config_mak
+    echo "#define HOST_ARM 1" >> $config_h
+  ;;
+  armv4l)
+    echo "ARCH=arm" >> $config_mak
+    echo "#define HOST_ARM 1" >> $config_h
+  ;;
+  cris)
+    echo "ARCH=cris" >> $config_mak
+    echo "#define HOST_CRIS 1" >> $config_h
+  ;;
+  hppa)
+    echo "ARCH=hppa" >> $config_mak
+    echo "#define HOST_HPPA 1" >> $config_h
+  ;;
+  ia64)
+    echo "ARCH=ia64" >> $config_mak
+    echo "#define HOST_IA64 1" >> $config_h
+  ;;
+  m68k)
+    echo "ARCH=m68k" >> $config_mak
+    echo "#define HOST_M68K 1" >> $config_h
+  ;;
+  mips)
+    echo "ARCH=mips" >> $config_mak
+    echo "#define HOST_MIPS 1" >> $config_h
+  ;;
+  mips64)
+    echo "ARCH=mips64" >> $config_mak
+    echo "#define HOST_MIPS64 1" >> $config_h
+  ;;
+  powerpc)
+    echo "ARCH=ppc" >> $config_mak
+    echo "#define HOST_PPC 1" >> $config_h
+  ;;
+  s390)
+    echo "ARCH=s390" >> $config_mak
+    echo "#define HOST_S390 1" >> $config_h
+  ;;
+  sparc)
+    echo "ARCH=sparc" >> $config_mak
+    echo "#define HOST_SPARC 1" >> $config_h
+  ;;
+  sparc64)
+    echo "ARCH=sparc64" >> $config_mak
+    echo "#define HOST_SPARC64 1" >> $config_h
+  ;;
+  *)
+    echo "Unsupported CPU = $cpu"
+    exit 1
+  ;;
+esac
 if test "$bigendian" = "yes" ; then
   echo "WORDS_BIGENDIAN=yes" >> $config_mak
   echo "#define WORDS_BIGENDIAN 1" >> $config_h
@@ -1000,6 +1087,11 @@ if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=yes" >> $config_mak
   echo "CURSES_LIBS=-lcurses" >> $config_mak
 fi
+if test "$brlapi" = "yes" ; then
+  echo "CONFIG_BRLAPI=yes" >> $config_mak
+  echo "#define CONFIG_BRLAPI 1" >> $config_h
+  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
+fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
@@ -1025,18 +1117,18 @@ config_h=$target_dir/config.h
 target_cpu=`echo $target | cut -d '-' -f 1`
 target_bigendian="no"
 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
+[ "$target_cpu" = "m68k" ] && target_bigendian=yes
+[ "$target_cpu" = "mips" ] && target_bigendian=yes
+[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
+[ "$target_cpu" = "mips64" ] && target_bigendian=yes
 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
-[ "$target_cpu" = "mips" ] && target_bigendian=yes
-[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
-[ "$target_cpu" = "mips64" ] && target_bigendian=yes
 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
-[ "$target_cpu" = "m68k" ] && target_bigendian=yes
+[ "$target_cpu" = "sparc" ] && target_bigendian=yes
+[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
+[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
 target_softmmu="no"
 target_user_only="no"
 target_linux_user="no"
@@ -1098,108 +1190,158 @@ elfload32="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
 
-if test "$target_cpu" = "i386" ; then
-  echo "TARGET_ARCH=i386" >> $config_mak
-  echo "#define TARGET_ARCH \"i386\"" >> $config_h
-  echo "#define TARGET_I386 1" >> $config_h
-  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
-    echo "#define USE_KQEMU 1" >> $config_h
-  fi
-elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
-  echo "TARGET_ARCH=arm" >> $config_mak
-  echo "#define TARGET_ARCH \"arm\"" >> $config_h
-  echo "#define TARGET_ARM 1" >> $config_h
-  bflt="yes"
-elif test "$target_cpu" = "sparc" ; then
-  echo "TARGET_ARCH=sparc" >> $config_mak
-  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
-  echo "#define TARGET_SPARC 1" >> $config_h
-elif test "$target_cpu" = "sparc64" ; then
-  echo "TARGET_ARCH=sparc64" >> $config_mak
-  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
-  echo "#define TARGET_SPARC 1" >> $config_h
-  echo "#define TARGET_SPARC64 1" >> $config_h
-  elfload32="yes"
-elif test "$target_cpu" = "sparc32plus" ; then
-  echo "TARGET_ARCH=sparc64" >> $config_mak
-  echo "TARGET_ABI_DIR=sparc" >> $config_mak
-  echo "TARGET_ARCH2=sparc32plus" >> $config_mak
-  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
-  echo "#define TARGET_SPARC 1" >> $config_h
-  echo "#define TARGET_SPARC64 1" >> $config_h
-  echo "#define TARGET_ABI32 1" >> $config_h
-elif test "$target_cpu" = "ppc" ; then
-  echo "TARGET_ARCH=ppc" >> $config_mak
-  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
-  echo "#define TARGET_PPC 1" >> $config_h
-elif test "$target_cpu" = "ppcemb" ; then
-  echo "TARGET_ARCH=ppcemb" >> $config_mak
-  echo "TARGET_ABI_DIR=ppc" >> $config_mak
-  echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
-  echo "#define TARGET_PPC 1" >> $config_h
-  echo "#define TARGET_PPCEMB 1" >> $config_h
-elif test "$target_cpu" = "ppc64" ; then
-  echo "TARGET_ARCH=ppc64" >> $config_mak
-  echo "TARGET_ABI_DIR=ppc" >> $config_mak
-  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
-  echo "#define TARGET_PPC 1" >> $config_h
-  echo "#define TARGET_PPC64 1" >> $config_h
-elif test "$target_cpu" = "ppc64abi32" ; then
-  echo "TARGET_ARCH=ppc64" >> $config_mak
-  echo "TARGET_ABI_DIR=ppc" >> $config_mak
-  echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
-  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
-  echo "#define TARGET_PPC 1" >> $config_h
-  echo "#define TARGET_PPC64 1" >> $config_h
-  echo "#define TARGET_ABI32 1" >> $config_h
-elif test "$target_cpu" = "x86_64" ; then
-  echo "TARGET_ARCH=x86_64" >> $config_mak
-  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
-  echo "#define TARGET_I386 1" >> $config_h
-  echo "#define TARGET_X86_64 1" >> $config_h
-  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
-    echo "#define USE_KQEMU 1" >> $config_h
-  fi
-elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
-  echo "TARGET_ARCH=mips" >> $config_mak
-  echo "#define TARGET_ARCH \"mips\"" >> $config_h
-  echo "#define TARGET_MIPS 1" >> $config_h
-  echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
-elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
-  echo "TARGET_ARCH=mipsn32" >> $config_mak
-  echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
-  echo "#define TARGET_MIPS 1" >> $config_h
-  echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
-elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
-  echo "TARGET_ARCH=mips64" >> $config_mak
-  echo "#define TARGET_ARCH \"mips64\"" >> $config_h
-  echo "#define TARGET_MIPS 1" >> $config_h
-  echo "#define TARGET_MIPS64 1" >> $config_h
-  echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
-elif test "$target_cpu" = "cris" ; then
-  echo "TARGET_ARCH=cris" >> $config_mak
-  echo "#define TARGET_ARCH \"cris\"" >> $config_h
-  echo "#define TARGET_CRIS 1" >> $config_h
-  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
-  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
-elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
-  echo "TARGET_ARCH=sh4" >> $config_mak
-  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
-  echo "#define TARGET_SH4 1" >> $config_h
-  bflt="yes"
-elif test "$target_cpu" = "m68k" ; then
-  echo "TARGET_ARCH=m68k" >> $config_mak
-  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
-  echo "#define TARGET_M68K 1" >> $config_h
-  bflt="yes"
-elif test "$target_cpu" = "alpha" ; then
-  echo "TARGET_ARCH=alpha" >> $config_mak
-  echo "#define TARGET_ARCH \"alpha\"" >> $config_h
-  echo "#define TARGET_ALPHA 1" >> $config_h
-else
-  echo "Unsupported target CPU"
-  exit 1
-fi
+case "$target_cpu" in
+  i386)
+    echo "TARGET_ARCH=i386" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"i386\"" >> $config_h
+    echo "#define TARGET_I386 1" >> $config_h
+    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
+    then
+      echo "#define USE_KQEMU 1" >> $config_h
+    fi
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
+    if test -n "$gcc3minver" -a $gcc3minver -gt 3
+    then
+      echo "HAVE_GT_GCC_3_3=true" >> $config_mak
+    else
+      echo "HAVE_GT_GCC_3_3=false" >> $config_mak
+    fi
+  ;;
+  x86_64)
+    echo "TARGET_ARCH=x86_64" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
+    echo "#define TARGET_I386 1" >> $config_h
+    echo "#define TARGET_X86_64 1" >> $config_h
+    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
+    then
+      echo "#define USE_KQEMU 1" >> $config_h
+    fi
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  alpha)
+    echo "TARGET_ARCH=alpha" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
+    echo "#define TARGET_ALPHA 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  arm|armeb)
+    echo "TARGET_ARCH=arm" >> $config_mak
+    echo "#define TARGET_ARCH \"arm\"" >> $config_h
+    echo "#define TARGET_ARM 1" >> $config_h
+    bflt="yes"
+  ;;
+  cris)
+    echo "TARGET_ARCH=cris" >> $config_mak
+    echo "#define TARGET_ARCH \"cris\"" >> $config_h
+    echo "#define TARGET_CRIS 1" >> $config_h
+  ;;
+  m68k)
+    echo "TARGET_ARCH=m68k" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
+    echo "#define TARGET_M68K 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    bflt="yes"
+  ;;
+  mips|mipsel)
+    echo "TARGET_ARCH=mips" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"mips\"" >> $config_h
+    echo "#define TARGET_MIPS 1" >> $config_h
+    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  mipsn32|mipsn32el)
+    echo "TARGET_ARCH=mipsn32" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
+    echo "#define TARGET_MIPS 1" >> $config_h
+    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  mips64|mips64el)
+    echo "TARGET_ARCH=mips64" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
+    echo "#define TARGET_MIPS 1" >> $config_h
+    echo "#define TARGET_MIPS64 1" >> $config_h
+    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  ppc)
+    echo "TARGET_ARCH=ppc" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
+    echo "#define TARGET_PPC 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  ppcemb)
+    echo "TARGET_ARCH=ppcemb" >> $config_mak
+    echo "TARGET_ABI_DIR=ppc" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
+    echo "#define TARGET_PPC 1" >> $config_h
+    echo "#define TARGET_PPCEMB 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  ppc64)
+    echo "TARGET_ARCH=ppc64" >> $config_mak
+    echo "TARGET_ABI_DIR=ppc" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
+    echo "#define TARGET_PPC 1" >> $config_h
+    echo "#define TARGET_PPC64 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  ppc64abi32)
+    echo "TARGET_ARCH=ppc64" >> $config_mak
+    echo "TARGET_ABI_DIR=ppc" >> $config_mak
+    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
+    echo "#define TARGET_PPC 1" >> $config_h
+    echo "#define TARGET_PPC64 1" >> $config_h
+    echo "#define TARGET_ABI32 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+  ;;
+  sh4|sh4eb)
+    echo "TARGET_ARCH=sh4" >> $config_mak
+    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
+    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
+    echo "#define TARGET_SH4 1" >> $config_h
+    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    bflt="yes"
+  ;;
+  sparc)
+    echo "TARGET_ARCH=sparc" >> $config_mak
+    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
+    echo "#define TARGET_SPARC 1" >> $config_h
+  ;;
+  sparc64)
+    echo "TARGET_ARCH=sparc64" >> $config_mak
+    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
+    echo "#define TARGET_SPARC 1" >> $config_h
+    echo "#define TARGET_SPARC64 1" >> $config_h
+    elfload32="yes"
+  ;;
+  sparc32plus)
+    echo "TARGET_ARCH=sparc64" >> $config_mak
+    echo "TARGET_ABI_DIR=sparc" >> $config_mak
+    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
+    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
+    echo "#define TARGET_SPARC 1" >> $config_h
+    echo "#define TARGET_SPARC64 1" >> $config_h
+    echo "#define TARGET_ABI32 1" >> $config_h
+  ;;
+  *)
+    echo "Unsupported target CPU"
+    exit 1
+  ;;
+esac
 if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
   echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
@@ -1221,7 +1363,18 @@ if test "$target_darwin_user" = "yes" ; then
   echo "#define CONFIG_DARWIN_USER 1" >> $config_h
 fi
 
-if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64"  -o "$target_cpu" = "sparc32plus" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then
+if test "$target_cpu" = "arm" \
+     -o "$target_cpu" = "armeb" \
+     -o "$target_cpu" = "m68k" \
+     -o "$target_cpu" = "mips" \
+     -o "$target_cpu" = "mipsel" \
+     -o "$target_cpu" = "mipsn32" \
+     -o "$target_cpu" = "mipsn32el" \
+     -o "$target_cpu" = "mips64" \
+     -o "$target_cpu" = "mips64el" \
+     -o "$target_cpu" = "sparc" \
+     -o "$target_cpu" = "sparc64" \
+     -o "$target_cpu" = "sparc32plus"; then
   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
 fi