Subject: Re: libtool
To: Klaus Heinz <heinz@netbsd.org>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-pkg
Date: 02/14/2002 14:02:45
On Wed, 13 Feb 2002, Klaus Heinz wrote:

: > > Or is 'libtool' used in pkgsrc mainly for the non-NetBSD systems like
: > > Solaris, Linux and Darwin ?
: >
: > No. It can be used by all OSes.
:
: I know it _can_ :). I wanted to say: do the packages which use libtool do so
: because of differences between NetBSD ports or for the sake of those other
: platforms (Solaris, etc.).

Both.  Read my other post.  NetBSD a.out platforms (and even some old ELF
ones, notably mips) vary wildly in the way that shared libraries are created
and referenced.

: Does anybody know examples where libtool was introduced during the
: packaging process ?

editors/pico, for one.  There are others.  However, typically this is done
where a shared library is desired, and the package did *not* create one
beforehand.

: The example I know best, because I am trying to update it, is text/icu.
: This software does indeed support many different platforms and (Net)BSD
: is among them, the new version 2.0  works out of the box, to the last
: test case.

: This assumes, the compiler on NetBSD understands '-shared', which seems
: not to be the case on every NetBSD port (or older versions).

Well, you could mark the package as unusable on old NetBSD a.out platforms.

Or fix the package to detect NetBSD a.out and use the appropriate build
procedure ("ld -Bshareable") for those platforms, and submit the change back
to the maintainer.  The NetBSD platforms for which "ld -Bshareable"  should
be preferred can be detected with the following shellcode heuristic:

if echo '__ELF__' | $CC -E - | grep -q __ELF__; then
    # __ELF__ passed through, so mark package as a.out; use "ld -Bshareable"
else
    # __ELF__ was #defined, so mark package as ELF; use "cc -shared"
fi

This is very similar to the heuristic I introduced into libtool ages ago.
Note that "grep -q" is not valid on all systems, so this test should only be
done after NetBSD is detected as a host.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/