From 5c52c00ea4ad8afaebd5259bc53215a1ab41569f Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Thu, 13 Feb 2020 18:20:23 +0100 Subject: 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 --- configure.seed | 9 +++++++++ src/lib/Makefile.in | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3