diff --git a/configure.in b/configure.in index 02d903571..d512c5cfd 100644 --- a/configure.in +++ b/configure.in @@ -63,63 +63,66 @@ AC_C_BIGENDIAN #### Warnings +# Stay command-line compatible with the gnome-common configure option. Here +# minimum/yes/maximum are the same, however. +AC_ARG_ENABLE(compile_warnings, + AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],[Turn on compiler warnings]),, + enable_compile_warnings=error) + changequote(,)dnl -if test "x$GCC" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wall" ;; - esac - -# case " $CFLAGS " in -# *[\ \ ]-Wshadow[\ \ ]*) ;; -# *) CFLAGS="$CFLAGS -Wshadow" ;; -# esac - - case " $CFLAGS " in - *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wnested-externs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wnested-externs" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wpointer-arith[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wpointer-arith" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wcast-align[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wcast-align" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wsign-compare[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wsign-compare" ;; - esac - - if test "x$enable_ansi" = "xyes"; then +if test "$enable_compile_warnings" != no ; then + if test "x$GCC" = "xyes"; then case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ansi" ;; + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac + +# case " $CFLAGS " in +# *[\ \ ]-Wshadow[\ \ ]*) ;; +# *) CFLAGS="$CFLAGS -Wshadow" ;; +# esac + + case " $CFLAGS " in + *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; esac case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -pedantic" ;; + *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; esac + + case " $CFLAGS " in + *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wnested-externs[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wnested-externs" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wpointer-arith[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wpointer-arith" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wcast-align[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wcast-align" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wsign-compare[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wsign-compare" ;; + esac + + if test "$enable_compile_warnings" = error; then + case " $CFLAGS " in + *[\ \ ]-Werror[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Werror" ;; + esac + fi fi fi changequote([,])dnl @@ -529,11 +532,6 @@ if test "x$enable_debug" = "xyes"; then CFLAGS="$CFLAGS -g -O" fi -# Warnings are there for a reason -if test "x$GCC" = "xyes"; then - CFLAGS="$CFLAGS -Wall -Werror -ansi" -fi - # For fix-meta-rectangle.py AM_PATH_PYTHON([2.5])