[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_TRY_COMPILE() annoyances with 2.63b
From: |
Mike Frysinger |
Subject: |
Re: AC_TRY_COMPILE() annoyances with 2.63b |
Date: |
Mon, 6 Apr 2009 09:16:53 -0400 |
User-agent: |
KMail/1.11.1 (Linux/2.6.28; KDE/4.2.1; x86_64; ; ) |
On Monday 06 April 2009 08:59:32 Eric Blake wrote:
> According to Mike Frysinger on 4/5/2009 7:19 PM:
> >> i'm not an expert by any means with internal autoconf/m4. if there's a
> >> m4 helper function to test whether an argument contains something other
> >> than whitespace, then the change to m4sh.m4:_AS_IF is trivial ... use
> >> that rather than m4_ifvaln([$1],....
> >
> > to answer my own question and to post a patch, m4_normalize can be used:
>
> Indeed. However, m4_normalize is an expensive choice for doing this check
> (it involves regular expressions). I'm thinking of introducing a new
> m4sugar macro (untested in this email) that can be used for this purpose
> with less overhead - any suggestions for a better name?
"blank" is actually what i thought of at first when i went looking for a
preexisting function ;)
> # m4_ifblank(COND, [IF-BLANK], [IF-TEXT])
> # ---------------------------------------
> # If COND is empty, or consists only of blanks (space, tab, newline),
> # expand IF-BLANK, else expand IF-TEXT.
> m4_define([m4_ifblank],
> [m4_if(m4_translit([[$1]], [ ][ ][
> ]), [], [$2], [$3])])
>
> Hmm, this means that in addition to differing on a COND consisting of just
> whitespace, m4_ifval and m4_ifblank have opposite if-then sense:
> m4_ifval([$1], [$1], [])
> m4_ifblank([$1], [], [$1])
call it m4_ifnblank() ? or have both so people can swap as needed ? i
imagine people would favor the form for their specific case which only
requires one argument. i know i would.
m4_ifblank(COND, [IF-BLANK], [IF-TEXT])
m4_ifnblank(COND, [IF-TEXT], [IF-BLANK])
> > this should "fix" every macro that uses AS_IF with an "else" argument.
> > it certainly fixes my test case.
>
> I think you are right that fixing AS_IF to detect blank instead of empty
> arguments when performing optimizations will probably help a number of
> poorly-written configure.ac, so I will probably be checking in a patch
> along these lines soon. Note, however, that this still doesn't help
> situations like:
>
> AS_IF([foo], [AC_REQUIRE([bar])])
>
> since the presence of AC_REQUIRE will trigger the IF-TEXT expansion,
> although the subsequent expansion pass will result in a blank body.
true, although i dont really know squat about m4 to propose any solution along
those lines. perhaps have the else case always emit a leading null cmd ":" ?
seems like adding 2 bytes is a small price to pay for the resulting syntax
safety ...
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -607,7 +607,7 @@ m4_define([_AS_IF],
])
m4_define([_AS_IF_ELSE],
[m4_ifvaln([$1],
-[else
+[else :
$1])])
m4_defun([AS_IF],
-mike
signature.asc
Description: This is a digitally signed message part.
- AC_TRY_COMPILE() annoyances with 2.63b, Mike Frysinger, 2009/04/05
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Eric Blake, 2009/04/05
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Mike Frysinger, 2009/04/05
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Mike Frysinger, 2009/04/05
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Eric Blake, 2009/04/06
- Re: AC_TRY_COMPILE() annoyances with 2.63b,
Mike Frysinger <=
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Ralf Wildenhues, 2009/04/06
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Mike Frysinger, 2009/04/06
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Eric Blake, 2009/04/06
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Ralf Wildenhues, 2009/04/07
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Ralf Wildenhues, 2009/04/07
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Mike Frysinger, 2009/04/07
- Re: AC_TRY_COMPILE() annoyances with 2.63b, Andreas Schwab, 2009/04/07
- AS_IF optimization (was: AC_TRY_COMPILE() annoyances with 2.63b), Eric Blake, 2009/04/07
- Re: AS_IF optimization (was: AC_TRY_COMPILE() annoyances with 2.63b), Andreas Schwab, 2009/04/07
- Re: AS_IF optimization, Eric Blake, 2009/04/07