source: ThirdParty/CodePatterns/m4/boost.m4@ 4e8108

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation 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 PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 4e8108 was 41e8e2, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '084729c5923f0123e695fbe2548b393288c1f13d' as 'ThirdParty/CodePatterns'

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