source: ThirdParty/JobMarket/m4/boost.m4@ 860145

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 860145 was 363f28, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '404d2be35f6544290132fcbe8f79a4ff9c6584ad' as 'ThirdParty/JobMarket'

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