Add '--enable-sanitize' from other osmocom projects
Change-Id: Iac9ce76ce4ca5f5247bc42c16bb365d94cfde156
diff --git a/configure.ac b/configure.ac
index dfcaa15..459fab1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,18 @@
*) AC_MSG_ERROR([Linux only, dude!]);;
esac
+AC_ARG_ENABLE(sanitize,
+ [AS_HELP_STRING(
+ [--enable-sanitize],
+ [Compile with address sanitizer enabled],
+ )],
+ [sanitize=$enableval], [sanitize="no"])
+if test x"$sanitize" = x"yes"
+then
+ CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
+ CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
+fi
+
regular_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_REENTRANT"
regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
-Wmissing-prototypes -Wshadow -Wstrict-prototypes \
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 4e21fd7..ebdc6ea 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -5,7 +5,7 @@
osmo-clean-workspace.sh
autoreconf --install --force
-./configure CFLAGS="-Werror" CPPFLAGS="-Werror"
+./configure --enable-sanitize CFLAGS="-Werror" CPPFLAGS="-Werror"
$MAKE $PARALLEL_MAKE
$MAKE distcheck