How to include Boost in GNU Autotools project?
autotools, boost, c++, makefile
Solution
The Archive has `AX_BOOST_*`.
I switched to boost.m4 for some time, but it is so painfully slow I could edit a Makefile with the full Boost path by hand in vim before boost.m4 finished testing for the second library.
I went back to the Archive and was happy to learn the boost macros are being actively maintained again; then I proceeded to purge boost.m4 from every one of my projects.
Relevant excerpts from a use case (assuming the ax_boost_*.m4 files are in subdir m4):
./bootstrap
aclocal -I m4 --install
...
./configure.ac
...
AC_CONFIG_MACRO_DIR([m4])
...
AX_BOOST_BASE([1.48],, [AC_MSG_ERROR([libfoo needs Boost, but it was not found in your system])])
AX_BOOST_SYSTEM
AX_BOOST_FILESYSTEM
...
./Makefile.am
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = bootstrap ...
SUBDIRS = ... src ...
...
./src/Makefile.am
AM_CPPFLAGS = \
... \
$(BOOST_CPPFLAGS) \
...
...
AM_LDFLAGS = ... \
$(BOOST_LDFLAGS)
...
lib_LTLIBRARIES = libFoo.la
...
libFoo_la_LIBADD = \
... \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_SYSTEM_LIB) \
...
Problem
My project compiles using GNU autotools (`aclocal && autoconf && ./configure && make`). I'd like to use Boost, and I'd like for other people to be able to compile it as well. - Should I put Boost in my project's dir, or rely on the system's Boost? - How should I tell autotools to use Boost? I've Googled and found many m4 files that claim to do this - but where should I put those m4 files? I can stash one in my `/usr/share/aclocal` dir, but that doesn't help someone else who wants to compile the project using `./configure && make`.