> From: "Gary V. Vaughan" <[EMAIL PROTECTED]>
> Date: Fri, 5 Oct 2001 22:46:36 +0100
>
> libtool needs to store lots of script snippets in shell variables to
> be passed to eval later. In order for this to work, it must be
> possible to backslash escape shell meta characters, so that eval's
> behaviour is predictable.
In this case I don't think it's feasible to require a POSIX shell on
the part of the installer, as you probably still want to run on bare
SunOS 4.1.4. So it's a somewhat different case from LINENO, which
isn't needed for correct operation of "configure".
That being said, have you tried doing something like this as a replacement
for escaped_something=`echo "$something" | sed 's/\\/\\\\/g'`?
case $something in
*\\*)
awk_script='{
input=$0
output=""
while ((i = index(input, "\\")) != 0) {
output = output substr(input, 1, i) "\\"
input = substr(input, i + 1)
}
print output input
}'
escaped_something=`awk "$awk_script" <<EOF
$something
EOF
`
;;
*)
escaped_something=$something;;
esac
This is a bit hard to read, but it is quite portable and you can
package it up into an Autoconf macro. And in the common case where
$something contains no backslashes, this solution runs about 50 times
faster than the echo|sed solution (at least, on my Solaris 8 box).
Maybe something like this should be added to Autoconf. Certainly
Autoconf is now buggy in more than one place, if "configure" is passed
operands that contain backslashes.
_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool