Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- Please test this on SPARC. :)
configure | 72 +++++++++++++++++++++++++++++++++---------------------------- 1 files changed, 39 insertions(+), 33 deletions(-) diff --git a/configure b/configure index d6f472b..99de45b 100755 --- a/configure +++ b/configure @@ -82,7 +82,7 @@ path_of() { cpu="" sysroot="/usr/gnemul/qemu-%M" static="no" -sparc_cpu="" +with_arch="" cross_prefix="" cross_compiling="no" default_cross_prefix="" @@ -215,20 +215,7 @@ for opt do ;; --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" ;; - --sparc_cpu=*) - sparc_cpu="$optarg" - case $sparc_cpu in - v7|v8|v8plus|v8plusa) - cpu="sparc" - ;; - v9) - cpu="sparc64" - ;; - *) - echo "undefined SPARC architecture. Exiting"; - exit 1 - ;; - esac + --with-arch=*|--sparc_cpu=*) with_arch="$optarg" ;; esac done @@ -661,7 +648,7 @@ for opt do ;; --enable-uname-release=*) uname_release="$optarg" ;; - --sparc_cpu=*) + --with-arch=*|--sparc_cpu=*) ;; --enable-werror) werror="yes" ;; @@ -721,21 +708,40 @@ for opt do done # -# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right -# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) +# Plug in the right QEMU_CFLAGS/LDFLAGS for the architecture # host_guest_base="no" + case "$cpu" in - sparc) case $sparc_cpu in - v7|v8) - QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" - ;; - v8plus|v8plusa) - QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" - ;; - *) # sparc_cpu not defined in the command line - QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" - esac + arm*|i386|x86_64|mips*|hppa*|s390|s390x) + test -n "$with_arch" && QEMU_CFLAGS="-march=${with_arch} $QEMU_CFLAGS" + ;; + + sparc|sparc64) + test "$with_arch" = v8plusa && with_arch=v8plus + case "$cpu:$with_arch" in + *:v7|*:v8|*:v8plus) + QEMU_CFLAGS="-mcpu=${with_arch} -D__sparc_${with_arch}__ $QEMU_CFLAGS" + cpu=sparc + ;; + *:v9) + QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${with_arch}__ $QEMU_CFLAGS" + cpu=sparc64 + ;; + sparc:*) QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" + ;; + sparc64:*) QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" + ;; + esac + ;; + + *) + test -n "$with_arch" && QEMU_CFLAGS="-mcpu=${with_arch} $QEMU_CFLAGS" + ;; +esac + +case "${cpu}" in + sparc) LDFLAGS="-m32 $LDFLAGS" QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" if test "$solaris" = "no" ; then @@ -744,9 +750,8 @@ case "$cpu" in fi ;; sparc64) - QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" LDFLAGS="-m64 $LDFLAGS" - QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" + QEMU_CFLAGS="-m64 -ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" if test "$solaris" != "no" ; then QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" fi @@ -812,6 +817,7 @@ echo "Advanced options (experts only):" echo " --srcdir=PATH path of source code [$srcdir]" echo " --build=BUILD specify triplet for build machine [$build]" echo " --enable-targets=LIST choose compiled targets [$target_list]" +echo " --with-arch=ARCH build qemu for given architecture" echo " --with-sysroot=PREFIX where to find shared libraries, etc." echo " use %M for cpu name [$sysroot]" echo " --host=HOST cross-compile for host triplet HOST [$host]" @@ -879,7 +885,6 @@ echo " --disable-guest-base disable GUEST_BASE support" echo " --enable-user-pie build usermode emulation targets as PIE" echo " --disable-user-pie do not build usermode emulation targets as PIE" echo " --enable-uname-release=R Return R for uname -r in usermode emulation" -echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --disable-uuid disable uuid support" echo " --enable-uuid enable uuid support" echo " --disable-vde disable support for vde network" @@ -920,6 +925,7 @@ echo " --make=MAKE use specified make [$make]" echo " --install=INSTALL use specified install [$install]" echo " --static enable static build [$static]" echo " --target-list=LIST set target list [$target_list]" +echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo "" echo "Some influential environment variables can be passed on the command line:" echo " CC C compiler command" @@ -2323,8 +2329,8 @@ echo "VNC SASL support $vnc_sasl" echo "VNC JPEG support $vnc_jpeg" echo "VNC PNG support $vnc_png" echo "VNC thread $vnc_thread" -if test -n "$sparc_cpu"; then - echo "Target Sparc Arch $sparc_cpu" +if test -n "$with_arch"; then +echo "Target Arch $with_arch" fi echo "xen support $xen" echo "brlapi support $brlapi" -- 1.7.2.3