From: Daniel Jacobowitz Date: Mon, 20 Oct 2003 16:18:26 +0000 (+0000) Subject: * lib/autoconf/lang.m4 (AC_LANG_WERROR): New macro. X-Git-Tag: AUTOCONF-2.57g~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd1ddde557b02a0512a136568054ad7fcdb2b966;p=thirdparty%2Fautoconf.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 9444d161..74a7dcd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-10-20 Daniel Jacobowitz + + * 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 * lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Override diff --git a/NEWS b/NEWS index ba0ce661..2a8508fe 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ ** 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. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 8ca5db2a..b018c55b 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -384,7 +384,7 @@ Types 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 @@ -5163,7 +5163,7 @@ compiling. @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 @@ -5230,6 +5230,17 @@ AC_CHECK_SIZEOF(int *) 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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 968b3509..9202ad0c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2069,6 +2069,7 @@ AC_DEFUN([_AC_PREPROC_IFELSE], 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 @@ -2150,7 +2151,9 @@ AC_DEFUN([AC_EGREP_HEADER], 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 @@ -2189,7 +2192,9 @@ AU_DEFUN([AC_TRY_COMPILE], 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 diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index 05c9f4c8..237ea30a 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -633,3 +633,11 @@ ac_objext=$OBJEXT ## ------------------------------- ## ## 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