]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/config/ltmain.m4sh (func_mode_link): Fix accumulation
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 23 Apr 2007 17:10:17 +0000 (17:10 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 23 Apr 2007 17:10:17 +0000 (17:10 +0000)
of `inherited_linker_flags' entries from multiple deplibs, by
adding $new_inherited_linker_flags only once, only in link pass.
* tests/inherited_flags: Amend test to expose this.
* NEWS: Adjust: kill one regression, but add note about the
feature new in 1.9b.
Report by Jeff Squyres and others.

ChangeLog
NEWS
libltdl/config/ltmain.m4sh
tests/inherited_flags.at

index 2185ab7ce60bf9d0add911a91c4c93d8af8a97d3..725c92fc19943011a768ae994c4804546ca0dc50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-04-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/config/ltmain.m4sh (func_mode_link): Fix accumulation
+       of `inherited_linker_flags' entries from multiple deplibs, by
+       adding $new_inherited_linker_flags only once, only in link pass.
+       * tests/inherited_flags: Amend test to expose this.
+       * NEWS: Adjust: kill one regression, but add note about the
+       feature new in 1.9b.
+       Report by Jeff Squyres and others.
+
 2007-04-23  Charles Wilson  <libtool@cwilson.fastmail.fm>
 
        * libltdl/config/ltmain.m4sh (func_mode_link): move wrapper
diff --git a/NEWS b/NEWS
index ff55563a9fd85d7bad0f8cc509cb612fd69fa37c..6c0d5d591b1c417d658d7f0a23e25f2daa3b5945 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,12 +12,6 @@ New in 2.1a: 2007-??-??; CVS version 2.1a, Libtool team:
     any more, some setups may fail.  A mechanism to allow the user to
     choose the mode has not been implemented yet.
 
-  - In 1.9b, a new variable inherited_linker_flags has been added to the
-    libtool library files.  This variable takes flags that should be
-    used by dependent libraries and programs, but that do not fit into
-    `dependency_libs' for both clarity and backward-compatibility.
-    Currently, these flags are not uniquified and thus accumulate.
-
 * Important incompatible changes and obsoleted features:
 
   - Removed deprecated APIs from libltdl: lt_dlcaller_register,
@@ -66,6 +60,10 @@ New in 2.1a: 2007-??-??; CVS version 2.1a, Libtool team:
     Both testsuites have been made more useful for testing
     cross-compilers.  The new testsuite exposes many more issues, but
     may also be a little rocky on exotic systems.
+  - In 1.9b, a new variable inherited_linker_flags has been added to the
+    libtool library files.  This variable takes flags that should be
+    used by dependent libraries and programs, but that do not fit into
+    `dependency_libs' for both clarity and backward-compatibility.
 
 * Changes in supported systems or compilers:
 
index 017644a238affcf87b1e8974ff589dd5bf71c2f7..df4d5c437eaf189e688aceb51965da22be34695d 100644 (file)
@@ -4036,12 +4036,6 @@ func_mode_link ()
          done
        fi
        dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       if test "$linkmode,$pass" = "prog,link"; then
-         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
-         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
-       else
-         compiler_flags="$compiler_flags $inherited_linker_flags"
-       fi
        if test "$linkmode,$pass" = "lib,link" ||
           test "$linkmode,$pass" = "prog,scan" ||
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
@@ -4669,6 +4663,14 @@ func_mode_link ()
          fi # link_all_deplibs != no
        fi # linkmode = lib
       done # for deplib in $libs
+      if test "$pass" = link; then
+       if test "$linkmode" = "prog"; then
+         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+       else
+         compiler_flags="$compiler_flags $new_inherited_linker_flags"
+       fi
+      fi
       dependency_libs="$newdependency_libs"
       if test "$pass" = dlpreopen; then
        # Link the dlpreopened libraries before other libraries
index b749a4064d7eb892779c1aa8bfdbfd7739f404cd..cd693fa6d9240637d8440a9853b6c21afa320253 100644 (file)
@@ -41,6 +41,11 @@ AT_DATA([baz.c],
 int baz() { return 1;}
 ])
 
+AT_DATA([both.c],
+[
+int both() { return 1;}
+])
+
 AT_DATA([main.c],
 [
 int main() { return 0;}
@@ -49,9 +54,11 @@ int main() { return 0;}
 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o baz.lo baz.c
+$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o both.lo both.c
 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo -rpath /usr/local/lib -no-undefined
 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la bar.lo -rpath /usr/local/lib -no-undefined
+$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libboth.la both.lo -rpath /usr/local/lib -no-undefined
 
 
 mv libfoo.la libfoo.la.bak
@@ -62,6 +69,10 @@ mv libbar.la libbar.la.bak
 sed -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la
 rm libbar.la.bak
 
+mv libboth.la libboth.la.bak
+sed -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la
+rm libboth.la.bak
+
 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /usr/local/lib ./libfoo.la ./libbar.la],
         [ignore],[stdout],[ignore])
 # We used to grep for
@@ -76,4 +87,18 @@ AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo -no
 AT_CHECK([grep 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' stdout],
         [0],[ignore],[ignore])
 
+# now check for duplicates
+AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /usr/local/lib ./libfoo.la ./libbar.la ./libboth.la],
+        [ignore],[stdout],[ignore])
+AT_CHECK([grep 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
+        [1],[ignore],[ignore])
+AT_CHECK([grep 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
+        [1],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo -no-undefined -rpath /usr/local/lib  ./libfoo.la ./libbar.la ./libboth.la],
+       [ignore],[stdout],[ignore])
+AT_CHECK([grep 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
+        [1],[ignore],[ignore])
+AT_CHECK([grep 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
+        [1],[ignore],[ignore])
+
 AT_CLEANUP