[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_WERROR
From: |
Daniel Jacobowitz |
Subject: |
Re: AC_PROG_WERROR |
Date: |
Thu, 16 Oct 2003 12:31:57 -0400 |
User-agent: |
Mutt/1.5.1i |
On Thu, Oct 16, 2003 at 12:30:11PM -0400, Daniel Jacobowitz wrote:
> On Fri, Oct 03, 2003 at 09:03:00AM +0200, Akim Demaille wrote:
> >
> > > On Thu, Oct 02, 2003 at 09:18:32AM +0200, Akim Demaille wrote:
> > >> Issues:
> > >>
> > >> 1. I think the name is wrong indeed, and I'm not sure we want this
> > >> to be independent of the current language
> > >>
> > >> 2. The documentation should make it clear when and why using this
> > >> macro
> > >>
> > >> 3. NEWS it please :)
> >
> > > How's this? Any better?
> >
> > This is much better. But:
> >
> > ~/src/gnu % grep -i autoconf copyright.list | grep -i daniel nostromo
> > 9:01
> > ~/src/gnu % grep -i autoconf copyright.list | grep -i jaco nostromo
> > Err 1
> >
> > you don't seem to have filled the papers for Autoconf. Could you do
> > that? You know the process, don't you?
>
> Some time later...
>
> Here's a version against current CVS. Um, I added the NEWS to the
> 2.57g section, I don't remember if 2.57g was released or not...
Oops, patch-below-signature bites again.
2003-10-16 Daniel Jacobowitz <address@hidden>
* 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.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.313
diff -u -p -r1.313 NEWS
--- NEWS 8 Oct 2003 13:12:21 -0000 1.313
+++ NEWS 16 Oct 2003 16:24:11 -0000
@@ -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: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.769
diff -u -p -r1.769 autoconf.texi
--- doc/autoconf.texi 15 Oct 2003 22:56:22 -0000 1.769
+++ doc/autoconf.texi 16 Oct 2003 16:24:18 -0000
@@ -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
address@hidden AC_LANG_WERROR
address@hidden
+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 @code{CFLAGS}, @code{CXXFLAGS}, et
+cetera.
address@hidden defmac
@node C Compiler
@subsection C Compiler Characteristics
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.819
diff -u -p -r1.819 general.m4
--- lib/autoconf/general.m4 8 Oct 2003 13:12:24 -0000 1.819
+++ lib/autoconf/general.m4 16 Oct 2003 16:24:19 -0000
@@ -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: lib/autoconf/lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.165
diff -u -p -r1.165 lang.m4
--- lib/autoconf/lang.m4 3 Sep 2003 00:35:53 -0000 1.165
+++ lib/autoconf/lang.m4 16 Oct 2003 16:24:19 -0000
@@ -617,3 +617,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
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer