[C++-sig] using libtool with boost.python
Rene Rivera
grafik.list at redshift-software.com
Wed Jul 6 05:04:15 CEST 2005
Dirgesh Patel wrote:
> if i want to use libtool to compile and link all of my files in the JAMFILE
> with boost.python...how can i do so, here is what my Jamfile looks like
> currently.
>
> extension MaskUtil
> : # sources
> MaskUtil.cpp
>
> # requirements and dependencies for Boost.Python extensions
> <template>@boost/libs/python/build/extension
> ;
>
> # Declare a test for the extension module
> boost-python-runtest test2
> : # extension modules to use
> <pyd>MaskUtil ;
First bear with me I'm fairly ignorant as to libtool specifics, other
than it's yet another wrapper shell script around compilers and linkers.
AFAICT your question is:
How to make Boost.Build, this is the Boost tool component that knows how
to call the compiler, use the "libtool" executable instead of calling
gcc directly?
The start of an answer:
The documentation at: http://www.boost.org/tools/build/v1/gcc-tools.html
mentions the way to override what to use when invoking gcc. It has two
variables you specify "GXX" and "GCC" to correspond when compiling a C++
source file, and C source file respectively. For example you could
invoke bjam as:
bjam -sTOOLS=gcc "-sGXX=libtool g++"
"GXX" is used by Boost.Build to both compile and link ELF objects, so
any time a file is compiled or a shared library is linked it's going to
call it. Now I don't know all that much about how libtool does things
but if it doesn't understand the that using the "-c" option in GCC makes
it compile instead of link the above will not work. If libtool requires
additional options than those given to GCC you have two choices: a)
write a wrappers script around libtool that figures out the correct
options based on the GCC command line, or b) write a new Boost.Build
toolset that specifically supports libtool.
Such a libtool toolset might start like so:
===gcc-libtool-tools.jam===
extends-toolset gcc ;
actions gcc-Link-action bind NEEDLIBS NEEDIMPS
{
libtool ... g++ ...
}
actions gcc-Cc-action
{
libtool ... gcc ...
}
actions gcc-C++-action
{
libtool ... g++ ...
}
actions updated together piecemeal gcc-Archive-action
{
libtool ... ar ...
}
===gcc-libtool-tools.jam===
Basically you would be creating a toolset that mostly behaves like the
current gcc toolset, the functionality of which you get from the
"extends-toolset" invocation above, but overriding the four commands
used to do whatever libtool requires you to do.
I'm not sure how much I can explain without knowing how much you are
willing to do, and learn, when it comes to Boost.Build. And for that
matter why you want to use libtool at all, given that you are using
Boost.Build.
--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
More information about the Cplusplus-sig
mailing list