Use AC_C_BIGENDIAN instead of a custom endianness check in configure.ac. Makes
cross compiling easier.

Signed-off-by: George McCollister <[email protected]>
---
 configure.ac |   31 ++++++-------------------------
 1 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2a1b703..1151078 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,31 +347,12 @@ fi
 
 AC_C_SOCKLEN_T
 
-dnl Check if we're a little-endian or a big-endian system, needed by hash code
-AC_DEFUN([AC_C_ENDIAN],
-[AC_CACHE_CHECK(for endianness, ac_cv_c_endian,
-[
-  AC_RUN_IFELSE(
-    [AC_LANG_PROGRAM([], [dnl
-        long val = 1;
-        char *c = (char *) &val;
-        exit(*c == 1);
-    ])
-  ],[
-    ac_cv_c_endian=big
-  ],[
-    ac_cv_c_endian=little
-  ])
-])
-if test $ac_cv_c_endian = big; then
-  AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian])
-fi
-if test $ac_cv_c_endian = little; then
-  AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian])
-fi
-])
-
-AC_C_ENDIAN
+AC_C_BIGENDIAN(
+  AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian]),
+  AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian]),
+  AC_MSG_ERROR(unknown endianess),
+  AC_MSG_ERROR(universial endianess not supported)
+)
 
 AC_DEFUN([AC_C_HTONLL],
 [
-- 
1.6.4.2

Reply via email to