[Top][All Lists]

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

[PATCH] Speedup creation of configure.lineno

From: Paolo Bonzini
Subject: [PATCH] Speedup creation of configure.lineno
Date: Mon, 5 Jan 2004 09:43:59 +0100

> Thanks for the suggestion, it does look like a performance win on
> older hosts.  But out of curiosity, why was this worth your time?  Are
> you running 'configure' scripts on machines that lack modern shells,
> and where 'sed' is slow?

Autoconf 2.60 searches for a shell supporting shell functions, and not for a
shell supporting LINENO.  So if you have a shell with shell functions but
without LINENO it will trigger the sed script, and this is the case on
NetBSD.  Of course, suggestions on how to fix this without loosening the
check for shell functions, it is welcome.

> (Isn't sed fun?)

Yes, it is, and maintaining it is even more fun.

> For portability the $ needs to be escaped from 'sed' by surrounding it
> with square brackets, which in turn need to be doubled, thus: [[$]]LINENO.

What hosts have this problem?

> > + tok
> POSIX says that a space must separate the 't' command from the label.

Doh, I believed it was the other way.

> > + s,$LINENO\([[^'$as_cr_alnum'_]]\)\([[^\n]]*\n\)\(.*\),\3\1\2\3,
> Hmm, "[^\n]" doesn't have the seemingly-expected meaning here, as
> backslash loses its special meaning within a bracket expression.  See
> <>.

He he, but it is sed that parses \n and not the regex matcher. :-)  So [^\n]
would work, but it's not a major performance change.

> I installed the following patch instead: I hope it works for you.

Yes, it does.

> I can't easily test it, as I lack access to ancient hosts these days.

I tested mine on Linux simply by prefixing an "unset LINENO" command.

Could you please review the patch at


reply via email to

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