[Top][All Lists]

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

Re: automake-1.11.1 test failure on Mac OS X 10.6

From: Ralf Wildenhues
Subject: Re: automake-1.11.1 test failure on Mac OS X 10.6
Date: Sat, 16 Jan 2010 12:46:54 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Rugxulo, Andris,

I need your help for a bit of Autoconf testing for me; see below.

Background: Peter reported an Autoconf regression on OS X:

that came from this patch:
(bug also reported here:

I've looked at the issue now.  The patch we've applied is wrong.  Let's
fix it.

The logic is supposed to work this way:

1) This code tries to create a variable containing the carriage return

ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
  eval ac_cr=\$\'\\r\'

Back in Autoconf 2.63, this code was:


with a literal carriage return in it.

2) This code (and I've undone said patch above here) tries to find out
whether awk's print function expands the string literal "\r" to a
carriage return, or a literal carriage return is needed for that:

ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then

It sets the variable $ac_cs_awk_cr in such a way that, when used in the
replacement part of a sed 's' command, it causes sed to insert a literal
into the output that makes awk expand it to a carriage return.

This is where said patch went wrong: the logic never meant to use '\r'
which some sed's but not all expand to a literal carriage return; IOW,
we were relying on, and fooled by, undefined behavior in sed here.

3) This code is meant to cause config.status to replace literal carriage
return characters in substituted variables into strings that awk will
expand to carriage returns in the config.files, while avoiding to munge
end-of-line (EOL):

if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \

The idea was that, on systems where EOL is CR-LF, the sed "s/$ac_cr\$//"
would still prevent us from matching any carriage returns at EOL.

You both reported that, on your DJGPP installations, this causes '\r'
strings to appear at the end of each line in the $tmp/subs.awk file.

I have a DJGPP installation now, but I cannot reproduce this failure
with Autoconf 2.65: for me, the first line of code in (1) expands to a
literal carriage return, DJGPP awk understands that, and the code in (3)
is never invoked.

I'm not quite sure whether that is just due to the changes of the code
in (1), or whether there are other differences between our systems.

Can you please try the following: grap Autoconf 2.65 from ftp.gnu.org,
apply the patch below, build and install it on DJGPP, and see whether
it works on this example package?

cat >configure.ac <<\EOF
AC_INIT([foo], [1])
cat >foo.in <<\EOF
cat foo

If that does not work, then we may need to change the code in (3) to
something like

if test -z "$DJDIR" && sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \


PS: I still need to test on w32 systems before re-enabling carriage
return in the "Substitute and define special characters" test.

    Fix substitution of carriage return on Darwin.
    * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Set
    ac_cs_awk_cr to '\\r', so that sed portably expands this to '\r'
    rather than a literal carriage return, to fix substitution on
    Darwin.  Regression introduced in 2.63b.
    Report by Peter O'Gorman.

diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index f74bd34..3c6cf38 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -364,7 +364,7 @@ if test "x$ac_cr" = x; then
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\r'
+  ac_cs_awk_cr='\\r'

reply via email to

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