Boost logo

Boost :

From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2004-12-15 07:55:24


Hi Boosters,
I am using boost in several projects now, and some of these projects
will be released as open source. So they will have a configure script
that checks the compiling host, and which should report missing
libraries. I saw many open source projects adding boost to their source
code tree directly, thus these projects dont have to check the proper
boost versions, or library names.
  That solve the problem, but thats not a fine solution. To simplify
using boost libraries i would like to see boost supporting pkg-config
or a different maybe better approach which fits better to boost's needs.
But first I would like to explain how pkg-config works, and how
pkg-config makes using librariers simple.

The pkg-config package can be found here:
 http://pgk-config.freedesktop.org/wiki/Software_2fpkgconfig

It seems to work on all unix systems and windows. The pkg-config script
parses .pc files from several locations in the system, and allows
querrying the existance, version, compiler flags and linker flags of
installed libraries.

For example the gtkmm-2.0.pc file looks like that on suse systems:

prefix=/opt/gnome
exec_prefix=${prefix}
libdir=/opt/gnome/lib
includedir=${prefix}/include

Name: GTKmm
Description: C++ wrapper for GTK+
Requires: glibmm-2.0 gdkmm-2.0 pangomm-1.0 atkmm-1.0 gtk+-2.0
Version: 2.2.8
Libs: -L${libdir} -lgtkmm-2.0
Cflags: -I${includedir}/gtkmm-2.0 -I${libdir}/gtkmm-2.0/include

Thus when running 'pkg-config --libs gtkmm-2.0'
One gets the output:
-Wl,--export-dynamic -L/opt/gnome/lib -lgtkmm-2.0 -lgdkmm-2.0
-latkmm-1.0 -lgtk-x11-2.0 -lpangomm-1.0 -lglibmm-2.0 -lsigc-1.2
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0
-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

which can be used to link a gtkmm application to all libraries needed.

With the help of pkg-config can write simple makefiles, or build scripts
which execute pkg-config directly. But pkg-config also comes with a nice
m4 script to invoke it properly with autoconf.

PKG_CHECK_MODULES(GTKMM, gtkmm-2.0, ,[AC_MSG_ERROR("Gtkmm-2.0 missing")])

I am not sure how to provide transparent support for different toolsets,
and there is no way to specify further flags, like mt debug ...
So qt for example has adds two files qt.pc and qt-mt.pc. So maybe
pkg-config is not the right tool for boost. But at least for a large
amount of the gcc-boost users it would be fine.

Maybe boost could provide a similar facility for autotools. So maybe a
small "boost-config" that gets flags like toolset, debug-switch, a version
range descriptor, and then prints the compiler and/or linker flags. And
a small m4/shell script that makes invoking that tool even simpler.

Regards
Andreas Pokorny




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk