]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Improve AC_C_BIGENDIAN.
authorEric Blake <ebb9@byu.net>
Tue, 2 Sep 2008 01:36:23 +0000 (19:36 -0600)
committerEric Blake <ebb9@byu.net>
Tue, 2 Sep 2008 01:48:41 +0000 (19:48 -0600)
* doc/autoconf.texi (C Compiler) <AC_C_BIGENDIAN>: Mention that
universal builds require a config header.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Enhance comments.  Check
AH_HEADER at the last possible moment, so that users can use
AC_CONFIG_HEADER after this macro.
Reported by Stepan Kasal.

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

index f77bf78499ec7eb4cc951e89dff955880d0df5a4..f78c40f66d1c1fb3737079a59730c387ad3cc9dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-09-01  Eric Blake  <ebb9@byu.net>
 
+       Improve AC_C_BIGENDIAN.
+       * doc/autoconf.texi (C Compiler) <AC_C_BIGENDIAN>: Mention that
+       universal builds require a config header.
+       * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Enhance comments.  Check
+       AH_HEADER at the last possible moment, so that users can use
+       AC_CONFIG_HEADER after this macro.
+       Reported by Stepan Kasal.
+
        Fix manual date information.
        * doc/autoconf.tex: UPDATED refers to the day the manual was
        built, not the release date of Autoconf.
index eccf68da9f65ae36a7beaed0f5153d7b92ec2d56..23417b3739911759db1c5936edd92a8f0e2d2c5f 100644 (file)
@@ -6787,9 +6787,10 @@ The default for @var{action-if-true} is to define
 @samp{WORDS_BIGENDIAN}.  The default for @var{action-if-false} is to do
 nothing.  The default for @var{action-if-unknown} is to
 abort configure and tell the installer how to bypass this test.
-And finally, the default for @var{action-if-universal} is to define
-@samp{WORDS_BIGENDIAN} or not, depending on the architecture that the
-code is being generated for.
+And finally, the default for @var{action-if-universal} is to ensure that
+@samp{WORDS_BIGENDIAN} is defined if and only if a universal build is
+detected and the current code is big-endian; this default works only if
+@command{autoheader} is used (@pxref{autoheader Invocation}).
 
 If you use this macro without specifying @var{action-if-universal}, you
 should also use @code{AC_CONFIG_HEADERS}; otherwise
index 51fdfeba68fffe7f6f5638eaeef00149ed168282..6e250eedc38801ecf6d30afb1feef70713a2a96e 100644 (file)
@@ -1,7 +1,7 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Programming languages support.
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
+# Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1411,9 +1411,8 @@ AC_DEFUN([AC_C_BIGENDIAN],
 #endif])dnl
  AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
    [ac_cv_c_bigendian=unknown
-    m4_ifval(m4_ifdef([AH_HEADER], 1)[$4],
-      [# See if we're dealing with a universal compiler.
-       AC_COMPILE_IFELSE(
+    # See if we're dealing with a universal compiler.
+    AC_COMPILE_IFELSE(
         [AC_LANG_SOURCE(
            [[#ifndef __APPLE_CC__
               not a universal capable compiler
@@ -1426,8 +1425,7 @@ AC_DEFUN([AC_C_BIGENDIAN],
        # 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])])
+       esac])
     if test $ac_cv_c_bigendian = unknown; then
       # See if sys/param.h defines the BYTE_ORDER macro.
       AC_COMPILE_IFELSE(
@@ -1531,8 +1529,15 @@ AC_DEFUN([AC_C_BIGENDIAN],
    no)
      $2 ;; #(
    universal)
+dnl Note that AC_APPLE_UNIVERSAL_BUILD sorts less than WORDS_BIGENDIAN;
+dnl this is a necessity for proper config header operation.  Warn if
+dnl the user did not specify a config header but is relying on the
+dnl default behavior for universal builds.
      m4_default([$4],
-       [AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
+       [AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
+         [AC_DIAGNOSE([obsolete],
+           [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
+        AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
           [Define if building universal (internal helper macro)])])
      ;; #(
    *)