summaryrefslogtreecommitdiff
path: root/ltmain.sh
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2001-03-22 05:22:04 +0000
committerAlexandre Oliva <aoliva@redhat.com>2001-03-22 05:22:04 +0000
commit962b48c162a7181e67b7fc087203ffb9140214a4 (patch)
tree11a0dbc5bbc0ed3abe06a1a1b3612f3b9b1fe725 /ltmain.sh
parent65c89fd880c669cf36229ee1e7e13dba762ee296 (diff)
downloadgdb-962b48c162a7181e67b7fc087203ffb9140214a4.tar.gz
* ltconfig, ltmain.sh, libtool.m4, ltcf-c.sh, ltcf-cxx.sh,
ltcf-gcj.sh: Upgraded to libtool 1.4a 1.641.2.198.
Diffstat (limited to 'ltmain.sh')
-rw-r--r--ltmain.sh527
1 files changed, 410 insertions, 117 deletions
diff --git a/ltmain.sh b/ltmain.sh
index 2bccd110f03..b81cb285ed6 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,7 +1,8 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
#
-# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
@@ -55,7 +56,7 @@ modename="$progname"
PROGRAM=ltmain.sh
PACKAGE=libtool
VERSION=1.4a
-TIMESTAMP=" (1.641.2.122 2000/09/30 05:27:52)"
+TIMESTAMP=" (1.641.2.198 2001/03/20 05:47:28)"
default_mode=
help="Try \`$progname --help' for more information."
@@ -113,22 +114,22 @@ do
arg="$1"
shift
- case "$arg" in
+ case $arg in
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
- case "$prev" in
+ case $prev in
execute_dlfiles)
- eval "$prev=\"\$$prev \$arg\""
+ execute_dlfiles="$execute_dlfiles $arg"
;;
tag)
tagname="$arg"
# Check whether tagname contains only valid characters
- case "$tagname" in
+ case $tagname in
*[!-_A-Za-z0-9,/]*)
echo "$progname: invalid tag name: $tagname" 1>&2
exit 1
@@ -154,7 +155,7 @@ do
fi
# Have we seen a non-optional argument yet?
- case "$arg" in
+ case $arg in
--help)
show_help=yes
;;
@@ -241,12 +242,12 @@ if test -z "$show_help"; then
# Infer the operation mode.
if test -z "$mode"; then
- case "$nonopt" in
+ case $nonopt in
*cc | *++ | gcc* | *-gcc*)
mode=link
for arg
do
- case "$arg" in
+ case $arg in
-c)
mode=compile
break
@@ -291,7 +292,7 @@ if test -z "$show_help"; then
help="Try \`$modename --help --mode=$mode' for more information."
# These modes are in order of execution frequency so that they run quickly.
- case "$mode" in
+ case $mode in
# libtool compile mode
compile)
modename="$modename: compile"
@@ -305,14 +306,14 @@ if test -z "$show_help"; then
user_target=no
for arg
do
- case "$prev" in
+ case $prev in
"") ;;
xcompiler)
# Aesthetically quote the previous argument.
prev=
lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
+ case $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.
@@ -332,7 +333,7 @@ if test -z "$show_help"; then
esac
# Accept any command-line options.
- case "$arg" in
+ case $arg in
-o)
if test "$user_target" != "no"; then
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
@@ -371,7 +372,7 @@ if test -z "$show_help"; then
# 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
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
@@ -391,7 +392,7 @@ if test -z "$show_help"; then
;;
esac
- case "$user_target" in
+ case $user_target in
next)
# The next one is the -o target name
user_target=yes
@@ -419,7 +420,7 @@ if test -z "$show_help"; then
# Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
- case "$lastarg" in
+ case $lastarg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
lastarg="\"$lastarg\""
;;
@@ -433,7 +434,7 @@ if test -z "$show_help"; then
fi
done
- case "$user_target" in
+ case $user_target in
set)
;;
no)
@@ -449,7 +450,7 @@ if test -z "$show_help"; then
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
xform='[cCFSfmso]'
- case "$libobj" in
+ case $libobj in
*.ada) xform=ada ;;
*.adb) xform=adb ;;
*.ads) xform=ads ;;
@@ -466,7 +467,7 @@ if test -z "$show_help"; then
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
- case "$libobj" in
+ case $libobj in
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
*)
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
@@ -544,7 +545,7 @@ if test -z "$show_help"; then
trap "$run $rm $removelist; exit 1" 1 2 15
# On Cygwin there's no "real" PIC flag so we must build both object types
- case "$host_os" in
+ case $host_os in
cygwin* | mingw* | pw32* | os2*)
pic_mode=default
;;
@@ -777,7 +778,7 @@ EOF
# libtool link mode
link | relink)
modename="$modename: link"
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
@@ -843,7 +844,7 @@ EOF
# We need to know -static, to get the right output filenames.
for arg
do
- case "$arg" in
+ case $arg in
-all-static | -static)
if test "X$arg" = "X-all-static"; then
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
@@ -873,7 +874,7 @@ EOF
arg="$1"
base_compile="$base_compile $arg"
shift
- case "$arg" in
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
;;
@@ -883,14 +884,14 @@ EOF
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
- case "$prev" in
+ case $prev in
output)
compile_command="$compile_command @OUTPUT@"
finalize_command="$finalize_command @OUTPUT@"
;;
esac
- case "$prev" in
+ case $prev in
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
@@ -898,7 +899,7 @@ EOF
finalize_command="$finalize_command @SYMFILE@"
preload=yes
fi
- case "$arg" in
+ case $arg in
*.la | *.lo) ;; # We handle these cases below.
force)
if test "$dlself" = no; then
@@ -950,9 +951,116 @@ EOF
prev=
continue
;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit 1
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit 1
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
rpath | xrpath)
# We need an absolute path.
- case "$arg" in
+ case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
$echo "$modename: only absolute run-paths are allowed" 1>&2
@@ -998,7 +1106,7 @@ EOF
prevarg="$arg"
- case "$arg" in
+ case $arg in
-all-static)
if test -n "$link_static_flag"; then
compile_command="$compile_command $link_static_flag"
@@ -1061,7 +1169,7 @@ EOF
-L*)
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
# We need an absolute path.
- case "$dir" in
+ case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
@@ -1079,9 +1187,9 @@ EOF
lib_search_path="$lib_search_path $dir"
;;
esac
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case ":$dllsearchpath:" in
+ case :$dllsearchpath: in
*":$dir:"*) ;;
*) dllsearchpath="$dllsearchpath:$dir";;
esac
@@ -1092,18 +1200,26 @@ EOF
-l*)
if test "$arg" = "-lc"; then
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
# These systems don't actually have c library (as such)
continue
;;
+ *-*-rhapsody* | *-*-darwin*)
+ # Darwin C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
esac
elif test "$arg" = "-lm"; then
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-pw32* | *-*-beos*)
# These systems don't actually have math library (as such)
continue
;;
+ *-*-rhapsody* | *-*-darwin*)
+ # Darwin math library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
esac
fi
deplibs="$deplibs $arg"
@@ -1121,7 +1237,7 @@ EOF
;;
-no-install)
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
# The PATH hackery in wrapper scripts is required on Windows
# in order for the loader to find any dlls it needs.
@@ -1129,8 +1245,8 @@ EOF
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
fast_install=no
;;
- *-*-rhapsody*)
- # rhapsody is a little odd...
+ *-*-rhapsody* | *-*-darwin*)
+ # Darwin C library is in the System framework
deplibs="$deplibs -framework System"
;;
*)
@@ -1145,6 +1261,11 @@ EOF
continue
;;
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
-o) prev=output ;;
-release)
@@ -1165,7 +1286,7 @@ EOF
-R*)
dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
# We need an absolute path.
- case "$dir" in
+ case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
$echo "$modename: only absolute run-paths are allowed" 1>&2
@@ -1204,7 +1325,7 @@ EOF
IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
- case "$flag" in
+ case $flag in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
flag="\"$flag\""
;;
@@ -1222,7 +1343,7 @@ EOF
IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
- case "$flag" in
+ case $flag in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
flag="\"$flag\""
;;
@@ -1250,7 +1371,7 @@ EOF
# 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
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
@@ -1272,7 +1393,7 @@ EOF
# Read the .lo file
# If there is no directory component, then add one.
- case "$arg" in
+ case $arg in
*/* | *\\*) . $arg ;;
*) . ./$arg ;;
esac
@@ -1384,7 +1505,7 @@ EOF
# 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
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
@@ -1486,7 +1607,7 @@ EOF
fi
# Determine the type of output
- case "$output" in
+ case $output in
"")
$echo "$modename: you must specify an output file" 1>&2
$echo "$help" 1>&2
@@ -1523,7 +1644,7 @@ EOF
lib)
passes="conv link"
for file in $dlfiles $dlprefiles; do
- case "$file" in
+ case $file in
*.la) ;;
*)
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
@@ -1564,7 +1685,7 @@ EOF
for deplib in $libs; do
lib=
found=no
- case "$deplib" in
+ case $deplib in
-l*)
if test $linkmode != lib && test $linkmode != prog; then
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
@@ -1714,7 +1835,7 @@ EOF
installed=yes
# Read the .la file
- case "$lib" in
+ case $lib in
*/* | *\\*) . $lib ;;
*) . ./$lib ;;
esac
@@ -1769,9 +1890,11 @@ EOF
exit 1
fi
if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking statically,
- # we need to preload.
- dlprefiles="$dlprefiles $lib"
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
else
newdlfiles="$newdlfiles $lib"
fi
@@ -1779,7 +1902,7 @@ EOF
fi
# We need an absolute path.
- case "$ladir" in
+ case $ladir in
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
*)
abs_ladir=`cd "$ladir" && pwd`
@@ -1854,7 +1977,7 @@ EOF
tmp_libs=
for deplib in $dependency_libs; do
- case "$deplib" in
+ case $deplib in
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
esac
# Need to link against all dependency_libs?
@@ -2003,12 +2126,12 @@ EOF
add_dir=
add=
lib_linked=yes
- case "$hardcode_action" in
+ case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = no; then
- case "$host" in
+ case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
esac
add_dir="-L$dir"
@@ -2042,7 +2165,7 @@ EOF
fi
if test -n "$add_shlibpath"; then
- case ":$compile_shlibpath:" in
+ case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
esac
@@ -2056,7 +2179,7 @@ EOF
if test "$hardcode_direct" != yes && \
test "$hardcode_minus_L" != yes && \
test "$hardcode_shlibpath_var" = yes; then
- case ":$finalize_shlibpath:" in
+ case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
@@ -2075,7 +2198,7 @@ EOF
add_dir="-L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
- case ":$finalize_shlibpath:" in
+ case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
@@ -2133,7 +2256,7 @@ EOF
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
- case "$libdir" in
+ case $libdir in
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
case " $xrpath " in
*" $temp_xrpath "*) ;;
@@ -2161,13 +2284,13 @@ EOF
if test $link_all_deplibs != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
- case "$deplib" in
+ case $deplib in
-L*) path="$deplib" ;;
*.la)
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
test "X$dir" = "X$deplib" && dir="."
# We need an absolute path.
- case "$dir" in
+ case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
@@ -2232,7 +2355,7 @@ EOF
eval tmp_libs=\"\$$var\"
new_libs=
for deplib in $tmp_libs; do
- case "$deplib" in
+ case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
*)
case " $specialdeplibs " in
@@ -2249,7 +2372,7 @@ EOF
done
tmp_libs=
for deplib in $new_libs; do
- case "$deplib" in
+ case $deplib in
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
@@ -2306,7 +2429,7 @@ EOF
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
- case "$outputname" in
+ case $outputname in
lib*)
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
eval libname=\"$libname_spec\"
@@ -2386,7 +2509,7 @@ EOF
age="$4"
# Check that each of the things are valid numbers.
- case "$current" in
+ case $current in
0 | [1-9] | [1-9][0-9]*) ;;
*)
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
@@ -2395,7 +2518,7 @@ EOF
;;
esac
- case "$revision" in
+ case $revision in
0 | [1-9] | [1-9][0-9]*) ;;
*)
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
@@ -2404,7 +2527,7 @@ EOF
;;
esac
- case "$age" in
+ case $age in
0 | [1-9] | [1-9][0-9]*) ;;
*)
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
@@ -2423,7 +2546,7 @@ EOF
major=
versuffix=
verstring=
- case "$version_type" in
+ case $version_type in
none) ;;
irix)
@@ -2531,7 +2654,7 @@ EOF
removelist=
tempremovelist=`echo "$output_objdir/*"`
for p in $tempremovelist; do
- case "$p" in
+ case $p in
*.$objext)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
@@ -2598,7 +2721,7 @@ EOF
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
# these systems don't actually have a c library (as such)!
;;
@@ -2625,7 +2748,7 @@ EOF
major=""
newdeplibs=
droppeddeps=no
- case "$deplibs_check_method" in
+ case $deplibs_check_method in
pass_all)
# Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
@@ -2650,7 +2773,7 @@ EOF
for i in $deplibs; do
name="`expr $i : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
+ if test "$name" != "" -a "$name" != "0"; then
libname=`eval \\$echo \"$libname_spec\"`
deplib_matches=`eval \\$echo \"$library_names_spec\"`
set dummy $deplib_matches
@@ -2675,7 +2798,7 @@ EOF
for i in $deplibs; do
name="`expr $i : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
+ if test "$name" != "" -a "$name" != "0"; then
$rm conftest
$LTCC -o conftest conftest.c $i
# Did it work?
@@ -2715,7 +2838,7 @@ EOF
for a_deplib in $deplibs; do
name="`expr $a_deplib : '-l\(.*\)'`"
# If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
+ if test "$name" != "" -a "$name" != "0"; then
libname=`eval \\$echo \"$libname_spec\"`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
@@ -2733,7 +2856,7 @@ EOF
potlib="$potent_lib"
while test -h "$potlib" 2>/dev/null; do
potliblink=`ls -ld $potlib | sed 's/.* -> //'`
- case "$potliblink" in
+ case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
@@ -2808,6 +2931,21 @@ EOF
echo "*** The inter-library dependencies that have been dropped here will be"
echo "*** automatically added whenever a program is linked with this library"
echo "*** or is declared to -dlopen it."
+
+ if test $allow_undefined = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
fi
fi
# Done checking deplibs!
@@ -2834,7 +2972,7 @@ EOF
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
@@ -2943,6 +3081,7 @@ EOF
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${outputname}x"
@@ -2958,7 +3097,7 @@ EOF
for xlib in $convenience; do
# Extract the objects.
- case "$xlib" in
+ case $xlib in
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
*) xabs=`pwd`"/$xlib" ;;
esac
@@ -2997,13 +3136,115 @@ EOF
else
eval cmds=\"$archive_cmds\"
fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
+ if len=`expr "X$cmds" : ".*"` &&
+ test $len -le $max_cmd_len; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$save_output-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*"` &&
+ test $len -le $max_cmd_len; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test $k -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$save_output-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$save_output-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ # Set up a command to remove the reloadale object files
+ # after they are used.
+ i=0
+ while test $i -lt $k
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~$rm $delfiles\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$mode" = relink; then
@@ -3052,7 +3293,7 @@ EOF
$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
fi
- case "$output" in
+ case $output in
*.lo)
if test -n "$objs$old_deplibs"; then
$echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
@@ -3097,7 +3338,7 @@ EOF
for xlib in $convenience; do
# Extract the objects.
- case "$xlib" in
+ case $xlib in
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
*) xabs=`pwd`"/$xlib" ;;
esac
@@ -3232,7 +3473,7 @@ EOF
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
@@ -3250,9 +3491,9 @@ EOF
*) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
- case "$host" in
+ case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case ":$dllsearchpath:" in
+ case :$dllsearchpath: in
*":$libdir:"*) ;;
*) dllsearchpath="$dllsearchpath:$libdir";;
esac
@@ -3276,7 +3517,7 @@ EOF
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
@@ -3313,7 +3554,7 @@ EOF
fi
if test -n "$dlsyms"; then
- case "$dlsyms" in
+ case $dlsyms in
"") ;;
*.c)
# Discover the nlist of each of the dlfiles.
@@ -3444,7 +3685,7 @@ static const void *lt_preloaded_setup() {
fi
pic_flag_for_symtable=
- case "$host" in
+ case $host in
# compiling the symbol table file with pic_flag works around
# a FreeBSD bug that causes programs to crash when -lm is
# linked before any other PIC object. But we must not use
@@ -3512,7 +3753,7 @@ static const void *lt_preloaded_setup() {
# We should set the shlibpath_var
rpath=
for dir in $temp_rpath; do
- case "$dir" in
+ case $dir in
[\\/]* | [A-Za-z]:[\\/]*)
# Absolute path.
rpath="$rpath$dir:"
@@ -3620,7 +3861,7 @@ static const void *lt_preloaded_setup() {
# Quote $echo for shipping.
if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
- case "$0" in
+ case $0 in
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
esac
@@ -3859,7 +4100,7 @@ fi\
# Add in members from convenience archives.
for xlib in $addlibs; do
# Extract the objects.
- case "$xlib" in
+ case $xlib in
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
*) xabs=`pwd`"/$xlib" ;;
esac
@@ -3903,7 +4144,39 @@ fi\
# fi
# done
- eval cmds=\"$old_archive_cmds\"
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test $len -le $max_cmd_len; then
+ :
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*"` &&
+ test $len -le $max_cmd_len; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+ fi
fi
IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
@@ -3920,7 +4193,7 @@ fi\
fi
# Now create the libtool archive.
- case "$output" in
+ case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
@@ -3952,7 +4225,7 @@ fi\
# Replace all uninstalled libtool libraries with the installed ones
newdependency_libs=
for deplib in $dependency_libs; do
- case "$deplib" in
+ case $deplib in
*.la)
name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
@@ -4050,7 +4323,7 @@ relink_command=\"$relink_command\""
$echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
# Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
@@ -4066,7 +4339,7 @@ relink_command=\"$relink_command\""
# 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
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
@@ -4089,7 +4362,7 @@ relink_command=\"$relink_command\""
continue
fi
- case "$arg" in
+ case $arg in
-d) isdir=yes ;;
-f) prev="-f" ;;
-g) prev="-g" ;;
@@ -4114,7 +4387,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
+ case $arg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""
;;
@@ -4165,11 +4438,11 @@ relink_command=\"$relink_command\""
exit 1
fi
fi
- case "$destdir" in
+ case $destdir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
for file in $files; do
- case "$file" in
+ case $file in
*.lo) ;;
*)
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
@@ -4191,7 +4464,7 @@ relink_command=\"$relink_command\""
for file in $files; do
# Do each installation.
- case "$file" in
+ case $file in
*.$libext)
# Do the static libraries later.
staticlibs="$staticlibs $file"
@@ -4210,7 +4483,7 @@ relink_command=\"$relink_command\""
old_library=
relink_command=
# If there is no directory component, then add one.
- case "$file" in
+ case $file in
*/* | *\\*) . $file ;;
*) . ./$file ;;
esac
@@ -4306,7 +4579,7 @@ relink_command=\"$relink_command\""
fi
# Deduce the name of the destination old-style object file.
- case "$destfile" in
+ case $destfile in
*.lo)
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
;;
@@ -4353,7 +4626,7 @@ relink_command=\"$relink_command\""
relink_command=
# If there is no directory component, then add one.
- case "$file" in
+ case $file in
*/* | *\\*) . $file ;;
*) . ./$file ;;
esac
@@ -4370,7 +4643,7 @@ relink_command=\"$relink_command\""
libdir=
if test -f "$lib"; then
# If there is no directory component, then add one.
- case "$lib" in
+ case $lib in
*/* | *\\*) . $lib ;;
*) . ./$lib ;;
esac
@@ -4384,7 +4657,7 @@ relink_command=\"$relink_command\""
relink_command=
# If there is no directory component, then add one.
- case "$file" in
+ case $file in
*/* | *\\*) . $file ;;
*) . ./$file ;;
esac
@@ -4563,7 +4836,7 @@ relink_command=\"$relink_command\""
fi
dir=
- case "$file" in
+ case $file in
*.la)
# Check to see that this really is a libtool archive.
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
@@ -4578,7 +4851,7 @@ relink_command=\"$relink_command\""
library_names=
# If there is no directory component, then add one.
- case "$file" in
+ case $file in
*/* | *\\*) . $file ;;
*) . ./$file ;;
esac
@@ -4633,13 +4906,13 @@ relink_command=\"$relink_command\""
args=
for file
do
- case "$file" in
+ case $file in
-*) ;;
*)
# Do a test to see if this is really a libtool program.
if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
# If there is no directory component, then add one.
- case "$file" in
+ case $file in
*/* | *\\*) . $file ;;
*) . ./$file ;;
esac
@@ -4696,7 +4969,7 @@ relink_command=\"$relink_command\""
for arg
do
- case "$arg" in
+ case $arg in
-*) rm="$rm $arg" ;;
*) files="$files $arg" ;;
esac
@@ -4708,6 +4981,8 @@ relink_command=\"$relink_command\""
exit 1
fi
+ rmdirs=
+
for file in $files; do
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
if test "X$dir" = "X$file"; then
@@ -4719,9 +4994,17 @@ relink_command=\"$relink_command\""
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
test $mode = uninstall && objdir="$dir"
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test $mode = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
rmfiles="$file"
- case "$name" in
+ case $name in
*.la)
# Possibly a libtool archive, so verify it.
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
@@ -4765,10 +5048,10 @@ relink_command=\"$relink_command\""
*.lo)
# Possibly a libtool object, so verify it.
- if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
# Read the .lo file
- . ./$file
+ . $dir/$name
# Add PIC object to the list of files to remove.
if test -n "$pic_object" \
@@ -4801,6 +5084,15 @@ relink_command=\"$relink_command\""
$show "$rm $rmfiles"
$run $rm $rmfiles
done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
exit 0
;;
@@ -4817,7 +5109,7 @@ relink_command=\"$relink_command\""
fi # test -z "$show_help"
# We need to display help for each of the modes.
-case "$mode" in
+case $mode in
"") $echo \
"Usage: $modename [OPTION]... [MODE-ARG]...
@@ -4956,6 +5248,7 @@ The following components of LINK-COMMAND are treated specially:
-no-install link a not-installable executable
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries