Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-06-25 05:41:32

Mathew Robertson wrote:
> > > To allow the autoconf tools (ie configure) to detect the presence of
>the various Boost libs and header file versions, would it be possible to
>add a C-linkage function to each libraries' source file(s). This would
>allow users to add a configure check which detects if a particular library
>instance is installed. For example, we add the following code to each
>library instance:
> > >
> > > extern "C" boost_autoconf() {}
> > >
> > > This allows autoconf users to add a test to their script:
> > >
> > > AC_CHECK_LIB(boost_regex,boost_autoconf,...,[Boost::Regex library
>not found])
> >
> > I don't see why you need a function with C linkage for this to work.
> > The behavior of autoconf depends on the current language specified
> > in at the point where you call AC_CHECK_LIB. If that
> > is C++, you should well be able to test for functions with C++ linkage.
> > See
>Yeah - thats what I'm trying to do. Specifically, I'm trying to detect if
>"libboost_regex..." is installed, so I have the following:
>AC_CHECK_LIB(boost_regex-gcc,<somefunc>,,AC_ERROR([Must have the
>Boost::Regex library installed])
>Now the problem is, 'What do I put in for <somefunc>?' All other C++
>libraries I have used, specifically contain a C-linkage function to allow
>configure to detect it.

I am not familiar with the autoconf tool, but is it possible to have
something like this:

// include_test.cpp
#include <boost/regex.hpp>

int main()
   // simple regex use here
   return( 0 );

That way, you'd get a compile error if regex.hpp is not found (Boost is not
on the system) or a link error if the library is not available (library
hasn't been built or configured).

I am not sure how this translates to autoconf: have you had a look to see
how GCC checks for stdio.h, etc.?


Express yourself with cool new emoticons

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