[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improved AC_LANG_WERROR
From: |
Andrey Simonenko |
Subject: |
Re: Improved AC_LANG_WERROR |
Date: |
Sat, 14 Apr 2007 19:54:12 +0300 |
User-agent: |
Mutt/1.5.14 (2007-02-12) |
On Fri, Apr 13, 2007 at 11:21:10AM +0300, Andrey Simonenko wrote:
>
> What is the better place for:
>
> 1. initialization of ac_X_werror_flag variables for all languages
> (which say how to treat warnings).
> 2. initialization of m4 _AC_LANG_X_WERROR_FLAG macro variables for
> all languages (which are used for building stacks of settings).
> All these variables should be initialized only once and for each
> language. Right now this is not implemented, so single two calls:
I decided to implement this in the following way:
lang.m4:
# AC_LANG_WERROR([VALUE])
# -----------------------
# How to treat warnings from the current language's preprocessor, compiler,
# and linker (works in a stack-like fashion):
# 1. No arguments:
# Similarly to AC_LANG_WERROR([on])
# 2. One argument:
# on -- treat warnings as fatal errors + remember previous value;
# off -- do not treat warnings as fatal errors + remember previous value;
# pop -- restore previous value.
AC_DEFUN([AC_LANG_WERROR],
[
m4_ifdef(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG, [], [
m4_divert_text([DEFAULTS], [
m4_define(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG, [off])
ac_[]_AC_LANG_ABBREV[]_werror_flag=])])
m4_if(
$#, 1, [m4_if(
[$1], [on], [
m4_pushdef(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG, [on])
ac_[]_AC_LANG_ABBREV[]_werror_flag=yes],
[$1], [off], [
m4_pushdef(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG, [off])
ac_[]_AC_LANG_ABBREV[]_werror_flag=],
[$1], [pop], [
m4_popdef(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG)
m4_ifdef(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG, [],
[m4_fatal([$0: unbalanced number of `on/off' and `pop' calls
for] _AC_LANG)])
m4_if(
m4_defn(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG), [on],
[ac_[]_AC_LANG_ABBREV[]_werror_flag=yes],
m4_defn(_AC_LANG_[]_AC_LANG_ABBREV[]_WERROR_FLAG), [off],
[ac_[]_AC_LANG_ABBREV[]_werror_flag=],
[m4_fatal([$0: stack of values is damaged])])],
[m4_fatal([$0: wrong argument: `$1'])])],
$#, 0, [AC_LANG_WERROR([on])],
[m4_fatal([$0: incorrect number of arguments: $#])])
])# AC_LANG_WERROR
Also I have a question. To remove all new line characters and extra
white-space characters, which are produced by this macro, from the
configure script, it is necessary to insert many dnl and make code of
this macro unintended. Is this correct, or I misunderstand something?