Debian Codegraph @

m4/boost.m4

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