X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fbyteorder.m4;h=4692bbd205c44a9fe3719e4a534169272b10de15;hb=c67da677fe0944d3d2d3ff46e65fc3bc775404ae;hp=b6bd84a8f18b5c00912d18765a6e3d3b66cf1b93;hpb=717020b76aacd61929bf78ee6e8d838f619016f1;p=m6w6%2Flibmemcached diff --git a/m4/byteorder.m4 b/m4/byteorder.m4 index b6bd84a8..4692bbd2 100644 --- a/m4/byteorder.m4 +++ b/m4/byteorder.m4 @@ -1,41 +1,25 @@ AC_DEFUN([DETECT_BYTEORDER], [ - AC_MSG_CHECKING([for htonll]) - have_htoll="no" + AC_REQUIRE([AC_C_BIGENDIAN]) + AC_CACHE_CHECK([for htonll],[av_cv_have_htonll],[ + AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ + AC_LANG_PROGRAM([[ #include #include #include - ], [ + ]],[[ return htonll(0); - ]) + ]]) ], [ - have_htoll="yes" - AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll]) - ]) + ac_cv_have_htonll=yes + ],[ + ac_cv_have_htonll=no + ])]) - 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_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]) - ]) + AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[ + AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])]) + + AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"]) ]) -DETECT_BYTEORDER