1 dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
3 AC_DEFUN([IDT_COMPILE_WARNINGS],[
4 if test -f $srcdir/autogen.sh; then
5 default_compile_warnings="error"
7 default_compile_warnings="no"
10 AC_ARG_WITH(compile-warnings,
11 AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@],
13 [enable_compile_warnings="$withval"],
14 [enable_compile_warnings="$default_compile_warnings"])
17 if test "x$GCC" != xyes; then
18 enable_compile_warnings=no
22 realsave_CFLAGS="$CFLAGS"
24 case "$enable_compile_warnings" in
29 warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
32 warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
33 CFLAGS="$warning_flags $CFLAGS"
34 for option in -Wno-sign-compare -Wno-pointer-sign; do
36 CFLAGS="$CFLAGS $option"
37 AC_MSG_CHECKING([whether gcc understands $option])
38 AC_TRY_COMPILE([], [],
42 AC_MSG_RESULT($has_option)
43 if test $has_option = yes; then
44 warning_flags="$warning_flags $option"
50 if test "$enable_compile_warnings" = "error" ; then
51 warning_flags="$warning_flags -Werror"
55 AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
58 CFLAGS="$realsave_CFLAGS"
59 AC_MSG_CHECKING(what warning flags to pass to the C compiler)
60 AC_MSG_RESULT($warning_flags)
62 WARN_CFLAGS="$warning_flags"