]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: add --enable-werror
authorKarel Zak <kzak@redhat.com>
Wed, 1 Jul 2020 13:23:10 +0000 (15:23 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Jul 2020 13:23:10 +0000 (15:23 +0200)
Add new ./configure option to make all compiler warnings into errors.

Addresses: https://github.com/karelzak/util-linux/issues/1083
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac

index 80da3f4201c4f11afe57575f9db9774231782a89..543f2cc0ca169c75b7ab4cc5f14183ef193e00aa 100644 (file)
@@ -122,7 +122,6 @@ AC_C_BIGENDIAN
 dnl Compiler warnings
 UL_WARN_ADD([-fno-common])
 UL_WARN_ADD([-Wall])
-UL_WARN_ADD([-Werror=sequence-point])
 UL_WARN_ADD([-Wextra])
 UL_WARN_ADD([-Wextra-semi])
 UL_WARN_ADD([-Wembedded-directive])
@@ -146,8 +145,20 @@ UL_WARN_ADD([-Wformat-security])
 UL_WARN_ADD([-Wimplicit-function-declaration])
 UL_WARN_ADD([-Wdiscarded-qualifiers])
 UL_WARN_ADD([-Waddress-of-packed-member])
+
+AC_ARG_ENABLE([werror],
+  AS_HELP_STRING([--enable-werror], [make all compiler warnings into errors]),
+  [], [enable_werror=no]
+)
+AS_IF([test "x$enable_werror" = xyes], [
+  UL_WARN_ADD([-Werror])
+],[
+  UL_WARN_ADD([-Werror=sequence-point])
+])
+
 AC_SUBST([WARN_CFLAGS])
 
+
 UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
 AC_SUBST([BSD_WARN_CFLAGS])