Boost logo

Boost :

From: Thomas Porschberg (thomas.porschberg_at_[hidden])
Date: 2005-12-29 09:14:18


Thomas Porschberg <thomas.porschberg <at> osp-dd.de> writes:

> But I note that a lot of software components come with a
> m4 macro to support the configuration process.
> I found a boost.m4 file at http://alien.cern.ch/cache/org.glite/project/boost.
m4.

I discovered http://autoconf-archive.cryp.to/ which comes with
some m4 macros for boost too.
In the meanwhile I wrote a own m4 macro which does set
BOOST_LDFLAGS and BOOST_CPPFLAGS and checks a version number.
I call it with
AX_BOOST_LIB_VERSION(1.33)
in my configure.ac
I post it here and hope it is not considered as spam.
If someone has improvements please let me know. How
I already mentioned I'm a GNU-build-tool-greenhorn by
myself.

AC_DEFUN([AX_BOOST_LIB_VERSION], [
        BOOST_LIB_VERSION_REQ="$1"
        AC_MSG_CHECKING(for boostlib >= $BOOST_LIB_VERSION_REQ)
        succeeded=no

        AC_ARG_WITH(boost, [ --with-boost=DIR root directory for boost library ],
[
                if test "$withval" = "no"; then
                        AC_MSG_ERROR('You specified --with-boost=no.
                   Sorry we need boost. Please download from http://boost.org.')
                elif test "$withval" = "yes"; then
                        AC_MSG_WARN('You did not specify a directory for the --with-
boost option. We try /usr/local.')
                        ac_boost_path=/usr/local
                else
                        ac_boost_path="$withval"
                fi
        ],[ac_boost_path=/usr/local])

        _version=0
        if test "$ac_boost_path" != ""; then
                LDFLAGS="$LDFLAGS -L$ac_boost_path/lib"
                export LDFLAGS
                AC_SUBST(BOOST_LDFLAGS, [-L$ac_boost_path/lib])
                if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`;
do
                                _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed
's/\/include\/boost-//' | sed 's/_/./'`
                                V_CHECK=`expr $_version_tmp \> $_version`
                                if test "$V_CHECK" = "1" ; then
                                        _version=$_version_tmp
                                fi
                                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
                                BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-
$VERSION_UNDERSCORE"
                        done
                        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
                        export CPPFLAGS
                        AC_SUBST(BOOST_CPPFLAGS)
                fi
        fi

        VERSION_CHECK=`expr $BOOST_LIB_VERSION_REQ \<\= "$_version"`
        if test "$VERSION_CHECK" = "1" ; then
                succeeded=yes
        fi

        if test "$succeeded" = "yes" ; then
                AC_MSG_RESULT(yes (found version $_version))
        else
                AC_MSG_RESULT(no)
                if test "$_version" = "0" ; then
                        AC_MSG_ERROR('We did not find a directory include/boost-
<version>
                   under $ac_boost_path.
                   This means we could not detect the boost libraries.
                   Sorry we need boost. Please download from http://boost.org.')
                else
                        AC_MSG_ERROR('Your boost libraries seems to old (version
$_version).
                   We need at least $BOOST_LIB_VERSION_REQ')
                fi
        fi
        
])


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