A number of small build fixes found while looking at mingw support.
authorBrian Aker <brian@tangent.org>
Thu, 25 Oct 2012 06:28:22 +0000 (02:28 -0400)
committerBrian Aker <brian@tangent.org>
Thu, 25 Oct 2012 06:28:22 +0000 (02:28 -0400)
37 files changed:
ChangeLog
Makefile.am
bootstrap.sh
clients/memaslap.c
clients/ms_conn.c
clients/ms_task.c
clients/ms_thread.c
clients/utilities.h
configure.ac
libhashkit/common.h
libmemcached-1.0/platform.h
libmemcached-1.0/struct/server.h
libmemcached/assert.hpp
libmemcached/backtrace.cc
libmemcached/byteorder.cc
libmemcached/byteorder.h
libmemcached/common.h
libmemcached/connect.cc
libmemcached/csl/parser.yy
libmemcached/csl/scanner.l
libmemcached/server.hpp
libmemcachedprotocol/binary_handler.c
libmemcachedprotocol/handler.c
libmemcachedutil/common.h
libtest/cmdline.cc
libtest/cmdline.h
libtest/common.h
libtest/drizzled.h
libtest/gearmand.h
libtest/server.h
libtest/server_container.h
libtest/test.hpp
libtest/tmpfile.cc
m4/ax_compiler_version.m4
tests/memdump.cc
util/instance.hpp
win32/include.am

index ddb4be3b0d18b39f3fafb7772ee46ec390606b18..6679d8c91352c41e02c07b15dcfb635e7f290881 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+1.0.14 
+*
+
 1.0.13 Fri Oct 19 00:09:28 EDT 2012
 * Fix bug that caused version string to not be exported correctly.
 
index c6b23a43cfc23626799c154045b9d4b12e6e821d..dcf1519afed67a55aec43171dc82cd45036b552e 100644 (file)
@@ -39,17 +39,29 @@ include libtest/include.am
 
 include libhashkit-1.0/include.am
 include libmemcached-1.0/include.am
+
+if BUILD_LIBMEMCACHED_PROTOCOL
 include libmemcachedprotocol-0.0/include.am
+endif
+
 include libmemcachedutil-1.0/include.am
 
 include clients/include.am
 include docs/include.am
 include man/include.am
+
+if BUILD_LIBMEMCACHED_PROTOCOL
 include example/include.am
+endif
+
 include libhashkit/include.am
 include libmemcached/include.am
 include libmemcachedutil/include.am
+
+if BUILD_LIBMEMCACHED_PROTOCOL
 include libmemcachedprotocol/include.am
+endif
+
 include libmemcachedinternal/include.am
 include libmemcachedinternal/util/include.am
 include poll/include.am
@@ -128,5 +140,5 @@ maintainer-clean-local:
        -rmdir build-aux
 
 install-website: html-local
-       @rm -r -f /var/www/libmemcached/*
+       -rm -r -f /var/www/libmemcached/*
        @cp -r docs/html /var/www/libmemcached
index 00aed45aef2cb9c41157bdff096b005172cd9190..ad4751a6fad1cecde6f9cbdbd37a791d246b07a8 100755 (executable)
@@ -49,7 +49,7 @@ command_not_found_handle ()
   exit 127
 }
 
-die ()
+function die ()
 { 
   echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2
   exit 1; 
@@ -492,6 +492,26 @@ function make_for_snapshot ()
   snapshot_check
 }
 
+function make_for_mingw32 ()
+{
+  # Make sure it is clean
+  if [ -f Makefile -o -f configure ]; then
+    make_maintainer_clean
+  fi
+  assert_no_file 'Makefile'
+
+  if command_exists mingw32-configure; then
+    run_autoreconf
+
+    mingw32-configure || die 'mingw32-configure failed'
+    assert_file 'Makefile'
+
+    if command_exists mingw32-make; then
+      mingw32-make || die 'mingw32-make failed'
+    fi
+  fi
+}
+
 # If we are locally testing, we should make sure the environment is setup correctly
 function check_for_jenkins ()
 {
@@ -508,6 +528,17 @@ function check_for_jenkins ()
   fi
 }
 
+function make_universe ()
+{
+  make_for_snapshot
+  make_valgrind
+  make_gdb
+  make_rpm
+  make_for_mingw32
+  make_distcheck
+  make_install_system
+}
+
 function make_for_continuus_integration ()
 {
   # Setup the environment if we are local
@@ -663,8 +694,10 @@ function make_distcheck ()
 
 function make_rpm ()
 {
-  run_configure_if_required
-  make_target 'rpm'
+  if [ -f 'rpm.am' -o -d 'rpm' ]; then
+    run_configure_if_required
+    make_target 'rpm'
+  fi
 }
 
 function make_maintainer_clean ()
@@ -817,8 +850,14 @@ autoreconf_setup ()
       fi
     fi
     
+    if [ "$VCS_CHECKOUT" ]; then
+      if $DEBUG; then
+        MAKE="$MAKE --warn-undefined-variables"
+      fi
+    fi
+
     if $DEBUG; then
-      MAKE="$MAKE --warn-undefined-variables"
+      MAKE="$MAKE -d"
     fi
   fi
 
@@ -1008,6 +1047,10 @@ check_make_target()
       ;;
     'snapshot')
       ;;
+    'mingw')
+      ;;
+    'universe')
+      ;;
     'valgrind')
       ;;
     'jenkins')
@@ -1101,6 +1144,9 @@ function bootstrap ()
         make
         run_configure
         ;;
+      'mingw')
+        make_for_mingw32
+        ;;
       'snapshot')
         make_for_snapshot
         ;;
@@ -1110,6 +1156,9 @@ function bootstrap ()
       'valgrind')
         make_valgrind
         ;;
+      'universe')
+        make_universe
+        ;;
       'jenkins')
         make_for_continuus_integration
         ;;
index 8053775cb3bb6e4565636367c9290ac9a1504401..764707b5ab2b88b4a6e2084f64828a158fdeaada 100644 (file)
 #include <stdlib.h>
 #include <getopt.h>
 #include <limits.h>
-#if TIME_WITH_SYS_TIME
+
+#if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
 # include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
 
 
index b4d5f673d11df8ce616ec7494f1c3a4dc49faf76..2a65f6cfa423cf83951fba2c8e20db67789243ab 100644 (file)
 #include <netinet/tcp.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#if TIME_WITH_SYS_TIME
+
+#if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
 # include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
+
 #include "ms_setting.h"
 #include "ms_thread.h"
 #include "ms_atomic.h"
index 7e7921fcf2b9b6cc44e17c84bfd39e1b5461c20f..083b46f48d420fa86bc2de6b054e44ab852075a1 100644 (file)
 
 #include "config.h"
 
-#include <inttypes.h>
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
 # include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
 
 #include "ms_thread.h"
index 1efe5cfbb6f62df9dc8975033065d6ae933db002..2405e6adaa967ed4fdfbf688f5c8dc9ab3417fe4 100644 (file)
 
 #include "config.h"
 
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
 # include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
+
 #include "ms_thread.h"
 #include "ms_setting.h"
 #include "ms_atomic.h"
index da973b5f883fbc89da1c7bed04328dd2b5131a5d..a9f199d5e48115e13fb7cd817e02f81310615c0d 100644 (file)
 #include <libmemcached-1.0/memcached.h>
 #include "clients/client_options.h"
 
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
 # include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
 
+
 #ifdef __sun
   /* For some odd reason the option struct on solaris defines the argument
    * as char* and not const char*
index eb896f52d64f969f85099dcc27d719fe9ed8c15e..9e3f72aca16ec414d409aa08d761ee0fa5181ad7 100644 (file)
@@ -6,7 +6,7 @@
 # Use and distribution licensed under the BSD license.  See
 # the COPYING file in this directory for full text.
 
-AC_INIT([libmemcached],[1.0.13],[http://libmemcached.org/])
+AC_INIT([libmemcached],[1.0.14],[http://libmemcached.org/])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -59,6 +59,20 @@ AS_IF([ test "$ax_cv_cxx_stdcxx_98" = no ],[
        AC_MSG_ERROR([Your system lacks a new enough C++ compiler])
        ])
 
+AC_DEFUN([LIBMEMCACHED_PROTOCOL],
+         [AC_ARG_ENABLE([libmemcachedprotocol],
+                        [AS_HELP_STRING([--enable-libmemcachedprotocol],
+                                        [Enable libmemcachedprotocol])],
+                                        [ax_enable_libmemcachedprotocol=yes],
+                                        [ax_enable_libmemcachedprotocol=no])
+
+         AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
+
+         AC_MSG_CHECKING([for libmemcachedprotocol])
+         AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
+         ])
+LIBMEMCACHED_PROTOCOL
+
 # Adding support for libtest
 m4_include([libtest/yatl.m4])
 
@@ -103,12 +117,12 @@ AC_CHECK_HEADERS([fcntl.h])
 AC_CHECK_HEADERS([inttypes.h])
 AC_CHECK_HEADERS([libintl.h])
 AC_CHECK_HEADERS([limits.h])
-AC_CHECK_HEADERS([malloc.h])
 AC_CHECK_HEADERS([math.h])
 AC_CHECK_HEADERS([netdb.h])
 AC_CHECK_HEADERS([netinet/in.h])
 AC_CHECK_HEADERS([netinet/tcp.h])
 AC_CHECK_HEADERS([pthread.h])
+AC_CHECK_HEADERS([spawn.h])
 AC_CHECK_HEADERS([stdarg.h])
 AC_CHECK_HEADERS([stddef.h])
 AC_CHECK_HEADERS([stdio.h])
@@ -116,9 +130,13 @@ AC_CHECK_HEADERS([stdlib.h])
 AC_CHECK_HEADERS([sys/socket.h])
 AC_CHECK_HEADERS([sys/sysctl.h])
 AC_CHECK_HEADERS([sys/time.h])
+AC_CHECK_HEADERS([sys/un.h])
 AC_CHECK_HEADERS([time.h])
 AC_CHECK_HEADERS([unistd.h])
-AC_HEADER_TIME
+
+# Windows only
+AC_CHECK_HEADERS([winsock2.h])
+AC_CHECK_HEADERS([ws2tcpip.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 
@@ -146,8 +164,6 @@ AC_CHECK_FUNCS([strtoull])
 AC_FUNC_ALLOCA
 AC_FUNC_ERROR_AT_LINE
 AC_FUNC_FORK
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
 AC_FUNC_STRERROR_R
 
 AC_CHECK_HEADER([umem.h], [
index 5b0b8e0bb10f950db7895994f12a158522867398..e1343971942fbca6eb6d6b5e077aa356679f664a 100644 (file)
 extern "C" {
 #endif
 
-HASHKIT_LOCAL
 void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result);
 
-HASHKIT_LOCAL
 int update_continuum(hashkit_st *hashkit);
 
 #ifdef __cplusplus
index 763febaa2d8dcebb9ec6b542616c193c22bdad5e..6f43ca2cee560dbfe8b167e9e012d1820bc9e1ac 100644 (file)
@@ -46,11 +46,17 @@ typedef short in_port_t;
 typedef SOCKET memcached_socket_t;
 #else
 typedef int memcached_socket_t;
+
 #include <sys/socket.h>
+
 #include <netinet/in.h>
+
 #include <arpa/inet.h>
+
 #include <netdb.h>
+
 #include <sys/un.h>
+
 #include <netinet/tcp.h>
 
 #endif /* WIN32 */
index a8a30565bc3c8fcb7d60bf3acf49da48b37face4..33bdc0491eb8dd42b4a343812a4821f8efcd259b 100644 (file)
 
 #pragma once
 
-#ifndef WIN32
-#include <netdb.h>
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
 #endif
 
 #ifdef NI_MAXHOST
-#define MEMCACHED_NI_MAXHOST NI_MAXHOST
+# define MEMCACHED_NI_MAXHOST NI_MAXHOST
 #else
-#define MEMCACHED_NI_MAXHOST 1025
+# define MEMCACHED_NI_MAXHOST 1025
 #endif
 
 #ifdef NI_MAXSERV
-#define MEMCACHED_NI_MAXSERV NI_MAXSERV
+# define MEMCACHED_NI_MAXSERV NI_MAXSERV
 #else
-#define MEMCACHED_NI_MAXSERV 32
+# define MEMCACHED_NI_MAXSERV 32
 #endif
 
 enum memcached_server_state_t {
index 6858879c180faeddc8f33608224c2e5135d21593..28948c3c0cbfbb23f29fe5c51cbce2ddaff36275 100644 (file)
@@ -37,9 +37,6 @@
 
 #pragma once
 
-#include <cstdlib>
-#include <cstdio>
-
 #ifdef NDEBUG
 #define assert_msg(__expr, __mesg) (void)(__expr); (void)(__mesg);
 #else
index 81cfddefcc94d69fe014b3154f46c228b330ecdd..d297901615258460d6ace623259d90b9dd2009c5 100644 (file)
 
 #include <libmemcached/common.h>
 
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-
 #ifdef HAVE_EXECINFO_H
 #  include <execinfo.h>
 #endif
index 7e141756000cc3a5977e5405d9ff1335d77e4a3c..1a96d987e5a9bdf8c0871870a8f31a4127a6b5f3 100644 (file)
@@ -58,28 +58,21 @@ static inline uint64_t swap64(uint64_t in)
 }
 #endif
 
-#ifdef HAVE_HTONLL
 
 uint64_t memcached_ntohll(uint64_t value)
 {
+#ifdef HAVE_HTONLL
   return ntohll(value);
-}
-
-uint64_t memcached_htonll(uint64_t value)
-{
-  return htonll(value);
-}
-
-#else // HAVE_HTONLL
-
-uint64_t memcached_ntohll(uint64_t value)
-{
+#else
   return swap64(value);
+#endif
 }
 
 uint64_t memcached_htonll(uint64_t value)
 {
+#ifdef HAVE_HTONLL
+  return htonll(value);
+#else
   return swap64(value);
+#endif
 }
-
-#endif // HAVE_HTONLL
index 92687c1d7b6430223250938c9480b9d52f7dc159..a7d108d3a6c7c9b8fc2d2c0d5f17d38391754f4d 100644 (file)
 extern "C" {
 #endif
 
-LIBMEMCACHED_LOCAL
 uint64_t memcached_ntohll(uint64_t);
 
-LIBMEMCACHED_LOCAL
 uint64_t memcached_htonll(uint64_t);
 
 #ifdef __cplusplus
index 5c86eb16e01967360ccf3bef583e7a35cf66fb84..5a76faf6da938346e2330f860df5b52b6878ce0e 100644 (file)
 #include <config.h>
 
 #ifdef __cplusplus
-#  include <cstdio>
-#  include <cstdlib>
-#  include <cstring>
-#  include <ctime>
-#  include <cctype>
-#  include <cerrno>
-#  include <climits>
+# include <cstddef>
+# include <cstdio>
+# include <cstdlib>
+# include <cstring>
+# include <ctime>
+# include <cctype>
+# include <cerrno>
+# include <climits>
 #else
-#  ifdef HAVE_STDLIB_H
-#   include <stdio.h>
-#  endif
-#  ifdef HAVE_STDLIB_H
-#    include <stdlib.h>
-#  endif
-#  include <string.h>
+# ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+# endif
+# ifdef HAVE_STDLIB_H
+#  include <stdio.h>
+# endif
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+# include <string.h>
+# ifdef HAVE_TIME_H
 #  include <time.h>
-#  ifdef HAVE_ERRNO_H
-#    include <errno.h>
-#  endif
-#  ifdef HAVE_LIMITS_H
-#    include <limits.h>
-#  endif
+# endif
+# ifdef HAVE_ERRNO_H
+#  include <errno.h>
+# endif
+# ifdef HAVE_LIMITS_H
+#  include <limits.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
 #endif
 
 #ifdef HAVE_FCNTL_H
-#  include <fcntl.h>
+# include <fcntl.h>
 #endif
 
 #ifdef HAVE_SYS_TYPES_H
-#  include <sys/types.h>
+# include <sys/types.h>
 #endif
 
 #ifdef HAVE_UNISTD_H
-#  include <unistd.h>
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
 #endif
 
 #ifdef HAVE_STRINGS_H
-#  include <strings.h>
+# include <strings.h>
 #endif
 
 #ifdef HAVE_DLFCN_H
-#  include <dlfcn.h>
+# include <dlfcn.h>
 #endif
 
 #include <libmemcached-1.0/memcached.h>
index 65be51a07f9a2c509f7dba7bc6c11043e358bc1a..4e7e24bf48c47e9f1d5c4fcdadbf9611c7810742 100644 (file)
 #include <libmemcached/common.h>
 
 #include <cassert>
-#include <ctime>
-#include <sys/time.h>
 
 #ifndef SOCK_CLOEXEC 
 #  define SOCK_CLOEXEC 0
 #endif
 
 #ifndef SOCK_NONBLOCK 
-#  define SOCK_NONBLOCK 0
+# define SOCK_NONBLOCK 0
 #endif
 
 #ifndef FD_CLOEXEC
index 486fb4b346efa9ddf0dc60126908fb5d83ed778e..4fed2754d84ac3dcf728e305757abc85d9449bb5 100644 (file)
@@ -96,14 +96,14 @@ inline void __config_error(Context *context, yyscan_t *scanner, const char *erro
 
 %token COMMENT
 %token END
-%token ERROR
+%token CSL_ERROR
 %token RESET
 %token PARSER_DEBUG
 %token INCLUDE
 %token CONFIGURE_FILE
 %token EMPTY_LINE
 %token SERVER
-%token SOCKET
+%token CSL_SOCKET
 %token SERVERS
 %token SERVERS_OPTION
 %token UNKNOWN_OPTION
@@ -165,13 +165,13 @@ inline void __config_error(Context *context, yyscan_t *scanner, const char *erro
 %token RANDOM
 
 /* Boolean values */
-%token <boolean> TRUE
-%token <boolean> FALSE
+%token <boolean> CSL_TRUE
+%token <boolean> CSL_FALSE
 
 %nonassoc ','
 %nonassoc '='
 
-%token <number> FLOAT
+%token <number> CSL_FLOAT
 %token <number> NUMBER
 %token <number> PORT
 %token <number> WEIGHT_START
@@ -208,7 +208,7 @@ statement:
             context->set_end();
             YYACCEPT;
           }
-        | ERROR
+        | CSL_ERROR
           {
             context->rc= MEMCACHED_PARSE_USER_ERROR;
             parser_abort(context, "ERROR called directly");
@@ -252,7 +252,7 @@ expression:
             }
             context->unset_server();
           }
-        | SOCKET string optional_weight
+        | CSL_SOCKET string optional_weight
           {
             if (memcached_failed(context->rc= memcached_server_add_unix_socket_with_weight(context->memc, $2.c_str, uint32_t($3))))
             {
index 5a3419069faf4aa04e663ae64a808b07e821c00f..e35008a8da37f768e1f5c62206b84738a6098f33 100644 (file)
@@ -67,9 +67,6 @@
 
 
 %{
-#include <cstdlib>
-#include <cstring>
-
 #define PARAM yyget_extra(yyscanner)
 
 #define get_lex_chars(buffer, result, max_size, context) \
 
 "--SERVER="                          { yyextra->begin= yytext; yyextra->set_server(); return yyextra->previous_token= SERVER; }
 
-"--SOCKET="                          { yyextra->begin= yytext; return yyextra->previous_token= SOCKET; }
+"--SOCKET="                          { yyextra->begin= yytext; return yyextra->previous_token= CSL_SOCKET; }
 
 "--BINARY-PROTOCOL"                    { yyextra->begin= yytext; return yyextra->previous_token= BINARY_PROTOCOL; }
 "--BUFFER-REQUESTS"                    { yyextra->begin= yytext; return yyextra->previous_token= BUFFER_REQUESTS; }
@@ -172,10 +169,10 @@ RESET           { yyextra->begin= yytext; return yyextra->previous_token= RESET;
 DEBUG           { yyextra->begin= yytext; return yyextra->previous_token= PARSER_DEBUG; }
 SERVERS           { yyextra->begin= yytext; return yyextra->previous_token= SERVERS; }
 END           { yyextra->begin= yytext; return yyextra->previous_token= END; }
-ERROR           { yyextra->begin= yytext; return yyextra->previous_token= ERROR; }
+CSL_ERROR           { yyextra->begin= yytext; return yyextra->previous_token= CSL_ERROR; }
 
-TRUE           { return yyextra->previous_token= TRUE; }
-FALSE           { return yyextra->previous_token= FALSE; }
+TRUE           { return yyextra->previous_token= CSL_TRUE; }
+FALSE           { return yyextra->previous_token= CSL_FALSE; }
 
 
 "--"[[:alnum:]]*   {
index 351b34be02260bcae879bd47dc5b919e5fdb4585..8cbdc15108b243a1029a8f2ba93648cccab00027 100644 (file)
@@ -60,12 +60,12 @@ void __server_free(memcached_server_st *);
 
 static inline bool memcached_is_valid_servername(const memcached_string_t& arg)
 {
-  return (arg.c_str != NULL or arg.size == 0) and arg.size < NI_MAXHOST;
+  return (arg.c_str != NULL or arg.size == 0) and arg.size < MEMCACHED_NI_MAXHOST;
 }
 
 static inline bool memcached_is_valid_filename(const memcached_string_t& arg)
 {
-  return arg.c_str != NULL and arg.size > 0 and arg.size < NI_MAXHOST;
+  return arg.c_str != NULL and arg.size > 0 and arg.size < MEMCACHED_NI_MAXHOST;
 }
 
 void memcached_instance_free(org::libmemcached::Instance *);
index d720424a9cc82aac7fc197ef01614809da60654f..851c87510581a20be01fec9738c75a8c75f22a1e 100644 (file)
@@ -76,7 +76,7 @@ static protocol_binary_response_status raw_response_handler(const void *cookie,
     return PROTOCOL_BINARY_RESPONSE_EINTERNAL;
   }
 
-  size_t len= sizeof(protocol_binary_response_header) + htonl(response->response.bodylen);
+  size_t len= sizeof(protocol_binary_response_header) + memcached_htonl(response->response.bodylen);
   size_t offset= 0;
   char *ptr= (void*)response;
 
index 59b461f6aa083b286c8e6e619ab8382e352437f5..2a6390551c9a95c0f43e391d6a593b91e5b6e3e5 100644 (file)
@@ -46,6 +46,9 @@
 #include <ctype.h>
 #include <stdio.h>
 
+#include <sys/types.h>
+#include <sys/socket.h>
+
 /*
 ** **********************************************************************
 ** INTERNAL INTERFACE
index 5c7b59f4a4b6b3002b16a8c153f7ac641f1a1e9c..ec00877a6dfe951d3a88fb787defaaf0eac7dd12 100644 (file)
 
 #pragma once
 
-#include <config.h>
+#include "config.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <cstdio>
 
 #include <libmemcachedutil-1.0/util.h>
 #include <libmemcached/assert.hpp>
index d4dd970b9ebf47e0694ee2cb484b492bac5fd4bc..ce98acb16fba7ab884d8fe71a0042e6637fbd6b8 100644 (file)
@@ -45,8 +45,6 @@ using namespace libtest;
 #include <fcntl.h>
 #include <fstream>
 #include <memory>
-#include <poll.h>
-#include <spawn.h>
 #include <sstream>
 #include <string>
 #include <sys/stat.h>
@@ -435,7 +433,7 @@ Application::error_t Application::join()
       }
 
       _app_exit_state= Application::SIGTERM_KILLED;
-      Error << "waitpid() application terminated at request"
+      Out << "waitpid() application terminated at request"
         << " pid:" << _pid 
         << " name:" << built_argv[0];
     }
index ae4d9ba1d67751f73315277095642842d2d53ed7..ca7098dd722343823e223cb932f6dbdead0615c5 100644 (file)
 
 #pragma once
 
-#include <spawn.h>
+#ifdef HAVE_SPAWN_H
+# include <spawn.h>
+#endif
+
+/*
+  http://www.gnu.org/software/automake/manual/automake.html#Tests
+  When no test protocol is in use, an exit status of 0 from a test script will denote a success, an exit status of 77 a skipped test, an exit status of 99 an hard error, and any other exit status will denote a failure.
+*/
 
-// http://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol
 #define EXIT_SKIP 77
-#define EXIT_FATAL 77
+#define EXIT_FATAL 99
 
 #ifndef EX_NOEXEC
-#  define EX_NOEXEC 126
+# define EX_NOEXEC 126
 #endif
 
 #ifndef EX_NOTFOUND
-#  define EX_NOTFOUND 127
+# define EX_NOTFOUND 127
 #endif
 
 namespace libtest {
index 4d8d5724ce5c7e4aa5ea1134fa49362e201fc28b..20b482586402820dcf041e7e78665eb6a00575c1 100644 (file)
 #include <fnmatch.h>
 #endif
 
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#else
+# include "poll/poll.h"
+#endif
+
+#ifdef HAVE_SPAWN_H
+# include <spawn.h>
+#endif
+
 #include <libtest/test.hpp>
 
 #include <libtest/is_pid.hpp>
index c3e3055acca010a46397107d9d3aad6d775510c1..3bc3755597add48a74982bfb750189806befc547 100644 (file)
@@ -36,8 +36,6 @@
 
 #pragma once
 
-#include <arpa/inet.h>
-
 namespace libtest { struct Server; }
 
 namespace libtest {
index 49c08c9f6b723e50b01fd3b7586bbe59dc2593cf..ef14ce6352153b5ad02731ffb3e61a9072e4b65c 100644 (file)
@@ -36,8 +36,6 @@
 
 #pragma once
 
-#include <arpa/inet.h>
-
 namespace libtest { struct Server; }
 
 namespace libtest {
index f27ce08f7455066598b6ac333b7eef079cdcc1a9..c4e7579cf8975b33838b64641f3abb1bb56fa7d9 100644 (file)
 #include <cassert>
 #include <cstdio>
 #include <cstring>
-#include <netdb.h>
-#include <netinet/in.h>
+
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
 #include <string>
 #include <unistd.h>
 #include <vector>
index b8743033ed85bd98fc29468d20a36249caa24de5..6eadc6d57e31416664ae11c2cabb95a595e1cf76 100644 (file)
@@ -39,8 +39,7 @@
 #include <cassert>
 #include <cstdio>
 #include <cstring>
-#include <netdb.h>
-#include <netinet/in.h>
+
 #include <string>
 #include <unistd.h>
 #include <vector>
index bdcccdc02b113fbee0e2e3fd036449a49ea700fd..576f3014990deedfd78ab27308f3d51f91d3dff7 100644 (file)
 
 #include <cstdio>
 #include <cstdlib>
-#include <arpa/inet.h>
+
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
 
 #include <libtest/visibility.h>
 #include <libtest/version.h>
index d2457e2bd41ca16cdbf58ea3d1540095be70b5fe..a576a4a16f315a894eaeb7e63504368b91f257a1 100644 (file)
@@ -34,6 +34,7 @@
  *
  */
 
+#include "config.h"
 #include <libtest/common.h>
 
 namespace libtest {
index a277a9e7a7c12458da1782888a565f922a41c12a..da897bc23e7b2a11e805d2eeb3e02f0b95bf7175 100644 (file)
@@ -4,8 +4,8 @@
 #
 # SYNOPSIS
 #
-#   AX_C_COMPILER_VERSION
-#   AX_CXX_COMPILER_VERSION
+#   AX_C_COMPILER_VERSION()
+#   AX_CXX_COMPILER_VERSION()
 #
 # DESCRIPTION
 #
 #  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#serial 3
+#serial 4
 
   AC_DEFUN([AX_C_COMPILER_VERSION],[
       AC_REQUIRE([AX_COMPILER_VENDOR])
-      AC_MSG_CHECKING("C Compiler version")
+      AC_MSG_CHECKING([C Compiler version])
 
-      AC_CHECK_DECL([__GNUC_PATCHLEVEL__],[GNUCC="yes"], [GNUCC="no"])
-      AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"],[SUNCC="no"])
-      AC_CHECK_DECL([__ICC], [INTELCC="yes"],[INTELCC="no"])
-      AC_CHECK_DECL([__clang__], [CLANG="yes"],[CLANG="no"])
+      ax_cv_c_compiler_version_vendor="$ax_cv_c_compiler_vendor"
 
-      ax_cc_version=unknown
-      AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$SUNCC" = "yes"],[ax_cc_version=`$CC -V 2>&1 | sed 1q`])])
-      AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$CLANG" = "yes"],[ax_cc_version=`$CC --version 2>&1 | sed 1q` ])])
-      AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$INTELCC" = "yes"],[ax_cc_version=`$CC --version 2>&1 | sed 1q` ])])
-      AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$GNUCC" = "yes"],[ax_cc_version=`$CC --version | sed 1q` ])])
+      AC_CHECK_DECL([__GNUC_PATCHLEVEL__],[
+        GNUCC=yes
+        ],[GNUCC=no])
+      AC_MSG_CHECKING([GNUCC])
+      AC_MSG_RESULT([$GNUCC])
 
-      AC_MSG_RESULT(["$ax_cc_version"])
-      AC_SUBST([CC_VERSION],["$ax_cc_version"])
+      AC_CHECK_DECL([__SUNPRO_C],[SUNCC=yes],[SUNCC=no])
+      AC_MSG_CHECKING([SUNCC])
+      AC_MSG_RESULT([$SUNCC])
+
+      AC_CHECK_DECL([__ICC],[INTELCC=yes],[INTELCC=no])
+      AC_MSG_CHECKING([INTELCC])
+      AC_MSG_RESULT([$INTELCC])
+
+      AC_CHECK_DECL([__clang__],[CLANG=yes],[CLANG=no])
+      AC_MSG_CHECKING([CLANG])
+      AC_MSG_RESULT([$CLANG])
+
+      AC_CHECK_DECL([__MINGW32__],[
+        MINGW=yes
+        ax_cv_c_compiler_version_vendor=mingw
+        ],[MINGW=no])
+      AC_MSG_CHECKING([MINGW])
+      AC_MSG_RESULT([$MINGW])
+
+      AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
+        sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],[
+        intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
+        clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
+        gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],[
+        mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],[
+        ax_c_compiler_version=unknown])
+
+      AC_MSG_RESULT(["$ax_c_compiler_version"])
+      AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
+      AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
       ])
 
-  AC_DEFUN([AX_CXX_COMPILER_VERSION], [
+  AC_DEFUN([AX_CXX_COMPILER_VERSION],[
       AC_REQUIRE([AX_C_COMPILER_VERSION])
-      AC_MSG_CHECKING("C++ Compiler version")
+      AC_MSG_CHECKING([C++ Compiler version])
 
-      ax_cxx_version=unknown
-      AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$GNUCC" = "yes"],[ax_cxx_version=`$CXX --version | sed 1q`])])
-      AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$SUNCC" = "yes"],[ax_cxx_version=`$CXX -V 2>&1 | sed 1q`])])
-      AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$CLANG" = "yes"],[ax_cxx_version=`$CXX --version 2>&1 | sed 1q`])])
-      AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$INTELCC" = "yes"],[ax_cc_version=`$CCX --version 2>&1 | sed 1q` ])])
+      AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
+        sun],[ax_cxx_compiler_version=`$CC -V 2>&1 | sed 1q`],[
+        intel],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
+        clang],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
+        gnu],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
+        mingw],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
+        ax_cxx_compiler_version=unknown])
 
-      AC_MSG_RESULT(["$ax_cxx_version"])
-      AC_SUBST([CXX_VERSION], ["$ax_cxx_version"])
+      AC_MSG_RESULT(["$ax_cxx_compiler_version"])
+      AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
+      AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
       ])
index 840c1a17fd63d6e078d7db1b4c576d702e866b89..f044844d07339477767b70d1609063d16bf3c412 100644 (file)
@@ -121,6 +121,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error)
   if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
   {
     error= TEST_FAILURE;
+    return NULL;
   }
 
   return &servers;
index bd9aeaa4a90507b3105df56e241f039e59654d56..1855ef8db2e592f19899f217f7529efca9f416f1 100644 (file)
@@ -37,7 +37,6 @@
 
 #pragma once
 
-#include <arpa/inet.h>
 #include <cstdio>
 #include <cerrno>
 #include <cassert>
index 43e8d9b180d83c5b19436d14e2e2f6c641d1aef3..9552bc73ff3c5f93cc942830fdfb904c379dbad9 100644 (file)
@@ -6,6 +6,8 @@ noinst_HEADERS+= win32/wrappers.h
 if BUILD_WIN32_WRAPPERS
 libhashkit_libhashkit_la_LDFLAGS+=-no-undefined
 libmemcached_libmemcached_la_LDFLAGS+=-no-undefined
+if BUILD_LIBMEMCACHED_PROTOCOL
 libmemcached_libmemcachedprotocol_la_LDFLAGS+=-no-undefined
+endif
 libmemcached_libmemcachedutil_la_LDFLAGS+=-no-undefined
 endif