There's an excellent boost.m4 macro that you can include in your project in the m4
subdirectory. These macros are located with AC_CONFIG_MACRO_DIR([m4])
in configure.ac
.
Add ACLOCAL_AMFLAGS = -I m4 --install
to the top-level Makefile.am
, used by automake
.
Here's why it's such a good macro:
BOOST_REQUIRE([1.54],[ACTION-IF-NOT-FOUND])
This will define BOOST_CPPFLAGS
which you can add to CPPFLAGS
, use in an AC_SUBST
, etc.
For individual Boost components, it's possible to specify debug builds, static builds, etc. But the (typically) multi-threaded, dynamic libraries are best, e.g.,
BOOST_FILESYSTEM([mt])
will define BOOST_FILESYSTEM_LIBS
and BOOST_FILESYSTEM_LDFLAGS
. As another bonus, if the library relies on, say, Boost.System, then these library dependencies are automatically added to the LIBS
, LDFLAGS
, etc.
You should just specify that a Boost installation is required rather than trying to distribute it. It's easily built and installed from source, or from precompiled packages. The former takes a long time, but it's best to have an 'optimized' build on the system. There's a lot of software that can make use of a (robust and optimized) Boost implementation.
Then use the BOOST_REQUIRE
error message if there's no acceptable version available.