summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-09-06 14:49:41 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-06 15:03:07 +0200
commit114fbda5d4748eb1cbadb98c55217d55752bb2da (patch)
treea8ab72f1575c4f38912ddeaec21baaace5cb8183 /src
parentb103c0e4a3d9db7bdcb07acfe791c4e293df684b (diff)
osmocon: Add --enable-{werror,sanitize} configure flags
Diffstat (limited to 'src')
-rw-r--r--src/host/osmocon/configure.ac27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/host/osmocon/configure.ac b/src/host/osmocon/configure.ac
index 41308003..a42f4874 100644
--- a/src/host/osmocon/configure.ac
+++ b/src/host/osmocon/configure.ac
@@ -21,5 +21,32 @@ AC_HEADER_STDC
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
+
+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
+
AC_OUTPUT(
Makefile)