AM_CONDITIONAL(BUILD_WIN32_WRAPPERS, test "x$ac_cv_header_winsock2_h" = "xyes")
AS_IF(test "x$ac_cv_header_winsock2_h" = "xyes",
AM_LDFLAGS="$AM_LDFLAGS -lws2_32")
-
-#
-# Some platforms define EWOULDBLOCK == EAGAIN, causing our switch for error
-# codes to be illegal (POSIX.1-2001 allows both return codes from recv, so
-# we need to test both if they differ...)
-#
-AC_MSG_CHECKING([if EWOULDBLOCK == EAGAIN])
-AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([
-#include <errno.h>
- ], [dnl
- return EAGAIN == EWOULDBLOCK ? 0 : 1;
- ])
- ],[
- AC_MSG_RESULT([yes])
- ], [
- AC_MSG_RESULT([no])
- AC_DEFINE([USE_EAGAIN], [1], [Define to true if you need to test for eagain])
- ])
+DETECT_EAGAIN
AC_CONFIG_FILES([
Makefile
AC_DEFUN([DETECT_BYTEORDER],
[
AC_REQUIRE([AC_C_BIGENDIAN])
- AC_CACHE_CHECK([for htonll],[av_cv_have_htonll],[
-
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
+ AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll],
+ [AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
- ]],[[
- return htonll(0);
- ]])
- ], [
- ac_cv_have_htonll=yes
- ],[
- ac_cv_have_htonll=no
- ])])
-
+ ], [
+return htonll(0);
+ ],
+ [ ac_cv_have_htonll=yes ],
+ [ ac_cv_have_htonll=no ])
+ ])
AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[
- AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])
+ AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])])
AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"])
])
-
--- /dev/null
+#
+# Some platforms define EWOULDBLOCK == EAGAIN, causing our switch for error
+# codes to be illegal (POSIX.1-2001 allows both return codes from recv, so
+# we need to test both if they differ...)
+#
+AC_DEFUN([DETECT_EAGAIN],
+[
+ AC_CACHE_CHECK([if EWOULDBLOCK == EAGAIN],[av_cv_eagain_ewouldblock],
+ [AC_TRY_COMPILE([
+#include <errno.h>
+ ], [
+int error = EAGAIN;
+switch (error)
+{
+ case EAGAIN:
+ case EWOULDBLOCK:
+ error = 1;
+ break;
+ default:
+ error = 0;
+}
+ ],
+ [ av_cv_eagain_ewouldblock=no ],
+ [ av_cv_eagain_ewouldblock=yes ])
+ ])
+ AS_IF([test "x$ac_cv_eagain_ewouldblock" = "xyes"],[
+ AC_DEFINE([USE_EAGAIN], [1], [Define to true if you need to test for eagain])])
+])
dnl ---------------------------------------------------------------------------
dnl Macro: PROTOCOL_BINARY_TEST
dnl ---------------------------------------------------------------------------
+
AC_DEFUN([PROTOCOL_BINARY_TEST],
- [AC_LANG_PUSH([C])
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -I${srcdir}"
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
+[
+ AC_CACHE_CHECK([for supported struct padding], [ac_cv_supported_struct_padding], [
+ AC_LANG_PUSH([C])
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -I${srcdir}"
+ AC_TRY_COMPILE([
#include <inttypes.h>
#include "libmemcached/memcached/protocol_binary.h"
- ]],[[
+ ], [
protocol_binary_request_set request;
- if (sizeof(request) != sizeof(request.bytes)) {
- return 1;
+ int a = 1;
+ switch (a) {
+ case sizeof(request):
+ case sizeof(request.bytes):
+ break;
+ default:
+ a = 2;
}
- ]])],, AC_MSG_ERROR([Unsupported struct padding done by compiler.]))
+ ],
+ [ ac_cv_supported_struct_padding=no ],
+ [ ac_cv_supported_struct_padding=yes ])
CFLAGS="$save_CFLAGS"
AC_LANG_POP
+ ])
+ AS_IF([test "x$ac_cv_supported_struct_padding" = "xno"],[
+ AC_MSG_ERROR([Unsupported struct padding done by compiler.])])
])
dnl ---------------------------------------------------------------------------
dnl Macro: SETSOCKOPT_SANITY
dnl ---------------------------------------------------------------------------
AC_DEFUN([SETSOCKOPT_SANITY],[
+ AC_CACHE_CHECK([for working SO_SNDTIMEO], [ac_cv_have_so_sndtimeo],
AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
}
return 0;
]])],
- [AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])])
+ [ac_cv_have_so_sndtimeo=yes],
+ [ac_cv_have_so_sndtimeo=no],
+ [ac_cv_have_so_sndtimeo=yes])
+ AS_IF([test "x$ac_cv_have_so_sndtimeo" = "xyes"], [
+ AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])])
+ AC_LANG_POP
+ )
+
+ AC_CACHE_CHECK([for working SO_RCVTIMEO], [ac_cv_have_so_rcvtimeo],
+ AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
- ]],[[
+ ]],[[
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct timeval waittime;
}
}
return 0;
- ]])], [AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])])
+ ]])],
+ [ac_cv_have_so_rcvtimeo=yes],
+ [ac_cv_have_so_rcvtimeo=no],
+ [ac_cv_have_so_rcvtimeo=yes])
- AC_LANG_POP
+ AS_IF([test "x$ac_cv_have_so_rcvtimeo" = "xyes"], [
+ AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])])
+ AC_LANG_POP
+ )
])
dnl ---------------------------------------------------------------------------
dnl End Macro: SETSOCKOPT_SANITY