source: m4/boost.m4@ 4464ef

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_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 4464ef was 4da4de, checked in by Frederik Heber <heber@…>, 10 years ago

FIX: Added Boost::MultiIndexContainer check for MemDebug.

  • this requires CodePatterns 1.2.10 and allows finally enable-debug compilation with Ubuntu 14.04.
  • Property mode set to 100644
File size: 49.4 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_BIMAP()
543# ------------
544# Look for Boost.Bimap
545BOOST_DEFUN([Bimap],
546[BOOST_FIND_HEADER([boost/bimap.hpp])])
547
548
549# BOOST_BIND()
550# ------------
551# Look for Boost.Bind.
552BOOST_DEFUN([Bind],
553[BOOST_FIND_HEADER([boost/bind.hpp])])
554
555
556# BOOST_CAST()
557# ------------
558# Look for Boost.Cast
559BOOST_DEFUN([Cast],
560[BOOST_FIND_HEADER([boost/cast.hpp])])
561
562
563# BOOST_CHRONO()
564# --------------
565# Look for Boost.Chrono.
566BOOST_DEFUN([Chrono],
567[# Do we have to check for Boost.System? This link-time dependency was
568# added as of 1.35.0. If we have a version <1.35, we must not attempt to
569# find Boost.System as it didn't exist by then.
570if test $boost_major_version -ge 135; then
571 BOOST_SYSTEM([$1])
572fi # end of the Boost.System check.
573boost_filesystem_save_LIBS=$LIBS
574boost_filesystem_save_LDFLAGS=$LDFLAGS
575m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
576LIBS="$LIBS $BOOST_SYSTEM_LIBS"
577LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
578BOOST_FIND_LIB([chrono], [$1],
579 [boost/chrono.hpp],
580 [boost::chrono::thread_clock d;])
581if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
582 BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
583fi
584LIBS=$boost_filesystem_save_LIBS
585LDFLAGS=$boost_filesystem_save_LDFLAGS
586])# BOOST_CHRONO
587
588
589# BOOST_CONVERSION()
590# ------------------
591# Look for Boost.Conversion (cast / lexical_cast)
592BOOST_DEFUN([Conversion],
593[BOOST_FIND_HEADER([boost/cast.hpp])
594BOOST_FIND_HEADER([boost/lexical_cast.hpp])
595])# BOOST_CONVERSION
596
597
598# BOOST_CRC()
599# -----------
600# Look for Boost.CRC
601BOOST_DEFUN([CRC],
602[BOOST_FIND_HEADER([boost/crc.hpp])
603])# BOOST_CRC
604
605
606# BOOST_DATE_TIME([PREFERRED-RT-OPT])
607# -----------------------------------
608# Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the
609# documentation of BOOST_FIND_LIB above.
610BOOST_DEFUN([Date_Time],
611[BOOST_FIND_LIB([date_time], [$1],
612 [boost/date_time/posix_time/posix_time.hpp],
613 [boost::posix_time::ptime t;])
614])# BOOST_DATE_TIME
615
616
617# BOOST_EXCEPTION()
618# ------------
619# Look for Boost.Exception
620BOOST_DEFUN([Exception],
621[BOOST_FIND_HEADER([boost/exception/all.hpp])])
622
623
624# BOOST_FILESYSTEM([PREFERRED-RT-OPT])
625# ------------------------------------
626# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see
627# the documentation of BOOST_FIND_LIB above.
628# Do not check for boost/filesystem.hpp because this file was introduced in
629# 1.34.
630BOOST_DEFUN([Filesystem],
631[# Do we have to check for Boost.System? This link-time dependency was
632# added as of 1.35.0. If we have a version <1.35, we must not attempt to
633# find Boost.System as it didn't exist by then.
634if test $boost_major_version -ge 135; then
635 BOOST_SYSTEM([$1])
636fi # end of the Boost.System check.
637boost_filesystem_save_LIBS=$LIBS
638boost_filesystem_save_LDFLAGS=$LDFLAGS
639m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
640LIBS="$LIBS $BOOST_SYSTEM_LIBS"
641LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
642BOOST_FIND_LIB([filesystem], [$1],
643 [boost/filesystem/path.hpp], [boost::filesystem::path p;])
644if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
645 BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
646fi
647LIBS=$boost_filesystem_save_LIBS
648LDFLAGS=$boost_filesystem_save_LDFLAGS
649])# BOOST_FILESYSTEM
650
651
652# BOOST_FUSION()
653# -----------------
654# Look for Boost.Fusion
655BOOST_DEFUN([Fusion],
656[BOOST_FIND_HEADER([boost/fusion/sequence.hpp])])
657
658
659# BOOST_FLYWEIGHT()
660# -----------------
661# Look for Boost.Flyweight.
662BOOST_DEFUN([Flyweight],
663[dnl There's a hidden dependency on pthreads.
664AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
665BOOST_FIND_HEADER([boost/flyweight.hpp])
666AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag])
667])
668
669
670# BOOST_FOREACH()
671# ---------------
672# Look for Boost.Foreach.
673BOOST_DEFUN([Foreach],
674[BOOST_FIND_HEADER([boost/foreach.hpp])])
675
676
677# BOOST_FORMAT()
678# --------------
679# Look for Boost.Format.
680# Note: we can't check for boost/format/format_fwd.hpp because the header isn't
681# standalone. It can't be compiled because it triggers the following error:
682# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
683# does not name a type
684BOOST_DEFUN([Format],
685[BOOST_FIND_HEADER([boost/format.hpp])])
686
687
688# BOOST_FUNCTION()
689# ----------------
690# Look for Boost.Function
691BOOST_DEFUN([Function],
692[BOOST_FIND_HEADER([boost/function.hpp])])
693
694
695# BOOST_GEOMETRY()
696# ----------------
697# Look for Boost.Geometry (new since 1.47.0).
698BOOST_DEFUN([Geometry],
699[BOOST_FIND_HEADER([boost/geometry.hpp])
700])# BOOST_GEOMETRY
701
702
703# BOOST_GRAPH([PREFERRED-RT-OPT])
704# -------------------------------
705# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
706# documentation of BOOST_FIND_LIB above.
707BOOST_DEFUN([Graph],
708[BOOST_FIND_LIB([graph], [$1],
709 [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
710])# BOOST_GRAPH
711
712
713# BOOST_IOSTREAMS([PREFERRED-RT-OPT])
714# -----------------------------------
715# Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the
716# documentation of BOOST_FIND_LIB above.
717BOOST_DEFUN([IOStreams],
718[BOOST_FIND_LIB([iostreams], [$1],
719 [boost/iostreams/device/file_descriptor.hpp],
720 [boost::iostreams::file_descriptor fd; fd.close();])
721])# BOOST_IOSTREAMS
722
723
724# BOOST_HASH()
725# ------------
726# Look for Boost.Functional/Hash
727BOOST_DEFUN([Hash],
728[BOOST_FIND_HEADER([boost/functional/hash.hpp])])
729
730
731# BOOST_ITERATOR()
732# ------------
733# Look for Boost.Iterator
734BOOST_DEFUN([Iterator],
735[BOOST_FIND_HEADER([boost/iterator/iterator_adaptor.hpp])])
736
737
738# BOOST_LAMBDA()
739# --------------
740# Look for Boost.Lambda
741BOOST_DEFUN([Lambda],
742[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
743
744
745# BOOST_LOG([PREFERRED-RT-OPT])
746# -----------------------------
747# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
748# documentation of BOOST_FIND_LIB above.
749BOOST_DEFUN([Log],
750[BOOST_FIND_LIB([log], [$1],
751 [boost/log/core/core.hpp],
752 [boost::log::attribute a; a.get_value();])
753])# BOOST_LOG
754
755
756# BOOST_LOG_SETUP([PREFERRED-RT-OPT])
757# -----------------------------------
758# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
759# documentation of BOOST_FIND_LIB above.
760BOOST_DEFUN([Log_Setup],
761[AC_REQUIRE([BOOST_LOG])dnl
762BOOST_FIND_LIB([log_setup], [$1],
763 [boost/log/utility/setup/from_settings.hpp],
764 [boost::log::basic_settings<char> bs; bs.empty();])
765])# BOOST_LOG_SETUP
766
767
768# BOOST_MATH()
769# ------------
770# Look for Boost.Math
771# TODO: This library isn't header-only but it comes in multiple different
772# flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99,
773# libboost_math_c99f, libboost_math_c99l, libboost_math_tr1,
774# libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the
775# right thing anyway.
776BOOST_DEFUN([Math],
777[BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
778
779
780# BOOST_MPI([PREFERRED-RT-OPT])
781# -------------------------------
782# Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the
783# documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is
784# set, otherwise tries CXX
785#
786BOOST_DEFUN([MPI],
787[boost_save_CXX=${CXX}
788boost_save_CXXCPP=${CXXCPP}
789if test x"${MPICXX}" != x; then
790 CXX=${MPICXX}
791 CXXCPP="${MPICXX} -E"
792fi
793BOOST_FIND_LIB([mpi], [$1],
794 [boost/mpi.hpp],
795 [int argc = 0;
796 char **argv = 0;
797 boost::mpi::environment env(argc,argv);])
798CXX=${boost_save_CXX}
799CXXCPP=${boost_save_CXXCPP}
800])# BOOST_MPI
801
802
803# BOOST_MPL()
804# ------------------
805# Look for Boost.MPL
806BOOST_DEFUN([MPL],
807[BOOST_FIND_HEADER([boost/mpl/for_each.hpp])])
808
809
810# BOOST_MULTIARRAY()
811# ------------------
812# Look for Boost.MultiArray
813BOOST_DEFUN([MultiArray],
814[BOOST_FIND_HEADER([boost/multi_array.hpp])])
815
816# BOOST_MULTIINDEXCCONTAINER()
817# ------------------
818# Look for Boost.MultiIndexContainer
819BOOST_DEFUN([MultiIndexContainer],
820[BOOST_FIND_HEADER([boost/multi_index_container.hpp])])
821
822
823# BOOST_NUMERIC_UBLAS()
824# --------------------------
825# Look for Boost.NumericUblas (Basic Linear Algebra)
826BOOST_DEFUN([Numeric_Ublas],
827[BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp])
828])# BOOST_NUMERIC_UBLAS
829
830
831# BOOST_NUMERIC_CONVERSION()
832# --------------------------
833# Look for Boost.NumericConversion (policy-based numeric conversion)
834BOOST_DEFUN([Numeric_Conversion],
835[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
836])# BOOST_NUMERIC_CONVERSION
837
838
839# BOOST_OPTIONAL()
840# ----------------
841# Look for Boost.Optional
842BOOST_DEFUN([Optional],
843[BOOST_FIND_HEADER([boost/optional.hpp])])
844
845
846# BOOST_PREPROCESSOR()
847# --------------------
848# Look for Boost.Preprocessor
849BOOST_DEFUN([Preprocessor],
850[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
851
852
853# BOOST_PROPERTY_TREE([PREFERRED-RT-OPT])
854# -----------------------------------------
855# Look for Boost.Property_Tree. For the documentation of PREFERRED-RT-OPT,
856# see the documentation of BOOST_FIND_LIB above.
857BOOST_DEFUN([Property_Tree],
858[BOOST_FIND_LIB([property_tree], [$1],
859 [boost/property_tree/ptree.hpp],
860 [boost::property_tree::ptree pt; boost::property_tree::read_xml d("test", pt);])
861])# BOOST_PROPERTY_TREE
862
863
864# BOOST_RANDOM()
865# --------------------
866# Look for Boost.Random
867BOOST_DEFUN([Random],
868[BOOST_FIND_HEADER([boost/random/random_number_generator.hpp])])
869
870
871# BOOST_UNORDERED()
872# -----------------
873# Look for Boost.Unordered
874BOOST_DEFUN([Unordered],
875[BOOST_FIND_HEADER([boost/unordered_map.hpp])])
876
877
878# BOOST_UUID()
879# ------------
880# Look for Boost.Uuid
881BOOST_DEFUN([Uuid],
882[BOOST_FIND_HEADER([boost/uuid/uuid.hpp])])
883
884
885# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
886# -----------------------------------------
887# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT,
888# see the documentation of BOOST_FIND_LIB above.
889BOOST_DEFUN([Program_Options],
890[BOOST_FIND_LIB([program_options], [$1],
891 [boost/program_options.hpp],
892 [boost::program_options::options_description d("test");])
893])# BOOST_PROGRAM_OPTIONS
894
895
896
897# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
898# ------------------------------------
899# Save VARIABLE, and define it via `python-config --FLAG`.
900# Substitute BOOST_PYTHON_VARIABLE.
901m4_define([_BOOST_PYTHON_CONFIG],
902[AC_SUBST([BOOST_PYTHON_$1],
903 [`python-config --$2 2>/dev/null`])dnl
904boost_python_save_$1=$$1
905$1="$$1 $BOOST_PYTHON_$1"])
906
907
908# BOOST_PYTHON([PREFERRED-RT-OPT])
909# --------------------------------
910# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
911# see the documentation of BOOST_FIND_LIB above.
912BOOST_DEFUN([Python],
913[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
914_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
915_BOOST_PYTHON_CONFIG([LIBS], [libs])
916m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
917BOOST_FIND_LIBS([python], [python python3], [$1],
918 [boost/python.hpp],
919 [], [BOOST_PYTHON_MODULE(empty) {}])
920CPPFLAGS=$boost_python_save_CPPFLAGS
921LDFLAGS=$boost_python_save_LDFLAGS
922LIBS=$boost_python_save_LIBS
923])# BOOST_PYTHON
924
925
926# BOOST_REF()
927# -----------
928# Look for Boost.Ref
929BOOST_DEFUN([Ref],
930[BOOST_FIND_HEADER([boost/ref.hpp])])
931
932
933# BOOST_REGEX([PREFERRED-RT-OPT])
934# -------------------------------
935# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
936# documentation of BOOST_FIND_LIB above.
937BOOST_DEFUN([Regex],
938[BOOST_FIND_LIB([regex], [$1],
939 [boost/regex.hpp],
940 [boost::regex exp("*"); boost::regex_match("foo", exp);])
941])# BOOST_REGEX
942
943
944# BOOST_SERIALIZATION([PREFERRED-RT-OPT])
945# ---------------------------------------
946# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
947# the documentation of BOOST_FIND_LIB above.
948BOOST_DEFUN([Serialization],
949[BOOST_FIND_LIB([serialization], [$1],
950 [boost/archive/text_oarchive.hpp],
951 [std::ostream* o = 0; // Cheap way to get an ostream...
952 boost::archive::text_oarchive t(*o);])
953])# BOOST_SERIALIZATION
954
955
956# BOOST_SIGNALS([PREFERRED-RT-OPT])
957# ---------------------------------
958# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
959# documentation of BOOST_FIND_LIB above.
960BOOST_DEFUN([Signals],
961[BOOST_FIND_LIB([signals], [$1],
962 [boost/signal.hpp],
963 [boost::signal<void ()> s;])
964])# BOOST_SIGNALS
965
966
967# BOOST_SIGNALS2()
968# ----------------
969# Look for Boost.Signals2 (new since 1.39.0).
970BOOST_DEFUN([Signals2],
971[BOOST_FIND_HEADER([boost/signals2.hpp])
972])# BOOST_SIGNALS2
973
974
975# BOOST_SMART_PTR()
976# -----------------
977# Look for Boost.SmartPtr
978BOOST_DEFUN([Smart_Ptr],
979[BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
980BOOST_FIND_HEADER([boost/shared_ptr.hpp])
981])
982
983
984# BOOST_STATICASSERT()
985# --------------------
986# Look for Boost.StaticAssert
987BOOST_DEFUN([StaticAssert],
988[BOOST_FIND_HEADER([boost/static_assert.hpp])])
989
990
991# BOOST_STRING_ALGO()
992# -------------------
993# Look for Boost.StringAlgo
994BOOST_DEFUN([String_Algo],
995[BOOST_FIND_HEADER([boost/algorithm/string.hpp])
996])
997
998
999# BOOST_SYSTEM([PREFERRED-RT-OPT])
1000# --------------------------------
1001# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
1002# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
1003# 1.35.0.
1004BOOST_DEFUN([System],
1005[BOOST_FIND_LIB([system], [$1],
1006 [boost/system/error_code.hpp],
1007 [boost::system::error_code e; e.clear();])
1008])# BOOST_SYSTEM
1009
1010
1011# BOOST_TEST([PREFERRED-RT-OPT])
1012# ------------------------------
1013# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
1014# documentation of BOOST_FIND_LIB above.
1015BOOST_DEFUN([Test],
1016[m4_pattern_allow([^BOOST_CHECK$])dnl
1017BOOST_FIND_LIB([unit_test_framework], [$1],
1018 [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
1019 [using boost::unit_test::test_suite;
1020 test_suite* init_unit_test_suite(int argc, char ** argv)
1021 { return NULL; }])
1022])# BOOST_TEST
1023
1024
1025# BOOST_THREAD([PREFERRED-RT-OPT])
1026# ---------------------------------
1027# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
1028# documentation of BOOST_FIND_LIB above.
1029BOOST_DEFUN([Thread],
1030[dnl Having the pthread flag is required at least on GCC3 where
1031dnl boost/thread.hpp would complain if we try to compile without
1032dnl -pthread on GNU/Linux.
1033AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
1034boost_thread_save_LIBS=$LIBS
1035boost_thread_save_LDFLAGS=$LDFLAGS
1036boost_thread_save_CPPFLAGS=$CPPFLAGS
1037# Link-time dependency from thread to system was added as of 1.49.0.
1038if test $boost_major_version -ge 149; then
1039BOOST_SYSTEM([$1])
1040fi # end of the Boost.System check.
1041m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
1042LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1043LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
1044CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
1045
1046# When compiling for the Windows platform, the threads library is named
1047# differently.
1048case $host_os in
1049 (*mingw*) boost_thread_lib_ext=_win32;;
1050esac
1051BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
1052 [$1],
1053 [boost/thread.hpp], [boost::thread t; boost::mutex m;])
1054
1055BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1056BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
1057BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
1058LIBS=$boost_thread_save_LIBS
1059LDFLAGS=$boost_thread_save_LDFLAGS
1060CPPFLAGS=$boost_thread_save_CPPFLAGS
1061])# BOOST_THREAD
1062
1063AU_ALIAS([BOOST_THREADS], [BOOST_THREAD])
1064
1065
1066# BOOST_TOKENIZER()
1067# -----------------
1068# Look for Boost.Tokenizer
1069BOOST_DEFUN([Tokenizer],
1070[BOOST_FIND_HEADER([boost/tokenizer.hpp])])
1071
1072
1073# BOOST_TRIBOOL()
1074# ---------------
1075# Look for Boost.Tribool
1076BOOST_DEFUN([Tribool],
1077[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
1078BOOST_FIND_HEADER([boost/logic/tribool.hpp])
1079])
1080
1081
1082# BOOST_TUPLE()
1083# -------------
1084# Look for Boost.Tuple
1085BOOST_DEFUN([Tuple],
1086[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
1087
1088
1089# BOOST_TYPETRAITS()
1090# --------------------
1091# Look for Boost.TypeTraits
1092BOOST_DEFUN([TypeTraits],
1093[BOOST_FIND_HEADER([boost/type_traits.hpp])])
1094
1095
1096# BOOST_UTILITY()
1097# ---------------
1098# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
1099# etc.)
1100BOOST_DEFUN([Utility],
1101[BOOST_FIND_HEADER([boost/utility.hpp])])
1102
1103
1104# BOOST_VARIANT()
1105# ---------------
1106# Look for Boost.Variant.
1107BOOST_DEFUN([Variant],
1108[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
1109BOOST_FIND_HEADER([boost/variant.hpp])])
1110
1111
1112# BOOST_POINTER_CONTAINER()
1113# ------------------------
1114# Look for Boost.PointerContainer
1115BOOST_DEFUN([Pointer_Container],
1116[BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp])
1117BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp])
1118BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])
1119BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp])
1120BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp])
1121BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp])
1122])# BOOST_POINTER_CONTAINER
1123
1124
1125# BOOST_WAVE([PREFERRED-RT-OPT])
1126# ------------------------------
1127# NOTE: If you intend to use Wave/Spirit with thread support, make sure you
1128# call BOOST_THREAD first.
1129# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
1130# documentation of BOOST_FIND_LIB above.
1131BOOST_DEFUN([Wave],
1132[AC_REQUIRE([BOOST_FILESYSTEM])dnl
1133AC_REQUIRE([BOOST_DATE_TIME])dnl
1134boost_wave_save_LIBS=$LIBS
1135boost_wave_save_LDFLAGS=$LDFLAGS
1136m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
1137LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \
1138$BOOST_THREAD_LIBS"
1139LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \
1140$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
1141BOOST_FIND_LIB([wave], [$1],
1142 [boost/wave.hpp],
1143 [boost::wave::token_id id; get_token_name(id);])
1144LIBS=$boost_wave_save_LIBS
1145LDFLAGS=$boost_wave_save_LDFLAGS
1146])# BOOST_WAVE
1147
1148
1149# BOOST_XPRESSIVE()
1150# -----------------
1151# Look for Boost.Xpressive (new since 1.36.0).
1152BOOST_DEFUN([Xpressive],
1153[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
1154
1155
1156# ----------------- #
1157# Internal helpers. #
1158# ----------------- #
1159
1160
1161# _BOOST_PTHREAD_FLAG()
1162# ---------------------
1163# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
1164# which must be used in CPPFLAGS and LIBS.
1165#
1166# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
1167# boost/thread.hpp will trigger a #error if -pthread isn't used:
1168# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
1169# is not turned on. Please set the correct command line options for
1170# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
1171#
1172# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
1173AC_DEFUN([_BOOST_PTHREAD_FLAG],
1174[AC_REQUIRE([AC_PROG_CXX])dnl
1175AC_REQUIRE([AC_CANONICAL_HOST])dnl
1176AC_LANG_PUSH([C++])dnl
1177AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
1178[ boost_cv_pthread_flag=
1179 # The ordering *is* (sometimes) important. Some notes on the
1180 # individual items follow:
1181 # (none): in case threads are in libc; should be tried before -Kthread and
1182 # other compiler flags to prevent continual compiler warnings
1183 # -lpthreads: AIX (must check this before -lpthread)
1184 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1185 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1186 # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1187 # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
1188 # -pthreads: Solaris/GCC
1189 # -mthreads: MinGW32/GCC, Lynx/GCC
1190 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1191 # doesn't hurt to check since this sometimes defines pthreads too;
1192 # also defines -D_REENTRANT)
1193 # ... -mt is also the pthreads flag for HP/aCC
1194 # -lpthread: GNU Linux, etc.
1195 # --thread-safe: KAI C++
1196 case $host_os in #(
1197 *solaris*)
1198 # On Solaris (at least, for some versions), libc contains stubbed
1199 # (non-functional) versions of the pthreads routines, so link-based
1200 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
1201 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
1202 # a function called by this macro, so we could check for that, but
1203 # who knows whether they'll stub that too in a future libc.) So,
1204 # we'll just look for -pthreads and -lpthread first:
1205 boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
1206 *)
1207 boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
1208 -pthreads -mthreads -lpthread --thread-safe -mt";;
1209 esac
1210 # Generate the test file.
1211 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
1212 [pthread_t th; pthread_join(th, 0);
1213 pthread_attr_init(0); pthread_cleanup_push(0, 0);
1214 pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
1215 for boost_pthread_flag in '' $boost_pthread_flags; do
1216 boost_pthread_ok=false
1217dnl Re-use the test file already generated.
1218 boost_pthreads__save_LIBS=$LIBS
1219 LIBS="$LIBS $boost_pthread_flag"
1220 AC_LINK_IFELSE([],
1221 [if grep ".*$boost_pthread_flag" conftest.err; then
1222 echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
1223 else
1224 boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
1225 fi])
1226 LIBS=$boost_pthreads__save_LIBS
1227 $boost_pthread_ok && break
1228 done
1229])
1230AC_LANG_POP([C++])dnl
1231])# _BOOST_PTHREAD_FLAG
1232
1233
1234# _BOOST_gcc_test(MAJOR, MINOR)
1235# -----------------------------
1236# Internal helper for _BOOST_FIND_COMPILER_TAG.
1237m4_define([_BOOST_gcc_test],
1238["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
1239
1240# _BOOST_mingw_test(MAJOR, MINOR)
1241# -----------------------------
1242# Internal helper for _BOOST_FIND_COMPILER_TAG.
1243m4_define([_BOOST_mingw_test],
1244["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \
1245 (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1246 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl
1247
1248
1249# _BOOST_FIND_COMPILER_TAG()
1250# --------------------------
1251# Internal. When Boost is installed without --layout=system, each library
1252# filename will hold a suffix that encodes the compiler used during the
1253# build. The Boost build system seems to call this a `tag'.
1254AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
1255[AC_REQUIRE([AC_PROG_CXX])dnl
1256AC_REQUIRE([AC_CANONICAL_HOST])dnl
1257AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
1258[boost_cv_lib_tag=unknown
1259if test x$boost_cv_inc_path != xno; then
1260 AC_LANG_PUSH([C++])dnl
1261 # The following tests are mostly inspired by boost/config/auto_link.hpp
1262 # The list is sorted to most recent/common to oldest compiler (in order
1263 # to increase the likelihood of finding the right compiler with the
1264 # least number of compilation attempt).
1265 # Beware that some tests are sensible to the order (for instance, we must
1266 # look for MinGW before looking for GCC3).
1267 # I used one compilation test per compiler with a #error to recognize
1268 # each compiler so that it works even when cross-compiling (let me know
1269 # if you know a better approach).
1270 # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
1271 # como, edg, kcc, bck, mp, sw, tru, xlc
1272 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
1273 # the same defines as GCC's).
1274 for i in \
1275 _BOOST_mingw_test(4,8) \
1276 _BOOST_gcc_test(4, 8) \
1277 _BOOST_mingw_test(4,7) \
1278 _BOOST_gcc_test(4, 7) \
1279 _BOOST_mingw_test(4,6) \
1280 _BOOST_gcc_test(4, 6) \
1281 _BOOST_mingw_test(4,5) \
1282 _BOOST_gcc_test(4, 5) \
1283 _BOOST_mingw_test(4,4) \
1284 _BOOST_gcc_test(4, 4) \
1285 _BOOST_mingw_test(4,3) \
1286 _BOOST_gcc_test(4, 3) \
1287 _BOOST_mingw_test(4,2) \
1288 _BOOST_gcc_test(4, 2) \
1289 _BOOST_mingw_test(4,1) \
1290 _BOOST_gcc_test(4, 1) \
1291 _BOOST_mingw_test(4,0) \
1292 _BOOST_gcc_test(4, 0) \
1293 "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
1294 && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1295 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
1296 _BOOST_gcc_test(3, 4) \
1297 _BOOST_gcc_test(3, 3) \
1298 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
1299 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
1300 _BOOST_gcc_test(3, 2) \
1301 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
1302 _BOOST_gcc_test(3, 1) \
1303 _BOOST_gcc_test(3, 0) \
1304 "defined __BORLANDC__ @ bcb" \
1305 "defined __ICC && (defined __unix || defined __unix__) @ il" \
1306 "defined __ICL @ iw" \
1307 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
1308 _BOOST_gcc_test(2, 95) \
1309 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
1310 "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
1311 "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
1312 "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
1313 do
1314 boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
1315 boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
1316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1317#if $boost_tag_test
1318/* OK */
1319#else
1320# error $boost_tag_test
1321#endif
1322]])], [boost_cv_lib_tag=$boost_tag; break], [])
1323 done
1324AC_LANG_POP([C++])dnl
1325 case $boost_cv_lib_tag in #(
1326 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
1327 # to "gcc41" for instance.
1328 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
1329 gcc*)
1330 boost_tag_x=
1331 case $host_os in #(
1332 darwin*)
1333 if test $boost_major_version -ge 136; then
1334 # The `x' added in r46793 of Boost.
1335 boost_tag_x=x
1336 fi;;
1337 esac
1338 # We can specify multiple tags in this variable because it's used by
1339 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
1340 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
1341 ;; #(
1342 unknown)
1343 AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
1344 boost_cv_lib_tag=
1345 ;;
1346 esac
1347fi])dnl end of AC_CACHE_CHECK
1348])# _BOOST_FIND_COMPILER_TAG
1349
1350
1351# _BOOST_GUESS_WHETHER_TO_USE_MT()
1352# --------------------------------
1353# Compile a small test to try to guess whether we should favor MT (Multi
1354# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
1355AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
1356[# Check whether we do better use `mt' even though we weren't ask to.
1357AC_LANG_PUSH([C++])dnl
1358AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1359#if defined _REENTRANT || defined _MT || defined __MT__
1360/* use -mt */
1361#else
1362# error MT not needed
1363#endif
1364]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
1365AC_LANG_POP([C++])dnl
1366])
1367
1368# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
1369# -------------------------------------------------------------------
1370# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
1371# will break when Autoconf changes its internals. Requires that you manually
1372# rm -f conftest.$ac_objext in between to really different tests, otherwise
1373# you will try to link a conftest.o left behind by a previous test.
1374# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
1375# macro).
1376#
1377# Don't use "break" in the actions, as it would short-circuit some code
1378# this macro runs after the actions.
1379m4_define([_BOOST_AC_LINK_IFELSE],
1380[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
1381rm -f conftest$ac_exeext
1382boost_save_ac_ext=$ac_ext
1383boost_use_source=:
1384# If we already have a .o, re-use it. We change $ac_ext so that $ac_link
1385# tries to link the existing object file instead of compiling from source.
1386test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
1387 _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
1388AS_IF([_AC_DO_STDERR($ac_link) && {
1389 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
1390 test ! -s conftest.err
1391 } && test -s conftest$ac_exeext && {
1392 test "$cross_compiling" = yes ||
1393 $as_executable_p conftest$ac_exeext
1394dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
1395 }],
1396 [$2],
1397 [if $boost_use_source; then
1398 _AC_MSG_LOG_CONFTEST
1399 fi
1400 $3])
1401ac_objext=$boost_save_ac_objext
1402ac_ext=$boost_save_ac_ext
1403dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
1404dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
1405dnl as it would interfere with the next link command.
1406rm -f core conftest.err conftest_ipa8_conftest.oo \
1407 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
1408])# _BOOST_AC_LINK_IFELSE
1409
1410# Local Variables:
1411# mode: autoconf
1412# End:
Note: See TracBrowser for help on using the repository browser.