]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/lang.m4 (AC_LANG_WERROR): New macro.
authorDaniel Jacobowitz <drow@mvista.com>
Mon, 20 Oct 2003 16:18:26 +0000 (16:18 +0000)
committerDaniel Jacobowitz <drow@mvista.com>
Mon, 20 Oct 2003 16:18:26 +0000 (16:18 +0000)
* 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.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/lang.m4

index 9444d16147116d76ab92b1ee64e48d0b6633fce8..74a7dcd7c90a76be1e4c237e8c811434a8df3441 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/NEWS b/NEWS
index ba0ce66115f46cea61bb5469ceeed2deb3b39929..2a8508fe98017b1fa66eb5c4263c54e1ca34ea15 100644 (file)
--- 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.
index 8ca5db2a8bd56e87bcf947735e261f3277a21beb..b018c55bf34b23b2fc9731793cd92cf95b77602f 100644 (file)
@@ -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
index 968b3509f21229f765239cc6bfed6bf369fe02c5..9202ad0c5ba97ace73224f1d77f8f926fe0c73ff 100644 (file)
@@ -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
index 05c9f4c8841076c549e8f5554ce71c2cb29a121d..237ea30af4b0c0145ffb288b25dfaf04a23513dd 100644 (file)
@@ -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