dlprefiles="$dlprefiles $arg"
fi
prev=
+ continue
;;
esac
;;
linkmode=prog ;;
esac
- libs="$deplibs"
+ specialdeplibs=
+ libs=
+ # Find all interdependent deplibs that
+ # are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ libs="$libs $deplib"
+ done
deplibs=
newdependency_libs=
uninst_path= # paths that contain uninstalled libtool libraries
done
;;
prog)
+ compile_deplibs=
+ finalize_deplibs=
alldeplibs=no
newdlfiles=
newdlprefiles=
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
esac
fi
+ if test $pass = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
for deplib in $libs; do
lib=
found=no
done
if test "$found" != yes; then
if test "$linkmode,$pass" = "prog,link"; then
- compile_command="$compile_command $deplib"
- finalize_command="$finalize_command $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
else
- deplibs="$deplibs $deplib"
- test $linkmode = lib && newdependency_libs="$newdependency_libs $deplib"
+ deplibs="$deplib $deplibs"
+ test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
-L*)
case $linkmode in
lib)
- case "$deplibs " in
- *" $deplib "*) ;;
- *)
- deplibs="$deplibs $deplib"
- newdependency_libs="$newdependency_libs $deplib"
- new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- esac
+ deplibs="$deplib $deplibs"
+ newdependency_libs="$deplib $newdependency_libs"
+ new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
;;
prog)
if test $pass = scan; then
- deplibs="$deplibs $deplib"
+ deplibs="$deplib $deplibs"
new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
else
- compile_command="$compile_command $deplib"
- finalize_command="$finalize_command $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
fi
;;
*)
*" $dir "*) ;;
*) xrpath="$xrpath $dir" ;;
esac
- continue
fi
+ continue
;;
*.la) lib="$deplib" ;;
*.$libext)
echo
echo "*** Warning: Linking the shared library $output against the"
echo "*** static library $deplib is not portable!"
- deplibs="$deplibs $deplib"
+ deplibs="$deplib $deplibs"
fi
continue
;;
prog)
- if test $pass = scan; then
- deplibs="$deplibs $deplib"
+ if test $pass != link; then
+ deplibs="$deplib $deplibs"
else
- compile_command="$compile_command $deplib"
- finalize_command="$finalize_command $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
fi
continue
;;
esac
;;
- *.lo | *.$objext) continue ;;
+ *.lo | *.$objext)
+ if test $linkmode = prog; then
+ if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ fi
+ continue
+ ;;
%DEPLIBS%)
alldeplibs=yes
continue
if test $linkmode = prog && test $pass != link; then
new_lib_search_path="$new_lib_search_path $ladir"
- deplibs="$deplibs $lib"
+ deplibs="$lib $deplibs"
linkalldeplibs=no
if test "$link_all_deplibs" != no || test "$fast_install" != no || \
test "$build_libtool_libs" = no || test -z "$library_names"; then
linkalldeplibs=yes
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$newdependency_libs $dependeny_libs"
fi
+ tmp_libs=
for deplib in $dependency_libs; do
case "$deplib" in
-L*) new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
esac
# Need to link against all dependency_libs?
- test $linkalldeplibs = yes && deplibs="$deplibs $deplib"
+ if test $linkalldeplibs = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ tmp_libs="$tmp_libs $deplib"
done
continue
fi
convenience="$convenience $dir/$old_library"
old_convenience="$old_convenience $dir/$old_library"
if test $linkmode = lib; then
- deplibs="$deplibs $dir/$old_library"
- newdependency_libs="$newdependency_libs $dependency_libs"
+ deplibs="$dir/$old_library $deplibs"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ tmp_libs="$tmp_libs $deplib"
+ done
elif test "$linkmode,$pass" = "prog,link"; then
- compile_command="$compile_command $dir/$old_library"
- finalize_command="$finalize_command $dir/$old_library"
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
fi
continue
fi
esac
fi
if test $linkmode = prog; then
- if test -n "$add_dir"; then
- case "$compile_command " in
- *" $add_dir "*) ;;
- *) compile_command="$compile_command $add_dir" ;;
- esac
- fi
- test -n "$add" && compile_command="$compile_command $add"
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
- if test -n "$add_dir"; then
- case "$deplibs " in
- *" $add_dir "*) ;;
- *) deplibs="$deplibs $add_dir" ;;
- esac
- fi
- test -n "$add" && deplibs="$deplibs $add"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
if test "$hardcode_direct" != yes && \
test "$hardcode_minus_L" != yes && \
test "$hardcode_shlibpath_var" = yes; then
- case ":$finalize_shlibpath:" in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
fi
fi
fi
fi
if test $linkmode = prog; then
- if test -n "$add_dir"; then
- case "$finalize_command " in
- *" $add_dir "*) ;;
- *) finalize_command="$finalize_command $add_dir" ;;
- esac
- fi
- test -n "$add" && finalize_command="$finalize_command $add"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
- if test -n "$add_dir"; then
- case "$deplibs " in
- *" $add_dir "*) ;;
- *) deplibs="$deplibs $add_dir" ;;
- esac
- fi
- test -n "$add" && deplibs="$deplibs $add"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add deplibs"
fi
fi
elif test $linkmode = prog; then
# shared platforms.
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"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
else
- case "$compile_command " in
- *" -L$dir "*) ;;
- *) compile_command="$compile_command -L$dir";;
- esac
- compile_command="$compile_command -l$name"
- case "$finalize_command " in
- *" -L$dir "*) ;;
- *) finalize_command="$finalize_command -L$dir";;
- esac
- finalize_command="$finalize_command -l$name"
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
fi
elif test "$build_libtool_libs" = yes; then
# Not a shared library
else
convenience="$convenience $dir/$old_library"
old_convenience="$old_convenience $dir/$old_library"
- deplibs="$deplibs $dir/$old_library"
+ deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
fi
new_lib_search_path="$new_lib_search_path $absdir"
# Link against this library
- test "$link_static" = no && newdependency_libs="$newdependency_libs $abs_ladir/$laname"
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
- newdependency_libs="$newdependency_libs $dependency_libs"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ tmp_libs="$tmp_libs $deplib"
+ done
if test $link_all_deplibs != no; then
# Add the search paths of all dependency libraries
;;
*) continue ;;
esac
- case "$deplibs " in
+ case " $deplibs " in
*" $path "*) ;;
- *) deplibs="$path $deplibs" ;;
+ *) deplibs="$deplibs $path" ;;
esac
done
fi
fi
done
dependency_libs="$newdependency_libs"
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $new_lib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- lib_search_path="$lib_search_path $sys_lib_search_path"
+ if test $pass = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ deplibs="$deplibs $save_deplibs"
+ elif test $pass != dlopen; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $new_lib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ lib_search_path="$lib_search_path $sys_lib_search_path"
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Make sure that $var contains only unique libraries
+ # and add them in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ case "$deplib" in
+ -L*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case "$deplib" in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done
+ fi
done
if test $linkmode = prog; then
dlfiles="$newdlfiles"
fi
fi
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
exit 0
;;
- # libtool clean mode
- clean)
- modename="$modename: clean"
- rm="$nonopt"
- files=
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case "$arg" in
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$objdir"
- else
- objdir="$dir/$objdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- rmfiles="$file"
-
- case "$file" in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . ./$file
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
-
- *)
- # Do a test to see if this is a libtool program.
- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$file
-
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- done
- exit 0
- ;;
-
# libtool execute mode
execute)
modename="$modename: execute"
fi
;;
- # libtool uninstall mode
- uninstall)
- modename="$modename: uninstall"
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
rm="$nonopt"
files=
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
for arg
do
case "$arg" in
for file in $files; do
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$objdir"
+ else
+ objdir="$dir/$objdir"
+ fi
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test $mode = uninstall && objdir="$dir"
rmfiles="$file"
# Delete the libtool libraries and symlinks.
for n in $library_names; do
- rmfiles="$rmfiles $dir/$n"
+ rmfiles="$rmfiles $objdir/$n"
done
- test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
-
- $show "$rm $rmfiles"
- $run $rm $rmfiles
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+ test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
+ if test $mode = uninstall; then
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- fi
+ fi
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
fi
-
- # FIXME: should reinstall the best remaining shared library.
fi
;;
oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
rmfiles="$rmfiles $dir/$oldobj"
fi
- $show "$rm $rmfiles"
- $run $rm $rmfiles
;;
*)
- $show "$rm $rmfiles"
- $run $rm $rmfiles
+ # Do a test to see if this is a libtool program.
+ if test $mode = clean &&
+ (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$file
+
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ fi
;;
esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
done
exit 0
;;