]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(AC_C_BIGENDIAN): Check for BYTE_ORDER macro from sys/param.h before
authorRoland McGrath <roland@gnu.org>
Sat, 25 Feb 1995 06:56:47 +0000 (06:56 +0000)
committerRoland McGrath <roland@gnu.org>
Sat, 25 Feb 1995 06:56:47 +0000 (06:56 +0000)
trying the test program which cannot be cross-compiled.

acspecific.m4
lib/autoconf/specific.m4

index 4d792d4a3758f821feb6b1b3c59f6b4880f24463..c66013f593f9e1a03f61b06e6b1efaf0f0ea4bb3 100644 (file)
@@ -1527,7 +1527,20 @@ AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }],
 AC_DEFUN(AC_C_BIGENDIAN,
 [AC_MSG_CHECKING(whether byte ordering is bigendian)
 AC_CACHE_VAL(ac_cv_c_bigendian,
-[AC_TRY_RUN([main () {
+[ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/param.h>], [
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/param.h>], [
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
+if test $ac_cv_c_bigendian = unknown; then
+AC_TRY_RUN([main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
@@ -1536,7 +1549,8 @@ AC_CACHE_VAL(ac_cv_c_bigendian,
   } u;
   u.l = 1;
   exit (u.c[sizeof (long) - 1] == 1);
-}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)])dnl
+}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)
+fi])dnl
 AC_MSG_RESULT($ac_cv_c_bigendian)
 if test $ac_cv_c_bigendian = yes; then
   AC_DEFINE(WORDS_BIGENDIAN)
index 4d792d4a3758f821feb6b1b3c59f6b4880f24463..c66013f593f9e1a03f61b06e6b1efaf0f0ea4bb3 100644 (file)
@@ -1527,7 +1527,20 @@ AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }],
 AC_DEFUN(AC_C_BIGENDIAN,
 [AC_MSG_CHECKING(whether byte ordering is bigendian)
 AC_CACHE_VAL(ac_cv_c_bigendian,
-[AC_TRY_RUN([main () {
+[ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/param.h>], [
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/param.h>], [
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
+if test $ac_cv_c_bigendian = unknown; then
+AC_TRY_RUN([main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
@@ -1536,7 +1549,8 @@ AC_CACHE_VAL(ac_cv_c_bigendian,
   } u;
   u.l = 1;
   exit (u.c[sizeof (long) - 1] == 1);
-}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)])dnl
+}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)
+fi])dnl
 AC_MSG_RESULT($ac_cv_c_bigendian)
 if test $ac_cv_c_bigendian = yes; then
   AC_DEFINE(WORDS_BIGENDIAN)