clients_memaslap_SOURCES+= clients/generator.cc clients/execute.cc
clients_memaslap_LDADD=
-clients_memaslap_LDADD+= @LIBEVENT_LDFLAGS@
+clients_memaslap_LDADD+= @LIBEVENT_LIB@
clients_memaslap_LDADD+= $(CLIENTS_LDADDS)
clients_memcapable_SOURCES=
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C++])
+LT_LIB_M
AX_ASSERT
AC_CHECK_HEADERS_ONCE([errno.h])
AC_CHECK_HEADERS_ONCE([execinfo.h])
AC_CHECK_HEADERS_ONCE([fcntl.h])
+AC_CHECK_HEADERS_ONCE([fnmatch.h])
AC_CHECK_HEADERS_ONCE([inttypes.h])
AC_CHECK_HEADERS_ONCE([libintl.h])
AC_CHECK_HEADERS_ONCE([limits.h])
AC_CHECK_HEADERS_ONCE([netdb.h])
AC_CHECK_HEADERS_ONCE([netinet/in.h])
AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
+AC_CHECK_HEADERS_ONCE([poll.h])
AC_CHECK_HEADERS_ONCE([pthread.h])
AC_CHECK_HEADERS_ONCE([spawn.h])
AC_CHECK_HEADERS_ONCE([stdarg.h])
AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_CHECK_HEADERS_ONCE([sys/un.h])
+AC_CHECK_HEADERS_ONCE([sys/wait.h])
AC_CHECK_HEADERS_ONCE([syslog.h])
AC_CHECK_HEADERS_ONCE([time.h])
AC_CHECK_HEADERS_ONCE([unistd.h])
# Windows only
-AC_CHECK_HEADERS([winsock2.h])
-AC_CHECK_HEADERS([ws2tcpip.h])
+AC_CHECK_HEADERS_ONCE([winsock2.h])
+AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_FUNCS([putenv])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([setenv])
+AC_CHECK_FUNCS([sigignore])
AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([sqrt])
AC_CHECK_FUNCS([strcasecmp])
[AC_DEFINE([HAVE_CLOCK_GETTIME],[0],[Have clock_gettime])])
# Check for the ability to call dlopen
-AS_IF([test "x$enable_static" = "xyes"],
+AS_IF([test "x$enable_shared" = xyes],
[AC_CHECK_LIB([dl],[dlopen],
[AC_SUBST([DL_LIB],[-ldl])
AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])])],
- [AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])])
-
-AC_CHECK_LIB([m],[floor])
-AC_CHECK_FUNCS([sigignore])
+ [AC_DEFINE([HAVE_LIBDL],[0],[Have dlopen])])
AC_CHECK_HEADERS([atomic.h])
AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
build_solaris_privs=yes])
])
-AC_CHECK_HEADERS_ONCE([winsock2.h poll.h sys/wait.h fnmatch.h])
AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
AX_UUID_GENERATE_TIME_SAFE
-
AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
[AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
AX_PTHREAD_TIMEDJOIN_NP
CHECK_FOR_PTHREAD_AND_SASL
-# backtrace() does not work with static builds.
+# backtrace(), others require shared builds
AS_IF([test "x$enable_shared" = "xyes"],
- [AC_DEFINE([AX_ENABLE_BACKTRACE],[1],[Support for backtrace().])])
+ [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])
AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
PANDORA_ENABLE_DTRACE
*/
-#include <libhashkit/common.h>
+#include "libhashkit/common.h"
-#include <libhashkit/rijndael.hpp>
+#include "libhashkit/rijndael.hpp"
#include <cstring>
nobase_include_HEADERS+= libhashkit/hashkit.h
+libhashkit_libhashkit_la_LIBADD=
libhashkit_libhashkit_la_SOURCES=
libhashkit_libhashkit_la_CXXFLAGS=
libhashkit_libhashkit_la_CFLAGS=
libhashkit_libhashkit_la_CXXFLAGS+= -DBUILDING_HASHKIT
libhashkit_libhashkit_la_CFLAGS+= -DBUILDING_HASHKIT
-libhashkit_libhashkit_la_LIBADD=
libhashkit_libhashkit_la_LDFLAGS= -version-info $(HASHKIT_LIBRARY_VERSION)
# library used for testing
libhashkit_libhashkitinc_la_SOURCES= ${libhashkit_libhashkit_la_SOURCES}
libhashkit_libhashkitinc_la_CFLAGS= ${libhashkit_libhashkit_la_CFLAGS}
-libhashkit_libhashkitinc_la_LDFLAGS= $(LIBM)
+libhashkit_libhashkitinc_la_CXXFLAGS= ${libhashkit_libhashkit_la_CXXFLAGS}
#include <assert.h>
#include <stdlib.h>
-#include <libhashkit/rijndael.hpp>
+#include "libhashkit/rijndael.hpp"
/*
Te0[x] = S [x].[02, 01, 01, 03];
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * libmcachedd client library.
+ * Libmemcached client library.
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*
*/
-#include <libmemcached/common.h>
+#include "mem_config.h"
-#ifdef AX_ENABLE_BACKTRACE
+#include "libmemcached/backtrace.hpp"
-#ifdef HAVE_EXECINFO_H
-# include <execinfo.h>
-#endif
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
-#ifdef HAVE_GCC_ABI_DEMANGLE
-# include <cxxabi.h>
-#endif
+#if defined(HAVE_SHARED_ENABLED) && HAVE_SHARED_ENABLED
-#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
#endif
#ifdef HAVE_GCC_ABI_DEMANGLE
+# include <cxxabi.h>
# define USE_DEMANGLE 1
#else
# define USE_DEMANGLE 0
#endif
+#ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
+
const int MAX_DEPTH= 50;
void custom_backtrace(void)
{
#ifdef HAVE_EXECINFO_H
- void *array[MAX_DEPTH];
-
- int backtrace_size= backtrace(array, MAX_DEPTH);
- fprintf(stderr, "Number of stack frames obtained: %d\n", backtrace_size);
+ void *backtrace_buffer[MAX_DEPTH +1];
-#ifdef HAVE_DLFCN_H
- Dl_info dlinfo;
-#endif
+ int stack_frames= backtrace(backtrace_buffer, MAX_DEPTH);
+ if (stack_frames)
+ {
+ char **symbollist= backtrace_symbols(backtrace_buffer, stack_frames);
+ if (symbollist)
+ {
+ for (int x= 0; x < stack_frames; x++)
+ {
+ bool was_demangled= false;
- for (int x= 0; x < backtrace_size; ++x)
- {
+ if (USE_DEMANGLE)
+ {
#ifdef HAVE_DLFCN_H
- if (dladdr(array[x], &dlinfo) == 0)
- {
- continue;
- }
+ Dl_info dlinfo;
+ if (dladdr(backtrace_buffer[x], &dlinfo))
+ {
+ char demangled_buffer[1024];
+ const char *called_in= "<unresolved>";
+ if (dlinfo.dli_sname)
+ {
+ size_t demangled_size= sizeof(demangled_buffer);
+ int status;
+ char* demangled;
+ if ((demangled= abi::__cxa_demangle(dlinfo.dli_sname, demangled_buffer, &demangled_size, &status)))
+ {
+ called_in= demangled;
+ fprintf(stderr, "---> demangled: %s -> %s\n", demangled_buffer, demangled);
+ }
+ else
+ {
+ called_in= dlinfo.dli_sname;
+ }
+
+ was_demangled= true;
+ fprintf(stderr, "#%d %lp in %s at %s\n",
+ x, backtrace_buffer[x],
+ called_in,
+ dlinfo.dli_fname);
+ }
+ }
#endif
+ }
- const char* symname= dlinfo.dli_sname;
-
- int status;
- char* demangled= abi::__cxa_demangle(symname, NULL, 0, &status);
- if (status == 0 and demangled)
- {
- symname= demangled;
- }
-
- printf("object: %s, function: %s\n", dlinfo.dli_fname, symname);
+ if (was_demangled == false)
+ {
+ fprintf(stderr, "?%d %lp in %s\n", x, backtrace_buffer[x], symbollist[x]);
+ }
+ }
- if (demangled)
- {
- free(demangled);
+ ::free(symbollist);
}
- }
+ }
#endif // HAVE_EXECINFO_H
+}
+
+#else // HAVE_SHARED_ENABLED
-#else // AX_ENABLE_BACKTRACE
void custom_backtrace(void)
{
+ fprintf(stderr, "Backtrace null function called\n");
}
#endif // AX_ENABLE_BACKTRACE
noinst_HEADERS+= libmemcached/watchpoint.h
lib_LTLIBRARIES+= libmemcached/libmemcached.la
+libmemcached_libmemcached_la_DEPENDENCIES=
+libmemcached_libmemcached_la_LIBADD=
+libmemcached_libmemcached_la_LDFLAGS=
libmemcached_libmemcached_la_CFLAGS= -DBUILDING_LIBMEMCACHED
-
libmemcached_libmemcached_la_CXXFLAGS= -DBUILDING_LIBMEMCACHED
libmemcached_libmemcached_la_SOURCES+= libmemcached/instance.cc
libmemcached/options.cc: libmemcached/csl/parser.h
-
-libmemcached_libmemcached_la_DEPENDENCIES=
-libmemcached_libmemcached_la_LIBADD=
-libmemcached_libmemcached_la_LDFLAGS=
libmemcached_libmemcached_la_LDFLAGS+= -version-info ${MEMCACHED_LIBRARY_VERSION}
-libmemcached_libmemcached_la_LDFLAGS+= @DL_LIB@
+libmemcached_libmemcached_la_LIBADD+= @DL_LIB@
if HAVE_SASL
libmemcached_libmemcached_la_CXXFLAGS+= @PTHREAD_CFLAGS@
libmemcached_libmemcached_la_LIBADD+= @PTHREAD_LIBS@
-libmemcached_libmemcached_la_LIBADD+= @SASL_LDFLAGS@
+libmemcached_libmemcached_la_LIBADD+= @SASL_LIB@
endif
if HAVE_DTRACE
${AM_CXXFLAGS} \
${NO_CONVERSION} \
-DBUILDING_LIBMEMCACHEDINTERNAL
-libmemcachedinternal_libmemcachedinternal_la_LDFLAGS=
-libmemcachedinternal_libmemcachedinternal_la_LDFLAGS+= @DL_LIB@
libmemcachedinternal_libmemcachedinternal_la_LIBADD= $(libmemcached_libmemcached_la_LIBADD)
libmemcachedinternal_libmemcachedinternal_la_DEPENDENCIES= $(libmemcached_libmemcached_la_DEPENDENCIES)
endif
libmemcached_libmemcachedprotocol_la_CXXFLAGS+= @PTHREAD_CFLAGS@
libmemcached_libmemcachedprotocol_la_LIBADD=
-libmemcached_libmemcachedprotocol_la_LIBADD+= @LIBEVENT_LDFLAGS@
+libmemcached_libmemcachedprotocol_la_LIBADD+= @LIBEVENT_LIB@
libmemcached_libmemcachedprotocol_la_LIBADD+= @PTHREAD_LIBS@
libmemcached_libmemcachedprotocol_la_LDFLAGS= ${AM_LDFLAGS}
libmemcached_libmemcachedprotocol_la_LDFLAGS+= -version-info ${MEMCACHED_PROTOCAL_LIBRARY_VERSION}
libmemcachedutil/ping.cc \
libmemcachedutil/pool.cc \
libmemcachedutil/version.cc
-libmemcached_libmemcachedutil_la_CXXFLAGS= \
+libmemcached_libmemcachedutil_la_LIBADD=
+libmemcached_libmemcachedutil_la_LDFLAGS=
+libmemcached_libmemcachedutil_la_CXXFLAGS=
+libmemcached_libmemcachedutil_la_DEPENDENCIES=
+libmemcached_libmemcachedutil_la_CXXFLAGS+= \
${AM_CXXFLAGS} \
${NO_CONVERSION} \
-DBUILDING_LIBMEMCACHED
libmemcached_libmemcachedutil_la_CXXFLAGS+= @PTHREAD_CFLAGS@
-libmemcached_libmemcachedutil_la_LIBADD= libmemcached/libmemcached.la
+libmemcached_libmemcachedutil_la_LDFLAGS+= ${AM_LDFLAGS} -version-info ${MEMCACHED_UTIL_LIBRARY_VERSION}
+libmemcached_libmemcachedutil_la_LIBADD+= libmemcached/libmemcached.la
libmemcached_libmemcachedutil_la_LIBADD+= @PTHREAD_LIBS@
-libmemcached_libmemcachedutil_la_LDFLAGS= ${AM_LDFLAGS} -version-info ${MEMCACHED_UTIL_LIBRARY_VERSION}
-libmemcached_libmemcachedutil_la_DEPENDENCIES= libmemcached/libmemcached.la
+libmemcached_libmemcachedutil_la_DEPENDENCIES+= libmemcached/libmemcached.la
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <cerrno>
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+
+#include "libmemcached/backtrace.hpp"
+
+class Test {
+public:
+ Test()
+ {
+ }
+
+ void call_backtrace()
+ {
+ std::cerr << __func__ << std::endl;
+ custom_backtrace();
+ }
+};
+
+void SIGSEGV_handler(int sig_num, siginfo_t* info, void* ucontext)
+{
+ std::cerr << __func__ << std::endl;
+ (void)sig_num;
+ (void)info;
+ (void)ucontext;
+
+ custom_backtrace();
+}
+
+int raise_SIGSEGV()
+{
+ std::cerr << std::endl << "Calling backtrace()" << std::endl;
+ custom_backtrace();
+ std::cerr << std::endl << "Calling raise()" << std::endl;
+ return raise(SIGSEGV);
+}
+
+int layer4()
+{
+ return raise_SIGSEGV();
+}
+
+int layer3()
+{
+ return layer4();
+}
+
+int layer2()
+{
+ return layer3();
+}
+
+int layer1()
+{
+ return layer2();
+}
+
+int main(int, char **)
+{
+ Test t;
+
+ t.call_backtrace();
+
+ struct sigaction sigact;
+
+ sigact.sa_sigaction= SIGSEGV_handler;
+ sigact.sa_flags= SA_RESTART | SA_SIGINFO;
+
+ if (sigaction(SIGSEGV, &sigact, (struct sigaction *)NULL) != 0)
+ {
+ std::cerr << "error setting signal handler for " << strsignal(SIGSEGV) << "(" << SIGSEGV << ")" << std::endl;
+
+ exit(EXIT_FAILURE);
+ }
+
+ int ret= layer1();
+ if (ret)
+ {
+ std::cerr << "raise() " << strerror(errno) << std::endl;
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
libtest_libtest_la_SOURCES+= libtest/vchar.cc
libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
-libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
+libtest_libtest_la_CXXFLAGS+= @PTHREAD_CFLAGS@
libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS)
-libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
libtest_libtest_la_LIBADD+= $(CURL_LIBS)
-libtest_libtest_la_LIBADD+= $(RT_LIB)
+libtest_libtest_la_LIBADD+= @PTHREAD_LIBS@
+libtest_libtest_la_LIBADD+= @RT_LIB@
libtest_libtest_la_DEPENDENCIES+= libtest_tmp_dir
libtest_libtest_la_DEPENDENCIES+=libtest/abort
libtest_unittest_DEPENDENCIES+= gearmand/gearmand
else
if HAVE_LIBGEARMAN
-libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
-libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
+libtest_libtest_la_LIBADD+= @LIBGEARMAN_LDFLAGS@
libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
libtest_libtest_la_SOURCES+= libtest/gearmand.cc
libtest_libtest_la_SOURCES+= util/instance.cc
libtest_abort_SOURCES= libtest/abort.cc
noinst_PROGRAMS+= libtest/abort
+
+libtest_backtrace_SOURCES=
+libtest_backtrace_LDADD=
+libtest_backtrace_SOURCES+= libtest/backtrace_test.cc
+libtest_backtrace_SOURCES+= libmemcached/backtrace.cc
+libtest_backtrace_LDADD+= @DL_LIB@
+noinst_PROGRAMS+= libtest/backtrace
+test-backtrace: libtest/backtrace
+ @libtest/backtrace
+
+gdb-backtrace: libtest/backtrace
+ @$(GDB_COMMAND) libtest/backtrace
#include <libtest/common.h>
-#include <libmemcached-1.0/memcached.h>
-#include <libmemcachedutil-1.0/util.h>
-
#include <cassert>
#include <cerrno>
#include <cstdio>
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 4
+#serial 6
AC_DEFUN([AX_CHECK_LIBRARY], [
AC_ARG_VAR($1[_CPPFLAGS], [C preprocessor flags for ]$1[ headers])
])
AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"],
- AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found])
- m4_ifval( m4_normalize([$4]), [$4]),
- m4_ifval( m4_normalize([$5]), [$5]))
-])
+ [AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found])
+ AC_SUBST($1[_CPPFLAGS])
+ AC_SUBST($1[_LDFLAGS])
+ AC_SUBST($1[_LIB],[-l]$3)
+ m4_ifval( m4_normalize([$4]), [$4]),
+ m4_ifval( m4_normalize([$5]), [$5])])
+ AM_CONDITIONAL([HAVE_]$1,[test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"])
+ ])
_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
- AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
- [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
- AS_IF([test "x$ac_c_gcc_recent" = xyes],
- [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
- _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
- _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
- _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
- ])])
+ AS_IF([test "x$ax_enable_debug" = xno],
+ [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+ AS_IF([test "x$ac_c_gcc_recent" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
+ ])])])
AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
[_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
- AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ AS_IF([test "x$ax_enable_debug" = xno],
+ [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
[_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
AS_IF([test "x$ac_c_gcc_recent" = xyes],
[_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
- ])])
+ ])])])
AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
[_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
#
# SYNOPSIS
#
-# AX_LIBEVENT(), AX_LIBEVENT2(), AX_LIBEVENT2_EVHTTP()
+# AX_LIBEVENT([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+# AX_LIBEVENT2()
+# AX_LIBEVENT2_EVHTTP()
#
# DESCRIPTION
#
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 4
AC_DEFUN([AX_LIBEVENT],
[AC_PREREQ([2.63])dnl
AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent],
- [AX_SAVE_FLAGS
- LIBS="-levent $LIBS"
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <event.h>
- ],[
- struct event_base *tmp_event= event_init();
- event_base_free(tmp_event);
- ])],
- [ax_cv_libevent=yes],
- [ax_cv_libevent=no],
- [AC_MSG_WARN([test program execution failed])])
- AC_LANG_POP
- AX_RESTORE_FLAGS
- ])
+ ],[
+ struct event_base *tmp_event= event_init();
+ event_base_free(tmp_event);
+ ])],
+ [ax_cv_libevent=yes],
+ [ax_cv_libevent=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
AS_IF([test "x$ax_cv_libevent" = "xyes"],
- [LIBEVENT_LDFLAGS="-levent"
- AC_SUBST(LIBEVENT_LDFLAGS)
- AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],
- [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])])
+ [AC_SUBST([LIBEVENT_LIB],[-levent])
+ AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])])
AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+ AS_IF([test "x$ax_cv_libevent" = xyes],
+ [$1],
+ [$2])
])
- AC_DEFUN([AX_LIBEVENT2],
- [AC_REQUIRE([AX_LIBEVENT])
- AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2],
- [AX_SAVE_FLAGS
- LIBS="-levent $LIBS"
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
+AC_DEFUN([AX_LIBEVENT2],
+ [AC_REQUIRE([AX_LIBEVENT])
+ AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <event2/event.h>
- ],[
- struct event_base *tmp_event= event_init();
- event_base_free(tmp_event);
- ])],
- [ax_cv_libevent2=yes],
- [ax_cv_libevent2=no],
- [AC_MSG_WARN([test program execution failed])])
- AC_LANG_POP
- AX_RESTORE_FLAGS
- ])
+ ],[
+ struct event_base *tmp_event= event_init();
+ event_base_free(tmp_event);
+ ])],
+ [ax_cv_libevent2=yes],
+ [ax_cv_libevent2=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP([C])
+ AX_RESTORE_FLAGS
+ ])
- AS_IF([test "x$ax_cv_libevent2" = xyes],
- [LIBEVENT2_LDFLAGS="-levent"
- AC_SUBST(LIBEVENT2_LDFLAGS)
- AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
- [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
+ AS_IF([test "x$ax_cv_libevent2" = xyes],
+ [AC_SUBST([LIBEVENT2_LIB],[-levent])
+ AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
- AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
- ])
+ AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+ AS_IF([test "x$ax_cv_libevent2" = xyes],
+ [$1],
+ [$2])
+ ])dnl AX_LIBEVENT2
- AC_DEFUN([AX_LIBEVENT2_EVHTTP],
- [AC_REQUIRE([AX_LIBEVENT2])
- AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
- [AX_SAVE_FLAGS
- LIBS="-levent $LIBS"
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([
+#
+AC_DEFUN([AX_LIBEVENT2_EVHTTP],
+ [AC_REQUIRE([AX_LIBEVENT2])
+ AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <event2/event.h>
#include <event2/http.h>
- ],[
- struct event_base *libbase= event_base_new();
- struct evhttp *libsrvr= evhttp_new(libbase);
- ])],
- [ax_cv_libevent2_evhttp=yes],
- [ax_cv_libevent2_evhttp=no],
- [AC_MSG_WARN([test program execution failed])])
- AC_LANG_POP
- AX_RESTORE_FLAGS
- ])
+ ],[
+ struct event_base *libbase= event_base_new();
+ struct evhttp *libsrvr= evhttp_new(libbase);
+ ])],
+ [ax_cv_libevent2_evhttp=yes],
+ [ax_cv_libevent2_evhttp=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP([C])
+ AX_RESTORE_FLAGS
+ ])
- AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
- [LIBEVENT2_LDFLAGS="-levent"
- AC_SUBST(LIBEVENT2_LDFLAGS)
- AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
- [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
+ AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
+ [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[1],[Define if event_init is present in event2/http.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[0],[Define if event_init is present in event2/http.h.])])
- AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])
- ])
+ AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+ AS_IF([test "x$ax_cv_libevent2_evhttp" = xyes],
+ [$1],
+ [$2])
+ ])dnl AX_LIBEVENT2_EVHTTP
[ax_sasl_check=no
AX_CHECK_LIBRARY([LIBSASL],[sasl/sasl.h],[sasl2],
[ax_sasl_check=yes
- AC_SUBST([SASL_LDFLAGS],[[-lsasl2]])
+ AC_SUBST([SASL_LIB],[[-lsasl2]])
])
AC_MSG_CHECKING([checking to see if sasl works])
AC_MSG_RESULT(["$ax_sasl_check"])
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 5
+#serial 6
AC_DEFUN([AX_UUID],
[AC_PREREQ([2.63])dnl
[ax_libuuid=yes])
],[ax_libuuid=no])
- AS_IF([test "$ax_libuuid" = yes],
+ AS_IF([test "x$ax_libuuid" = xyes],
[AC_DEFINE([HAVE_UUID_UUID_H],[1],[Have uuid/uuid.h])
- AS_IF([test "$ax_cv_libuuid_is_required" = yes],[ LIBUUID_LDFLAGS='-luuid' ])],
+ AS_IF([test "x$ax_cv_libuuid_is_required" = xyes],[ LIBUUID_LIB='-luuid' ])],
[AC_DEFINE([HAVE_UUID_UUID_H],[0],[Have uuid/uuid.h])
])
- AC_SUBST([LIBUUID_LDFLAGS])
- AM_CONDITIONAL([HAVE_LIBUUID],[test "$ax_libuuid" = yes])
+ AC_SUBST([LIBUUID_LIB])
+ AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes])
])
AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE],
AC_CACHE_CHECK([for uuid_generate_time_safe],
[ax_cv_uuid_generate_time_safe],
[AX_SAVE_FLAGS
- LIBS="$LIBUUID_LDFLAGS $LIBS"
+ LIBS="$LIBUUID_LIB $LIBS"
AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([#include <uuid/uuid.h>],[
# serial 1
AC_DEFUN([CHECK_FOR_LIBGEARMAND],
- [AX_CHECK_LIBRARY([LIBGEARMAN], [libgearman/gearmand.h], [gearman],
+ [AX_CHECK_LIBRARY([LIBGEARMAN],[libgearman/gearman.h],[gearman],
[ax_check_for_libgearman=yes],
[ax_check_for_libgearman=no])
AS_IF([test "$ax_check_for_libgearman" = xyes],
[AC_DEFINE([HAVE_LIBGEARMAN],[1],[Enables libgearman Support])],
[AC_DEFINE([HAVE_LIBGEARMAN],[0],[Enables libgearman Support])])
- AM_CONDITIONAL(HAVE_LIBGEARMAN,[test "$ax_check_for_libgearman" = xyes])
])
tests_libmemcached_1_0_testapp_DEPENDENCIES+= libhashkit/libhashkit.la
tests_libmemcached_1_0_testapp_DEPENDENCIES+= libmemcached/libmemcachedutil.la
-tests_libmemcached_1_0_testapp_LDADD+= @LIBUUID_LDFLAGS@
+tests_libmemcached_1_0_testapp_LDADD+= @LIBUUID_LIB@
tests_libmemcached_1_0_testapp_LDADD+= @PTHREAD_LIBS@
tests_libmemcached_1_0_testapp_LDADD+= libmemcached/libmemcached.la
tests_libmemcached_1_0_testapp_LDADD+= libmemcached/libmemcachedutil.la
tests_libmemcached_1_0_testsocket_DEPENDENCIES+= libhashkit/libhashkit.la
tests_libmemcached_1_0_testsocket_DEPENDENCIES+= libmemcached/libmemcachedutil.la
-tests_libmemcached_1_0_testsocket_LDADD+= @LIBUUID_LDFLAGS@
+tests_libmemcached_1_0_testsocket_LDADD+= @LIBUUID_LIB@
tests_libmemcached_1_0_testsocket_LDADD+= @PTHREAD_LIBS@
tests_libmemcached_1_0_testsocket_LDADD+= libmemcached/libmemcached.la
tests_libmemcached_1_0_testsocket_LDADD+= libmemcached/libmemcachedutil.la
*/
-#include <mem_config.h>
+#include "mem_config.h"
#include "util/instance.hpp"
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
+#endif
+
+#ifndef INVALID_SOCKET
+# define INVALID_SOCKET -1
+#endif
+
+#ifndef SOCKET_ERROR
+# define SOCKET_ERROR -1
+#endif
+
+#ifndef get_socket_errno
+# define get_socket_errno() errno
+#endif
+
+#ifndef closesocket
+# define closesocket(a) close(a)
#endif
#pragma once
-#include <cstdio>
-#include <cerrno>
#include <cassert>
+#include <cerrno>
#include <cstddef>
-#include <sys/socket.h>
+#include <cstdio>
+#include <netinet/in.h>
#include <string>
+#include <sys/socket.h>
#include "util/operation.hpp"