summaryrefslogtreecommitdiffstats
path: root/src/host/layer23
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-08-11 12:52:00 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-11 12:59:30 +0000
commit4d07f40b9427743902df86a128453572ba1734bb (patch)
tree9538081f24ae53ef546c102e92c12aeb720736ff /src/host/layer23
parenta50d3fff72c14e69400103379ef743afb03b8d2f (diff)
layer23: Add --enable-sanitize and --enable-werror configure flags
We use this in the network-side Osmocom projects (CNI) and it's useful to have the same flags also for the OsmocomBB host software. Change-Id: I45800c937d665fdbd2dd6b0cee38408f587f1a9f
Diffstat (limited to 'src/host/layer23')
-rw-r--r--src/host/layer23/configure.ac27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/host/layer23/configure.ac b/src/host/layer23/configure.ac
index a5938c7a..3e696103 100644
--- a/src/host/layer23/configure.ac
+++ b/src/host/layer23/configure.ac
@@ -11,6 +11,33 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
+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
+
+AC_ARG_ENABLE(werror,
+ [AS_HELP_STRING(
+ [--enable-werror],
+ [Turn all compiler warnings into errors, with exceptions:
+ a) deprecation (allow upstream to mark deprecation without breaking builds);
+ b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
+ ]
+ )],
+ [werror=$enableval], [werror="no"])
+if test x"$werror" = x"yes"
+then
+ WERROR_FLAGS="-Werror"
+ WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
+ WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
+ CFLAGS="$CFLAGS $WERROR_FLAGS"
+ CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
+fi
+
dnl checks for libraries
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0)