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 http://quince-lib.com/preparation/configuring_boost_build.html). 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?
You can also take a look at Boost.IOStreams which detect if bzip2 and zlib are available.
Its Jamfile.v2 says: # The biggest trick in this Jamfile is to link to zlib and bzip2 when # needed. To configure that, a number of variables are used, which must # be set by user with 'path-constant' either in Boost's root Jamfile, or # in user-config.jam.
Boost.Thread also contains some auto-detection checks, I think.
Its Jamfile.v2 says: # You need to provide the include path and lib path in the variables # PTW32_INCLUDE and PTW32_LIB respectively. You can specify these # paths in site-config.jam, user-config.jam or in the environment. I'm thinking that the only auto-detection I need is inspection of bjam constants. --- Michael