summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSailesh Mukil <smukil@netflix.com>2019-12-09 09:32:12 -0800
committerdormando <dormando@rydia.net>2020-01-13 17:41:57 -0800
commitacdfe1a45dc65507a4eb6a4edad3b3ac8abf151f (patch)
tree9393ad96461542e06a2f6c82b9729707e82441a8 /configure.ac
parent78536dd34e69e5af01b41ddd9013bcb0a1740d7b (diff)
downloadmemcached-acdfe1a45dc65507a4eb6a4edad3b3ac8abf151f.tar.gz
Allow compilation with ASAN
Compiling with ASAN can help find improper memory management by detecting leaks, use after frees, double frees, buffer overflows, etc. It will profile the binary which has an effect on the binary size and possibly a small impact on performance (although a lot better than valgrind). We can use this from GCC-4.8 onwards. To enable, during configure time, run: ./configure --enable-asan Docs: https://github.com/google/sanitizers/wiki/AddressSanitizer Limitations (Pulled from Clang docs, but should be similar for GCC): https://clang.llvm.org/docs/AddressSanitizer.html#limitations
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac11
1 files changed, 11 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index fe8cbec..e1fa597 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,9 @@ AC_ARG_ENABLE(tls,
[AS_HELP_STRING([--enable-tls], [Enable Transport Layer Security EXPERIMENTAL ])])
+AC_ARG_ENABLE(asan,
+ [AS_HELP_STRING([--enable-asan], [Compile with ASAN EXPERIMENTAL ])])
+
dnl **********************************************************************
dnl DETECT_SASL_CB_GETCONF
dnl
@@ -199,12 +202,17 @@ if test "x$enable_arm_crc32" = "xyes"; then
AC_DEFINE([ARM_CRC32],1,[Set to nonzero if you want to enable ARMv8 crc32])
fi
+if test "x$enable_asan" = "xyes"; then
+ AC_DEFINE([ASAN],1,[Set to nonzero if you want to compile using ASAN])
+fi
+
AM_CONDITIONAL([BUILD_DTRACE],[test "$build_dtrace" = "yes"])
AM_CONDITIONAL([DTRACE_INSTRUMENT_OBJ],[test "$dtrace_instrument_obj" = "yes"])
AM_CONDITIONAL([ENABLE_SASL],[test "$enable_sasl" = "yes"])
AM_CONDITIONAL([ENABLE_EXTSTORE],[test "$enable_extstore" = "yes"])
AM_CONDITIONAL([ENABLE_ARM_CRC32],[test "$enable_arm_crc32" = "yes"])
AM_CONDITIONAL([ENABLE_TLS],[test "$enable_tls" = "yes"])
+AM_CONDITIONAL([ENABLE_ASAN],[test "$enable_asan" = "yes"])
AC_SUBST(DTRACE)
@@ -760,6 +768,9 @@ elif test "$GCC" = "yes"
then
GCC_VERSION=`$CC -dumpversion`
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
+ if test "x$enable_asan" = "xyes"; then
+ CFLAGS="$CFLAGS -fsanitize=address"
+ fi
case $GCC_VERSION in
4.4.*)
CFLAGS="$CFLAGS -fno-strict-aliasing"