1
define(GNUPG_CHECK_ENDIAN,
2
[ if test "$cross_compiling" = yes; then
3
AC_MSG_WARN(cross compiling; assuming big endianess)
5
AC_MSG_CHECKING(endianess)
6
AC_CACHE_VAL(gnupg_cv_c_endian,
7
[ gnupg_cv_c_endian=unknown
8
# See if sys/param.h defines the BYTE_ORDER macro.
9
AC_TRY_COMPILE([#include <sys/types.h>
10
#include <sys/param.h>], [
11
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
13
#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
14
AC_TRY_COMPILE([#include <sys/types.h>
15
#include <sys/param.h>], [
16
#if BYTE_ORDER != BIG_ENDIAN
18
#endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)])
19
if test "$gnupg_cv_c_endian" = unknown; then
21
/* Are we little or big endian? From Harbison&Steele. */
25
char c[sizeof (long)];
28
exit (u.c[sizeof (long) - 1] == 1);
30
gnupg_cv_c_endian=little,
31
gnupg_cv_c_endian=big,
36
AC_MSG_RESULT([$gnupg_cv_c_endian])
37
if test "$gnupg_cv_c_endian" = little; then
38
AC_DEFINE(LITTLE_ENDIAN_HOST,1,
39
[Defined if the host has little endian byte ordering])
41
AC_DEFINE(BIG_ENDIAN_HOST,1,
42
[Defined if the host has big endian byte ordering])