3 dnl GNOME_COMPILE_WARNINGS
4 dnl Turn on many useful compiler warnings
5 dnl For now, only works on GCC
6 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
7 AC_ARG_ENABLE(compile-warnings,
8 [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=yes)
10 AC_MSG_CHECKING(what warning flags to pass to the C compiler)
12 if test "x$GCC" != xyes; then
13 enable_compile_warnings=no
16 if test "x$enable_compile_warnings" != "xno"; then
17 if test "x$GCC" = "xyes"; then
20 *) warnCFLAGS="-g -Wall -Wunused" ;;
23 ## -W is not all that useful. And it cannot be controlled
24 ## with individual -Wno-xxx flags, unlike -Wall
25 if test "x$enable_compile_warnings" = "xyes"; then
26 warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations\
27 -finline-functions -Wshadow -Wpointer-arith \
28 -Wwrite-strings -Wno-unused-function -Werror"
32 AC_MSG_RESULT($warnCFLAGS)
35 [ --enable-iso-c Try to warn if code is not ISO C ],,
38 AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
40 if test "x$enable_iso_c" != "xno"; then
41 if test "x$GCC" = "xyes"; then
44 *) complCFLAGS="$complCFLAGS -ansi" ;;
49 *) complCFLAGS="$complCFLAGS -pedantic" ;;
53 AC_MSG_RESULT($complCFLAGS)
54 if test "x$cflags_set" != "xyes"; then
55 CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"