From 71e07cf654c476ab13bf30421524b442cc9ad5a7 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 15 Aug 2015 00:15:59 +0200 Subject: [PATCH] Make building with -Werror optional. I noticed various downstream distros patch out -Werror for one reason or another. This adds an option to make that easier. It is still on by default. --- configure.ac | 14 ++++++++++++++ src/Makefile.am | 4 ---- src/daemon/Makefile.am | 4 ---- src/libcollectdclient/Makefile.am | 4 ---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 6f65df1e..09e87e4b 100644 --- a/configure.ac +++ b/configure.ac @@ -5915,6 +5915,20 @@ AC_SUBST(LCC_VERSION_STRING) AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h) +AM_CFLAGS="-Wall" +AC_ARG_ENABLE([werror], + AS_HELP_STRING( + [--disable-werror], + [Disable -Werror @<:@default=no@:>@)] + ) +) + +if test "x$enable_werror" != "xno" +then + AM_CFLAGS="$AM_CFLAGS -Werror" +fi +AC_SUBST([AM_CFLAGS]) + AC_CONFIG_FILES([Makefile src/Makefile src/daemon/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 9493c246..adadbbd2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,10 +6,6 @@ SUBDIRS += daemon PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\' -if COMPILER_IS_GCC -AM_CFLAGS = -Wall -Werror -endif - AM_CPPFLAGS = -I$(srcdir)/daemon AM_CPPFLAGS += -DPREFIX='"${prefix}"' AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index cd53a7bf..4e383413 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -1,7 +1,3 @@ -if COMPILER_IS_GCC -AM_CFLAGS = -Wall -Werror -endif - AM_CPPFLAGS = -I$(top_srcdir)/src AM_CPPFLAGS += -DPREFIX='"${prefix}"' AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' diff --git a/src/libcollectdclient/Makefile.am b/src/libcollectdclient/Makefile.am index 5abee2f1..e81a5943 100644 --- a/src/libcollectdclient/Makefile.am +++ b/src/libcollectdclient/Makefile.am @@ -1,9 +1,5 @@ AUTOMAKE_OPTIONS = foreign no-dependencies -if COMPILER_IS_GCC -AM_CFLAGS = -Wall -Werror -endif - pkginclude_HEADERS = collectd/client.h collectd/network.h collectd/network_buffer.h collectd/lcc_features.h lib_LTLIBRARIES = libcollectdclient.la nodist_pkgconfig_DATA = libcollectdclient.pc -- 2.11.0