diff mbox

[36/39] add autoconfy --with-arch= option, compatible with --sparc-cpu

Message ID 1286888457-5033-37-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Oct. 12, 2010, 1 p.m. UTC
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
        Please test this on SPARC. :)

 configure |   72 +++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 39 insertions(+), 33 deletions(-)

Comments

Blue Swirl Oct. 12, 2010, 7:47 p.m. UTC | #1
On Tue, Oct 12, 2010 at 1:00 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@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

Why?

> +      case "$cpu:$with_arch" in
> +      *:v7|*:v8|*:v8plus)
> +        QEMU_CFLAGS="-mcpu=${with_arch} -D__sparc_${with_arch}__ $QEMU_CFLAGS"

-mcpu=v8plus (or v8plusa) is not a valid option. v8plus* should be
handled below like v9, with -mcpu=ultrasparc.

> +        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
>
>
>
>
Paolo Bonzini Oct. 13, 2010, 7:32 a.m. UTC | #2
On 10/12/2010 09:47 PM, Blue Swirl wrote:
>> >  +    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
>
> Why?

Nevermind, I didn't really understand the old code.  I'll fix now.

Paolo
diff mbox

Patch

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"