From: Robert Boehne Date: Wed, 28 Nov 2001 21:50:32 +0000 (+0000) Subject: With help from Michael Matz : X-Git-Tag: release-1-4-3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4d804f3dd1e3db8890dee87e40866d7130cd786;p=thirdparty%2Flibtool.git With help from Michael Matz : * ltmain.in: Add a new command line argument --preserve-dup-deps for preserving duplicate dependent libraries. * libtool.texi: Document it. --- diff --git a/ChangeLog b/ChangeLog index f393de3c5..4c5b7e261 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-28 Robert Boehne + + With help from Michael Matz : + * ltmain.in: Add a new command line argument + --preserve-dup-deps for preserving duplicate + dependent libraries. + * libtool.texi: Document it. + 2001-11-28 Gary V. Vaughan * libtoolize.in: The test for whether AC_PROG_LIBTOOL is defined diff --git a/doc/libtool.texi b/doc/libtool.texi index 28921aba3..0e2101ded 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1063,6 +1063,15 @@ be executed by libtool. Display basic configuration options. This provides a way for packages to determine whether shared or static libraries will be built. +@item --preserve-dup-deps +Do not remove duplicate dependencies in libraries. When building packages +with static libraries, the libraries may depend circularly on each other +(shared libs can too, but for those it doesn't matter), so there are +situations, where -la -lb -la is required, and the second -la may not be +stripped or the link will fail. In cases where these duplications are +required, this option will preserve them, only stripping the libraries +that libtool knows it can safely. + @item --finish Same as @samp{--mode=finish}. @@ -4106,10 +4115,10 @@ they are bundled with: @table @code @item aix3* @itemx aix4* -AIX compilers have no PIC flags, since AIX has been ported only to -PowerPC and RS/6000 chips. @footnote{All code compiled for the PowerPC -and RS/6000 chips (@code{powerpc-*-*}, @code{powerpcle-*-*}, and -@code{rs6000-*-*}) is position-independent, regardless of the operating +Most AIX compilers have no PIC flags, since AIX (with the exception of +AIX for IA-64) runs on PowerPC and RS/6000 chips. @footnote{All code compiled +for the PowerPC and RS/6000 chips (@code{powerpc-*-*}, @code{powerpcle-*-*}, +and @code{rs6000-*-*}) is position-independent, regardless of the operating system or compiler suite. So, ``regular objects'' can be used to build shared libraries on these systems and no special PIC compiler flags are required.} @@ -4148,15 +4157,9 @@ Particularly, if a pair of static archives each resolve some of the other's symbols, it might be necessary to list one of those archives both before and after the other one. Libtool does not currently cope with this situation well, since dupicate libraries are removed from -thr link line. - -If you find yourself developing on a host that requires you to list -libraries multiple times in order for it to generate correctly linked -objects, you can defeat libtool's removal algorithm like this: - -@example -$ libtool ... -lfoo -lbar -Wl,-lfoo -@end example +the link line by default. Libtool provides the command line option +@samp{--preserve-dup-deps} to preserve all duplicate dependencies +in cases where it is necessary. @node Archivers @subsection Archivers diff --git a/ltmain.in b/ltmain.in index 34d96f3b0..b9656746b 100644 --- a/ltmain.in +++ b/ltmain.in @@ -177,6 +177,8 @@ do --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; + --preserve-dup-deps) duplicate_deps="yes" ;; + --quiet | --silent) show=: ;; @@ -1330,9 +1332,11 @@ compiler." # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi libs="$libs $deplib" done deplibs= @@ -1557,9 +1561,11 @@ compiler." tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done elif test $linkmode != prog && test $linkmode != lib; then @@ -1682,9 +1688,11 @@ compiler." # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done # for deplib continue @@ -1984,9 +1992,11 @@ compiler." tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done