On Thu, Aug 14, 2008 at 10:43:21PM +0200, Ralf Wildenhues wrote:
> * Peter O'Gorman wrote on Thu, Aug 14, 2008 at 08:04:20PM CEST:
> > On Thu, Aug 14, 2008 at 07:16:58PM +0200, Ralf Wildenhues wrote:
> > > (Hereby volunteering to do my part in it in the next 48 hours,
> > > but please others do test as well if possible).
> > 
> > I will test on aix, i386-darwin, and i386-linux

I think this one addresses your nits.

Peter
-- 
Peter O'Gorman
[EMAIL PROTECTED]
>From f58daa236229e04e0799c20a131ff88e5e996789 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <[EMAIL PROTECTED]>
Date: Thu, 14 Aug 2008 16:04:30 -0500
Subject: [PATCH] Limit AC_C_BIGENDIAN univeral checks to Mac OS X.

* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Limit the check to __APPLE_CC__ with 
possible -arch flags.
* NEWS: Document it.
---
 ChangeLog         |    7 +++++++
 NEWS              |    4 ++++
 lib/autoconf/c.m4 |   28 ++++++++++++++++++++--------
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aa82465..6f30bd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-14  Peter O'Gorman  <[EMAIL PROTECTED]>
+
+       Limit AC_C_BIGENDIAN univeral checks to Mac OS X.
+       * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Limit the check to
+       __APPLE_CC__ with possible -arch flags.
+       * NEWS: Document it.
+
 2008-08-12  Eric Blake  <[EMAIL PROTECTED]>
 
        Optimize m4_bmatch.
diff --git a/NEWS b/NEWS
index 2cf6747..2aa3e45 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU Autoconf NEWS - User visible changes.
 
 * Major changes in Autoconf 2.62a (2008-??-??)
 
+** AC_C_BIGENDIAN does not mistakenly report "universal" for some
+   bigendian hosts, a regression introduced with universal binary
+   support in 2.62.
+
 ** AC_PATH_X now includes /lib64 and /usr/lib64 in its list of default
    library directories.
 
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index ffaa06e..36c59bb 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1399,11 +1399,15 @@ fi
 AC_DEFUN([AC_C_BIGENDIAN],
 [AH_VERBATIM([WORDS_BIGENDIAN],
 [/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
-   significant byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-#elif ! defined __LITTLE_ENDIAN__
-# undef WORDS_BIGENDIAN
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
 #endif])dnl
  AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
    [ac_cv_c_bigendian=unknown
@@ -1411,12 +1415,18 @@ AC_DEFUN([AC_C_BIGENDIAN],
       [# See if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined.
        AC_COMPILE_IFELSE(
         [AC_LANG_SOURCE(
-           [[#if ! (defined __BIG_ENDIAN__ || defined __LITTLE_ENDIAN__)
-              neither is defined;
+           [[#ifndef __APPLE_CC__
+              not a universal capable compiler 
             #endif
             typedef int dummy;
            ]])],
-        [ac_cv_c_bigendian=universal])],
+        [
+       # 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])],
       [AC_DIAGNOSE([obsolete], [AC_C_BIGENDIAN suggests AC_CONFIG_HEADERS])])
     if test $ac_cv_c_bigendian = unknown; then
       # See if sys/param.h defines the BYTE_ORDER macro.
@@ -1521,6 +1531,8 @@ AC_DEFUN([AC_C_BIGENDIAN],
    no)
      $2 ;; #(
    universal)
+     AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
+       [Define if building universal (internal helper macro)])
      $4 ;; #(
    *)
      m4_default([$3],
-- 
1.5.4.1

Reply via email to