help="Try \`$progname --help' for more information."
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([\\"$]\)/\\\1/g'
+
# Global variables:
can_build_shared=yes
enable_shared=yes
case "$host_os" in
aix3*)
allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
+ archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
aix4*)
allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
+ archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
hardcode_direct=yes
hardcode_minus_L=yes
;;
echo "checking whether to build static libraries... $enable_static" 1>&6
+# Now quote all the things that may contain metacharacters.
+for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
+ old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
+ link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ profile_flag_pattern library_names_spec soname_spec RANLIB \
+ old_archive_cmds old_postinstall_cmds archive_cmds postinstall_cmds \
+ allow_undefined_flag finish_cmds global_symbol_pipe striplib old_striplib \
+ hardcode_libdir_flag_spec hardcode_libdir_separator; do
+
+ eval "$var=\`echo \"\$$var\" | sed \"\$sed_quote_subst\"\`"
+done
+
ofile=libtool
trap "$rm $ofile; exit 1" 1 2 15
echo creating $ofile
host="$host"
# The archiver.
-AR='$AR'
+AR="$AR"
# The default C compiler.
-CC='$CC'
+CC="$CC"
# The linker used to build libraries.
-LD='$LD'
+LD="$LD"
# Whether we need hard or soft links.
-LN_S='$LN_S'
+LN_S="$LN_S"
# A BSD-compatible nm program.
-NM='$NM'
+NM="$NM"
# How to create reloadable object files.
-reload_flag='$reload_flag'
-reload_cmds='$reload_cmds'
+reload_flag="$reload_flag"
+reload_cmds="$reload_cmds"
# How to pass a linker flag through the compiler.
-wl='$wl'
+wl="$wl"
# Additional compiler flags for building library objects.
-pic_flag='$pic_flag'
+pic_flag="$pic_flag"
# Compiler flag to prevent dynamic linking.
-link_static_flag='$link_static_flag'
+link_static_flag="$link_static_flag"
# Compiler flag to turn off builtin functions.
-no_builtin_flag='$no_builtin_flag'
+no_builtin_flag="$no_builtin_flag"
# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec='$export_dynamic_flag_spec'
+export_dynamic_flag_spec="$export_dynamic_flag_spec"
# Pattern to match compiler flags for creating libNAME_p libraries:
-profile_flag_pattern='$profile_flag_pattern'
+profile_flag_pattern="$profile_flag_pattern"
# Library versioning type.
version_type=$version_type
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME.
-library_names_spec='$library_names_spec'
+library_names_spec="$library_names_spec"
# The coded name of the library, if different from the real name.
-soname_spec='$soname_spec'
+soname_spec="$soname_spec"
# Commands used to build and install an old-style archive.
-RANLIB='$RANLIB'
-old_archive_cmds='$old_archive_cmds'
-old_postinstall_cmds='$old_postinstall_cmds'
+RANLIB="$RANLIB"
+old_archive_cmds="$old_archive_cmds"
+old_postinstall_cmds="$old_postinstall_cmds"
# Commands used to build and install a shared archive.
-archive_cmds='$archive_cmds'
-postinstall_cmds='$postinstall_cmds'
+archive_cmds="$archive_cmds"
+postinstall_cmds="$postinstall_cmds"
# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag='$allow_undefined_flag'
+allow_undefined_flag="$allow_undefined_flag"
# Commands used to finish a libtool library installation in a directory.
-finish_cmds='$finish_cmds'
+finish_cmds="$finish_cmds"
# Take the output of nm and produce a listing of raw symbols and C names
global_symbol_pipe="$global_symbol_pipe"
# How to strip a library file.
-striplib='$striplib'
-old_striplib='$old_striplib'
+striplib="$striplib"
+old_striplib="$old_striplib"
# This is the shared library runtime path variable.
runpath_var=$runpath_var
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec'
+hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator='$hardcode_libdir_separator'
+hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
-# WARNING: An implicit problem with writing libtool as a shell script
-# is that arguments with embedded whitespace probably will cause
-# problems, and arguments with embedded single quotes *definitely*
-# will cause problems.
-
-# It would take a serious effort to fix the problems with whitespace.
-# These occur because we use space-separated arguments to "for"
-# commands. It is nearly impossible to fix the problems with single
-# quotes, because we use them to do quoting in strings that we "eval".
-
# The name of this program.
progname=`echo "$0" | sed 's%^.*/%%'`
objdir=.libs
rm="rm -f"
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([\\"$]\)/\\\1/g'
+
# NLS nuisances.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
compile)
progname="$progname: compile"
# Get the compilation command and the source file.
- base_compile="$nonopt"
+ base_compile=
lastarg=
- srcfile=
+ srcfile="$nonopt"
suppress_output=
for arg
do
- # Quote any args containing shell metacharacters.
+ # The only flag that cannot be specified is the output filename.
+ if test "X$arg" = "X-o"; then
+ echo "$progname: you cannot specify the output filename with \`-o'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`echo "$lastarg" | sed "$sed_quote_subst"`
+
+ # 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
- *[[~#$^\&*\(\){}\\\|\;\<\>?\ \ \"]*|*]*)
- quote_arg="'$arg'"
- ;;
- *)
- quote_arg="$arg"
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
;;
esac
- base_compile="$base_compile$lastarg"
- srcfile="$quote_arg"
- lastarg=" $srcfile"
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
done
# Get the name of the library object.
if test "$build_libtool_libs" = yes; then
# All platforms use -DPIC, to notify preprocessed assembler code.
$show "$base_compile$pic_flag -DPIC $srcfile"
- if $run eval "$base_compile$pic_flag -DPIC $srcfile"; then :
+ if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
else
test -n "$obj" && $run $rm $obj
exit 1
if test "$build_old_libs" = yes; then
# Suppress compiler output if we already did a PIC compilation.
$show "$base_compile $srcfile$suppress_output"
- if $run eval "$base_compile $srcfile$suppress_output"; then :
+ if $run eval "$base_compile \$srcfile$suppress_output"; then :
else
$run $rm $obj $libobj
exit 1
# link it into a program.
if test "$build_libtool_libs" != yes; then
$show "echo timestamp > $libobj"
- $run eval "echo timestamp > $libobj" || exit $?
+ $run eval "echo timestamp > \$libobj" || exit $?
fi
exit 0
# libtool link mode
link)
progname="$progname: link"
- # Go through the arguments, transforming them on the way.
CC="$nonopt"
- args="$CC"
allow_undefined=no
compile_command="$CC"
finalize_command="$CC"
+
compile_shlibpath=
finalize_shlibpath=
deplibs=
esac
done
+ # Go through the arguments, transforming them on the way.
for arg
do
# If the previous option needs an argument, assign it.
output)
compile_command="$compile_command @OUTPUT@"
finalize_command="$finalize_command @OUTPUT@"
- args="$args $arg"
;;
esac
esac
fi
- args="$args $arg"
prevarg="$arg"
case "$arg" in
- -allow-undefined) allow_undefined=yes ;;
+ -allow-undefined)
+ allow_undefined=yes
+ continue
+ ;;
-dlopen)
prev=dlfiles
-export-dynamic)
if test "$export_dynamic" != yes; then
export_dynamic=yes
- compile_command="$compile_command "`eval echo "$export_dynamic_flag_spec"`
- finalize_command="$finalize_command "`eval echo "$export_dynamic_flag_spec"`
+ arg=`eval echo "$export_dynamic_flag_spec"`
+
# Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
fi
- continue
;;
-L*)
-static)
link_static="$link_static_flag"
- test -n "$link_static" && compile_command="$compile_command $link_static"
- continue
+ compile_command="$compile_command $link_static"
+ finalize_command="$finalize_command $link_static"
+ continue
;;
-version-info)
continue
;;
- -*) CC="$CC $arg" ;; # Some other compiler flag.
-
- *.o)
- # A standard object.
- objs="$objs $arg"
+ # 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 "$arg" | sed "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
;;
- *.a)
- # Find the relevant object directory and library name.
- file=`echo "$arg" | sed 's%^.*/%%'`
- dir=`echo "$arg" | sed 's%/[^/]*$%/%'`
- test "X$dir" = "X$arg" && dir=
-
- # Standard archive.
+ *.o | *.a)
+ # A standard object.
objs="$objs $arg"
;;
fi
if test -n "$libdir"; then
- hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
- compile_command="$compile_command $hardcode_libdir_flag"
- finalize_command="$finalize_command $hardcode_libdir_flag"
+ flag=`eval echo \"$hardcode_libdir_flag_spec\"`
+
+ compile_command="$compile_command $flag"
+ finalize_command="$finalize_command $flag"
fi
elif test "$hardcode_runpath_var" = yes; then
# Do the same for the permanent run path.
echo "$progname: cannot find static library for \`$arg'" 1>&2
exit 1
fi
- test -n "$old_library" && linklib="$old_library"
if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
compile_command="$compile_command $dir/$linklib"
finalize_command="$finalize_command $dir/$linklib"
else
# Here we assume that "$hardcode_minusL" != unsupported.
+ # This is valid on all known static and shared platforms.
compile_command="$compile_command -L$dir -l$name"
finalize_command="$finalize_command -L$dir -l$name"
fi
fi
- continue
+ continue
;;
*)
;;
esac
+ # Now actually substitute the argument into the commands.
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
done
# We have no uninstalled library dependencies, so finalize right now.
$show "$compile_command"
- $run $compile_command
+ $run eval "$compile_command"
status=$?
# If we failed to link statically, then try again.
echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
compile_command=`echo "$compile_command " | sed -e "s% $link_static % %" -e 's/ $//'`
$show "$compile_command"
- $run $compile_command
+ $run eval "$compile_command"
status=$?
fi
exit $status
# Now create the wrapper script.
echo "creating $output"
+ # Quote the finalize command for shipping.
+ finalize_command=`echo "$finalize_command" | sed "$sed_quote_subst"`
+
# Only actually do things if our run command is non-null.
if test -z "$run"; then
$rm $output
if test "\$libtool_install_magic" = "$magic"; then
# install mode needs the following variables:
link_against_libtool_libs='$link_against_libtool_libs'
- finalize_command='$finalize_command'
+ finalize_command="$finalize_command"
else
# When we are sourced in execute mode, \$file is already set.
test "\$libtool_execute_magic" = "$magic" || file="\$0"
for arg
do
# Quote arguments (to preserve shell metacharacters).
- args="\$args '\$arg'"
+ sed_quote_subst='$sed_quote_subst'
+ arg=\`echo "\$arg" | sed "\$sed_quote_subst"\`
+ args="\$args \\"\$arg\\""
done
# Export the path to the program.
progname="$progname: install"
# The first argument is the name of the installation program.
- install_prog="$nonopt"
+ # Aesthetically quote it.
+ arg=`echo "$nonopt" | sed "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg"
# We need to accept at least all the BSD install flags.
dest=
fi
;;
esac
+
+ # Aesthetically quote the argument.
+ arg=`echo "$arg" | sed "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
install_prog="$install_prog $arg"
done
# Install the pseudo-library for information purposes.
name=`echo "$file" | sed 's%^.*/%%'`
$show "$install_prog $file $destdir/$name"
- $run $install_prog $file $destdir/$name || exit $?
+ $run eval "$install_prog $file $destdir/$name" || exit $?
# Maybe install the static library, too.
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
# Install the libtool object if requested.
if test -n "$destfile"; then
$show "$install_prog $file $destfile"
- $run $install_prog $file $destfile || exit $?
+ $run eval "$install_prog $file $destfile" || exit $?
fi
# Install the old object if enabled.
staticobj=`echo "$file" | sed 's/\.lo$/\.o/'`
$show "$install_prog $staticobj $staticdest"
- $run $install_prog $staticobj $staticdest || exit $?
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
fi
exit 0
;;
if test "$finalize" = yes; then
echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
$show "$finalize_command"
- if $run $finalize_command; then :
+ if $run eval "$finalize_command"; then :
else
echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
continue
fi
$show "$install_prog$stripme $file $dest"
- $run $install_prog$stripme $file $dest || exit $?
+ $run eval "$install_prog\$stripme \$file \$dest" || exit $?
;;
esac
done
oldlib="$destdir/$name"
$show "$install_prog $file $oldlib"
- $run $install_prog $file $oldlib || exit $?
+ $run eval "$install_prog \$file \$oldlib" || exit $?
# Support stripping libraries.
if test -n "$stripme"; then
;;
esac
# Quote arguments (to preserve shell metacharacters).
- args="$args '$file'"
+ file=`echo "$file" | sed "$sed_quote_subst"`
+ args="$args \"$file\""
done
if test -z "$run"; then
eval "export $shlibpath_var"
# Now actually exec the command.
- eval "exec '$cmd'$args"
+ eval "exec \$cmd$args"
- echo "$progname: cannot exec '$cmd'$args"
+ echo "$progname: cannot exec \$cmd$args"
exit 1
else
# Display what would be done.
eval "echo \"\$shlibpath_var=\$$shlibpath_var\""
echo "export $shlibpath_var"
- echo "'$cmd'$args"
+ echo "$cmd$args"
exit 0
fi
;;