[Top][All Lists]

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

Unbreak Cygwin bash igncr mode with ac_cr

From: Aaron W. LaFramboise
Subject: Unbreak Cygwin bash igncr mode with ac_cr
Date: Thu, 08 Jan 2009 04:13:03 -0600
User-agent: Thunderbird (Windows/20081209)

The addition of the ac_cr code to config.status broke running in Cygwin bash's igncr mode. When run in such a mode, ./configure fails as follows.

config.status: creating Makefile
gawk: ./confcD5836/subs.awk:1: BEGIN {\r
gawk: ./confcD5836/subs.awk:1:        ^ backslash not last character on line
config.status: error: could not create Makefile


The igncr mode essentially ignores or throws away any carriage returns found as bash is parsing a file. It has an effect somewhat similar to using Cygwin text mode mounts, and in practice, it makes a lot of strange line ending-related issues go away.

I know that this option may be somewhat controversial, but given that its the only really effective way to handle certain sorts of problems on Cygwin, I think it's important that autoconf be able to run under this mode.

The problem is that the ac_cr variable ends up being empty. The recent change to use tr instead of a bare carriage return has no effect on this.

One way to solve this is to just skip the conversion step if igncr is set, which can be detected by checking for the empty ac_cr variable. I've attached a patch that implements this solution and seems to fix the problem for me.

What do you guys think about this?
2008-01-08  Aaron W. LaFramboise  <address@hidden>

        * lib/autoconf/status.m4 (ac_cr): Skip processing if empty.

Index: lib/autoconf/status.m4
RCS file: /srv/git/autoconf.git/HEAD/lib/autoconf/status.m4,v
retrieving revision 1.172
diff -p -u lib/autoconf/status.m4
--- lib/autoconf/status.m4 revision 1.172
+++ lib/autoconf/status.m4 working copy
@@ -558,7 +558,7 @@
 dnl unlikely if the configure script itself happens to be converted
 dnl to w32 text mode.
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+if test "x$ac_cr" != x && sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"

reply via email to

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