autoconf
[Top][All Lists]
Advanced

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

Newlines in AC_SUBST


From: Norman Gray
Subject: Newlines in AC_SUBST
Date: Thu, 29 Jan 2004 12:27:56 +0000 (GMT)

Greetings,

Could someone give a ruling on a mild ambiguity in the AC_SUBST
documentation?

The documentation says:

    This value of variable should not contain literal newlines.

Now, the point of that remark (and part of my question is: is this
the only point?) is because the variable will be substituted within
./configure, in one of the

    s,@variable@,$variable,

sed substitutions.  However, do escaped newlines count in this
prohibition?

Writing

    AC_SUBST(variable)
    variable="blah\\
"

does work (ie, it does include the newline in the substituted output
file).  Escaping newlines in this fashion is blessed by the sed
documentation in the Single-Unix spec, and in all the sed man pages I
have ready access to (including Digital Unix, which I've always found
reliably primitive); furthermore I haven't come across problems with
this in the (admittedly small) range of machines I've worked on,
and this is not mentioned as a portability issue of seds in the
`Portable Shell Programming' section of the autoconf documentation.

Would anyone here counsel _against_ doing this, either

  * because the substituted variables are used elsewhere within
    autoconf in some _extremely_ obscure place that I haven't found
    yet;

  * because they _might_ in principle be so used;

  * or just on grounds of good taste?

If so, then I'd suggest changing the AC_SUBST documentation to say
`no, not even escaped newlines: don't do "..."'; if not, then I'd
suggest changing it to something like `not contain unescaped newlines:
thus you may do: "...", but not "..."'.

I know about AC_SUBST_FILE, which potentially avoids this issue
altogether, but in my particular case I'd rather avoid extra files;
and also I'm curious about this!

Thanks for any pointers.  All the best,

Norman


-- 
---------------------------------------------------------------------------
Norman Gray                        http://www.astro.gla.ac.uk/users/norman/
Physics and Astronomy, University of Glasgow, UK     address@hidden





reply via email to

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