autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_C_BIGENDIAN answers "universal" on powerpc-aix


From: Eric Blake
Subject: Re: AC_C_BIGENDIAN answers "universal" on powerpc-aix
Date: Mon, 01 Sep 2008 19:50:48 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ralf Wildenhues on 8/26/2008 8:40 AM:
>> ``And finally, the default for @var{action-if-universal} is to ensure
>> that `config header' defines @samp{WORDS_BIGENDIAN), if and only if
>> the code being generated is destined for big-endian architecture.
>> This feature works only if autoheader is used.''
> 
> Fine with me.

I reworded it slightly, to read better from a native speaker's perspective.

> 
>> 2)
>>
>> I propose to perform to do (unconditionally):
>>     set ac_cv_c_bigendian=universal if universal detected
> 
> OK with me.  You could still emit the AC_DIAGNOSE, but wrapped in a
> AC_CONFIG_COMMANDS_PRE (Libtool's ltdl.m4 does similar, while checking
> AH_HEADER).  What do you think?

I like the AC_CONFIG_COMMANDS_PRE hint.

>> 5)
>> It is important that "AC_APPLE_UNIVERSAL_BUILD" < "WORDS_BIGENDIAN"
>> so that the macros fall into the config header in the right order.
>> Perhaps this should be mentioned in a comment above 
>> AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],...)
> 
> Good point.

Done.

The remaining points are too risky pre-2.63, which I really hope to churn
out soon.  So here's what I'm proposing to commit.  Any comments?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki8m/gACgkQ84KuGfSFAYBRYQCbBBTf40231eQlFMmxAedmb1CS
jHQAmwSloX+D0w61ABC4Y8MoNnlwJ8CL
=ewxu
-----END PGP SIGNATURE-----
>From 7bb64f8f9408b0ad46b019fe272058b3a3a4b6e8 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 1 Sep 2008 19:36:23 -0600
Subject: [PATCH] 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.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    8 ++++++++
 doc/autoconf.texi |    7 ++++---
 lib/autoconf/c.m4 |   21 +++++++++++++--------
 3 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f77bf78..f78c40f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-09-01  Eric Blake  <address@hidden>
 
+       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.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index eccf68d..23417b3 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -6787,9 +6787,10 @@ C Compiler
 @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
address@hidden 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
address@hidden is defined if and only if a universal build is
+detected and the current code is big-endian; this default works only if
address@hidden 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
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 51fdfeb..6e250ee 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -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)])])
      ;; #(
    *)
-- 
1.6.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]