From 1d13723e0a42a770aa4d421c9786d1429ab8d125 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Apr 2016 02:18:35 +0300 Subject: Add configure flag --enable-werror Enable it by default in some build scripts. --- build/bmake | 3 ++- build/bmakedebug | 3 ++- configure.ac | 13 +++++++++++++ src/Makefile.am | 8 ++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/build/bmake b/build/bmake index 0233974e6..241b582c8 100755 --- a/build/bmake +++ b/build/bmake @@ -48,7 +48,8 @@ autoreconf -i --mandir=$dir/run/share/man \ --enable-memdebug=no \ --enable-tcmalloc=no \ ---enable-googleprofiler=no +--enable-googleprofiler=no \ +--enable-werror cd po make -j8 update-gmo 2>../build/make1.log diff --git a/build/bmakedebug b/build/bmakedebug index ee6a0d210..991d1c259 100755 --- a/build/bmakedebug +++ b/build/bmakedebug @@ -62,7 +62,8 @@ autoreconf -i --enable-memdebug=no \ --enable-tcmalloc=no \ --enable-googleprofiler=no \ ---enable-checks=yes +--enable-checks=yes \ +--enable-werror cd po make -j8 update-gmo 2>../build/make1.log diff --git a/configure.ac b/configure.ac index fa4964ed5..8f009883e 100755 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,19 @@ AM_INIT_AUTOMAKE([1.9]) AC_CONFIG_HEADERS([config.h:config.h.in]) AC_LANG_CPLUSPLUS +# Enable -Werror +AC_ARG_ENABLE(werror, +[ --enable-werror Fail build if warning present], +[case "${enableval}" in + yes) werror_enabled=true + ;; + no) werror_enabled=false + ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; +esac],[werror_enabled=false]) + +AM_CONDITIONAL(ENABLE_WERROR, test x$werror_enabled = xtrue) + # Checks for android. AC_ARG_ENABLE(androidbuild, [ --enable-androidbuild Turn on android building], diff --git a/src/Makefile.am b/src/Makefile.am index a28ed7985..d537e8f60 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,11 @@ manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \ -DLOCALEDIR=\""$(localedir)"\" \ -Wall +if ENABLE_WERROR +manaplus_CXXFLAGS += -Werror +dyecmd_CXXFLAGS += -Werror +endif + if ENABLE_PUGIXML manaplus_CXXFLAGS += -DENABLE_PUGIXML dyecmd_CXXFLAGS += -DENABLE_PUGIXML @@ -1753,6 +1758,9 @@ manaplustests_CXXFLAGS = ${manaplus_CXXFLAGS} \ if USE_SDL2 manaplustests_CXXFLAGS += -DUSE_SDL2 endif +if ENABLE_WERROR +manaplustests_CXXFLAGS += -Werror +endif manaplustests_SOURCES = ${manaplus_SOURCES} \ enums/enums_unittest.cc \ -- cgit v1.2.3-60-g2f50