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 configure.in 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 configure.ac at the point where you call AC_CHECK_LIB. If that
>language
> > is C++, you should well be able to test for functions with C++ linkage.
> > See
>http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_5.html#SEC43
>
>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 );
}
//--end

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.?

Regards,
Reece

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk