[ Let's move this to libtool-patches Note also the list server may not come back up for a few days. ]
Hi Pierre, Sorry for the delay. * Pierre Ossman wrote on Fri, Jan 27, 2006 at 05:30:22PM CET: > I've put together a suggestion (against 1.5 branch, but the difference > shouldn't be that big compared to HEAD) for this. Many thanks for your effort! I'm not convinced yet that this is the way to go, on the contrary, I have real doubts, but at least this is a start. > What it does is strip ${libext} from the name and, if we're on a > $need_lib_prefix system, applies a command that should reverse the > effect of $libname_spec. It then appends the '.la' extension. *snip* OK. But the '.la' extension should be necessary for preloading only. > The effect is that preloading and "normal" loading will work for any > application that uses the platform independent ways of loading: Yep. > Any programs that uses lt_dlopen("module.a") will break with this patch. > But I would consider such a call unsupported since they've been mucking > about in libtool internals to figure out that name. My tests show that also lt_dlopen("module.la") may fail on some systems. > The is another breakage caused by the fact that libtool special cases > the 'lib' prefix. dlpreopening a module called libfoo on a > $need_lib_prefix system with a prefix of 'lib' will not work. The reason > is that the above magic cannot tell the difference between 'libfoo' and > 'foo' (which will be transformed to 'libfoo') on such a system. I'm still afraid this will cause user breakage. You can neither expect the user to use the prefix nor to omit it. It's much too useful to be able to dlopen "regular libraries", this feature is used often. > Please review and comment. If it looks good I'll make a patch for HEAD > and try to do some test cases. The naming is a bit inconsistent: we use `*_cmds' for `~'-separated lists of commands -- yes, shrext_cmds is a bad counter example, and should be fixed, too. It should either be libname_rev, since it's not a command at all, or ltmain should be able to cope with (multiple) commands in there. (This is documented in libtool.texi, too.) Have you tested it? I tested something like the patch below (after the forward port of your patch). There are several ugly details to be aware of: Inside the backquotes in libname_rev, you may not use double quotes. This is because the config.status escaping would then lead to "`..\"..\"..`" which is not portable. Also, to use $Xsed, you should add an X, and an `-e'. ;-) The patch below is missing at least documentation of `libname_rev' in libtool.texi, and some decent tests, beside the cheap one. For me this breaks mdemo-exec.test after mdemo-static.test on GNU/Linux (without any further modifications). You can simulate need_lib_prefix by help of the attached patch (which I won't apply ATM because I don't know whether it's safe). The patch creates a test which itself creates a new build tree for Libtool, changes need_lib_prefix, configures mdemo, (mdemo-conf, not mdemo-static), changes need_lib_prefix there, then builds. Adjust as needed. Cheers, Ralf Index: libltdl/config/ltmain.m4sh =================================================================== RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v retrieving revision 1.35 diff -u -r1.35 ltmain.m4sh --- libltdl/config/ltmain.m4sh 5 Feb 2006 11:06:31 -0000 1.35 +++ libltdl/config/ltmain.m4sh 12 Feb 2006 15:05:11 -0000 @@ -874,7 +874,13 @@ for dlprefile in $dlprefiles; do func_echo "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" - name="$func_basename_result" + func_stripname '' ".$libext" "$func_basename_result" + name="$func_stripname_result" + if test "$need_lib_prefix" != no; then + eval shared_ext=\"$shrext_cmds\" + eval name=\"$libname_rev\" + fi + name=${name}.la $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" Index: libltdl/m4/libtool.m4 =================================================================== RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v retrieving revision 1.60 diff -u -r1.60 libtool.m4 --- libltdl/m4/libtool.m4 9 Feb 2006 16:04:01 -0000 1.60 +++ libltdl/m4/libtool.m4 12 Feb 2006 15:05:14 -0000 @@ -1898,6 +1898,7 @@ [withGCC=$GCC]) library_names_spec= libname_spec='lib$name' +libname_rev='`$ECHO X$name | \$Xsed -e s/^lib//`' soname_spec= shrext_cmds=".so" postinstall_cmds= @@ -2381,6 +2382,7 @@ os2*) libname_spec='$name' + libname_rev='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' @@ -2524,6 +2526,7 @@ _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [libname_rev], [1], [Reverse of libname_spec]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]])
Index: Makefile.am =================================================================== RCS file: /cvsroot/libtool/libtool/Makefile.am,v retrieving revision 1.192 diff -u -r1.192 Makefile.am --- Makefile.am 9 Feb 2006 15:31:11 -0000 1.192 +++ Makefile.am 28 Feb 2006 17:22:31 -0000 @@ -398,6 +398,7 @@ tests/template.at \ tests/early-libtool.at \ tests/deplibs-ident.at \ + tests/need_lib_prefix.at \ tests/stresstest.at EXTRA_DIST += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) $(srcdir)/tests/package.m4 --- /dev/null 1970-01-01 00:00:01.000000000 +0100 +++ tests/need_lib_prefix.at 2006-01-31 14:15:51.000000000 +0100 @@ -0,0 +1,39 @@ +# Hand crafted tests for GNU Libtool. -*- Autotest -*- +# Copyright 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# need_lib_prefix.test - make sure libltdl works on systems that need this + +AT_SETUP([Test libltdl with need_lib_prefix.]) + +# This does not work with BSD make. Require GNU make to be sure. +AT_CHECK([$MAKE --version | grep 'GNU Make' || (exit 77)], [0], [stdout], [ignore]) + +# we just configure the whole Libtool package here again. +AT_CHECK([$abs_top_srcdir/configure $configure_options], 0, [ignore], [ignore]) +sed 's,^need_lib_prefix=.*,need_lib_prefix=unknown,' < ./libtool > ./libtool-new +mv -f ./libtool-new ./libtool +chmod +x ./libtool +LT_AT_MAKE([check], [TESTS=tests/mdemo-conf.test VERBOSE=x TESTSUITE_FLAGS=-V]) +sed 's,^need_lib_prefix=.*,need_lib_prefix=unknown,' \ + < tests/mdemo/libtool > tests/mdemo/libtool-new +mv -f tests/mdemo/libtool-new tests/mdemo/libtool +chmod +x tests/mdemo/libtool +LT_AT_MAKE([check], + [TESTS='tests/mdemo-make.test tests/mdemo-exec.test' VERBOSE=x TESTSUITE_FLAGS=-V]) + +AT_CLEANUP
_______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool