From 586ac44e6e48b5d6b02faa9aca2f3f3286332e62 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 12 Apr 2001 02:20:59 +0000 Subject: [PATCH] * ltmain.in: Mark duplicate libraries appearing in predeps and postdeps as specialdeplibs. Explain the whole plan. --- ChangeLog | 5 +++++ ltmain.in | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index dea32df48..f45d4093f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-04-11 Alexandre Oliva + + * ltmain.in: Mark duplicate libraries appearing in predeps and + postdeps as specialdeplibs. Explain the whole plan. + 2001-04-11 Ossama Othman * config.guess: Updated to latest version. diff --git a/ltmain.in b/ltmain.in index e33fe4fe0..47db3501c 100644 --- a/ltmain.in +++ b/ltmain.in @@ -1630,6 +1630,18 @@ EOF if test $linkmode = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $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 + pre_post_deps= fi deplibs= @@ -2373,6 +2385,20 @@ EOF case $deplib in -L*) new_libs="$deplib $new_libs" ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) -- 2.47.2