+0.31
+ * Added support or HA via replication.
+ * malloc() removed for server key usage.
+ * Update build system.
* Added support for memcached_set_memory_allocators().
* Fixed bug in configure.ac for have_htoll.
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = docs libmemcached libmemcachedutil tests support clients
+SUBDIRS = docs libmemcached libmemcachedutil support clients tests
EXTRA_dist = README.FIRST
check-local: test-no-outputdiff
-LDADDS = $(top_builddir)/libmemcached/libmemcached.la
+LDADDS = $(top_builddir)/libmemcached/libmemcached.la libutilities.la
bin_PROGRAMS = memcat memdump memcp memstat memrm memflush memslap memerror
generator.h \
execute.h
-memcat_SOURCES = memcat.c utilities.c
+noinst_LTLIBRARIES= libutilities.la libgenexec.la
+
+libutilities_la_SOURCES= utilities.c
+libgenexec_la_SOURCES= generator.c execute.c
+
+memcat_SOURCES = memcat.c
memcat_LDADD = $(LDADDS)
memcat_LDFLAGS = -rpath $(pkglibdir)
-memcp_SOURCES = memcp.c utilities.c
+memcp_SOURCES = memcp.c
memcp_LDADD = $(LDADDS)
memcp_LDFLAGS = -rpath $(pkglibdir)
-memdump_SOURCES = memdump.c utilities.c
+memdump_SOURCES = memdump.c
memdump_LDADD = $(LDADDS)
memdump_LDFLAGS = -rpath $(pkglibdir)
-memstat_SOURCES = memstat.c utilities.c
+memstat_SOURCES = memstat.c
memstat_LDADD = $(LDADDS)
memstat_LDFLAGS = -rpath $(pkglibdir)
-memrm_SOURCES = memrm.c utilities.c
+memrm_SOURCES = memrm.c
memrm_LDADD = $(LDADDS)
memrm_LDFLAGS = -rpath $(pkglibdir)
-memflush_SOURCES = memflush.c utilities.c
+memflush_SOURCES = memflush.c
memflush_LDADD = $(LDADDS)
memflush_LDFLAGS = -rpath $(pkglibdir)
-memerror_SOURCES = memerror.c utilities.c
+memerror_SOURCES = memerror.c
memerror_LDADD = $(LDADDS)
memerror_LDFLAGS = -rpath $(pkglibdir)
-memslap_SOURCES = memslap.c utilities.c generator.c execute.c
-memslap_LDADD = $(LDADDS) -lpthread
-memslap_LDFLAGS = -rpath $(pkglibdir)
+memslap_SOURCES = memslap.c
+memslap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
+memslap_LDADD = $(LDADDS) $(PTHREAD_LIBS) libgenexec.la
+memslap_LDFLAGS = $(AM_LDFLAGS) -rpath $(pkglibdir)
test-start-server:
memflush --servers=localhost
-#!/usr/bin/env bash
+#!/bin/sh
# Taken from lighthttpd server (BSD). Thanks Jan!
# Run this to generate all the initial makefiles, etc.
die() { echo "$@"; exit 1; }
-# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
+# --force means overwrite ltmain.sh script if it already exists
LIBTOOLIZE_FLAGS=" --automake --copy --force"
-# ACLOCAL=${ACLOCAL:-aclocal}
-ACLOCAL_FLAGS="-I m4"
-# AUTOHEADER=${AUTOHEADER:-autoheader}
-# AUTOMAKE=${AUTOMAKE:-automake}
+# --add-missing instructs automake to install missing auxiliary files
+# and --force to overwrite them if they already exist
AUTOMAKE_FLAGS="--add-missing --copy --force"
-# AUTOCONF=${AUTOCONF:-autoconf}
+ACLOCAL_FLAGS="-I m4"
ARGV0=$0
ARGS="$@"
-
run() {
echo "$ARGV0: running \`$@' $ARGS"
$@ $ARGS
}
-## jump out if one of the programs returns 'false'
-set -e
+# Try to locate a program by using which, and verify that the file is an
+# executable
+locate_binary() {
+ for f in $@
+ do
+ file=`which $f 2>/dev/null | grep -v '^no '`
+ if test -n "$file" -a -x "$file"; then
+ echo $file
+ return 0
+ fi
+ done
+
+ echo ""
+ return 1
+}
-## We do not currently support glibtoolize
+# Try to detect the supported binaries if the user didn't
+# override that by pushing the environment variable
if test x$LIBTOOLIZE = x; then
- if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
- LIBTOOLIZE=glibtoolize
- elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
- LIBTOOLIZE=libtoolize-1.5
- elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
- LIBTOOLIZE=libtoolize
- else
- echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
+ LIBTOOLIZE=`locate_binary glibtoolize libtoolize-1.5 libtoolize`
+ if test x$LIBTOOLIZE = x; then
+ die "Did not find a supported libtoolize"
fi
fi
-## suse has aclocal and aclocal-1.9
if test x$ACLOCAL = x; then
- if test \! "x`which aclocal-1.10 2> /dev/null | grep -v '^no'`" = x; then
- ACLOCAL=aclocal-1.10
- elif test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
- ACLOCAL=aclocal-1.9
- elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
- ACLOCAL=aclocal19
- elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
- ACLOCAL=aclocal
- else
- echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
+ ACLOCAL=`locate_binary aclocal-1.10 aclocal-1.9 aclocal19 aclocal`
+ if test x$ACLOCAL = x; then
+ die "Did not find a supported aclocal"
fi
fi
if test x$AUTOMAKE = x; then
- if test \! "x`which automake-1.10 2> /dev/null | grep -v '^no'`" = x; then
- AUTOMAKE=automake-1.10
- elif test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
- AUTOMAKE=automake-1.9
- elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
- AUTOMAKE=automake19
- elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
- AUTOMAKE=automake
- else
- echo "automake 1.9.x wasn't found, exiting"; exit 0
+ AUTOMAKE=`locate_binary automake-1.10 automake-1.9 automake19 automake`
+ if test x$AUTOMAKE = x; then
+ die "Did not find a supported automake"
fi
fi
-
-## macosx has autoconf-2.59 and autoconf-2.60
if test x$AUTOCONF = x; then
- if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
- AUTOCONF=autoconf-2.59
- elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
- AUTOCONF=autoconf259
- elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
- AUTOCONF=autoconf
- else
- echo "autoconf 2.59+ wasn't found, exiting"; exit 0
+ AUTOCONF=`locate_binary autoconf-2.59 autoconf259 autoconf`
+ if test x$AUTOCONF = x; then
+ die "Did not find a supported autoconf"
fi
fi
if test x$AUTOHEADER = x; then
- if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
- AUTOHEADER=autoheader-2.59
- elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
- AUTOHEADER=autoheader259
- elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
- AUTOHEADER=autoheader
- else
- echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
+ AUTOHEADER=`locate_binary autoheader-2.59 autoheader259 autoheader`
+ if test x$AUTOHEADER = x; then
+ die "Did not find a supported autoheader"
fi
fi
-
-# --force means overwrite ltmain.sh script if it already exists
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
-
run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
run $AUTOHEADER || die "Can't execute autoheader"
-
-# --add-missing instructs automake to install missing auxiliary files
-# and --force to overwrite them if they already exist
run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
run $AUTOCONF || die "Can't execute autoconf"
-echo -n "Automade with: "
-$AUTOMAKE --version | head -1
-echo -n "Configured with: "
-$AUTOCONF --version | head -1
-
+echo "---"
+echo "Configured with the following tools:"
+echo " * `$LIBTOOLIZE --version | head -1`"
+echo " * `$ACLOCAL --version | head -1`"
+echo " * `$AUTOHEADER --version | head -1`"
+echo " * `$AUTOMAKE --version | head -1`"
+echo " * `$AUTOCONF --version | head -1`"
+echo "---"
# libmemcached
-# Copyright (C) 2008 Brian Aker
+# Copyright (C) 2008 Brian Aker, Monty Taylor
# All rights reserved.
#
# Use and distribution licensed under the BSD license. See
AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
+PANDORA_CANONICAL_TARGET
+
#shared library versioning
MEMCACHED_LIBRARY_VERSION=2:0:0
# | | |
MEMCACHEDUTIL_LIBRARY_VERSION=0:0:0
AC_SUBST(MEMCACHEDUTIL_LIBRARY_VERSION)
-# Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
-SAVE_CFLAGS=${CFLAGS}
-SAVE_CXXFLAGS=${CXXFLAGS}
-CFLAGS=
-CXXFLAGS=
-
-AC_CANONICAL_TARGET
-
-CFLAGS=${SAVE_CFLAGS}
-CXXFLAGS=${SAVE_CXXFLAGS}
-
-AM_INIT_AUTOMAKE([-Wall -Werror nostdinc subdir-objects])
-
-if test "x${enable_dependency_tracking}" = "x"
-then
- enable_dependency_tracking=yes
-fi
-
-if test -d "${srcdir}/.bzr"
-then
- building_from_bzr=yes
-else
- building_from_bzr=no
-fi
-
-AC_PROG_CXX
-
-ACX_USE_SYSTEM_EXTENSIONS
-
-AC_PROG_CPP
-AM_PROG_CC_C_O
-
-FORCE_MAC_GCC42
-dnl Once we can use a modern autoconf, we can use this
-dnl AC_PROG_CC_C99
-
-AC_C_BIGENDIAN
-AC_C_CONST
-AC_HEADER_TIME
-AC_TYPE_SIZE_T
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-
-AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
-
-# We use libtool
-AC_PROG_LIBTOOL
-
-AC_MSG_CHECKING("C Compiler version")
-if test "$GCC" = "yes"
-then
- CC_VERSION=`$CC --version | sed 1q`
-elif test "$SUNCC" = "yes"
-then
- CC_VERSION=`$CC -V 2>&1 | sed 1q`
-else
- CC_VERSION=""
-fi
-AC_MSG_RESULT("$CC_VERSION")
-AC_SUBST(CC_VERSION)
# libmemcached versioning when linked with GNU ld.
if test "$lt_cv_prog_gnu_ld" = "yes"
AC_SUBST(LD_VERSION_SCRIPT)
AC_SUBST(LD_UTIL_VERSION_SCRIPT)
-gl_VISIBILITY
-
-# Build optimized or debug version ?
-# First check for gcc and g++
-if test "$GCC" = "yes"
-then
-
- dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
- dnl with using AC_CC_STD_C99 above
- CC="${CC} -std=gnu99"
-
- CFLAGS="-ggdb3 ${CFLAGS}"
- CXXFLAGS="-ggdb3 ${CXXFLAGS}"
-
- DEBUG_CFLAGS="-O0"
- DEBUG_CXXFLAGS="-O0"
-
- OPTIMIZE_CFLAGS="-O3"
- OPTIMIZE_CXXFLAGS="-O3"
-fi
-if test "x$SUNCC" = "xyes"
-then
- dnl Once we can use a modern autoconf, we can replace the -xc99=all here
- dnl with using AC_CC_STD_C99 above
- CC="${CC} -xc99=all"
-
- CFLAGS="-g -mt ${CFLAGS}"
- CXXFLAGS="-xlang=c99 -g -mt -compat=5 -library=stlport4 -template=no%extdef ${CXXFLAGS}"
-
- OPTIMIZE_FLAGS="-xO4 -xlibmil -xdepend -xbuiltin"
- OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS} -Xa -xstrconst"
- OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}"
-
-fi
-
-ENABLE_64BIT
#--------------------------------------------------------------------
# Check for libpthread
dnl Specialty checks
DETECT_BYTEORDER
ENABLE_UTILLIB
-ENABLE_DTRACE
SETSOCKOPT_SANITY
ENABLE_HSIEH_HASH
REQUIRE_POD2MAN
WITH_MEMCACHED
ENABLE_DEPRECATED
-dnl TODO: Remove this define once we are using 2.61 across the board.
-# AX_HEADER_ASSERT
-# ----------------
-# Check whether to enable assertions.
-AC_DEFUN([AX_HEADER_ASSERT],
-[
- AC_MSG_CHECKING([whether to enable assertions])
- AC_ARG_ENABLE([assert],
- [AS_HELP_STRING([--disable-assert],
- [Turn off assertions])],
- [ac_cv_assert="no"],
- [ac_cv_assert="yes"])
- AC_MSG_RESULT([$ac_cv_assert])
-])
-AX_HEADER_ASSERT
-
-
-AC_ARG_WITH([debug],
- [AS_HELP_STRING([--with-debug],
- [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
- [with_debug=$withval],
- [with_debug=no])
-if test "$with_debug" = "yes"
-then
- # Debugging. No optimization.
- CFLAGS="${DEBUG_CFLAGS} -DDEBUG ${CFLAGS}"
- CXXFLAGS="${DEBUG_CXXFLAGS} -DDEBUG ${CXXFLAGS}"
-else
- # Optimized version. No debug
- CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS}"
- CXXFLAGS="${OPTIMIZE_CXXFLAGS} ${CXXFLAGS}"
-fi
-
-AC_ARG_ENABLE([profiling],
- [AS_HELP_STRING([--enable-profiling],
- [Toggle profiling @<:@default=off@:>@])],
- [ac_profiling="$enableval"],
- [ac_profiling="no"])
-
-AC_ARG_ENABLE([coverage],
- [AS_HELP_STRING([--enable-coverage],
- [Toggle coverage @<:@default=off@:>@])],
- [ac_coverage="$enableval"],
- [ac_coverage="no"])
-
-if test "$GCC" = "yes"
-then
-
- AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
- [ac_cv_safe_to_use_fdiagnostics_show_option_],
- [save_CFLAGS="$CFLAGS"
- CFLAGS="-fdiagnostics-show-option ${CFLAGS}"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([],[])],
- [ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
- [ac_cv_safe_to_use_fdiagnostics_show_option_=no])
- CFLAGS="$save_CFLAGS"])
-
- AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"],
- [
- F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
- ])
-
- AC_CACHE_CHECK([whether it is safe to use -Wconversion],
- [ac_cv_safe_to_use_wconversion_],
- [save_CFLAGS="$CFLAGS"
- CFLAGS="-Werror -Wconversion ${CFLAGS}"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
-#include <stdbool.h>
-void foo(bool a)
-{
- (void)a;
-}
- ]],[[
-foo(0);
- ]])],
- [ac_cv_safe_to_use_wconversion_=yes],
- [ac_cv_safe_to_use_wconversion_=no])
- CFLAGS="$save_CFLAGS"])
-
- AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
- [W_CONVERSION="-Wconversion"
- AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
- [ac_cv_safe_to_use_Wconversion_],
- [save_CFLAGS="$CFLAGS"
- CFLAGS="-Werror -Wconversion ${CFLAGS}"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <netinet/in.h>
- ]],[[
-uint16_t x= htons(80);
- ]])],
- [ac_cv_safe_to_use_Wconversion_=yes],
- [ac_cv_safe_to_use_Wconversion_=no])
- CFLAGS="$save_CFLAGS"])
-
- AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
- [
- NO_CONVERSION="-Wno-conversion"
- ])
- ])
-
- AS_IF([test "$ac_profiling" = "yes"],
- [CC_PROFILING="-pg"])
-
- AS_IF([test "$ac_coverage" = "yes"],
- [CC_COVERAGE="-fprofile-arcs -ftest-coverage"])
-
- AS_IF([test "$building_from_bzr" = "yes"],
- [W_FAIL=""])
- #[W_FAIL="-Werror"])
-
- BASE_WARNINGS="-pedantic -Wall -Wextra ${W_FAIL} -Wundef -Wshadow -Wmissing-declarations -Wstrict-aliasing -Wformat=2 ${F_DIAGNOSTICS_SHOW_OPTION} ${W_CONVERSION} ${CFLAG_VISIBILITY}"
- CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wswitch-default -Wswitch-enum -Wcast-align"
- CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Weffc++ -Wno-long-long"
-
- AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
- [ac_cv_safe_to_use_Wlogical_op_],
- [save_CFLAGS="$CFLAGS"
- CFLAGS="-Wlogical-op"
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM(
- [[
-#include <stdio>
- ]], [[]])
- ],
- [ac_cv_safe_to_use_Wlogical_op_=yes],
- [ac_cv_safe_to_use_Wlogical_op_=no])
- CFLAGS="$save_CFLAGS"])
- AS_IF([test "$ac_cv_safe_to_use_Wlogical_op_" = "yes"],
- [CC_WARNINGS="${CC_WARNINGS} -Wlogical-op"])
-
- AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls from C++],
- [ac_cv_safe_to_use_Wredundant_decls_],
- [AC_LANG_PUSH(C++)
- save_CXXFLAGS="${CXXFLAGS}"
- CXXFLAGS="${CXXFLAGS} ${W_FAIL} -Wredundant-decls"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
-template <typename E> struct C { void foo(); };
-template <typename E> void C<E>::foo() { }
-template <> void C<int>::foo();
- AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_use_Wredundant_decls_=yes],
- [ac_cv_safe_to_use_Wredundant_decls_=no])
- CXXFLAGS="${save_CXXFLAGS}"
- AC_LANG_POP()])
- AS_IF([test "$ac_cv_safe_to_use_Wredundant_decls_" = "yes"],
- [CXX_WARNINGS="${CXX_WARNINGS} -Wredundant-decls"],
- [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
-
- NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing"
- NO_REDUNDANT_DECLS="-Wno-redundant-decls"
-fi
-if test "$SUNCC" = "yes"
-then
-
- AS_IF([test "$ac_profiling" = "yes"],
- [CC_PROFILING="-xinstrument=datarace"])
-
- AS_IF([test "$building_from_bzr" = "yes"],
- [W_FAIL="-errwarn=%all"])
-
- AC_CACHE_CHECK([whether E_PASTE_RESULT_NOT_TOKEN is usable],
- [ac_cv_paste_result],
- [
- save_CFLAGS="${CFLAGS}"
- CFLAGS="-errwarn=%all -erroff=E_PASTE_RESULT_NOT_TOKEN ${CFLAGS}"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
- AC_INCLUDES_DEFAULT
- ],[
- int x= 0;])],
- [ac_cv_paste_result=yes],
- [ac_cv_paste_result=no])
- CFLAGS="${save_CFLAGS}"
- ])
- AS_IF([test $ac_cv_paste_result = yes],
- [W_PASTE_RESULT=",E_PASTE_RESULT_NOT_TOKEN"])
-
-
- CC_WARNINGS="-v -errtags=yes ${W_FAIL} -erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}"
- CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${W_FAIL}"
-fi
-
-AC_SUBST(NO_CONVERSION)
-AC_SUBST(NO_REDUNDANT_DECLS)
-AC_SUBST(NO_STRICT_ALIASING)
-
-AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
-AM_CFLAGS="${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE} ${CFLAGS}"
-AM_CXXFLAGS="${CXX_WARNING} ${CC_PROFILING} ${CC_COVERAGE} ${CXXFLAGS}"
-
-AC_SUBST([AM_CPPFLAGS])
-AC_SUBST([AM_CFLAGS])
-AC_SUBST([AM_CXXFLAGS])
-
-dnl We've collected the flags in AM_*FLAGS now, so blank these.
-CFLAGS=""
-CXXFLAGS=""
-CPPFLAGS=""
AC_CONFIG_FILES([
Makefile
echo " * C Compiler: $CC_VERSION"
echo " * Assertions enabled: $ac_cv_assert"
echo " * Debug enabled: $with_debug"
-echo " * Warnings as failure: $building_from_bzr"
+echo " * Warnings as failure: $ac_cv_warnings_as_errors"
echo ""
echo "---"
memcached_analyze.pod\
memcached_generate_hash_value.pod\
memcached_memory_allocators.pod\
- memory_user_data.pod
+ memcached_user_data.pod
man_MANS = libmemcached.3\
libmemcached_examples.3\
EXTRA_DIST = libmemcached_probes.d memcached/README.txt libmemcached.ver \
memcached_configure.h.in
-BUILT_SOURCES= @DTRACE_HEADER@
-
EXTRA_HEADERS =
-DTRACE = @DTRACE@
-DTRACEFLAGS = @DTRACEFLAGS@
+BUILT_SOURCES=
noinst_HEADERS = libmemcached_probes.h \
memcached_io.h \
memcached_internal.h \
common.h \
- memcached/protocol_binary.h @DTRACE_HEADER@
+ memcached/protocol_binary.h
pkginclude_HEADERS= memcached.h \
memcached.hh \
memcached_watchpoint.h \
visibility.h
+
if BUILD_LIBMEMCACHEDUTIL
pkginclude_HEADERS+= memcached_util.h memcached_pool.h
endif
jenkins_hash.c \
memcached_allocators.c
+
if INCLUDE_HSIEH_SRC
libmemcached_la_SOURCES += hsieh_hash.c
endif
libmemcached_la_SOURCES += byteorder.c
endif
-libmemcached_la_DEPENDENCIES = @DTRACE_OBJ@ libmemcachedcallbacks.la
-libmemcached_la_LIBADD = @DTRACE_OBJ@ $(LIBM) libmemcachedcallbacks.la
+libmemcached_la_DEPENDENCIES= libmemcachedcallbacks.la
+libmemcached_la_LIBADD= $(LIBM) libmemcachedcallbacks.la
libmemcached_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION) $(LD_VERSION_SCRIPT) $(LIBM)
-dtrace_probes.h: libmemcached_probes.d
- $(DTRACE) $(DTRACEFLAGS) -o dtrace_probes.tmp -h -s libmemcached_probes.d
- sed "s/#include <unistd.h>//g" dtrace_probes.tmp > dtrace_probes.h
- rm dtrace_probes.tmp
+if HAVE_DTRACE
+BUILT_SOURCES+= dtrace_probes.h
+libmemcached_la_SOURCES += libmemcached_probes.d
+endif
+
+if DTRACE_NEEDS_OBJECTS
+libmemcached_la_DEPENDENCIES += libmemcached_probes.o
+endif
+SUFFIXES= .d
-# So libtool doesn't support dtrace, but just copy one of the existing
-# lo-file and replace the file name ;-)
-libmemcached_probes.lo: libmemcached_probes.o
- sed "s,jenkins_hash,libmemcached_probes,g" jenkins_hash.lo > libmemcached_probes.lo
+dtrace_probes.h: libmemcached_probes.d
+ $(DTRACE) $(DTRACEFLAGS) -h -o dtrace_probes.h -s libmemcached_probes.d
-libmemcached_probes.o: $(libmemcached_la_OBJECTS)
- $(DTRACE) $(DTRACEFLAGS) -o .libs/libmemcached_probes.o -G -s libmemcached_probes.d `grep pic_object *.lo | cut -f 2 -d\' | grep -v non_pic_object`
+libmemcached_probes.o: libmemcached_probes.d $(libmemcached_la_OBJECTS)
+ $(DTRACE) $(DTRACEFLAGS) -o .libs/libmemcached_probes.o -G -s libmemcached_probes.d `grep '^pic_object' *.lo | cut -f 2 -d\'`
$(DTRACE) $(DTRACEFLAGS) -o libmemcached_probes.o -G -s libmemcached_probes.d `grep non_pic_object *.lo | cut -f 2 -d\' `
provider libmemcached {
probe memcached_delete_start();
probe memcached_delete_end();
+ probe memcached_increment_with_initial_start();
+ probe memcached_increment_with_initial_end();
+ probe memcached_decrement_with_initial_start();
+ probe memcached_decrement_with_initial_end();
probe memcached_increment_start();
probe memcached_increment_end();
probe memcached_decrement_start();
value, value_length, 0, 0);
}
memcached_return cas(const char *key, const char *value,
- size_t value_length, uint64_t cas)
+ size_t value_length, uint64_t cas_arg)
{
return memcached_cas(&memc, key, strlen(key),
- value, value_length, 0, 0, cas);
+ value, value_length, 0, 0, cas_arg);
}
memcached_return cas_by_key(const char *master_key, const char *key,
const char *value, size_t value_length,
- uint64_t cas)
+ uint64_t cas_arg)
{
return memcached_cas_by_key(&memc,
master_key, strlen(master_key),
key, strlen(key),
value, value_length,
- 0, 0, cas);
+ 0, 0, cas_arg);
}
// using 'remove' vs. 'delete' since 'delete' is a keyword
memcached_return remove(const char *key)
#include "common.h"
static memcached_return ascii_dump(memcached_st *ptr, memcached_dump_func *callback, void *context, uint32_t number_of_callbacks)
{
- memcached_return rc;
+ memcached_return rc= 0;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
size_t send_length;
uint32_t server_key;
+++ /dev/null
-dnl ---------------------------------------------------------------------------
-dnl Macro: ENABLE_64BIT
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([ENABLE_64BIT],[
-
- AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
- AS_IF([test "x$ISAINFO" != "xno"],
- [isainfo_b=`${ISAINFO} -b`],
- [isainfo_b="x"])
-
- AS_IF([test "$isainfo_b" != "x"],
- [AC_ARG_ENABLE([64bit],
- [AS_HELP_STRING([--disable-64bit],
- [Build 64 bit binary @<:@default=on@:>@])],
- [ac_enable_64bit="$enableval"],
- [ac_enable_64bit="yes"])])
-
- AS_IF([test "x$ac_enable_64bit" = "xyes"],[
- if test "x$libdir" = "x\${exec_prefix}/lib" ; then
- # The user hasn't overridden the default libdir, so we'll
- # the dir suffix to match solaris 32/64-bit policy
- isainfo_k=`${ISAINFO} -k`
- libdir="${libdir}/${isainfo_k}"
- fi
- CFLAGS="-m64 $CFLAGS"
- CXXFLAGS="-m64 $CXXFLAGS"
- if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"
- then
- CFLAGS="-xmemalign=8s $CFLAGS"
- CXXFLAGS="-xmemalign=8s $CXXFLAGS"
- fi
- ])
-])
-dnl ---------------------------------------------------------------------------
-dnl End Macro: ENABLE_64BIT
-dnl ---------------------------------------------------------------------------
--- /dev/null
+# ===========================================================================
+# http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AC_CXX_COMPILE_STDCXX_0X
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++0x
+# standard.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AC_DEFUN([AC_CXX_COMPILE_STDCXX_0X], [
+ AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
+ ac_cv_cxx_compile_cxx0x_native,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
+ AC_LANG_RESTORE
+ ])
+
+ AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
+ ac_cv_cxx_compile_cxx0x_cxx,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=c++0x"
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+
+ AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
+ ac_cv_cxx_compile_cxx0x_gxx,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+
+ if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
+ test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
+ test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
+ AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
+ fi
+])
--- /dev/null
+dnl Copyright © 2008 Benjamin Kosnik <bkoz@redhat.com>
+
+dnl Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
+
+
+AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [
+ AC_CACHE_CHECK(for ISO C++ 98 include files,
+ ac_cv_cxx_stdcxx_98,
+ [AC_LANG_PUSH(C++)
+ AC_TRY_COMPILE([
+ #include <cassert>
+ #include <cctype>
+ #include <cerrno>
+ #include <cfloat>
+ #include <ciso646>
+ #include <climits>
+ #include <clocale>
+ #include <cmath>
+ #include <csetjmp>
+ #include <csignal>
+ #include <cstdarg>
+ #include <cstddef>
+ #include <cstdio>
+ #include <cstdlib>
+ #include <cstring>
+ #include <ctime>
+
+ #include <algorithm>
+ #include <bitset>
+ #include <complex>
+ #include <deque>
+ #include <exception>
+ #include <fstream>
+ #include <functional>
+ #include <iomanip>
+ #include <ios>
+ #include <iosfwd>
+ #include <iostream>
+ #include <istream>
+ #include <iterator>
+ #include <limits>
+ #include <list>
+ #include <locale>
+ #include <map>
+ #include <memory>
+ #include <new>
+ #include <numeric>
+ #include <ostream>
+ #include <queue>
+ #include <set>
+ #include <sstream>
+ #include <stack>
+ #include <stdexcept>
+ #include <streambuf>
+ #include <string>
+ #include <typeinfo>
+ #include <utility>
+ #include <valarray>
+ #include <vector>
+ ],,
+ ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
+ AC_LANG_POP()
+ ])
+ if test "$ac_cv_cxx_stdcxx_98" = yes; then
+ AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
+ fi
+])
+++ /dev/null
-AC_DEFUN([FORCE_MAC_GCC42],
- [AS_IF([test "$GCC" = "yes"],[
- dnl If you're on a Mac, and you didn't ask for a specific compiler
- dnl You're gonna get 4.2.
- AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
- AS_IF([test -f /usr/bin/gcc-4.2],
- [
- CPP="/usr/bin/gcc-4.2 -E"
- CC=/usr/bin/gcc-4.2
- CXX=/usr/bin/g++-4.2
- ])
- ])
- ])
-])
-
-AC_DEFUN([CHECK_GCC_VERSION],[
- AC_REQUIRE([FORCE_MAC_GCC42])
- AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
-# error GCC is Too Old!
-#endif
- ]])],
- [ac_cv_gcc_recent=yes],
- [ac_cv_gcc_recent=no])])
- AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
- AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2]))
- AS_IF([test "$drizzle_cv_gcc_recent" = "no"],
- AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required]))
-])
+++ /dev/null
-dnl ---------------------------------------------------------------------------
-dnl Macro: ENABLE_DTRACE
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([ENABLE_DTRACE],[
- AC_ARG_ENABLE([dtrace],
- [AS_HELP_STRING([--enable-dtrace],
- [Build with support for the DTRACE. @<:@default=off@:>@])],
- [ac_cv_enable_dtrace="yes"],
- [ac_cv_enable_dtrace="no"])
-
- if test "$ac_cv_enable_dtrace" = "yes"
- then
- AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH])
- if test "x$DTRACE" != "xno"; then
- AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support])
- DTRACE_HEADER=dtrace_probes.h
-
- # DTrace on MacOSX does not use -G option
- $DTRACE -G -o conftest.$$ -s libmemcached/libmemcached_probes.d 2>/dev/zero
- if test $? -eq 0
- then
- DTRACE_OBJ=libmemcached_probes.lo
- rm conftest.$$
- fi
-
- ac_cv_enable_dtrace="yes"
- AC_SUBST(HAVE_DTRACE)
- else
- AC_MSG_ERROR([Need dtrace binary and OS support.])
- fi
- fi
-
- AC_SUBST(DTRACEFLAGS)
- AC_SUBST(DTRACE_HEADER)
- AC_SUBST(DTRACE_OBJ)
- AM_CONDITIONAL([HAVE_DTRACE], [ test "$ac_cv_enable_dtrace" = "yes" ])
-])
-dnl ---------------------------------------------------------------------------
-dnl End Macro: ENABLE_DTRACE
-dnl ---------------------------------------------------------------------------
# AC_DEFINE. The goal here is to define all known feature-enabling
# macros, then, if reports of conflicts are made, disable macros that
# cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl ---------------------------------------------------------------------------
+dnl Macro: PANDORA_64BIT
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([PANDORA_64BIT],[
+
+ AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
+ AS_IF([test "x$ISAINFO" != "xno"],
+ [isainfo_b=`${ISAINFO} -b`],
+ [isainfo_b="x"])
+
+ AS_IF([test "$isainfo_b" != "x"],
+ [AC_ARG_ENABLE([64bit],
+ [AS_HELP_STRING([--disable-64bit],
+ [Build 64 bit binary @<:@default=on@:>@])],
+ [ac_enable_64bit="$enableval"],
+ [ac_enable_64bit="yes"])])
+
+ AS_IF([test "x$ac_enable_64bit" = "xyes"],[
+ if test "x$libdir" = "x\${exec_prefix}/lib" ; then
+ # The user hasn't overridden the default libdir, so we'll
+ # the dir suffix to match solaris 32/64-bit policy
+ isainfo_k=`${ISAINFO} -k`
+ libdir="${libdir}/${isainfo_k}"
+ fi
+ CPPFLAGS="-m64 ${CPPFLAGS}"
+ LDFLAGS="-m64 ${LDFLAGS}"
+ DTRACEFLAGS="${DTRACEFLAGS} -64"
+ if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"
+ then
+ AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
+ AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
+ fi
+ ],[DTRACEFLAGS="${DTRACEFLAGS} -32"])
+])
+dnl ---------------------------------------------------------------------------
+dnl End Macro: PANDORA_64BIT
+dnl ---------------------------------------------------------------------------
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Which version of the canonical setup we're using
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.1])
+
+AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
+ dnl Force dependency tracking on for Sun Studio builds
+ AS_IF([test "x${enable_dependency_tracking}" = "x"],[
+ enable_dependency_tracking=yes
+ ])
+])
+
+dnl The standard setup for how we build Pandora projects
+AC_DEFUN([PANDORA_CANONICAL_TARGET],[
+ AC_REQUIRE([PANDORA_FORCE_DEPEND_TRACKING])
+ m4_define([PCT_ALL_ARGS],[$@])
+ m4_define([PCT_USE_GNULIB],[no])
+ m4_define([PCT_REQUIRE_CXX],[no])
+ m4_define([PCT_IGNORE_SHARED_PTR],[no])
+ m4_foreach_w([pct_arg],$@,[
+ m4_case(pct_arg,
+ [use-gnulib], [
+ m4_undefine([PCT_USE_GNULIB])
+ m4_define([PCT_USE_GNULIB],[yes])
+ ],
+ [require-cxx], [
+ m4_undefine([PCT_REQUIRE_CXX])
+ m4_define([PCT_REQUIRE_CXX],[yes])
+ ],
+ [ignore-shared-ptr], [
+ m4_undefine([PCT_IGNORE_SHARED_PTR])
+ m4_define([PCT_IGNORE_SHARED_PTR],[yes])
+ ])
+ ])
+
+ # We need to prevent canonical target
+ # from injecting -O2 into CFLAGS - but we won't modify anything if we have
+ # set CFLAGS on the command line, since that should take ultimate precedence
+ AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
+ [CFLAGS=""])
+ AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
+ [CXXFLAGS=""])
+
+ AC_CANONICAL_TARGET
+
+ AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects)
+
+ m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ])
+
+ AC_REQUIRE([AC_PROG_CC])
+
+ dnl Once we can use a modern autoconf, we can use this
+ dnl AC_PROG_CC_C99
+ AC_PROG_CXX
+ AC_PROG_CPP
+ AM_PROG_CC_C_O
+
+ gl_USE_SYSTEM_EXTENSIONS
+
+
+ PANDORA_LIBTOOL
+
+ dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
+ dnl so we check c++98 features and fail if we don't have them, mainly
+ dnl for that reason
+ PANDORA_CHECK_CXX_STANDARD
+ m4_if(PCT_REQUIRE_CXX, [yes], [
+ AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
+ AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
+ ])
+ ])
+
+ PANDORA_SHARED_PTR
+ m4_if(PCT_IGNORE_SHARED_PTR, [no], [
+ AS_IF([test "$ac_cv_shared_ptr_namespace" = "missing"],[
+ AC_MSG_WARN([a usable shared_ptr implementation was not found. Let someone know what your platform is.])
+ ])
+ ])
+
+ m4_if(PCT_USE_GNULIB, [yes], [gl_INIT])
+
+ AC_C_BIGENDIAN
+ AC_C_CONST
+ AC_C_INLINE
+ AC_C_VOLATILE
+
+ AC_HEADER_TIME
+ AC_TYPE_SIZE_T
+ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+
+
+ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+
+ AC_SYS_LARGEFILE
+
+ AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
+
+ PANDORA_CHECK_C_VERSION
+ PANDORA_CHECK_CXX_VERSION
+
+ PANDORA_OPTIMIZE
+ PANDORA_64BIT
+ PANDORA_WARNINGS(PCT_ALL_ARGS)
+
+ gl_VISIBILITY
+
+ PANDORA_ENABLE_DTRACE
+ PANDORA_HEADER_ASSERT
+
+ AC_CHECK_PROGS([DOXYGEN], [doxygen])
+ AC_CHECK_PROGS([PERL], [perl])
+
+ AS_IF([test "x${gl_LIBOBJS}" != "x"],[
+ AS_IF([test "$GCC" = "yes"],[
+ AM_CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${AM_CPPFLAGS}"
+ ],[
+ AM_CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${AM_CPPFLAGS}"
+ ])
+ ])
+
+ AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}"
+ AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
+
+ AC_SUBST([AM_CFLAGS])
+ AC_SUBST([AM_CXXFLAGS])
+ AC_SUBST([AM_CPPFLAGS])
+
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+
+AC_DEFUN([PANDORA_CHECK_C_VERSION],[
+
+ dnl Print version of C compiler
+ AC_MSG_CHECKING("C Compiler version--$GCC")
+ AS_IF([test "$GCC" = "yes"],[
+ CC_VERSION=`$CC --version | sed 1q`
+ ],[AS_IF([test "$SUNCC" = "yes"],[
+ CC_VERSION=`$CC -V 2>&1 | sed 1q`
+ ],[
+ CC_VERSION=""
+ ])
+ ])
+ AC_MSG_RESULT("$CC_VERSION")
+ AC_SUBST(CC_VERSION)
+])
+
+
+AC_DEFUN([PANDORA_CHECK_CXX_VERSION], [
+ dnl Print version of CXX compiler
+ AC_MSG_CHECKING("C++ Compiler version")
+ AS_IF([test "$GCC" = "yes"],[
+ CXX_VERSION=`$CXX --version | sed 1q`
+ ],[AS_IF([test "$SUNCC" = "yes"],[
+ CXX_VERSION=`$CXX -V 2>&1 | sed 1q`
+ ],[
+ CXX_VERSION=""
+ ])
+ ])
+ AC_MSG_RESULT("$CXX_VERSION")
+ AC_SUBST(CXX_VERSION)
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([PANDORA_CHECK_CXX_STANDARD],[
+ AC_REQUIRE([AC_CXX_COMPILE_STDCXX_0X])
+ AS_IF([test "$GCC" = "yes"],
+ [AS_IF([test "$ac_cv_cxx_compile_cxx0x_native" = "yes"],[],
+ [AS_IF([test "$ac_cv_cxx_compile_cxx0x_gxx" = "yes"],
+ [CXXFLAGS="-std=gnu++0x ${CXXFLAGS}"],
+ [CXXFLAGS="-std=gnu++98"])
+ ])
+ ])
+ AC_CXX_HEADER_STDCXX_98
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl ---------------------------------------------------------------------------
+dnl Macro: PANDORA_ENABLE_DTRACE
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([PANDORA_ENABLE_DTRACE],[
+ AC_ARG_ENABLE([dtrace],
+ [AS_HELP_STRING([--enable-dtrace],
+ [Build with support for the DTRACE. @<:@default=off@:>@])],
+ [ac_cv_enable_dtrace="yes"],
+ [ac_cv_enable_dtrace="no"])
+
+ AS_IF([test "$ac_cv_enable_dtrace" = "yes"],[
+ AC_CHECK_PROGS([DTRACE], [dtrace])
+ AS_IF([test "x$ac_cv_prog_DTRACE" = "xdtrace"],[
+ AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support])
+ dnl DTrace on MacOSX does not use -G option
+ cat >conftest.d <<_ACEOF
+provider Example {
+ probe increment(int);
+};
+_ACEOF
+ $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero
+ AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes])
+ rm -f conftest.d.o conftest.d
+
+ AC_SUBST(DTRACEFLAGS) dnl TODO: test for -G on OSX
+ ac_cv_have_dtrace=yes
+ ])])
+
+AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_have_dtrace" = "xyes"])
+AM_CONDITIONAL([DTRACE_NEEDS_OBJECTS],
+ [test "x$ac_cv_dtrace_needs_objects" = "xyes"])
+
+])
+dnl ---------------------------------------------------------------------------
+dnl End Macro: PANDORA_ENABLE_DTRACE
+dnl ---------------------------------------------------------------------------
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl If the user is on a Mac and didn't ask for a specific compiler
+dnl You're gonna get 4.2.
+AC_DEFUN([PANDORA_MAC_GCC42],
+ [AS_IF([test "$GCC" = "yes"],[
+ AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
+ AS_IF([test -f /usr/bin/gcc-4.2],
+ [
+ CPP="/usr/bin/gcc-4.2 -E"
+ CC=/usr/bin/gcc-4.2
+ CXX=/usr/bin/g++-4.2
+ ])
+ ])
+ ])
+])
+
+dnl
+AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[
+ AC_REQUIRE([PANDORA_MAC_GCC42])
+ AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
+# error GCC is Too Old!
+#endif
+ ]])],
+ [ac_cv_gcc_recent=yes],
+ [ac_cv_gcc_recent=no])])
+ AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
+ AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2]))
+ AS_IF([test "$ac_cv_gcc_recent" = "no"],
+ AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required]))
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl PANDORA_HEADER_ASSERT
+dnl ----------------
+dnl Check whether to enable assertions.
+AC_DEFUN([PANDORA_HEADER_ASSERT],
+[
+ AC_MSG_CHECKING([whether to enable assertions])
+ AC_ARG_ENABLE([assert],
+ [AS_HELP_STRING([--disable-assert],
+ [Turn off assertions])],
+ [ac_cv_assert="no"],
+ [ac_cv_assert="yes"])
+ AC_MSG_RESULT([$ac_cv_assert])
+
+ AS_IF([test "$ac_cv_assert" = "yes"],
+ [AC_CHECK_HEADERS(assert.h)],
+ [AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])])
+])
+
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([PANDORA_LIBTOOL],[
+ AC_REQUIRE([AC_PROG_LIBTOOL])
+ dnl By requiring AC_PROG_LIBTOOL, we should force the macro system to read
+ dnl libtool.m4, where in 2.2 AC_PROG_LIBTOOL is an alias for LT_INIT
+ dnl Then, if we're on 2.2, we should have LT_LANG, so we'll call it.
+ m4_ifdef([LT_LANG],[
+ LT_LANG(C)
+ LT_LANG(C++)
+ ])
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([PANDORA_OPTIMIZE],[
+ dnl Build optimized or debug version ?
+ dnl First check for gcc and g++
+ AS_IF([test "$GCC" = "yes"],[
+
+ AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
+
+ dnl The following is required for portable results of floating point
+ dnl calculations on PowerPC. The same must also be done for IA-64, but
+ dnl this options is missing in the IA-64 gcc backend.
+ case "$target_cpu" in
+ *ppc* | *powerpc*)
+ AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
+ AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}"
+ ;;
+ esac
+
+ dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
+ dnl with using AC_CC_STD_C99 above
+ CC="${CC} -std=gnu99"
+
+ AM_CPPFLAGS="-ggdb3 ${AM_CPPFLAGS}"
+
+ DEBUG_CFLAGS="-O0"
+ DEBUG_CXXFLAGS="-O0"
+
+ OPTIMIZE_CFLAGS="-O3"
+ OPTIMIZE_CXXFLAGS="-O3"
+ ])
+ AS_IF([test "$SUNCC" = "yes"],[
+ dnl Once we can use a modern autoconf, we can replace the -xc99=all here
+ dnl with using AC_CC_STD_C99 above
+ CC="${CC} -xc99=all"
+ CXX="${CXX} -xlang=c99"
+
+ AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"
+ AM_CXXFLAGS="-g -mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}"
+
+ dnl TODO: Make a test for -xO4 usability here
+ OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
+ OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"
+ OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}"
+ ])
+
+ AC_ARG_WITH([debug],
+ [AS_HELP_STRING([--with-debug],
+ [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
+ [with_debug=$withval],
+ [with_debug=no])
+ AS_IF([test "$with_debug" = "yes"],[
+ # Debugging. No optimization.
+ AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG"
+ ],[
+ # Optimized version. No debug
+ AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"
+ ])
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl We check two things: where is the memory include file, and in what
+dnl namespace does shared_ptr reside.
+dnl We include AC_COMPILE_IFELSE for all the combinations we've seen in the
+dnl wild:
+dnl
+dnl GCC 4.3: namespace: std:: #include <memory>
+dnl GCC 4.2: namespace: tr1:: #include <tr1/memory>
+dnl GCC 4.2: namespace: boost:: #include <boost/shared_ptr.hpp>
+dnl
+dnl We define one of HAVE_HAVE_TR1_SHARED_PTR or HAVE_BOOST_SHARED_PTR
+dnl depending on location, and SHARED_PTR_NAMESPACE to be the namespace in
+dnl which shared_ptr is defined.
+dnl
+
+AC_DEFUN([PANDORA_SHARED_PTR],[
+ AC_REQUIRE([PANDORA_CHECK_CXX_STANDARD])
+ AC_LANG_PUSH(C++)
+ AC_CHECK_HEADERS(memory tr1/memory boost/shared_ptr.hpp)
+ AC_CACHE_CHECK([the location of shared_ptr header file],
+ [ac_cv_shared_ptr_h],[
+ for namespace in std tr1 std::tr1 boost
+ do
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+#if defined(HAVE_MEMORY)
+# include <memory>
+#endif
+#if defined(HAVE_TR1_MEMORY)
+# include <tr1/memory>
+#endif
+#if defined(HAVE_BOOST_SHARED_PTR_HPP)
+# include <boost/shared_ptr.hpp>
+#endif
+#include <string>
+
+using $namespace::shared_ptr;
+using namespace std;
+ ]],[[
+shared_ptr<string> test_ptr(new string("test string"));
+ ]])],
+ [
+ ac_cv_shared_ptr_namespace="${namespace}"
+ break
+ ],[ac_cv_shared_ptr_namespace=missing])
+ done
+ ])
+ AC_DEFINE_UNQUOTED([SHARED_PTR_NAMESPACE],
+ ${ac_cv_shared_ptr_namespace},
+ [The namespace in which SHARED_PTR can be found])
+ AC_LANG_POP()
+])
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
+
+ ac_cv_building_from_vc=no
+
+ AS_IF([test -d "${srcdir}/.bzr"],[
+ ac_cv_building_from_bzr=yes
+ ac_cv_building_from_vc=yes
+ ],[
+ ac_cv_building_from_bzr=no
+ ])
+
+ AS_IF([test -d "${srcdir}/.svn"],[
+ ac_cv_building_from_svn=yes
+ ac_cv_building_from_vc=yes
+ ],[
+ ac_cv_building_from_svn=no
+ ])
+
+ AS_IF([test -d "${srcdir}/.hg"],[
+ ac_cv_building_from_hg=yes
+ ac_cv_building_from_vc=yes
+ ],[
+ ac_cv_building_from_hg=no
+ ])
+
+])
+
--- /dev/null
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl AC_PANDORA_WARNINGS([less-warnings|warnings-always-on])
+dnl less-warnings turn on a limited set of warnings
+dnl warnings-always-on always set warnings=error regardless of tarball/vc
+
+dnl @TODO: remove less-warnings option as soon as Drizzle is clean enough to
+dnl allow it
+
+AC_DEFUN([PANDORA_WARNINGS],[
+ m4_define([PW_LESS_WARNINGS],[no])
+ m4_define([PW_WARN_ALWAYS_ON],[no])
+ m4_foreach_w([pw_arg],$@,[
+ m4_case(pw_arg,
+ [less-warnings],[
+ m4_undefine([PW_LESS_WARNINGS])
+ m4_define([PW_LESS_WARNINGS],[yes])
+ ],
+ [warnings-always-on],[
+ m4_undefine([PW_WARN_ALWAYS_ON])
+ m4_define([PW_WARN_ALWAYS_ON],[yes])
+ ])
+ ])
+
+ AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
+ m4_if(PW_WARN_ALWAYS_ON, [yes],
+ [ac_cv_warnings_as_errors=yes],
+ AS_IF([test "$ac_cv_building_from_vc" = "yes"],
+ [ac_cv_warnings_as_errors=yes],
+ [ac_cv_warnings_as_errors=no]))
+
+ AC_ARG_ENABLE([profiling],
+ [AS_HELP_STRING([--enable-profiling],
+ [Toggle profiling @<:@default=off@:>@])],
+ [ac_profiling="$enableval"],
+ [ac_profiling="no"])
+
+ AC_ARG_ENABLE([coverage],
+ [AS_HELP_STRING([--enable-coverage],
+ [Toggle coverage @<:@default=off@:>@])],
+ [ac_coverage="$enableval"],
+ [ac_coverage="no"])
+
+ AS_IF([test "$GCC" = "yes"],[
+
+ AS_IF([test "$ac_profiling" = "yes"],[
+ CC_PROFILING="-pg"
+ save_LIBS="${LIBS}"
+ LIBS=""
+ AC_CHECK_LIB(c_p, read)
+ LIBC_P="${LIBS}"
+ LIBS="${save_LIBS}"
+ AC_SUBST(LIBC_P)
+ ],[
+ CC_PROFILING=" "
+ ])
+
+ AS_IF([test "$ac_coverage" = "yes"],
+ [CC_COVERAGE="-fprofile-arcs -ftest-coverage"])
+
+ AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],
+ [W_FAIL="-Werror"])
+
+ AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
+ [ac_cv_safe_to_use_fdiagnostics_show_option_],
+ [save_CFLAGS="$CFLAGS"
+ CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([],[])],
+ [ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
+ [ac_cv_safe_to_use_fdiagnostics_show_option_=no])
+ CFLAGS="$save_CFLAGS"])
+
+ AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"],
+ [
+ F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
+ ])
+
+ AC_CACHE_CHECK([whether it is safe to use -Wconversion],
+ [ac_cv_safe_to_use_wconversion_],
+ [save_CFLAGS="$CFLAGS"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <stdbool.h>
+void foo(bool a)
+{
+ (void)a;
+}
+ ]],[[
+foo(0);
+ ]])],
+ [ac_cv_safe_to_use_wconversion_=yes],
+ [ac_cv_safe_to_use_wconversion_=no])
+ CFLAGS="$save_CFLAGS"])
+
+ AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
+ [W_CONVERSION="-Wconversion"
+ AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
+ [ac_cv_safe_to_use_Wconversion_],
+ [save_CFLAGS="$CFLAGS"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <netinet/in.h>
+ ]],[[
+uint16_t x= htons(80);
+ ]])],
+ [ac_cv_safe_to_use_Wconversion_=yes],
+ [ac_cv_safe_to_use_Wconversion_=no])
+ CFLAGS="$save_CFLAGS"])
+
+ AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
+ [NO_CONVERSION="-Wno-conversion"])
+ ])
+
+ NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing"
+ NO_SHADOW="-Wno-shadow"
+
+ m4_if(PW_LESS_WARNINGS,[no],[
+ BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing"
+ CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum"
+ CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
+ ],[
+ BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}"
+ ])
+
+ BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow -Wstrict-aliasing ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
+ CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}"
+ CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}"
+
+ AC_CACHE_CHECK([whether it is safe to use -Wmissing-declarations from C++],
+ [ac_cv_safe_to_use_Wmissing_declarations_],
+ [AC_LANG_PUSH(C++)
+ save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="-Werror -pedantic -Wmissing-declarations ${AM_CXXFLAGS}"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [[
+#include <stdio.h>
+ ]], [[]])
+ ],
+ [ac_cv_safe_to_use_Wmissing_declarations_=yes],
+ [ac_cv_safe_to_use_Wmissing_declarations_=no])
+ CXXFLAGS="$save_CXXFLAGS"
+ AC_LANG_POP()
+ ])
+ AS_IF([test "$ac_cv_safe_to_use_Wmissing_declarations_" = "yes"],
+ [CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations"])
+
+ AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
+ [ac_cv_safe_to_use_Wlogical_op_],
+ [save_CFLAGS="$CFLAGS"
+ CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS}"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [[
+#include <stdio.h>
+ ]], [[]])
+ ],
+ [ac_cv_safe_to_use_Wlogical_op_=yes],
+ [ac_cv_safe_to_use_Wlogical_op_=no])
+ CFLAGS="$save_CFLAGS"])
+ AS_IF([test "$ac_cv_safe_to_use_Wlogical_op_" = "yes"],
+ [CC_WARNINGS="${CC_WARNINGS} -Wlogical-op"])
+
+ AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls from C++],
+ [ac_cv_safe_to_use_Wredundant_decls_],
+ [AC_LANG_PUSH(C++)
+ save_CXXFLAGS="${CXXFLAGS}"
+ CXXFLAGS="${W_FAIL} -pedantic -Wredundant-decls ${AM_CXXFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+template <typename E> struct C { void foo(); };
+template <typename E> void C<E>::foo() { }
+template <> void C<int>::foo();
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_use_Wredundant_decls_=yes],
+ [ac_cv_safe_to_use_Wredundant_decls_=no])
+ CXXFLAGS="${save_CXXFLAGS}"
+ AC_LANG_POP()])
+ AS_IF([test "$ac_cv_safe_to_use_Wredundant_decls_" = "yes"],
+ [CXX_WARNINGS="${CXX_WARNINGS} -Wredundant-decls"],
+ [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
+
+ NO_REDUNDANT_DECLS="-Wno-redundant-decls"
+ PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow"
+
+ ])
+
+ AS_IF([test "$SUNCC" = "yes"],[
+
+ AS_IF([test "$ac_profiling" = "yes"],
+ [CC_PROFILING="-xinstrument=datarace"])
+
+ AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],
+ [W_FAIL="-errwarn=%all"])
+
+ AC_CACHE_CHECK([whether E_PASTE_RESULT_NOT_TOKEN is usable],
+ [ac_cv_paste_result],
+ [
+ save_CFLAGS="${CFLAGS}"
+ CFLAGS="-errwarn=%all -erroff=E_PASTE_RESULT_NOT_TOKEN ${CFLAGS}"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ AC_INCLUDES_DEFAULT
+ ],[
+ int x= 0;])],
+ [ac_cv_paste_result=yes],
+ [ac_cv_paste_result=no])
+ CFLAGS="${save_CFLAGS}"
+ ])
+ AS_IF([test $ac_cv_paste_result = yes],
+ [W_PASTE_RESULT=",E_PASTE_RESULT_NOT_TOKEN"])
+
+
+ m4_if(PW_LESS_WARNINGS, [no],[
+ CC_WARNINGS_FULL="-erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}"
+ ],[
+ CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR"
+ CXX_WARNINGS_FULL="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint"
+ ])
+
+ CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}"
+ CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}"
+ PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn"
+ NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
+
+ ])
+
+ AC_SUBST(NO_CONVERSION)
+ AC_SUBST(NO_REDUNDANT_DECLS)
+ AC_SUBST(NO_UNREACHED)
+ AC_SUBST(NO_SHADOW)
+ AC_SUBST(NO_STRICT_ALIASING)
+ AC_SUBST(PROTOSKIP_WARNINGS)
+
+])
noinst_HEADERS = test.h server.h ketama_test_cases.h
noinst_PROGRAMS = testapp testplus udptest atomsmasher startservers
+noinst_LTLIBRARIES= libserver.la libtest.la
-testapp_CFLAGS= ${AM_CFLAGS} ${NO_CONVERSION} ${NO_STRICT_ALIASING}
-testapp_SOURCES = test.c function.c server.c ../clients/generator.c ../clients/execute.c
-testapp_LDADD = $(LDADDS)
+libserver_la_SOURCES= server.c
+libtest_la_SOURCES= test.c
-testplus_SOURCES = test.c plus.cpp server.c
-testplus_LDADD = $(LDADDS)
+testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
+testapp_SOURCES = function.c
+testapp_LDADD = $(LDADDS) $(top_builddir)/clients/libgenexec.la libtest.la libserver.la
-udptest_SOURCES = test.c udp.c server.c
-udptest_LDADD = $(LDADDS)
+testplus_SOURCES = plus.cpp
+testplus_LDADD = $(LDADDS) libtest.la libserver.la
-atomsmasher_SOURCES = test.c atomsmasher.c server.c ../clients/generator.c ../clients/execute.c
-atomsmasher_LDADD = $(LDADDS)
+udptest_SOURCES = udp.c
+udptest_LDADD = $(LDADDS) libtest.la libserver.la
-startservers_SOURCES = start.c server.c
-startservers_LDADD = $(LDADDS)
+atomsmasher_SOURCES = atomsmasher.c
+atomsmasher_LDADD = $(LDADDS) $(top_builddir)/clients/libgenexec.la libtest.la libserver.la
+
+startservers_SOURCES = start.c
+startservers_LDADD = $(LDADDS) libserver.la
record:
./testapp > output.res
libtool --mode=execute valgrind --tool=helgrind testapp
helgrind-slap:
- libtool --mode=execute valgrind --tool=helgrind ../clients/memslap --server=localhost --concurrency=30
+ libtool --mode=execute valgrind --tool=helgrind ${top_builddir}/clients/memslap --server=localhost --concurrency=30
test-no-outputdiff: testapp
./testapp > /dev/null
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
if (setting_value)
- assert(rc == MEMCACHED_NOTSTORED || MEMCACHED_STORED);
+ assert(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_STORED);
else
assert(rc == MEMCACHED_NOTSTORED);
Error 34 -> THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT
Error 35 -> SERVER IS MARKED DEAD
Error 36 -> ENCOUNTERED AN UNKNOWN STAT KEY
+Error 0 -> SUCCESS
+Error 1 -> FAILURE
+Error 2 -> HOSTNAME LOOKUP FAILURE
+Error 3 -> CONNECTION FAILURE
+Error 4 -> CONNECTION BIND FAILURE
+Error 5 -> WRITE FAILURE
+Error 6 -> READ FAILURE
+Error 7 -> UNKNOWN READ FAILURE
+Error 8 -> PROTOCOL ERROR
+Error 9 -> CLIENT ERROR
+Error 10 -> SERVER ERROR
+Error 11 -> CONNECTION SOCKET CREATE FAILURE
+Error 12 -> CONNECTION DATA EXISTS
+Error 13 -> CONNECTION DATA DOES NOT EXIST
+Error 14 -> NOT STORED
+Error 15 -> STORED
+Error 16 -> NOT FOUND
+Error 17 -> MEMORY ALLOCATION FAILURE
+Error 18 -> PARTIAL READ
+Error 19 -> SOME ERRORS WERE REPORTED
+Error 20 -> NO SERVERS DEFINED
+Error 21 -> SERVER END
+Error 22 -> SERVER DELETE
+Error 23 -> SERVER VALUE
+Error 24 -> STAT VALUE
+Error 25 -> ITEM VALUE
+Error 26 -> SYSTEM ERROR
+Error 27 -> COULD NOT OPEN UNIX SOCKET
+Error 28 -> ACTION NOT SUPPORTED
+Error 29 -> A KEY LENGTH OF ZERO WAS PROVIDED
+Error 30 -> FETCH WAS NOT COMPLETED
+Error 31 -> A TIMEOUT OCCURRED
+Error 32 -> ACTION QUEUED
+Error 33 -> A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE
+Error 34 -> THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT
+Error 35 -> SERVER IS MARKED DEAD
+Error 36 -> ENCOUNTERED AN UNKNOWN STAT KEY
mcach.set(key, inc_value, strlen(inc_value));
ret_value= mcach.get(key, &value_length);
printf("\nretvalue %s\n",ret_value);
- int_inc_value= atoi(inc_value);
- int_ret_value= atoi(ret_value);
+ int_inc_value= uint64_t(atol(inc_value));
+ int_ret_value= uint64_t(atol(ret_value));
assert(int_ret_value == int_inc_value);
rc= mcach.increment(key, 1, &int_ret_value);