diff options
author | Christian Grothoff <christian@grothoff.org> | 2005-01-21 16:42:45 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2005-01-21 16:42:45 +0000 |
commit | 7166eaa7ff40782f89aca81bf30e2e4ceac7fb76 (patch) | |
tree | 146f465aaa565a327fb3a3dd85c3b5eb7900d497 /acinclude.m4 | |
download | libextractor-7166eaa7ff40782f89aca81bf30e2e4ceac7fb76.tar.gz libextractor-7166eaa7ff40782f89aca81bf30e2e4ceac7fb76.zip |
Importing libextractor.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..cda05d7 --- /dev/null +++ b/acinclude.m4 | |||
@@ -0,0 +1,44 @@ | |||
1 | define(GNUPG_CHECK_ENDIAN, | ||
2 | [ if test "$cross_compiling" = yes; then | ||
3 | AC_MSG_WARN(cross compiling; assuming big endianess) | ||
4 | fi | ||
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 | ||
12 | bogus endian macros | ||
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 | ||
17 | not big endian | ||
18 | #endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)]) | ||
19 | if test "$gnupg_cv_c_endian" = unknown; then | ||
20 | AC_TRY_RUN([main () { | ||
21 | /* Are we little or big endian? From Harbison&Steele. */ | ||
22 | union | ||
23 | { | ||
24 | long l; | ||
25 | char c[sizeof (long)]; | ||
26 | } u; | ||
27 | u.l = 1; | ||
28 | exit (u.c[sizeof (long) - 1] == 1); | ||
29 | }], | ||
30 | gnupg_cv_c_endian=little, | ||
31 | gnupg_cv_c_endian=big, | ||
32 | gnupg_cv_c_endian=big | ||
33 | ) | ||
34 | fi | ||
35 | ]) | ||
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]) | ||
40 | else | ||
41 | AC_DEFINE(BIG_ENDIAN_HOST,1, | ||
42 | [Defined if the host has big endian byte ordering]) | ||
43 | fi | ||
44 | ]) | ||