configure: add --enable-Werror
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 11 Feb 2020 22:29:09 +0000 (17:29 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 25 Mar 2020 19:18:21 +0000 (15:18 -0400)
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 <simon.marchi@efficios.com>
Change-Id: I18c33125c717305aac8f1d8a19fee7e065d70c31
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac

index 2bb30edb325316b64307d67a9e968a5aa280e7c4..0614b270efcfa42e3c64856603a9143dd9998cc6 100644 (file)
@@ -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
This page took 0.025874 seconds and 4 git commands to generate.