From 0bd1e0d6ebfcc273a725d9d9231eedd26a6129fd Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 19 Oct 2023 15:41:39 +0200 Subject: [PATCH] configure: add --enable-werror Change-Id: Ife3716c667d2e9b3fcd94d3cdc044d594e7dab5a --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index e7d9888..a16f40b 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,25 @@ then 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+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition" + 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_SUBST([CPPFLAGS]) AC_SUBST([CFLAGS]) AC_CONFIG_FILES([Makefile src/Makefile include/Makefile include/libgtpnl/Makefile include/linux/Makefile tools/Makefile libgtpnl.pc])