X-Git-Url: http://git.efficios.com/?p=argpar.git;a=blobdiff_plain;f=configure.ac;h=8464b8cfe2c4eeb5d54f30beddccd9c9bac51ef9;hp=01f70d7f16a3adb44dccfd60db739928f7b9015e;hb=871eba329ad77b01051cd29ec372f8ae5a401882;hpb=7ac57709d4964e2c59c9b0592632c374056caa00 diff --git a/configure.ac b/configure.ac index 01f70d7..8464b8c 100644 --- a/configure.ac +++ b/configure.ac @@ -4,9 +4,48 @@ LT_INIT AC_CONFIG_MACRO_DIRS([m4]) +AC_USE_SYSTEM_EXTENSIONS + # Depend on glib just for the tests. PKG_CHECK_MODULES([GLIB], [glib-2.0]) +# When given, add -Werror to WARN_CFLAGS and WARN_CXXFLAGS. +# Disabled by default +AE_FEATURE_DEFAULT_DISABLE +AE_FEATURE([Werror],[Treat compiler warnings as errors.]) + +# Detect warning flags supported by the C compiler and append them to +# WARN_CFLAGS. +# +m4_define([WARN_FLAGS_LIST], [ dnl + -Wall dnl + -Wextra dnl + -Wmissing-prototypes dnl + -Wmissing-declarations dnl + -Wnull-dereference dnl + -Wundef dnl + -Wredundant-decls dnl + -Wshadow dnl + -Wjump-misses-init dnl + -Wsuggest-attribute=format dnl + -Wtautological-constant-out-of-range-compare dnl + -Wnested-externs dnl + -Wwrite-strings dnl + -Wformat=2 dnl + -Wstrict-aliasing dnl + -Wmissing-noreturn dnl + -Winit-self dnl + -Wduplicated-cond dnl + -Wduplicated-branches dnl + -Wlogical-op dnl +]) + +AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror]) +AE_IF_FEATURE_ENABLED([Werror], [WARN_CFLAGS="${WARN_CFLAGS} -Werror"]) +AM_CFLAGS="${AM_CFLAGS} ${WARN_CFLAGS}" + +AC_SUBST(AM_CFLAGS) + AC_CONFIG_FILES([ Makefile argpar/Makefile