I am an autotools newb and I have difficulties figuring out howto easily link a specific library into one of the configured targets.
I have a source package that I want to build the usual way: ./configure && make && make install
Unfortunately one of the cpps has a missing reference to another library. Compiling it by hand (adjusting the commandline) works. But I would rather "patch" the compile script. Where is the standard place to edit linking references?
undefined reference to `boost::system::get_system_category()
That is my error message btw.
Use
ax_cxx_check_lib.m4
because boost_system does not have any extern "C" symbols (unmangled names) that can be checked withAC_CHECK_LIB
:http://ac-archive.sourceforge.net/guidod/ax_cxx_check_lib.m4
Download the file above and name it
acinclude.m4
, and put it in them4
folder in your project root.In
configure.ac
:In
Makefile.am
:You need to add the relevant
-l
flag toAM_LDFLAGS
inMakefile.am
; e.g.:Note that Boost libraries generally end in a suffix—a sequence of letters that indicates the build configuration. In the above example, the suffix is
-mt
. This could be different in your installation (though the-mt
variant is commonly available on POSIXy systems, IME).I do something like this:
BOOST_LIB_SUFFIX
is a precious variable (seeAC_ARG_VAR
) that defaults to-mt
.