1# boost.m4: Locate Boost headers and libraries for autoconf-based projects. 2# Copyright (C) 2007-2011, 2014 Benoit Sigoure <tsuna@lrde.epita.fr> 3# 4# This program is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 3 of the License, or 7# (at your option) any later version. 8# 9# Additional permission under section 7 of the GNU General Public 10# License, version 3 ("GPLv3"): 11# 12# If you convey this file as part of a work that contains a 13# configuration script generated by Autoconf, you may do so under 14# terms of your choice. 15# 16# This program is distributed in the hope that it will be useful, 17# but WITHOUT ANY WARRANTY; without even the implied warranty of 18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19# GNU General Public License for more details. 20# 21# You should have received a copy of the GNU General Public License 22# along with this program. If not, see <http://www.gnu.org/licenses/>. 23 24m4_define([_BOOST_SERIAL], [m4_translit([ 25# serial 25 26], [# 27], [])]) 28 29# Original sources can be found at http://github.com/tsuna/boost.m4 30# You can fetch the latest version of the script by doing: 31# wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 32 33# ------ # 34# README # 35# ------ # 36 37# This file provides several macros to use the various Boost libraries. 38# The first macro is BOOST_REQUIRE. It will simply check if it's possible to 39# find the Boost headers of a given (optional) minimum version and it will 40# define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to 41# your configure so that users can specify non standard locations. 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 45# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry, 46# simply read the README, it will show you what to do step by step. 47 48m4_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. 61m4_define([_BOOST_SED_CPP], 62[AC_LANG_PUSH([C++])dnl 63AC_LANG_PREPROC_REQUIRE()dnl 64AC_REQUIRE([AC_PROG_SED])dnl 65AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) 66AS_IF([dnl eval is necessary to expand ac_cpp. 67dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. 68dnl Beware of Windows end-of-lines, for instance if we are running 69dnl some Windows programs under Wine. In that case, boost/version.hpp 70dnl is certainly using "\r\n", but the regular Unix shell will only 71dnl strip `\n' with backquotes, not the `\r'. This results in 72dnl boost_cv_lib_version='1_37\r' for instance, which breaks 73dnl everything else. 74dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK 75dnl 76dnl Beware that GCC 5, when expanding macros, may embed # line directives 77dnl a within single line: 78dnl 79dnl # 1 "conftest.cc" 80dnl # 1 "<built-in>" 81dnl # 1 "<command-line>" 82dnl # 1 "conftest.cc" 83dnl # 1 "/opt/local/include/boost/version.hpp" 1 3 84dnl # 2 "conftest.cc" 2 85dnl boost-lib-version = 86dnl # 2 "conftest.cc" 3 87dnl "1_56" 88dnl 89dnl So get rid of the # lines, and glue the remaining ones together. 90(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 91 grep -v '#' | 92 tr -d '\r' | 93 tr -s '\n' ' ' | 94 $SED -n -e "$1" >conftest.i 2>&1], 95 [$3], 96 [$4]) 97rm -rf conftest* 98AC_LANG_POP([C++])dnl 99])# _BOOST_SED_CPP 100 101 102 103# BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) 104# ----------------------------------------------- 105# Look for Boost. If version is given, it must either be a literal of the form 106# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a 107# variable "$var". 108# Defines the value BOOST_CPPFLAGS. This macro only checks for headers with 109# the required version, it does not check for any of the Boost libraries. 110# On # success, defines HAVE_BOOST. On failure, calls the optional 111# ACTION-IF-NOT-FOUND action if one was supplied. 112# Otherwise aborts with an error message. 113AC_DEFUN_ONCE([BOOST_REQUIRE], 114[AC_REQUIRE([AC_PROG_CXX])dnl 115AC_REQUIRE([AC_PROG_GREP])dnl 116echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD 117boost_save_IFS=$IFS 118boost_version_req=$1 119IFS=. 120set x $boost_version_req 0 0 0 121IFS=$boost_save_IFS 122shift 123boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` 124boost_version_req_string=$[1].$[2].$[3] 125AC_ARG_WITH([boost], 126 [AS_HELP_STRING([--with-boost=DIR], 127 [prefix of Boost $1 @<:@guess@:>@])])dnl 128AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl 129# If BOOST_ROOT is set and the user has not provided a value to 130# --with-boost, then treat BOOST_ROOT as if it the user supplied it. 131if test x"$BOOST_ROOT" != x; then 132 if test x"$with_boost" = x; then 133 AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) 134 with_boost=$BOOST_ROOT 135 else 136 AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) 137 fi 138fi 139AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], 140 ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl 141boost_save_CPPFLAGS=$CPPFLAGS 142 AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string], 143 [boost_cv_inc_path], 144 [boost_cv_inc_path=no 145AC_LANG_PUSH([C++])dnl 146m4_pattern_allow([^BOOST_VERSION$])dnl 147 AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp> 148#if !defined BOOST_VERSION 149# error BOOST_VERSION is not defined 150#elif BOOST_VERSION < $boost_version_req 151# error Boost headers version < $boost_version_req 152#endif 153]])]) 154 # If the user provided a value to --with-boost, use it and only it. 155 case $with_boost in #( 156 ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ 157 /usr/include C:/Boost/include;; #( 158 *) set x "$with_boost/include" "$with_boost";; 159 esac 160 shift 161 for boost_dir 162 do 163 # Without --layout=system, Boost (or at least some versions) installs 164 # itself in <prefix>/include/boost-<version>. This inner loop helps to 165 # find headers in such directories. 166 # 167 # Any ${boost_dir}/boost-x_xx directories are searched in reverse version 168 # order followed by ${boost_dir}. The final '.' is a sentinel for 169 # searching $boost_dir" itself. Entries are whitespace separated. 170 # 171 # I didn't indent this loop on purpose (to avoid over-indented code) 172 boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ 173 && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ 174 && echo .` 175 for boost_inc in $boost_layout_system_search_list 176 do 177 if test x"$boost_inc" != x.; then 178 boost_inc="$boost_dir/$boost_inc" 179 else 180 boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list 181 fi 182 if test x"$boost_inc" != x; then 183 # We are going to check whether the version of Boost installed 184 # in $boost_inc is usable by running a compilation that 185 # #includes it. But if we pass a -I/some/path in which Boost 186 # is not installed, the compiler will just skip this -I and 187 # use other locations (either from CPPFLAGS, or from its list 188 # of system include directories). As a result we would use 189 # header installed on the machine instead of the /some/path 190 # specified by the user. So in that precise case (trying 191 # $boost_inc), make sure the version.hpp exists. 192 # 193 # Use test -e as there can be symlinks. 194 test -e "$boost_inc/boost/version.hpp" || continue 195 CPPFLAGS="$CPPFLAGS -I$boost_inc" 196 fi 197 AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) 198 if test x"$boost_cv_inc_path" = xyes; then 199 if test x"$boost_inc" != x; then 200 boost_cv_inc_path=$boost_inc 201 fi 202 break 2 203 fi 204 done 205 done 206AC_LANG_POP([C++])dnl 207 ]) 208 case $boost_cv_inc_path in #( 209 no) 210 boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" 211 m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])], 212 [AC_MSG_NOTICE([$boost_errmsg])]) 213 $2 214 ;;#( 215 yes) 216 BOOST_CPPFLAGS= 217 ;;#( 218 *) 219 AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl 220 ;; 221 esac 222 if test x"$boost_cv_inc_path" != xno; then 223 AC_DEFINE([HAVE_BOOST], [1], 224 [Defined if the requested minimum BOOST version is satisfied]) 225 AC_CACHE_CHECK([for Boost's header version], 226 [boost_cv_lib_version], 227 [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl 228 _BOOST_SED_CPP([[/^boost-lib-version = /{s///;s/[\" ]//g;p;q;}]], 229 [#include <boost/version.hpp> 230boost-lib-version = BOOST_LIB_VERSION], 231 [boost_cv_lib_version=`cat conftest.i`])]) 232 # e.g. "134" for 1_34_1 or "135" for 1_35 233 boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` 234 case $boost_major_version in #( 235 '' | *[[!0-9]]*) 236 AC_MSG_ERROR([invalid value: boost_major_version='$boost_major_version']) 237 ;; 238 esac 239fi 240CPPFLAGS=$boost_save_CPPFLAGS 241])# BOOST_REQUIRE 242 243 244# BOOST_STATIC() 245# -------------- 246# Add the "--enable-static-boost" configure argument. If this argument is given 247# on the command line, static versions of the libraries will be looked up. 248AC_DEFUN([BOOST_STATIC], 249 [AC_ARG_ENABLE([static-boost], 250 [AS_HELP_STRING([--enable-static-boost], 251 [Prefer the static boost libraries over the shared ones [no]])], 252 [enable_static_boost=yes], 253 [enable_static_boost=no])])# BOOST_STATIC 254 255 256# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) 257# -------------------------------------------------------------------------- 258# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for 259# some parts of the Boost library which are only made of headers and don't 260# require linking (such as Boost.Foreach). 261# 262# Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be 263# found in the first place, in which case by default a notice is issued to the 264# user. Presumably if we haven't died already it's because it's OK to not have 265# Boost, which is why only a notice is issued instead of a hard error. 266# 267# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in 268# case of success # (where HEADER-NAME is written LIKE_THIS, e.g., 269# HAVE_BOOST_FOREACH_HPP). 270AC_DEFUN([BOOST_FIND_HEADER], 271[AC_REQUIRE([BOOST_REQUIRE])dnl 272if test x"$boost_cv_inc_path" = xno; then 273 m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) 274else 275AC_LANG_PUSH([C++])dnl 276boost_save_CPPFLAGS=$CPPFLAGS 277CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 278AC_CHECK_HEADER([$1], 279 [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], 280 [Define to 1 if you have <$1>])])], 281 [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])]) 282CPPFLAGS=$boost_save_CPPFLAGS 283AC_LANG_POP([C++])dnl 284fi 285])# BOOST_FIND_HEADER 286 287 288# BOOST_FIND_LIBS([COMPONENT-NAME], [CANDIDATE-LIB-NAMES], 289# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 290# [CXX-PROLOGUE]) 291# -------------------------------------------------------------- 292# Look for the Boost library COMPONENT-NAME (e.g., `thread', for 293# libboost_thread) under the possible CANDIDATE-LIB-NAMES (e.g., 294# "thread_win32 thread"). Check that HEADER-NAME works and check that 295# libboost_LIB-NAME can link with the code CXX-TEST. The optional 296# argument CXX-PROLOGUE can be used to include some C++ code before 297# the `main' function. 298# 299# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above). 300# 301# Boost libraries typically come compiled with several flavors (with different 302# runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one 303# or more of the following letters: sgdpn (in that order). s = static 304# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build, 305# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n' 306# must always be used along with `p'). Additionally, PREFERRED-RT-OPT can 307# start with `mt-' to indicate that there is a preference for multi-thread 308# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp 309# ... If you want to make sure you have a specific version of Boost 310# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. 311AC_DEFUN([BOOST_FIND_LIBS], 312[AC_REQUIRE([BOOST_REQUIRE])dnl 313AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl 314AC_REQUIRE([BOOST_STATIC])dnl 315AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl 316if test x"$boost_cv_inc_path" = xno; then 317 AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) 318else 319dnl The else branch is huge and wasn't intended on purpose. 320AC_LANG_PUSH([C++])dnl 321AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl 322AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl 323AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl 324AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl 325BOOST_FIND_HEADER([$4]) 326boost_save_CPPFLAGS=$CPPFLAGS 327CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 328AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib], 329 [_BOOST_FIND_LIBS($@)]) 330case $Boost_lib in #( 331 (no) _AC_MSG_LOG_CONFTEST 332 AC_MSG_ERROR([cannot find the flags to link with Boost $1]) 333 ;; 334esac 335AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl 336AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl 337AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl 338AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl 339CPPFLAGS=$boost_save_CPPFLAGS 340AS_VAR_POPDEF([Boost_lib])dnl 341AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl 342AS_VAR_POPDEF([Boost_lib_LDPATH])dnl 343AS_VAR_POPDEF([Boost_lib_LIBS])dnl 344AC_LANG_POP([C++])dnl 345fi 346]) 347 348 349# BOOST_FIND_LIB([LIB-NAME], 350# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 351# [CXX-PROLOGUE]) 352# -------------------------------------------------------------- 353# Backward compatibility wrapper for BOOST_FIND_LIBS. 354AC_DEFUN([BOOST_FIND_LIB], 355[BOOST_FIND_LIBS([$1], $@)]) 356 357 358# _BOOST_FIND_LIBS([LIB-NAME], [CANDIDATE-LIB-NAMES], 359# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], 360# [CXX-PROLOGUE]) 361# -------------------------------------------------------------- 362# Real implementation of BOOST_FIND_LIBS: rely on these local macros: 363# Boost_lib, Boost_lib_LDFLAGS, Boost_lib_LDPATH, Boost_lib_LIBS 364# 365# The algorithm is as follows: first look for a given library name 366# according to the user's PREFERRED-RT-OPT. For each library name, we 367# prefer to use the ones that carry the tag (toolset name). Each 368# library is searched through the various standard paths were Boost is 369# usually installed. If we can't find the standard variants, we try 370# to enforce -mt (for instance on MacOSX, libboost_thread.dylib 371# doesn't exist but there's -obviously- libboost_thread-mt.dylib). 372AC_DEFUN([_BOOST_FIND_LIBS], 373[Boost_lib=no 374 case "$3" in #( 375 (mt | mt-) boost_mt=-mt; boost_rtopt=;; #( 376 (mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$3" : 'Xmt-*\(.*\)'`;; #( 377 (*) boost_mt=; boost_rtopt=$3;; 378 esac 379 if test $enable_static_boost = yes; then 380 boost_rtopt="s$boost_rtopt" 381 fi 382 # Find the proper debug variant depending on what we've been asked to find. 383 case $boost_rtopt in #( 384 (*d*) boost_rt_d=$boost_rtopt;; #( 385 (*[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn') 386 boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( 387 (*) boost_rt_d='-d';; 388 esac 389 # If the PREFERRED-RT-OPT are not empty, prepend a `-'. 390 test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" 391 $boost_guess_use_mt && boost_mt=-mt 392 # Look for the abs path the static archive. 393 # $libext is computed by Libtool but let's make sure it's non empty. 394 test -z "$libext" && 395 AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?]) 396 boost_save_ac_objext=$ac_objext 397 # Generate the test file. 398 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$4> 399$6], [$5])]) 400dnl Optimization hacks: compiling C++ is slow, especially with Boost. What 401dnl we're trying to do here is guess the right combination of link flags 402dnl (LIBS / LDFLAGS) to use a given library. This can take several 403dnl iterations before it succeeds and is thus *very* slow. So what we do 404dnl instead is that we compile the code first (and thus get an object file, 405dnl typically conftest.o). Then we try various combinations of link flags 406dnl until we succeed to link conftest.o in an executable. The problem is 407dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always 408dnl remove all the temporary files including conftest.o. So the trick here 409dnl is to temporarily change the value of ac_objext so that conftest.o is 410dnl preserved accross tests. This is obviously fragile and I will burn in 411dnl hell for not respecting Autoconf's documented interfaces, but in the 412dnl mean time, it optimizes the macro by a factor of 5 to 30. 413dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left 414dnl empty because the test file is generated only once above (before we 415dnl start the for loops). 416 AC_COMPILE_IFELSE([], 417 [ac_objext=do_not_rm_me_plz], 418 [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) 419 ac_objext=$boost_save_ac_objext 420 boost_failed_libs= 421# Don't bother to ident the following nested for loops, only the 2 422# innermost ones matter. 423for boost_lib_ in $2; do 424for boost_tag_ in -$boost_cv_lib_tag ''; do 425for boost_ver_ in -$boost_cv_lib_version ''; do 426for boost_mt_ in $boost_mt -mt ''; do 427for boost_rtopt_ in $boost_rtopt '' -d; do 428 for boost_lib in \ 429 boost_$boost_lib_$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ 430 boost_$boost_lib_$boost_tag_$boost_rtopt_$boost_ver_ \ 431 boost_$boost_lib_$boost_tag_$boost_mt_$boost_ver_ \ 432 boost_$boost_lib_$boost_tag_$boost_ver_ 433 do 434 # Avoid testing twice the same lib 435 case $boost_failed_libs in #( 436 (*@$boost_lib@*) continue;; 437 esac 438 # If with_boost is empty, we'll search in /lib first, which is not quite 439 # right so instead we'll try to a location based on where the headers are. 440 boost_tmp_lib=$with_boost 441 test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} 442 for boost_ldpath in "$boost_tmp_lib/lib" '' \ 443 /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ 444 "$with_boost" C:/Boost/lib /lib* 445 do 446 # Don't waste time with directories that don't exist. 447 if test x"$boost_ldpath" != x && test ! -e "$boost_ldpath"; then 448 continue 449 fi 450 boost_save_LDFLAGS=$LDFLAGS 451 # Are we looking for a static library? 452 case $boost_ldpath:$boost_rtopt_ in #( 453 (*?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) 454 Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext" 455 test -e "$Boost_lib_LIBS" || continue;; #( 456 (*) # No: use -lboost_foo to find the shared library. 457 Boost_lib_LIBS="-l$boost_lib";; 458 esac 459 boost_save_LIBS=$LIBS 460 LIBS="$Boost_lib_LIBS $LIBS" 461 test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" 462dnl First argument of AC_LINK_IFELSE left empty because the test file is 463dnl generated only once above (before we start the for loops). 464 _BOOST_AC_LINK_IFELSE([], 465 [Boost_lib=yes], [Boost_lib=no]) 466 ac_objext=$boost_save_ac_objext 467 LDFLAGS=$boost_save_LDFLAGS 468 LIBS=$boost_save_LIBS 469 if test x"$Boost_lib" = xyes; then 470 # Check or used cached result of whether or not using -R or 471 # -rpath makes sense. Some implementations of ld, such as for 472 # Mac OSX, require -rpath but -R is the flag known to work on 473 # other systems. https://github.com/tsuna/boost.m4/issues/19 474 AC_CACHE_VAL([boost_cv_rpath_link_ldflag], 475 [case $boost_ldpath in 476 '') # Nothing to do. 477 boost_cv_rpath_link_ldflag= 478 boost_rpath_link_ldflag_found=yes;; 479 *) 480 for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do 481 LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath" 482 LIBS="$boost_save_LIBS $Boost_lib_LIBS" 483 _BOOST_AC_LINK_IFELSE([], 484 [boost_rpath_link_ldflag_found=yes 485 break], 486 [boost_rpath_link_ldflag_found=no]) 487 done 488 ;; 489 esac 490 AS_IF([test "x$boost_rpath_link_ldflag_found" != "xyes"], 491 [AC_MSG_ERROR([Unable to determine whether to use -R or -rpath])]) 492 LDFLAGS=$boost_save_LDFLAGS 493 LIBS=$boost_save_LIBS 494 ]) 495 test x"$boost_ldpath" != x && 496 Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath" 497 Boost_lib_LDPATH="$boost_ldpath" 498 break 7 499 else 500 boost_failed_libs="$boost_failed_libs@$boost_lib@" 501 fi 502 done 503 done 504done 505done 506done 507done 508done # boost_lib_ 509rm -f conftest.$ac_objext 510]) 511 512 513 514# --------------------------------------- # 515# Checks for the various Boost libraries. # 516# --------------------------------------- # 517 518# List of boost libraries: http://www.boost.org/libs/libraries.htm 519# The page http://beta.boost.org/doc/libs is useful: it gives the first release 520# version of each library (among other things). 521 522# BOOST_DEFUN(LIBRARY, CODE) 523# -------------------------- 524# Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE. 525# 526# Use indir to avoid the warning on underquoted macro name given to AC_DEFUN. 527m4_define([BOOST_DEFUN], 528[m4_indir([AC_DEFUN], 529 m4_toupper([BOOST_$1]), 530[m4_pushdef([BOOST_Library], [$1])dnl 531$2 532m4_popdef([BOOST_Library])dnl 533]) 534]) 535 536# BOOST_ARRAY() 537# ------------- 538# Look for Boost.Array 539BOOST_DEFUN([Array], 540[BOOST_FIND_HEADER([boost/array.hpp])]) 541 542 543# BOOST_ASIO() 544# ------------ 545# Look for Boost.Asio (new in Boost 1.35). 546BOOST_DEFUN([Asio], 547[AC_REQUIRE([BOOST_SYSTEM])dnl 548BOOST_FIND_HEADER([boost/asio.hpp])]) 549 550 551# BOOST_BIND() 552# ------------ 553# Look for Boost.Bind. 554BOOST_DEFUN([Bind], 555[BOOST_FIND_HEADER([boost/bind.hpp])]) 556 557 558# BOOST_CHRONO() 559# -------------- 560# Look for Boost.Chrono. 561BOOST_DEFUN([Chrono], 562[# Do we have to check for Boost.System? This link-time dependency was 563# added as of 1.35.0. If we have a version <1.35, we must not attempt to 564# find Boost.System as it didn't exist by then. 565if test $boost_major_version -ge 135; then 566 BOOST_SYSTEM([$1]) 567fi # end of the Boost.System check. 568boost_filesystem_save_LIBS=$LIBS 569boost_filesystem_save_LDFLAGS=$LDFLAGS 570m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 571LIBS="$LIBS $BOOST_SYSTEM_LIBS" 572LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 573BOOST_FIND_LIB([chrono], [$1], 574 [boost/chrono.hpp], 575 [boost::chrono::thread_clock d;]) 576if test $enable_static_boost = yes && test $boost_major_version -ge 135; then 577 BOOST_CHRONO_LIBS="$BOOST_CHRONO_LIBS $BOOST_SYSTEM_LIBS" 578fi 579LIBS=$boost_filesystem_save_LIBS 580LDFLAGS=$boost_filesystem_save_LDFLAGS 581])# BOOST_CHRONO 582 583 584# BOOST_CONTEXT([PREFERRED-RT-OPT]) 585# ----------------------------------- 586# Look for Boost.Context. For the documentation of PREFERRED-RT-OPT, see the 587# documentation of BOOST_FIND_LIB above. 588# 589# * This library was introduced in Boost 1.51.0 590# * The signatures of make_fcontext() and jump_fcontext were changed in 1.56.0 591# * A dependency on boost_thread appears in 1.57.0 592BOOST_DEFUN([Context], 593[boost_context_save_LIBS=$LIBS 594 boost_context_save_LDFLAGS=$LDFLAGS 595if test $boost_major_version -ge 157; then 596 BOOST_THREAD([$1]) 597 m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl 598 LIBS="$LIBS $BOOST_THREAD_LIBS" 599 LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS" 600fi 601BOOST_FIND_LIB([context], [$1], 602 [boost/context/all.hpp],[[ 603 604// creates a stack 605void * stack_pointer = new void*[4096]; 606std::size_t const size = sizeof(void*[4096]); 607 608#if BOOST_VERSION <= 105100 609ctx::make_fcontext(&fc, f); 610return ctx::jump_fcontext(&fcm, &fc, 3) == 6; 611 612#else 613 614fc = ctx::make_fcontext(stack_pointer, size, f); 615return ctx::jump_fcontext(&fcm, fc, 3) == 6; 616 617#endif 618 619 620]],[dnl 621 622#include <boost/version.hpp> 623#if BOOST_VERSION <= 105100 624 625namespace ctx = boost::ctx; 626 627static ctx::fcontext_t fcm, fc; 628 629static void f(intptr_t i) { 630 ctx::jump_fcontext(&fc, &fcm, i * 2); 631} 632 633#elif BOOST_VERSION <= 105500 634 635namespace ctx = boost::context; 636 637// context 638static ctx::fcontext_t fcm, *fc; 639 640// context-function 641static void f(intptr_t i) { 642 ctx::jump_fcontext(fc, &fcm, i * 2); 643} 644 645#else 646 647namespace ctx = boost::context; 648 649// context 650static ctx::fcontext_t fcm, fc; 651 652// context-function 653static void f(intptr_t i) { 654 ctx::jump_fcontext(&fc, fcm, i * 2); 655} 656#endif 657]) 658LIBS=$boost_context_save_LIBS 659LDFLAGS=$boost_context_save_LDFLAGS 660])# BOOST_CONTEXT 661 662 663# BOOST_CONVERSION() 664# ------------------ 665# Look for Boost.Conversion (cast / lexical_cast) 666BOOST_DEFUN([Conversion], 667[BOOST_FIND_HEADER([boost/cast.hpp]) 668BOOST_FIND_HEADER([boost/lexical_cast.hpp]) 669])# BOOST_CONVERSION 670 671 672# BOOST_COROUTINE([PREFERRED-RT-OPT]) 673# ----------------------------------- 674# Look for Boost.Coroutine. For the documentation of PREFERRED-RT-OPT, see the 675# documentation of BOOST_FIND_LIB above. This library was introduced in Boost 676# 1.53.0 677BOOST_DEFUN([Coroutine], 678[ 679boost_coroutine_save_LIBS=$LIBS 680boost_coroutine_save_LDFLAGS=$LDFLAGS 681# Link-time dependency from coroutine to context 682BOOST_CONTEXT([$1]) 683# Starting from Boost 1.55 a dependency on Boost.System is added 684if test $boost_major_version -ge 155; then 685 BOOST_SYSTEM([$1]) 686fi 687m4_pattern_allow([^BOOST_(CONTEXT|SYSTEM)_(LIBS|LDFLAGS)]) 688LIBS="$LIBS $BOOST_CONTEXT_LIBS $BOOST_SYSTEM_LIBS" 689LDFLAGS="$LDFLAGS $BOOST_CONTEXT_LDFLAGS" 690 691# in 1.53 coroutine was a header only library 692if test $boost_major_version -eq 153; then 693 BOOST_FIND_HEADER([boost/coroutine/coroutine.hpp]) 694else 695 BOOST_FIND_LIB([coroutine], [$1], 696 [boost/coroutine/coroutine.hpp], 697 [ 698 #include <boost/version.hpp> 699 #if BOOST_VERSION <= 105500 700 boost::coroutines::coroutine<int(int)> coro; coro.get(); 701 #else 702 boost::coroutines::asymmetric_coroutine<int>::pull_type coro; coro.get(); 703 #endif 704 ]) 705fi 706# Link-time dependency from coroutine to context, existed only in 1.53, in 1.54 707# coroutine doesn't use context from its headers but from its library. 708if test $boost_major_version -eq 153 || test $enable_static_boost = yes && test $boost_major_version -ge 154; then 709 BOOST_COROUTINE_LIBS="$BOOST_COROUTINE_LIBS $BOOST_CONTEXT_LIBS" 710 BOOST_COROUTINE_LDFLAGS="$BOOST_COROUTINE_LDFLAGS $BOOST_CONTEXT_LDFLAGS" 711fi 712if test $enable_static_boost = yes && test $boost_major_version -ge 155; then 713 BOOST_COROUTINE_LIBS="$BOOST_COROUTINE_LIBS $BOOST_SYSTEM_LIBS" 714 BOOST_COROUTINE_LDFLAGS="$BOOST_COROUTINE_LDFLAGS $BOOST_SYSTEM_LDFLAGS" 715fi 716LIBS=$boost_coroutine_save_LIBS 717LDFLAGS=$boost_coroutine_save_LDFLAGS 718])# BOOST_COROUTINE 719 720 721# BOOST_CRC() 722# ----------- 723# Look for Boost.CRC 724BOOST_DEFUN([CRC], 725[BOOST_FIND_HEADER([boost/crc.hpp]) 726])# BOOST_CRC 727 728 729# BOOST_DATE_TIME([PREFERRED-RT-OPT]) 730# ----------------------------------- 731# Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the 732# documentation of BOOST_FIND_LIB above. 733BOOST_DEFUN([Date_Time], 734[BOOST_FIND_LIB([date_time], [$1], 735 [boost/date_time/posix_time/posix_time.hpp], 736 [boost::posix_time::ptime t;]) 737])# BOOST_DATE_TIME 738 739 740# BOOST_FILESYSTEM([PREFERRED-RT-OPT]) 741# ------------------------------------ 742# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see 743# the documentation of BOOST_FIND_LIB above. 744# Do not check for boost/filesystem.hpp because this file was introduced in 745# 1.34. 746BOOST_DEFUN([Filesystem], 747[# Do we have to check for Boost.System? This link-time dependency was 748# added as of 1.35.0. If we have a version <1.35, we must not attempt to 749# find Boost.System as it didn't exist by then. 750if test $boost_major_version -ge 135; then 751 BOOST_SYSTEM([$1]) 752fi # end of the Boost.System check. 753boost_filesystem_save_LIBS=$LIBS 754boost_filesystem_save_LDFLAGS=$LDFLAGS 755m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 756LIBS="$LIBS $BOOST_SYSTEM_LIBS" 757LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 758BOOST_FIND_LIB([filesystem], [$1], 759 [boost/filesystem/path.hpp], [boost::filesystem::path p;]) 760if test $enable_static_boost = yes && test $boost_major_version -ge 135; then 761 BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS" 762fi 763LIBS=$boost_filesystem_save_LIBS 764LDFLAGS=$boost_filesystem_save_LDFLAGS 765])# BOOST_FILESYSTEM 766 767 768# BOOST_FLYWEIGHT() 769# ----------------- 770# Look for Boost.Flyweight. 771BOOST_DEFUN([Flyweight], 772[dnl There's a hidden dependency on pthreads. 773AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl 774BOOST_FIND_HEADER([boost/flyweight.hpp]) 775AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag]) 776]) 777 778 779# BOOST_FOREACH() 780# --------------- 781# Look for Boost.Foreach. 782BOOST_DEFUN([Foreach], 783[BOOST_FIND_HEADER([boost/foreach.hpp])]) 784 785 786# BOOST_FORMAT() 787# -------------- 788# Look for Boost.Format. 789# Note: we can't check for boost/format/format_fwd.hpp because the header isn't 790# standalone. It can't be compiled because it triggers the following error: 791# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' 792# does not name a type 793BOOST_DEFUN([Format], 794[BOOST_FIND_HEADER([boost/format.hpp])]) 795 796 797# BOOST_FUNCTION() 798# ---------------- 799# Look for Boost.Function 800BOOST_DEFUN([Function], 801[BOOST_FIND_HEADER([boost/function.hpp])]) 802 803 804# BOOST_GEOMETRY() 805# ---------------- 806# Look for Boost.Geometry (new since 1.47.0). 807BOOST_DEFUN([Geometry], 808[BOOST_FIND_HEADER([boost/geometry.hpp]) 809])# BOOST_GEOMETRY 810 811 812# BOOST_GRAPH([PREFERRED-RT-OPT]) 813# ------------------------------- 814# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the 815# documentation of BOOST_FIND_LIB above. 816BOOST_DEFUN([Graph], 817[boost_graph_save_LIBS=$LIBS 818boost_graph_save_LDFLAGS=$LDFLAGS 819# Link-time dependency from graph to regex was added as of 1.40.0. 820if test $boost_major_version -ge 140; then 821 BOOST_REGEX([$1]) 822 m4_pattern_allow([^BOOST_REGEX_(LIBS|LDFLAGS)$])dnl 823 LIBS="$LIBS $BOOST_REGEX_LIBS" 824 LDFLAGS="$LDFLAGS $BOOST_REGEX_LDFLAGS" 825fi 826BOOST_FIND_LIB([graph], [$1], 827 [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) 828LIBS=$boost_graph_save_LIBS 829LDFLAGS=$boost_graph_save_LDFLAGS 830])# BOOST_GRAPH 831 832 833# BOOST_IOSTREAMS([PREFERRED-RT-OPT]) 834# ----------------------------------- 835# Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the 836# documentation of BOOST_FIND_LIB above. 837BOOST_DEFUN([IOStreams], 838[BOOST_FIND_LIB([iostreams], [$1], 839 [boost/iostreams/device/file_descriptor.hpp], 840 [boost::iostreams::file_descriptor fd; fd.close();]) 841])# BOOST_IOSTREAMS 842 843 844# BOOST_HASH() 845# ------------ 846# Look for Boost.Functional/Hash 847BOOST_DEFUN([Hash], 848[BOOST_FIND_HEADER([boost/functional/hash.hpp])]) 849 850 851# BOOST_LAMBDA() 852# -------------- 853# Look for Boost.Lambda 854BOOST_DEFUN([Lambda], 855[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) 856 857 858# BOOST_LOCALE() 859# -------------- 860# Look for Boost.Locale 861BOOST_DEFUN([Locale], 862[ 863boost_locale_save_LIBS=$LIBS 864boost_locale_save_LDFLAGS=$LDFLAGS 865# require SYSTEM for boost-1.50.0 and up 866if test $boost_major_version -ge 150; then 867 BOOST_SYSTEM([$1]) 868 m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 869 LIBS="$LIBS $BOOST_SYSTEM_LIBS" 870 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 871fi # end of the Boost.System check. 872BOOST_FIND_LIB([locale], [$1], 873 [boost/locale.hpp], 874 [[boost::locale::generator gen; std::locale::global(gen(""));]]) 875LIBS=$boost_locale_save_LIBS 876LDFLAGS=$boost_locale_save_LDFLAGS 877])# BOOST_LOCALE 878 879# BOOST_LOG([PREFERRED-RT-OPT]) 880# ----------------------------- 881# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the 882# documentation of BOOST_FIND_LIB above. 883BOOST_DEFUN([Log], 884[boost_log_save_LIBS=$LIBS 885boost_log_save_LDFLAGS=$LDFLAGS 886BOOST_SYSTEM([$1]) 887BOOST_FILESYSTEM([$1]) 888BOOST_DATE_TIME([$1]) 889m4_pattern_allow([^BOOST_(SYSTEM|FILESYSTEM|DATE_TIME)_(LIBS|LDFLAGS)$])dnl 890LIBS="$LIBS $BOOST_DATE_TIME_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS" 891LDFLAGS="$LDFLAGS $BOOST_DATE_TIME_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS $BOOST_SYSTEM_LDFLAGS" 892BOOST_FIND_LIB([log], [$1], 893 [boost/log/core/core.hpp], 894 [boost::log::attribute a; a.get_value();]) 895LIBS=$boost_log_save_LIBS 896LDFLAGS=$boost_log_save_LDFLAGS 897])# BOOST_LOG 898 899 900# BOOST_LOG_SETUP([PREFERRED-RT-OPT]) 901# ----------------------------------- 902# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the 903# documentation of BOOST_FIND_LIB above. 904BOOST_DEFUN([Log_Setup], 905[boost_log_setup_save_LIBS=$LIBS 906boost_log_setup_save_LDFLAGS=$LDFLAGS 907BOOST_LOG([$1]) 908m4_pattern_allow([^BOOST_LOG_(LIBS|LDFLAGS)$])dnl 909LIBS="$LIBS $BOOST_LOG_LIBS" 910LDFLAGS="$LDFLAGS $BOOST_LOG_LDFLAGS" 911BOOST_FIND_LIB([log_setup], [$1], 912 [boost/log/utility/setup/from_settings.hpp], 913 [boost::log::basic_settings<char> bs; bs.empty();]) 914LIBS=$boost_log_setup_save_LIBS 915LDFLAGS=$boost_log_setup_save_LDFLAGS 916])# BOOST_LOG_SETUP 917 918 919# BOOST_MATH() 920# ------------ 921# Look for Boost.Math 922# TODO: This library isn't header-only but it comes in multiple different 923# flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, 924# libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, 925# libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the 926# right thing anyway. 927BOOST_DEFUN([Math], 928[BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) 929 930 931# BOOST_MPI([PREFERRED-RT-OPT]) 932# ------------------------------- 933# Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the 934# documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is 935# set, otherwise tries CXX 936# 937BOOST_DEFUN([MPI], 938[boost_save_CXX=${CXX} 939boost_save_CXXCPP=${CXXCPP} 940if test x"${MPICXX}" != x; then 941 CXX=${MPICXX} 942 CXXCPP="${MPICXX} -E" 943fi 944BOOST_FIND_LIB([mpi], [$1], 945 [boost/mpi.hpp], 946 [int argc = 0; 947 char **argv = 0; 948 boost::mpi::environment env(argc,argv);]) 949CXX=${boost_save_CXX} 950CXXCPP=${boost_save_CXXCPP} 951])# BOOST_MPI 952 953 954# BOOST_MULTIARRAY() 955# ------------------ 956# Look for Boost.MultiArray 957BOOST_DEFUN([MultiArray], 958[BOOST_FIND_HEADER([boost/multi_array.hpp])]) 959 960 961# BOOST_NUMERIC_UBLAS() 962# -------------------------- 963# Look for Boost.NumericUblas (Basic Linear Algebra) 964BOOST_DEFUN([Numeric_Ublas], 965[BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp]) 966])# BOOST_NUMERIC_UBLAS 967 968 969# BOOST_NUMERIC_CONVERSION() 970# -------------------------- 971# Look for Boost.NumericConversion (policy-based numeric conversion) 972BOOST_DEFUN([Numeric_Conversion], 973[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) 974])# BOOST_NUMERIC_CONVERSION 975 976 977# BOOST_OPTIONAL() 978# ---------------- 979# Look for Boost.Optional 980BOOST_DEFUN([Optional], 981[BOOST_FIND_HEADER([boost/optional.hpp])]) 982 983 984# BOOST_PREPROCESSOR() 985# -------------------- 986# Look for Boost.Preprocessor 987BOOST_DEFUN([Preprocessor], 988[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) 989 990 991# BOOST_RANGE() 992# -------------------- 993# Look for Boost.Range 994BOOST_DEFUN([Range], 995[BOOST_FIND_HEADER([boost/range/adaptors.hpp])]) 996 997# BOOST_UNORDERED() 998# ----------------- 999# Look for Boost.Unordered 1000BOOST_DEFUN([Unordered], 1001[BOOST_FIND_HEADER([boost/unordered_map.hpp])]) 1002 1003 1004# BOOST_UUID() 1005# ------------ 1006# Look for Boost.Uuid 1007BOOST_DEFUN([Uuid], 1008[BOOST_FIND_HEADER([boost/uuid/uuid.hpp])]) 1009 1010 1011# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) 1012# ----------------------------------------- 1013# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, 1014# see the documentation of BOOST_FIND_LIB above. 1015BOOST_DEFUN([Program_Options], 1016[BOOST_FIND_LIB([program_options], [$1], 1017 [boost/program_options.hpp], 1018 [boost::program_options::options_description d("test");]) 1019])# BOOST_PROGRAM_OPTIONS 1020 1021 1022 1023# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG) 1024# ------------------------------------ 1025# Save VARIABLE, and define it via `python-config --FLAG`. 1026# Substitute BOOST_PYTHON_VARIABLE. 1027m4_define([_BOOST_PYTHON_CONFIG], 1028[AC_SUBST([BOOST_PYTHON_$1], 1029 [`python-config --$2 2>/dev/null`])dnl 1030boost_python_save_$1=$$1 1031$1="$$1 $BOOST_PYTHON_$1"]) 1032 1033 1034# BOOST_PYTHON([PREFERRED-RT-OPT]) 1035# -------------------------------- 1036# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT, 1037# see the documentation of BOOST_FIND_LIB above. 1038BOOST_DEFUN([Python], 1039[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes]) 1040_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags]) 1041_BOOST_PYTHON_CONFIG([LIBS], [libs]) 1042m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl 1043BOOST_FIND_LIBS([python], [python python3], [$1], 1044 [boost/python.hpp], 1045 [], [BOOST_PYTHON_MODULE(empty) {}]) 1046CPPFLAGS=$boost_python_save_CPPFLAGS 1047LDFLAGS=$boost_python_save_LDFLAGS 1048LIBS=$boost_python_save_LIBS 1049])# BOOST_PYTHON 1050 1051 1052# BOOST_REF() 1053# ----------- 1054# Look for Boost.Ref 1055BOOST_DEFUN([Ref], 1056[BOOST_FIND_HEADER([boost/ref.hpp])]) 1057 1058 1059# BOOST_REGEX([PREFERRED-RT-OPT]) 1060# ------------------------------- 1061# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the 1062# documentation of BOOST_FIND_LIB above. 1063BOOST_DEFUN([Regex], 1064[BOOST_FIND_LIB([regex], [$1], 1065 [boost/regex.hpp], 1066 [boost::regex exp("*"); boost::regex_match("foo", exp);]) 1067])# BOOST_REGEX 1068 1069 1070# BOOST_SERIALIZATION([PREFERRED-RT-OPT]) 1071# --------------------------------------- 1072# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see 1073# the documentation of BOOST_FIND_LIB above. 1074BOOST_DEFUN([Serialization], 1075[BOOST_FIND_LIB([serialization], [$1], 1076 [boost/archive/text_oarchive.hpp], 1077 [std::ostream* o = 0; // Cheap way to get an ostream... 1078 boost::archive::text_oarchive t(*o);]) 1079])# BOOST_SERIALIZATION 1080 1081 1082# BOOST_SIGNALS([PREFERRED-RT-OPT]) 1083# --------------------------------- 1084# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the 1085# documentation of BOOST_FIND_LIB above. 1086BOOST_DEFUN([Signals], 1087[BOOST_FIND_LIB([signals], [$1], 1088 [boost/signal.hpp], 1089 [boost::signal<void ()> s;]) 1090])# BOOST_SIGNALS 1091 1092 1093# BOOST_SIGNALS2() 1094# ---------------- 1095# Look for Boost.Signals2 (new since 1.39.0). 1096BOOST_DEFUN([Signals2], 1097[BOOST_FIND_HEADER([boost/signals2.hpp]) 1098])# BOOST_SIGNALS2 1099 1100 1101# BOOST_SMART_PTR() 1102# ----------------- 1103# Look for Boost.SmartPtr 1104BOOST_DEFUN([Smart_Ptr], 1105[BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) 1106BOOST_FIND_HEADER([boost/shared_ptr.hpp]) 1107]) 1108 1109 1110# BOOST_STATICASSERT() 1111# -------------------- 1112# Look for Boost.StaticAssert 1113BOOST_DEFUN([StaticAssert], 1114[BOOST_FIND_HEADER([boost/static_assert.hpp])]) 1115 1116 1117# BOOST_STRING_ALGO() 1118# ------------------- 1119# Look for Boost.StringAlgo 1120BOOST_DEFUN([String_Algo], 1121[BOOST_FIND_HEADER([boost/algorithm/string.hpp]) 1122]) 1123 1124 1125# BOOST_SYSTEM([PREFERRED-RT-OPT]) 1126# -------------------------------- 1127# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the 1128# documentation of BOOST_FIND_LIB above. This library was introduced in Boost 1129# 1.35.0. 1130BOOST_DEFUN([System], 1131[BOOST_FIND_LIB([system], [$1], 1132 [boost/system/error_code.hpp], 1133 [boost::system::error_code e; e.clear();]) 1134])# BOOST_SYSTEM 1135 1136 1137# BOOST_TEST([PREFERRED-RT-OPT]) 1138# ------------------------------ 1139# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the 1140# documentation of BOOST_FIND_LIB above. 1141BOOST_DEFUN([Test], 1142[m4_pattern_allow([^BOOST_CHECK$])dnl 1143BOOST_FIND_LIB([unit_test_framework], [$1], 1144 [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);], 1145 [using boost::unit_test::test_suite; 1146 test_suite* init_unit_test_suite(int argc, char ** argv) 1147 { return NULL; }]) 1148])# BOOST_TEST 1149 1150 1151# BOOST_THREAD([PREFERRED-RT-OPT]) 1152# --------------------------------- 1153# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the 1154# documentation of BOOST_FIND_LIB above. 1155BOOST_DEFUN([Thread], 1156[dnl Having the pthread flag is required at least on GCC3 where 1157dnl boost/thread.hpp would complain if we try to compile without 1158dnl -pthread on GNU/Linux. 1159AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl 1160boost_thread_save_LIBS=$LIBS 1161boost_thread_save_LDFLAGS=$LDFLAGS 1162boost_thread_save_CPPFLAGS=$CPPFLAGS 1163# Link-time dependency from thread to system was added as of 1.49.0. 1164if test $boost_major_version -ge 149; then 1165BOOST_SYSTEM([$1]) 1166fi # end of the Boost.System check. 1167m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl 1168LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag" 1169LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" 1170CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" 1171 1172# When compiling for the Windows platform, the threads library is named 1173# differently. This suffix doesn't exist in new versions of Boost, or 1174# possibly new versions of GCC on mingw I am assuming it's Boost's change for 1175# now and I am setting version to 1.48, for lack of knowledge as to when this 1176# change occurred. 1177if test $boost_major_version -lt 148; then 1178 case $host_os in 1179 (*mingw*) boost_thread_lib_ext=_win32;; 1180 esac 1181fi 1182BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext], 1183 [$1], 1184 [boost/thread.hpp], [boost::thread t; boost::mutex m;]) 1185 1186case $host_os in 1187 (*mingw*) boost_thread_w32_socket_link=-lws2_32;; 1188esac 1189 1190BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag $boost_thread_w32_socket_link" 1191BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS" 1192BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" 1193LIBS=$boost_thread_save_LIBS 1194LDFLAGS=$boost_thread_save_LDFLAGS 1195CPPFLAGS=$boost_thread_save_CPPFLAGS 1196])# BOOST_THREAD 1197 1198AU_ALIAS([BOOST_THREADS], [BOOST_THREAD]) 1199 1200 1201# BOOST_TOKENIZER() 1202# ----------------- 1203# Look for Boost.Tokenizer 1204BOOST_DEFUN([Tokenizer], 1205[BOOST_FIND_HEADER([boost/tokenizer.hpp])]) 1206 1207 1208# BOOST_TRIBOOL() 1209# --------------- 1210# Look for Boost.Tribool 1211BOOST_DEFUN([Tribool], 1212[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) 1213BOOST_FIND_HEADER([boost/logic/tribool.hpp]) 1214]) 1215 1216 1217# BOOST_TUPLE() 1218# ------------- 1219# Look for Boost.Tuple 1220BOOST_DEFUN([Tuple], 1221[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) 1222 1223 1224# BOOST_TYPETRAITS() 1225# -------------------- 1226# Look for Boost.TypeTraits 1227BOOST_DEFUN([TypeTraits], 1228[BOOST_FIND_HEADER([boost/type_traits.hpp])]) 1229 1230 1231# BOOST_UTILITY() 1232# --------------- 1233# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, 1234# etc.) 1235BOOST_DEFUN([Utility], 1236[BOOST_FIND_HEADER([boost/utility.hpp])]) 1237 1238 1239# BOOST_VARIANT() 1240# --------------- 1241# Look for Boost.Variant. 1242BOOST_DEFUN([Variant], 1243[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) 1244BOOST_FIND_HEADER([boost/variant.hpp])]) 1245 1246 1247# BOOST_POINTER_CONTAINER() 1248# ------------------------ 1249# Look for Boost.PointerContainer 1250BOOST_DEFUN([Pointer_Container], 1251[BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp]) 1252BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp]) 1253BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp]) 1254BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp]) 1255BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp]) 1256BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp]) 1257])# BOOST_POINTER_CONTAINER 1258 1259 1260# BOOST_WAVE([PREFERRED-RT-OPT]) 1261# ------------------------------ 1262# NOTE: If you intend to use Wave/Spirit with thread support, make sure you 1263# call BOOST_THREAD first. 1264# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the 1265# documentation of BOOST_FIND_LIB above. 1266BOOST_DEFUN([Wave], 1267[AC_REQUIRE([BOOST_FILESYSTEM])dnl 1268AC_REQUIRE([BOOST_DATE_TIME])dnl 1269boost_wave_save_LIBS=$LIBS 1270boost_wave_save_LDFLAGS=$LDFLAGS 1271m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl 1272LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \ 1273$BOOST_THREAD_LIBS" 1274LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \ 1275$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" 1276BOOST_FIND_LIB([wave], [$1], 1277 [boost/wave.hpp], 1278 [boost::wave::token_id id; get_token_name(id);]) 1279LIBS=$boost_wave_save_LIBS 1280LDFLAGS=$boost_wave_save_LDFLAGS 1281])# BOOST_WAVE 1282 1283 1284# BOOST_XPRESSIVE() 1285# ----------------- 1286# Look for Boost.Xpressive (new since 1.36.0). 1287BOOST_DEFUN([Xpressive], 1288[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) 1289 1290 1291# ----------------- # 1292# Internal helpers. # 1293# ----------------- # 1294 1295 1296# _BOOST_PTHREAD_FLAG() 1297# --------------------- 1298# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag 1299# which must be used in CPPFLAGS and LIBS. 1300# 1301# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, 1302# boost/thread.hpp will trigger a #error if -pthread isn't used: 1303# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support 1304# is not turned on. Please set the correct command line options for 1305# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" 1306# 1307# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html 1308AC_DEFUN([_BOOST_PTHREAD_FLAG], 1309[AC_REQUIRE([AC_PROG_CXX])dnl 1310AC_REQUIRE([AC_CANONICAL_HOST])dnl 1311AC_LANG_PUSH([C++])dnl 1312AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag], 1313[ boost_cv_pthread_flag= 1314 # The ordering *is* (sometimes) important. Some notes on the 1315 # individual items follow: 1316 # (none): in case threads are in libc; should be tried before -Kthread and 1317 # other compiler flags to prevent continual compiler warnings 1318 # -lpthreads: AIX (must check this before -lpthread) 1319 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) 1320 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) 1321 # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) 1322 # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) 1323 # -pthreads: Solaris/GCC 1324 # -mthreads: MinGW32/GCC, Lynx/GCC 1325 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it 1326 # doesn't hurt to check since this sometimes defines pthreads too; 1327 # also defines -D_REENTRANT) 1328 # ... -mt is also the pthreads flag for HP/aCC 1329 # -lpthread: GNU Linux, etc. 1330 # --thread-safe: KAI C++ 1331 case $host_os in #( 1332 *solaris*) 1333 # On Solaris (at least, for some versions), libc contains stubbed 1334 # (non-functional) versions of the pthreads routines, so link-based 1335 # tests will erroneously succeed. (We need to link with -pthreads/-mt/ 1336 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather 1337 # a function called by this macro, so we could check for that, but 1338 # who knows whether they'll stub that too in a future libc.) So, 1339 # we'll just look for -pthreads and -lpthread first: 1340 boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( 1341 *) 1342 boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ 1343 -pthreads -mthreads -lpthread --thread-safe -mt";; 1344 esac 1345 # Generate the test file. 1346 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>], 1347 [pthread_t th; pthread_join(th, 0); 1348 pthread_attr_init(0); pthread_cleanup_push(0, 0); 1349 pthread_create(0,0,0,0); pthread_cleanup_pop(0);])]) 1350 for boost_pthread_flag in '' $boost_pthread_flags; do 1351 boost_pthread_ok=false 1352dnl Re-use the test file already generated. 1353 boost_pthreads__save_LIBS=$LIBS 1354 LIBS="$LIBS $boost_pthread_flag" 1355 AC_LINK_IFELSE([], 1356 [if grep ".*$boost_pthread_flag" conftest.err; then 1357 echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD 1358 else 1359 boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag 1360 fi]) 1361 LIBS=$boost_pthreads__save_LIBS 1362 $boost_pthread_ok && break 1363 done 1364]) 1365AC_LANG_POP([C++])dnl 1366])# _BOOST_PTHREAD_FLAG 1367 1368 1369# _BOOST_gcc_test(MAJOR, MINOR) 1370# ----------------------------- 1371# Internal helper for _BOOST_FIND_COMPILER_TAG. 1372m4_define([_BOOST_gcc_test], 1373["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl 1374 1375# _BOOST_mingw_test(MAJOR, MINOR) 1376# ----------------------------- 1377# Internal helper for _BOOST_FIND_COMPILER_TAG. 1378m4_define([_BOOST_mingw_test], 1379["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \ 1380 (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ 1381 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl 1382 1383 1384# _BOOST_FIND_COMPILER_TAG() 1385# -------------------------- 1386# Internal. When Boost is installed without --layout=system, each library 1387# filename will hold a suffix that encodes the compiler used during the 1388# build. The Boost build system seems to call this a `tag'. 1389AC_DEFUN([_BOOST_FIND_COMPILER_TAG], 1390[AC_REQUIRE([AC_PROG_CXX])dnl 1391AC_REQUIRE([AC_CANONICAL_HOST])dnl 1392AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], 1393 [boost_cv_lib_tag], 1394[boost_cv_lib_tag=unknown 1395if test x$boost_cv_inc_path != xno; then 1396 AC_LANG_PUSH([C++])dnl 1397 # The following tests are mostly inspired by boost/config/auto_link.hpp 1398 # The list is sorted to most recent/common to oldest compiler (in order 1399 # to increase the likelihood of finding the right compiler with the 1400 # least number of compilation attempt). 1401 # Beware that some tests are sensible to the order (for instance, we must 1402 # look for MinGW before looking for GCC3). 1403 # I used one compilation test per compiler with a #error to recognize 1404 # each compiler so that it works even when cross-compiling (let me know 1405 # if you know a better approach). 1406 # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): 1407 # como, edg, kcc, bck, mp, sw, tru, xlc 1408 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines 1409 # the same defines as GCC's). 1410 for i in \ 1411 _BOOST_mingw_test(5, 3) \ 1412 _BOOST_gcc_test(5, 3) \ 1413 _BOOST_mingw_test(5, 2) \ 1414 _BOOST_gcc_test(5, 2) \ 1415 _BOOST_mingw_test(5, 1) \ 1416 _BOOST_gcc_test(5, 1) \ 1417 _BOOST_mingw_test(5, 0) \ 1418 _BOOST_gcc_test(5, 0) \ 1419 _BOOST_mingw_test(4, 10) \ 1420 _BOOST_gcc_test(4, 10) \ 1421 _BOOST_mingw_test(4, 9) \ 1422 _BOOST_gcc_test(4, 9) \ 1423 _BOOST_mingw_test(4, 8) \ 1424 _BOOST_gcc_test(4, 8) \ 1425 _BOOST_mingw_test(4, 7) \ 1426 _BOOST_gcc_test(4, 7) \ 1427 _BOOST_mingw_test(4, 6) \ 1428 _BOOST_gcc_test(4, 6) \ 1429 _BOOST_mingw_test(4, 5) \ 1430 _BOOST_gcc_test(4, 5) \ 1431 _BOOST_mingw_test(4, 4) \ 1432 _BOOST_gcc_test(4, 4) \ 1433 _BOOST_mingw_test(4, 3) \ 1434 _BOOST_gcc_test(4, 3) \ 1435 _BOOST_mingw_test(4, 2) \ 1436 _BOOST_gcc_test(4, 2) \ 1437 _BOOST_mingw_test(4, 1) \ 1438 _BOOST_gcc_test(4, 1) \ 1439 _BOOST_mingw_test(4, 0) \ 1440 _BOOST_gcc_test(4, 0) \ 1441 "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ 1442 && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ 1443 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ 1444 _BOOST_gcc_test(3, 4) \ 1445 _BOOST_gcc_test(3, 3) \ 1446 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ 1447 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ 1448 _BOOST_gcc_test(3, 2) \ 1449 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ 1450 _BOOST_gcc_test(3, 1) \ 1451 _BOOST_gcc_test(3, 0) \ 1452 "defined __BORLANDC__ @ bcb" \ 1453 "defined __ICC && (defined __unix || defined __unix__) @ il" \ 1454 "defined __ICL @ iw" \ 1455 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ 1456 _BOOST_gcc_test(2, 95) \ 1457 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ 1458 "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ 1459 "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ 1460 "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" 1461 do 1462 boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '` 1463 boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'` 1464 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1465#if $boost_tag_test 1466/* OK */ 1467#else 1468# error $boost_tag_test 1469#endif 1470]])], [boost_cv_lib_tag=$boost_tag; break], []) 1471 done 1472AC_LANG_POP([C++])dnl 1473 case $boost_cv_lib_tag in #( 1474 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed 1475 # to "gcc41" for instance. 1476 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. 1477 gcc*) 1478 boost_tag_x= 1479 case $host_os in #( 1480 darwin*) 1481 if test $boost_major_version -ge 136; then 1482 # The `x' added in r46793 of Boost. 1483 boost_tag_x=x 1484 fi;; 1485 esac 1486 # We can specify multiple tags in this variable because it's used by 1487 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... 1488 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" 1489 ;; #( 1490 unknown) 1491 AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]]) 1492 boost_cv_lib_tag= 1493 ;; 1494 esac 1495fi])dnl end of AC_CACHE_CHECK 1496])# _BOOST_FIND_COMPILER_TAG 1497 1498 1499# _BOOST_GUESS_WHETHER_TO_USE_MT() 1500# -------------------------------- 1501# Compile a small test to try to guess whether we should favor MT (Multi 1502# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly. 1503AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT], 1504[# Check whether we do better use `mt' even though we weren't ask to. 1505AC_LANG_PUSH([C++])dnl 1506AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1507#if defined _REENTRANT || defined _MT || defined __MT__ 1508/* use -mt */ 1509#else 1510# error MT not needed 1511#endif 1512]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false]) 1513AC_LANG_POP([C++])dnl 1514]) 1515 1516# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) 1517# ------------------------------------------------------------------- 1518# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile, 1519# will break when Autoconf changes its internals. Requires that you manually 1520# rm -f conftest.$ac_objext in between to really different tests, otherwise 1521# you will try to link a conftest.o left behind by a previous test. 1522# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this 1523# macro). 1524# 1525# Don't use "break" in the actions, as it would short-circuit some code 1526# this macro runs after the actions. 1527m4_define([_BOOST_AC_LINK_IFELSE], 1528[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl 1529rm -f conftest$ac_exeext 1530boost_save_ac_ext=$ac_ext 1531boost_use_source=: 1532# If we already have a .o, re-use it. We change $ac_ext so that $ac_link 1533# tries to link the existing object file instead of compiling from source. 1534test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && 1535 _AS_ECHO_LOG([re-using the existing conftest.$ac_objext]) 1536AS_IF([_AC_DO_STDERR($ac_link) && { 1537 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || 1538 test ! -s conftest.err 1539 } && test -s conftest$ac_exeext && { 1540 test "$cross_compiling" = yes || 1541 $as_executable_p conftest$ac_exeext 1542dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough. 1543 }], 1544 [$2], 1545 [if $boost_use_source; then 1546 _AC_MSG_LOG_CONFTEST 1547 fi 1548 $3]) 1549ac_objext=$boost_save_ac_objext 1550ac_ext=$boost_save_ac_ext 1551dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) 1552dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), 1553dnl as it would interfere with the next link command. 1554rm -f core conftest.err conftest_ipa8_conftest.oo \ 1555 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl 1556])# _BOOST_AC_LINK_IFELSE 1557 1558# Local Variables: 1559# mode: autoconf 1560# End: 1561