From 03d1a2a58d61fc30135f49032ab95c6785aa4ec6 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 23 Nov 2012 17:24:49 -0500 Subject: [PATCH] Fix issue where we couldn't compile if only working with static. --- configure.ac | 4 +++- libmemcached-1.0/t/include.am | 17 ++++++++++------- libmemcached/backtrace.cc | 17 ++++++++++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index b255cefb..a8fbcafa 100644 --- a/configure.ac +++ b/configure.ac @@ -280,8 +280,9 @@ CHECK_FOR_PTHREAD_AND_SASL # backtrace() does not work with static builds. -AS_IF([test "x$enable_static" = "xyes"], +AS_IF([test "x$enable_shared" = "xyes"], [AC_DEFINE([AX_ENABLE_BACKTRACE],[1],[Support for backtrace().])]) +AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"]) PANDORA_ENABLE_DTRACE HAVE_GCC_ATOMICS @@ -313,6 +314,7 @@ echo " * CPP Flags: $CPPFLAGS" echo " * LIB Flags: $LIB" echo " * Assertions enabled: $ax_enable_assert" echo " * Debug enabled: $ax_enable_debug" +echo " * Shared: $enable_shared" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * SASL support: $ax_sasl_option" echo " * make -j: $enable_jobserver" diff --git a/libmemcached-1.0/t/include.am b/libmemcached-1.0/t/include.am index 96705114..82136cd8 100644 --- a/libmemcached-1.0/t/include.am +++ b/libmemcached-1.0/t/include.am @@ -10,6 +10,7 @@ LIBMEMCACHED_1_0_TEST_PATH= libmemcached-1.0/t +if SHARED_ENABLED # Test linking with C application libmemcached_1_0_t_c_test_SOURCES= libmemcached-1.0/t/c_test.c libmemcached_1_0_t_c_test_LDADD= libmemcached/libmemcached.la @@ -17,16 +18,18 @@ libmemcached_1_0_t_c_test_DEPENDENCIES= libmemcached/libmemcached.la check_PROGRAMS+= libmemcached-1.0/t/c_test noinst_PROGRAMS+= libmemcached-1.0/t/c_test -# Test linking with C++ application -libmemcached_1_0_t_cc_test_SOURCES= libmemcached-1.0/t/cc_test.cc -libmemcached_1_0_t_cc_test_LDADD= libmemcached/libmemcached.la -libmemcached_1_0_t_cc_test_DEPENDENCIES= libmemcached/libmemcached.la -check_PROGRAMS+= libmemcached-1.0/t/cc_test -noinst_PROGRAMS+= libmemcached-1.0/t/cc_test - # Test linking with C application/SASL include libmemcached_1_0_t_c_sasl_test_SOURCES= libmemcached-1.0/t/c_sasl_test.c libmemcached_1_0_t_c_sasl_test_LDADD= libmemcached/libmemcached.la libmemcached_1_0_t_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la check_PROGRAMS+= libmemcached-1.0/t/c_sasl_test noinst_PROGRAMS+= libmemcached-1.0/t/c_sasl_test +else +endif + +# Test linking with C++ application +libmemcached_1_0_t_cc_test_SOURCES= libmemcached-1.0/t/cc_test.cc +libmemcached_1_0_t_cc_test_LDADD= libmemcached/libmemcached.la +libmemcached_1_0_t_cc_test_DEPENDENCIES= libmemcached/libmemcached.la +check_PROGRAMS+= libmemcached-1.0/t/cc_test +noinst_PROGRAMS+= libmemcached-1.0/t/cc_test diff --git a/libmemcached/backtrace.cc b/libmemcached/backtrace.cc index d2979016..98361ea5 100644 --- a/libmemcached/backtrace.cc +++ b/libmemcached/backtrace.cc @@ -37,22 +37,24 @@ #include +#ifdef AX_ENABLE_BACKTRACE + #ifdef HAVE_EXECINFO_H -# include +# include #endif #ifdef HAVE_GCC_ABI_DEMANGLE -# include +# include #endif #ifdef HAVE_DLFCN_H -# include +# include #endif #ifdef HAVE_GCC_ABI_DEMANGLE -# define USE_DEMANGLE 1 +# define USE_DEMANGLE 1 #else -# define USE_DEMANGLE 0 +# define USE_DEMANGLE 0 #endif const int MAX_DEPTH= 50; @@ -95,4 +97,9 @@ void custom_backtrace(void) } } #endif // HAVE_EXECINFO_H + +#else // AX_ENABLE_BACKTRACE +void custom_backtrace(void) +{ } +#endif // AX_ENABLE_BACKTRACE -- 2.30.2