Currently, configure.in makes an assumption that we are compiling for a
UltraSPARC CPU when compiling on a Sun/sparc box.

Of course, code with the SPARCv8+ instructions will not run on CPUs that
do not support them, and these include all our old SPARC friends.

This patch adds checking (via 'uname -m') for the arch we are running on.
If it's the older sparc systems (sun4, sun4c, sun4m, sun4d, sun4t) then do
not force the "-xarch=v8plus" flag for 'as'. If it is something other than
the aformentioned (sun4u, etc), include it.

/dale
--- configure.in-orig   Thu Feb 21 14:46:02 2002
+++ configure.in        Thu Feb 21 15:24:59 2002
@@ -329,15 +329,33 @@
         *sparc*)
             OSDIR="solaris_sparc"
             eolstr="\\n"
+            sparc_arch=`uname -m`
             is_gnu_as=`${AS} --help 2>/dev/null | grep gnu.org`
             if test -z "$is_gnu_as"
             then
-                ASFLAGS="-xarch=v8plus -KPIC -q"
-                ASCPPFLAGS="-D_ASM -D__STDC__=0"
+                case "$sparc_arch" in
+                 sun4c|sun4m|sun4d|sun4t|sun4)
+                    ASFLAGS="-K PIC"
+                    ASCPPFLAGS="-D_ASM -D__STDC__=0"
+                    ;;
+                 *)
+                    ASFLAGS="-xarch=v8plus -K PIC"
+                    ASCPPFLAGS="-D_ASM -D__STDC__=0"
+                    ;;
+                esac
             else
-                ASFLAGS="-K pic -P -D_ASM -D__STDC__=0 -xarch=v8plus"
-                ASCPPFLAGS=""
-                ASCPP="cat"
+                case "$sparc_arch" in
+                 sun4c|sun4m|sun4d|sun4t|sun4)
+                    ASFLAGS="-K pic -P -D_ASM -D__STDC__=0"
+                    ASCPPFLAGS=""
+                    ASCPP="cat"
+                    ;;
+                 *)
+                    ASFLAGS="-K pic -P -D_ASM -D__STDC__=0 -xarch=v8plus"
+                    ASCPPFLAGS=""
+                    ASCPP="cat"
+                    ;;
+                esac
             fi
             AC_SUBST(ASCPPFLAGS)
             AC_SUBST(ASFLAGS)

Reply via email to