Add --enable-sanitize configure option
Change-Id: Idb2c1d6057012ed2f032e7504387a0767d02d75b
diff --git a/configure.ac b/configure.ac
index 3533af9..5867cbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,15 @@
dnl Checks for typedefs, structures and compiler characteristics
+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
+
dnl checks for libraries
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.1)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty)