@cindex finish mode
@cindex mode, finish
-@dfn{Finish} mode helps system administrators install libtool libraries
-so that they can be located and linked into user programs.
-
-Each @var{mode-arg} is interpreted as the name of a library directory.
-Running this command may require superuser privileges, so the
-@option{--dry-run} option may be useful.
+@dfn{Finish} mode has two functions. One is to help system administrators
+install libtool libraries so that they can be located and linked into
+user programs. To invoke this functionality, pass the name of a library
+directory as @var{mode-arg}. Running this command may require superuser
+privileges, and the @option{--dry-run} option may be useful.
+
+The second is to facilitate transferring libtool libraries to a native
+compilation environment after they were built in a cross-compilation
+environment. Cross-compilation environments may rely on recent libtool
+features, and running libtool in finish mode will make it easier to
+work with older versions of libtool. This task is performed whenever
+the @var{mode-arg} is a @samp{.la} file.
@node Uninstall mode
@section Uninstall mode
fi
done
+ if test -n "$libs"; then
+ tmpdir=`func_mktempdir`
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED 's/[].[^$\\*|]/\\\\&/g'`
+ sysroot_cmd="s|\([ ']\)$sysroot_regex|\1|g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ for lib in $libs; do
+ $opt_dry_run || {
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ }
+ file="$outputname"
+ done
+ $opt_dry_run || ${RM}r "$tmpdir"
+ fi
+
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT])
AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"], [1])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib2.la], [0], [ignore])
+AT_CHECK([./libtool --mode=finish $sysroot/$prefix/lib/lib@<:@12@:>@.la], [0], [ignore])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib@<:@12@:>@.la], [1])
# missing tests
# 1) pass absolute .la files