1 # boost.m4: Locate Boost headers and libraries for autoconf-based projects.
2 # Copyright (C) 2007, 2008, 2009, 2010, 2011 Benoit Sigoure <tsuna@lrde.epita.fr>
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.
9 # Additional permission under section 7 of the GNU General Public
10 # License, version 3 ("GPLv3"):
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.
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.
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/>.
24 m4_define([_BOOST_SERIAL], [m4_translit([
29 # Original sources can be found at http://github.com/tsuna/boost.m4
30 # You can fetch the latest version of the script by doing:
31 # wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4
37 # This file provides several macros to use the various Boost libraries.
38 # The first macro is BOOST_REQUIRE. It will simply check if it's possible to
39 # find the Boost headers of a given (optional) minimum version and it will
40 # define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to
41 # your configure so that users can specify non standard locations.
42 # If the user's environment contains BOOST_ROOT and --with-boost was not
43 # specified, --with-boost=$BOOST_ROOT is implicitly used.
44 # For more README and documentation, go to http://github.com/tsuna/boost.m4
45 # Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry,
46 # simply read the README, it will show you what to do step by step.
48 m4_pattern_forbid([^_?(BOOST|Boost)_])
51 # _BOOST_SED_CPP(SED-PROGRAM, PROGRAM,
52 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
53 # --------------------------------------------------------
54 # Same as AC_EGREP_CPP, but leave the result in conftest.i.
56 # SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded
57 # in double-quotes, so escape your double quotes.
59 # It could be useful to turn this into a macro which extracts the
61 m4_define([_BOOST_SED_CPP],
62 [AC_LANG_PREPROC_REQUIRE()dnl
63 AC_REQUIRE([AC_PROG_SED])dnl
64 AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
65 AS_IF([dnl eval is necessary to expand ac_cpp.
66 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
67 dnl Beware of Windows end-of-lines, for instance if we are running
68 dnl some Windows programs under Wine. In that case, boost/version.hpp
69 dnl is certainly using "\r\n", but the regular Unix shell will only
70 dnl strip `\n' with backquotes, not the `\r'. This results in
71 dnl boost_cv_lib_version='1_37\r' for instance, which breaks
73 dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
74 (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
77 $SED -n -e "$1" >conftest.i 2>&1],
85 # BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND])
86 # -----------------------------------------------
87 # Look for Boost. If version is given, it must either be a literal of the form
88 # "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a
90 # Defines the value BOOST_CPPFLAGS. This macro only checks for headers with
91 # the required version, it does not check for any of the Boost libraries.
92 # On # success, defines HAVE_BOOST. On failure, calls the optional
93 # ACTION-IF-NOT-FOUND action if one was supplied.
94 # Otherwise aborts with an error message.
95 AC_DEFUN([BOOST_REQUIRE],
96 [AC_REQUIRE([AC_PROG_CXX])dnl
97 AC_REQUIRE([AC_PROG_GREP])dnl
98 echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD
102 set x $boost_version_req 0 0 0
105 boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"`
106 boost_version_req_string=$[1].$[2].$[3]
108 [AS_HELP_STRING([--with-boost=DIR],
109 [prefix of Boost $1 @<:@guess@:>@])])dnl
110 AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl
111 # If BOOST_ROOT is set and the user has not provided a value to
112 # --with-boost, then treat BOOST_ROOT as if it the user supplied it.
113 if test x"$BOOST_ROOT" != x; then
114 if test x"$with_boost" = x; then
115 AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT])
116 with_boost=$BOOST_ROOT
118 AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost])
121 AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],
122 ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl
123 boost_save_CPPFLAGS=$CPPFLAGS
124 AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string],
126 [boost_cv_inc_path=no
127 AC_LANG_PUSH([C++])dnl
128 m4_pattern_allow([^BOOST_VERSION$])dnl
129 AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp>
130 #if !defined BOOST_VERSION
131 # error BOOST_VERSION is not defined
132 #elif BOOST_VERSION < $boost_version_req
133 # error Boost headers version < $boost_version_req
136 # If the user provided a value to --with-boost, use it and only it.
137 case $with_boost in #(
138 ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \
139 /usr/include C:/Boost/include;; #(
140 *) set x "$with_boost/include" "$with_boost";;
145 # Without --layout=system, Boost (or at least some versions) installs
146 # itself in <prefix>/include/boost-<version>. This inner loop helps to
147 # find headers in such directories.
149 # Any ${boost_dir}/boost-x_xx directories are searched in reverse version
150 # order followed by ${boost_dir}. The final '.' is a sentinel for
151 # searching $boost_dir" itself. Entries are whitespace separated.
153 # I didn't indent this loop on purpose (to avoid over-indented code)
154 boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \
155 && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \
157 for boost_inc in $boost_layout_system_search_list
159 if test x"$boost_inc" != x.; then
160 boost_inc="$boost_dir/$boost_inc"
162 boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list
164 if test x"$boost_inc" != x; then
165 # We are going to check whether the version of Boost installed
166 # in $boost_inc is usable by running a compilation that
167 # #includes it. But if we pass a -I/some/path in which Boost
168 # is not installed, the compiler will just skip this -I and
169 # use other locations (either from CPPFLAGS, or from its list
170 # of system include directories). As a result we would use
171 # header installed on the machine instead of the /some/path
172 # specified by the user. So in that precise case (trying
173 # $boost_inc), make sure the version.hpp exists.
175 # Use test -e as there can be symlinks.
176 test -e "$boost_inc/boost/version.hpp" || continue
177 CPPFLAGS="$CPPFLAGS -I$boost_inc"
179 AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no])
180 if test x"$boost_cv_inc_path" = xyes; then
181 if test x"$boost_inc" != x; then
182 boost_cv_inc_path=$boost_inc
188 AC_LANG_POP([C++])dnl
190 case $boost_cv_inc_path in #(
192 boost_errmsg="cannot find Boost headers version >= $boost_version_req_string"
193 m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])],
194 [AC_MSG_NOTICE([$boost_errmsg])])
201 AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl
204 if test x"$boost_cv_inc_path" != xno; then
205 AC_DEFINE([HAVE_BOOST], [1],
206 [Defined if the requested minimum BOOST version is satisfied])
207 AC_CACHE_CHECK([for Boost's header version],
208 [boost_cv_lib_version],
209 [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
210 _BOOST_SED_CPP([/^boost-lib-version=/{s///;s/\"//g;p;q;}],
211 [#include <boost/version.hpp>
212 boost-lib-version = BOOST_LIB_VERSION],
213 [boost_cv_lib_version=`cat conftest.i`])])
214 # e.g. "134" for 1_34_1 or "135" for 1_35
215 boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
216 case $boost_major_version in #(
218 AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version])
222 CPPFLAGS=$boost_save_CPPFLAGS
227 # Add the "--enable-static-boost" configure argument. If this argument is given
228 # on the command line, static versions of the libraries will be looked up.
229 AC_DEFUN([BOOST_STATIC],
230 [AC_ARG_ENABLE([static-boost],
231 [AC_HELP_STRING([--enable-static-boost],
232 [Prefer the static boost libraries over the shared ones [no]])],
233 [enable_static_boost=yes],
234 [enable_static_boost=no])])# BOOST_STATIC
236 # BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
237 # --------------------------------------------------------------------------
238 # Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for
239 # some parts of the Boost library which are only made of headers and don't
240 # require linking (such as Boost.Foreach).
242 # Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be
243 # found in the first place, in which case by default a notice is issued to the
244 # user. Presumably if we haven't died already it's because it's OK to not have
245 # Boost, which is why only a notice is issued instead of a hard error.
247 # Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in
248 # case of success # (where HEADER-NAME is written LIKE_THIS, e.g.,
249 # HAVE_BOOST_FOREACH_HPP).
250 AC_DEFUN([BOOST_FIND_HEADER],
251 [AC_REQUIRE([BOOST_REQUIRE])dnl
252 if test x"$boost_cv_inc_path" = xno; then
253 m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])])
255 AC_LANG_PUSH([C++])dnl
256 boost_save_CPPFLAGS=$CPPFLAGS
257 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
258 AC_CHECK_HEADER([$1],
259 [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
260 [Define to 1 if you have <$1>])])],
261 [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])])
262 CPPFLAGS=$boost_save_CPPFLAGS
263 AC_LANG_POP([C++])dnl
265 ])# BOOST_FIND_HEADER
268 # BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
269 # [CXX-PROLOGUE], [ACTION-IF-NOT-FOUND])
270 # -------------------------------------------------------------------------
271 # Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for
272 # libboost_thread). Check that HEADER-NAME works and check that
273 # libboost_LIB-NAME can link with the code CXX-TEST. The optional argument
274 # CXX-PROLOGUE can be used to include some C++ code before the `main'
275 # function. If ACTION-IF-NOT-FOUND is given, errors are nonfatal (otherwise
278 # Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
280 # Boost libraries typically come compiled with several flavors (with different
281 # runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one
282 # or more of the following letters: sgdpn (in that order). s = static
283 # runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build,
284 # n = (unsure) STLPort build without iostreams from STLPort (it looks like `n'
285 # must always be used along with `p'). Additionally, PREFERRED-RT-OPT can
286 # start with `mt-' to indicate that there is a preference for multi-thread
287 # builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
288 # ... If you want to make sure you have a specific version of Boost
289 # (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
290 AC_DEFUN([BOOST_FIND_LIB],
291 [AC_REQUIRE([BOOST_REQUIRE])dnl
292 AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
293 AC_REQUIRE([BOOST_STATIC])dnl
294 AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl
295 if test x"$boost_cv_inc_path" = xno; then
296 AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library])
298 dnl The else branch is huge and wasn't intended on purpose.
299 AC_LANG_PUSH([C++])dnl
300 AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
301 AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
302 AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl
303 AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
304 BOOST_FIND_HEADER([$3], [$6])
305 boost_save_CPPFLAGS=$CPPFLAGS
306 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
307 # Now let's try to find the library. The algorithm is as follows: first look
308 # for a given library name according to the user's PREFERRED-RT-OPT. For each
309 # library name, we prefer to use the ones that carry the tag (toolset name).
310 # Each library is searched through the various standard paths were Boost is
311 # usually installed. If we can't find the standard variants, we try to
312 # enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist
313 # but there's -obviously- libboost_threads-mt.dylib).
314 AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
317 mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
318 mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #(
319 *) boost_mt=; boost_rtopt=$2;;
321 if test $enable_static_boost = yes; then
322 boost_rtopt="s$boost_rtopt"
324 # Find the proper debug variant depending on what we've been asked to find.
325 case $boost_rtopt in #(
326 *d*) boost_rt_d=$boost_rtopt;; #(
327 *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
328 boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
331 # If the PREFERRED-RT-OPT are not empty, prepend a `-'.
332 test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
333 $boost_guess_use_mt && boost_mt=-mt
334 # Look for the abs path the static archive.
335 # $libext is computed by Libtool but let's make sure it's non empty.
337 AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
338 boost_save_ac_objext=$ac_objext
339 # Generate the test file.
340 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>
342 dnl Optimization hacks: compiling C++ is slow, especially with Boost. What
343 dnl we're trying to do here is guess the right combination of link flags
344 dnl (LIBS / LDFLAGS) to use a given library. This can take several
345 dnl iterations before it succeeds and is thus *very* slow. So what we do
346 dnl instead is that we compile the code first (and thus get an object file,
347 dnl typically conftest.o). Then we try various combinations of link flags
348 dnl until we succeed to link conftest.o in an executable. The problem is
349 dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always
350 dnl remove all the temporary files including conftest.o. So the trick here
351 dnl is to temporarily change the value of ac_objext so that conftest.o is
352 dnl preserved accross tests. This is obviously fragile and I will burn in
353 dnl hell for not respecting Autoconf's documented interfaces, but in the
354 dnl mean time, it optimizes the macro by a factor of 5 to 30.
355 dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left
356 dnl empty because the test file is generated only once above (before we
357 dnl start the for loops).
358 AC_COMPILE_IFELSE([],
359 [ac_objext=do_not_rm_me_plz],
360 [m4_if([$6], [], [AC_MSG_ERROR([cannot compile a test that uses Boost $1])],
361 [AC_MSG_NOTICE([cannot compile a test that uses Boost $1])])
363 ac_objext=$boost_save_ac_objext
365 # Don't bother to ident the 6 nested for loops, only the 2 innermost ones
367 for boost_tag_ in -$boost_cv_lib_tag ''; do
368 for boost_ver_ in -$boost_cv_lib_version ''; do
369 for boost_mt_ in $boost_mt -mt ''; do
370 for boost_rtopt_ in $boost_rtopt '' -d; do
372 boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
373 boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \
374 boost_$1$boost_tag_$boost_mt_$boost_ver_ \
375 boost_$1$boost_tag_$boost_ver_
377 # Avoid testing twice the same lib
378 case $boost_failed_libs in #(
379 *@$boost_lib@*) continue;;
381 # If with_boost is empty, we'll search in /lib first, which is not quite
382 # right so instead we'll try to a location based on where the headers are.
383 boost_tmp_lib=$with_boost
384 test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
385 for boost_ldpath in "$boost_tmp_lib/lib" '' \
386 /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
387 "$with_boost" C:/Boost/lib /lib*
389 test -e "$boost_ldpath" || continue
390 boost_save_LDFLAGS=$LDFLAGS
391 # Are we looking for a static library?
392 case $boost_ldpath:$boost_rtopt_ in #(
393 *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
394 Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
395 test -e "$Boost_lib_LIBS" || continue;; #(
396 *) # No: use -lboost_foo to find the shared library.
397 Boost_lib_LIBS="-l$boost_lib";;
399 boost_save_LIBS=$LIBS
400 LIBS="$Boost_lib_LIBS $LIBS"
401 test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath"
402 dnl First argument of AC_LINK_IFELSE left empty because the test file is
403 dnl generated only once above (before we start the for loops).
404 _BOOST_AC_LINK_IFELSE([],
405 [Boost_lib=yes], [Boost_lib=no])
406 ac_objext=$boost_save_ac_objext
407 LDFLAGS=$boost_save_LDFLAGS
408 LIBS=$boost_save_LIBS
409 if test x"$Boost_lib" = xyes; then
410 Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-rpath -Wl,$boost_ldpath"
411 Boost_lib_LDPATH="$boost_ldpath"
414 boost_failed_libs="$boost_failed_libs@$boost_lib@"
422 rm -f conftest.$ac_objext
424 case $Boost_lib in #((
425 no) _AC_MSG_LOG_CONFTEST
426 m4_if([$6], [], [AC_MSG_ERROR([cannot find the flags to link with Boost $1])],
427 [AC_MSG_NOTICE([cannot find the flags to link with Boost $1])])
431 AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl
432 AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl
433 AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl
434 AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl
437 CPPFLAGS=$boost_save_CPPFLAGS
438 AS_VAR_POPDEF([Boost_lib])dnl
439 AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
440 AS_VAR_POPDEF([Boost_lib_LDPATH])dnl
441 AS_VAR_POPDEF([Boost_lib_LIBS])dnl
442 AC_LANG_POP([C++])dnl
447 # --------------------------------------- #
448 # Checks for the various Boost libraries. #
449 # --------------------------------------- #
451 # List of boost libraries: http://www.boost.org/libs/libraries.htm
452 # The page http://beta.boost.org/doc/libs is useful: it gives the first release
453 # version of each library (among other things).
455 # BOOST_DEFUN(LIBRARY, CODE)
456 # --------------------------
457 # Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE.
459 # Use indir to avoid the warning on underquoted macro name given to AC_DEFUN.
460 m4_define([BOOST_DEFUN],
461 [m4_indir([AC_DEFUN],
462 m4_toupper([BOOST_$1]),
463 [m4_pushdef([BOOST_Library], [$1])dnl
465 m4_popdef([BOOST_Library])dnl
471 # Look for Boost.Array
473 [BOOST_FIND_HEADER([boost/array.hpp])])
478 # Look for Boost.Asio (new in Boost 1.35).
480 [AC_REQUIRE([BOOST_SYSTEM])dnl
481 BOOST_FIND_HEADER([boost/asio.hpp])])
486 # Look for Boost.Bind
488 [BOOST_FIND_HEADER([boost/bind.hpp])])
493 # Look for Boost.Chrono
494 BOOST_DEFUN([Chrono],
495 [# Do we have to check for Boost.System? This link-time dependency was
496 # added as of 1.35.0. If we have a version <1.35, we must not attempt to
497 # find Boost.System as it didn't exist by then.
498 if test $boost_major_version -ge 135; then
500 fi # end of the Boost.System check.
501 boost_filesystem_save_LIBS=$LIBS
502 boost_filesystem_save_LDFLAGS=$LDFLAGS
503 m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
504 LIBS="$LIBS $BOOST_SYSTEM_LIBS"
505 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
506 BOOST_FIND_LIB([chrono], [$1],
508 [boost::chrono::thread_clock d;])
509 if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
510 AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"])
512 LIBS=$boost_filesystem_save_LIBS
513 LDFLAGS=$boost_filesystem_save_LDFLAGS
520 # Look for Boost.Conversion (cast / lexical_cast)
521 BOOST_DEFUN([Conversion],
522 [BOOST_FIND_HEADER([boost/cast.hpp])
523 BOOST_FIND_HEADER([boost/lexical_cast.hpp])
527 # BOOST_DATE_TIME([PREFERRED-RT-OPT])
528 # -----------------------------------
529 # Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the
530 # documentation of BOOST_FIND_LIB above.
531 BOOST_DEFUN([Date_Time],
532 [BOOST_FIND_LIB([date_time], [$1],
533 [boost/date_time/posix_time/posix_time.hpp],
534 [boost::posix_time::ptime t;])
538 # BOOST_FILESYSTEM([PREFERRED-RT-OPT])
539 # ------------------------------------
540 # Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see
541 # the documentation of BOOST_FIND_LIB above.
542 # Do not check for boost/filesystem.hpp because this file was introduced in
544 BOOST_DEFUN([Filesystem],
545 [# Do we have to check for Boost.System? This link-time dependency was
546 # added as of 1.35.0. If we have a version <1.35, we must not attempt to
547 # find Boost.System as it didn't exist by then.
548 if test $boost_major_version -ge 135; then
550 fi # end of the Boost.System check.
551 boost_filesystem_save_LIBS=$LIBS
552 boost_filesystem_save_LDFLAGS=$LDFLAGS
553 m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
554 LIBS="$LIBS $BOOST_SYSTEM_LIBS"
555 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
556 BOOST_FIND_LIB([filesystem], [$1],
557 [boost/filesystem/path.hpp], [boost::filesystem::path p;])
558 if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
559 AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"])
561 LIBS=$boost_filesystem_save_LIBS
562 LDFLAGS=$boost_filesystem_save_LDFLAGS
568 # Look for Boost.Foreach
569 BOOST_DEFUN([Foreach],
570 [BOOST_FIND_HEADER([boost/foreach.hpp])])
575 # Look for Boost.Format
576 # Note: we can't check for boost/format/format_fwd.hpp because the header isn't
577 # standalone. It can't be compiled because it triggers the following error:
578 # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
579 # does not name a type
580 BOOST_DEFUN([Format],
581 [BOOST_FIND_HEADER([boost/format.hpp])])
586 # Look for Boost.Function
587 BOOST_DEFUN([Function],
588 [BOOST_FIND_HEADER([boost/function.hpp])])
591 # BOOST_GRAPH([PREFERRED-RT-OPT])
592 # -------------------------------
593 # Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
594 # documentation of BOOST_FIND_LIB above.
596 [BOOST_FIND_LIB([graph], [$1],
597 [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
601 # BOOST_IOSTREAMS([PREFERRED-RT-OPT])
602 # -----------------------------------
603 # Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the
604 # documentation of BOOST_FIND_LIB above.
605 BOOST_DEFUN([IOStreams],
606 [BOOST_FIND_LIB([iostreams], [$1],
607 [boost/iostreams/device/file_descriptor.hpp],
608 [boost::iostreams::file_descriptor fd; fd.close();])
614 # Look for Boost.Functional/Hash
616 [BOOST_FIND_HEADER([boost/functional/hash.hpp])])
621 # Look for Boost.Lambda
622 BOOST_DEFUN([Lambda],
623 [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
626 # BOOST_LOG([PREFERRED-RT-OPT])
627 # -----------------------------
628 # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the
629 # documentation of BOOST_FIND_LIB above.
631 [BOOST_FIND_LIB([log], [$1],
632 [boost/log/core/core.hpp],
633 [boost::log::attribute a; a.get_value();])
637 # BOOST_LOG_SETUP([PREFERRED-RT-OPT])
638 # -----------------------------------
639 # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the
640 # documentation of BOOST_FIND_LIB above.
641 BOOST_DEFUN([Log_Setup],
642 [AC_REQUIRE([BOOST_LOG])dnl
643 BOOST_FIND_LIB([log_setup], [$1],
644 [boost/log/utility/init/from_settings.hpp],
645 [boost::log::basic_settings<char> bs; bs.empty();])
651 # Look for Boost.Math
652 # TODO: This library isn't header-only but it comes in multiple different
653 # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99,
654 # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1,
655 # libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the
656 # right thing anyway.
658 [BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
663 # Look for Boost.MultiArray
664 BOOST_DEFUN([MultiArray],
665 [BOOST_FIND_HEADER([boost/multi_array.hpp])])
668 # BOOST_NUMERIC_CONVERSION()
669 # --------------------------
670 # Look for Boost.NumericConversion (policy-based numeric conversion)
671 BOOST_DEFUN([Numeric_Conversion],
672 [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
673 ])# BOOST_NUMERIC_CONVERSION
678 # Look for Boost.Optional
679 BOOST_DEFUN([Optional],
680 [BOOST_FIND_HEADER([boost/optional.hpp])])
683 # BOOST_PREPROCESSOR()
684 # --------------------
685 # Look for Boost.Preprocessor
686 BOOST_DEFUN([Preprocessor],
687 [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
692 # Look for Boost.Unordered
693 BOOST_DEFUN([Unordered],
694 [BOOST_FIND_HEADER([boost/unordered_map.hpp])])
699 # Look for Boost.Uuid
701 [BOOST_FIND_HEADER([boost/uuid/uuid.hpp])])
704 # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
705 # -----------------------------------------
706 # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT,
707 # see the documentation of BOOST_FIND_LIB above.
708 BOOST_DEFUN([Program_Options],
709 [BOOST_FIND_LIB([program_options], [$1],
710 [boost/program_options.hpp],
711 [boost::program_options::options_description d("test");])
712 ])# BOOST_PROGRAM_OPTIONS
716 # _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
717 # ------------------------------------
718 # Save VARIABLE, and define it via `python-config --FLAG`.
719 # Substitute BOOST_PYTHON_VARIABLE.
720 m4_define([_BOOST_PYTHON_CONFIG],
721 [AC_SUBST([BOOST_PYTHON_$1],
722 [`python-config --$2 2>/dev/null`])dnl
723 boost_python_save_$1=$$1
724 $1="$$1 $BOOST_PYTHON_$1"])
727 # BOOST_PYTHON([PREFERRED-RT-OPT])
728 # --------------------------------
729 # Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
730 # see the documentation of BOOST_FIND_LIB above.
731 BOOST_DEFUN([Python],
732 [_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
733 _BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
734 _BOOST_PYTHON_CONFIG([LIBS], [libs])
735 m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
736 BOOST_FIND_LIB([python], [$1],
738 [], [BOOST_PYTHON_MODULE(empty) {}])
739 CPPFLAGS=$boost_python_save_CPPFLAGS
740 LDFLAGS=$boost_python_save_LDFLAGS
741 LIBS=$boost_python_save_LIBS
749 [BOOST_FIND_HEADER([boost/ref.hpp])])
752 # BOOST_REGEX([PREFERRED-RT-OPT])
753 # -------------------------------
754 # Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
755 # documentation of BOOST_FIND_LIB above.
757 [BOOST_FIND_LIB([regex], [$1],
759 [boost::regex exp("*"); boost::regex_match("foo", exp);])
763 # BOOST_SERIALIZATION([PREFERRED-RT-OPT])
764 # ---------------------------------------
765 # Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
766 # the documentation of BOOST_FIND_LIB above.
767 BOOST_DEFUN([Serialization],
768 [BOOST_FIND_LIB([serialization], [$1],
769 [boost/archive/text_oarchive.hpp],
770 [std::ostream* o = 0; // Cheap way to get an ostream...
771 boost::archive::text_oarchive t(*o);])
772 ])# BOOST_SERIALIZATION
775 # BOOST_SIGNALS([PREFERRED-RT-OPT])
776 # ---------------------------------
777 # Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
778 # documentation of BOOST_FIND_LIB above.
779 BOOST_DEFUN([Signals],
780 [BOOST_FIND_LIB([signals], [$1],
782 [boost::signal<void ()> s;])
788 # Look for Boost.SmartPtr
789 BOOST_DEFUN([Smart_Ptr],
790 [BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
791 BOOST_FIND_HEADER([boost/shared_ptr.hpp])
795 # BOOST_STATICASSERT()
796 # --------------------
797 # Look for Boost.StaticAssert
798 BOOST_DEFUN([StaticAssert],
799 [BOOST_FIND_HEADER([boost/static_assert.hpp])])
802 # BOOST_STRING_ALGO()
803 # -------------------
804 # Look for Boost.StringAlgo
805 BOOST_DEFUN([String_Algo],
806 [BOOST_FIND_HEADER([boost/algorithm/string.hpp])
810 # BOOST_SYSTEM([PREFERRED-RT-OPT], [ACTION-IF-NOT-FOUND])
811 # -------------------------------------------------------
812 # Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
813 # documentation of BOOST_FIND_LIB above. This library was introduced in Boost
815 BOOST_DEFUN([System],
816 [BOOST_FIND_LIB([system], [$1],
817 [boost/system/error_code.hpp],
818 [boost::system::error_code e; e.clear();],
823 # BOOST_TEST([PREFERRED-RT-OPT])
824 # ------------------------------
825 # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
826 # documentation of BOOST_FIND_LIB above.
828 [m4_pattern_allow([^BOOST_CHECK$])dnl
829 BOOST_FIND_LIB([unit_test_framework], [$1],
830 [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
831 [using boost::unit_test::test_suite;
832 test_suite* init_unit_test_suite(int argc, char ** argv)
837 # BOOST_THREADS([PREFERRED-RT-OPT], [ACTION-IF-NOT-FOUND])
838 # --------------------------------------------------------
839 # Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
840 # documentation of BOOST_FIND_LIB above. If ACTION-IF-NOT-FOUND is given,
841 # errors are non-fatal; if it's absent, errors are fatal.
842 # FIXME: Provide an alias "BOOST_THREAD".
843 BOOST_DEFUN([Threads],
844 [dnl Having the pthread flag is required at least on GCC3 where
845 dnl boost/thread.hpp would complain if we try to compile without
846 dnl -pthread on GNU/Linux.
847 AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
848 boost_threads_save_LIBS=$LIBS
849 boost_threads_save_LDFLAGS=$LDFLAGS
850 boost_threads_save_CPPFLAGS=$CPPFLAGS
851 # Link-time dependency from thread to system was added as of 1.49.0.
852 if test $boost_major_version -ge 149; then
853 BOOST_SYSTEM([$1], [AC_MSG_WARN([[Boost system library (libboost-system) not installed or unusable; this may lead to problems with using threads. It is recommended that you install your distribution's libboost-system development package (probably named libboost-system###-dev, or boost-system-devel, or something like that).]])])
854 fi # end of the Boost.System check.
855 m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
856 LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
857 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
858 # Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
859 # boost/thread.hpp will trigger a #error if -pthread isn't used:
860 # boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
861 # is not turned on. Please set the correct command line options for
862 # threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
863 CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
865 # When compiling for the Windows platform, the threads library is named
869 BOOST_FIND_LIB([thread_win32], [$1],
870 [boost/thread.hpp], [boost::thread t; boost::mutex m;], [], [$2])
871 BOOST_THREAD_LDFLAGS=$BOOST_THREAD_WIN32_LDFLAGS
872 BOOST_THREAD_LDPATH=$BOOST_THREAD_WIN32_LDPATH
873 BOOST_THREAD_LIBS=$BOOST_THREAD_WIN32_LIBS
876 BOOST_FIND_LIB([thread], [$1],
877 [boost/thread.hpp], [boost::thread t; boost::mutex m;], [], [$2])
881 BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
882 BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
883 BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
884 LIBS=$boost_threads_save_LIBS
885 LDFLAGS=$boost_threads_save_LDFLAGS
886 CPPFLAGS=$boost_threads_save_CPPFLAGS
892 # Look for Boost.Tokenizer
893 BOOST_DEFUN([Tokenizer],
894 [BOOST_FIND_HEADER([boost/tokenizer.hpp])])
899 # Look for Boost.Tribool
900 BOOST_DEFUN([Tribool],
901 [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
902 BOOST_FIND_HEADER([boost/logic/tribool.hpp])
908 # Look for Boost.Tuple
910 [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
914 # --------------------
915 # Look for Boost.TypeTraits
916 BOOST_DEFUN([TypeTraits],
917 [BOOST_FIND_HEADER([boost/type_traits.hpp])])
922 # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
924 BOOST_DEFUN([Utility],
925 [BOOST_FIND_HEADER([boost/utility.hpp])])
930 # Look for Boost.Variant.
931 BOOST_DEFUN([Variant],
932 [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
933 BOOST_FIND_HEADER([boost/variant.hpp])])
936 # BOOST_WAVE([PREFERRED-RT-OPT])
937 # ------------------------------
938 # NOTE: If you intend to use Wave/Spirit with thread support, make sure you
939 # call BOOST_THREADS first.
940 # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
941 # documentation of BOOST_FIND_LIB above.
943 [AC_REQUIRE([BOOST_FILESYSTEM])dnl
944 AC_REQUIRE([BOOST_DATE_TIME])dnl
945 boost_wave_save_LIBS=$LIBS
946 boost_wave_save_LDFLAGS=$LDFLAGS
947 m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
948 LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \
950 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \
951 $BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
952 BOOST_FIND_LIB([wave], [$1],
954 [boost::wave::token_id id; get_token_name(id);])
955 LIBS=$boost_wave_save_LIBS
956 LDFLAGS=$boost_wave_save_LDFLAGS
962 # Look for Boost.Xpressive (new since 1.36.0).
963 BOOST_DEFUN([Xpressive],
964 [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
967 # ----------------- #
968 # Internal helpers. #
969 # ----------------- #
972 # _BOOST_PTHREAD_FLAG()
973 # ---------------------
974 # Internal helper for BOOST_THREADS. Based on ACX_PTHREAD:
975 # http://autoconf-archive.cryp.to/acx_pthread.html
976 AC_DEFUN([_BOOST_PTHREAD_FLAG],
977 [AC_REQUIRE([AC_PROG_CXX])dnl
978 AC_REQUIRE([AC_CANONICAL_HOST])dnl
979 AC_LANG_PUSH([C++])dnl
980 AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
981 [ boost_cv_pthread_flag=
982 # The ordering *is* (sometimes) important. Some notes on the
983 # individual items follow:
984 # (none): in case threads are in libc; should be tried before -Kthread and
985 # other compiler flags to prevent continual compiler warnings
986 # -lpthreads: AIX (must check this before -lpthread)
987 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
988 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
989 # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
990 # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
991 # -pthreads: Solaris/GCC
992 # -mthreads: MinGW32/GCC, Lynx/GCC
993 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
994 # doesn't hurt to check since this sometimes defines pthreads too;
995 # also defines -D_REENTRANT)
996 # ... -mt is also the pthreads flag for HP/aCC
997 # -lpthread: GNU Linux, etc.
998 # --thread-safe: KAI C++
1001 # On Solaris (at least, for some versions), libc contains stubbed
1002 # (non-functional) versions of the pthreads routines, so link-based
1003 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
1004 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
1005 # a function called by this macro, so we could check for that, but
1006 # who knows whether they'll stub that too in a future libc.) So,
1007 # we'll just look for -pthreads and -lpthread first:
1008 boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
1010 boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
1011 -pthreads -mthreads -lpthread --thread-safe -mt";;
1013 # Generate the test file.
1014 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
1015 [pthread_t th; pthread_join(th, 0);
1016 pthread_attr_init(0); pthread_cleanup_push(0, 0);
1017 pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
1018 for boost_pthread_flag in '' $boost_pthread_flags; do
1019 boost_pthread_ok=false
1020 dnl Re-use the test file already generated.
1021 boost_pthreads__save_LIBS=$LIBS
1022 LIBS="$LIBS $boost_pthread_flag"
1024 [if grep ".*$boost_pthread_flag" conftest.err; then
1025 echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
1027 boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
1029 LIBS=$boost_pthreads__save_LIBS
1030 $boost_pthread_ok && break
1033 AC_LANG_POP([C++])dnl
1034 ])# _BOOST_PTHREAD_FLAG
1037 # _BOOST_gcc_test(MAJOR, MINOR)
1038 # -----------------------------
1039 # Internal helper for _BOOST_FIND_COMPILER_TAG.
1040 m4_define([_BOOST_gcc_test],
1041 ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
1044 # _BOOST_FIND_COMPILER_TAG()
1045 # --------------------------
1046 # Internal. When Boost is installed without --layout=system, each library
1047 # filename will hold a suffix that encodes the compiler used during the
1048 # build. The Boost build system seems to call this a `tag'.
1049 AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
1050 [AC_REQUIRE([AC_PROG_CXX])dnl
1051 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1052 AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
1053 [boost_cv_lib_tag=unknown
1054 if test x$boost_cv_inc_path != xno; then
1055 AC_LANG_PUSH([C++])dnl
1056 # The following tests are mostly inspired by boost/config/auto_link.hpp
1057 # The list is sorted to most recent/common to oldest compiler (in order
1058 # to increase the likelihood of finding the right compiler with the
1059 # least number of compilation attempt).
1060 # Beware that some tests are sensible to the order (for instance, we must
1061 # look for MinGW before looking for GCC3).
1062 # I used one compilation test per compiler with a #error to recognize
1063 # each compiler so that it works even when cross-compiling (let me know
1064 # if you know a better approach).
1065 # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
1066 # como, edg, kcc, bck, mp, sw, tru, xlc
1067 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
1068 # the same defines as GCC's).
1070 _BOOST_gcc_test(4, 8) \
1071 _BOOST_gcc_test(4, 7) \
1072 _BOOST_gcc_test(4, 6) \
1073 _BOOST_gcc_test(4, 5) \
1074 _BOOST_gcc_test(4, 4) \
1075 _BOOST_gcc_test(4, 3) \
1076 _BOOST_gcc_test(4, 2) \
1077 _BOOST_gcc_test(4, 1) \
1078 _BOOST_gcc_test(4, 0) \
1079 "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
1080 && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1081 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
1082 _BOOST_gcc_test(3, 4) \
1083 _BOOST_gcc_test(3, 3) \
1084 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
1085 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
1086 _BOOST_gcc_test(3, 2) \
1087 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
1088 _BOOST_gcc_test(3, 1) \
1089 _BOOST_gcc_test(3, 0) \
1090 "defined __BORLANDC__ @ bcb" \
1091 "defined __ICC && (defined __unix || defined __unix__) @ il" \
1092 "defined __ICL @ iw" \
1093 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
1094 _BOOST_gcc_test(2, 95) \
1095 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
1096 "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
1097 "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
1098 "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
1100 boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
1101 boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
1102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1106 # error $boost_tag_test
1108 ]])], [boost_cv_lib_tag=$boost_tag; break], [])
1110 AC_LANG_POP([C++])dnl
1111 case $boost_cv_lib_tag in #(
1112 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
1113 # to "gcc41" for instance.
1114 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
1119 if test $boost_major_version -ge 136; then
1120 # The `x' added in r46793 of Boost.
1124 # We can specify multiple tags in this variable because it's used by
1125 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
1126 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
1129 AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
1133 fi])dnl end of AC_CACHE_CHECK
1134 ])# _BOOST_FIND_COMPILER_TAG
1137 # _BOOST_GUESS_WHETHER_TO_USE_MT()
1138 # --------------------------------
1139 # Compile a small test to try to guess whether we should favor MT (Multi
1140 # Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
1141 AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
1142 [# Check whether we do better use `mt' even though we weren't ask to.
1143 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1144 #if defined _REENTRANT || defined _MT || defined __MT__
1147 # error MT not needed
1149 ]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
1152 # _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
1153 # -------------------------------------------------------------------
1154 # Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
1155 # will break when Autoconf changes its internals. Requires that you manually
1156 # rm -f conftest.$ac_objext in between to really different tests, otherwise
1157 # you will try to link a conftest.o left behind by a previous test.
1158 # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
1161 # Don't use "break" in the actions, as it would short-circuit some code
1162 # this macro runs after the actions.
1163 m4_define([_BOOST_AC_LINK_IFELSE],
1164 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
1165 rm -f conftest$ac_exeext
1166 boost_save_ac_ext=$ac_ext
1168 # If we already have a .o, re-use it. We change $ac_ext so that $ac_link
1169 # tries to link the existing object file instead of compiling from source.
1170 test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
1171 _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
1172 AS_IF([_AC_DO_STDERR($ac_link) && {
1173 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
1174 test ! -s conftest.err
1175 } && test -s conftest$ac_exeext && {
1176 test "$cross_compiling" = yes ||
1177 $as_executable_p conftest$ac_exeext
1178 dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
1181 [if $boost_use_source; then
1182 _AC_MSG_LOG_CONFTEST
1185 ac_objext=$boost_save_ac_objext
1186 ac_ext=$boost_save_ac_ext
1187 dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
1188 dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
1189 dnl as it would interfere with the next link command.
1190 rm -f core conftest.err conftest_ipa8_conftest.oo \
1191 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
1192 ])# _BOOST_AC_LINK_IFELSE