+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.
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
-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
exit 127
}
-die ()
+function die ()
{
echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2
exit 1;
}
+function nassert ()
+{
+ local param_name=\$"$1"
+ local param_value=`eval "expr \"$param_name\" "`
+
+ if [ -n "$param_value" ]; then
+ echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2
+ exit 1
+ fi
+}
+
function assert ()
{
local param_name=\$"$1"
local param_value=`eval "expr \"$param_name\" "`
if [ -z "$param_value" ]; then
- echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name)" >&2
+ echo "$bash_source:$bash_lineno: assert($param_name)" >&2
exit 1
fi
}
fi
}
-safe_pushd ()
+function safe_pushd ()
{
pushd $1 &> /dev/null ;
fi
}
-safe_popd ()
+function safe_popd ()
{
local directory_to_delete=`pwd`
popd &> /dev/null ;
fi
}
-make_valgrind ()
+function make_valgrind ()
{
if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then
make_darwin_malloc
push_TESTS_ENVIRONMENT
+ # If we don't have a configure, then most likely we will be missing libtool
+ assert_file 'configure'
if [[ -f 'libtool' ]]; then
- TESTS_ENVIRONMENT="$LIBTOOL_COMMAND $VALGRIND_COMMAND"
+ TESTS_ENVIRONMENT="./libtool --mode=execute $VALGRIND_COMMAND"
else
TESTS_ENVIRONMENT="$VALGRIND_COMMAND"
fi
pop_TESTS_ENVIRONMENT
}
-make_install_system ()
+function make_install_system ()
{
local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
push_PREFIX_ARG $INSTALL_LOCATION
safe_popd
}
-make_darwin_malloc ()
+function make_darwin_malloc ()
{
run_configure_if_required
MallocScribble=$old_MallocScribble
}
-snapshot_check ()
+function snapshot_check ()
{
if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
}
# This will reset our environment, and make sure built files are available.
-make_for_snapshot ()
+function make_for_snapshot ()
{
# Make sure it is clean
make_maintainer_clean
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
-check_for_jenkins ()
+function check_for_jenkins ()
{
if ! $jenkins_build_environment; then
echo "Not inside of jenkins"
fi
}
-make_for_continuus_integration ()
+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
check_for_jenkins
make_install_system
;;
*)
- run_configure
- make_all
+ make_jenkins_default
;;
esac
safe_popd
}
-make_gdb ()
+# The point to this test is to test bootstrap.sh itself
+function self_test ()
+{
+ # We start off with a clean env
+ make_maintainer_clean
+
+ eval "./bootstrap.sh jenkins" || die "failed 'jenkins'"
+ eval "./bootstrap.sh all" || die "failed 'all'"
+ eval "./bootstrap.sh gdb" || die "failed 'gdb'"
+ eval "./bootstrap.sh maintainer-clean" || die "failed 'maintainer-clean'"
+}
+
+function make_gdb ()
{
run_configure_if_required
setup_gdb_command
fi
- if [ -f 'libtool' ]; then
- TESTS_ENVIRONMENT="$LIBTOOL_COMMAND $GDB_COMMAND"
+ # If we don't have a configure, then most likely we will be missing libtool
+ assert_file 'configure'
+ if [[ -f 'libtool' ]]; then
+ TESTS_ENVIRONMENT="./libtool --mode=execute $GDB_COMMAND"
else
TESTS_ENVIRONMENT="$GDB_COMMAND"
fi
# $1 target to compile
# $2 to die, or not to die, based on contents
-make_target ()
+function make_target ()
{
if [[ -z "$1" ]]; then
die "Programmer error, no target provided for make"
fi
}
-make_distcheck ()
+function make_distcheck ()
{
make_target 'distcheck'
}
-make_rpm ()
+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
}
-make_maintainer_clean ()
+function make_maintainer_clean ()
{
run_configure_if_required
make_target 'maintainer-clean' 'no_error'
}
-make_check ()
+function make_check ()
{
make_target 'check'
}
-make_all ()
+function make_jenkins_default ()
{
+ run_configure
make_target 'all'
}
-run_configure_if_required ()
+function make_default ()
+{
+ run_configure_if_required
+ make_target 'all'
+}
+
+function run_configure_if_required ()
{
run_autoreconf_if_required
assert_file 'Makefile' 'configure did not produce a Makefile'
}
-run_autoreconf_if_required ()
+function run_autoreconf_if_required ()
{
if [ ! -x 'configure' ]; then
run_autoreconf
assert_exec_file 'configure'
}
-run_autoreconf ()
+function run_autoreconf ()
{
if [[ -z "$AUTORECONF" ]]; then
die "Programmer error, tried to call run_autoreconf () but AUTORECONF was not set"
parse_command_line_options ()
{
- local SHORTOPTS=':apcmt:dv'
+ local SHORTOPTS=':apcmt:dvh'
+
+ nassert MAKE_TARGET
while getopts "$SHORTOPTS" opt; do
case $opt in
DEBUG_OPTION=true
enable_debug
;;
+ h) # help
+ echo "bootstrap.sh [options] optional_target ..."
+ exit
+ ;;
v) # verbose
VERBOSE_OPTION=true
VERBOSE=true
esac
done
+ shift $((OPTIND-1))
+
if [ -n "$1" ]; then
- MAKE_TARGET="$1"
+ MAKE_TARGET="$@"
fi
}
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
check_make_target()
{
case $1 in
+ 'self')
+ ;;
'gdb')
;;
'clean_op')
;;
'configure')
;;
- 'rpm')
+ 'distcheck')
+ ;;
+ 'check')
;;
'snapshot')
;;
+ 'mingw')
+ ;;
+ 'universe')
+ ;;
'valgrind')
;;
'jenkins')
;;
'all')
;;
+ 'test-*')
+ ;;
+ 'valgrind-*')
+ ;;
+ 'gdb-*')
+ ;;
'dist')
;;
*)
esac
}
-bootstrap ()
+function bootstrap ()
{
determine_target_platform
# Set up whatever we need to do to use autoreconf later
autoreconf_setup
+ if [ -z "$MAKE_TARGET" ]; then
+ MAKE_TARGET="make_default"
+ fi
+
if $PRINT_SETUP_OPTION -o $DEBUG; then
echo
print_setup
fi
fi
- # Setup LIBTOOL_COMMAND if we need it
- if [ -f 'libtool' ]; then
- LIBTOOL_COMMAND='./libtool --mode=execute'
- fi
-
# Use OLD_TESTS_ENVIRONMENT for tracking the state of the variable
local OLD_TESTS_ENVIRONMENT=
push_PREFIX_ARG $PREFIX
fi
- # Either we run a known target (or error), or we default to "all"
- if [[ -n "$MAKE_TARGET" ]]; then
+ # We should always have a target by this point
+ assert MAKE_TARGET
+ local MAKE_TARGET_ARRAY=($MAKE_TARGET)
+
+ for target in "${MAKE_TARGET_ARRAY[@]}"
+ do
# If we are running inside of Jenkins, we want to only run some of the possible tests
if $jenkins_build_environment; then
- check_make_target $MAKE_TARGET
+ check_make_target $target
fi
- case $MAKE_TARGET in
+ case $target in
+ 'self')
+ self_test
+ ;;
'gdb')
make_gdb
;;
'configure')
run_configure
;;
+ 'default')
+ make
+ run_configure
+ ;;
+ 'mingw')
+ make_for_mingw32
+ ;;
'snapshot')
make_for_snapshot
;;
'valgrind')
make_valgrind
;;
+ 'universe')
+ make_universe
+ ;;
'jenkins')
make_for_continuus_integration
;;
*)
run_configure_if_required
- make_target $MAKE_TARGET
+ make_target "$target"
;;
esac
- else
- run_configure_if_required
- make_all
- fi
+ done
}
main ()
rebuild_host_os no_output
+ parse_command_line_options $@
+
# If we are running under Jenkins we predetermine what tests we will run against
# This MAKE_TARGET can be overridden by parse_command_line_options based MAKE_TARGET changes.
# We don't want Jenkins overriding other variables, so we NULL them.
- if $jenkins_build_environment; then
+ if [ -z "$MAKE_TARGET" -a $jenkins_build_environment ]; then
MAKE_TARGET='jenkins'
fi
- parse_command_line_options $@
-
bootstrap
jobs -l
#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
#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"
#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"
#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"
#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*
# 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])
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])
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])
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.
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], [
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
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 */
#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 {
#pragma once
-#include <cstdlib>
-#include <cstdio>
-
#ifdef NDEBUG
#define assert_msg(__expr, __mesg) (void)(__expr); (void)(__mesg);
#else
#include <libmemcached/common.h>
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#endif
}
#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
extern "C" {
#endif
-LIBMEMCACHED_LOCAL
uint64_t memcached_ntohll(uint64_t);
-LIBMEMCACHED_LOCAL
uint64_t memcached_htonll(uint64_t);
#ifdef __cplusplus
#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>
#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
%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
%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
context->set_end();
YYACCEPT;
}
- | ERROR
+ | CSL_ERROR
{
context->rc= MEMCACHED_PARSE_USER_ERROR;
parser_abort(context, "ERROR called directly");
}
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))))
{
%{
-#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; }
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:]]* {
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 *);
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;
#include <ctype.h>
#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
/*
** **********************************************************************
** INTERNAL INTERFACE
#pragma once
-#include <config.h>
+#include "config.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <cstdio>
#include <libmemcachedutil-1.0/util.h>
#include <libmemcached/assert.hpp>
#include <fcntl.h>
#include <fstream>
#include <memory>
-#include <poll.h>
-#include <spawn.h>
#include <sstream>
#include <string>
#include <sys/stat.h>
}
_app_exit_state= Application::SIGTERM_KILLED;
- Error << "waitpid() application terminated at request"
+ Out << "waitpid() application terminated at request"
<< " pid:" << _pid
<< " name:" << built_argv[0];
}
#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 {
#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>
#pragma once
-#include <arpa/inet.h>
-
namespace libtest { struct Server; }
namespace libtest {
#pragma once
-#include <arpa/inet.h>
-
namespace libtest { struct Server; }
namespace libtest {
#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>
#include <cassert>
#include <cstdio>
#include <cstring>
-#include <netdb.h>
-#include <netinet/in.h>
+
#include <string>
#include <unistd.h>
#include <vector>
#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>
*
*/
+#include "config.h"
#include <libtest/common.h>
namespace libtest {
#
# 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"])
])
%exclude %{_libdir}/libmemcached.la
%exclude %{_libdir}/libhashkit.la
%exclude %{_libdir}/libmemcachedutil.la
-%exclude %{_libdir}/libmemcachedprotocol.la
%exclude %{_libdir}/libmemcached.a
%exclude %{_libdir}/libhashkit.a
%exclude %{_libdir}/libmemcachedutil.a
-%exclude %{_libdir}/libmemcachedprotocol.a
%{_libdir}/libhashkit.so.2.0.0
%{_libdir}/libmemcached.so.11.0.0
%{_libdir}/libmemcachedutil.so.2.0.0
-%{_libdir}/libmemcachedprotocol.so.0.0.0
%{_libdir}/libhashkit.so.2
%{_libdir}/libmemcached.so.11
-%{_libdir}/libmemcachedprotocol.so.0
%{_libdir}/libmemcachedutil.so.2
%{_mandir}/man1/memaslap.1.gz
%{_mandir}/man1/memcapable.1.gz
%{_includedir}/libhashkit-1.0/types.h
%{_includedir}/libhashkit-1.0/visibility.h
-%{_includedir}/libmemcachedprotocol-0.0/binary.h
-%{_includedir}/libmemcachedprotocol-0.0/callback.h
-%{_includedir}/libmemcachedprotocol-0.0/handler.h
-%{_includedir}/libmemcachedprotocol-0.0/vbucket.h
-
%{_includedir}/libmemcachedutil-1.0/util.h
%{_includedir}/libmemcachedutil-1.0/flush.h
%{_includedir}/libmemcachedutil-1.0/pid.h
%{_libdir}/libhashkit.so
%{_libdir}/libmemcached.so
-%{_libdir}/libmemcachedprotocol.so
%{_libdir}/libmemcachedutil.so
%{_libdir}/pkgconfig/libmemcached.pc
%{_mandir}/man3/hashkit_clone.3.gz
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, 0 };
- test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
+ test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
return TEST_SUCCESS;
}
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_SUCCESS, rc);
- test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
+ test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
memcached_free(memc);
if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
+ return NULL;
}
return &servers;
#pragma once
-#include <arpa/inet.h>
#include <cstdio>
#include <cerrno>
#include <cassert>
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