1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
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 <sys/types.h>
#include <sys/param.h>
],[
#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 */
|