Boost logo

Boost :

Subject: Re: [boost] Use of third-party libraries
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-07-24 03:42:27

On Thu, Jul 24, 2014 at 11:11 AM, Michael Shepanski <mps_at_[hidden]> wrote:
> On 23/07/2014 9:31 PM, Andrey Semashev wrote:
>> The library build scripts should perform auto-detection checks at
>> build time. I have something like this in Boost.Log, although I test
>> whether the compiler supports SSE/AVX and whether Message Compiler is
>> available. But the approach should be similar - you attempt to compile
>> a test application and set up build macros or select the actual
>> sources to build from.
> So let's say I'm trying to decide whether libpq is installed. Your
> suggestion is that I "attempt to compile a test application". So I would
> have to tell the compiler the location of libpq's incude directory (and if I
> attempt to link then I have to tell the linker the location of the libpq
> binary). Now, at the moment, the only way I know these locations is from the
> constants "libpq_include_dir" and "libpq_lib_dir", defined in
> user-config.jam (see
> So I might
> as well test those constants directly, no? Or should I be determining the
> "installed" locations of those things by some other means?
> I'm thinking that the only auto-detection I need is inspection of bjam
> constants.

Having constants so that the user is able to specify the paths
manually (either in user-config.jam or bjam command line) is required.
However, on Linux (and on other UNIX-like systems as well) there are
standard locations for headers and libs which need not be specified in
the compiler command line. So if libpq is installed but the bjam
constants are not set you might still be able to compile your backend.
In order to check that you'll have to attempt to compile a test
application. Then there is pkgconfig, which can be used to obtain
these paths automatically. It is quite common in Linux and probably
other UNIX-like systems, although I'm not sure. Of course, how far you
are willing to go in inspecting the environment is up to you.

There is another aspect that may require test applications. I don't
know if that's your case but you may have requirements on specific
versions or features of the third party libraries. You can use test
applications to verify that the third party library fulfills your

Boost list run by bdawes at, gregod at, cpdaniel at, john at