Fix issue where we couldn't compile if only working with static.
authorBrian Aker <brian@tangent.org>
Fri, 23 Nov 2012 22:24:49 +0000 (17:24 -0500)
committerBrian Aker <brian@tangent.org>
Fri, 23 Nov 2012 22:24:49 +0000 (17:24 -0500)
configure.ac
libmemcached-1.0/t/include.am
libmemcached/backtrace.cc

index b255cefb2e30132e7c0a8d3bcff50a0cadbfa49e..a8fbcafa74f201b7f302e3a9cff72e8ded9ad556 100644 (file)
@@ -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"
index 967051144a46bf36e987aabee9c6fcd581d811e2..82136cd835208d737b1359edaf49f7154a513721 100644 (file)
@@ -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
index d297901615258460d6ace623259d90b9dd2009c5..98361ea55dda229bdf6cf74af2b8a4a11279af3e 100644 (file)
 
 #include <libmemcached/common.h>
 
+#ifdef AX_ENABLE_BACKTRACE
+
 #ifdef HAVE_EXECINFO_H
-#  include <execinfo.h>
+# include <execinfo.h>
 #endif
 
 #ifdef HAVE_GCC_ABI_DEMANGLE
-#  include <cxxabi.h>
+# include <cxxabi.h>
 #endif
 
 #ifdef HAVE_DLFCN_H
-#  include <dlfcn.h>
+# include <dlfcn.h>
 #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