boost.m4 51 KB

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