X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=config%2Fbyteorder.m4;h=b6bd84a8f18b5c00912d18765a6e3d3b66cf1b93;hb=5c3aa0ef3f1b83e49c9f8093a94d2015873e185b;hp=fe88605a0d9aba5b61bb68575798b7d338855982;hpb=2fe4e1635c70f4b2815aaf9bc147fee0b2c93de3;p=awesomized%2Flibmemcached diff --git a/config/byteorder.m4 b/config/byteorder.m4 index fe88605a..b6bd84a8 100644 --- a/config/byteorder.m4 +++ b/config/byteorder.m4 @@ -1,11 +1,41 @@ -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ +AC_DEFUN([DETECT_BYTEORDER], +[ + AC_MSG_CHECKING([for htonll]) + have_htoll="no" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ #include #include #include - ], [ + ], [ + return htonll(0); + ]) + ], [ + have_htoll="yes" + AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll]) + ]) + + AC_MSG_RESULT([$have_htoll]) + AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$have_htoll" == "xno"]) + AC_MSG_CHECKING([byteorder]) + have_htoll="no" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#include + ], [ if (htonl(5) != 5) { return 1; } - ]) - ], AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder])) + ]) + ], [ + AC_MSG_RESULT([big endian]) + AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder]) + ], [ + AC_MSG_RESULT([little endian]) + AC_DEFINE([BYTEORDER_LITTLE_ENDIAN], [1], [Enable little endian byteorder]) + ]) +]) + +DETECT_BYTEORDER