0d8cc8f8920918b0024385ddcd9dd1e5800acbe6
[m6w6/libmemcached] / config / 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 if test "x$have_htoll" == "xno"
21 then
22 AC_MSG_CHECKING([byteorder])
23 have_htoll="no"
24 AC_RUN_IFELSE([
25 AC_LANG_PROGRAM([
26 #include <sys/types.h>
27 #include <netinet/in.h>
28 #include <inttypes.h>
29 ], [
30 if (htonl(5) != 5) {
31 return 1;
32 }
33 ])
34 ], [
35 AC_MSG_RESULT([big endian])
36 AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder])
37 ], AC_MSG_RESULT([little endian]))
38 fi
39 ])
40
41 DETECT_BYTEORDER