Subject: Libtool on NetBSD/ELF
To: None <tech-pkg@netbsd.org>
From: Steinar Hamre <steinarh@stud.fim.ntnu.no>
List: tech-pkg
Date: 10/02/2000 14:14:55
Ok, everyone hates libtool for always beeing so wrong. But we still
have to fix it. libtool -module on netbsd/elf creates an 'ar'-archive,
and *wow* that does not work with dlopen(). So I've tried fixing
libtool on netbsd/elf a little bit. It would be very nice if somebody
told me if I'm doing anything awfully wrong before i send this to the
libtool maintainers.
First, echo __ELF__ | $CC -E - | grep __ELF__ is true if the the
toolcain is *not* elf. So the first test was inversed.
secondly there is no problem making and using a library named `u'
need_lib_prefix=no
need_version=no
LD_LIBRARY_PATH overrides the binary's RPATH
shlibpath_overrides_runpath=yes
file_magic seems to be the most sensible deplibs_check_method. (better
than unknown, anyway)
The (seriosly misnamed) version_type `linux' seems to be the most
sensible one. It's used by most elf and ecoff platforms. The only real
alternative is `freebsd-elf'. The difference is: `linux' uses 3-digit
versioning libfoo.so.$major.$age.$minor (major=$current-$age) whereas
`freebsd-elf' uses 1-digit versioning libfoo.so.$current
$ libtool --mode=link gcc -version-info 6:1:4 [...] will create
libfoo.so.2.4.1 (soname libfoo.so.2) using `version_type=linux'
libfoo.so.6 (soname libfoo.so.6) using `version_type=freebsd-elf'
Steinar
diff -ur libtool-1.3.5.o/ltconfig.in libtool-1.3.5/ltconfig.in
--- libtool-1.3.5.o/ltconfig.in Sat May 27 03:58:57 2000
+++ libtool-1.3.5/ltconfig.in Mon Oct 2 11:37:10 2000
@@ -1194,11 +1194,13 @@
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- else
archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
# can we support soname and/or expsyms with a.out? -oliva
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ need_lib_prefix=no
+ need_version=no
fi
;;
@@ -2014,9 +2016,13 @@
else
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
soname_spec='${libname}${release}.so$major'
+ version_type=linux
dynamic_linker='NetBSD ld.elf_so'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
fi
shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
;;
openbsd*)