dnl @synopsis AC_C_BIGENDIAN_CROSS dnl dnl Check endianess even when crosscompiling dnl (partially based on the original AC_C_BIGENDIAN). dnl dnl The implementation will create a binary, and instead of running dnl the binary it will be grep'ed for some symbols that will look dnl different for different endianess of the binary. dnl dnl @version $Id: ac_c_bigendian_cross.m4,v 1.1 2000/09/09 13:29:23 simons Exp $ dnl @author Guido Draheim dnl AC_DEFUN([AC_C_BIGENDIAN_CROSS], [AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian], [# See if sys/param.h defines the BYTE_ORDER macro. AC_TRY_COMPILE([#include #include ], [ #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 #include ], [ #if BYTE_ORDER != BIG_ENDIAN not big endian #endif], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])], [# It does not, try to run a simple test AC_TRY_RUN([main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian="unknown (cross-compiling)"]) ])]) if test "$ac_cv_c_bigendian" = "unknown (cross-compiling)"; then AC_MSG_CHECKING([whether byte order LOOKS bigendian]) [cat >conftest.c <