]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Improve multiarch detection.
authorBruno Haible <bruno@clisp.org>
Mon, 29 Dec 2008 23:19:31 +0000 (16:19 -0700)
committerEric Blake <ebb9@byu.net>
Mon, 29 Dec 2008 23:19:31 +0000 (16:19 -0700)
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Make detection of options
indicating a universal build more reliable.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/autoconf/c.m4

index f60e99afdecde672facd6f3e246882ddb5b7b777..fe0fb5c6d0c91dd97326a7d9cf50520d8f5d2e37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-26  Bruno Haible  <bruno@clisp.org>
+
+       Improve multiarch detection.
+       * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Make detection of options
+       indicating a universal build more reliable.
+
 2008-12-28  William Pursell  <bill.pursell@gmail.com>  (tiny change)
 
        Use AS_CASE in documented example.
index b728d80b598f04f3a69a55c2970535d076065d62..beaf0b151396f0dbb4bfadf8099b06a36cc5e608 100644 (file)
@@ -1312,11 +1312,26 @@ AC_DEFUN([AC_C_BIGENDIAN],
            ]])],
         [
        # Check for potential -arch flags.  It is not universal unless
-       # there are some -arch flags.  Note that *ppc* also matches
-       # ppc64.  This check is also rather less than ideal.
-       case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
-         *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
-       esac])
+       # there are at least two -arch flags with different values.
+       ac_arch=
+       ac_prev=
+       for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+        if test -n "$ac_prev"; then
+          case $ac_word in
+            i?86 | x86_64 | ppc | ppc64)
+              if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+                ac_arch=$ac_word
+              else
+                ac_cv_c_bigendian=universal
+                break
+              fi
+              ;;
+          esac
+          ac_prev=
+        elif test "x$ac_word" = "x-arch"; then
+          ac_prev=arch
+        fi
+       done])
     if test $ac_cv_c_bigendian = unknown; then
       # See if sys/param.h defines the BYTE_ORDER macro.
       AC_COMPILE_IFELSE(