1 dnl Copyright (C) 2008 Kim Woelders
2 dnl This code is public domain and can be freely used or copied.
4 dnl Macro to set compiler warning flags
6 dnl Provides configure argument --enable-werror to stop compilation on warnings
8 dnl Usage: AC_C_WARNFLAGS([LANG])
9 dnl Set LANG to 'cpp' when compiling for C++
11 AC_DEFUN([AC_C_WARNFLAGS], [
12 define(ac_c_compile_cpp, ifelse([$1], [cpp], [yes], [no]))
15 [ --enable-werror treat compiler warnings as errors @<:@default=no@:>@],,
18 if test "x$GCC" = "xyes"; then
19 CWARNFLAGS="-W -Wall -Waggregate-return -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings"
20 ifelse(ac_c_compile_cpp, no, [
21 CWARNFLAGS="$CWARNFLAGS -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes"
24 if test "x$enable_werror" = "xyes"; then
25 CWARNFLAGS="$CWARNFLAGS -Werror"