mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-24 14:24:59 +08:00
* config/ltmain.in (func_quote_for_eval): Factor out the ugly
shell meta-character quoting. Changed all callers.
This commit is contained in:
parent
18aa63dac0
commit
e5e3b3ada7
@ -1,3 +1,8 @@
|
||||
2004-09-14 Gary V. Vaughan <gary@gnu.org>
|
||||
|
||||
* config/ltmain.in (func_quote_for_eval): Factor out the ugly
|
||||
shell meta-character quoting. Changed all callers.
|
||||
|
||||
2004-09-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Simplification:
|
||||
|
141
config/ltmain.in
141
config/ltmain.in
@ -739,6 +739,25 @@ func_mkdir_p () {
|
||||
}
|
||||
|
||||
|
||||
# func_quote_for_eval arg
|
||||
# Aesthetically quote ARG to be evaled later.
|
||||
func_quote_for_eval ()
|
||||
{
|
||||
my_arg="$1"
|
||||
|
||||
case $my_arg in
|
||||
# Double-quote args containing other shell metacharacters.
|
||||
# Many Bourne shells cannot handle close brackets correctly
|
||||
# in scan sets, so we specify it separately.
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
my_arg="\"$my_arg\""
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$my_arg"
|
||||
}
|
||||
|
||||
|
||||
# func_check_version_match
|
||||
# Ensure that we are using m4 macros, and libtool script from the same
|
||||
# release of libtool.
|
||||
@ -825,12 +844,7 @@ func_infer_tag () {
|
||||
if test -n "$available_tags" && test -z "$tagname"; then
|
||||
CC_quoted=
|
||||
for arg in $CC; do
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
CC_quoted="$CC_quoted $arg"
|
||||
CC_quoted="$CC_quoted "`func_quote_for_eval "$arg"`
|
||||
done
|
||||
case $@ in
|
||||
# Blanks in the command may have been stripped by the calling shell,
|
||||
@ -845,14 +859,9 @@ func_infer_tag () {
|
||||
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
||||
CC_quoted=
|
||||
for arg in $CC; do
|
||||
# Double-quote args containing other shell metacharacters.
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
CC_quoted="$CC_quoted $arg"
|
||||
done
|
||||
# Double-quote args containing other shell metacharacters.
|
||||
CC_quoted="$CC_quoted "`func_quote_for_eval "$arg"`
|
||||
done
|
||||
case "$@ " in
|
||||
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
|
||||
# The compiler in the base compile command matches
|
||||
@ -1233,16 +1242,7 @@ func_mode_compile ()
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for arg in $args; do
|
||||
IFS="$save_ifs"
|
||||
|
||||
# Double-quote args containing other shell metacharacters.
|
||||
# Many Bourne shells cannot handle close brackets correctly
|
||||
# in scan sets, so we specify it separately.
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
lastarg="$lastarg $arg"
|
||||
lastarg="$lastarg "`func_quote_for_eval "$arg"`
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
|
||||
@ -1265,17 +1265,7 @@ func_mode_compile ()
|
||||
|
||||
# Aesthetically quote the previous argument.
|
||||
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
|
||||
|
||||
case $lastarg in
|
||||
# Double-quote args containing other shell metacharacters.
|
||||
# Many Bourne shells cannot handle close brackets correctly
|
||||
# in scan sets, so we specify it separately.
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
lastarg="\"$lastarg\""
|
||||
;;
|
||||
esac
|
||||
|
||||
base_compile="$base_compile $lastarg"
|
||||
base_compile="$base_compile "`func_quote_for_eval "$lastarg"`
|
||||
done # for arg
|
||||
|
||||
case $arg_mode in
|
||||
@ -1812,12 +1802,7 @@ func_mode_install ()
|
||||
$echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
|
||||
# Aesthetically quote it.
|
||||
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
install_prog="$arg "
|
||||
install_prog=`func_quote_for_eval "$arg "`
|
||||
arg="$1"
|
||||
shift
|
||||
else
|
||||
@ -1828,12 +1813,7 @@ func_mode_install ()
|
||||
# The real first argument should be the name of the installation program.
|
||||
# Aesthetically quote it.
|
||||
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
install_prog="$install_prog$arg"
|
||||
install_prog="$install_prog"`func_quote_for_eval "$arg"`
|
||||
|
||||
# We need to accept at least all the BSD install flags.
|
||||
dest=
|
||||
@ -1876,12 +1856,7 @@ func_mode_install ()
|
||||
|
||||
# Aesthetically quote the argument.
|
||||
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
install_prog="$install_prog $arg"
|
||||
install_prog="$install_prog "`func_quote_for_eval "$arg"`
|
||||
done
|
||||
|
||||
test -z "$install_prog" && \
|
||||
@ -2393,15 +2368,9 @@ func_mode_link ()
|
||||
|
||||
# Go through the arguments, transforming them on the way.
|
||||
while test "$#" -gt 0; do
|
||||
arg="$1"
|
||||
arg=`$echo "X$1" | $Xsed -e "$sed_quote_subst"`
|
||||
libtool_args="$libtool_args "`func_quote_for_eval "$arg"`
|
||||
shift
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
|
||||
;;
|
||||
*) qarg=$arg ;;
|
||||
esac
|
||||
libtool_args="$libtool_args $qarg"
|
||||
|
||||
# If the previous option needs an argument, assign it.
|
||||
if test -n "$prev"; then
|
||||
@ -2917,11 +2886,7 @@ func_mode_link ()
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $args; do
|
||||
IFS="$save_ifs"
|
||||
case $flag in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
flag="\"$flag\""
|
||||
;;
|
||||
esac
|
||||
flag=`func_quote_for_eval "$flag"`
|
||||
arg="$arg $wl$flag"
|
||||
compiler_flags="$compiler_flags $flag"
|
||||
done
|
||||
@ -2935,11 +2900,7 @@ func_mode_link ()
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $args; do
|
||||
IFS="$save_ifs"
|
||||
case $flag in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
flag="\"$flag\""
|
||||
;;
|
||||
esac
|
||||
flag=`func_quote_for_eval "$flag"`
|
||||
arg="$arg $wl$flag"
|
||||
compiler_flags="$compiler_flags $wl$flag"
|
||||
linker_flags="$linker_flags $flag"
|
||||
@ -2968,31 +2929,19 @@ func_mode_link ()
|
||||
# +DA*, +DD* enable 64-bit mode on the HP compiler
|
||||
# -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*)
|
||||
# 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"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
compile_command="$compile_command $arg"
|
||||
finalize_command="$finalize_command $arg"
|
||||
compiler_flags="$compiler_flags $arg"
|
||||
continue
|
||||
;;
|
||||
-64|-mips[0-9]|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
|
||||
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
|
||||
arg=`func_quote_for_eval "$arg"`
|
||||
compile_command="$compile_command $arg"
|
||||
finalize_command="$finalize_command $arg"
|
||||
compiler_flags="$compiler_flags $arg"
|
||||
continue
|
||||
;;
|
||||
|
||||
# Some other compiler flag.
|
||||
-* | +*)
|
||||
# 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"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
|
||||
arg=`func_quote_for_eval "$arg"`
|
||||
;;
|
||||
|
||||
*.$objext)
|
||||
@ -3125,11 +3074,7 @@ func_mode_link ()
|
||||
# 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"`
|
||||
case $arg in
|
||||
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
||||
arg="\"$arg\""
|
||||
;;
|
||||
esac
|
||||
arg=`func_quote_for_eval "$arg"`
|
||||
;;
|
||||
esac # arg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user