-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 <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
- ], [
+ ], [
+ 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"])
+ if test "x$have_htoll" == "xno"
+ then
+ AC_MSG_CHECKING([byteorder])
+ have_htoll="no"
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <inttypes.h>
+ ], [
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]))
+ fi
+])
+
+DETECT_BYTEORDER
memcached_verbosity.c \
memcached_version.c \
murmur_hash.c \
- jenkins_hash.c \
- byteorder.c
+ jenkins_hash.c
+
+if BUILD_BYTEORDER
+libmemcached_la_SOURCES += byteorder.c
+endif
libmemcached_la_DEPENDENCIES = @DTRACE_OBJ@
libmemcached_la_LIBADD = @DTRACE_OBJ@
uint32_t generate_hash(memcached_st *ptr, const char *key, size_t key_length);
memcached_return memcached_server_remove(memcached_server_st *st_ptr);
+#ifndef HAVE_HTONLL
extern uint64_t ntohll(uint64_t);
extern uint64_t htonll(uint64_t);
+#endif
memcached_return memcached_purge(memcached_server_st *ptr);