Building with -Werror makes a lot of sense for development, but not a lot for distro deployments. Changes in default flag settings, versions of the compiler or C library, or 3rd party libraries can easily trigger harmless warnings that are a waste of time to track down. Especially when elfutils itself enables many extra -W flags. So add a configure flag for distros to utilize when building.
Signed-off-by: Mike Frysinger <[email protected]> --- ChangeLog | 5 +++++ config/eu.am | 2 +- configure.ac | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a0ce570..3ccd2a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-02 Mike Frysinger <[email protected]> + + * configure.ac: Add --disable-werror flag. Export WERROR. + * config/eu.am (AM_CFLAGS): Change -Werror to $(WERROR). + 2013-12-20 Mark Wielaard <[email protected]> * NEWS (libdwfl): Add dwfl_getthread_frames. diff --git a/config/eu.am b/config/eu.am index 38718c7..220c843 100644 --- a/config/eu.am +++ b/config/eu.am @@ -32,7 +32,7 @@ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. AM_CFLAGS = -std=gnu99 -Wall -Wshadow \ - $(if $($(*F)_no_Werror),,-Werror) \ + $(if $($(*F)_no_Werror),,$(WERROR)) \ $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ $($(*F)_CFLAGS) diff --git a/configure.ac b/configure.ac index 72fb3e8..f0fe890 100644 --- a/configure.ac +++ b/configure.ac @@ -48,6 +48,14 @@ AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) AC_CANONICAL_HOST +AC_ARG_ENABLE(werror, +[AS_HELP_STRING([--disable-werror], + [turn off -Werror @<:@default=enabled@:>@])]) +if test "x$enable_werror" != "xno"; then + WERROR="-Werror" +fi +AC_SUBST(WERROR) + AC_ARG_ENABLE(deterministic-archives, [AS_HELP_STRING([--enable-deterministic-archives], [ar and ranlib default to -D behavior])], [ -- 1.8.4.3
