use standard AC_C_BIGENDIAN macro rather than trying to define it manually --- a/configure.ac +++ b/configure.ac @@ -155,52 +155,24 @@ AC_SUBST(GSKI_CFLAGS) AC_SUBST(GSKI_LIBS) AM_CONDITIONAL(WITH_GTK_INTERFACE, test "x$with_gtk" = "xyes") -dnl Target endianness -AC_ARG_ENABLE(bigendian, -AC_HELP_STRING([--enable-bigendian], - [the target is big endian default=no]), -ski_cv_c_target_bigendian=${enableval}, ski_cv_c_target_bigendian=no) - dnl Check for host endianness AC_CACHE_CHECK([whether host byte ordering is defined in sys/param.h], ski_cv_c_bigendian_compile, [AC_TRY_COMPILE([ #include #include ],[ #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN #error bogus endian macros #endif ], ski_cv_c_bigendian_compile=yes, ski_cv_c_bigendian_compile=no)]) if test "x$ski_cv_c_bigendian_compile" = xyes; then AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness]) -else -AC_CACHE_CHECK([whether host byte ordering is big endian], -ski_cv_c_bigendian, -[AC_TRY_RUN([int main () { - union { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - return (u.c[sizeof (long) - 1] == 1); -}], -ski_cv_c_bigendian=no, ski_cv_c_bigendian=yes, -AC_MSG_ERROR([cannot detect host endianness]))]) - -AC_DEFINE(BIG_ENDIAN, 4321, [define to 4321 if missing from sys/param.h]) -AC_DEFINE(LITTLE_ENDIAN, 1234, [define to 4321 if missing from sys/param.h]) -if test "x$ski_cv_c_bigendian" = xyes; then - AC_DEFINE(BYTE_ORDER, 4321, - [define to 4321 if host is big endian, 1234 if little endian]) -else - AC_DEFINE(BYTE_ORDER, 1234, - [define to 4321 if host is big endian, 1234 if little endian]) -fi fi +AC_C_BIGENDIAN dnl Check for variables & functions --- a/src/std.h +++ b/src/std.h @@ -62,6 +62,14 @@ extern unsigned long long __strtoull(const char *, char **, int); # define BIG_ENDIAN 4321 # define LITTLE_ENDIAN 1234 # define BYTE_ORDER BIG_ENDIAN +# else +# define BIG_ENDIAN 4321 +# define LITTLE_ENDIAN 1234 +# ifdef WORDS_BIGENDIAN +# define BYTE_ORDER BIG_ENDIAN +# else +# define BYTE_ORDER LITTLE_ENDIAN +# endif # endif /* !defined HAVE_CONFIG_H */ #endif /* !defined ENDIANESS_IN_SYS_PARAM_H */