From 67ee2205f3874e2f14c1c98606b0b98ccdfc34a5 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 22 Feb 2007 10:59:25 +0200 Subject: [PATCH] Use -Wno-always-true only if $CC accepts it. GCC 4.1 doesn't. --- configure.in | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 5f9e4d7a..a9776da3 100644 --- a/configure.in +++ b/configure.in @@ -1413,13 +1413,28 @@ if test "x$ac_cv_prog_gcc" = "xyes"; then ;; 4.*) # Do not show warnings related to (char * | unsigned char *) type - # difference. Do not show "always evaluate as true". - CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign -Wno-always-true" + # difference. + CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign" ;; *) # These should be ok using -Werror ;; esac + + # GCC 4.2 snapshots warn that comparisons like &object != NULL + # always return true. Some macros in ELinks check whether pointer + # arguments are NULL, and giving them addresses of named objects + # triggers the warning. These warnings have not revealed any real + # bugs, so shut them up instead of complicating the code. GCC 4.1 + # does not recognize -Wno-always-true and exits with code 1 if it is + # given. + AC_MSG_CHECKING([whether $CC accepts -Wno-always-true]) + EL_SAVE_FLAGS + CFLAGS="$CFLAGS -Wno-always-true" + AC_TRY_COMPILE([], [], + [AC_MSG_RESULT([yes])], + [EL_RESTORE_FLAGS + AC_MSG_RESULT([no])]) fi EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])