From: Brian Aker Date: Mon, 2 Aug 2010 18:33:16 +0000 (-0700) Subject: Merge Trond X-Git-Tag: 0.44~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9c7e4d791a127f8ae46aaddc531319da1f34b5ba;hp=03982cb00168ed0b3fc06d063c29076a9ffe1699;p=awesomized%2Flibmemcached Merge Trond --- diff --git a/.bzrignore b/.bzrignore index f428ca67..0579973b 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,3 +1,4 @@ +*.exe *.lo *.pop */*.l[oa] diff --git a/configure.ac b/configure.ac index 0a2df059..a2faafd6 100644 --- a/configure.ac +++ b/configure.ac @@ -139,26 +139,11 @@ AC_CHECK_HEADERS_ONCE(winsock2.h poll.h sys/wait.h fnmatch.h) AM_CONDITIONAL(BUILD_POLL, test "x$ac_cv_header_poll_h" = "xno") 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 - ], [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]) - ]) + [AM_LDFLAGS="$AM_LDFLAGS -lws2_32" + AM_CFLAGS="$AM_CFLAGS $NO_WERROR" + AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR" + ]) +DETECT_EAGAIN AC_CONFIG_FILES([ Makefile diff --git a/libmemcached/protocol/ascii_handler.c b/libmemcached/protocol/ascii_handler.c index 6f5102b0..87a0edb1 100644 --- a/libmemcached/protocol/ascii_handler.c +++ b/libmemcached/protocol/ascii_handler.c @@ -146,8 +146,8 @@ ascii_get_response_handler(const void *cookie, if (client->ascii_command == GETS_CMD) { - snprintf(dest, sizeof(buffer) - used, " %u %u %llu\r\n", flags, - bodylen, (unsigned long long)cas); + snprintf(dest, sizeof(buffer) - used, " %u %u %" PRIu64 "\r\n", flags, + bodylen, cas); } else { @@ -440,8 +440,7 @@ static void process_arithmetic(memcached_protocol_client_st *client, if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { char buffer[80]; - snprintf(buffer, sizeof(buffer), "%llu\r\n", - (unsigned long long)result); + snprintf(buffer, sizeof(buffer), "%"PRIu64"\r\n", result); spool_string(client, buffer); } else diff --git a/m4/byteorder.m4 b/m4/byteorder.m4 index 4692bbd2..32431798 100644 --- a/m4/byteorder.m4 +++ b/m4/byteorder.m4 @@ -1,25 +1,19 @@ 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_LINK([ #include #include #include - ]],[[ - 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"]) ]) - diff --git a/m4/eagain.m4 b/m4/eagain.m4 new file mode 100644 index 00000000..3ba8c23f --- /dev/null +++ b/m4/eagain.m4 @@ -0,0 +1,28 @@ +# +# 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 + ], [ +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])]) +]) diff --git a/m4/protocol_binary.m4 b/m4/protocol_binary.m4 index ba7acaf5..5c00b556 100644 --- a/m4/protocol_binary.m4 +++ b/m4/protocol_binary.m4 @@ -1,22 +1,34 @@ 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 #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 --------------------------------------------------------------------------- diff --git a/m4/setsockopt.m4 b/m4/setsockopt.m4 index e37fe2ae..58c61c0a 100644 --- a/m4/setsockopt.m4 +++ b/m4/setsockopt.m4 @@ -2,6 +2,7 @@ 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([[ @@ -25,8 +26,17 @@ AC_DEFUN([SETSOCKOPT_SANITY],[ } 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 @@ -34,7 +44,7 @@ AC_DEFUN([SETSOCKOPT_SANITY],[ #include #include #include - ]],[[ + ]],[[ int sock = socket(AF_INET, SOCK_STREAM, 0); struct timeval waittime; @@ -48,9 +58,15 @@ AC_DEFUN([SETSOCKOPT_SANITY],[ } } 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 diff --git a/win32/wrappers.h b/win32/wrappers.h index 20218fd5..80b44651 100644 --- a/win32/wrappers.h +++ b/win32/wrappers.h @@ -12,6 +12,8 @@ #ifndef WIN32_WRAPPERS_H #define WIN32_WRAPPERS_H 1 +#include + /* * One of the Windows headers define interface as a macro, but that * is causing problems with the member named "interface" in some of the @@ -19,6 +21,10 @@ */ #undef interface +#undef malloc +#undef realloc + + /* * WinSock use a separate range for error codes. Let's just map to the * WinSock ones.