Re: AC_TRY_COMPILE() annoyances with 2.63b

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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?

# 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])

Is it worth trying to think of a better macro name so that both macros
will favor the second (rather than the third) argument when the first
argument is not empty?

> 
> 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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknZ/LMACgkQ84KuGfSFAYC1EACfY4IEyfl+qWBBnwRAQdrTiTxQ
11YAoMrXfwB7HZVbYFoz/CypJ1xar6Y6
=QqeD
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux