Subject: Re: C++, libtool and a.out
To: Nick Hudson <email@example.com>
From: Todd Vierling <firstname.lastname@example.org>
Date: 06/21/2000 23:11:11
On Wed, 21 Jun 2000, Nick Hudson wrote:
: OK so pkglibtool supported C++ constructors and destructors on a.out
: systems by introducing the cplusplus flag which would link in
: /usr/lib/c++rt0.o if specified. I would to apply the attached patch
: so that libtool 1.3.5 will also support C++ and a.out.
Be careful hardcoding /usr/lib here. Think about cross compilation.
The best solution would be to check whether or not "cc -shared" works
properly (a fix went in between 1.3 and 1.4), and use that. It will link in
c++rt0.o automatically, from the "normal library path". If we want to add
this for 1.3-and-before systems (that do not have a specially updated
compiler), it can then be done manually, provided "cc -shared" does not work
How to check? Use the following:
if $CC -dumpspecs | grep 'c++rt0' >/dev/null; then
# use "cc -shared" for shared objects
# use "ld -Bshareable" and manually tack on c++rt0
Note that this check is only necessary for a.out. For ELF, "cc -shared" is
already usable. Also note that we cannot use "grep -q" in the cross
compilation case; hence "grep >/dev/null".
-- Todd Vierling (email@example.com)