Re: revisit: bare carriage return in status.m4 / configure

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

 



[Please don't top-post]

Steven R. Loomis <srl <at> icu-project.org> writes:

> 
> That works only on ASCII based platforms, and it requires tr (which 
> wasn't formerly required, according to the thread quoted below).

Autoconf is already a significant client of tr (for example, look at the output 
of AC_CHECK_HEADERS).  We need to submit a bug report against standards.texi 
that adds tr to the list of approved programs.  But using tr in config.status 
is not an issue.

The problem that config.status has to work around is that not all awk and sed 
recognize the \r escape sequence; for those that don't, the use of a literal ^M 
in the configure/config.status was deemed workable at the moment.  On the other 
hand, our use of raw ^M is ASCII-agnostic:

ac_cr='
'
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'
else
  ac_cs_awk_cr=$ac_cr
fi

If we change $ac_cr to be \015, then $ac_cs_awk_cr will likewise be \015 in the 
case where the \r escape sequence didn't work (and if it did work, then we know 
\r and \015 are equivalent).  So, whether or not \015 is carriage return in the 
current encoding, we are doing an idempotent replace.

I agree that using raw ^M in a portable script comes with its own set of 
portability problems, therfore I will commit a patch that switches over to tr 
in the near future.  Thanks Steven for the report, and Thomas for the patch 
idea.

-- 
Eric Blake





_______________________________________________
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