Changeset 9982
- Timestamp:
- Jul 15, 2011, 10:33:39 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
m4/boost.m4
r9981 r9982 1 1 # boost.m4: Locate Boost headers and libraries for autoconf-based projects. 2 # Copyright (C) 2007 Benoit Sigoure <tsuna@lrde.epita.fr>2 # Copyright (C) 2007, 2008, 2009, 2010, 2011 Benoit Sigoure <tsuna@lrde.epita.fr> 3 3 # 4 4 # This program is free software: you can redistribute it and/or modify … … 22 22 # along with this program. If not, see <http://www.gnu.org/licenses/>. 23 23 24 # serial 8 25 # Original sources can be found at http://repo.or.cz/w/boost.m4.git 24 m4_define([_BOOST_SERIAL], [m4_translit([ 25 # serial 16 26 ], [# 27 ], [])]) 28 29 # Original sources can be found at http://github.com/tsuna/boost.m4 26 30 # You can fetch the latest version of the script by doing: 27 # wget 'http://repo.or.cz/w/boost.m4.git?a=blob_plain;f=build-aux/boost.m4;hb=HEAD' -Oboost.m431 # wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 28 32 29 33 # ------ # … … 36 40 # define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to 37 41 # your configure so that users can specify non standard locations. 38 # For more README and documentation, go to http://repo.or.cz/w/boost.m4.git 42 # If the user's environment contains BOOST_ROOT and --with-boost was not 43 # specified, --with-boost=$BOOST_ROOT is implicitly used. 44 # For more README and documentation, go to http://github.com/tsuna/boost.m4 39 45 # Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry, 40 46 # simply read the README, it will show you what to do step by step. 41 47 42 m4_pattern_forbid([^_?BOOST_]) 43 44 # BOOST_REQUIRE([VERSION]) 45 # ------------------------ 48 m4_pattern_forbid([^_?(BOOST|Boost)_]) 49 50 51 # _BOOST_SED_CPP(SED-PROGRAM, PROGRAM, 52 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 53 # -------------------------------------------------------- 54 # Same as AC_EGREP_CPP, but leave the result in conftest.i. 55 # 56 # SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded 57 # in double-quotes, so escape your double quotes. 58 # 59 # It could be useful to turn this into a macro which extracts the 60 # value of any macro. 61 m4_define([_BOOST_SED_CPP], 62 [AC_LANG_PREPROC_REQUIRE()dnl 63 AC_REQUIRE([AC_PROG_SED])dnl 64 AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) 65 AS_IF([dnl eval is necessary to expand ac_cpp. 66 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. 67 dnl Beware of Windows end-of-lines, for instance if we are running 68 dnl some Windows programs under Wine. In that case, boost/version.hpp 69 dnl is certainly using "\r\n", but the regular Unix shell will only 70 dnl strip `\n' with backquotes, not the `\r'. This results in 71 dnl boost_cv_lib_version='1_37\r' for instance, which breaks 72 dnl everything else. 73 dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK 74 (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 75 tr -d '\r' | 76 $SED -n -e "$1" >conftest.i 2>&1], 77 [$3], 78 [$4]) 79 rm -rf conftest* 80 ])# AC_EGREP_CPP 81 82 83 84 # BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) 85 # ----------------------------------------------- 46 86 # Look for Boost. If version is given, it must either be a literal of the form 47 87 # "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a … … 49 89 # Defines the value BOOST_CPPFLAGS. This macro only checks for headers with 50 90 # the required version, it does not check for any of the Boost libraries. 51 # FIXME: Add a 2nd optional argument so that it's not fatal if Boost isn't found 52 # and add an AC_DEFINE to tell whether HAVE_BOOST. 91 # On # success, defines HAVE_BOOST. On failure, calls the optional 92 # ACTION-IF-NOT-FOUND action if one was supplied. 93 # Otherwise aborts with an error message. 53 94 AC_DEFUN([BOOST_REQUIRE], 54 [dnl First find out what kind of argument we have. 55 dnl If we have an empty argument, there is no constraint on the version of 56 dnl Boost to use. If it's a literal version number, we can split it in M4 (so 57 dnl the resulting configure script will be smaller/faster). Otherwise we do 58 dnl the splitting at runtime. 59 m4_bmatch([$1], 60 [^ *$], [m4_pushdef([BOOST_VERSION_REQ], [])dnl 61 boost_version_major=0 62 boost_version_minor=0 63 boost_version_subminor=0 64 ], 65 [^[0-9]+\([-._][0-9]+\)*$], 66 [m4_pushdef([BOOST_VERSION_REQ], [ version >= $1])dnl 67 boost_version_major=m4_bregexp([$1], [^\([0-9]+\)], [\1]) 68 boost_version_minor=m4_bregexp([$1], [^[0-9]+[-._]\([0-9]+\)], [\1]) 69 boost_version_subminor=m4_bregexp([$1], [^[0-9]+[-._][0-9]+[-._]\([0-9]+\)], [\1]) 70 ], 71 [^\$[a-zA-Z_]+$], 72 [m4_pushdef([BOOST_VERSION_REQ], [])dnl 73 boost_version_major=`expr "X$1" : 'X\([[^-._]]*\)'` 74 boost_version_minor=`expr "X$1" : 'X[[0-9]]*[[-._]]\([[^-._]]*\)'` 75 boost_version_subminor=`expr "X$1" : 'X[[0-9]]*[[-._]][[0-9]]*[[-._]]\([[0-9]]*\)'` 76 case $boost_version_major:$boost_version_minor in #( 77 *: | :* | *[[^0-9]]*:* | *:*[[^0-9]]*) 78 AC_MSG_ERROR([[Invalid argument for REQUIRE_BOOST: `$1']]) 79 ;; 80 esac 81 ], 82 [m4_fatal(Invalid argument: `$1')] 83 )dnl 95 [AC_REQUIRE([AC_PROG_CXX])dnl 96 AC_REQUIRE([AC_PROG_GREP])dnl 97 echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD 98 boost_save_IFS=$IFS 99 boost_version_req=$1 100 IFS=. 101 set x $boost_version_req 0 0 0 102 IFS=$boost_save_IFS 103 shift 104 boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` 105 boost_version_req_string=$[1].$[2].$[3] 84 106 AC_ARG_WITH([boost], 85 107 [AS_HELP_STRING([--with-boost=DIR], 86 [prefix of Boost]BOOST_VERSION_REQ[ @<:@guess@:>@])])dnl 108 [prefix of Boost $1 @<:@guess@:>@])])dnl 109 AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl 110 # If BOOST_ROOT is set and the user has not provided a value to 111 # --with-boost, then treat BOOST_ROOT as if it the user supplied it. 112 if test x"$BOOST_ROOT" != x; then 113 if test x"$with_boost" = x; then 114 AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) 115 with_boost=$BOOST_ROOT 116 else 117 AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) 118 fi 119 fi 87 120 AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], 88 ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"]) 89 AC_CACHE_CHECK([for Boost headers[]BOOST_VERSION_REQ], 121 ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl 122 boost_save_CPPFLAGS=$CPPFLAGS 123 AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string], 90 124 [boost_cv_inc_path], 91 125 [boost_cv_inc_path=no 92 126 AC_LANG_PUSH([C++])dnl 93 boost_subminor_chk= 94 test x"$boost_version_subminor" != x \ 95 && boost_subminor_chk="|| (B_V_MAJ == $boost_version_major \ 96 && B_V_MIN == $boost_version_minor \ 97 && B_V_SUB < $boost_version_subminor)" 98 for boost_dir in "$with_boost/include" '' \ 99 /opt/local/include /usr/local/include /opt/include /usr/include \ 100 "$with_boost" C:/Boost/include 127 m4_pattern_allow([^BOOST_VERSION$])dnl 128 AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp> 129 #if !defined BOOST_VERSION 130 # error BOOST_VERSION is not defined 131 #elif BOOST_VERSION < $boost_version_req 132 # error Boost headers version < $boost_version_req 133 #endif 134 ]])]) 135 # If the user provided a value to --with-boost, use it and only it. 136 case $with_boost in #( 137 ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ 138 /usr/include C:/Boost/include;; #( 139 *) set x "$with_boost/include" "$with_boost";; 140 esac 141 shift 142 for boost_dir 101 143 do 102 144 # Without --layout=system, Boost (or at least some versions) installs 103 145 # itself in <prefix>/include/boost-<version>. This inner loop helps to 104 146 # find headers in such directories. 147 # 148 # Any ${boost_dir}/boost-x_xx directories are searched in reverse version 149 # order followed by ${boost_dir}. The final '.' is a sentinel for 150 # searching $boost_dir" itself. Entries are whitespace separated. 151 # 105 152 # I didn't indent this loop on purpose (to avoid over-indented code) 106 for boost_inc in "$boost_dir" "$boost_dir"/boost-* 153 boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ 154 && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ 155 && echo .` 156 for boost_inc in $boost_layout_system_search_list 107 157 do 108 # $boost_inc can often be a symlink, so keep -e here. 109 test -e "$boost_inc" || continue 110 # Ensure that version.hpp exists: we're going to read it. Moreover, 111 # Boost could be reachable thanks to the default include path so we can 112 # mistakenly accept a wrong include path without this check. 113 test -e "$boost_inc/boost/version.hpp" || continue 114 boost_save_CPPFLAGS=$CPPFLAGS 115 test x"$boost_inc" != x && CPPFLAGS="$CPPFLAGS -I$boost_inc" 116 m4_pattern_allow([^BOOST_VERSION$])dnl 117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/version.hpp> 118 #ifndef BOOST_VERSION 119 # error BOOST_VERSION is not defined 120 #endif 121 #define B_V_MAJ (BOOST_VERSION / 100000) 122 #define B_V_MIN (BOOST_VERSION / 100 % 1000) 123 #define B_V_SUB (BOOST_VERSION % 100) 124 #if (B_V_MAJ < $boost_version_major) \ 125 || (B_V_MAJ == $boost_version_major \ 126 && B_V_MIN < $boost_version_minor) $boost_subminor_chk 127 # error Boost headers version < $1 128 #endif 129 ]])], [boost_cv_inc_path=yes], [boost_cv_version=no]) 130 CPPFLAGS=$boost_save_CPPFLAGS 158 if test x"$boost_inc" != x.; then 159 boost_inc="$boost_dir/$boost_inc" 160 else 161 boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list 162 fi 163 if test x"$boost_inc" != x; then 164 # We are going to check whether the version of Boost installed 165 # in $boost_inc is usable by running a compilation that 166 # #includes it. But if we pass a -I/some/path in which Boost 167 # is not installed, the compiler will just skip this -I and 168 # use other locations (either from CPPFLAGS, or from its list 169 # of system include directories). As a result we would use 170 # header installed on the machine instead of the /some/path 171 # specified by the user. So in that precise case (trying 172 # $boost_inc), make sure the version.hpp exists. 173 # 174 # Use test -e as there can be symlinks. 175 test -e "$boost_inc/boost/version.hpp" || continue 176 CPPFLAGS="$CPPFLAGS -I$boost_inc" 177 fi 178 AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) 131 179 if test x"$boost_cv_inc_path" = xyes; then 132 180 if test x"$boost_inc" != x; then … … 141 189 case $boost_cv_inc_path in #( 142 190 no) 143 AC_MSG_ERROR([Could not find Boost headers[]BOOST_VERSION_REQ]) 191 boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" 192 m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])], 193 [AC_MSG_NOTICE([$boost_errmsg])]) 194 $2 144 195 ;;#( 145 196 yes) … … 147 198 ;;#( 148 199 *) 149 BOOST_CPPFLAGS="-I$boost_cv_inc_path"200 AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl 150 201 ;; 151 202 esac 152 AC_SUBST([BOOST_CPPFLAGS])dnl 203 if test x"$boost_cv_inc_path" != xno; then 204 AC_DEFINE([HAVE_BOOST], [1], 205 [Defined if the requested minimum BOOST version is satisfied]) 153 206 AC_CACHE_CHECK([for Boost's header version], 154 207 [boost_cv_lib_version], 155 208 [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl 156 boost_cv_lib_version=unknown 157 boost_sed_version='/^.*BOOST_LIB_VERSION.*"\([[^"]]*\)".*$/!d;s//\1/' 158 boost_version_hpp="$boost_inc/boost/version.hpp" 159 test -e "$boost_version_hpp" \ 160 && boost_cv_lib_version=`sed "$boost_sed_version" "$boost_version_hpp"` 161 ]) 209 _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;q;}], 210 [#include <boost/version.hpp> 211 boost-lib-version = BOOST_LIB_VERSION], 212 [boost_cv_lib_version=`cat conftest.i`])]) 162 213 # e.g. "134" for 1_34_1 or "135" for 1_35 163 214 boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` 164 case $boost_major_version in 165 '' | *[[ ^0-9]]*)166 AC_MSG_ERROR([ Invalid value: boost_major_version=$boost_major_version])215 case $boost_major_version in #( 216 '' | *[[!0-9]]*) 217 AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version]) 167 218 ;; 168 219 esac 169 m4_popdef([BOOST_VERSION_REQ])dnl 220 fi 221 CPPFLAGS=$boost_save_CPPFLAGS 170 222 ])# BOOST_REQUIRE 171 223 224 # BOOST_STATIC() 225 # -------------- 226 # Add the "--enable-static-boost" configure argument. If this argument is given 227 # on the command line, static versions of the libraries will be looked up. 228 AC_DEFUN([BOOST_STATIC], 229 [AC_ARG_ENABLE([static-boost], 230 [AC_HELP_STRING([--enable-static-boost], 231 [Prefer the static boost libraries over the shared ones [no]])], 232 [enable_static_boost=yes], 233 [enable_static_boost=no])])# BOOST_STATIC 172 234 173 235 # BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) … … 177 239 # require linking (such as Boost.Foreach). 178 240 # 179 # Default ACTION-IF-NOT-FOUND: Fail with a fatal error. 241 # Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be 242 # found in the first place, in which case by default a notice is issued to the 243 # user. Presumably if we haven't died already it's because it's OK to not have 244 # Boost, which is why only a notice is issued instead of a hard error. 180 245 # 181 246 # Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in … … 184 249 AC_DEFUN([BOOST_FIND_HEADER], 185 250 [AC_REQUIRE([BOOST_REQUIRE])dnl 251 if test x"$boost_cv_inc_path" = xno; then 252 m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) 253 else 186 254 AC_LANG_PUSH([C++])dnl 187 255 boost_save_CPPFLAGS=$CPPFLAGS … … 193 261 CPPFLAGS=$boost_save_CPPFLAGS 194 262 AC_LANG_POP([C++])dnl 263 fi 195 264 ])# BOOST_FIND_HEADER 196 265 … … 218 287 # (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. 219 288 AC_DEFUN([BOOST_FIND_LIB], 220 [AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl 221 AC_REQUIRE([BOOST_REQUIRE])dnl 289 [AC_REQUIRE([BOOST_REQUIRE])dnl 290 AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl 291 AC_REQUIRE([BOOST_STATIC])dnl 222 292 AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl 293 if test x"$boost_cv_inc_path" = xno; then 294 AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) 295 else 296 dnl The else branch is huge and wasn't intended on purpose. 223 297 AC_LANG_PUSH([C++])dnl 224 298 AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl 225 299 AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl 300 AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl 226 301 AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl 227 302 BOOST_FIND_HEADER([$3]) … … 242 317 *) boost_mt=; boost_rtopt=$2;; 243 318 esac 319 if test $enable_static_boost = yes; then 320 boost_rtopt="s$boost_rtopt" 321 fi 244 322 # Find the proper debug variant depending on what we've been asked to find. 245 323 case $boost_rtopt in #( … … 278 356 AC_COMPILE_IFELSE([], 279 357 [ac_objext=do_not_rm_me_plz], 280 [AC_MSG_ERROR([ Cannot compile a test that uses Boost $1])])358 [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) 281 359 ac_objext=$boost_save_ac_objext 282 360 boost_failed_libs= … … 302 380 test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} 303 381 for boost_ldpath in "$boost_tmp_lib/lib" '' \ 304 /opt/local/lib /usr/local/lib /opt/lib /usr/lib\305 "$with_boost" C:/Boost/lib /lib /usr/lib64 /lib64382 /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ 383 "$with_boost" C:/Boost/lib /lib* 306 384 do 307 385 test -e "$boost_ldpath" || continue … … 326 404 LIBS=$boost_save_LIBS 327 405 if test x"$Boost_lib" = xyes; then 328 Boost_lib_LDFLAGS="-L$boost_ldpath -R$boost_ldpath" 406 Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath" 407 Boost_lib_LDPATH="$boost_ldpath" 329 408 break 6 330 409 else … … 340 419 ]) 341 420 case $Boost_lib in #( 342 no) AC_MSG_ERROR([Could not find the flags to link with Boost $1]) 421 no) _AC_MSG_LOG_CONFTEST 422 AC_MSG_ERROR([cannot find the flags to link with Boost $1]) 343 423 ;; 344 424 esac 345 AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS]) 346 AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS]) 425 AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl 426 AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl 427 AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl 428 AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl 347 429 CPPFLAGS=$boost_save_CPPFLAGS 348 430 AS_VAR_POPDEF([Boost_lib])dnl 349 431 AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl 432 AS_VAR_POPDEF([Boost_lib_LDPATH])dnl 350 433 AS_VAR_POPDEF([Boost_lib_LIBS])dnl 351 434 AC_LANG_POP([C++])dnl 435 fi 352 436 ])# BOOST_FIND_LIB 353 437 … … 361 445 # version of each library (among other things). 362 446 447 # BOOST_DEFUN(LIBRARY, CODE) 448 # -------------------------- 449 # Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE. 450 # 451 # Use indir to avoid the warning on underquoted macro name given to AC_DEFUN. 452 m4_define([BOOST_DEFUN], 453 [m4_indir([AC_DEFUN], 454 m4_toupper([BOOST_$1]), 455 [m4_pushdef([BOOST_Library], [$1])dnl 456 $2 457 m4_popdef([BOOST_Library])dnl 458 ]) 459 ]) 460 461 # BOOST_ARRAY() 462 # ------------- 463 # Look for Boost.Array 464 BOOST_DEFUN([Array], 465 [BOOST_FIND_HEADER([boost/array.hpp])]) 466 363 467 364 468 # BOOST_ASIO() 365 469 # ------------ 366 470 # Look for Boost.Asio (new in Boost 1.35). 367 AC_DEFUN([BOOST_ASIO],471 BOOST_DEFUN([Asio], 368 472 [AC_REQUIRE([BOOST_SYSTEM])dnl 369 473 BOOST_FIND_HEADER([boost/asio.hpp])]) … … 373 477 # ------------ 374 478 # Look for Boost.Bind 375 AC_DEFUN([BOOST_BIND],479 BOOST_DEFUN([Bind], 376 480 [BOOST_FIND_HEADER([boost/bind.hpp])]) 377 481 … … 380 484 # ------------------ 381 485 # Look for Boost.Conversion (cast / lexical_cast) 382 AC_DEFUN([BOOST_CONVERSION],486 BOOST_DEFUN([Conversion], 383 487 [BOOST_FIND_HEADER([boost/cast.hpp]) 384 488 BOOST_FIND_HEADER([boost/lexical_cast.hpp]) … … 390 494 # Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the 391 495 # documentation of BOOST_FIND_LIB above. 392 AC_DEFUN([BOOST_DATE_TIME],496 BOOST_DEFUN([Date_Time], 393 497 [BOOST_FIND_LIB([date_time], [$1], 394 498 [boost/date_time/posix_time/posix_time.hpp], … … 403 507 # Do not check for boost/filesystem.hpp because this file was introduced in 404 508 # 1.34. 405 AC_DEFUN([BOOST_FILESYSTEM],509 BOOST_DEFUN([Filesystem], 406 510 [# Do we have to check for Boost.System? This link-time dependency was 407 511 # added as of 1.35.0. If we have a version <1.35, we must not attempt to … … 417 521 BOOST_FIND_LIB([filesystem], [$1], 418 522 [boost/filesystem/path.hpp], [boost::filesystem::path p;]) 523 if test $enable_static_boost = yes && test $boost_major_version -ge 135; then 524 AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"]) 525 fi 419 526 LIBS=$boost_filesystem_save_LIBS 420 527 LDFLAGS=$boost_filesystem_save_LDFLAGS … … 425 532 # --------------- 426 533 # Look for Boost.Foreach 427 AC_DEFUN([BOOST_FOREACH],534 BOOST_DEFUN([Foreach], 428 535 [BOOST_FIND_HEADER([boost/foreach.hpp])]) 429 536 … … 436 543 # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' 437 544 # does not name a type 438 AC_DEFUN([BOOST_FORMAT],545 BOOST_DEFUN([Format], 439 546 [BOOST_FIND_HEADER([boost/format.hpp])]) 440 547 … … 443 550 # ---------------- 444 551 # Look for Boost.Function 445 AC_DEFUN([BOOST_FUNCTION],552 BOOST_DEFUN([Function], 446 553 [BOOST_FIND_HEADER([boost/function.hpp])]) 447 554 … … 451 558 # Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the 452 559 # documentation of BOOST_FIND_LIB above. 453 AC_DEFUN([BOOST_GRAPH],560 BOOST_DEFUN([Graph], 454 561 [BOOST_FIND_LIB([graph], [$1], 455 562 [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) … … 458 565 459 566 # BOOST_IOSTREAMS([PREFERRED-RT-OPT]) 460 # ------------------------------- 567 # ----------------------------------- 461 568 # Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the 462 569 # documentation of BOOST_FIND_LIB above. 463 AC_DEFUN([BOOST_IOSTREAMS],570 BOOST_DEFUN([IOStreams], 464 571 [BOOST_FIND_LIB([iostreams], [$1], 465 572 [boost/iostreams/device/file_descriptor.hpp], 466 [boost::iostreams::file_descriptor fd (0); fd.close();])573 [boost::iostreams::file_descriptor fd; fd.close();]) 467 574 ])# BOOST_IOSTREAMS 468 575 … … 471 578 # ------------ 472 579 # Look for Boost.Functional/Hash 473 AC_DEFUN([BOOST_HASH],580 BOOST_DEFUN([Hash], 474 581 [BOOST_FIND_HEADER([boost/functional/hash.hpp])]) 475 582 … … 478 585 # -------------- 479 586 # Look for Boost.Lambda 480 AC_DEFUN([BOOST_LAMBDA],587 BOOST_DEFUN([Lambda], 481 588 [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) 589 590 591 # BOOST_LOG([PREFERRED-RT-OPT]) 592 # ----------------------------- 593 # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the 594 # documentation of BOOST_FIND_LIB above. 595 BOOST_DEFUN([Log], 596 [BOOST_FIND_LIB([log], [$1], 597 [boost/log/core/core.hpp], 598 [boost::log::attribute a; a.get_value();]) 599 ])# BOOST_LOG 600 601 602 # BOOST_LOG_SETUP([PREFERRED-RT-OPT]) 603 # ----------------------------------- 604 # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the 605 # documentation of BOOST_FIND_LIB above. 606 BOOST_DEFUN([Log_Setup], 607 [AC_REQUIRE([BOOST_LOG])dnl 608 BOOST_FIND_LIB([log_setup], [$1], 609 [boost/log/utility/init/from_settings.hpp], 610 [boost::log::basic_settings<char> bs; bs.empty();]) 611 ])# BOOST_LOG_SETUP 612 613 614 # BOOST_MATH() 615 # ------------ 616 # Look for Boost.Math 617 # TODO: This library isn't header-only but it comes in multiple different 618 # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, 619 # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, 620 # libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the 621 # right thing anyway. 622 BOOST_DEFUN([Math], 623 [BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) 624 625 626 # BOOST_MULTIARRAY() 627 # ------------------ 628 # Look for Boost.MultiArray 629 BOOST_DEFUN([MultiArray], 630 [BOOST_FIND_HEADER([boost/multi_array.hpp])]) 631 632 633 # BOOST_NUMERIC_CONVERSION() 634 # -------------------------- 635 # Look for Boost.NumericConversion (policy-based numeric conversion) 636 BOOST_DEFUN([Numeric_Conversion], 637 [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) 638 ])# BOOST_NUMERIC_CONVERSION 639 640 641 # BOOST_OPTIONAL() 642 # ---------------- 643 # Look for Boost.Optional 644 BOOST_DEFUN([Optional], 645 [BOOST_FIND_HEADER([boost/optional.hpp])]) 482 646 483 647 … … 485 649 # -------------------- 486 650 # Look for Boost.Preprocessor 487 AC_DEFUN([BOOST_PREPROCESSOR],651 BOOST_DEFUN([Preprocessor], 488 652 [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) 653 654 655 # BOOST_UNORDERED() 656 # ----------------- 657 # Look for Boost.Unordered 658 BOOST_DEFUN([Unordered], 659 [BOOST_FIND_HEADER([boost/unordered_map.hpp])]) 660 661 662 # BOOST_UUID() 663 # ------------ 664 # Look for Boost.Uuid 665 BOOST_DEFUN([Uuid], 666 [BOOST_FIND_HEADER([boost/uuid/uuid.hpp])]) 489 667 490 668 491 669 # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) 492 670 # ----------------------------------------- 493 # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, see494 # the documentation of BOOST_FIND_LIB above.495 AC_DEFUN([BOOST_PROGRAM_OPTIONS],671 # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, 672 # see the documentation of BOOST_FIND_LIB above. 673 BOOST_DEFUN([Program_Options], 496 674 [BOOST_FIND_LIB([program_options], [$1], 497 675 [boost/program_options.hpp], … … 500 678 501 679 680 681 # _BOOST_PYTHON_CONFIG(VARIABLE, FLAG) 682 # ------------------------------------ 683 # Save VARIABLE, and define it via `python-config --FLAG`. 684 # Substitute BOOST_PYTHON_VARIABLE. 685 m4_define([_BOOST_PYTHON_CONFIG], 686 [AC_SUBST([BOOST_PYTHON_$1], 687 [`python-config --$2 2>/dev/null`])dnl 688 boost_python_save_$1=$$1 689 $1="$$1 $BOOST_PYTHON_$1"]) 690 691 692 # BOOST_PYTHON([PREFERRED-RT-OPT]) 693 # -------------------------------- 694 # Look for Boost.Python. For the documentation of PREFERRED-RT-OPT, 695 # see the documentation of BOOST_FIND_LIB above. 696 BOOST_DEFUN([Python], 697 [_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes]) 698 _BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags]) 699 _BOOST_PYTHON_CONFIG([LIBS], [libs]) 700 m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl 701 BOOST_FIND_LIB([python], [$1], 702 [boost/python.hpp], 703 [], [BOOST_PYTHON_MODULE(empty) {}]) 704 CPPFLAGS=$boost_python_save_CPPFLAGS 705 LDFLAGS=$boost_python_save_LDFLAGS 706 LIBS=$boost_python_save_LIBS 707 ])# BOOST_PYTHON 708 709 502 710 # BOOST_REF() 503 711 # ----------- 504 712 # Look for Boost.Ref 505 AC_DEFUN([BOOST_REF],713 BOOST_DEFUN([Ref], 506 714 [BOOST_FIND_HEADER([boost/ref.hpp])]) 507 715 … … 511 719 # Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the 512 720 # documentation of BOOST_FIND_LIB above. 513 AC_DEFUN([BOOST_REGEX],721 BOOST_DEFUN([Regex], 514 722 [BOOST_FIND_LIB([regex], [$1], 515 723 [boost/regex.hpp], … … 522 730 # Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see 523 731 # the documentation of BOOST_FIND_LIB above. 524 AC_DEFUN([BOOST_SERIALIZATION],732 BOOST_DEFUN([Serialization], 525 733 [BOOST_FIND_LIB([serialization], [$1], 526 734 [boost/archive/text_oarchive.hpp], … … 534 742 # Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the 535 743 # documentation of BOOST_FIND_LIB above. 536 AC_DEFUN([BOOST_SIGNALS],744 BOOST_DEFUN([Signals], 537 745 [BOOST_FIND_LIB([signals], [$1], 538 746 [boost/signal.hpp], … … 544 752 # ----------------- 545 753 # Look for Boost.SmartPtr 546 AC_DEFUN([BOOST_SMART_PTR],754 BOOST_DEFUN([Smart_Ptr], 547 755 [BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) 548 756 BOOST_FIND_HEADER([boost/shared_ptr.hpp]) … … 550 758 551 759 760 # BOOST_STATICASSERT() 761 # -------------------- 762 # Look for Boost.StaticAssert 763 BOOST_DEFUN([StaticAssert], 764 [BOOST_FIND_HEADER([boost/static_assert.hpp])]) 765 766 552 767 # BOOST_STRING_ALGO() 553 768 # ------------------- 554 769 # Look for Boost.StringAlgo 555 AC_DEFUN([BOOST_STRING_ALGO],770 BOOST_DEFUN([String_Algo], 556 771 [BOOST_FIND_HEADER([boost/algorithm/string.hpp]) 557 772 ]) … … 563 778 # documentation of BOOST_FIND_LIB above. This library was introduced in Boost 564 779 # 1.35.0. 565 AC_DEFUN([BOOST_SYSTEM],780 BOOST_DEFUN([System], 566 781 [BOOST_FIND_LIB([system], [$1], 567 782 [boost/system/error_code.hpp], … … 574 789 # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the 575 790 # documentation of BOOST_FIND_LIB above. 576 AC_DEFUN([BOOST_TEST],791 BOOST_DEFUN([Test], 577 792 [m4_pattern_allow([^BOOST_CHECK$])dnl 578 793 BOOST_FIND_LIB([unit_test_framework], [$1], … … 589 804 # documentation of BOOST_FIND_LIB above. 590 805 # FIXME: Provide an alias "BOOST_THREAD". 591 AC_DEFUN([BOOST_THREADS],806 BOOST_DEFUN([Threads], 592 807 [dnl Having the pthread flag is required at least on GCC3 where 593 808 dnl boost/thread.hpp would complain if we try to compile without … … 604 819 CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" 605 820 BOOST_FIND_LIB([thread], [$1], 606 821 [boost/thread.hpp], [boost::thread t; boost::mutex m;]) 607 822 BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag" 608 823 BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" … … 615 830 # ----------------- 616 831 # Look for Boost.Tokenizer 617 AC_DEFUN([BOOST_TOKENIZER],832 BOOST_DEFUN([Tokenizer], 618 833 [BOOST_FIND_HEADER([boost/tokenizer.hpp])]) 619 834 … … 622 837 # --------------- 623 838 # Look for Boost.Tribool 624 AC_DEFUN([BOOST_TRIBOOL],839 BOOST_DEFUN([Tribool], 625 840 [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) 626 841 BOOST_FIND_HEADER([boost/logic/tribool.hpp]) … … 631 846 # ------------- 632 847 # Look for Boost.Tuple 633 AC_DEFUN([BOOST_TUPLE],848 BOOST_DEFUN([Tuple], 634 849 [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) 850 851 852 # BOOST_TYPETRAITS() 853 # -------------------- 854 # Look for Boost.TypeTraits 855 BOOST_DEFUN([TypeTraits], 856 [BOOST_FIND_HEADER([boost/type_traits.hpp])]) 635 857 636 858 … … 639 861 # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, 640 862 # etc.) 641 AC_DEFUN([BOOST_UTILITY],863 BOOST_DEFUN([Utility], 642 864 [BOOST_FIND_HEADER([boost/utility.hpp])]) 643 865 … … 646 868 # --------------- 647 869 # Look for Boost.Variant. 648 AC_DEFUN([BOOST_VARIANT],870 BOOST_DEFUN([Variant], 649 871 [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) 650 872 BOOST_FIND_HEADER([boost/variant.hpp])]) … … 657 879 # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the 658 880 # documentation of BOOST_FIND_LIB above. 659 AC_DEFUN([BOOST_WAVE],881 BOOST_DEFUN([Wave], 660 882 [AC_REQUIRE([BOOST_FILESYSTEM])dnl 661 883 AC_REQUIRE([BOOST_DATE_TIME])dnl … … 678 900 # ----------------- 679 901 # Look for Boost.Xpressive (new since 1.36.0). 680 AC_DEFUN([BOOST_XPRESSIVE],902 BOOST_DEFUN([Xpressive], 681 903 [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) 682 904 … … 766 988 AC_DEFUN([_BOOST_FIND_COMPILER_TAG], 767 989 [AC_REQUIRE([AC_PROG_CXX])dnl 990 AC_REQUIRE([AC_CANONICAL_HOST])dnl 768 991 AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag], 769 [AC_LANG_PUSH([C++])dnl 770 boost_cv_lib_tag=unknown 992 [boost_cv_lib_tag=unknown 993 if test x$boost_cv_inc_path != xno; then 994 AC_LANG_PUSH([C++])dnl 771 995 # The following tests are mostly inspired by boost/config/auto_link.hpp 772 996 # The list is sorted to most recent/common to oldest compiler (in order … … 782 1006 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines 783 1007 # the same defines as GCC's). 784 # TODO: Move the test on GCC 4.4 up once it's released.785 1008 for i in \ 1009 _BOOST_gcc_test(4, 6) \ 1010 _BOOST_gcc_test(4, 5) \ 1011 _BOOST_gcc_test(4, 4) \ 786 1012 _BOOST_gcc_test(4, 3) \ 787 1013 _BOOST_gcc_test(4, 2) \ … … 793 1019 _BOOST_gcc_test(3, 4) \ 794 1020 _BOOST_gcc_test(3, 3) \ 795 "defined _MSC_VER && _MSC_VER >= 1400 @ vc80" \ 1021 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ 1022 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ 796 1023 _BOOST_gcc_test(3, 2) \ 797 1024 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ … … 802 1029 "defined __ICL @ iw" \ 803 1030 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ 804 _BOOST_gcc_test(4, 4) \805 1031 _BOOST_gcc_test(2, 95) \ 806 1032 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ … … 820 1046 done 821 1047 AC_LANG_POP([C++])dnl 822 ])823 1048 case $boost_cv_lib_tag in #( 824 1049 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed 825 1050 # to "gcc41" for instance. 1051 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. 826 1052 gcc*) 1053 boost_tag_x= 1054 case $host_os in #( 1055 darwin*) 1056 if test $boost_major_version -ge 136; then 1057 # The `x' added in r46793 of Boost. 1058 boost_tag_x=x 1059 fi;; 1060 esac 827 1061 # We can specify multiple tags in this variable because it's used by 828 1062 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... 829 boost_cv_lib_tag="$boost_ cv_lib_tag -gcc"1063 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" 830 1064 ;; #( 831 1065 unknown) … … 834 1068 ;; 835 1069 esac 1070 fi])dnl end of AC_CACHE_CHECK 836 1071 ])# _BOOST_FIND_COMPILER_TAG 837 1072 … … 859 1094 # you will try to link a conftest.o left behind by a previous test. 860 1095 # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this 861 # macro) 1096 # macro). 1097 # 1098 # Don't use "break" in the actions, as it would short-circuit some code 1099 # this macro runs after the actions. 862 1100 m4_define([_BOOST_AC_LINK_IFELSE], 863 1101 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl 864 1102 rm -f conftest$ac_exeext 865 boost_ ac_ext_save=$ac_ext1103 boost_save_ac_ext=$ac_ext 866 1104 boost_use_source=: 867 1105 # If we already have a .o, re-use it. We change $ac_ext so that $ac_link … … 882 1120 fi 883 1121 $3]) 1122 ac_objext=$boost_save_ac_objext 1123 ac_ext=$boost_save_ac_ext 884 1124 dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) 885 1125 dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), … … 888 1128 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl 889 1129 ])# _BOOST_AC_LINK_IFELSE 1130 1131 # Local Variables: 1132 # mode: autoconf 1133 # End:
Note:
See TracChangeset
for help on using the changeset viewer.