bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature request: turn off, save and restore AC_LANG_WERROR


From: Harald van Dijk
Subject: Feature request: turn off, save and restore AC_LANG_WERROR
Date: Mon, 08 Aug 2011 22:42:54 +0200

Hi,

I'd like to be able to turn on AC_LANG_WERROR for a configure test, and
turn it back off after the test. I found I can do this using the
ac_c_werror_flag variable, as used in the default check for the -g
compiler flag, but as far as I can tell this is an internal flag and I
should not be using it in my own script. Could macros be added to
change, save and restore the state?

I'm thinking about something like the below. I have not tested this
extensively, and there are probably stylistic issues, and I have not yet
looked at updating the documentation, I'm just asking if this approach
would be acceptable.

Alternatively, could changing ac_${lang}_werror_flag be mentioned in the
documentation and supported?

Cheers,
Harald

diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index d2e98f9..c763efb 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -713,10 +713,45 @@ ac_objext=$OBJEXT
 ## 4. Compilers' characteristics.  ##
 ## ------------------------------- ##
 
+# _AC_LANG_INIT_WERROR
+# --------------------
+AC_DEFUN([_AC_LANG_INIT_WERROR],
+[m4_divert_once([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])])
+
 # 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=])
+[_AC_LANG_INIT_WERROR
 ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR
+
+
+# AC_LANG_NO_WERROR
+# -----------------
+# Stop treating warnings from the current language's preprocessor,
+# compiler, and linker as fatal errors.
+AC_DEFUN([AC_LANG_NO_WERROR],
+[_AC_LANG_INIT_WERROR
+ac_[]_AC_LANG_ABBREV[]_werror_flag=])# AC_LANG_WERROR
+
+
+m4_define([_AC_LANG_WERROR_COUNT], [0])
+
+
+# AC_LANG_PUSH_WERROR
+# -------------------
+# Save the current state of AC_LANG_WERROR
+AC_DEFUN([AC_LANG_PUSH_WERROR],
+[_AC_LANG_INIT_WERROR
+m4_define([_AC_LANG_WERROR_COUNT], incr(_AC_LANG_WERROR_COUNT))
+ac_xsave_[]_AC_LANG_WERROR_COUNT[]_[]_AC_LANG_ABBREV[]_werror_flag=
$ac_[]_AC_LANG_ABBREV[]_werror_flag])
+
+
+# AC_LANG_POP_WERROR
+# ------------------
+# Restores the state of AC_LANG_WERROR
+AC_DEFUN([AC_LANG_POP_WERROR],
+[_AC_LANG_INIT_WERROR
+ac_[]_AC_LANG_ABBREV[]_werror_flag=
$ac_xsave_[]_AC_LANG_WERROR_COUNT[]_[]_AC_LANG_ABBREV[]_werror_flag
+m4_define([_AC_LANG_WERROR_COUNT], decr(_AC_LANG_WERROR_COUNT))])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]