From: Wayne Davison Date: Tue, 29 Sep 2020 21:22:40 +0000 (-0700) Subject: Handle early gcc versions that don't understand -Wno-pedantic. X-Git-Tag: v3.2.4pre1~116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33e94849b1013ff7e7b04e0a45ab2fffe2dd1e44;p=thirdparty%2Frsync.git Handle early gcc versions that don't understand -Wno-pedantic. --- diff --git a/configure.ac b/configure.ac index eda5f0fa..1116e658 100644 --- a/configure.ac +++ b/configure.ac @@ -116,9 +116,9 @@ fi # I don't want our version too far out of sync. CFLAGS="$CFLAGS -DHAVE_CONFIG_H" -# If GCC, turn on warnings and turn pedantic warnings into errors to ensure an array-init overflow is an error. +# If GCC, turn on warnings. if test x"$GCC" = x"yes"; then - CFLAGS="$CFLAGS -Wall -W -pedantic-errors" + CFLAGS="$CFLAGS -Wall -W" fi AC_ARG_WITH(included-popt, @@ -1046,10 +1046,18 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then with_included_popt=yes fi -if test x"$with_included_popt" = x"yes" -a x"$GCC" = x"yes"; then - # Our internal popt code cannot be compiled with pedantic warnings as errors, so turn off - # pedantic warnings. This does not affect the array-init overflow as an error, though. - CFLAGS="$CFLAGS -Wno-pedantic" +if test x"$GCC" = x"yes"; then + if test x"$with_included_popt" != x"yes"; then + # Turn pedantic warnings into errors to ensure an array-init overflow is an error. + CFLAGS="$CFLAGS -pedantic-errors" + else + # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to + # turn off pedantic warnings (which will not lose the error for array-init overflow). + case `$CC -dumpversion 2>/dev/null` in + 4.*) ;; # Early gcc doesn't understand -Wno-pedantic + *) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; + esac + fi fi AC_MSG_CHECKING([whether to use included libpopt])