Add --enable-compile-warnings option to configure script.

This patch adds the option to disable or enable compiler warnings
to maintain compatibility with gnome standard configure options, and
allow users to work around warnings from compiler incompatibility.

--enable-compile-warnings=no disables compile warnings completely,
while --enable-compile-warnings=yes turns on non-fatal warnings.
The default --enable-compile-warnings=error gives the previous behavior.

Dead code for enabling '-ansi -pendantic' is removed, and the
default enabling of -ansi is removed as well. Blanket disabling
GCC extensions and C99 features causes various problems; we're
better off enforcing the dialect we want to use at code review
time.

https://bugzilla.gnome.org/show_bug.cgi?id=616275
This commit is contained in:
Nickolas Lloyd 2010-07-01 17:25:42 +00:00 committed by Owen W. Taylor
parent 7511ea27e2
commit bb3d23f7f6

View File

@ -63,8 +63,15 @@ 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
if test "$enable_compile_warnings" != no ; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
@ -110,17 +117,13 @@ if test "x$GCC" = "xyes"; then
*) CFLAGS="$CFLAGS -Wsign-compare" ;;
esac
if test "x$enable_ansi" = "xyes"; then
if test "$enable_compile_warnings" = error; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
*[\ \ ]-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])