Merge Monty
[m6w6/libmemcached] / m4 / byteorder.m4
1 AC_DEFUN([DETECT_BYTEORDER],
2 [
3 AC_MSG_CHECKING([for htonll])
4 have_htoll="no"
5 AC_RUN_IFELSE([
6 AC_LANG_PROGRAM([
7 #include <sys/types.h>
8 #include <netinet/in.h>
9 #include <inttypes.h>
10 ], [
11 return htonll(0);
12 ])
13 ], [
14 have_htoll="yes"
15 AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])
16 ])
17
18 AC_MSG_RESULT([$have_htoll])
19 AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$have_htoll" = "xno"])
20 AC_MSG_CHECKING([byteorder])
21 have_htoll="no"
22 AC_RUN_IFELSE([
23 AC_LANG_PROGRAM([
24 #include <sys/types.h>
25 #include <netinet/in.h>
26 #include <inttypes.h>
27 ], [
28 if (htonl(5) != 5) {
29 return 1;
30 }
31 ])
32 ], [
33 AC_MSG_RESULT([big endian])
34 AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder])
35 ], [
36 AC_MSG_RESULT([little endian])
37 AC_DEFINE([BYTEORDER_LITTLE_ENDIAN], [1], [Enable little endian byteorder])
38 ])
39 ])
40