PageRenderTime 58ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/repast.hpc/trunk/repast.hpc/dist/autotools/m4/boost.m4

#
m4 | 1058 lines | 570 code | 104 blank | 384 comment | 0 complexity | cbbcd68f98155ba04b77b546706b22e6 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, CPL-1.0, MPL-2.0-no-copyleft-exception, GPL-2.0, LGPL-2.0, BSD-3-Clause, BSD-2-Clause, AGPL-3.0
  1. # boost.m4: Locate Boost headers and libraries for autoconf-based projects.
  2. # Copyright (C) 2007, 2008, 2009 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. m4_define([_BOOST_SERIAL], [m4_translit([
  24. # serial 12
  25. ], [#
  26. ], [])])
  27. # Original sources can be found at http://github.com/tsuna/boost.m4
  28. # You can fetch the latest version of the script by doing:
  29. # wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4
  30. # ------ #
  31. # README #
  32. # ------ #
  33. # This file provides several macros to use the various Boost libraries.
  34. # The first macro is BOOST_REQUIRE. It will simply check if it's possible to
  35. # find the Boost headers of a given (optional) minimum version and it will
  36. # define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to
  37. # your configure so that users can specify non standard locations.
  38. # If the user's environment contains BOOST_ROOT and --with-boost was not
  39. # specified, --with-boost=$BOOST_ROOT is implicitly used.
  40. # For more README and documentation, go to http://github.com/tsuna/boost.m4
  41. # Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry,
  42. # simply read the README, it will show you what to do step by step.
  43. m4_pattern_forbid([^_?BOOST_])
  44. # _BOOST_SED_CPP(SED-PROGRAM, PROGRAM,
  45. # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  46. # --------------------------------------------------------
  47. # Same as AC_EGREP_CPP, but leave the result in conftest.i.
  48. # PATTERN is *not* overquoted, as in AC_EGREP_CPP. It could be useful
  49. # to turn this into a macro which extracts the value of any macro.
  50. m4_define([_BOOST_SED_CPP],
  51. [AC_LANG_PREPROC_REQUIRE()dnl
  52. AC_REQUIRE([AC_PROG_SED])dnl
  53. AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
  54. AS_IF([dnl eval is necessary to expand ac_cpp.
  55. dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
  56. dnl Beware of Windows end-of-lines, for instance if we are running
  57. dnl some Windows programs under Wine. In that case, boost/version.hpp
  58. dnl is certainly using "\r\n", but the regular Unix shell will only
  59. dnl strip `\n' with backquotes, not the `\r'. This results in
  60. dnl boost_cv_lib_version='1_37\r' for instance, which breaks
  61. dnl everything else.
  62. dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
  63. (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
  64. tr -d '\r' |
  65. $SED -n -e "$1" >conftest.i 2>&1],
  66. [$3],
  67. [$4])
  68. rm -rf conftest*
  69. ])# AC_EGREP_CPP
  70. # BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND])
  71. # -----------------------------------------------
  72. # Look for Boost. If version is given, it must either be a literal of the form
  73. # "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a
  74. # variable "$var".
  75. # Defines the value BOOST_CPPFLAGS. This macro only checks for headers with
  76. # the required version, it does not check for any of the Boost libraries.
  77. # On # success, defines HAVE_BOOST. On failure, calls the optional
  78. # ACTION-IF-NOT-FOUND action if one was supplied.
  79. # Otherwise aborts with an error message.
  80. AC_DEFUN([BOOST_REQUIRE],
  81. [AC_REQUIRE([AC_PROG_CXX])dnl
  82. AC_REQUIRE([AC_PROG_GREP])dnl
  83. echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD
  84. boost_save_IFS=$IFS
  85. boost_version_req=$1
  86. IFS=.
  87. set x $boost_version_req 0 0 0
  88. IFS=$boost_save_IFS
  89. shift
  90. boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"`
  91. AC_ARG_WITH([boost],
  92. [AS_HELP_STRING([--with-boost=DIR],
  93. [prefix of Boost $1 @<:@guess@:>@])])dnl
  94. AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl
  95. # If BOOST_ROOT is set and the user has not provided a value to
  96. # --with-boost, then treat BOOST_ROOT as if it the user supplied it.
  97. if test x"$BOOST_ROOT" != x; then
  98. if test x"$with_boost" = x; then
  99. AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT])
  100. with_boost=$BOOST_ROOT
  101. else
  102. AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost])
  103. fi
  104. fi
  105. AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],
  106. ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])
  107. boost_save_CPPFLAGS=$CPPFLAGS
  108. AC_CACHE_CHECK([for Boost headers version >= $boost_version_req],
  109. [boost_cv_inc_path],
  110. [boost_cv_inc_path=no
  111. AC_LANG_PUSH([C++])dnl
  112. m4_pattern_allow([^BOOST_VERSION$])dnl
  113. AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp>
  114. #if !defined BOOST_VERSION
  115. # error BOOST_VERSION is not defined
  116. #elif BOOST_VERSION < $boost_version_req
  117. # error Boost headers version < $boost_version_req
  118. #endif
  119. ]])])
  120. # If the user provided a value to --with-boost, use it and only it.
  121. case $with_boost in #(
  122. ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \
  123. /usr/include C:/Boost/include;; #(
  124. *) set x "$with_boost/include" "$with_boost";;
  125. esac
  126. shift
  127. for boost_dir
  128. do
  129. # Without --layout=system, Boost (or at least some versions) installs
  130. # itself in <prefix>/include/boost-<version>. This inner loop helps to
  131. # find headers in such directories.
  132. #
  133. # Any ${boost_dir}/boost-x_xx directories are searched in reverse version
  134. # order followed by ${boost_dir}. The final '.' is a sentinel for
  135. # searching $boost_dir" itself. Entries are whitespace separated.
  136. #
  137. # I didn't indent this loop on purpose (to avoid over-indented code)
  138. boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \
  139. && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \
  140. && echo .`
  141. for boost_inc in $boost_layout_system_search_list
  142. do
  143. if test x"$boost_inc" != x.; then
  144. boost_inc="$boost_dir/$boost_inc"
  145. else
  146. boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list
  147. fi
  148. if test x"$boost_inc" != x; then
  149. # We are going to check whether the version of Boost installed
  150. # in $boost_inc is usable by running a compilation that
  151. # #includes it. But if we pass a -I/some/path in which Boost
  152. # is not installed, the compiler will just skip this -I and
  153. # use other locations (either from CPPFLAGS, or from its list
  154. # of system include directories). As a result we would use
  155. # header installed on the machine instead of the /some/path
  156. # specified by the user. So in that precise case (trying
  157. # $boost_inc), make sure the version.hpp exists.
  158. #
  159. # Use test -e as there can be symlinks.
  160. test -e "$boost_inc/boost/version.hpp" || continue
  161. CPPFLAGS="$CPPFLAGS -I$boost_inc"
  162. fi
  163. AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no])
  164. if test x"$boost_cv_inc_path" = xyes; then
  165. if test x"$boost_inc" != x; then
  166. boost_cv_inc_path=$boost_inc
  167. fi
  168. break 2
  169. fi
  170. done
  171. done
  172. AC_LANG_POP([C++])dnl
  173. ])
  174. case $boost_cv_inc_path in #(
  175. no)
  176. boost_errmsg="cannot find Boost headers version >= $boost_version_req"
  177. m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])],
  178. [AC_MSG_NOTICE([$boost_errmsg])])
  179. $2
  180. ;;#(
  181. yes)
  182. BOOST_CPPFLAGS=
  183. ;;#(
  184. *)
  185. AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])
  186. ;;
  187. esac
  188. if test x"$boost_cv_inc_path" != xno; then
  189. AC_DEFINE([HAVE_BOOST], [1],
  190. [Defined if the requested minimum BOOST version is satisfied])
  191. AC_CACHE_CHECK([for Boost's header version],
  192. [boost_cv_lib_version],
  193. [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
  194. _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;g;}],
  195. [#include <boost/version.hpp>
  196. boost-lib-version = BOOST_LIB_VERSION],
  197. [boost_cv_lib_version=`cat conftest.i`])])
  198. # e.g. "134" for 1_34_1 or "135" for 1_35
  199. boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
  200. case $boost_major_version in #(
  201. '' | *[[!0-9]]*)
  202. AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version])
  203. ;;
  204. esac
  205. fi
  206. CPPFLAGS=$boost_save_CPPFLAGS
  207. ])# BOOST_REQUIRE
  208. # BOOST_STATIC()
  209. # --------------
  210. # Add the "--enable-static-boost" configure argument. If this argument is given
  211. # on the command line, static versions of the libraries will be looked up.
  212. AC_DEFUN([BOOST_STATIC],
  213. [AC_ARG_ENABLE([static-boost],
  214. [AC_HELP_STRING([--enable-static-boost],
  215. [Prefer the static boost libraries over the shared ones [no]])],
  216. [enable_static_boost=yes],
  217. [enable_static_boost=no])])# BOOST_STATIC
  218. # BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
  219. # --------------------------------------------------------------------------
  220. # Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for
  221. # some parts of the Boost library which are only made of headers and don't
  222. # require linking (such as Boost.Foreach).
  223. #
  224. # Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be
  225. # found in the first place, in which case by default a notice is issued to the
  226. # user. Presumably if we haven't died already it's because it's OK to not have
  227. # Boost, which is why only a notice is issued instead of a hard error.
  228. #
  229. # Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in
  230. # case of success # (where HEADER-NAME is written LIKE_THIS, e.g.,
  231. # HAVE_BOOST_FOREACH_HPP).
  232. AC_DEFUN([BOOST_FIND_HEADER],
  233. [AC_REQUIRE([BOOST_REQUIRE])dnl
  234. if test x"$boost_cv_inc_path" = xno; then
  235. m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])])
  236. else
  237. AC_LANG_PUSH([C++])dnl
  238. boost_save_CPPFLAGS=$CPPFLAGS
  239. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  240. AC_CHECK_HEADER([$1],
  241. [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
  242. [Define to 1 if you have <$1>])])],
  243. [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])])
  244. CPPFLAGS=$boost_save_CPPFLAGS
  245. AC_LANG_POP([C++])dnl
  246. fi
  247. ])# BOOST_FIND_HEADER
  248. # BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
  249. # [CXX-PROLOGUE])
  250. # -------------------------------------------------------------------------
  251. # Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for
  252. # libboost_thread). Check that HEADER-NAME works and check that
  253. # libboost_LIB-NAME can link with the code CXX-TEST. The optional argument
  254. # CXX-PROLOGUE can be used to include some C++ code before the `main'
  255. # function.
  256. #
  257. # Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
  258. #
  259. # Boost libraries typically come compiled with several flavors (with different
  260. # runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one
  261. # or more of the following letters: sgdpn (in that order). s = static
  262. # runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build,
  263. # n = (unsure) STLPort build without iostreams from STLPort (it looks like `n'
  264. # must always be used along with `p'). Additionally, PREFERRED-RT-OPT can
  265. # start with `mt-' to indicate that there is a preference for multi-thread
  266. # builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
  267. # ... If you want to make sure you have a specific version of Boost
  268. # (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
  269. AC_DEFUN([BOOST_FIND_LIB],
  270. [AC_REQUIRE([BOOST_REQUIRE])dnl
  271. AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
  272. AC_REQUIRE([BOOST_STATIC])dnl
  273. AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl
  274. if test x"$boost_cv_inc_path" = xno; then
  275. AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library])
  276. else
  277. dnl The else branch is huge and wasn't intended on purpose.
  278. AC_LANG_PUSH([C++])dnl
  279. AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
  280. AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
  281. AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
  282. BOOST_FIND_HEADER([$3])
  283. boost_save_CPPFLAGS=$CPPFLAGS
  284. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  285. # Now let's try to find the library. The algorithm is as follows: first look
  286. # for a given library name according to the user's PREFERRED-RT-OPT. For each
  287. # library name, we prefer to use the ones that carry the tag (toolset name).
  288. # Each library is searched through the various standard paths were Boost is
  289. # usually installed. If we can't find the standard variants, we try to
  290. # enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist
  291. # but there's -obviously- libboost_threads-mt.dylib).
  292. AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
  293. [Boost_lib=no
  294. case "$2" in #(
  295. mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
  296. mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #(
  297. *) boost_mt=; boost_rtopt=$2;;
  298. esac
  299. if test $enable_static_boost = yes; then
  300. boost_rtopt="s$boost_rtopt"
  301. fi
  302. # Find the proper debug variant depending on what we've been asked to find.
  303. case $boost_rtopt in #(
  304. *d*) boost_rt_d=$boost_rtopt;; #(
  305. *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
  306. boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
  307. *) boost_rt_d='-d';;
  308. esac
  309. # If the PREFERRED-RT-OPT are not empty, prepend a `-'.
  310. test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
  311. $boost_guess_use_mt && boost_mt=-mt
  312. # Look for the abs path the static archive.
  313. # $libext is computed by Libtool but let's make sure it's non empty.
  314. test -z "$libext" &&
  315. AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
  316. boost_save_ac_objext=$ac_objext
  317. # Generate the test file.
  318. AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>
  319. $5], [$4])])
  320. dnl Optimization hacks: compiling C++ is slow, especially with Boost. What
  321. dnl we're trying to do here is guess the right combination of link flags
  322. dnl (LIBS / LDFLAGS) to use a given library. This can take several
  323. dnl iterations before it succeeds and is thus *very* slow. So what we do
  324. dnl instead is that we compile the code first (and thus get an object file,
  325. dnl typically conftest.o). Then we try various combinations of link flags
  326. dnl until we succeed to link conftest.o in an executable. The problem is
  327. dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always
  328. dnl remove all the temporary files including conftest.o. So the trick here
  329. dnl is to temporarily change the value of ac_objext so that conftest.o is
  330. dnl preserved accross tests. This is obviously fragile and I will burn in
  331. dnl hell for not respecting Autoconf's documented interfaces, but in the
  332. dnl mean time, it optimizes the macro by a factor of 5 to 30.
  333. dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left
  334. dnl empty because the test file is generated only once above (before we
  335. dnl start the for loops).
  336. AC_COMPILE_IFELSE([],
  337. [ac_objext=do_not_rm_me_plz],
  338. [AC_MSG_ERROR([cannot compile a test that uses Boost $1])])
  339. ac_objext=$boost_save_ac_objext
  340. boost_failed_libs=
  341. # Don't bother to ident the 6 nested for loops, only the 2 innermost ones
  342. # matter.
  343. for boost_tag_ in -$boost_cv_lib_tag ''; do
  344. for boost_ver_ in -$boost_cv_lib_version ''; do
  345. for boost_mt_ in $boost_mt -mt ''; do
  346. for boost_rtopt_ in $boost_rtopt '' -d; do
  347. for boost_lib in \
  348. boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
  349. boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \
  350. boost_$1$boost_tag_$boost_mt_$boost_ver_ \
  351. boost_$1$boost_tag_$boost_ver_
  352. do
  353. # Avoid testing twice the same lib
  354. case $boost_failed_libs in #(
  355. *@$boost_lib@*) continue;;
  356. esac
  357. # If with_boost is empty, we'll search in /lib first, which is not quite
  358. # right so instead we'll try to a location based on where the headers are.
  359. boost_tmp_lib=$with_boost
  360. test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
  361. for boost_ldpath in "$boost_tmp_lib/lib" '' \
  362. /opt/local/lib /usr/local/lib /opt/lib /usr/lib \
  363. "$with_boost" C:/Boost/lib /lib /usr/lib64 /lib64
  364. do
  365. test -e "$boost_ldpath" || continue
  366. boost_save_LDFLAGS=$LDFLAGS
  367. # Are we looking for a static library?
  368. case $boost_ldpath:$boost_rtopt_ in #(
  369. *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
  370. Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
  371. test -e "$Boost_lib_LIBS" || continue;; #(
  372. *) # No: use -lboost_foo to find the shared library.
  373. Boost_lib_LIBS="-l$boost_lib";;
  374. esac
  375. boost_save_LIBS=$LIBS
  376. LIBS="$Boost_lib_LIBS $LIBS"
  377. test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath"
  378. dnl First argument of AC_LINK_IFELSE left empty because the test file is
  379. dnl generated only once above (before we start the for loops).
  380. _BOOST_AC_LINK_IFELSE([],
  381. [Boost_lib=yes], [Boost_lib=no])
  382. ac_objext=$boost_save_ac_objext
  383. LDFLAGS=$boost_save_LDFLAGS
  384. LIBS=$boost_save_LIBS
  385. if test x"$Boost_lib" = xyes; then
  386. Boost_lib_LDFLAGS="-L$boost_ldpath"
  387. break 6
  388. else
  389. boost_failed_libs="$boost_failed_libs@$boost_lib@"
  390. fi
  391. done
  392. done
  393. done
  394. done
  395. done
  396. done
  397. rm -f conftest.$ac_objext
  398. ])
  399. case $Boost_lib in #(
  400. no) _AC_MSG_LOG_CONFTEST
  401. AC_MSG_ERROR([cannot not find the flags to link with Boost $1])
  402. ;;
  403. esac
  404. AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])
  405. AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])
  406. CPPFLAGS=$boost_save_CPPFLAGS
  407. AS_VAR_POPDEF([Boost_lib])dnl
  408. AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
  409. AS_VAR_POPDEF([Boost_lib_LIBS])dnl
  410. AC_LANG_POP([C++])dnl
  411. fi
  412. ])# BOOST_FIND_LIB
  413. # --------------------------------------- #
  414. # Checks for the various Boost libraries. #
  415. # --------------------------------------- #
  416. # List of boost libraries: http://www.boost.org/libs/libraries.htm
  417. # The page http://beta.boost.org/doc/libs is useful: it gives the first release
  418. # version of each library (among other things).
  419. # BOOST_ARRAY()
  420. # -------------
  421. # Look for Boost.Array
  422. AC_DEFUN([BOOST_ARRAY],
  423. [BOOST_FIND_HEADER([boost/array.hpp])])
  424. # BOOST_ASIO()
  425. # ------------
  426. # Look for Boost.Asio (new in Boost 1.35).
  427. AC_DEFUN([BOOST_ASIO],
  428. [AC_REQUIRE([BOOST_SYSTEM])dnl
  429. BOOST_FIND_HEADER([boost/asio.hpp])])
  430. # BOOST_BIND()
  431. # ------------
  432. # Look for Boost.Bind
  433. AC_DEFUN([BOOST_BIND],
  434. [BOOST_FIND_HEADER([boost/bind.hpp])])
  435. # BOOST_CONVERSION()
  436. # ------------------
  437. # Look for Boost.Conversion (cast / lexical_cast)
  438. AC_DEFUN([BOOST_CONVERSION],
  439. [BOOST_FIND_HEADER([boost/cast.hpp])
  440. BOOST_FIND_HEADER([boost/lexical_cast.hpp])
  441. ])# BOOST_CONVERSION
  442. # BOOST_DATE_TIME([PREFERRED-RT-OPT])
  443. # -----------------------------------
  444. # Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the
  445. # documentation of BOOST_FIND_LIB above.
  446. AC_DEFUN([BOOST_DATE_TIME],
  447. [BOOST_FIND_LIB([date_time], [$1],
  448. [boost/date_time/posix_time/posix_time.hpp],
  449. [boost::posix_time::ptime t;])
  450. ])# BOOST_DATE_TIME
  451. # BOOST_FILESYSTEM([PREFERRED-RT-OPT])
  452. # ------------------------------------
  453. # Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see
  454. # the documentation of BOOST_FIND_LIB above.
  455. # Do not check for boost/filesystem.hpp because this file was introduced in
  456. # 1.34.
  457. AC_DEFUN([BOOST_FILESYSTEM],
  458. [# Do we have to check for Boost.System? This link-time dependency was
  459. # added as of 1.35.0. If we have a version <1.35, we must not attempt to
  460. # find Boost.System as it didn't exist by then.
  461. if test $boost_major_version -ge 135; then
  462. BOOST_SYSTEM([$1])
  463. fi # end of the Boost.System check.
  464. boost_filesystem_save_LIBS=$LIBS
  465. boost_filesystem_save_LDFLAGS=$LDFLAGS
  466. m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
  467. LIBS="$LIBS $BOOST_SYSTEM_LIBS"
  468. LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
  469. BOOST_FIND_LIB([filesystem], [$1],
  470. [boost/filesystem/path.hpp], [boost::filesystem::path p;])
  471. LIBS=$boost_filesystem_save_LIBS
  472. LDFLAGS=$boost_filesystem_save_LDFLAGS
  473. ])# BOOST_FILESYSTEM
  474. # BOOST_FOREACH()
  475. # ---------------
  476. # Look for Boost.Foreach
  477. AC_DEFUN([BOOST_FOREACH],
  478. [BOOST_FIND_HEADER([boost/foreach.hpp])])
  479. # BOOST_FORMAT()
  480. # --------------
  481. # Look for Boost.Format
  482. # Note: we can't check for boost/format/format_fwd.hpp because the header isn't
  483. # standalone. It can't be compiled because it triggers the following error:
  484. # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
  485. # does not name a type
  486. AC_DEFUN([BOOST_FORMAT],
  487. [BOOST_FIND_HEADER([boost/format.hpp])])
  488. # BOOST_FUNCTION()
  489. # ----------------
  490. # Look for Boost.Function
  491. AC_DEFUN([BOOST_FUNCTION],
  492. [BOOST_FIND_HEADER([boost/function.hpp])])
  493. # BOOST_GRAPH([PREFERRED-RT-OPT])
  494. # -------------------------------
  495. # Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
  496. # documentation of BOOST_FIND_LIB above.
  497. AC_DEFUN([BOOST_GRAPH],
  498. [BOOST_FIND_LIB([graph], [$1],
  499. [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
  500. ])# BOOST_GRAPH
  501. # BOOST_IOSTREAMS([PREFERRED-RT-OPT])
  502. # -------------------------------
  503. # Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the
  504. # documentation of BOOST_FIND_LIB above.
  505. AC_DEFUN([BOOST_IOSTREAMS],
  506. [BOOST_FIND_LIB([iostreams], [$1],
  507. [boost/iostreams/device/file_descriptor.hpp],
  508. [boost::iostreams::file_descriptor fd(0); fd.close();])
  509. ])# BOOST_IOSTREAMS
  510. # BOOST_HASH()
  511. # ------------
  512. # Look for Boost.Functional/Hash
  513. AC_DEFUN([BOOST_HASH],
  514. [BOOST_FIND_HEADER([boost/functional/hash.hpp])])
  515. # BOOST_LAMBDA()
  516. # --------------
  517. # Look for Boost.Lambda
  518. AC_DEFUN([BOOST_LAMBDA],
  519. [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
  520. # BOOST_MATH()
  521. # ------------
  522. # Look for Boost.Math
  523. # TODO: This library isn't header-only but it comes in multiple different
  524. # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99,
  525. # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1,
  526. # libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the
  527. # right thing anyway.
  528. AC_DEFUN([BOOST_MATH],
  529. [BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
  530. # BOOST_MULTIARRAY()
  531. # ------------------
  532. # Look for Boost.MultiArray
  533. AC_DEFUN([BOOST_MULTIARRAY],
  534. [BOOST_FIND_HEADER([boost/multi_array.hpp])])
  535. # BOOST_NUMERIC_CONVERSION()
  536. # --------------------------
  537. # Look for Boost.NumericConversion (policy-based numeric conversion)
  538. AC_DEFUN([BOOST_NUMERIC_CONVERSION],
  539. [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
  540. ])# BOOST_NUMERIC_CONVERSION
  541. # BOOST_OPTIONAL()
  542. # ----------------
  543. # Look for Boost.Optional
  544. AC_DEFUN([BOOST_OPTIONAL],
  545. [BOOST_FIND_HEADER([boost/optional.hpp])])
  546. # BOOST_PREPROCESSOR()
  547. # --------------------
  548. # Look for Boost.Preprocessor
  549. AC_DEFUN([BOOST_PREPROCESSOR],
  550. [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
  551. # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
  552. # -----------------------------------------
  553. # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, see
  554. # the documentation of BOOST_FIND_LIB above.
  555. AC_DEFUN([BOOST_PROGRAM_OPTIONS],
  556. [BOOST_FIND_LIB([program_options], [$1],
  557. [boost/program_options.hpp],
  558. [boost::program_options::options_description d("test");])
  559. ])# BOOST_PROGRAM_OPTIONS
  560. # BOOST_REF()
  561. # -----------
  562. # Look for Boost.Ref
  563. AC_DEFUN([BOOST_REF],
  564. [BOOST_FIND_HEADER([boost/ref.hpp])])
  565. # BOOST_REGEX([PREFERRED-RT-OPT])
  566. # -------------------------------
  567. # Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
  568. # documentation of BOOST_FIND_LIB above.
  569. AC_DEFUN([BOOST_REGEX],
  570. [BOOST_FIND_LIB([regex], [$1],
  571. [boost/regex.hpp],
  572. [boost::regex exp("*"); boost::regex_match("foo", exp);])
  573. ])# BOOST_REGEX
  574. # BOOST_SERIALIZATION([PREFERRED-RT-OPT])
  575. # ---------------------------------------
  576. # Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
  577. # the documentation of BOOST_FIND_LIB above.
  578. AC_DEFUN([BOOST_SERIALIZATION],
  579. [BOOST_FIND_LIB([serialization], [$1],
  580. [boost/archive/text_oarchive.hpp],
  581. [std::ostream* o = 0; // Cheap way to get an ostream...
  582. boost::archive::text_oarchive t(*o);])
  583. ])# BOOST_SERIALIZATION
  584. # BOOST_MPI([PREFERRED-RT-OPT])
  585. # ---------------------------------------
  586. # Look for Boost.MPI. For the documentation of PREFERRED-RT-OPT, see
  587. # the documentation of BOOST_FIND_LIB above.
  588. AC_DEFUN([BOOST_MPI],
  589. boost_mpi_save_LIBS=$LIBS
  590. boost_mpi_save_LDFLAGS=$LDFLAGS
  591. LIBS="$LIBS $BOOST_SERIALIZATION_LIBS"
  592. LDFLAGS="$LDFLAGS $BOOST_SERIALIZATION_LDFLAGS"
  593. [BOOST_FIND_LIB([mpi], [$1],
  594. [boost/mpi.hpp],
  595. [boost::mpi::communicator world;])
  596. LIBS=$boost_mpi_save_LIBS
  597. LDFLAGS=$boost_mpi_save_LDFLAGS
  598. ])# BOOST_MPI
  599. # BOOST_SIGNALS([PREFERRED-RT-OPT])
  600. # ---------------------------------
  601. # Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
  602. # documentation of BOOST_FIND_LIB above.
  603. AC_DEFUN([BOOST_SIGNALS],
  604. [BOOST_FIND_LIB([signals], [$1],
  605. [boost/signal.hpp],
  606. [boost::signal<void ()> s;])
  607. ])# BOOST_SIGNALS
  608. # BOOST_SMART_PTR()
  609. # -----------------
  610. # Look for Boost.SmartPtr
  611. AC_DEFUN([BOOST_SMART_PTR],
  612. [BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
  613. BOOST_FIND_HEADER([boost/shared_ptr.hpp])
  614. ])
  615. # BOOST_STATICASSERT()
  616. # --------------------
  617. # Look for Boost.StaticAssert
  618. AC_DEFUN([BOOST_STATICASSERT],
  619. [BOOST_FIND_HEADER([boost/static_assert.hpp])])
  620. # BOOST_STRING_ALGO()
  621. # -------------------
  622. # Look for Boost.StringAlgo
  623. AC_DEFUN([BOOST_STRING_ALGO],
  624. [BOOST_FIND_HEADER([boost/algorithm/string.hpp])
  625. ])
  626. # BOOST_SYSTEM([PREFERRED-RT-OPT])
  627. # --------------------------------
  628. # Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
  629. # documentation of BOOST_FIND_LIB above. This library was introduced in Boost
  630. # 1.35.0.
  631. AC_DEFUN([BOOST_SYSTEM],
  632. [BOOST_FIND_LIB([system], [$1],
  633. [boost/system/error_code.hpp],
  634. [boost::system::error_code e; e.clear();])
  635. ])# BOOST_SYSTEM
  636. # BOOST_TEST([PREFERRED-RT-OPT])
  637. # ------------------------------
  638. # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
  639. # documentation of BOOST_FIND_LIB above.
  640. AC_DEFUN([BOOST_TEST],
  641. [m4_pattern_allow([^BOOST_CHECK$])dnl
  642. BOOST_FIND_LIB([unit_test_framework], [$1],
  643. [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
  644. [using boost::unit_test::test_suite;
  645. test_suite* init_unit_test_suite(int argc, char ** argv)
  646. { return NULL; }])
  647. ])# BOOST_TEST
  648. # BOOST_THREADS([PREFERRED-RT-OPT])
  649. # ---------------------------------
  650. # Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
  651. # documentation of BOOST_FIND_LIB above.
  652. # FIXME: Provide an alias "BOOST_THREAD".
  653. AC_DEFUN([BOOST_THREADS],
  654. [dnl Having the pthread flag is required at least on GCC3 where
  655. dnl boost/thread.hpp would complain if we try to compile without
  656. dnl -pthread on GNU/Linux.
  657. AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
  658. boost_threads_save_LIBS=$LIBS
  659. boost_threads_save_CPPFLAGS=$CPPFLAGS
  660. LIBS="$LIBS $boost_cv_pthread_flag"
  661. # Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
  662. # boost/thread.hpp will trigger a #error if -pthread isn't used:
  663. # boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
  664. # is not turned on. Please set the correct command line options for
  665. # threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
  666. CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
  667. BOOST_FIND_LIB([thread], [$1],
  668. [boost/thread.hpp], [boost::thread t; boost::mutex m;])
  669. BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag"
  670. BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
  671. LIBS=$boost_threads_save_LIBS
  672. CPPFLAGS=$boost_threads_save_CPPFLAGS
  673. ])# BOOST_THREADS
  674. # BOOST_TOKENIZER()
  675. # -----------------
  676. # Look for Boost.Tokenizer
  677. AC_DEFUN([BOOST_TOKENIZER],
  678. [BOOST_FIND_HEADER([boost/tokenizer.hpp])])
  679. # BOOST_TRIBOOL()
  680. # ---------------
  681. # Look for Boost.Tribool
  682. AC_DEFUN([BOOST_TRIBOOL],
  683. [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
  684. BOOST_FIND_HEADER([boost/logic/tribool.hpp])
  685. ])
  686. # BOOST_TUPLE()
  687. # -------------
  688. # Look for Boost.Tuple
  689. AC_DEFUN([BOOST_TUPLE],
  690. [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
  691. # BOOST_TYPETRAITS()
  692. # --------------------
  693. # Look for Boost.TypeTraits
  694. AC_DEFUN([BOOST_TYPETRAITS],
  695. [BOOST_FIND_HEADER([boost/type_traits.hpp])])
  696. # BOOST_UTILITY()
  697. # ---------------
  698. # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
  699. # etc.)
  700. AC_DEFUN([BOOST_UTILITY],
  701. [BOOST_FIND_HEADER([boost/utility.hpp])])
  702. # BOOST_VARIANT()
  703. # ---------------
  704. # Look for Boost.Variant.
  705. AC_DEFUN([BOOST_VARIANT],
  706. [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
  707. BOOST_FIND_HEADER([boost/variant.hpp])])
  708. # BOOST_WAVE([PREFERRED-RT-OPT])
  709. # ------------------------------
  710. # NOTE: If you intend to use Wave/Spirit with thread support, make sure you
  711. # call BOOST_THREADS first.
  712. # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
  713. # documentation of BOOST_FIND_LIB above.
  714. AC_DEFUN([BOOST_WAVE],
  715. [AC_REQUIRE([BOOST_FILESYSTEM])dnl
  716. AC_REQUIRE([BOOST_DATE_TIME])dnl
  717. boost_wave_save_LIBS=$LIBS
  718. boost_wave_save_LDFLAGS=$LDFLAGS
  719. m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
  720. LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\
  721. $BOOST_THREAD_LIBS"
  722. LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\
  723. $BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
  724. BOOST_FIND_LIB([wave], [$1],
  725. [boost/wave.hpp],
  726. [boost::wave::token_id id; get_token_name(id);])
  727. LIBS=$boost_wave_save_LIBS
  728. LDFLAGS=$boost_wave_save_LDFLAGS
  729. ])# BOOST_WAVE
  730. # BOOST_XPRESSIVE()
  731. # -----------------
  732. # Look for Boost.Xpressive (new since 1.36.0).
  733. AC_DEFUN([BOOST_XPRESSIVE],
  734. [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
  735. # ----------------- #
  736. # Internal helpers. #
  737. # ----------------- #
  738. # _BOOST_PTHREAD_FLAG()
  739. # ---------------------
  740. # Internal helper for BOOST_THREADS. Based on ACX_PTHREAD:
  741. # http://autoconf-archive.cryp.to/acx_pthread.html
  742. AC_DEFUN([_BOOST_PTHREAD_FLAG],
  743. [AC_REQUIRE([AC_PROG_CXX])dnl
  744. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  745. AC_LANG_PUSH([C++])dnl
  746. AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
  747. [ boost_cv_pthread_flag=
  748. # The ordering *is* (sometimes) important. Some notes on the
  749. # individual items follow:
  750. # (none): in case threads are in libc; should be tried before -Kthread and
  751. # other compiler flags to prevent continual compiler warnings
  752. # -lpthreads: AIX (must check this before -lpthread)
  753. # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
  754. # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
  755. # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
  756. # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
  757. # -pthreads: Solaris/GCC
  758. # -mthreads: MinGW32/GCC, Lynx/GCC
  759. # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
  760. # doesn't hurt to check since this sometimes defines pthreads too;
  761. # also defines -D_REENTRANT)
  762. # ... -mt is also the pthreads flag for HP/aCC
  763. # -lpthread: GNU Linux, etc.
  764. # --thread-safe: KAI C++
  765. case $host_os in #(
  766. *solaris*)
  767. # On Solaris (at least, for some versions), libc contains stubbed
  768. # (non-functional) versions of the pthreads routines, so link-based
  769. # tests will erroneously succeed. (We need to link with -pthreads/-mt/
  770. # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
  771. # a function called by this macro, so we could check for that, but
  772. # who knows whether they'll stub that too in a future libc.) So,
  773. # we'll just look for -pthreads and -lpthread first:
  774. boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
  775. *)
  776. boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
  777. -pthreads -mthreads -lpthread --thread-safe -mt";;
  778. esac
  779. # Generate the test file.
  780. AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
  781. [pthread_t th; pthread_join(th, 0);
  782. pthread_attr_init(0); pthread_cleanup_push(0, 0);
  783. pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
  784. for boost_pthread_flag in '' $boost_pthread_flags; do
  785. boost_pthread_ok=false
  786. dnl Re-use the test file already generated.
  787. boost_pthreads__save_LIBS=$LIBS
  788. LIBS="$LIBS $boost_pthread_flag"
  789. AC_LINK_IFELSE([],
  790. [if grep ".*$boost_pthread_flag" conftest.err; then
  791. echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
  792. else
  793. boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
  794. fi])
  795. LIBS=$boost_pthreads__save_LIBS
  796. $boost_pthread_ok && break
  797. done
  798. ])
  799. AC_LANG_POP([C++])dnl
  800. ])# _BOOST_PTHREAD_FLAG
  801. # _BOOST_gcc_test(MAJOR, MINOR)
  802. # -----------------------------
  803. # Internal helper for _BOOST_FIND_COMPILER_TAG.
  804. m4_define([_BOOST_gcc_test],
  805. ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
  806. # _BOOST_FIND_COMPILER_TAG()
  807. # --------------------------
  808. # Internal. When Boost is installed without --layout=system, each library
  809. # filename will hold a suffix that encodes the compiler used during the
  810. # build. The Boost build system seems to call this a `tag'.
  811. AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
  812. [AC_REQUIRE([AC_PROG_CXX])dnl
  813. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  814. AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
  815. [boost_cv_lib_tag=unknown
  816. if test x$boost_cv_inc_path != xno; then
  817. AC_LANG_PUSH([C++])dnl
  818. # The following tests are mostly inspired by boost/config/auto_link.hpp
  819. # The list is sorted to most recent/common to oldest compiler (in order
  820. # to increase the likelihood of finding the right compiler with the
  821. # least number of compilation attempt).
  822. # Beware that some tests are sensible to the order (for instance, we must
  823. # look for MinGW before looking for GCC3).
  824. # I used one compilation test per compiler with a #error to recognize
  825. # each compiler so that it works even when cross-compiling (let me know
  826. # if you know a better approach).
  827. # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
  828. # como, edg, kcc, bck, mp, sw, tru, xlc
  829. # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
  830. # the same defines as GCC's).
  831. # TODO: Move the test on GCC 4.4 up once it's released.
  832. for i in \
  833. _BOOST_gcc_test(4, 3) \
  834. _BOOST_gcc_test(4, 2) \
  835. _BOOST_gcc_test(4, 1) \
  836. _BOOST_gcc_test(4, 0) \
  837. "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
  838. && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
  839. || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
  840. _BOOST_gcc_test(3, 4) \
  841. _BOOST_gcc_test(3, 3) \
  842. "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
  843. "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
  844. _BOOST_gcc_test(3, 2) \
  845. "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
  846. _BOOST_gcc_test(3, 1) \
  847. _BOOST_gcc_test(3, 0) \
  848. "defined __BORLANDC__ @ bcb" \
  849. "defined __ICC && (defined __unix || defined __unix__) @ il" \
  850. "defined __ICL @ iw" \
  851. "defined __xlC__ && __xlC__ == 0x900 @ xlc90" \
  852. "defined __xlC__ && __xlC__ == 0x01010 @ xlc101" \
  853. "defined __xlC__ && __xlC__ == 0x0b01 @ xlc111" \
  854. "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
  855. _BOOST_gcc_test(4, 4) \
  856. _BOOST_gcc_test(2, 95) \
  857. "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
  858. "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
  859. "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
  860. "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
  861. do
  862. boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
  863. boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
  864. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  865. #if $boost_tag_test
  866. /* OK */
  867. #else
  868. # error $boost_tag_test
  869. #endif
  870. ]])], [boost_cv_lib_tag=$boost_tag; break], [])
  871. done
  872. AC_LANG_POP([C++])dnl
  873. case $boost_cv_lib_tag in #(
  874. # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
  875. # to "gcc41" for instance.
  876. *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
  877. gcc*)
  878. boost_tag_x=
  879. case $host_os in #(
  880. darwin*)
  881. if test $boost_major_version -ge 136; then
  882. # The `x' added in r46793 of Boost.
  883. boost_tag_x=x
  884. fi;;
  885. esac
  886. # We can specify multiple tags in this variable because it's used by
  887. # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
  888. boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
  889. ;; #(
  890. unknown)
  891. AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
  892. boost_cv_lib_tag=
  893. ;;
  894. esac
  895. fi])dnl end of AC_CACHE_CHECK
  896. ])# _BOOST_FIND_COMPILER_TAG
  897. # _BOOST_GUESS_WHETHER_TO_USE_MT()
  898. # --------------------------------
  899. # Compile a small test to try to guess whether we should favor MT (Multi
  900. # Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
  901. AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
  902. [# Check whether we do better use `mt' even though we weren't ask to.
  903. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  904. #if defined _REENTRANT || defined _MT || defined __MT__
  905. /* use -mt */
  906. #else
  907. # error MT not needed
  908. #endif
  909. ]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
  910. ])
  911. # _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
  912. # -------------------------------------------------------------------
  913. # Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
  914. # will break when Autoconf changes its internals. Requires that you manually
  915. # rm -f conftest.$ac_objext in between to really different tests, otherwise
  916. # you will try to link a conftest.o left behind by a previous test.
  917. # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
  918. # macro).
  919. #
  920. # Don't use "break" in the actions, as it would short-circuit some code
  921. # this macro runs after the actions.
  922. m4_define([_BOOST_AC_LINK_IFELSE],
  923. [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
  924. rm -f conftest$ac_exeext
  925. boost_save_ac_ext=$ac_ext
  926. boost_use_source=:
  927. # If we already have a .o, re-use it. We change $ac_ext so that $ac_link
  928. # tries to link the existing object file instead of compiling from source.
  929. test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
  930. _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
  931. AS_IF([_AC_DO_STDERR($ac_link) && {
  932. test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
  933. test ! -s conftest.err
  934. } && test -s conftest$ac_exeext && {
  935. test "$cross_compiling" = yes ||
  936. $as_executable_p conftest$ac_exeext
  937. dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
  938. }],
  939. [$2],
  940. [if $boost_use_source; then
  941. _AC_MSG_LOG_CONFTEST
  942. fi
  943. $3])
  944. ac_objext=$boost_save_ac_objext
  945. ac_ext=$boost_save_ac_ext
  946. dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
  947. dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
  948. dnl as it would interfere with the next link command.
  949. rm -f core conftest.err conftest_ipa8_conftest.oo \
  950. conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
  951. ])# _BOOST_AC_LINK_IFELSE
  952. # Local Variables:
  953. # mode: autoconf
  954. # End: