The -Werror flag is great for development, but not so great with releases.
Often times newer (or older) versions of gcc like to warn about different
things, or in different ways depending on the architecture (we don't think
that the maintainer is going to test building for every one out there).

So add a knob for distros to turn off -Werror in their builds.

Signed-off-by: Mike Frysinger <[email protected]>
---
 config/eu.am |    5 ++++-
 configure.ac |    5 +++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/config/eu.am b/config/eu.am
index f259c5b..4c10f55 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -28,11 +28,14 @@
 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
 AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
-           $(if $($(*F)_no_Werror),,-Werror) \
            $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
            $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
            $($(*F)_CFLAGS)
 
+if BUILD_WERROR
+AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
+endif
+
 if MUDFLAP
 AM_CFLAGS += -fmudflap
 libmudflap = -lmudflap
diff --git a/configure.ac b/configure.ac
index a9f1fc9..4c6248c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,11 @@ AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
 AM_CONDITIONAL(BUILD_STATIC, [dnl
 test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
 
+AC_ARG_ENABLE([werror],
+AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
+              [enable_werror=$enableval], [enable_werror=yes])
+AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
+
 AC_ARG_ENABLE([tests-rpath],
 AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
               [tests_use_rpath=yes], [tests_use_rpath=no])
-- 
1.7.6.1

_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel

Reply via email to