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