aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremanuele-f <faranda@ntop.org>2020-02-13 18:20:23 +0100
committeremanuele-f <faranda@ntop.org>2020-02-13 18:42:13 +0100
commit5c52c00ea4ad8afaebd5259bc53215a1ab41569f (patch)
treef2965a187180b891336b023bb0073c16c8f8e979
parentf89f25c1182a22fbe891fa0fc87ad7ed3e1440b5 (diff)
Add the --with-llvm-sanitizer flag
To enable the leaks detector, set the ASAN_OPTIONS=detect_leaks=1 environment variable, e.g: ASAN_OPTIONS=detect_leaks=1 example/ndpiReader -i test.pcap
-rw-r--r--configure.seed9
-rw-r--r--src/lib/Makefile.in2
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.seed b/configure.seed
index 092b9c022..23ef8490b 100644
--- a/configure.seed
+++ b/configure.seed
@@ -4,6 +4,15 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
+AC_ARG_WITH(llvm_sanitizer, [ --with-llvm-sanitizer Build with support for the LLVM address sanitizer])
+
+AS_IF([test "${with_llvm_sanitizer+set}" = set],[
+ CFLAGS="${CFLAGS} -Wno-unused-value -fsanitize=address -fno-omit-frame-pointer"
+ LDFLAGS="${LDFLAGS} -fsanitize=address"
+ CC=clang
+ CXX=clang++
+])
+
LT_INIT
AC_PROG_CC
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 6be9d78e9..f69c81946 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -14,7 +14,7 @@ prefix = @prefix@
libdir = ${prefix}/lib
includedir = ${prefix}/include/ndpi
CC = @CC@
-CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -O2 -g -Wall @CUSTOM_NDPI@
+CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -Wall @CFLAGS@ @CUSTOM_NDPI@
LDFLAGS = @LDFLAGS@
RANLIB = ranlib