Debian Codegraph @

m4/boost.m4

raw ◀ ▶
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*/loongarch64*/ /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*/loongarch64* /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*/loongarch64* /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*/loongarch64* /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*/loongarch64* /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 BOOST_DEFUN([Filesystem],
•821 [dnl
822 AC_ARG_WITH([boost-filesystem],
823 AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
824 [specify the Boost Filesystem library to use;
825 e.g. --with-boost-filesystem=boost_filesystem-gcc-mt]),
826 [
827 if test "$withval" = "no"; then
828 want_boost="no"
829 elif test "$withval" = "yes"; then
830 want_boost="yes"
831 boost_filesystem_library=""
832 else
833 want_boost="yes"
834 boost_filesystem_library="${withval#boost_}"
835 fi
836 ],
837 [want_boost="yes"])
838 boost_filesystem_save_LIBS=$LIBS
839 boost_filesystem_save_LDFLAGS=$LDFLAGS
840 BOOST_FIND_LIBS([filesystem], [$boost_filesystem_library filesystem], [$1],
841 [boost/filesystem/path.hpp], [boost::filesystem::path p;])
842 LIBS=$boost_filesystem_save_LIBS
843 LDFLAGS=$boost_filesystem_save_LDFLAGS
844 ])# BOOST_FILESYSTEM
845
846
847 # BOOST_FLYWEIGHT()
848 # -----------------
849 # Look for Boost.Flyweight.
850 BOOST_DEFUN([Flyweight],
851 [dnl There's a hidden dependency on pthreads.
852 AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
853 BOOST_FIND_HEADER([boost/flyweight.hpp])
854 AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag])
855 ])
856
857
858 # BOOST_FOREACH()
859 # ---------------
860 # Look for Boost.Foreach.
861 BOOST_DEFUN([Foreach],
862 [BOOST_FIND_HEADER([boost/foreach.hpp])])
863
864
865 # BOOST_FORMAT()
866 # --------------
867 # Look for Boost.Format.
868 # Note: we can't check for boost/format/format_fwd.hpp because the header isn't
869 # standalone. It can't be compiled because it triggers the following error:
870 # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
871 # does not name a type
872 BOOST_DEFUN([Format],
873 [BOOST_FIND_HEADER([boost/format.hpp])])
874
875
876 # BOOST_FUNCTION()
877 # ----------------
878 # Look for Boost.Function
879 BOOST_DEFUN([Function],
880 [BOOST_FIND_HEADER([boost/function.hpp])])
881
882
883 # BOOST_GEOMETRY()
884 # ----------------
885 # Look for Boost.Geometry (new since 1.47.0).
886 BOOST_DEFUN([Geometry],
887 [BOOST_FIND_HEADER([boost/geometry.hpp])
888 ])# BOOST_GEOMETRY
889
890
891 # BOOST_GRAPH([PREFERRED-RT-OPT])
892 # -------------------------------
893 # Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
894 # documentation of BOOST_FIND_LIB above.
895 BOOST_DEFUN([Graph],
896 [BOOST_FIND_LIB([graph], [$1],
897 [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
898 ])# BOOST_GRAPH
899
900
901 # BOOST_IOSTREAMS([PREFERRED-RT-OPT])
902 # -----------------------------------
903 # Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the
904 # documentation of BOOST_FIND_LIB above.
905 BOOST_DEFUN([IOStreams],
906 [BOOST_FIND_LIB([iostreams], [$1],
907 [boost/iostreams/device/file_descriptor.hpp],
908 [boost::iostreams::file_descriptor fd; fd.close();])
909 ])# BOOST_IOSTREAMS
910
911
912 # BOOST_HASH()
913 # ------------
914 # Look for Boost.Functional/Hash
915 BOOST_DEFUN([Hash],
916 [BOOST_FIND_HEADER([boost/functional/hash.hpp])])
917
918
919 # BOOST_LAMBDA()
920 # --------------
921 # Look for Boost.Lambda
922 BOOST_DEFUN([Lambda],
923 [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
924
925
926 # BOOST_LOG([PREFERRED-RT-OPT])
927 # -----------------------------
928 # Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
929 # documentation of BOOST_FIND_LIB above.
930 BOOST_DEFUN([Log],
931 [BOOST_FIND_LIB([log], [$1],
932 [boost/log/core/core.hpp],
933 [boost::log::attribute a; a.get_value();])
934 ])# BOOST_LOG
935
936
937 # BOOST_LOG_SETUP([PREFERRED-RT-OPT])
938 # -----------------------------------
939 # Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
940 # documentation of BOOST_FIND_LIB above.
941 BOOST_DEFUN([Log_Setup],
942 [AC_REQUIRE([BOOST_LOG])dnl
943 BOOST_FIND_LIB([log_setup], [$1],
944 [boost/log/utility/setup/from_settings.hpp],
945 [boost::log::basic_settings<char> bs; bs.empty();])
946 ])# BOOST_LOG_SETUP
947
948
949 # BOOST_MATH()
950 # ------------
951 # Look for Boost.Math
952 # TODO: This library isn't header-only but it comes in multiple different
953 # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99,
954 # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1,
955 # libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the
956 # right thing anyway.
957 BOOST_DEFUN([Math],
958 [BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
959
960
961 # BOOST_MPI([PREFERRED-RT-OPT])
962 # -------------------------------
963 # Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the
964 # documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is
965 # set, otherwise tries CXX
966 #
967 BOOST_DEFUN([MPI],
968 [boost_save_CXX=${CXX}
969 boost_save_CXXCPP=${CXXCPP}
970 if test x"${MPICXX}" != x; then
971 CXX=${MPICXX}
972 CXXCPP="${MPICXX} -E"
973 fi
974 BOOST_FIND_LIB([mpi], [$1],
975 [boost/mpi.hpp],
976 [int argc = 0;
977 char **argv = 0;
978 boost::mpi::environment env(argc,argv);])
979 CXX=${boost_save_CXX}
980 CXXCPP=${boost_save_CXXCPP}
981 ])# BOOST_MPI
982
983
984 # BOOST_MULTIARRAY()
985 # ------------------
986 # Look for Boost.MultiArray
987 BOOST_DEFUN([MultiArray],
988 [BOOST_FIND_HEADER([boost/multi_array.hpp])])
989
990
991 # BOOST_NUMERIC_UBLAS()
992 # --------------------------
993 # Look for Boost.NumericUblas (Basic Linear Algebra)
994 BOOST_DEFUN([Numeric_Ublas],
995 [BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp])
996 ])# BOOST_NUMERIC_UBLAS
997
998
999 # BOOST_NUMERIC_CONVERSION()
1000 # --------------------------
1001 # Look for Boost.NumericConversion (policy-based numeric conversion)
1002 BOOST_DEFUN([Numeric_Conversion],
1003 [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
1004 ])# BOOST_NUMERIC_CONVERSION
1005
1006
1007 # BOOST_OPTIONAL()
1008 # ----------------
1009 # Look for Boost.Optional
1010 BOOST_DEFUN([Optional],
1011 [BOOST_FIND_HEADER([boost/optional.hpp])])
1012
1013
1014 # BOOST_PREPROCESSOR()
1015 # --------------------
1016 # Look for Boost.Preprocessor
1017 BOOST_DEFUN([Preprocessor],
1018 [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
1019
1020
1021 # BOOST_UNORDERED()
1022 # -----------------
1023 # Look for Boost.Unordered
1024 BOOST_DEFUN([Unordered],
1025 [BOOST_FIND_HEADER([boost/unordered_map.hpp])])
1026
1027
1028 # BOOST_UUID()
1029 # ------------
1030 # Look for Boost.Uuid
1031 BOOST_DEFUN([Uuid],
1032 [BOOST_FIND_HEADER([boost/uuid/uuid.hpp])])
1033
1034
1035 # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
1036 # -----------------------------------------
1037 # Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT,
1038 # see the documentation of BOOST_FIND_LIB above.
1039 BOOST_DEFUN([Program_Options],
1040 [BOOST_FIND_LIB([program_options], [$1],
1041 [boost/program_options.hpp],
1042 [boost::program_options::options_description d("test");])
1043 ])# BOOST_PROGRAM_OPTIONS
1044
1045
1046
1047 # _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
1048 # ------------------------------------
1049 # Save VARIABLE, and define it via `python-config --FLAG`.
1050 # Substitute BOOST_PYTHON_VARIABLE.
1051 #
1052 # CHANGED FOR GENGEO:
1053 # * Name of Python configuration file altered to reflect changes in
1054 # Python 3 to naming conventions
1055 m4_define([_BOOST_PYTHON_CONFIG],
1056 [AC_SUBST([BOOST_PYTHON_$1],
1057 [`python${PYTHON_VERSION}${PYTHON_VERSION_SUFFIX}-config --$2 2>/dev/null`])dnl
1058 boost_python_save_$1=$$1
1059 $1="$$1 $BOOST_PYTHON_$1"])
1060
1061
1062 # BOOST_PYTHON([PREFERRED-RT-OPT])
1063 # --------------------------------
1064 # Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
1065 # see the documentation of BOOST_FIND_LIB above.
1066 #
1067 # CHANGED FOR GENGEO:
1068 # * addition of --with-boost-python help-string macro, modified from
1069 # --with-boost-filesystem help-string macro above
1070 # * addition of $boost_python_library to second parameter of
1071 # BOOST_FIND_LIBS to allow the macro to be used
1072 BOOST_DEFUN([Python],
1073 [
1074 AC_ARG_WITH([boost-python],
1075 AS_HELP_STRING([--with-boost-python@<:@=special-lib@:>@],
1076 [specify the Boost Python library to use;
1077 e.g. --with-boost-python=boost_python-gcc-mt]),
1078 [
1079 if test "$withval" = "no"; then
1080 want_boost="no"
1081 elif test "$withval" = "yes"; then
1082 want_boost="yes"
1083 boost_python_library=""
1084 else
1085 want_boost="yes"
1086 boost_python_library="${withval#boost_}"
1087 fi
1088 ],
1089 [want_boost="yes"])
1090 _BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
1091 _BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
1092 _BOOST_PYTHON_CONFIG([LIBS], [libs])
1093 m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
1094 BOOST_FIND_LIBS([python], [$boost_python_library python python3], [$1],
1095 [boost/python.hpp],
1096 [], [BOOST_PYTHON_MODULE(empty) {}])
1097 CPPFLAGS=$boost_python_save_CPPFLAGS
1098 LDFLAGS=$boost_python_save_LDFLAGS
1099 LIBS=$boost_python_save_LIBS
1100 ])# BOOST_PYTHON
1101
1102
1103 # BOOST_REF()
1104 # -----------
1105 # Look for Boost.Ref
1106 BOOST_DEFUN([Ref],
1107 [BOOST_FIND_HEADER([boost/ref.hpp])])
1108
1109
1110 # BOOST_REGEX([PREFERRED-RT-OPT])
1111 # -------------------------------
1112 # Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
1113 # documentation of BOOST_FIND_LIB above.
1114 #
1115 # CHANGED FOR GENGEO:
1116 # * addition of --with-boost-regex help-string macro, modified from
1117 # --with-boost-filesystem help-string macro above
1118 # * replacement of BOOST_FIND_LIB with BOOST_FIND_LIBS
1119 # * addition of $boost_regex_library to second parameter of
1120 # BOOST_FIND_LIBS to allow the macro to be used
1121 BOOST_DEFUN([Regex],
1122 [
1123 AC_ARG_WITH([boost-regex],
1124 AS_HELP_STRING([--with-boost-regex<:@=special-lib@:>@],
1125 [specify the Boost Regex library to use;
1126 e.g. --with-boost-regex=boost_regex-gcc-mt]),
1127 [
1128 if test "$withval" = "no"; then
1129 want_boost="no"
1130 elif test "$withval" = "yes"; then
1131 want_boost="yes"
1132 boost_regex_library=""
1133 else
1134 want_boost="yes"
1135 boost_regex_library="${withval#boost_}"
1136 fi
1137 ],
1138 [want_boost="yes"])
1139 BOOST_FIND_LIBS([regex], [$boost_regex_library regex], [$1],
1140 [boost/regex.hpp],
1141 [boost::regex exp("*"); boost::regex_match("foo", exp);])
1142 ])# BOOST_REGEX
1143
1144
1145 # BOOST_SERIALIZATION([PREFERRED-RT-OPT])
1146 # ---------------------------------------
1147 # Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
1148 # the documentation of BOOST_FIND_LIB above.
1149 BOOST_DEFUN([Serialization],
1150 [BOOST_FIND_LIB([serialization], [$1],
1151 [boost/archive/text_oarchive.hpp],
1152 [std::ostream* o = 0; // Cheap way to get an ostream...
1153 boost::archive::text_oarchive t(*o);])
1154 ])# BOOST_SERIALIZATION
1155
1156
1157 # BOOST_SIGNALS([PREFERRED-RT-OPT])
1158 # ---------------------------------
1159 # Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
1160 # documentation of BOOST_FIND_LIB above.
1161 BOOST_DEFUN([Signals],
1162 [BOOST_FIND_LIB([signals], [$1],
1163 [boost/signal.hpp],
1164 [boost::signal<void ()> s;])
1165 ])# BOOST_SIGNALS
1166
1167
1168 # BOOST_SIGNALS2()
1169 # ----------------
1170 # Look for Boost.Signals2 (new since 1.39.0).
1171 BOOST_DEFUN([Signals2],
1172 [BOOST_FIND_HEADER([boost/signals2.hpp])
1173 ])# BOOST_SIGNALS2
1174
1175
1176 # BOOST_SMART_PTR()
1177 # -----------------
1178 # Look for Boost.SmartPtr
1179 BOOST_DEFUN([Smart_Ptr],
1180 [BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
1181 BOOST_FIND_HEADER([boost/shared_ptr.hpp])
1182 ])
1183
1184
1185 # BOOST_STATICASSERT()
1186 # --------------------
1187 # Look for Boost.StaticAssert
1188 BOOST_DEFUN([StaticAssert],
1189 [BOOST_FIND_HEADER([boost/static_assert.hpp])])
1190
1191
1192 # BOOST_STRING_ALGO()
1193 # -------------------
1194 # Look for Boost.StringAlgo
1195 BOOST_DEFUN([String_Algo],
1196 [BOOST_FIND_HEADER([boost/algorithm/string.hpp])
1197 ])
1198
1199
1200 # BOOST_SYSTEM([PREFERRED-RT-OPT])
1201 # --------------------------------
1202 # Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
1203 # documentation of BOOST_FIND_LIB above. This library was introduced in Boost
1204 # 1.35.0.
1205 #
1206 # CHANGED FOR GENGEO:
1207 # * addition of --with-boost-system help-string macro, modified from
1208 # --with-boost-filesystem help-string macro above
1209 # * replacement of BOOST_FIND_LIB with BOOST_FIND_LIBS
1210 # * addition of $boost_system_library to second parameter of
1211 # BOOST_FIND_LIBS to allow the macro to be used
1212 BOOST_DEFUN([System],
1213 [
1214 AC_ARG_WITH([boost-system],
1215 AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
1216 [specify the Boost System library to use (Boost 1.35 and above);
1217 e.g. --with-boost-system=boost_system-gcc-mt]),
1218 [
1219 if test "$withval" = "no"; then
1220 want_boost="no"
1221 elif test "$withval" = "yes"; then
1222 want_boost="yes"
1223 boost_system_library=""
1224 else
1225 want_boost="yes"
1226 boost_system_library="${withval#boost_}"
1227 fi
1228 ],
1229 [want_boost="yes"])
1230 BOOST_FIND_LIBS([system], [$boost_system_library system], [$1],
1231 [boost/system/error_code.hpp],
1232 [boost::system::error_code e; e.clear();])
1233 ])# BOOST_SYSTEM
1234
1235
1236 # BOOST_TEST([PREFERRED-RT-OPT])
1237 # ------------------------------
1238 # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
1239 # documentation of BOOST_FIND_LIB above.
1240 BOOST_DEFUN([Test],
1241 [m4_pattern_allow([^BOOST_CHECK$])dnl
1242 BOOST_FIND_LIB([unit_test_framework], [$1],
1243 [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
1244 [using boost::unit_test::test_suite;
1245 test_suite* init_unit_test_suite(int argc, char ** argv)
1246 { return NULL; }])
1247 ])# BOOST_TEST
1248
1249
1250 # BOOST_THREAD([PREFERRED-RT-OPT])
1251 # ---------------------------------
1252 # Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
1253 # documentation of BOOST_FIND_LIB above.
1254 BOOST_DEFUN([Thread],
1255 [dnl Having the pthread flag is required at least on GCC3 where
1256 dnl boost/thread.hpp would complain if we try to compile without
1257 dnl -pthread on GNU/Linux.
1258 AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
1259 boost_thread_save_LIBS=$LIBS
1260 boost_thread_save_LDFLAGS=$LDFLAGS
1261 boost_thread_save_CPPFLAGS=$CPPFLAGS
1262 # Link-time dependency from thread to system was added as of 1.49.0.
1263 if test $boost_major_version -ge 149; then
1264 BOOST_SYSTEM([$1])
1265 fi # end of the Boost.System check.
1266 m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
1267 LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1268 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
1269 CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
1270
1271 # When compiling for the Windows platform, the threads library is named
1272 # differently.
1273 case $host_os in
1274 (*mingw*) boost_thread_lib_ext=_win32;;
1275 esac
1276 BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
1277 [$1],
1278 [boost/thread.hpp], [boost::thread t; boost::mutex m;])
1279
1280 BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
1281 BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
1282 BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
1283 LIBS=$boost_thread_save_LIBS
1284 LDFLAGS=$boost_thread_save_LDFLAGS
1285 CPPFLAGS=$boost_thread_save_CPPFLAGS
1286 ])# BOOST_THREAD
1287
1288 AU_ALIAS([BOOST_THREADS], [BOOST_THREAD])
1289
1290
1291 # BOOST_TOKENIZER()
1292 # -----------------
1293 # Look for Boost.Tokenizer
1294 BOOST_DEFUN([Tokenizer],
1295 [BOOST_FIND_HEADER([boost/tokenizer.hpp])])
1296
1297
1298 # BOOST_TRIBOOL()
1299 # ---------------
1300 # Look for Boost.Tribool
1301 BOOST_DEFUN([Tribool],
1302 [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
1303 BOOST_FIND_HEADER([boost/logic/tribool.hpp])
1304 ])
1305
1306
1307 # BOOST_TUPLE()
1308 # -------------
1309 # Look for Boost.Tuple
1310 BOOST_DEFUN([Tuple],
1311 [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
1312
1313
1314 # BOOST_TYPETRAITS()
1315 # --------------------
1316 # Look for Boost.TypeTraits
1317 BOOST_DEFUN([TypeTraits],
1318 [BOOST_FIND_HEADER([boost/type_traits.hpp])])
1319
1320
1321 # BOOST_UTILITY()
1322 # ---------------
1323 # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
1324 # etc.)
1325 BOOST_DEFUN([Utility],
1326 [BOOST_FIND_HEADER([boost/utility.hpp])])
1327
1328
1329 # BOOST_VARIANT()
1330 # ---------------
1331 # Look for Boost.Variant.
1332 BOOST_DEFUN([Variant],
1333 [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
1334 BOOST_FIND_HEADER([boost/variant.hpp])])
1335
1336
1337 # BOOST_POINTER_CONTAINER()
1338 # ------------------------
1339 # Look for Boost.PointerContainer
1340 BOOST_DEFUN([Pointer_Container],
1341 [BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp])
1342 BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp])
1343 BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])
1344 BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp])
1345 BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp])
1346 BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp])
1347 ])# BOOST_POINTER_CONTAINER
1348
1349
1350 # BOOST_WAVE([PREFERRED-RT-OPT])
1351 # ------------------------------
1352 # NOTE: If you intend to use Wave/Spirit with thread support, make sure you
1353 # call BOOST_THREAD first.
1354 # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
1355 # documentation of BOOST_FIND_LIB above.
1356 BOOST_DEFUN([Wave],
1357 [AC_REQUIRE([BOOST_FILESYSTEM])dnl
1358 AC_REQUIRE([BOOST_DATE_TIME])dnl
1359 boost_wave_save_LIBS=$LIBS
1360 boost_wave_save_LDFLAGS=$LDFLAGS
1361 m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
1362 LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \
1363 $BOOST_THREAD_LIBS"
1364 LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \
1365 $BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
1366 BOOST_FIND_LIB([wave], [$1],
1367 [boost/wave.hpp],
1368 [boost::wave::token_id id; get_token_name(id);])
1369 LIBS=$boost_wave_save_LIBS
1370 LDFLAGS=$boost_wave_save_LDFLAGS
1371 ])# BOOST_WAVE
1372
1373
1374 # BOOST_XPRESSIVE()
1375 # -----------------
1376 # Look for Boost.Xpressive (new since 1.36.0).
1377 BOOST_DEFUN([Xpressive],
1378 [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
1379
1380
1381 # ----------------- #
1382 # Internal helpers. #
1383 # ----------------- #
1384
1385
1386 # _BOOST_PTHREAD_FLAG()
1387 # ---------------------
1388 # Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
1389 # which must be used in CPPFLAGS and LIBS.
1390 #
1391 # Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
1392 # boost/thread.hpp will trigger a #error if -pthread isn't used:
1393 # boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
1394 # is not turned on. Please set the correct command line options for
1395 # threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
1396 #
1397 # Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
1398 AC_DEFUN([_BOOST_PTHREAD_FLAG],
1399 [AC_REQUIRE([AC_PROG_CXX])dnl
1400 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1401 AC_LANG_PUSH([C++])dnl
1402 AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
1403 [ boost_cv_pthread_flag=
1404 # The ordering *is* (sometimes) important. Some notes on the
1405 # individual items follow:
1406 # (none): in case threads are in libc; should be tried before -Kthread and
1407 # other compiler flags to prevent continual compiler warnings
1408 # -lpthreads: AIX (must check this before -lpthread)
1409 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
1410 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
1411 # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
1412 # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
1413 # -pthreads: Solaris/GCC
1414 # -mthreads: MinGW32/GCC, Lynx/GCC
1415 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
1416 # doesn't hurt to check since this sometimes defines pthreads too;
1417 # also defines -D_REENTRANT)
1418 # ... -mt is also the pthreads flag for HP/aCC
1419 # -lpthread: GNU Linux, etc.
1420 # --thread-safe: KAI C++
1421 case $host_os in #(
1422 *solaris*)
1423 # On Solaris (at least, for some versions), libc contains stubbed
1424 # (non-functional) versions of the pthreads routines, so link-based
1425 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
1426 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
1427 # a function called by this macro, so we could check for that, but
1428 # who knows whether they'll stub that too in a future libc.) So,
1429 # we'll just look for -pthreads and -lpthread first:
1430 boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
1431 *)
1432 boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
1433 -pthreads -mthreads -lpthread --thread-safe -mt";;
1434 esac
1435 # Generate the test file.
1436 AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
1437 [pthread_t th; pthread_join(th, 0);
1438 pthread_attr_init(0); pthread_cleanup_push(0, 0);
1439 pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
1440 for boost_pthread_flag in '' $boost_pthread_flags; do
1441 boost_pthread_ok=false
1442 dnl Re-use the test file already generated.
1443 boost_pthreads__save_LIBS=$LIBS
1444 LIBS="$LIBS $boost_pthread_flag"
1445 AC_LINK_IFELSE([],
1446 [if grep ".*$boost_pthread_flag" conftest.err; then
1447 echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
1448 else
1449 boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
1450 fi])
1451 LIBS=$boost_pthreads__save_LIBS
1452 $boost_pthread_ok && break
1453 done
1454 ])
1455 AC_LANG_POP([C++])dnl
1456 ])# _BOOST_PTHREAD_FLAG
1457
1458
1459 # _BOOST_gcc_test(MAJOR, MINOR)
1460 # -----------------------------
1461 # Internal helper for _BOOST_FIND_COMPILER_TAG.
1462 m4_define([_BOOST_gcc_test],
1463 ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
1464
1465 # _BOOST_mingw_test(MAJOR, MINOR)
1466 # -----------------------------
1467 # Internal helper for _BOOST_FIND_COMPILER_TAG.
1468 m4_define([_BOOST_mingw_test],
1469 ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \
1470 (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1471 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl
1472
1473
1474 # _BOOST_FIND_COMPILER_TAG()
1475 # --------------------------
1476 # Internal. When Boost is installed without --layout=system, each library
1477 # filename will hold a suffix that encodes the compiler used during the
1478 # build. The Boost build system seems to call this a `tag'.
1479 AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
1480 [AC_REQUIRE([AC_PROG_CXX])dnl
1481 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1482 AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
1483 [boost_cv_lib_tag=unknown
1484 if test x$boost_cv_inc_path != xno; then
1485 AC_LANG_PUSH([C++])dnl
1486 # The following tests are mostly inspired by boost/config/auto_link.hpp
1487 # The list is sorted to most recent/common to oldest compiler (in order
1488 # to increase the likelihood of finding the right compiler with the
1489 # least number of compilation attempt).
1490 # Beware that some tests are sensible to the order (for instance, we must
1491 # look for MinGW before looking for GCC3).
1492 # I used one compilation test per compiler with a #error to recognize
1493 # each compiler so that it works even when cross-compiling (let me know
1494 # if you know a better approach).
1495 # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
1496 # como, edg, kcc, bck, mp, sw, tru, xlc
1497 # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
1498 # the same defines as GCC's).
1499 for i in \
1500 _BOOST_mingw_test(6, 2) \
1501 _BOOST_gcc_test(6, 2) \
1502 _BOOST_mingw_test(6, 1) \
1503 _BOOST_gcc_test(6, 1) \
1504 _BOOST_mingw_test(6, 0) \
1505 _BOOST_gcc_test(6, 0) \
1506 _BOOST_mingw_test(5, 4) \
1507 _BOOST_gcc_test(5, 4) \
1508 _BOOST_mingw_test(5, 3) \
1509 _BOOST_gcc_test(5, 3) \
1510 _BOOST_mingw_test(5, 2) \
1511 _BOOST_gcc_test(5, 2) \
1512 _BOOST_mingw_test(5, 1) \
1513 _BOOST_gcc_test(5, 1) \
1514 _BOOST_mingw_test(5, 0) \
1515 _BOOST_gcc_test(5, 0) \
1516 _BOOST_mingw_test(4, 10) \
1517 _BOOST_gcc_test(4, 10) \
1518 _BOOST_mingw_test(4, 9) \
1519 _BOOST_gcc_test(4, 9) \
1520 _BOOST_mingw_test(4,8) \
1521 _BOOST_gcc_test(4, 8) \
1522 _BOOST_mingw_test(4,7) \
1523 _BOOST_gcc_test(4, 7) \
1524 _BOOST_mingw_test(4,6) \
1525 _BOOST_gcc_test(4, 6) \
1526 _BOOST_mingw_test(4,5) \
1527 _BOOST_gcc_test(4, 5) \
1528 _BOOST_mingw_test(4,4) \
1529 _BOOST_gcc_test(4, 4) \
1530 _BOOST_mingw_test(4,3) \
1531 _BOOST_gcc_test(4, 3) \
1532 _BOOST_mingw_test(4,2) \
1533 _BOOST_gcc_test(4, 2) \
1534 _BOOST_mingw_test(4,1) \
1535 _BOOST_gcc_test(4, 1) \
1536 _BOOST_mingw_test(4,0) \
1537 _BOOST_gcc_test(4, 0) \
1538 "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
1539 && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
1540 || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
1541 _BOOST_gcc_test(3, 4) \
1542 _BOOST_gcc_test(3, 3) \
1543 "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
1544 "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
1545 _BOOST_gcc_test(3, 2) \
1546 "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
1547 _BOOST_gcc_test(3, 1) \
1548 _BOOST_gcc_test(3, 0) \
1549 "defined __BORLANDC__ @ bcb" \
1550 "defined __ICC && (defined __unix || defined __unix__) @ il" \
1551 "defined __ICL @ iw" \
1552 "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
1553 _BOOST_gcc_test(2, 95) \
1554 "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
1555 "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
1556 "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
1557 "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
1558 do
1559 boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
1560 boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
1561 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1562 #if $boost_tag_test
1563 /* OK */
1564 #else
1565 # error $boost_tag_test
1566 #endif
1567 ]])], [boost_cv_lib_tag=$boost_tag; break], [])
1568 done
1569 AC_LANG_POP([C++])dnl
1570 case $boost_cv_lib_tag in #(
1571 # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
1572 # to "gcc41" for instance.
1573 *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
1574 gcc*)
1575 boost_tag_x=
1576 case $host_os in #(
1577 darwin*)
1578 if test $boost_major_version -ge 136; then
1579 # The `x' added in r46793 of Boost.
1580 boost_tag_x=x
1581 fi;;
1582 esac
1583 # We can specify multiple tags in this variable because it's used by
1584 # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
1585 boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
1586 ;; #(
1587 unknown)
1588 AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
1589 boost_cv_lib_tag=
1590 ;;
1591 esac
1592 fi])dnl end of AC_CACHE_CHECK
1593 ])# _BOOST_FIND_COMPILER_TAG
1594
1595
1596 # _BOOST_GUESS_WHETHER_TO_USE_MT()
1597 # --------------------------------
1598 # Compile a small test to try to guess whether we should favor MT (Multi
1599 # Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
1600 AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
1601 [# Check whether we do better use `mt' even though we weren't ask to.
1602 AC_LANG_PUSH([C++])dnl
1603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1604 #if defined _REENTRANT || defined _MT || defined __MT__
1605 /* use -mt */
1606 #else
1607 # error MT not needed
1608 #endif
1609 ]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
1610 AC_LANG_POP([C++])dnl
1611 ])
1612
1613 # _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
1614 # -------------------------------------------------------------------
1615 # Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
1616 # will break when Autoconf changes its internals. Requires that you manually
1617 # rm -f conftest.$ac_objext in between to really different tests, otherwise
1618 # you will try to link a conftest.o left behind by a previous test.
1619 # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
1620 # macro).
1621 #
1622 # Don't use "break" in the actions, as it would short-circuit some code
1623 # this macro runs after the actions.
1624 m4_define([_BOOST_AC_LINK_IFELSE],
1625 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
1626 rm -f conftest$ac_exeext
1627 boost_save_ac_ext=$ac_ext
1628 boost_use_source=:
1629 # If we already have a .o, re-use it. We change $ac_ext so that $ac_link
1630 # tries to link the existing object file instead of compiling from source.
1631 test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
1632 _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
1633 AS_IF([_AC_DO_STDERR($ac_link) && {
1634 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
1635 test ! -s conftest.err
1636 } && test -s conftest$ac_exeext && {
1637 test "$cross_compiling" = yes ||
1638 $as_executable_p conftest$ac_exeext
1639 dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
1640 }],
1641 [$2],
1642 [if $boost_use_source; then
1643 _AC_MSG_LOG_CONFTEST
1644 fi
1645 $3])
1646 ac_objext=$boost_save_ac_objext
1647 ac_ext=$boost_save_ac_ext
1648 dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
1649 dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
1650 dnl as it would interfere with the next link command.
1651 rm -f core conftest.err conftest_ipa8_conftest.oo \
1652 conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
1653 ])# _BOOST_AC_LINK_IFELSE
1654
1655 # Local Variables:
1656 # mode: autoconf
1657 # End: