From fa3f8be960428e090b9576e3c67f0db33ed369d5 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 11 Feb 2020 17:29:09 -0500 Subject: [PATCH] configure: add --enable-Werror MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If one wants to build with -Werror, it's not possible to simply configure with -Werror in the CFLAGS. This makes a bunch of configure checks fail, which would have otherwise passed. This patch adds an --enable-Werror option to configure, which has the effect of adding -Werror to AM_CFLAGS. It therefore ends up in the CFLAGS used to build the project, but it doesn't interfere with the configure checks. Signed-off-by: Simon Marchi Change-Id: I18c33125c717305aac8f1d8a19fee7e065d70c31 Signed-off-by: Jérémie Galarneau --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 2bb30edb3..0614b270e 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,14 @@ AX_APPEND_COMPILE_FLAGS([ dnl [WARN_CFLAGS], [-Werror]) +# When given, add -Werror to WARN_CFLAGS. +AC_ARG_ENABLE([Werror], + [AS_HELP_STRING([--enable-Werror], [Treat compiler warnings as errors.])] +) +AS_IF([test "x$enable_Werror" = "xyes"], + [WARN_CFLAGS="${WARN_CFLAGS} -Werror"] +) + # Checks for programs. AC_PROG_GREP AC_PROG_MAKE_SET -- 2.34.1