From: Robert Boehne Date: Tue, 27 Nov 2001 19:31:22 +0000 (+0000) Subject: With help from Michael Matz : X-Git-Tag: release-1-4d~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b4575cf0aee7853c6a91aa844fc2b3168476483;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 bf83f8c8a..43db3d11f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-27 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-27 Kevin Ryde * libtool.m4 (AC_LIBTOOL_SYS_MAX_CMD_LEN): Send "test" warnings to /dev/null, helps FreeBSD and maybe others. diff --git a/doc/libtool.texi b/doc/libtool.texi index f326be055..8f448e386 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}. @@ -4133,10 +4142,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.} @@ -4175,15 +4184,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 7d295408e..67bfd77a5 100644 --- a/ltmain.in +++ b/ltmain.in @@ -213,6 +213,8 @@ do --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; + --preserve-dup-deps) duplicate_deps="yes" ;; + --quiet | --silent) show=: ;; @@ -1638,9 +1640,11 @@ EOF # 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 @@ -1651,12 +1655,14 @@ EOF # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done + if test "X$duplicate_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi pre_post_deps= fi @@ -1890,9 +1896,11 @@ EOF 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 @@ -2017,9 +2025,11 @@ EOF # 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 @@ -2334,9 +2344,11 @@ EOF 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