autoconf
[Top][All Lists]
Advanced

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

Re: multiline output variables.


From: Dan Manthey
Subject: Re: multiline output variables.
Date: Mon, 7 Feb 2005 15:55:49 -0500

Hi, again.  This took a while because I was working on other things.  I
hope that this is the final patch for supporting multiline output
variables.  (Though I bet that I've made some dumb typo.)

The attached patch is 'cvs diff'ed from anoncvs as of this afternoon.

On Fri, 28 Jan 2005, Stepan Kasal wrote:

> 2) ad
> > AC_SUBST(ac_delim) can cause an endless loop
>
        Although this no longer causes a problem, I've made it always fake
ac_delim as being the empty string, just to reduce the mess.

> My proposal indeed fixed this, yet I think a safety belt cannot hurt.
> We could change the simple infinite loop to something like:
>
        I instead just ask `test ${#ac_delim} -gt 1000', which gives six
iterations with the current set up.

>
>
> 3) ad: the implementation of non-recursive substitution:
>
> All the hacks with |address@hidden@#| are too complicated and not general 
> enough.
> There is a better solution.
>
        I agree that your solution works and makes non-recursion invisible
to the user, but I think it's actually benefitial to have the wacky string
that gets deleted (for instance, to disabiguate address@hidden@bar@' by
address@hidden@|#_!!_#|bar@'), so I have not taken your suggestion here.  I just
surround all `@'s with the deleted string, and also put it at the
beginning of each output value.  Note that I changed the deleted string to
be a palendrome, since that allows it to be inserted at its own center.  I
think this just looks "better".

> sed  ':s
> /'"$ac_delim"'$/b ok
> N
> b s
> :ok
> s/?/?q/g
> s/@/?a/g
> s/[\\&,]/\\&/g
> s/\n/\\&/g
> s/^/s,@/
> s/!/@,/
> s/'"$ac_delim"'$/,g/'
        I figure that it's better to not accumulate lines, since with
newlines, output values can get quite large.  I instead handle the first
line of the value specially (to turn _AC_Var! into ,@_AC_Var@,|#_!!_#|)
and then loop through remaining lines without starting a new sed cycle.

> 4) When reading parts of your patch, I cannot understand why it is
> necessary to use diversions.
        Sheer lunacy on my part.  I've programmed to much lisp and forgot
that you could assign to variables.

> I think it might be easier to count `sed commands' instead of
> `substitutions'
        Indeed.  Note that I've taken the suggestion to use s///g rather
than looping back to the beginning, so the two numbers are usually closer.
In fact, I think that the majority of configure.ac's now will only need a
single sed fragment, which is nice.


Some additional stuff besides _AC_OUTPUT_FILES:  I've added to the
documentation of AC_HEADER_STDBOOL as an example of the benefits of this
patch. It is worth noting that this patch only allows newlines in output
variables, not in defines nor in cache values.  As mentioned before, I've
also restricted file substitutions to whole lines.

I've run `make check' with this patch, but killed it after the "Testing
config.status." section.  If there is a real chance that the patch effects
other tests, tell me.

My thanks go to Stepan for all the help he's given with this.

Now, could somebody tell me what paperwork I need to actually make this
public?  I have the okay from my work.

-Dan

Attachment: multi.diff
Description: Text document


reply via email to

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