+2004-10-20 Noah Misch <noah@cs.caltech.edu>,
+ Gary V. Vaughan <gary@gnu.org>
+
+ * m4/libtool.m4 (sed_quote_subst): Remove superfluous backslashes
+ from the match character set.
+ (double_quote_subst): Ditto.
+ * lib/general.m4sh (sed_quote_subst): Ditto.
+ (double_quote_subst): New variable, copied from
+ m4/libtool.m4. Much the same as sed_quote_subst, but variable
+ references are not quoted.
+ (func_quote_for_eval): Given any $foo; $bar and
+ $foo must be identical after the following commands:
+ func_quote_for_eval "$foo"
+ eval "bar=$func_quote_for_eval_result"
+ (func_quote_for_expand): In a similar vein to to func_quote_for_eval,
+ except that variable expansions are not protected when quoting the
+ command for subsequent display.
+ * config/ltmain.m4sh: Factor away use of $sed_quote_subst now that
+ it has been subsumed into func_quote_for_eval.
+ (func_mode_link): Instead of `2004-10-14 Peter O'Gorman' below,
+ use func_quote_for_expand so that ${wl} is expanded properly in
+ the $show expression.
+
2004-10-16 Gary V. Vaughan <gary@gnu.org>
* config/ltmain.m4sh (func_mode_finish): solaris-2.6 also has
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([[\\`\\"$\\\\]]\)/\\\1/g'
+sed_quote_subst='s/\([[`"$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
# test EBCDIC or ASCII
case `$ECHO A|tr A '\301'` in
A) # EBCDIC based system
# Aesthetically quote ARG to be evaled later.
func_quote_for_eval ()
{
- my_arg="$1"
+ my_arg=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"`
case $my_arg in
- # Double-quote args containing other shell metacharacters.
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"")
func_quote_for_eval_result="$my_arg"
}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ my_arg=`$ECHO "X$1" | $Xsed -e "$double_quote_subst"`
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
esac # case $arg_mode
# Aesthetically quote the previous argument.
- lastarg=`$ECHO "X$lastarg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$lastarg"
base_compile="$base_compile $func_quote_for_eval_result"
done # for arg
;;
esac
# Quote arguments (to preserve shell metacharacters).
- file=`$ECHO "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
+ func_quote_for_eval "$file"
+ args="$args $func_quote_for_eval_result"
done
if test -z "$run"; then
# Allow the use of GNU shtool's install command.
$ECHO "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
# Aesthetically quote it.
- arg=`$ECHO "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- func_quote_for_eval "$arg"
+ func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg="$1"
shift
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
install_prog="$install_prog$func_quote_for_eval_result"
esac
# Aesthetically quote the argument.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
install_prog="$install_prog $func_quote_for_eval_result"
done
arg="$1"
shift
qarg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
- func_quote_for_eval "$qarg"
+ func_quote_for_eval "$arg"
libtool_args="$libtool_args $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
;;
-Wc,*)
- args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ args=`$ECHO "X$arg" | $Xsed -e 's/^-Wc,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
;;
-Wl,*)
- args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ args=`$ECHO "X$arg" | $Xsed -e 's/^-Wl,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
# -q* pass through compiler args for the IBM compiler
# -m* pass through architecture-specific compiler args for GCC
-64|-mips[[0-9]]|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
compile_command="$compile_command $arg"
# Some other compiler flag.
-* | +*)
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
- func_quote_for_eval "$cmd"
- eval \$show \"$func_quote_for_eval_result\"
+ func_quote_for_expand "$cmd"
+ eval \$show "$func_quote_for_expand_result"
$run eval "$cmd" || {
lt_exit=$?
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
# Quote the link command for shipping.