Am 16.10.2017 um 12:31 schrieb Joe Orton:
On Fri, Oct 13, 2017 at 11:51:54AM -0400, Jim Jagielski wrote:
The long and short is that under maintainer mode, we cannot
expect AC_CHECK_LIB to being correct any longer, because
the combination of -Werror and -Wstrict-prototypes means
that any and all functions looked for/checked for using
AC_CHECK_LIB will NOT be found, due to warnings which are
now fatal errors during configure time, even if those
functions DO exist.

IMO the correct fix is to add all -W... flags to NOTEST_CFLAGS not
CFLAGS so they don't take effect during the configure run at all.  At
least I can't think of a good motivation for having compiler warnings
enabled when running autoconf tests in general.

Good hint, never used that variable. So what about the following patch instead: just tried it on trunk and seemed to work fine there. Ut changes APACHE_ADD_GCC_CFLAG to operate on NOTEST_CFLAGS instead of CFLAGS (the macro currently is only used in places where we IMHO actually want that change) and introduces NOTEST_CFLAGS use to configure where we handle maintainer mode and debugger mode.

Index: acinclude.m4
===================================================================
--- acinclude.m4        (revision 1812263)
+++ acinclude.m4        (working copy)
@@ -960,7 +960,7 @@
 dnl
 dnl APACHE_ADD_GCC_CFLAGS
 dnl
-dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
+dnl Check if compiler is gcc and supports flag. If yes, add to NOTEST_CFLAGS.
 dnl
 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
   define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
@@ -973,7 +973,7 @@
       CFLAGS="$save_CFLAGS"
     ])
     if test "$]ap_gcc_ckvar[" = "yes" ; then
-       APR_ADDTO(CFLAGS,[$1])
+       APR_ADDTO(NOTEST_CFLAGS,[$1])
     fi
   fi
   undefine([ap_gcc_ckvar])
Index: configure.in
===================================================================
--- configure.in        (revision 1812263)
+++ configure.in        (working copy)
@@ -627,14 +627,10 @@

AC_ARG_ENABLE(maintainer-mode,APACHE_HELP_STRING(--enable-maintainer-mode,Turn on debugging and compile time warnings and load all compiled modules),
 [
   if test "$enableval" = "yes"; then
-    APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
+    APR_ADDTO(NOTEST_CPPFLAGS, -DAP_DEBUG)
     if test "$GCC" = "yes"; then
- APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith])
-      # Next flag needed, because -Wstrict-prototypes in combination with
-      # -Werror leads to compiler errors during configure checks (autoconf
-      # generates incomplete prototypes).
-      APACHE_ADD_GCC_CFLAG([-Wno-error=strict-prototypes])
-      APACHE_ADD_GCC_CFLAG([-std=c89])
+ APR_ADDTO(NOTEST_CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith])
+      #APACHE_ADD_GCC_CFLAG([-std=c89])
       APACHE_ADD_GCC_CFLAG([-Werror])
       APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
       APACHE_ADD_GCC_CFLAG([-Wformat])
@@ -641,7 +637,7 @@
       APACHE_ADD_GCC_CFLAG([-Wformat-security])
       APACHE_ADD_GCC_CFLAG([-Wunused])
     elif test "$AIX_XLC" = "yes"; then
-      APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
+ APR_ADDTO(NOTEST_CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
     fi
     if test "x$enable_load_all_modules" = "x"; then
       LOAD_ALL_MODULES=yes
@@ -657,9 +653,9 @@

AC_ARG_ENABLE(debugger-mode,APACHE_HELP_STRING(--enable-debugger-mode,Turn on debugging and compile time warnings and turn off optimization),
 [
   if test "$enableval" = "yes"; then
-    APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
+    APR_ADDTO(NOTEST_CPPFLAGS, -DAP_DEBUG)
     if test "$GCC" = "yes"; then
- APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith -O0]) + APR_ADDTO(NOTEST_CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith -O0])
       APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
       APACHE_ADD_GCC_CFLAG([-Werror=declaration-after-statement])
       APACHE_ADD_GCC_CFLAG([-Wformat])
@@ -666,7 +662,7 @@
       APACHE_ADD_GCC_CFLAG([-Wformat-security])
       APACHE_ADD_GCC_CFLAG([-Werror=format-security])
     elif test "$AIX_XLC" = "yes"; then
-      APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
+ APR_ADDTO(NOTEST_CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
     fi
   fi
 ])dnl


Regards,

Rainer

Reply via email to