[configure] Invalidate cached warning flags if list of flags changes

such that one doesn't need to remove config.cache when when we add
new warning flags to be checked.
This commit is contained in:
Behdad Esfahbod 2006-09-02 19:51:54 -04:00
parent 7c97a787eb
commit e5a9c23308

View file

@ -92,7 +92,8 @@ dnl ===========================================================================
dnl
dnl cairo_cache_version should be increased every time that the backend
dnl detection stuff changes in a way that removing the config.cache file may be
dnl needed for correct operation.
dnl needed for correct operation. (this is only for the backend detection
dnl changes; it doesn't have any effect on any other cached thing.)
dnl
m4_define(cairo_cache_version, 4)
@ -560,7 +561,28 @@ AC_DEFUN([CAIRO_CC_TRY_FLAG], [
AC_MSG_RESULT([$cairo_cc_flag])
])
dnl Use lots of warning flags with with gcc and compatible compilers
dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked. So there's no need to do anything
dnl else. If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace
MAYBE_WARN="-Wall -Wextra \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum -Wmissing-format-attribute \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement -Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter"
# invalidate cached value if MAYBE_WARN has changed
if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then
unset cairo_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], cairo_cv_warn_cflags, [
echo
WARN_CFLAGS=""
@ -576,20 +598,12 @@ AC_CACHE_CHECK([for supported warning flags], cairo_cv_warn_cflags, [
# options (-Wall and -Wextra) up front and the -Wno options
# last.
MAYBE_WARN="-Wall -Wextra \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum -Wmissing-format-attribute \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement -Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter"
for W in $MAYBE_WARN; do
CAIRO_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
done
cairo_cv_warn_cflags=$WARN_CFLAGS
cairo_cv_warn_maybe=$MAYBE_WARN
AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS=$cairo_cv_warn_cflags