Changeset 6147

Show
Ignore:
Timestamp:
2008-04-13 14:37:10 (3 months ago)
Author:
emostar
Message:

Require boost 1.33.1 or greater to be present.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/admin/acinclude.m4.in

    r4728 r6147  
    9797dnl Check if it is possible to turn off exceptions/rtti support 
    9898AC_DEFUN([LICQ_CXX_FLAGS], 
    99 [AC_CACHE_CHECK(whether ${CXX-g++} accepts -fno-rtti -fno-exceptions -fno-check-new, licq_prog_cxx_fno_exceptions, 
    100 [echo 'void f(){}' > conftest.cc 
    101 if test -z "`${CXX-g++} -fno-rtti -fno-exceptions -fno-check-new -c conftest.cc 2>&1`"; then 
    102   licq_prog_cxx_fno_exceptions=yes 
    103 else 
    104   licq_prog_cxx_fno_exceptions=no 
    105 fi 
    106 rm -f conftest* 
    107 ]) 
    108  
    109 if test "$licq_prog_cxx_fno_exceptions" = "yes"; then 
    110   CXXFLAGS="${CXXFLAGS} -fno-rtti -fno-exceptions -fno-check-new" 
    111 fi 
    112  
     99
    113100  AC_ARG_ENABLE(debug, 
    114101    [  --enable-debug          creates debugging code], 
     
    127114dnl Check if it is possible to turn off exceptions support 
    128115AC_DEFUN([LICQDAEMON_CXX_FLAGS], 
    129 [AC_CACHE_CHECK(whether ${CXX-g++} accepts -fno-exceptions -fno-check-new, licqdaemon_prog_cxx_fno_exceptions, 
    130 [echo 'void f(){}' > conftest.cc 
    131 if test -z "`${CXX-g++} -fno-exceptions -fno-check-new -c conftest.cc 2>&1`"; then 
    132   licqdaemon_prog_cxx_fno_exceptions=yes 
    133 else 
    134   licqdaemon_prog_cxx_fno_exceptions=no 
    135 fi 
    136 rm -f conftest* 
    137 ]) 
    138  
    139 if test "$licqdaemon_prog_cxx_fno_exceptions" = "yes"; then 
    140   CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-check-new" 
    141 fi 
    142  
     116
    143117  AC_ARG_ENABLE(debug, 
    144118    [  --enable-debug          creates debugging code], 
    145     [ licqdaemon_use_debug="$enableval"], [licqdaemon_use_debug="no"]) 
    146  
     119    [ licqdaemon_use_debug="$enableval"], [licqdaemon_use_debug="no"])  
    147120if test "$licqdaemon_use_debug" = "no"; then 
    148121  CXXFLAGS="`echo $CXXFLAGS | sed 's/-g[[^ ]]*//'`" 
     
    362335]) 
    363336 
     337dnl @synopsis AX_BOOST([MINIMUM-VERSION]) 
     338dnl 
     339dnl Test for the Boost C++ libraries of a particular version (or newer) 
     340dnl 
     341dnl If no path to the installed boost library is given the macro 
     342dnl searchs under /usr, /usr/local, and /opt, and evaluates the 
     343dnl $BOOST_ROOT environment variable. Further documentation is 
     344dnl available at <http://randspringer.de/boost/index.html>. 
     345dnl 
     346dnl This macro calls: 
     347dnl 
     348dnl   AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) 
     349dnl 
     350dnl And sets: 
     351dnl 
     352dnl   HAVE_BOOST 
     353dnl 
     354dnl @category InstalledPackages 
     355dnl @category Cxx 
     356dnl @author Thomas Porschberg <thomas@randspringer.de> 
     357dnl @version 2006-06-15 
     358dnl @license AllPermissive 
     359AC_DEFUN([AX_BOOST_BASE], 
     360[ 
     361AC_ARG_WITH([boost], 
     362  AS_HELP_STRING([--with-boost-dir@<:@=DIR@:>@], [specify boost directory (optional)]), 
     363  [ 
     364    if test "$withval" = "yes"; then 
     365        ac_boost_path="" 
     366    else 
     367        ac_boost_path="$withval" 
     368    fi 
     369  ]) 
     370 
     371  boost_lib_version_req=ifelse([$1], ,1.31.0,$1) 
     372  boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` 
     373  boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` 
     374  boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` 
     375  boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` 
     376  if test "x$boost_lib_version_req_sub_minor" = "x" ; then 
     377    boost_lib_version_req_sub_minor="0" 
     378  fi 
     379  WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` 
     380  AC_MSG_CHECKING(for Boost >= $boost_lib_version_req) 
     381  succeeded=no 
     382 
     383  dnl first we check the system location for boost libraries 
     384  dnl this location ist chosen if boost libraries are installed with the --layout=system option 
     385  dnl or if you install boost with RPM 
     386  if test "$ac_boost_path" != ""; then 
     387    BOOST_LDFLAGS="-L$ac_boost_path/lib" 
     388    BOOST_CPPFLAGS="-I$ac_boost_path/include" 
     389  else 
     390    for ac_boost_path_tmp in /usr /usr/local /opt ; do 
     391      if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then 
     392        BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" 
     393        BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" 
     394        break; 
     395      fi 
     396    done 
     397  fi 
     398 
     399  CPPFLAGS_SAVED="$CPPFLAGS" 
     400  CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 
     401  export CPPFLAGS 
     402 
     403  LDFLAGS_SAVED="$LDFLAGS" 
     404  LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 
     405  export LDFLAGS 
     406 
     407  AC_LANG_PUSH(C++) 
     408  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 
     409  @%:@include <boost/version.hpp> 
     410  ]], [[ 
     411  #if BOOST_VERSION >= $WANT_BOOST_VERSION 
     412  // Everything is okay 
     413  #else 
     414  #  error Boost version is too old 
     415  #endif 
     416  ]])],[ 
     417  AC_MSG_RESULT(yes) 
     418  succeeded=yes 
     419  found_system=yes 
     420  ],[ 
     421  ]) 
     422  AC_LANG_POP([C++]) 
     423 
     424  dnl if we found no boost with system layout we search for boost libraries 
     425  dnl built and installed without the --layout=system option or for a staged(not installed) version 
     426  if test "x$succeeded" != "xyes"; then 
     427    _version=0 
     428    if test "$ac_boost_path" != ""; then 
     429      BOOST_LDFLAGS="-L$ac_boost_path/lib" 
     430      if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then 
     431        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do 
     432          _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` 
     433          V_CHECK=`expr $_version_tmp \> $_version` 
     434          if test "$V_CHECK" = "1" ; then 
     435            _version=$_version_tmp 
     436          fi 
     437          VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` 
     438          BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" 
     439        done 
     440      fi 
     441    else 
     442      for ac_boost_path in /usr /usr/local /opt ; do 
     443        if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then 
     444          for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do 
     445            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` 
     446            V_CHECK=`expr $_version_tmp \> $_version` 
     447            if test "$V_CHECK" = "1" ; then 
     448              _version=$_version_tmp 
     449              best_path=$ac_boost_path 
     450            fi 
     451          done 
     452        fi 
     453      done 
     454 
     455      VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` 
     456      BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" 
     457      BOOST_LDFLAGS="-L$best_path/lib" 
     458 
     459      if test "x$BOOST_ROOT" != "x"; then 
     460        if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then 
     461          version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` 
     462          stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` 
     463          stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` 
     464          V_CHECK=`expr $stage_version_shorten \>\= $_version` 
     465          if test "$V_CHECK" = "1" ; then 
     466            AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) 
     467            BOOST_CPPFLAGS="-I$BOOST_ROOT" 
     468            BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" 
     469          fi 
     470        fi 
     471      fi 
     472    fi 
     473 
     474    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 
     475    export CPPFLAGS 
     476    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 
     477    export LDFLAGS 
     478 
     479    AC_LANG_PUSH(C++) 
     480    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 
     481    @%:@include <boost/version.hpp> 
     482    ]], [[ 
     483    #if BOOST_VERSION >= $WANT_BOOST_VERSION 
     484    // Everything is okay 
     485    #else 
     486    #  error Boost version is too old 
     487    #endif 
     488    ]])],[ 
     489    AC_MSG_RESULT(yes) 
     490    succeeded=yes 
     491    found_system=yes 
     492    ],[ 
     493    ]) 
     494    AC_LANG_POP([C++]) 
     495  fi 
     496 
     497  if test "$succeeded" != "yes" ; then 
     498    if test "$_version" = "0" ; then 
     499      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.]]) 
     500    else 
     501      AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) 
     502    fi 
     503  else 
     504    AC_SUBST(BOOST_CPPFLAGS) 
     505    AC_SUBST(BOOST_LDFLAGS) 
     506    AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) 
     507  fi 
     508 
     509  CPPFLAGS="$CPPFLAGS_SAVED" 
     510  LDFLAGS="$LDFLAGS_SAVED" 
     511]) 
     512 
  • trunk/licq/configure.ac

    r5620 r6147  
    165165LICQ_CHECK_GPGME 
    166166LICQ_CHECK_OPENSSL 
     167AX_BOOST_BASE([1.33.1]) 
    167168 
    168169dnl Switch to C++ mode and check for needed C++ headers