[Top][All Lists]

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

Re: Use newer m4_map_args_{w,sep}

From: Eric Blake
Subject: Re: Use newer m4_map_args_{w,sep}
Date: Wed, 12 Nov 2008 06:23:31 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080914 Thunderbird/ Mnenhy/

Hash: SHA1

Hi Ralf, Paolo,

According to Ralf Wildenhues on 11/11/2008 10:53 PM:
>>  ** The autoconf macros AC_DEFINE and AC_DEFINE_UNQUOTED now output
>>     fewer blank lines.
> It is not clear whether "output" refers to the configure or to the
> config.h file here.

Good point.  I'll add the phrase 'to the configure file' at the end.

According to Paolo Bonzini on 11/12/2008 4:50 AM:
> There is one famous package that has this problem: Ruby.
> While I disagree with Ralf that this kind of incompatibilities are "more
> common than we'd like" in Autoconf git, I do think this is a showstopper
> for this patch, unfortunately.

Ouch.  The patch is not dead yet, just stalled.  I have an (untested) idea
for a macro that will strip trailing newlines; does this name sound okay?
 The idea is using m4_regexp to grab the index of the last newline with no
subsequent text (if there is one), using m4_translit to work around
difficulties in matching literal newline in regexp.  Using a newline after
$1 guarantees a match, so I can avoid the m4 1.4.9 bug without using

# m4_chop(STRING)
# ---------------
# Output a quoted version of STRING with all trailing newlines removed.
[m4_format([[%.*s]], m4_regexp(m4_translit([$1]m4_newline, [
]m4_defn([m4_cr_all]), [-]m4_for(,1,255,,.)), [-*$]), [$1])])

Once we have m4_chop, then AC_DEFINE should use:


then Ruby's use of unquoted # in $3 is matched with a newline during the
expansion, rather than the current issue where the # interferes with
detecting the end of the m4_expand; once the expansion is obtained, we can
safely remove the newline since AS_ECHO provides its own and since
m4_expand's output is properly quoted to no longer worry about raw #.

While we're at it, it is time to implement:

# m4_esyscmd_s(COMMAND)
# ---------------------
# Like m4_esyscmd, except strip any trailing newlines from the
# output (thus behaving more like ``).
m4_define([m4_esyscmd_s], [m4_chop(m4_esyscmd([$1]))])

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

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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