My apologies. I just realized that I submitted a commit-by-commit patch, when I just wanted to share the overall diff. Please use the following as the basis for discussion:
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a2368e7..87c70fb 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -7160,7 +7160,7 @@ makes this invalid. That is why Autoconf stopped issuing
address@hidden table
address@hidden
address@hidden AC_PROG_CC (@ovar{compiler-search-list})
address@hidden AC_PROG_CC (@ovar{compiler-search-list}, @dots{})
address@hidden
address@hidden CC
address@hidden CFLAGS
@@ -7213,6 +7213,15 @@ other compilers. If your package does not like this default, then it is
acceptable to insert the line @samp{: address@hidden""@}} after @code{AC_INIT}
and before @code{AC_PROG_CC} to select an empty default instead.
+Scan for common flags that enable compiler warnings. If found, append them
+to @code{CFLAGS}. To modify this behaviour, for example, to restore the old
+no-warning-flag behaviour, add parameters which will get shifted by 1,
+and passed on to @code{AC_FLAGS_WARN_ALL}.
+
address@hidden
+AC_PROG_CC([], [], [], [echo No warning flags please.])
address@hidden example
+
Many Autoconf macros use a compiler, and thus call
address@hidden([AC_PROG_CC])} to ensure that the compiler has been
determined before the body of the outermost @code{AC_DEFUN} macro.
@@ -7537,7 +7546,7 @@ compiler fix the header files automatically when installed.
address@hidden C++ Compiler Characteristics
address@hidden AC_PROG_CXX (@ovar{compiler-search-list})
address@hidden AC_PROG_CXX (@ovar{compiler-search-list}, @dots{})
address@hidden
address@hidden CXX
address@hidden CXXFLAGS
@@ -7599,6 +7608,16 @@ systems where G++ does not accept @option{-g}), or @option{-g} for other
compilers. If your package does not like this default, then it is
acceptable to insert the line @samp{: address@hidden""@}} after @code{AC_INIT}
and before @code{AC_PROG_CXX} to select an empty default instead.
+
+Scan for common flags that enable compiler warnings. If found, append them
+to @code{CXXFLAGS}. To modify this behaviour, for example, to restore the old
+no-warning-flag behaviour, add parameters which will get shifted by 1,
+and passed on to @code{AC_FLAGS_WARN_ALL}.
+
address@hidden
+AC_PROG_CXX([], [], [], [echo No warning flags please.])
address@hidden example
+
address@hidden defmac
address@hidden AC_PROG_CXXCPP
@@ -7825,7 +7844,7 @@ The result of the GNU test is cached in the
address@hidden variable.
address@hidden defmac
address@hidden AC_PROG_FC (@ovar{compiler-search-list}, @ovar{dialect})
address@hidden AC_PROG_FC (@ovar{compiler-search-list}, @ovar{dialect}, @dots{})
address@hidden
address@hidden FC
address@hidden FCFLAGS
@@ -7863,6 +7882,17 @@ set @code{FCFLAGS} to @option{-g} for all other Fortran compilers.
The result of the GNU test is cached in the @code{ac_cv_fc_compiler_gnu}
variable, acceptance of @option{-g} in the @code{ac_cv_prog_fc_g}
variable.
+
+Scan for common flags that enable compiler warnings. If found, append them
+to @code{FCFLAGS}. To modify this behaviour, for example, to restore the old
+no-warning-flag behaviour, add parameters which will get shifted by 2,
+and passed on to @code{AC_FLAGS_WARN_ALL}.
+
address@hidden
+AC_PROG_FC([], [], [], [], [echo No warning flags please.])
address@hidden example
+
+
address@hidden defmac
address@hidden AC_PROG_F77_C_O
@@ -23427,6 +23457,71 @@ The current language does not change. @code{AC_LANG_PUSH} is preferred
(@pxref{AC_LANG_PUSH}).
address@hidden defmac
address@hidden
address@hidden AC_CFLAGS_WARN_ALL(@var{shell-variable-to-add-to}, @var{add-value-if-not-found}, @var{action-if-found}, @var{action-if-not-found})
address@hidden
+Try to find a C compiler option that enables most reasonable warnings. See
address@hidden for how to use the (optional) parameters. The most
+typical usage is shown below.
+
address@hidden
+AC_CFLAGS_WARN_ALL
address@hidden example
address@hidden defmac
+
address@hidden
address@hidden AC_CXXFLAGS_WARN_ALL(@var{shell-variable-to-add-to}, @var{add-value-if-not-found}, @var{action-if-found}, @var{action-if-not-found})
address@hidden
+Try to find a C++ compiler option that enables most reasonable warnings. See
address@hidden for how to use the (optional) parameters. The most
+typical usage is shown below.
+
address@hidden
+AC_CXXFLAGS_WARN_ALL
address@hidden example
address@hidden defmac
+
address@hidden
address@hidden AC_FCFLAGS_WARN_ALL(@var{shell-variable-to-add-to}, @var{add-value-if-not-found}, @var{action-if-found}, @var{action-if-not-found})
address@hidden
+Try to find a Fortran compiler option that enables most reasonable warnings.
+See @pxref{AC_FLAGS_WARN_ALL} for how to use the (optional) parameters. The most
+typical usage is shown below.
+
address@hidden
+AC_FCFLAGS_WARN_ALL
address@hidden example
address@hidden defmac
+
address@hidden
address@hidden AC_FLAGS_WARN_ALL(@var{shell-variable-to-add-to}, @var{add-value-if-not-found}, @var{action-if-found}, @var{action-if-not-found})
address@hidden
+Try to find a compiler option that enables most reasonable warnings.
+
+Usually not used directly. Instead, use @pxref{AC_CFLAGS_WARN_ALL},
address@hidden, or @pxref{AC_FCFLAGS_WARN_ALL}, all of which perform
+a requisite @pxref{AC_LANG_PUSH}, and then invoke this macro without altering any
+positional parameters they were provided.
+
+The first positional parameter defines the shell variable to use, and
+if not provided, depends on @pxref{AC_LANG_PUSH} having been invoked properly.
+If appropriate warning flag values can be automatically determined for the
+compiler, then the third positional parameter (if present) defines an
+alternate action to take instead of appending to the shell variable. If no
+appropriate warning flag values could be determined, then the second
+positional parameter (if present) defines alternate flags to append to the
+shell variable, unless the fourth positional parameter is present, in which
+case it defines an alternate action to take instead of appending to the shell
+variable.
address@hidden defmac
+
address@hidden AC_APPEND_FLAG(@var{add-value})
address@hidden
+Used internally by @pxref{AC_FLAGS_WARN_ALL}. Behavior is to append the given to
+the shell variable determined or provided in the call to
address@hidden, but only if it is not already present there.
address@hidden defmac
+
address@hidden AC_LINK_FILES (@address@hidden, @address@hidden)
address@hidden
This is an obsolete version of @code{AC_CONFIG_LINKS}
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 25780f9..c018c92 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -424,11 +424,17 @@ AU_DEFUN([ac_cv_prog_gcc],
[ac_cv_c_compiler_gnu])
-# AC_PROG_CC([COMPILER ...])
+# AC_PROG_CC([COMPILER ...], ...)
# --------------------------
# COMPILER ... is a space separated list of C compilers to search for.
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
+# Any extra parameters will be passed on to AC_FLAGS_WARN_ALL. If there
+# are no extra parameters, then compiler warnings will be turned on. An
+# example of how to avoid this is invoking
+# AC_PROG_CC([COMPILER ...], [], [], [echo No extra warnings please.])
+# Where the final parameter is providing an alternate action to enabling
+# warning flags.
AN_MAKEVAR([CC], [AC_PROG_CC])
AN_PROGRAM([cc], [AC_PROG_CC])
AN_PROGRAM([gcc], [AC_PROG_CC])
@@ -491,6 +497,7 @@ _AC_PROG_CC_C11([ac_prog_cc_stdc=c11
[ac_prog_cc_stdc=no
ac_cv_prog_cc_stdc=no])])])
dnl
+AC_FLAGS_WARN_ALL(m4_shift($@))
AC_LANG_POP(C)dnl
])# AC_PROG_CC
@@ -674,7 +681,7 @@ AU_DEFUN([ac_cv_prog_gxx],
[ac_cv_cxx_compiler_gnu])
-# AC_PROG_CXX([LIST-OF-COMPILERS])
+# AC_PROG_CXX([LIST-OF-COMPILERS], ...)
# --------------------------------
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search
# for (if not specified, a default list is used). This just gives the
@@ -686,6 +693,12 @@ AU_DEFUN([ac_cv_prog_gxx],
# RCC Rational C++
# xlC_r AIX C Set++ (with support for reentrant code)
# xlC AIX C Set++
+# Any extra parameters will be passed on to AC_FLAGS_WARN_ALL. If there
+# are no extra parameters, then compiler warnings will be turned on. An
+# example of how to avoid this is invoking
+# AC_PROG_CXX([LIST-OF-COMPILERS], [], [], [echo No extra warnings please.])
+# Where the final parameter is providing an alternate action to enabling
+# warning flags.
AN_MAKEVAR([CXX], [AC_PROG_CXX])
AN_PROGRAM([CC], [AC_PROG_CXX])
AN_PROGRAM([c++], [AC_PROG_CXX])
@@ -732,6 +745,7 @@ _AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11
ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98],
[ac_prog_cxx_stdcxx=no
ac_cv_prog_cxx_stdcxx=no])])
+AC_FLAGS_WARN_ALL(m4_shift($@))
AC_LANG_POP(C++)dnl
])# AC_PROG_CXX
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index f20b029..8280e48 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -371,10 +371,16 @@ AC_LANG_POP(Fortran 77)dnl
])# AC_PROG_F77
-# AC_PROG_FC([COMPILERS...], [DIALECT])
+# AC_PROG_FC([COMPILERS...], [DIALECT], ...)
# -------------------------------------
# COMPILERS is a space separated list of Fortran 77 compilers to search
# for, and [DIALECT] is an optional dialect. See also _AC_PROG_FC.
+# Any extra parameters will be passed on to AC_FLAGS_WARN_ALL. If there
+# are no extra parameters, then compiler warnings will be turned on. An
+# example of how to avoid this is invoking
+# AC_PROG_FC([COMPILERS...], [DIALECT], [], [], [echo No extra warnings please.])
+# Where the final parameter is providing an alternate action to enabling
+# warning flags.
AC_DEFUN([AC_PROG_FC],
[AC_LANG_PUSH(Fortran)dnl
AC_ARG_VAR([FC], [Fortran compiler command])dnl
@@ -387,6 +393,7 @@ if test $ac_compiler_gnu = yes; then
else
GFC=
fi
+AC_FLAGS_WARN_ALL(m4_shift2($@))
AC_LANG_POP(Fortran)dnl
])# AC_PROG_FC
diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index c99f152..0c86b63 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -719,3 +719,139 @@ ac_objext=$OBJEXT
AC_DEFUN([AC_LANG_WERROR],
[m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])
ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR
+
+#
+# SYNOPSIS
+#
+# AC_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+# added in between.
+#
+# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
+# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+# FLAG.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+# NOTE: Copied from AX_APPEND_FLAG in autoconf-archive, which had copyright
+# assigned as follows:
+#
+# Copyright (c) 2008 Guido U. Draheim <
address@hidden>
+# Copyright (c) 2011 Maarten Bosmans <
address@hidden>
+#
+
+#serial 2
+
+AC_DEFUN([AC_APPEND_FLAG],
+[AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
+AS_VAR_SET_IF(FLAGS,
+ [case " AS_VAR_GET(FLAGS) " in
+ *" $1 "*)
+ AC_RUN_LOG([: FLAGS already contains $1])
+ ;;
+ *)
+ AC_RUN_LOG([: FLAGS="$FLAGS $1"])
+ AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
+ ;;
+ esac],
+ [AS_VAR_SET(FLAGS,["$1"])])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AC_APPEND_FLAG
+
+#
+# SYNOPSIS
+#
+# AC_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AC_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AC_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+#
+# DESCRIPTION
+#
+# Try to find a compiler option that enables most reasonable warnings.
+#
+# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
+# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
+#
+# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
+# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
+# Intel compilers. For a given compiler, the Fortran flags are much more
+# experimental than their C equivalents.
+#
+# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
+# - $2 add-value-if-not-found : nothing
+# - $3 action-if-found : add value to shellvariable
+# - $4 action-if-not-found : nothing
+#
+# NOTE: These macros depend on AX_APPEND_FLAG.
+# NOTE: Based upon AX_*FLAGS_WARN_ALL from autoconf-archive, which had
+# copyright assigned as follows:
+#
+# Copyright (c) 2008 Guido U. Draheim <
address@hidden>
+# Copyright (c) 2010 Rhys Ulerich <
address@hidden>
+#
+
+#serial 14
+
+AC_DEFUN([AC_FLAGS_WARN_ALL],[dnl
+AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
+VAR,[VAR="no, unknown"
+ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-warn all % -warn all" dnl Intel
+ "-pedantic % -Wall" dnl GCC
+ "-xstrconst % -v" dnl Solaris C
+ "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
+ "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
+ "-ansi -ansiE % -fullwarn" dnl IRIX
+ "+ESlit % +w1" dnl HP-UX C
+ "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
+ "-h conform % -h msglevel 2" dnl Cray C (Unicos)
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+FLAGS="$ac_save_[]FLAGS"
+])
+AS_VAR_POPDEF([FLAGS])dnl
+AC_REQUIRE([AC_APPEND_FLAG])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_default($4,[m4_ifval($2,[AC_APPEND_FLAG([$2], [$1])])]) ;;
+ *) m4_default($3,[AC_APPEND_FLAG([$VAR], [$1])]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+])dnl AC_FLAGS_WARN_ALL
+dnl implementation tactics:
+dnl the for-argument contains a list of options. The first part of
+dnl these does only exist to detect the compiler - usually it is
+dnl a global option to enable -ansi or -extrawarnings. All other
+dnl compilers will fail about it. That was needed since a lot of
+dnl compilers will give false positives for some option-syntax
+dnl like -Woption or -Xoption as they think of it is a pass-through
+dnl to later compile stages or something. The "%" is used as a
+dnl delimiter. A non-option comment can be given after "%%" marks
+dnl which will be shown but not added to the respective C/CXXFLAGS.
+
+AC_DEFUN([AC_CFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C])
+AC_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C])
+])
+
+AC_DEFUN([AC_CXXFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C++])
+AC_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C++])
+])
+
+AC_DEFUN([AC_FCFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([Fortran])
+AC_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([Fortran])
+])