diff options
-rw-r--r-- | configure.ac | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index b15f168..6a65990 100644 --- a/configure.ac +++ b/configure.ac @@ -37,19 +37,31 @@ AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="${CFLAGS} -std=c11"], [ AX_CHECK_COMPILE_FLAG([-std=c1x], [CFLAGS="${CFLAGS} -std=c1x"], [], []) ], []) -# Consider also: -# * -Wchkp -# * -Wformat=2 -# * -Wnull-dereference -# * -Winit-self -# * -Wmissing-include-dirs -# * etc. -# Cf. <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html> and -# <http://git.pehjota.net/overworld-rpg/overworld-rpg.git/tree/configure.ac#n60> AX_CFLAGS_WARN_ALL() dnl Adds -Wall or equivalent AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])]) AX_CHECK_COMPILE_FLAG([-Wextra], [AX_APPEND_FLAG([-Wextra])]) +AC_ARG_ENABLE([gcc-warnings], + [AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])], + [case "${enableval}" in yes|no);; *) AC_MSG_ERROR( + [bad value ${enableval} for gcc-warnings option]);; esac], + [ + gcc_warnings=no + gl_GCC_VERSION_IFELSE([4], [6], + [test -d "${srcdir}/.git" && gcc_warnings=yes]) + ] +) +if test "x${gcc_warnings}" = 'xyes'; then + nowarns='' + nowarns="${nowarns} -Wsystem-headers" + gl_MANYWARN_ALL_GCC([warns]) + gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}]) + for warn in ${warns}; do + gl_WARN_ADD([${warn}]) + done + AC_SUBST([WARN_CFLAGS]) +fi + AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto], [AX_APPEND_FLAG([-fdiagnostics-color=auto])]) |