From 883db334d8d993e134c2628f03514c5d00faee0a Mon Sep 17 00:00:00 2001 From: Gilles Espinasse Date: Mon, 2 Jul 2012 01:02:44 +0200 Subject: [PATCH] Fix unsupported -Wno option detection As gcc-4.4 and later accept every -Wno option, test for the option without no to check if the option is supported. For unsupported option, gcc warn 'unrecognized command line option' only when another warning occure. Signed-off-by: Gilles Espinasse --- build/configure.ac.warnings | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings index 9b9c742..b14cb6b 100644 --- a/build/configure.ac.warnings +++ b/build/configure.ac.warnings @@ -22,7 +22,9 @@ MAYBE_WARN="-Wall -Wextra \ -Wno-attributes -Wno-long-long -Winline" # -Wunused-but-set-variable is too noisy at present -NO_WARN="-Wno-unused-but-set-variable" +# gcc-4.4 and later accept every -Wno- option but may complain later if +# another warning happen. +NO_WARN="unused-but-set-variable" dnl Sun Studio 12 likes to rag at us for abusing enums like dnl having cairo_status_t variables hold cairo_int_status_t @@ -48,8 +50,6 @@ MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common" dnl Also to turn various gcc/glibc-specific preprocessor checks MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2" -MAYBE_WARN="$MAYBE_WARN $NO_WARN" - # invalidate cached value if MAYBE_WARN has changed if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then unset cairo_cv_warn_cflags @@ -72,6 +72,9 @@ AC_CACHE_CHECK([for supported warning flags], cairo_cv_warn_cflags, [ for W in $MAYBE_WARN; do CAIRO_CC_TRY_FLAG([$W],, [WARN_CFLAGS="$WARN_CFLAGS $W"]) done + for W in $NO_WARN; do + CAIRO_CC_TRY_FLAG([-W$W],, [WARN_CFLAGS="$WARN_CFLAGS -Wno-$W"]) + done cairo_cv_warn_cflags=$WARN_CFLAGS cairo_cv_warn_maybe=$MAYBE_WARN -- 1.7.2.5