From 114fbda5d4748eb1cbadb98c55217d55752bb2da Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 6 Sep 2018 14:49:41 +0200 Subject: osmocon: Add --enable-{werror,sanitize} configure flags Change-Id: I6a69ca514406fa18684ca2621be45f87ee8d64a4 --- src/host/osmocon/configure.ac | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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) -- cgit v1.2.3