source: m4/boost.m4@ 0c74aa

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 0c74aa was 3b35e7, checked in by Frederik Heber <heber@…>, 11 years ago

Fixes due to update to Ubuntu 14.04.

  • subdir-objects is default behavior for automake.
  • INCLUDES is deprecated (in favor of AM_CPPFLAGS), made sure that every .._CPPFLAGS includes AM_CPPFLAGS.
  • updated boost.m4 (serial 22), re-added missing macros.
  • qwt.m4 does not use QString in constructor, as it pulls in QtCore dependency.
  • VectorUnitTest lacked libboost_system dep.
  • Property mode set to 100644
File size: 49.2 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
817# BOOST_NUMERIC_UBLAS()
818# --------------------------
819# Look for Boost.NumericUblas (Basic Linear Algebra)
820BOOST_DEFUN([Numeric_Ublas],
821[BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp])
822])# BOOST_NUMERIC_UBLAS
823
824
825# BOOST_NUMERIC_CONVERSION()
826# --------------------------
827# Look for Boost.NumericConversion (policy-based numeric conversion)
828BOOST_DEFUN([Numeric_Conversion],
829[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
830])# BOOST_NUMERIC_CONVERSION
831
832
833# BOOST_OPTIONAL()
834# ----------------
835# Look for Boost.Optional
836BOOST_DEFUN([Optional],
837[BOOST_FIND_HEADER([boost/optional.hpp])])
838
839
840# BOOST_PREPROCESSOR()
841# --------------------
842# Look for Boost.Preprocessor
843BOOST_DEFUN([Preprocessor],
844[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
845
846
847# BOOST_PROPERTY_TREE([PREFERRED-RT-OPT])
848# -----------------------------------------
849# Look for Boost.Property_Tree. For the documentation of PREFERRED-RT-OPT,
850# see the documentation of BOOST_FIND_LIB above.
851BOOST_DEFUN([Property_Tree],
852[BOOST_FIND_LIB([property_tree], [$1],
853 [boost/property_tree/ptree.hpp],
854 [boost::property_tree::ptree pt; boost::property_tree::read_xml d("test", pt);])
855])# BOOST_PROPERTY_TREE
856
857
858# BOOST_RANDOM()
859# --------------------
860# Look for Boost.Random
861BOOST_DEFUN([Random],
862[BOOST_FIND_HEADER([boost/random/random_number_generator.hpp])])
863
864
865# BOOST_UNORDERED()
866# -----------------
867# Look for Boost.Unordered
868BOOST_DEFUN([Unordered],
869[BOOST_FIND_HEADER([boost/unordered_map.hpp])])
870
871
872# BOOST_UUID()
873# ------------
874# Look for Boost.Uuid
875BOOST_DEFUN([Uuid],
876[BOOST_FIND_HEADER([boost/uuid/uuid.hpp])])
877
878
879# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
880# -----------------------------------------
881# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT,
882# see the documentation of BOOST_FIND_LIB above.
883BOOST_DEFUN([Program_Options],
884[BOOST_FIND_LIB([program_options], [$1],
885 [boost/program_options.hpp],
886 [boost::program_options::options_description d("test");])
887])# BOOST_PROGRAM_OPTIONS
888
889
890
891# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
892# ------------------------------------
893# Save VARIABLE, and define it via `python-config --FLAG`.
894# Substitute BOOST_PYTHON_VARIABLE.
895m4_define([_BOOST_PYTHON_CONFIG],
896[AC_SUBST([BOOST_PYTHON_$1],
897 [`python-config --$2 2>/dev/null`])dnl
898boost_python_save_$1=$$1
899$1="$$1 $BOOST_PYTHON_$1"])
900
901
902# BOOST_PYTHON([PREFERRED-RT-OPT])
903# --------------------------------
904# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
905# see the documentation of BOOST_FIND_LIB above.
906BOOST_DEFUN([Python],
907[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
908_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
909_BOOST_PYTHON_CONFIG([LIBS], [libs])
910m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
911BOOST_FIND_LIBS([python], [python python3], [$1],
912 [boost/python.hpp],
913 [], [BOOST_PYTHON_MODULE(empty) {}])
914CPPFLAGS=$boost_python_save_CPPFLAGS
915LDFLAGS=$boost_python_save_LDFLAGS
916LIBS=$boost_python_save_LIBS
917])# BOOST_PYTHON
918
919
920# BOOST_REF()
921# -----------
922# Look for Boost.Ref
923BOOST_DEFUN([Ref],
924[BOOST_FIND_HEADER([boost/ref.hpp])])
925
926
927# BOOST_REGEX([PREFERRED-RT-OPT])
928# -------------------------------
929# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
930# documentation of BOOST_FIND_LIB above.
931BOOST_DEFUN([Regex],
932[BOOST_FIND_LIB([regex], [$1],
933 [boost/regex.hpp],
934 [boost::regex exp("*"); boost::regex_match("foo", exp);])
935])# BOOST_REGEX
936
937
938# BOOST_SERIALIZATION([PREFERRED-RT-OPT])
939# ---------------------------------------
940# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
941# the documentation of BOOST_FIND_LIB above.
942BOOST_DEFUN([Serialization],
943[BOOST_FIND_LIB([serialization], [$1],
944 [boost/archive/text_oarchive.hpp],
945 [std::ostream* o = 0; // Cheap way to get an ostream...
946 boost::archive::text_oarchive t(*o);])
947])# BOOST_SERIALIZATION
948
949
950# BOOST_SIGNALS([PREFERRED-RT-OPT])
951# ---------------------------------
952# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
953# documentation of BOOST_FIND_LIB above.
954BOOST_DEFUN([Signals],
955[BOOST_FIND_LIB([signals], [$1],
956 [boost/signal.hpp],
957 [boost::signal<void ()> s;])
958])# BOOST_SIGNALS
959
960
961# BOOST_SIGNALS2()
962# ----------------
963# Look for Boost.Signals2 (new since 1.39.0).
964BOOST_DEFUN([Signals2],
965[BOOST_FIND_HEADER([boost/signals2.hpp])
966])# BOOST_SIGNALS2
967
968
969# BOOST_SMART_PTR()
970# -----------------
971# Look for Boost.SmartPtr
972BOOST_DEFUN([Smart_Ptr],
973[BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
974BOOST_FIND_HEADER([boost/shared_ptr.hpp])
975])
976
977
978# BOOST_STATICASSERT()
979# --------------------
980# Look for Boost.StaticAssert
981BOOST_DEFUN([StaticAssert],
982[BOOST_FIND_HEADER([boost/static_assert.hpp])])
983
984
985# BOOST_STRING_ALGO()
986# -------------------
987# Look for Boost.StringAlgo
988BOOST_DEFUN([String_Algo],
989[BOOST_FIND_HEADER([boost/algorithm/string.hpp])
990])
991
992
993# BOOST_SYSTEM([PREFERRED-RT-OPT])
994# --------------------------------
995# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
996# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
997# 1.35.0.
998BOOST_DEFUN([System],
999[BOOST_FIND_LIB([system], [$1],
1000 [boost/system/error_code.hpp],
1001 [boost::system::error_code e; e.clear();])
1002])# BOOST_SYSTEM
1003
1004
1005# BOOST_TEST([PREFERRED-RT-OPT])
1006# ------------------------------
1007# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
1008# documentation of BOOST_FIND_LIB above.
1009BOOST_DEFUN([Test],
1010[m4_pattern_allow([^BOOST_CHECK$])dnl
1011BOOST_FIND_LIB([unit_test_framework], [$1],
1012 [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
1013 [using boost::unit_test::test_suite;
1014 test_suite* init_unit_test_suite(int argc, char ** argv)
1015 { return NULL; }])
1016])# BOOST_TEST
1017
1018
1019# BOOST_THREAD([PREFERRED-RT-OPT])
1020# ---------------------------------
1021# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
1022# documentation of BOOST_FIND_LIB above.
1023BOOST_DEFUN([Thread],
1024[dnl Having the pthread flag is required at least on GCC3 where
1025dnl boost/thread.hpp would complain if we try to compile without
1026dnl -pthread on GNU/Linux.
1027AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
1028boost_thread_save_LIBS=$LIBS
1029boost_thread_save_LDFLAGS=$LDFLAGS
1030boost_thread_save_CPPFLAGS=$CPPFLAGS
1031# Link-time dependency from thread to system was added as of 1.49.0.
1032if test $boost_major_version -ge 149; then
1033BOOST_SYSTEM([$1])
1034fi # end of the Boost.System check.
1035m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
1036LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1037LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
1038CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
1039
1040# When compiling for the Windows platform, the threads library is named
1041# differently.
1042case $host_os in
1043 (*mingw*) boost_thread_lib_ext=_win32;;
1044esac
1045BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
1046 [$1],
1047 [boost/thread.hpp], [boost::thread t; boost::mutex m;])
1048
1049BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1050BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
1051BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
1052LIBS=$boost_thread_save_LIBS
1053LDFLAGS=$boost_thread_save_LDFLAGS
1054CPPFLAGS=$boost_thread_save_CPPFLAGS
1055])# BOOST_THREAD
1056
1057AU_ALIAS([BOOST_THREADS], [BOOST_THREAD])
1058
1059
1060# BOOST_TOKENIZER()
1061# -----------------
1062# Look for Boost.Tokenizer
1063BOOST_DEFUN([Tokenizer],
1064[BOOST_FIND_HEADER([boost/tokenizer.hpp])])
1065
1066
1067# BOOST_TRIBOOL()
1068# ---------------
1069# Look for Boost.Tribool
1070BOOST_DEFUN([Tribool],
1071[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
1072BOOST_FIND_HEADER([boost/logic/tribool.hpp])
1073])
1074
1075
1076# BOOST_TUPLE()
1077# -------------
1078# Look for Boost.Tuple
1079BOOST_DEFUN([Tuple],
1080[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
1081
1082
1083# BOOST_TYPETRAITS()
1084# --------------------
1085# Look for Boost.TypeTraits
1086BOOST_DEFUN([TypeTraits],
1087[BOOST_FIND_HEADER([boost/type_traits.hpp])])
1088
1089
1090# BOOST_UTILITY()
1091# ---------------
1092# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
1093# etc.)
1094BOOST_DEFUN([Utility],
1095[BOOST_FIND_HEADER([boost/utility.hpp])])
1096
1097
1098# BOOST_VARIANT()
1099# ---------------
1100# Look for Boost.Variant.
1101BOOST_DEFUN([Variant],
1102[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
1103BOOST_FIND_HEADER([boost/variant.hpp])])
1104
1105
1106# BOOST_POINTER_CONTAINER()
1107# ------------------------
1108# Look for Boost.PointerContainer
1109BOOST_DEFUN([Pointer_Container],
1110[BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp])
1111BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp])
1112BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])
1113BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp])
1114BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp])
1115BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp])
1116])# BOOST_POINTER_CONTAINER
1117
1118
1119# BOOST_WAVE([PREFERRED-RT-OPT])
1120# ------------------------------
1121# NOTE: If you intend to use Wave/Spirit with thread support, make sure you
1122# call BOOST_THREAD first.
1123# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
1124# documentation of BOOST_FIND_LIB above.
1125BOOST_DEFUN([Wave],
1126[AC_REQUIRE([BOOST_FILESYSTEM])dnl
1127AC_REQUIRE([BOOST_DATE_TIME])dnl
1128boost_wave_save_LIBS=$LIBS
1129boost_wave_save_LDFLAGS=$LDFLAGS
1130m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
1131LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \
1132$BOOST_THREAD_LIBS"
1133LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \
1134$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
1135BOOST_FIND_LIB([wave], [$1],
1136 [boost/wave.hpp],
1137 [boost::wave::token_id id; get_token_name(id);])
1138LIBS=$boost_wave_save_LIBS
1139LDFLAGS=$boost_wave_save_LDFLAGS
1140])# BOOST_WAVE
1141
1142
1143# BOOST_XPRESSIVE()
1144# -----------------
1145# Look for Boost.Xpressive (new since 1.36.0).
1146BOOST_DEFUN([Xpressive],
1147[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
1148
1149
1150# ----------------- #
1151# Internal helpers. #
1152# ----------------- #
1153
1154
1155# _BOOST_PTHREAD_FLAG()
1156# ---------------------
1157# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
1158# which must be used in CPPFLAGS and LIBS.
1159#
1160# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
1161# boost/thread.hpp will trigger a #error if -pthread isn't used:
1162# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
1163# is not turned on. Please set the correct command line options for
1164# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
1165#
1166# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
1167AC_DEFUN([_BOOST_PTHREAD_FLAG],
1168[AC_REQUIRE([AC_PROG_CXX])dnl
1169AC_REQUIRE([AC_CANONICAL_HOST])dnl
1170AC_LANG_PUSH([C++])dnl
1171AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
1172[ boost_cv_pthread_flag=
1173 # The ordering *is* (sometimes) important. Some notes on the
1174 # individual items follow:
1175 # (none): in case threads are in libc; should be tried before -Kthread and
1176 # other compiler flags to prevent continual compiler warnings
1177 # -lpthreads: AIX (must check this before -lpthread)
1178 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1179 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1180 # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1181 # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
1182 # -pthreads: Solaris/GCC
1183 # -mthreads: MinGW32/GCC, Lynx/GCC
1184 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1185 # doesn't hurt to check since this sometimes defines pthreads too;
1186 # also defines -D_REENTRANT)
1187 # ... -mt is also the pthreads flag for HP/aCC
1188 # -lpthread: GNU Linux, etc.
1189 # --thread-safe: KAI C++
1190 case $host_os in #(
1191 *solaris*)
1192 # On Solaris (at least, for some versions), libc contains stubbed
1193 # (non-functional) versions of the pthreads routines, so link-based
1194 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
1195 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
1196 # a function called by this macro, so we could check for that, but
1197 # who knows whether they'll stub that too in a future libc.) So,
1198 # we'll just look for -pthreads and -lpthread first:
1199 boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
1200 *)
1201 boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
1202 -pthreads -mthreads -lpthread --thread-safe -mt";;
1203 esac
1204 # Generate the test file.
1205 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
1206 [pthread_t th; pthread_join(th, 0);
1207 pthread_attr_init(0); pthread_cleanup_push(0, 0);
1208 pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
1209 for boost_pthread_flag in '' $boost_pthread_flags; do
1210 boost_pthread_ok=false
1211dnl Re-use the test file already generated.
1212 boost_pthreads__save_LIBS=$LIBS
1213 LIBS="$LIBS $boost_pthread_flag"
1214 AC_LINK_IFELSE([],
1215 [if grep ".*$boost_pthread_flag" conftest.err; then
1216 echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
1217 else
1218 boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
1219 fi])
1220 LIBS=$boost_pthreads__save_LIBS
1221 $boost_pthread_ok && break
1222 done
1223])
1224AC_LANG_POP([C++])dnl
1225])# _BOOST_PTHREAD_FLAG
1226
1227
1228# _BOOST_gcc_test(MAJOR, MINOR)
1229# -----------------------------
1230# Internal helper for _BOOST_FIND_COMPILER_TAG.
1231m4_define([_BOOST_gcc_test],
1232["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
1233
1234# _BOOST_mingw_test(MAJOR, MINOR)
1235# -----------------------------
1236# Internal helper for _BOOST_FIND_COMPILER_TAG.
1237m4_define([_BOOST_mingw_test],
1238["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \
1239 (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1240 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl
1241
1242
1243# _BOOST_FIND_COMPILER_TAG()
1244# --------------------------
1245# Internal. When Boost is installed without --layout=system, each library
1246# filename will hold a suffix that encodes the compiler used during the
1247# build. The Boost build system seems to call this a `tag'.
1248AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
1249[AC_REQUIRE([AC_PROG_CXX])dnl
1250AC_REQUIRE([AC_CANONICAL_HOST])dnl
1251AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
1252[boost_cv_lib_tag=unknown
1253if test x$boost_cv_inc_path != xno; then
1254 AC_LANG_PUSH([C++])dnl
1255 # The following tests are mostly inspired by boost/config/auto_link.hpp
1256 # The list is sorted to most recent/common to oldest compiler (in order
1257 # to increase the likelihood of finding the right compiler with the
1258 # least number of compilation attempt).
1259 # Beware that some tests are sensible to the order (for instance, we must
1260 # look for MinGW before looking for GCC3).
1261 # I used one compilation test per compiler with a #error to recognize
1262 # each compiler so that it works even when cross-compiling (let me know
1263 # if you know a better approach).
1264 # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
1265 # como, edg, kcc, bck, mp, sw, tru, xlc
1266 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
1267 # the same defines as GCC's).
1268 for i in \
1269 _BOOST_mingw_test(4,8) \
1270 _BOOST_gcc_test(4, 8) \
1271 _BOOST_mingw_test(4,7) \
1272 _BOOST_gcc_test(4, 7) \
1273 _BOOST_mingw_test(4,6) \
1274 _BOOST_gcc_test(4, 6) \
1275 _BOOST_mingw_test(4,5) \
1276 _BOOST_gcc_test(4, 5) \
1277 _BOOST_mingw_test(4,4) \
1278 _BOOST_gcc_test(4, 4) \
1279 _BOOST_mingw_test(4,3) \
1280 _BOOST_gcc_test(4, 3) \
1281 _BOOST_mingw_test(4,2) \
1282 _BOOST_gcc_test(4, 2) \
1283 _BOOST_mingw_test(4,1) \
1284 _BOOST_gcc_test(4, 1) \
1285 _BOOST_mingw_test(4,0) \
1286 _BOOST_gcc_test(4, 0) \
1287 "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
1288 && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1289 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
1290 _BOOST_gcc_test(3, 4) \
1291 _BOOST_gcc_test(3, 3) \
1292 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
1293 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
1294 _BOOST_gcc_test(3, 2) \
1295 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
1296 _BOOST_gcc_test(3, 1) \
1297 _BOOST_gcc_test(3, 0) \
1298 "defined __BORLANDC__ @ bcb" \
1299 "defined __ICC && (defined __unix || defined __unix__) @ il" \
1300 "defined __ICL @ iw" \
1301 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
1302 _BOOST_gcc_test(2, 95) \
1303 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
1304 "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
1305 "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
1306 "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
1307 do
1308 boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
1309 boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
1310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1311#if $boost_tag_test
1312/* OK */
1313#else
1314# error $boost_tag_test
1315#endif
1316]])], [boost_cv_lib_tag=$boost_tag; break], [])
1317 done
1318AC_LANG_POP([C++])dnl
1319 case $boost_cv_lib_tag in #(
1320 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
1321 # to "gcc41" for instance.
1322 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
1323 gcc*)
1324 boost_tag_x=
1325 case $host_os in #(
1326 darwin*)
1327 if test $boost_major_version -ge 136; then
1328 # The `x' added in r46793 of Boost.
1329 boost_tag_x=x
1330 fi;;
1331 esac
1332 # We can specify multiple tags in this variable because it's used by
1333 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
1334 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
1335 ;; #(
1336 unknown)
1337 AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
1338 boost_cv_lib_tag=
1339 ;;
1340 esac
1341fi])dnl end of AC_CACHE_CHECK
1342])# _BOOST_FIND_COMPILER_TAG
1343
1344
1345# _BOOST_GUESS_WHETHER_TO_USE_MT()
1346# --------------------------------
1347# Compile a small test to try to guess whether we should favor MT (Multi
1348# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
1349AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
1350[# Check whether we do better use `mt' even though we weren't ask to.
1351AC_LANG_PUSH([C++])dnl
1352AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1353#if defined _REENTRANT || defined _MT || defined __MT__
1354/* use -mt */
1355#else
1356# error MT not needed
1357#endif
1358]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
1359AC_LANG_POP([C++])dnl
1360])
1361
1362# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
1363# -------------------------------------------------------------------
1364# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
1365# will break when Autoconf changes its internals. Requires that you manually
1366# rm -f conftest.$ac_objext in between to really different tests, otherwise
1367# you will try to link a conftest.o left behind by a previous test.
1368# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
1369# macro).
1370#
1371# Don't use "break" in the actions, as it would short-circuit some code
1372# this macro runs after the actions.
1373m4_define([_BOOST_AC_LINK_IFELSE],
1374[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
1375rm -f conftest$ac_exeext
1376boost_save_ac_ext=$ac_ext
1377boost_use_source=:
1378# If we already have a .o, re-use it. We change $ac_ext so that $ac_link
1379# tries to link the existing object file instead of compiling from source.
1380test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
1381 _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
1382AS_IF([_AC_DO_STDERR($ac_link) && {
1383 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
1384 test ! -s conftest.err
1385 } && test -s conftest$ac_exeext && {
1386 test "$cross_compiling" = yes ||
1387 $as_executable_p conftest$ac_exeext
1388dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
1389 }],
1390 [$2],
1391 [if $boost_use_source; then
1392 _AC_MSG_LOG_CONFTEST
1393 fi
1394 $3])
1395ac_objext=$boost_save_ac_objext
1396ac_ext=$boost_save_ac_ext
1397dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
1398dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
1399dnl as it would interfere with the next link command.
1400rm -f core conftest.err conftest_ipa8_conftest.oo \
1401 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
1402])# _BOOST_AC_LINK_IFELSE
1403
1404# Local Variables:
1405# mode: autoconf
1406# End:
Note: See TracBrowser for help on using the repository browser.