+2003-10-20 Daniel Jacobowitz <drow@mvista.com>
+
+ * lib/autoconf/lang.m4 (AC_LANG_WERROR): New macro.
+ * lib/autoconf/general.m4 (_AC_COMPILE_IFELSE, _AC_PREPROC_IFELSE)
+ (_AC_LINK_IFELSE): Check the werror flag.
+ * doc/autoconf.texi (Generic Compiler Characteristics): Document
+ AC_LANG_WERROR.
+ * NEWS: Mention it.
+
2003-10-20 Daniel Jacobowitz <drow@mvista.com>
* lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Override
** AC_CONFIG_MACRO_DIR
Use this macro to declare the directory for local m4 macros for aclocal.
+** New macros
+ AC_LANG_WERROR
+
* Major changes in Autoconf 2.57f
Released 2003-10-01, by Akim Demaille.
Compilers and Preprocessors
* Specific Compiler Characteristics:: Some portability issues
-* Generic Compiler Characteristics:: Language independent tests
+* Generic Compiler Characteristics:: Language independent tests and features
* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
* Fortran Compiler:: Likewise
@menu
* Specific Compiler Characteristics:: Some portability issues
-* Generic Compiler Characteristics:: Language independent tests
+* Generic Compiler Characteristics:: Language independent tests and features
* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
* Fortran Compiler:: Likewise
defines @code{SIZEOF_INT_P} to be 8 on DEC Alpha AXP systems.
@end defmac
+@defmac AC_LANG_WERROR
+@acindex{LANG_WERROR}
+Normally Autoconf ignores warnings generated by the compiler, linker, and
+preprocessor. If this macro is used, warnings will be treated as fatal
+errors instead for the current language. This macro is useful when the
+results of configuration will be used where warnings are unacceptable; for
+instance, if parts of a program are built with the GCC @samp{-Werror}
+option. If the whole program will be built using @samp{-Werror} it is
+often simpler to put @samp{-Werror} in the compiler flags (@code{CFLAGS}
+etc.).
+@end defmac
@node C Compiler
@subsection C Compiler Characteristics
if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_[]_AC_LANG_ABBREV[]_werror_flag
else
ac_cpp_err=
fi
m4_define([_AC_COMPILE_IFELSE],
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
rm -f conftest.$ac_objext
-AS_IF([AC_TRY_EVAL(ac_compile) &&
+AS_IF([_AC_EVAL_STDERR($ac_compile) &&
+ AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag"
+ || test ! -s conftest.err]) &&
AC_TRY_COMMAND([test -s conftest.$ac_objext])],
[$2],
[_AC_MSG_LOG_CONFTEST
m4_define([_AC_LINK_IFELSE],
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
rm -f conftest.$ac_objext conftest$ac_exeext
-AS_IF([AC_TRY_EVAL(ac_link) &&
+AS_IF([_AC_EVAL_STDERR($ac_link) &&
+ AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag"
+ || test ! -s conftest.err]) &&
AC_TRY_COMMAND([test -s conftest$ac_exeext])],
[$2],
[_AC_MSG_LOG_CONFTEST
## ------------------------------- ##
## 4. Compilers' characteristics. ##
## ------------------------------- ##
+
+# AC_LANG_WERROR
+# ------------------
+# Treat warnings from the current language's preprocessor, compiler, and
+# linker as fatal errors.
+AC_DEFUN([AC_LANG_WERROR],
+[m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=no])
+ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR