summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Duret-Lutz <adl@gnu.org>2001-08-12 12:23:49 +0000
committerAlexandre Duret-Lutz <adl@gnu.org>2001-08-12 12:23:49 +0000
commita5b70717c189cfd517d492bc3ec37880613fd486 (patch)
tree914f062b2e662228624b18e3be1087d8c0cb1680
parent6667f46047ac72968984d63b06ae1613334a1ca9 (diff)
downloadautoconf-a5b70717c189cfd517d492bc3ec37880613fd486.tar.gz
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Handle ACTION-IF-TRUE,
ACTION-IF-FALSE, and ACTION-IF-UNKNOWN. * doc/autoconf.texi (C Compiler Characteristics): Update documentation for AC_C_BIGENDIAN.
-rw-r--r--ChangeLog7
-rw-r--r--NEWS4
-rw-r--r--doc/autoconf.texi18
-rw-r--r--lib/autoconf/c.m418
4 files changed, 36 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 618fae76..1ba765d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2001-08-11 Alexandre Duret-Lutz <duret_g@epita.fr>
+ * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Handle ACTION-IF-TRUE,
+ ACTION-IF-FALSE, and ACTION-IF-UNKNOWN.
+ * doc/autoconf.texi (C Compiler Characteristics): Update
+ documentation for AC_C_BIGENDIAN.
+
+2001-08-11 Alexandre Duret-Lutz <duret_g@epita.fr>
+
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Guess endianness by grep'ing
magic values from an object file when cross-compiling.
Based on code by Guido Draheim <Guido.Draheim@gmx.de>.
diff --git a/NEWS b/NEWS
index 933f8de3..27fe117e 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@
- The top level $prefix is propagated to the AC_CONFIG_SUBDIRS configures.
** C Macros
- AC_C_BIGENDIAN supports the cross-compiling case.
+- AC_C_BIGENDIAN accepts ACTION-IF-TRUE, ACTION-IF-FALSE, and
+ ACTION-IF-UNKNOWN arguments. All are facultative, and the default
+ for ACTION-IF-TRUE is to define WORDS_BIGENDIAN like AC_C_BIGENDIAN
+ always did.
* Major changes in Autoconf 2.52
** Documentation
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 57fca80f..71f15e58 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -4486,14 +4486,26 @@ features. To check for characteristics not listed here, use
@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}) or @code{AC_TRY_RUN}
(@pxref{Run Time})
-@defmac AC_C_BIGENDIAN
+@defmac AC_C_BIGENDIAN (@ovar{action-if-true}, @ovar{action-if-false}, @ovar{action-if-unknown})
@maindex C_BIGENDIAN
@cvindex WORDS_BIGENDIAN
@cindex Endianness
If words are stored with the most significant byte first (like Motorola
-and SPARC, but not Intel and VAX, CPUs), define @code{WORDS_BIGENDIAN}.
-@end defmac
+and SPARC CPUs), execute @var{action-if-true}. If words are stored with
+the less significant byte first (like Intel and VAX CPUs), execute
+@var{action-if-false}.
+
+This macro runs a test-case if endianness cannot be determined from the
+system header files. When cross-compiling the test-case is not run but
+grep'ed for some magic values. @var{action-if-unknown} is executed if
+the latter case fails to determine the byte sex of the host system.
+The default for @var{action-if-true} is to define
+@samp{WORDS_BIGENDIAN}. The default for @var{action-if-false} is to do
+nothing. And finally, the default for @var{action-if-unknown} is to
+abort configure and tell the installer which variable he should preset
+to bypass this test.
+@end defmac
@defmac AC_C_CONST
@maindex C_CONST
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 7cd84d95..d8b131dc 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -828,8 +828,8 @@ fi
])# AC_C_LONG_DOUBLE
-# AC_C_BIGENDIAN
-# --------------
+# AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+# -------------------------------------------------------------------------
AC_DEFUN([AC_C_BIGENDIAN],
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[# See if sys/param.h defines the BYTE_ORDER macro.
@@ -884,14 +884,16 @@ if test `grep -l LiTTleEnDian conftest.$ac_objext` ; then
fi])])])])
case $ac_cv_c_bigendian in
yes)
- AC_DEFINE(WORDS_BIGENDIAN, 1,
- [Define if your processor stores words with the most significant
- byte first (like Motorola and SPARC, unlike Intel and VAX).]);;
+ m4_default([$1],
+ [AC_DEFINE([WORDS_BIGENDIAN], 1,
+ [Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
no)
- ;;
+ $2 ;;
*)
- AC_MSG_ERROR([unknown endianess
-presetting ac_cv_c_bigendian=no (or yes) will help]);;
+ m4_default([$3],
+ [AC_MSG_ERROR([unknown endianess
+presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
esac
])# AC_C_BIGENDIAN