autoconf
[Top][All Lists]
Advanced

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

Re: multiline output variables.


From: Stepan Kasal
Subject: Re: multiline output variables.
Date: Fri, 28 Jan 2005 09:48:32 +0100
User-agent: Mutt/1.4.1i

Hello again,

on a second thought, I see my yesterday ideas can be improved.  That's why
I answer to my own mail, sorry.

1) I wrote:

> ...  s/x\{23\}/yes/ ... is not portable

Does anyone know whether I was true or not?  The autoconf manual doesn't
mention this problem, and \{23\} is required by POSIX for BRE's.


2) ad
> AC_SUBST(ac_delim) can cause an endless loop

My proposal indeed fixed this, yet I think a safety belt cannot hurt.
We could change the simple infinite loop to something like:

ac_iter=""
ac_delim='%!_!#_ '
while :; do
  ...
  test `grep -c "$ac_delim"'$' ` = 74 && break
  ac_iter=x$ac_iter
  if test $ac_iter = xxxxxxxx; then
    AC_MSG_ERROR([Eight was not enough???])
  fi
  ac_delim="$ac_delim$ac_delim !_$ac_delim"
done


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.

Let's choose yet another escape character, say '?'.  And let's define:
?q  --  for a literal '?'
?a  --  for @

Then the resulting sed fragments, as executed by config.status, should
look like this:

/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s/?/?q/g
s,@bindir@,/usr/local/bin,g
...
s/?a/@/g
s/?q/?/g

Which means that you have to compute _AC_SED_SUBS_LIMIT as
        _AC_SED_CMD_LIMIT - 4 - 4*_AC_SED_SUBS

and that if the variables are listed as
        _AC_Var!$_AC_Var$ac_delim
then the postprocessing sed script would look like this:

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/'


4) When reading parts of your patch, I cannot understand why it is
necessary to use diversions.

I'd suggest this:
- write the file substitutions sed fragments
- if the last one has space for at least five commands, leave it open
- open a file for var substs, unless we have the open file from
  the previous step
- write the preamble:
        /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
        s/?/?q/g
        ...
- start a loop which processes the subst variables

I find this approach quite straightforward, and I don't see any need
for diversions.
I think it might be easier to count `sed commands' instead of
`substitutions' in this case.  Each file subst would increment it by 4,
while, variable subst would still increment it by 1.


5) I've noticed a typo: there is  "frament"  twice.

Have a nice day,
        Stepan Kasal




reply via email to

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