* 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.
This commit is contained in:
Ralf Wildenhues 2007-04-23 17:10:17 +00:00
parent e9cc8cb41f
commit 06470c3a43
4 changed files with 47 additions and 12 deletions

View File

@ -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

10
NEWS
View File

@ -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:

View 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

View 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