Changeset 2326


Ignore:
Timestamp:
Sep 26, 2010, 4:27:32 PM (11 years ago)
Author:
Peter
Message:

update boost m4 macro, which now uses action-if-found/action-if-not-found interface, so changed configure.ac reflecting this change.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r2309 r2326  
    196196boost_version=1.35
    197197AC_SUBST(boost_version)
    198 AX_BOOST_BASE(["$boost_version"])
    199 boost_version_check=$succeeded;
     198AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
    200199YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
    201200
     
    325324if test "x$want_boost" = "xyes"; then
    326325# Too old Boost is fatal -- sub-sequent compilation will fail.
    327 if test "${boost_version_check}" != "yes" ; then
     326if test "${boost_ok}" != "yes" ; then
    328327  all_reqs_ok="false"
    329328  AC_MSG_WARN([
    330   Boost found but not the required version. Please install
    331   Boost version ${boost_version} or later])
     329  Boost ${boost_version} (or newer) not found. Please make sure Boost
     330  is installed.])
    332331fi
    333332fi
  • trunk/m4/ax_boost_base.m4

    r2202 r2326  
    11# ===========================================================================
    2 #             http://autoconf-archive.cryp.to/ax_boost_base.html
     2#       http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
    33# ===========================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_BOOST_BASE([MINIMUM-VERSION])
     7#   AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    88#
    99# DESCRIPTION
     
    2424#     HAVE_BOOST
    2525#
    26 # LAST MODIFICATION
    27 #
    28 #   2008-04-12
    29 #
    30 # COPYLEFT
     26# LICENSE
    3127#
    3228#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
     29#   Copyright (c) 2009 Peter Adolphs
    3330#
    3431#   Copying and distribution of this file, with or without modification, are
    3532#   permitted in any medium without royalty provided the copyright notice
    36 #   and this notice are preserved.
     33#   and this notice are preserved. This file is offered as-is, without any
     34#   warranty.
     35
     36#serial 17
    3737
    3838AC_DEFUN([AX_BOOST_BASE],
    3939[
    4040AC_ARG_WITH([boost],
    41   AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
    42   [
     41  [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
     42    [use Boost library from a standard location (ARG=yes),
     43     from the specified location (ARG=<path>),
     44     or disable it (ARG=no)
     45     @<:@ARG=yes@:>@ ])],
     46    [
    4347    if test "$withval" = "no"; then
    44     want_boost="no"
     48        want_boost="no"
    4549    elif test "$withval" = "yes"; then
    4650        want_boost="yes"
    4751        ac_boost_path=""
    4852    else
    49       want_boost="yes"
     53        want_boost="yes"
    5054        ac_boost_path="$withval"
    51   fi
     55    fi
    5256    ],
    5357    [want_boost="yes"])
     
    5862        [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
    5963        [
    60         if test -d $withval
     64        if test -d "$withval"
    6165        then
    6266                ac_boost_lib_path="$withval"
     
    6973
    7074if test "x$want_boost" = "xyes"; then
    71   boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
    72   boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
    73   boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
    74   boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
    75   boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
    76   if test "x$boost_lib_version_req_sub_minor" = "x" ; then
    77     boost_lib_version_req_sub_minor="0"
    78       fi
    79   WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
    80   AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
    81   succeeded=no
    82 
    83   dnl first we check the system location for boost libraries
    84   dnl this location ist chosen if boost libraries are installed with the --layout=system option
    85   dnl or if you install boost with RPM
    86   if test "$ac_boost_path" != ""; then
    87     BOOST_LDFLAGS="-L$ac_boost_path/lib"
    88     BOOST_CPPFLAGS="-I$ac_boost_path/include"
    89   else
    90     for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
    91       if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
    92         BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
    93         BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
    94         break;
    95       fi
    96     done
    97   fi
     75    boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
     76    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
     77    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
     78    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
     79    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
     80    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
     81        boost_lib_version_req_sub_minor="0"
     82        fi
     83    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
     84    AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
     85    succeeded=no
     86
     87    dnl On x86_64 systems check for system libraries in both lib64 and lib.
     88    dnl The former is specified by FHS, but e.g. Debian does not adhere to
     89    dnl this (as it rises problems for generic multi-arch support).
     90    dnl The last entry in the list is chosen by default when no libraries
     91    dnl are found, e.g. when only header-only libraries are installed!
     92    libsubdirs="lib"
     93    if test `uname -m` = x86_64; then
     94        libsubdirs="lib64 lib lib64"
     95    fi
     96
     97    dnl first we check the system location for boost libraries
     98    dnl this location ist chosen if boost libraries are installed with the --layout=system option
     99    dnl or if you install boost with RPM
     100    if test "$ac_boost_path" != ""; then
     101        BOOST_LDFLAGS="-L$ac_boost_path/$libsubdir"
     102        BOOST_CPPFLAGS="-I$ac_boost_path/include"
     103    elif test "$cross_compiling" != yes; then
     104        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
     105            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
     106                for libsubdir in $libsubdirs ; do
     107                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     108                done
     109                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
     110                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
     111                break;
     112            fi
     113        done
     114    fi
    98115
    99116    dnl overwrite ld flags if we have required special directory with
     
    103120    fi
    104121
    105   CPPFLAGS_SAVED="$CPPFLAGS"
    106   CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
    107   export CPPFLAGS
    108 
    109   LDFLAGS_SAVED="$LDFLAGS"
    110   LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
    111   export LDFLAGS
    112 
    113   AC_LANG_PUSH(C++)
    114       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    115   @%:@include <boost/version.hpp>
    116   ]], [[
    117   #if BOOST_VERSION >= $WANT_BOOST_VERSION
    118   // Everything is okay
    119   #else
    120   #  error Boost version is too old
    121   #endif
    122   ]])],[
     122    CPPFLAGS_SAVED="$CPPFLAGS"
     123    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
     124    export CPPFLAGS
     125
     126    LDFLAGS_SAVED="$LDFLAGS"
     127    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
     128    export LDFLAGS
     129
     130    AC_REQUIRE([AC_PROG_CXX])
     131    AC_LANG_PUSH(C++)
     132        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
     133    @%:@include <boost/version.hpp>
     134    ]], [[
     135    #if BOOST_VERSION >= $WANT_BOOST_VERSION
     136    // Everything is okay
     137    #else
     138    #  error Boost version is too old
     139    #endif
     140    ]])],[
    123141        AC_MSG_RESULT(yes)
    124   succeeded=yes
    125   found_system=yes
    126         ],[
    127         ])
    128   AC_LANG_POP([C++])
    129 
    130 
    131 
    132   dnl if we found no boost with system layout we search for boost libraries
    133   dnl built and installed without the --layout=system option or for a staged(not installed) version
    134   if test "x$succeeded" != "xyes"; then
    135     _version=0
    136     if test "$ac_boost_path" != ""; then
    137       if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
    138         for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
    139           _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
    140           V_CHECK=`expr $_version_tmp \> $_version`
    141           if test "$V_CHECK" = "1" ; then
    142             _version=$_version_tmp
    143           fi
    144           VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
    145           BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
    146         done
    147       fi
    148     else
    149       for ac_boost_path in /usr /usr/local /opt /opt/local ; do
    150         if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
    151           for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
    152             _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
    153             V_CHECK=`expr $_version_tmp \> $_version`
    154             if test "$V_CHECK" = "1" ; then
    155               _version=$_version_tmp
    156                           best_path=$ac_boost_path
    157             fi
    158           done
    159         fi
    160       done
    161 
    162       VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
    163       BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
    164             if test "$ac_boost_lib_path" = ""
    165             then
    166                BOOST_LDFLAGS="-L$best_path/lib"
    167             fi
    168 
    169           if test "x$BOOST_ROOT" != "x"; then
    170         if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
    171           version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
    172           stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
    173                 stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
    174           V_CHECK=`expr $stage_version_shorten \>\= $_version`
     142    succeeded=yes
     143    found_system=yes
     144        ],[
     145        ])
     146    AC_LANG_POP([C++])
     147
     148
     149
     150    dnl if we found no boost with system layout we search for boost libraries
     151    dnl built and installed without the --layout=system option or for a staged(not installed) version
     152    if test "x$succeeded" != "xyes"; then
     153        _version=0
     154        if test "$ac_boost_path" != ""; then
     155            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
     156                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
     157                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
     158                    V_CHECK=`expr $_version_tmp \> $_version`
     159                    if test "$V_CHECK" = "1" ; then
     160                        _version=$_version_tmp
     161                    fi
     162                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
     163                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
     164                done
     165            fi
     166        else
     167            if test "$cross_compiling" != yes; then
     168                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
     169                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
     170                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
     171                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
     172                            V_CHECK=`expr $_version_tmp \> $_version`
     173                            if test "$V_CHECK" = "1" ; then
     174                                _version=$_version_tmp
     175                                best_path=$ac_boost_path
     176                            fi
     177                        done
     178                    fi
     179                done
     180
     181                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
     182                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
     183                if test "$ac_boost_lib_path" = ""; then
     184                    for libsubdir in $libsubdirs ; do
     185                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     186                    done
     187                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
     188                fi
     189            fi
     190
     191            if test "x$BOOST_ROOT" != "x"; then
     192                for libsubdir in $libsubdirs ; do
     193                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     194                done
     195                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
     196                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
     197                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
     198                        stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
     199                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
    175200                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
    176             AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
    177             BOOST_CPPFLAGS="-I$BOOST_ROOT"
    178             BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
    179           fi
    180         fi
    181           fi
    182     fi
    183 
    184     CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
    185     export CPPFLAGS
    186     LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
    187     export LDFLAGS
    188 
    189     AC_LANG_PUSH(C++)
    190         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    191     @%:@include <boost/version.hpp>
    192     ]], [[
    193     #if BOOST_VERSION >= $WANT_BOOST_VERSION
    194     // Everything is okay
    195     #else
    196     #  error Boost version is too old
    197     #endif
    198     ]])],[
    199           AC_MSG_RESULT(yes)
    200     succeeded=yes
    201     found_system=yes
    202           ],[
    203           ])
    204     AC_LANG_POP([C++])
    205   fi
    206 
    207   if test "$succeeded" != "yes" ; then
    208     if test "$_version" = "0" ; then
    209       AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
    210     else
    211       AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
    212     fi
    213   else
    214     AC_SUBST(BOOST_CPPFLAGS)
    215     AC_SUBST(BOOST_LDFLAGS)
    216     AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
    217   fi
    218 
    219         CPPFLAGS="$CPPFLAGS_SAVED"
    220         LDFLAGS="$LDFLAGS_SAVED"
     201                        AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
     202                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
     203                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
     204                    fi
     205                fi
     206            fi
     207        fi
     208
     209        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
     210        export CPPFLAGS
     211        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
     212        export LDFLAGS
     213
     214        AC_LANG_PUSH(C++)
     215            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
     216        @%:@include <boost/version.hpp>
     217        ]], [[
     218        #if BOOST_VERSION >= $WANT_BOOST_VERSION
     219        // Everything is okay
     220        #else
     221        #  error Boost version is too old
     222        #endif
     223        ]])],[
     224            AC_MSG_RESULT(yes)
     225        succeeded=yes
     226        found_system=yes
     227            ],[
     228            ])
     229        AC_LANG_POP([C++])
     230    fi
     231
     232    if test "$succeeded" != "yes" ; then
     233        if test "$_version" = "0" ; then
     234            AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
     235        else
     236            AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
     237        fi
     238        # execute ACTION-IF-NOT-FOUND (if present):
     239        ifelse([$3], , :, [$3])
     240    else
     241        AC_SUBST(BOOST_CPPFLAGS)
     242        AC_SUBST(BOOST_LDFLAGS)
     243        AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
     244        # execute ACTION-IF-FOUND (if present):
     245        ifelse([$2], , :, [$2])
     246    fi
     247
     248    CPPFLAGS="$CPPFLAGS_SAVED"
     249    LDFLAGS="$LDFLAGS_SAVED"
    221250fi
    222251
Note: See TracChangeset for help on using the changeset viewer.