| [79de12] | 1 | # boost.m4: Locate Boost headers and libraries for autoconf-based projects. | 
|---|
|  | 2 | # Copyright (C) 2007, 2008, 2009, 2010, 2011  Benoit Sigoure <tsuna@lrde.epita.fr> | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # This program is free software: you can redistribute it and/or modify | 
|---|
|  | 5 | # it under the terms of the GNU General Public License as published by | 
|---|
|  | 6 | # the Free Software Foundation, either version 3 of the License, or | 
|---|
|  | 7 | # (at your option) any later version. | 
|---|
|  | 8 | # | 
|---|
|  | 9 | # Additional permission under section 7 of the GNU General Public | 
|---|
|  | 10 | # License, version 3 ("GPLv3"): | 
|---|
|  | 11 | # | 
|---|
|  | 12 | # If you convey this file as part of a work that contains a | 
|---|
|  | 13 | # configuration script generated by Autoconf, you may do so under | 
|---|
|  | 14 | # terms of your choice. | 
|---|
|  | 15 | # | 
|---|
|  | 16 | # This program is distributed in the hope that it will be useful, | 
|---|
|  | 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
|  | 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
|  | 19 | # GNU General Public License for more details. | 
|---|
|  | 20 | # | 
|---|
|  | 21 | # You should have received a copy of the GNU General Public License | 
|---|
|  | 22 | # along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
|  | 23 |  | 
|---|
|  | 24 | m4_define([_BOOST_SERIAL], [m4_translit([ | 
|---|
| [f08ae7] | 25 | # serial 16 | 
|---|
| [79de12] | 26 | ], [# | 
|---|
|  | 27 | ], [])]) | 
|---|
|  | 28 |  | 
|---|
|  | 29 | # Original sources can be found at http://github.com/tsuna/boost.m4 | 
|---|
|  | 30 | # You can fetch the latest version of the script by doing: | 
|---|
|  | 31 | #   wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 | 
|---|
|  | 32 |  | 
|---|
|  | 33 | # ------ # | 
|---|
|  | 34 | # README # | 
|---|
|  | 35 | # ------ # | 
|---|
|  | 36 |  | 
|---|
|  | 37 | # This file provides several macros to use the various Boost libraries. | 
|---|
|  | 38 | # The first macro is BOOST_REQUIRE.  It will simply check if it's possible to | 
|---|
|  | 39 | # find the Boost headers of a given (optional) minimum version and it will | 
|---|
|  | 40 | # define BOOST_CPPFLAGS accordingly.  It will add an option --with-boost to | 
|---|
|  | 41 | # your configure so that users can specify non standard locations. | 
|---|
|  | 42 | # If the user's environment contains BOOST_ROOT and --with-boost was not | 
|---|
|  | 43 | # specified, --with-boost=$BOOST_ROOT is implicitly used. | 
|---|
|  | 44 | # For more README and documentation, go to http://github.com/tsuna/boost.m4 | 
|---|
|  | 45 | # Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL.  If you don't, don't worry, | 
|---|
|  | 46 | # simply read the README, it will show you what to do step by step. | 
|---|
|  | 47 |  | 
|---|
|  | 48 | m4_pattern_forbid([^_?(BOOST|Boost)_]) | 
|---|
|  | 49 |  | 
|---|
|  | 50 |  | 
|---|
|  | 51 | # _BOOST_SED_CPP(SED-PROGRAM, PROGRAM, | 
|---|
|  | 52 | #                [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | 
|---|
|  | 53 | # -------------------------------------------------------- | 
|---|
|  | 54 | # Same as AC_EGREP_CPP, but leave the result in conftest.i. | 
|---|
|  | 55 | # | 
|---|
|  | 56 | # SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP.  It is expanded | 
|---|
|  | 57 | # in double-quotes, so escape your double quotes. | 
|---|
|  | 58 | # | 
|---|
|  | 59 | # It could be useful to turn this into a macro which extracts the | 
|---|
|  | 60 | # value of any macro. | 
|---|
|  | 61 | m4_define([_BOOST_SED_CPP], | 
|---|
|  | 62 | [AC_LANG_PREPROC_REQUIRE()dnl | 
|---|
|  | 63 | AC_REQUIRE([AC_PROG_SED])dnl | 
|---|
|  | 64 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) | 
|---|
|  | 65 | AS_IF([dnl eval is necessary to expand ac_cpp. | 
|---|
|  | 66 | dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. | 
|---|
|  | 67 | dnl Beware of Windows end-of-lines, for instance if we are running | 
|---|
|  | 68 | dnl some Windows programs under Wine.  In that case, boost/version.hpp | 
|---|
|  | 69 | dnl is certainly using "\r\n", but the regular Unix shell will only | 
|---|
|  | 70 | dnl strip `\n' with backquotes, not the `\r'.  This results in | 
|---|
|  | 71 | dnl boost_cv_lib_version='1_37\r' for instance, which breaks | 
|---|
|  | 72 | dnl everything else. | 
|---|
|  | 73 | dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK | 
|---|
|  | 74 | (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | | 
|---|
|  | 75 | tr -d '\r' | | 
|---|
|  | 76 | $SED -n -e "$1" >conftest.i 2>&1], | 
|---|
|  | 77 | [$3], | 
|---|
|  | 78 | [$4]) | 
|---|
|  | 79 | rm -rf conftest* | 
|---|
|  | 80 | ])# AC_EGREP_CPP | 
|---|
|  | 81 |  | 
|---|
|  | 82 |  | 
|---|
|  | 83 |  | 
|---|
|  | 84 | # BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) | 
|---|
|  | 85 | # ----------------------------------------------- | 
|---|
|  | 86 | # Look for Boost.  If version is given, it must either be a literal of the form | 
|---|
|  | 87 | # "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a | 
|---|
|  | 88 | # variable "$var". | 
|---|
|  | 89 | # Defines the value BOOST_CPPFLAGS.  This macro only checks for headers with | 
|---|
|  | 90 | # the required version, it does not check for any of the Boost libraries. | 
|---|
|  | 91 | # On # success, defines HAVE_BOOST.  On failure, calls the optional | 
|---|
|  | 92 | # ACTION-IF-NOT-FOUND action if one was supplied. | 
|---|
|  | 93 | # Otherwise aborts with an error message. | 
|---|
|  | 94 | AC_DEFUN([BOOST_REQUIRE], | 
|---|
|  | 95 | [AC_REQUIRE([AC_PROG_CXX])dnl | 
|---|
|  | 96 | AC_REQUIRE([AC_PROG_GREP])dnl | 
|---|
|  | 97 | echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD | 
|---|
|  | 98 | boost_save_IFS=$IFS | 
|---|
|  | 99 | boost_version_req=$1 | 
|---|
|  | 100 | IFS=. | 
|---|
|  | 101 | set x $boost_version_req 0 0 0 | 
|---|
|  | 102 | IFS=$boost_save_IFS | 
|---|
|  | 103 | shift | 
|---|
|  | 104 | boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` | 
|---|
|  | 105 | boost_version_req_string=$[1].$[2].$[3] | 
|---|
|  | 106 | AC_ARG_WITH([boost], | 
|---|
|  | 107 | [AS_HELP_STRING([--with-boost=DIR], | 
|---|
|  | 108 | [prefix of Boost $1 @<:@guess@:>@])])dnl | 
|---|
|  | 109 | AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl | 
|---|
|  | 110 | # If BOOST_ROOT is set and the user has not provided a value to | 
|---|
|  | 111 | # --with-boost, then treat BOOST_ROOT as if it the user supplied it. | 
|---|
|  | 112 | if test x"$BOOST_ROOT" != x; then | 
|---|
|  | 113 | if test x"$with_boost" = x; then | 
|---|
|  | 114 | AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) | 
|---|
|  | 115 | with_boost=$BOOST_ROOT | 
|---|
|  | 116 | else | 
|---|
|  | 117 | AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) | 
|---|
|  | 118 | fi | 
|---|
|  | 119 | fi | 
|---|
|  | 120 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], | 
|---|
|  | 121 | ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl | 
|---|
|  | 122 | boost_save_CPPFLAGS=$CPPFLAGS | 
|---|
|  | 123 | AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string], | 
|---|
|  | 124 | [boost_cv_inc_path], | 
|---|
|  | 125 | [boost_cv_inc_path=no | 
|---|
|  | 126 | AC_LANG_PUSH([C++])dnl | 
|---|
|  | 127 | m4_pattern_allow([^BOOST_VERSION$])dnl | 
|---|
|  | 128 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp> | 
|---|
|  | 129 | #if !defined BOOST_VERSION | 
|---|
|  | 130 | # error BOOST_VERSION is not defined | 
|---|
|  | 131 | #elif BOOST_VERSION < $boost_version_req | 
|---|
|  | 132 | # error Boost headers version < $boost_version_req | 
|---|
|  | 133 | #endif | 
|---|
|  | 134 | ]])]) | 
|---|
|  | 135 | # If the user provided a value to --with-boost, use it and only it. | 
|---|
|  | 136 | case $with_boost in #( | 
|---|
| [004ae7] | 137 | ''|yes) set x '' /usr/local/include /usr/include \ | 
|---|
|  | 138 | /opt/local/include /opt/include \ | 
|---|
|  | 139 | C:/Boost/include;; #( | 
|---|
| [79de12] | 140 | *)      set x "$with_boost/include" "$with_boost";; | 
|---|
|  | 141 | esac | 
|---|
|  | 142 | shift | 
|---|
|  | 143 | for boost_dir | 
|---|
|  | 144 | do | 
|---|
|  | 145 | # Without --layout=system, Boost (or at least some versions) installs | 
|---|
|  | 146 | # itself in <prefix>/include/boost-<version>.  This inner loop helps to | 
|---|
|  | 147 | # find headers in such directories. | 
|---|
|  | 148 | # | 
|---|
|  | 149 | # Any ${boost_dir}/boost-x_xx directories are searched in reverse version | 
|---|
|  | 150 | # order followed by ${boost_dir}.  The final '.' is a sentinel for | 
|---|
|  | 151 | # searching $boost_dir" itself.  Entries are whitespace separated. | 
|---|
|  | 152 | # | 
|---|
|  | 153 | # I didn't indent this loop on purpose (to avoid over-indented code) | 
|---|
|  | 154 | boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ | 
|---|
|  | 155 | && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ | 
|---|
|  | 156 | && echo .` | 
|---|
|  | 157 | for boost_inc in $boost_layout_system_search_list | 
|---|
|  | 158 | do | 
|---|
|  | 159 | if test x"$boost_inc" != x.; then | 
|---|
|  | 160 | boost_inc="$boost_dir/$boost_inc" | 
|---|
|  | 161 | else | 
|---|
|  | 162 | boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list | 
|---|
|  | 163 | fi | 
|---|
|  | 164 | if test x"$boost_inc" != x; then | 
|---|
|  | 165 | # We are going to check whether the version of Boost installed | 
|---|
|  | 166 | # in $boost_inc is usable by running a compilation that | 
|---|
|  | 167 | # #includes it.  But if we pass a -I/some/path in which Boost | 
|---|
|  | 168 | # is not installed, the compiler will just skip this -I and | 
|---|
|  | 169 | # use other locations (either from CPPFLAGS, or from its list | 
|---|
|  | 170 | # of system include directories).  As a result we would use | 
|---|
|  | 171 | # header installed on the machine instead of the /some/path | 
|---|
|  | 172 | # specified by the user.  So in that precise case (trying | 
|---|
|  | 173 | # $boost_inc), make sure the version.hpp exists. | 
|---|
|  | 174 | # | 
|---|
|  | 175 | # Use test -e as there can be symlinks. | 
|---|
|  | 176 | test -e "$boost_inc/boost/version.hpp" || continue | 
|---|
|  | 177 | CPPFLAGS="$CPPFLAGS -I$boost_inc" | 
|---|
|  | 178 | fi | 
|---|
|  | 179 | AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) | 
|---|
|  | 180 | if test x"$boost_cv_inc_path" = xyes; then | 
|---|
|  | 181 | if test x"$boost_inc" != x; then | 
|---|
|  | 182 | boost_cv_inc_path=$boost_inc | 
|---|
|  | 183 | fi | 
|---|
|  | 184 | break 2 | 
|---|
|  | 185 | fi | 
|---|
|  | 186 | done | 
|---|
|  | 187 | done | 
|---|
|  | 188 | AC_LANG_POP([C++])dnl | 
|---|
|  | 189 | ]) | 
|---|
|  | 190 | case $boost_cv_inc_path in #( | 
|---|
|  | 191 | no) | 
|---|
|  | 192 | boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" | 
|---|
|  | 193 | m4_if([$2], [],  [AC_MSG_ERROR([$boost_errmsg])], | 
|---|
|  | 194 | [AC_MSG_NOTICE([$boost_errmsg])]) | 
|---|
|  | 195 | $2 | 
|---|
|  | 196 | ;;#( | 
|---|
|  | 197 | yes) | 
|---|
|  | 198 | BOOST_CPPFLAGS= | 
|---|
|  | 199 | ;;#( | 
|---|
|  | 200 | *) | 
|---|
|  | 201 | AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl | 
|---|
|  | 202 | ;; | 
|---|
|  | 203 | esac | 
|---|
|  | 204 | if test x"$boost_cv_inc_path" != xno; then | 
|---|
|  | 205 | AC_DEFINE([HAVE_BOOST], [1], | 
|---|
|  | 206 | [Defined if the requested minimum BOOST version is satisfied]) | 
|---|
|  | 207 | AC_CACHE_CHECK([for Boost's header version], | 
|---|
|  | 208 | [boost_cv_lib_version], | 
|---|
|  | 209 | [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl | 
|---|
|  | 210 | _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;q;}], | 
|---|
|  | 211 | [#include <boost/version.hpp> | 
|---|
|  | 212 | boost-lib-version = BOOST_LIB_VERSION], | 
|---|
|  | 213 | [boost_cv_lib_version=`cat conftest.i`])]) | 
|---|
|  | 214 | # e.g. "134" for 1_34_1 or "135" for 1_35 | 
|---|
|  | 215 | boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` | 
|---|
|  | 216 | case $boost_major_version in #( | 
|---|
|  | 217 | '' | *[[!0-9]]*) | 
|---|
|  | 218 | AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version]) | 
|---|
|  | 219 | ;; | 
|---|
|  | 220 | esac | 
|---|
|  | 221 | fi | 
|---|
|  | 222 | CPPFLAGS=$boost_save_CPPFLAGS | 
|---|
|  | 223 | ])# BOOST_REQUIRE | 
|---|
|  | 224 |  | 
|---|
|  | 225 | # BOOST_STATIC() | 
|---|
|  | 226 | # -------------- | 
|---|
|  | 227 | # Add the "--enable-static-boost" configure argument. If this argument is given | 
|---|
|  | 228 | # on the command line, static versions of the libraries will be looked up. | 
|---|
|  | 229 | AC_DEFUN([BOOST_STATIC], | 
|---|
|  | 230 | [AC_ARG_ENABLE([static-boost], | 
|---|
|  | 231 | [AC_HELP_STRING([--enable-static-boost], | 
|---|
|  | 232 | [Prefer the static boost libraries over the shared ones [no]])], | 
|---|
|  | 233 | [enable_static_boost=yes], | 
|---|
|  | 234 | [enable_static_boost=no])])# BOOST_STATIC | 
|---|
|  | 235 |  | 
|---|
|  | 236 | # BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) | 
|---|
|  | 237 | # -------------------------------------------------------------------------- | 
|---|
|  | 238 | # Wrapper around AC_CHECK_HEADER for Boost headers.  Useful to check for | 
|---|
|  | 239 | # some parts of the Boost library which are only made of headers and don't | 
|---|
|  | 240 | # require linking (such as Boost.Foreach). | 
|---|
|  | 241 | # | 
|---|
|  | 242 | # Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be | 
|---|
|  | 243 | # found in the first place, in which case by default a notice is issued to the | 
|---|
|  | 244 | # user.  Presumably if we haven't died already it's because it's OK to not have | 
|---|
|  | 245 | # Boost, which is why only a notice is issued instead of a hard error. | 
|---|
|  | 246 | # | 
|---|
|  | 247 | # Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in | 
|---|
|  | 248 | # case of success # (where HEADER-NAME is written LIKE_THIS, e.g., | 
|---|
|  | 249 | # HAVE_BOOST_FOREACH_HPP). | 
|---|
|  | 250 | AC_DEFUN([BOOST_FIND_HEADER], | 
|---|
|  | 251 | [AC_REQUIRE([BOOST_REQUIRE])dnl | 
|---|
|  | 252 | if test x"$boost_cv_inc_path" = xno; then | 
|---|
|  | 253 | m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) | 
|---|
|  | 254 | else | 
|---|
|  | 255 | AC_LANG_PUSH([C++])dnl | 
|---|
|  | 256 | boost_save_CPPFLAGS=$CPPFLAGS | 
|---|
|  | 257 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | 
|---|
|  | 258 | AC_CHECK_HEADER([$1], | 
|---|
|  | 259 | [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], | 
|---|
|  | 260 | [Define to 1 if you have <$1>])])], | 
|---|
|  | 261 | [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])]) | 
|---|
|  | 262 | CPPFLAGS=$boost_save_CPPFLAGS | 
|---|
|  | 263 | AC_LANG_POP([C++])dnl | 
|---|
|  | 264 | fi | 
|---|
|  | 265 | ])# BOOST_FIND_HEADER | 
|---|
|  | 266 |  | 
|---|
|  | 267 |  | 
|---|
|  | 268 | # BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], | 
|---|
|  | 269 | #                [CXX-PROLOGUE]) | 
|---|
|  | 270 | # ------------------------------------------------------------------------- | 
|---|
|  | 271 | # Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for | 
|---|
|  | 272 | # libboost_thread).  Check that HEADER-NAME works and check that | 
|---|
|  | 273 | # libboost_LIB-NAME can link with the code CXX-TEST.  The optional argument | 
|---|
|  | 274 | # CXX-PROLOGUE can be used to include some C++ code before the `main' | 
|---|
|  | 275 | # function. | 
|---|
|  | 276 | # | 
|---|
|  | 277 | # Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above). | 
|---|
|  | 278 | # | 
|---|
|  | 279 | # Boost libraries typically come compiled with several flavors (with different | 
|---|
|  | 280 | # runtime options) so PREFERRED-RT-OPT is the preferred suffix.  A suffix is one | 
|---|
|  | 281 | # or more of the following letters: sgdpn (in that order).  s = static | 
|---|
|  | 282 | # runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build, | 
|---|
|  | 283 | # n = (unsure) STLPort build without iostreams from STLPort (it looks like `n' | 
|---|
|  | 284 | # must always be used along with `p').  Additionally, PREFERRED-RT-OPT can | 
|---|
|  | 285 | # start with `mt-' to indicate that there is a preference for multi-thread | 
|---|
|  | 286 | # builds.  Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp | 
|---|
|  | 287 | # ...  If you want to make sure you have a specific version of Boost | 
|---|
|  | 288 | # (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. | 
|---|
|  | 289 | AC_DEFUN([BOOST_FIND_LIB], | 
|---|
|  | 290 | [AC_REQUIRE([BOOST_REQUIRE])dnl | 
|---|
|  | 291 | AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl | 
|---|
|  | 292 | AC_REQUIRE([BOOST_STATIC])dnl | 
|---|
|  | 293 | AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl | 
|---|
|  | 294 | if test x"$boost_cv_inc_path" = xno; then | 
|---|
|  | 295 | AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) | 
|---|
|  | 296 | else | 
|---|
|  | 297 | dnl The else branch is huge and wasn't intended on purpose. | 
|---|
|  | 298 | AC_LANG_PUSH([C++])dnl | 
|---|
|  | 299 | AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl | 
|---|
|  | 300 | AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl | 
|---|
|  | 301 | AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl | 
|---|
|  | 302 | AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl | 
|---|
|  | 303 | BOOST_FIND_HEADER([$3]) | 
|---|
|  | 304 | boost_save_CPPFLAGS=$CPPFLAGS | 
|---|
|  | 305 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | 
|---|
|  | 306 | # Now let's try to find the library.  The algorithm is as follows: first look | 
|---|
|  | 307 | # for a given library name according to the user's PREFERRED-RT-OPT.  For each | 
|---|
|  | 308 | # library name, we prefer to use the ones that carry the tag (toolset name). | 
|---|
|  | 309 | # Each library is searched through the various standard paths were Boost is | 
|---|
|  | 310 | # usually installed.  If we can't find the standard variants, we try to | 
|---|
|  | 311 | # enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist | 
|---|
|  | 312 | # but there's -obviously- libboost_threads-mt.dylib). | 
|---|
|  | 313 | AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib], | 
|---|
|  | 314 | [Boost_lib=no | 
|---|
|  | 315 | case "$2" in #( | 
|---|
|  | 316 | mt | mt-) boost_mt=-mt; boost_rtopt=;; #( | 
|---|
|  | 317 | mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #( | 
|---|
|  | 318 | *) boost_mt=; boost_rtopt=$2;; | 
|---|
|  | 319 | esac | 
|---|
|  | 320 | if test $enable_static_boost = yes; then | 
|---|
|  | 321 | boost_rtopt="s$boost_rtopt" | 
|---|
|  | 322 | fi | 
|---|
|  | 323 | # Find the proper debug variant depending on what we've been asked to find. | 
|---|
|  | 324 | case $boost_rtopt in #( | 
|---|
|  | 325 | *d*) boost_rt_d=$boost_rtopt;; #( | 
|---|
|  | 326 | *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn') | 
|---|
|  | 327 | boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( | 
|---|
|  | 328 | *) boost_rt_d='-d';; | 
|---|
|  | 329 | esac | 
|---|
|  | 330 | # If the PREFERRED-RT-OPT are not empty, prepend a `-'. | 
|---|
|  | 331 | test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" | 
|---|
|  | 332 | $boost_guess_use_mt && boost_mt=-mt | 
|---|
|  | 333 | # Look for the abs path the static archive. | 
|---|
|  | 334 | # $libext is computed by Libtool but let's make sure it's non empty. | 
|---|
|  | 335 | test -z "$libext" && | 
|---|
|  | 336 | AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?]) | 
|---|
|  | 337 | boost_save_ac_objext=$ac_objext | 
|---|
|  | 338 | # Generate the test file. | 
|---|
|  | 339 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3> | 
|---|
|  | 340 | $5], [$4])]) | 
|---|
|  | 341 | dnl Optimization hacks: compiling C++ is slow, especially with Boost.  What | 
|---|
|  | 342 | dnl we're trying to do here is guess the right combination of link flags | 
|---|
|  | 343 | dnl (LIBS / LDFLAGS) to use a given library.  This can take several | 
|---|
|  | 344 | dnl iterations before it succeeds and is thus *very* slow.  So what we do | 
|---|
|  | 345 | dnl instead is that we compile the code first (and thus get an object file, | 
|---|
|  | 346 | dnl typically conftest.o).  Then we try various combinations of link flags | 
|---|
|  | 347 | dnl until we succeed to link conftest.o in an executable.  The problem is | 
|---|
|  | 348 | dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always | 
|---|
|  | 349 | dnl remove all the temporary files including conftest.o.  So the trick here | 
|---|
|  | 350 | dnl is to temporarily change the value of ac_objext so that conftest.o is | 
|---|
|  | 351 | dnl preserved accross tests.  This is obviously fragile and I will burn in | 
|---|
|  | 352 | dnl hell for not respecting Autoconf's documented interfaces, but in the | 
|---|
|  | 353 | dnl mean time, it optimizes the macro by a factor of 5 to 30. | 
|---|
|  | 354 | dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left | 
|---|
|  | 355 | dnl empty because the test file is generated only once above (before we | 
|---|
|  | 356 | dnl start the for loops). | 
|---|
|  | 357 | AC_COMPILE_IFELSE([], | 
|---|
|  | 358 | [ac_objext=do_not_rm_me_plz], | 
|---|
|  | 359 | [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) | 
|---|
|  | 360 | ac_objext=$boost_save_ac_objext | 
|---|
|  | 361 | boost_failed_libs= | 
|---|
|  | 362 | # Don't bother to ident the 6 nested for loops, only the 2 innermost ones | 
|---|
|  | 363 | # matter. | 
|---|
|  | 364 | for boost_tag_ in -$boost_cv_lib_tag ''; do | 
|---|
|  | 365 | for boost_ver_ in -$boost_cv_lib_version ''; do | 
|---|
| [262ecc] | 366 | for boost_mt_ in $boost_mt '' -mt; do | 
|---|
| [79de12] | 367 | for boost_rtopt_ in $boost_rtopt '' -d; do | 
|---|
|  | 368 | for boost_lib in \ | 
|---|
|  | 369 | boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ | 
|---|
|  | 370 | boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \ | 
|---|
|  | 371 | boost_$1$boost_tag_$boost_mt_$boost_ver_ \ | 
|---|
|  | 372 | boost_$1$boost_tag_$boost_ver_ | 
|---|
|  | 373 | do | 
|---|
|  | 374 | # Avoid testing twice the same lib | 
|---|
|  | 375 | case $boost_failed_libs in #( | 
|---|
|  | 376 | *@$boost_lib@*) continue;; | 
|---|
|  | 377 | esac | 
|---|
|  | 378 | # If with_boost is empty, we'll search in /lib first, which is not quite | 
|---|
|  | 379 | # right so instead we'll try to a location based on where the headers are. | 
|---|
|  | 380 | boost_tmp_lib=$with_boost | 
|---|
|  | 381 | test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} | 
|---|
|  | 382 | for boost_ldpath in "$boost_tmp_lib/lib" '' \ | 
|---|
| [004ae7] | 383 | /usr/local/lib* /usr/lib* \ | 
|---|
|  | 384 | "$with_boost" C:/Boost/lib /lib* \ | 
|---|
|  | 385 | /opt/local/lib* /opt/lib* | 
|---|
| [79de12] | 386 | do | 
|---|
|  | 387 | test -e "$boost_ldpath" || continue | 
|---|
|  | 388 | boost_save_LDFLAGS=$LDFLAGS | 
|---|
|  | 389 | # Are we looking for a static library? | 
|---|
|  | 390 | case $boost_ldpath:$boost_rtopt_ in #( | 
|---|
|  | 391 | *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) | 
|---|
|  | 392 | Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext" | 
|---|
|  | 393 | test -e "$Boost_lib_LIBS" || continue;; #( | 
|---|
|  | 394 | *) # No: use -lboost_foo to find the shared library. | 
|---|
|  | 395 | Boost_lib_LIBS="-l$boost_lib";; | 
|---|
|  | 396 | esac | 
|---|
|  | 397 | boost_save_LIBS=$LIBS | 
|---|
|  | 398 | LIBS="$Boost_lib_LIBS $LIBS" | 
|---|
|  | 399 | test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" | 
|---|
|  | 400 | dnl First argument of AC_LINK_IFELSE left empty because the test file is | 
|---|
|  | 401 | dnl generated only once above (before we start the for loops). | 
|---|
|  | 402 | _BOOST_AC_LINK_IFELSE([], | 
|---|
|  | 403 | [Boost_lib=yes], [Boost_lib=no]) | 
|---|
|  | 404 | ac_objext=$boost_save_ac_objext | 
|---|
|  | 405 | LDFLAGS=$boost_save_LDFLAGS | 
|---|
|  | 406 | LIBS=$boost_save_LIBS | 
|---|
|  | 407 | if test x"$Boost_lib" = xyes; then | 
|---|
|  | 408 | Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath" | 
|---|
|  | 409 | Boost_lib_LDPATH="$boost_ldpath" | 
|---|
|  | 410 | break 6 | 
|---|
|  | 411 | else | 
|---|
|  | 412 | boost_failed_libs="$boost_failed_libs@$boost_lib@" | 
|---|
|  | 413 | fi | 
|---|
|  | 414 | done | 
|---|
|  | 415 | done | 
|---|
|  | 416 | done | 
|---|
|  | 417 | done | 
|---|
|  | 418 | done | 
|---|
|  | 419 | done | 
|---|
|  | 420 | rm -f conftest.$ac_objext | 
|---|
|  | 421 | ]) | 
|---|
|  | 422 | case $Boost_lib in #( | 
|---|
|  | 423 | no) _AC_MSG_LOG_CONFTEST | 
|---|
|  | 424 | AC_MSG_ERROR([cannot find the flags to link with Boost $1]) | 
|---|
|  | 425 | ;; | 
|---|
|  | 426 | esac | 
|---|
|  | 427 | AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl | 
|---|
|  | 428 | AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl | 
|---|
|  | 429 | AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl | 
|---|
|  | 430 | AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl | 
|---|
|  | 431 | CPPFLAGS=$boost_save_CPPFLAGS | 
|---|
|  | 432 | AS_VAR_POPDEF([Boost_lib])dnl | 
|---|
|  | 433 | AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl | 
|---|
|  | 434 | AS_VAR_POPDEF([Boost_lib_LDPATH])dnl | 
|---|
|  | 435 | AS_VAR_POPDEF([Boost_lib_LIBS])dnl | 
|---|
|  | 436 | AC_LANG_POP([C++])dnl | 
|---|
|  | 437 | fi | 
|---|
|  | 438 | ])# BOOST_FIND_LIB | 
|---|
|  | 439 |  | 
|---|
|  | 440 |  | 
|---|
|  | 441 | # --------------------------------------- # | 
|---|
|  | 442 | # Checks for the various Boost libraries. # | 
|---|
|  | 443 | # --------------------------------------- # | 
|---|
|  | 444 |  | 
|---|
|  | 445 | # List of boost libraries: http://www.boost.org/libs/libraries.htm | 
|---|
|  | 446 | # The page http://beta.boost.org/doc/libs is useful: it gives the first release | 
|---|
|  | 447 | # version of each library (among other things). | 
|---|
|  | 448 |  | 
|---|
|  | 449 | # BOOST_DEFUN(LIBRARY, CODE) | 
|---|
|  | 450 | # -------------------------- | 
|---|
|  | 451 | # Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE. | 
|---|
|  | 452 | # | 
|---|
|  | 453 | # Use indir to avoid the warning on underquoted macro name given to AC_DEFUN. | 
|---|
|  | 454 | m4_define([BOOST_DEFUN], | 
|---|
|  | 455 | [m4_indir([AC_DEFUN], | 
|---|
|  | 456 | m4_toupper([BOOST_$1]), | 
|---|
|  | 457 | [m4_pushdef([BOOST_Library], [$1])dnl | 
|---|
|  | 458 | $2 | 
|---|
|  | 459 | m4_popdef([BOOST_Library])dnl | 
|---|
|  | 460 | ]) | 
|---|
|  | 461 | ]) | 
|---|
|  | 462 |  | 
|---|
| [f08ae7] | 463 |  | 
|---|
|  | 464 | # BOOST_ANY() | 
|---|
|  | 465 | # ------------ | 
|---|
|  | 466 | # Look for Boost.Any | 
|---|
|  | 467 | BOOST_DEFUN([Any], | 
|---|
|  | 468 | [BOOST_FIND_HEADER([boost/any.hpp])]) | 
|---|
|  | 469 |  | 
|---|
|  | 470 |  | 
|---|
| [79de12] | 471 | # BOOST_ARRAY() | 
|---|
|  | 472 | # ------------- | 
|---|
|  | 473 | # Look for Boost.Array | 
|---|
|  | 474 | BOOST_DEFUN([Array], | 
|---|
|  | 475 | [BOOST_FIND_HEADER([boost/array.hpp])]) | 
|---|
|  | 476 |  | 
|---|
|  | 477 |  | 
|---|
|  | 478 | # BOOST_ASIO() | 
|---|
|  | 479 | # ------------ | 
|---|
|  | 480 | # Look for Boost.Asio (new in Boost 1.35). | 
|---|
|  | 481 | BOOST_DEFUN([Asio], | 
|---|
|  | 482 | [AC_REQUIRE([BOOST_SYSTEM])dnl | 
|---|
|  | 483 | BOOST_FIND_HEADER([boost/asio.hpp])]) | 
|---|
|  | 484 |  | 
|---|
|  | 485 |  | 
|---|
|  | 486 | # BOOST_BIND() | 
|---|
|  | 487 | # ------------ | 
|---|
|  | 488 | # Look for Boost.Bind | 
|---|
|  | 489 | BOOST_DEFUN([Bind], | 
|---|
|  | 490 | [BOOST_FIND_HEADER([boost/bind.hpp])]) | 
|---|
|  | 491 |  | 
|---|
|  | 492 |  | 
|---|
|  | 493 | # BOOST_CONVERSION() | 
|---|
|  | 494 | # ------------------ | 
|---|
|  | 495 | # Look for Boost.Conversion (cast / lexical_cast) | 
|---|
|  | 496 | BOOST_DEFUN([Conversion], | 
|---|
|  | 497 | [BOOST_FIND_HEADER([boost/cast.hpp]) | 
|---|
|  | 498 | BOOST_FIND_HEADER([boost/lexical_cast.hpp]) | 
|---|
|  | 499 | ])# BOOST_CONVERSION | 
|---|
|  | 500 |  | 
|---|
|  | 501 |  | 
|---|
|  | 502 | # BOOST_DATE_TIME([PREFERRED-RT-OPT]) | 
|---|
|  | 503 | # ----------------------------------- | 
|---|
|  | 504 | # Look for Boost.Date_Time.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 505 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 506 | BOOST_DEFUN([Date_Time], | 
|---|
|  | 507 | [BOOST_FIND_LIB([date_time], [$1], | 
|---|
|  | 508 | [boost/date_time/posix_time/posix_time.hpp], | 
|---|
|  | 509 | [boost::posix_time::ptime t;]) | 
|---|
|  | 510 | ])# BOOST_DATE_TIME | 
|---|
|  | 511 |  | 
|---|
|  | 512 |  | 
|---|
|  | 513 | # BOOST_EXCEPTION() | 
|---|
| [f08ae7] | 514 | # ------------ | 
|---|
| [79de12] | 515 | # Look for Boost.Exception | 
|---|
|  | 516 | BOOST_DEFUN([Exception], | 
|---|
|  | 517 | [BOOST_FIND_HEADER([boost/exception/all.hpp])]) | 
|---|
|  | 518 |  | 
|---|
|  | 519 |  | 
|---|
|  | 520 | # BOOST_FILESYSTEM([PREFERRED-RT-OPT]) | 
|---|
|  | 521 | # ------------------------------------ | 
|---|
|  | 522 | # Look for Boost.Filesystem.  For the documentation of PREFERRED-RT-OPT, see | 
|---|
|  | 523 | # the documentation of BOOST_FIND_LIB above. | 
|---|
|  | 524 | # Do not check for boost/filesystem.hpp because this file was introduced in | 
|---|
|  | 525 | # 1.34. | 
|---|
|  | 526 | BOOST_DEFUN([Filesystem], | 
|---|
|  | 527 | [# Do we have to check for Boost.System?  This link-time dependency was | 
|---|
|  | 528 | # added as of 1.35.0.  If we have a version <1.35, we must not attempt to | 
|---|
|  | 529 | # find Boost.System as it didn't exist by then. | 
|---|
|  | 530 | if test $boost_major_version -ge 135; then | 
|---|
|  | 531 | BOOST_SYSTEM([$1]) | 
|---|
|  | 532 | fi # end of the Boost.System check. | 
|---|
|  | 533 | boost_filesystem_save_LIBS=$LIBS | 
|---|
|  | 534 | boost_filesystem_save_LDFLAGS=$LDFLAGS | 
|---|
|  | 535 | m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl | 
|---|
|  | 536 | LIBS="$LIBS $BOOST_SYSTEM_LIBS" | 
|---|
|  | 537 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" | 
|---|
|  | 538 | BOOST_FIND_LIB([filesystem], [$1], | 
|---|
|  | 539 | [boost/filesystem/path.hpp], [boost::filesystem::path p;]) | 
|---|
|  | 540 | if test $enable_static_boost = yes && test $boost_major_version -ge 135; then | 
|---|
|  | 541 | AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"]) | 
|---|
|  | 542 | fi | 
|---|
|  | 543 | LIBS=$boost_filesystem_save_LIBS | 
|---|
|  | 544 | LDFLAGS=$boost_filesystem_save_LDFLAGS | 
|---|
|  | 545 | ])# BOOST_FILESYSTEM | 
|---|
|  | 546 |  | 
|---|
|  | 547 |  | 
|---|
|  | 548 | # BOOST_FOREACH() | 
|---|
|  | 549 | # --------------- | 
|---|
|  | 550 | # Look for Boost.Foreach | 
|---|
|  | 551 | BOOST_DEFUN([Foreach], | 
|---|
|  | 552 | [BOOST_FIND_HEADER([boost/foreach.hpp])]) | 
|---|
|  | 553 |  | 
|---|
|  | 554 |  | 
|---|
|  | 555 | # BOOST_FORMAT() | 
|---|
|  | 556 | # -------------- | 
|---|
|  | 557 | # Look for Boost.Format | 
|---|
|  | 558 | # Note: we can't check for boost/format/format_fwd.hpp because the header isn't | 
|---|
|  | 559 | # standalone.  It can't be compiled because it triggers the following error: | 
|---|
|  | 560 | # boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' | 
|---|
|  | 561 | #                                                  does not name a type | 
|---|
|  | 562 | BOOST_DEFUN([Format], | 
|---|
|  | 563 | [BOOST_FIND_HEADER([boost/format.hpp])]) | 
|---|
|  | 564 |  | 
|---|
|  | 565 |  | 
|---|
|  | 566 | # BOOST_FUNCTION() | 
|---|
|  | 567 | # ---------------- | 
|---|
|  | 568 | # Look for Boost.Function | 
|---|
|  | 569 | BOOST_DEFUN([Function], | 
|---|
|  | 570 | [BOOST_FIND_HEADER([boost/function.hpp])]) | 
|---|
|  | 571 |  | 
|---|
|  | 572 |  | 
|---|
| [619a0e] | 573 | # BOOST_FUSION() | 
|---|
|  | 574 | # ---------------- | 
|---|
|  | 575 | # Look for Boost.Fusion | 
|---|
|  | 576 | BOOST_DEFUN([Fusion], | 
|---|
|  | 577 | [BOOST_FIND_HEADER([boost/fusion/sequence.hpp])]) | 
|---|
|  | 578 |  | 
|---|
|  | 579 |  | 
|---|
| [79de12] | 580 | # BOOST_GRAPH([PREFERRED-RT-OPT]) | 
|---|
|  | 581 | # ------------------------------- | 
|---|
|  | 582 | # Look for Boost.Graphs.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 583 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 584 | BOOST_DEFUN([Graph], | 
|---|
|  | 585 | [BOOST_FIND_LIB([graph], [$1], | 
|---|
|  | 586 | [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) | 
|---|
|  | 587 | ])# BOOST_GRAPH | 
|---|
|  | 588 |  | 
|---|
|  | 589 |  | 
|---|
|  | 590 | # BOOST_IOSTREAMS([PREFERRED-RT-OPT]) | 
|---|
|  | 591 | # ----------------------------------- | 
|---|
|  | 592 | # Look for Boost.IOStreams.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 593 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 594 | BOOST_DEFUN([IOStreams], | 
|---|
|  | 595 | [BOOST_FIND_LIB([iostreams], [$1], | 
|---|
|  | 596 | [boost/iostreams/device/file_descriptor.hpp], | 
|---|
|  | 597 | [boost::iostreams::file_descriptor fd; fd.close();]) | 
|---|
|  | 598 | ])# BOOST_IOSTREAMS | 
|---|
|  | 599 |  | 
|---|
|  | 600 |  | 
|---|
|  | 601 | # BOOST_HASH() | 
|---|
|  | 602 | # ------------ | 
|---|
|  | 603 | # Look for Boost.Functional/Hash | 
|---|
|  | 604 | BOOST_DEFUN([Hash], | 
|---|
|  | 605 | [BOOST_FIND_HEADER([boost/functional/hash.hpp])]) | 
|---|
|  | 606 |  | 
|---|
|  | 607 |  | 
|---|
| [f08ae7] | 608 | # BOOST_ITERATOR() | 
|---|
|  | 609 | # ------------ | 
|---|
|  | 610 | # Look for Boost.Iterator | 
|---|
|  | 611 | BOOST_DEFUN([Iterator], | 
|---|
|  | 612 | [BOOST_FIND_HEADER([boost/iterator/iterator_adaptor.hpp])]) | 
|---|
|  | 613 |  | 
|---|
|  | 614 |  | 
|---|
| [79de12] | 615 | # BOOST_LAMBDA() | 
|---|
|  | 616 | # -------------- | 
|---|
|  | 617 | # Look for Boost.Lambda | 
|---|
|  | 618 | BOOST_DEFUN([Lambda], | 
|---|
|  | 619 | [BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) | 
|---|
|  | 620 |  | 
|---|
|  | 621 |  | 
|---|
| [f08ae7] | 622 | # BOOST_LOG([PREFERRED-RT-OPT]) | 
|---|
|  | 623 | # ----------------------------- | 
|---|
|  | 624 | # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 625 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 626 | BOOST_DEFUN([Log], | 
|---|
|  | 627 | [BOOST_FIND_LIB([log], [$1], | 
|---|
|  | 628 | [boost/log/core/core.hpp], | 
|---|
|  | 629 | [boost::log::attribute a; a.get_value();]) | 
|---|
|  | 630 | ])# BOOST_LOG | 
|---|
|  | 631 |  | 
|---|
|  | 632 |  | 
|---|
|  | 633 | # BOOST_LOG_SETUP([PREFERRED-RT-OPT]) | 
|---|
|  | 634 | # ----------------------------------- | 
|---|
|  | 635 | # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 636 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 637 | BOOST_DEFUN([Log_Setup], | 
|---|
|  | 638 | [AC_REQUIRE([BOOST_LOG])dnl | 
|---|
|  | 639 | BOOST_FIND_LIB([log_setup], [$1], | 
|---|
|  | 640 | [boost/log/utility/init/from_settings.hpp], | 
|---|
|  | 641 | [boost::log::basic_settings<char> bs; bs.empty();]) | 
|---|
|  | 642 | ])# BOOST_LOG_SETUP | 
|---|
|  | 643 |  | 
|---|
|  | 644 |  | 
|---|
| [79de12] | 645 | # BOOST_MATH() | 
|---|
|  | 646 | # ------------ | 
|---|
|  | 647 | # Look for Boost.Math | 
|---|
|  | 648 | # TODO: This library isn't header-only but it comes in multiple different | 
|---|
|  | 649 | # flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, | 
|---|
|  | 650 | # libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, | 
|---|
|  | 651 | # libboost_math_tr1f, libboost_math_tr1l).  This macro must be fixed to do the | 
|---|
|  | 652 | # right thing anyway. | 
|---|
|  | 653 | BOOST_DEFUN([Math], | 
|---|
|  | 654 | [BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) | 
|---|
|  | 655 |  | 
|---|
|  | 656 |  | 
|---|
|  | 657 | # BOOST_MULTIARRAY() | 
|---|
|  | 658 | # ------------------ | 
|---|
|  | 659 | # Look for Boost.MultiArray | 
|---|
|  | 660 | BOOST_DEFUN([MultiArray], | 
|---|
| [619a0e] | 661 | [BOOST_FIND_HEADER([boost/mpl/list.hpp])]) | 
|---|
| [79de12] | 662 |  | 
|---|
|  | 663 |  | 
|---|
| [619a0e] | 664 | # BOOST_MMPL() | 
|---|
|  | 665 | # ------------------ | 
|---|
|  | 666 | # Look for Boost.MPL | 
|---|
|  | 667 | BOOST_DEFUN([MPL], | 
|---|
|  | 668 | [BOOST_FIND_HEADER([boost/mpl/for_each.hpp])]) | 
|---|
|  | 669 |  | 
|---|
| [79de12] | 670 | # BOOST_NUMERIC_CONVERSION() | 
|---|
|  | 671 | # -------------------------- | 
|---|
|  | 672 | # Look for Boost.NumericConversion (policy-based numeric conversion) | 
|---|
|  | 673 | BOOST_DEFUN([Numeric_Conversion], | 
|---|
|  | 674 | [BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) | 
|---|
|  | 675 | ])# BOOST_NUMERIC_CONVERSION | 
|---|
|  | 676 |  | 
|---|
|  | 677 |  | 
|---|
|  | 678 | # BOOST_OPTIONAL() | 
|---|
|  | 679 | # ---------------- | 
|---|
|  | 680 | # Look for Boost.Optional | 
|---|
|  | 681 | BOOST_DEFUN([Optional], | 
|---|
|  | 682 | [BOOST_FIND_HEADER([boost/optional.hpp])]) | 
|---|
|  | 683 |  | 
|---|
|  | 684 |  | 
|---|
|  | 685 | # BOOST_PREPROCESSOR() | 
|---|
|  | 686 | # -------------------- | 
|---|
|  | 687 | # Look for Boost.Preprocessor | 
|---|
|  | 688 | BOOST_DEFUN([Preprocessor], | 
|---|
|  | 689 | [BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) | 
|---|
|  | 690 |  | 
|---|
|  | 691 |  | 
|---|
| [613da6] | 692 | # BOOST_PROPERTY_TREE([PREFERRED-RT-OPT]) | 
|---|
|  | 693 | # ----------------------------------------- | 
|---|
|  | 694 | # Look for Boost.Property_Tree.  For the documentation of PREFERRED-RT-OPT, | 
|---|
|  | 695 | # see the documentation of BOOST_FIND_LIB above. | 
|---|
|  | 696 | BOOST_DEFUN([Property_Tree], | 
|---|
|  | 697 | [BOOST_FIND_LIB([property_tree], [$1], | 
|---|
|  | 698 | [boost/property_tree/ptree.hpp], | 
|---|
|  | 699 | [boost::property_tree::ptree pt; boost::property_tree::read_xml d("test", pt);]) | 
|---|
|  | 700 | ])# BOOST_PROPERTY_TREE | 
|---|
|  | 701 |  | 
|---|
|  | 702 |  | 
|---|
| [f08ae7] | 703 | # BOOST_RANDOM() | 
|---|
|  | 704 | # -------------------- | 
|---|
|  | 705 | # Look for Boost.Random | 
|---|
|  | 706 | BOOST_DEFUN([Random], | 
|---|
|  | 707 | [BOOST_FIND_HEADER([boost/random/random_number_generator.hpp])]) | 
|---|
|  | 708 |  | 
|---|
|  | 709 |  | 
|---|
|  | 710 | # BOOST_UNORDERED() | 
|---|
|  | 711 | # ----------------- | 
|---|
|  | 712 | # Look for Boost.Unordered | 
|---|
|  | 713 | BOOST_DEFUN([Unordered], | 
|---|
|  | 714 | [BOOST_FIND_HEADER([boost/unordered_map.hpp])]) | 
|---|
|  | 715 |  | 
|---|
|  | 716 |  | 
|---|
|  | 717 | # BOOST_UUID() | 
|---|
|  | 718 | # ------------ | 
|---|
|  | 719 | # Look for Boost.Uuid | 
|---|
|  | 720 | BOOST_DEFUN([Uuid], | 
|---|
|  | 721 | [BOOST_FIND_HEADER([boost/uuid/uuid.hpp])]) | 
|---|
|  | 722 |  | 
|---|
|  | 723 |  | 
|---|
| [79de12] | 724 | # BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) | 
|---|
|  | 725 | # ----------------------------------------- | 
|---|
|  | 726 | # Look for Boost.Program_options.  For the documentation of PREFERRED-RT-OPT, | 
|---|
|  | 727 | # see the documentation of BOOST_FIND_LIB above. | 
|---|
|  | 728 | BOOST_DEFUN([Program_Options], | 
|---|
|  | 729 | [BOOST_FIND_LIB([program_options], [$1], | 
|---|
|  | 730 | [boost/program_options.hpp], | 
|---|
|  | 731 | [boost::program_options::options_description d("test");]) | 
|---|
|  | 732 | ])# BOOST_PROGRAM_OPTIONS | 
|---|
|  | 733 |  | 
|---|
|  | 734 |  | 
|---|
|  | 735 |  | 
|---|
|  | 736 | # _BOOST_PYTHON_CONFIG(VARIABLE, FLAG) | 
|---|
|  | 737 | # ------------------------------------ | 
|---|
|  | 738 | # Save VARIABLE, and define it via `python-config --FLAG`. | 
|---|
|  | 739 | # Substitute BOOST_PYTHON_VARIABLE. | 
|---|
|  | 740 | m4_define([_BOOST_PYTHON_CONFIG], | 
|---|
|  | 741 | [AC_SUBST([BOOST_PYTHON_$1], | 
|---|
|  | 742 | [`python-config --$2 2>/dev/null`])dnl | 
|---|
|  | 743 | boost_python_save_$1=$$1 | 
|---|
|  | 744 | $1="$$1 $BOOST_PYTHON_$1"]) | 
|---|
|  | 745 |  | 
|---|
|  | 746 |  | 
|---|
|  | 747 | # BOOST_PYTHON([PREFERRED-RT-OPT]) | 
|---|
|  | 748 | # -------------------------------- | 
|---|
|  | 749 | # Look for Boost.Python.  For the documentation of PREFERRED-RT-OPT, | 
|---|
|  | 750 | # see the documentation of BOOST_FIND_LIB above. | 
|---|
|  | 751 | BOOST_DEFUN([Python], | 
|---|
|  | 752 | [_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes]) | 
|---|
|  | 753 | _BOOST_PYTHON_CONFIG([LDFLAGS],   [ldflags]) | 
|---|
|  | 754 | _BOOST_PYTHON_CONFIG([LIBS],      [libs]) | 
|---|
|  | 755 | m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl | 
|---|
|  | 756 | BOOST_FIND_LIB([python], [$1], | 
|---|
|  | 757 | [boost/python.hpp], | 
|---|
|  | 758 | [], [BOOST_PYTHON_MODULE(empty) {}]) | 
|---|
|  | 759 | CPPFLAGS=$boost_python_save_CPPFLAGS | 
|---|
|  | 760 | LDFLAGS=$boost_python_save_LDFLAGS | 
|---|
|  | 761 | LIBS=$boost_python_save_LIBS | 
|---|
|  | 762 | ])# BOOST_PYTHON | 
|---|
|  | 763 |  | 
|---|
|  | 764 |  | 
|---|
|  | 765 | # BOOST_REF() | 
|---|
|  | 766 | # ----------- | 
|---|
|  | 767 | # Look for Boost.Ref | 
|---|
|  | 768 | BOOST_DEFUN([Ref], | 
|---|
|  | 769 | [BOOST_FIND_HEADER([boost/ref.hpp])]) | 
|---|
|  | 770 |  | 
|---|
|  | 771 |  | 
|---|
|  | 772 | # BOOST_REGEX([PREFERRED-RT-OPT]) | 
|---|
|  | 773 | # ------------------------------- | 
|---|
|  | 774 | # Look for Boost.Regex.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 775 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 776 | BOOST_DEFUN([Regex], | 
|---|
|  | 777 | [BOOST_FIND_LIB([regex], [$1], | 
|---|
|  | 778 | [boost/regex.hpp], | 
|---|
|  | 779 | [boost::regex exp("*"); boost::regex_match("foo", exp);]) | 
|---|
|  | 780 | ])# BOOST_REGEX | 
|---|
|  | 781 |  | 
|---|
|  | 782 |  | 
|---|
|  | 783 | # BOOST_SERIALIZATION([PREFERRED-RT-OPT]) | 
|---|
|  | 784 | # --------------------------------------- | 
|---|
|  | 785 | # Look for Boost.Serialization.  For the documentation of PREFERRED-RT-OPT, see | 
|---|
|  | 786 | # the documentation of BOOST_FIND_LIB above. | 
|---|
|  | 787 | BOOST_DEFUN([Serialization], | 
|---|
|  | 788 | [BOOST_FIND_LIB([serialization], [$1], | 
|---|
|  | 789 | [boost/archive/text_oarchive.hpp], | 
|---|
|  | 790 | [std::ostream* o = 0; // Cheap way to get an ostream... | 
|---|
|  | 791 | boost::archive::text_oarchive t(*o);]) | 
|---|
| [f08ae7] | 792 | ])# BOOST_SERIALIZATION | 
|---|
| [79de12] | 793 |  | 
|---|
|  | 794 |  | 
|---|
|  | 795 | # BOOST_SIGNALS([PREFERRED-RT-OPT]) | 
|---|
|  | 796 | # --------------------------------- | 
|---|
|  | 797 | # Look for Boost.Signals.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 798 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 799 | BOOST_DEFUN([Signals], | 
|---|
|  | 800 | [BOOST_FIND_LIB([signals], [$1], | 
|---|
|  | 801 | [boost/signal.hpp], | 
|---|
|  | 802 | [boost::signal<void ()> s;]) | 
|---|
|  | 803 | ])# BOOST_SIGNALS | 
|---|
|  | 804 |  | 
|---|
|  | 805 |  | 
|---|
|  | 806 | # BOOST_SMART_PTR() | 
|---|
|  | 807 | # ----------------- | 
|---|
|  | 808 | # Look for Boost.SmartPtr | 
|---|
|  | 809 | BOOST_DEFUN([Smart_Ptr], | 
|---|
|  | 810 | [BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) | 
|---|
|  | 811 | BOOST_FIND_HEADER([boost/shared_ptr.hpp]) | 
|---|
|  | 812 | ]) | 
|---|
|  | 813 |  | 
|---|
|  | 814 |  | 
|---|
|  | 815 | # BOOST_STATICASSERT() | 
|---|
|  | 816 | # -------------------- | 
|---|
|  | 817 | # Look for Boost.StaticAssert | 
|---|
|  | 818 | BOOST_DEFUN([StaticAssert], | 
|---|
|  | 819 | [BOOST_FIND_HEADER([boost/static_assert.hpp])]) | 
|---|
|  | 820 |  | 
|---|
|  | 821 |  | 
|---|
|  | 822 | # BOOST_STRING_ALGO() | 
|---|
|  | 823 | # ------------------- | 
|---|
|  | 824 | # Look for Boost.StringAlgo | 
|---|
|  | 825 | BOOST_DEFUN([String_Algo], | 
|---|
|  | 826 | [BOOST_FIND_HEADER([boost/algorithm/string.hpp]) | 
|---|
|  | 827 | ]) | 
|---|
|  | 828 |  | 
|---|
|  | 829 |  | 
|---|
|  | 830 | # BOOST_SYSTEM([PREFERRED-RT-OPT]) | 
|---|
|  | 831 | # -------------------------------- | 
|---|
|  | 832 | # Look for Boost.System.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 833 | # documentation of BOOST_FIND_LIB above.  This library was introduced in Boost | 
|---|
|  | 834 | # 1.35.0. | 
|---|
|  | 835 | BOOST_DEFUN([System], | 
|---|
|  | 836 | [BOOST_FIND_LIB([system], [$1], | 
|---|
|  | 837 | [boost/system/error_code.hpp], | 
|---|
|  | 838 | [boost::system::error_code e; e.clear();]) | 
|---|
|  | 839 | ])# BOOST_SYSTEM | 
|---|
|  | 840 |  | 
|---|
|  | 841 |  | 
|---|
|  | 842 | # BOOST_TEST([PREFERRED-RT-OPT]) | 
|---|
|  | 843 | # ------------------------------ | 
|---|
|  | 844 | # Look for Boost.Test.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 845 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 846 | BOOST_DEFUN([Test], | 
|---|
|  | 847 | [m4_pattern_allow([^BOOST_CHECK$])dnl | 
|---|
|  | 848 | BOOST_FIND_LIB([unit_test_framework], [$1], | 
|---|
|  | 849 | [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);], | 
|---|
|  | 850 | [using boost::unit_test::test_suite; | 
|---|
|  | 851 | test_suite* init_unit_test_suite(int argc, char ** argv) | 
|---|
|  | 852 | { return NULL; }]) | 
|---|
|  | 853 | ])# BOOST_TEST | 
|---|
|  | 854 |  | 
|---|
|  | 855 |  | 
|---|
|  | 856 | # BOOST_THREADS([PREFERRED-RT-OPT]) | 
|---|
|  | 857 | # --------------------------------- | 
|---|
|  | 858 | # Look for Boost.Thread.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 859 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 860 | # FIXME: Provide an alias "BOOST_THREAD". | 
|---|
|  | 861 | BOOST_DEFUN([Threads], | 
|---|
|  | 862 | [dnl Having the pthread flag is required at least on GCC3 where | 
|---|
|  | 863 | dnl boost/thread.hpp would complain if we try to compile without | 
|---|
|  | 864 | dnl -pthread on GNU/Linux. | 
|---|
|  | 865 | AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl | 
|---|
|  | 866 | boost_threads_save_LIBS=$LIBS | 
|---|
|  | 867 | boost_threads_save_CPPFLAGS=$CPPFLAGS | 
|---|
|  | 868 | LIBS="$LIBS $boost_cv_pthread_flag" | 
|---|
|  | 869 | # Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, | 
|---|
|  | 870 | # boost/thread.hpp will trigger a #error if -pthread isn't used: | 
|---|
|  | 871 | #   boost/config/requires_threads.hpp:47:5: #error "Compiler threading support | 
|---|
|  | 872 | #   is not turned on. Please set the correct command line options for | 
|---|
|  | 873 | #   threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" | 
|---|
|  | 874 | CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" | 
|---|
|  | 875 | BOOST_FIND_LIB([thread], [$1], | 
|---|
|  | 876 | [boost/thread.hpp], [boost::thread t; boost::mutex m;]) | 
|---|
|  | 877 | BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag" | 
|---|
|  | 878 | BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" | 
|---|
|  | 879 | LIBS=$boost_threads_save_LIBS | 
|---|
|  | 880 | CPPFLAGS=$boost_threads_save_CPPFLAGS | 
|---|
|  | 881 | ])# BOOST_THREADS | 
|---|
|  | 882 |  | 
|---|
|  | 883 |  | 
|---|
|  | 884 | # BOOST_TOKENIZER() | 
|---|
|  | 885 | # ----------------- | 
|---|
|  | 886 | # Look for Boost.Tokenizer | 
|---|
|  | 887 | BOOST_DEFUN([Tokenizer], | 
|---|
|  | 888 | [BOOST_FIND_HEADER([boost/tokenizer.hpp])]) | 
|---|
|  | 889 |  | 
|---|
|  | 890 |  | 
|---|
|  | 891 | # BOOST_TRIBOOL() | 
|---|
|  | 892 | # --------------- | 
|---|
|  | 893 | # Look for Boost.Tribool | 
|---|
|  | 894 | BOOST_DEFUN([Tribool], | 
|---|
|  | 895 | [BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) | 
|---|
|  | 896 | BOOST_FIND_HEADER([boost/logic/tribool.hpp]) | 
|---|
|  | 897 | ]) | 
|---|
|  | 898 |  | 
|---|
|  | 899 |  | 
|---|
|  | 900 | # BOOST_TUPLE() | 
|---|
|  | 901 | # ------------- | 
|---|
|  | 902 | # Look for Boost.Tuple | 
|---|
|  | 903 | BOOST_DEFUN([Tuple], | 
|---|
|  | 904 | [BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) | 
|---|
|  | 905 |  | 
|---|
|  | 906 |  | 
|---|
|  | 907 | # BOOST_TYPETRAITS() | 
|---|
|  | 908 | # -------------------- | 
|---|
|  | 909 | # Look for Boost.TypeTraits | 
|---|
|  | 910 | BOOST_DEFUN([TypeTraits], | 
|---|
|  | 911 | [BOOST_FIND_HEADER([boost/type_traits.hpp])]) | 
|---|
|  | 912 |  | 
|---|
|  | 913 |  | 
|---|
|  | 914 | # BOOST_UTILITY() | 
|---|
|  | 915 | # --------------- | 
|---|
|  | 916 | # Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, | 
|---|
|  | 917 | # etc.) | 
|---|
|  | 918 | BOOST_DEFUN([Utility], | 
|---|
|  | 919 | [BOOST_FIND_HEADER([boost/utility.hpp])]) | 
|---|
|  | 920 |  | 
|---|
|  | 921 |  | 
|---|
|  | 922 | # BOOST_VARIANT() | 
|---|
|  | 923 | # --------------- | 
|---|
|  | 924 | # Look for Boost.Variant. | 
|---|
|  | 925 | BOOST_DEFUN([Variant], | 
|---|
|  | 926 | [BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) | 
|---|
|  | 927 | BOOST_FIND_HEADER([boost/variant.hpp])]) | 
|---|
|  | 928 |  | 
|---|
|  | 929 |  | 
|---|
|  | 930 | # BOOST_WAVE([PREFERRED-RT-OPT]) | 
|---|
|  | 931 | # ------------------------------ | 
|---|
|  | 932 | # NOTE: If you intend to use Wave/Spirit with thread support, make sure you | 
|---|
|  | 933 | # call BOOST_THREADS first. | 
|---|
|  | 934 | # Look for Boost.Wave.  For the documentation of PREFERRED-RT-OPT, see the | 
|---|
|  | 935 | # documentation of BOOST_FIND_LIB above. | 
|---|
|  | 936 | BOOST_DEFUN([Wave], | 
|---|
|  | 937 | [AC_REQUIRE([BOOST_FILESYSTEM])dnl | 
|---|
|  | 938 | AC_REQUIRE([BOOST_DATE_TIME])dnl | 
|---|
|  | 939 | boost_wave_save_LIBS=$LIBS | 
|---|
|  | 940 | boost_wave_save_LDFLAGS=$LDFLAGS | 
|---|
|  | 941 | m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl | 
|---|
|  | 942 | LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\ | 
|---|
|  | 943 | $BOOST_THREAD_LIBS" | 
|---|
|  | 944 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\ | 
|---|
|  | 945 | $BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" | 
|---|
|  | 946 | BOOST_FIND_LIB([wave], [$1], | 
|---|
|  | 947 | [boost/wave.hpp], | 
|---|
|  | 948 | [boost::wave::token_id id; get_token_name(id);]) | 
|---|
|  | 949 | LIBS=$boost_wave_save_LIBS | 
|---|
|  | 950 | LDFLAGS=$boost_wave_save_LDFLAGS | 
|---|
|  | 951 | ])# BOOST_WAVE | 
|---|
|  | 952 |  | 
|---|
|  | 953 |  | 
|---|
|  | 954 | # BOOST_XPRESSIVE() | 
|---|
|  | 955 | # ----------------- | 
|---|
|  | 956 | # Look for Boost.Xpressive (new since 1.36.0). | 
|---|
|  | 957 | BOOST_DEFUN([Xpressive], | 
|---|
|  | 958 | [BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) | 
|---|
|  | 959 |  | 
|---|
|  | 960 |  | 
|---|
|  | 961 | # ----------------- # | 
|---|
|  | 962 | # Internal helpers. # | 
|---|
|  | 963 | # ----------------- # | 
|---|
|  | 964 |  | 
|---|
|  | 965 |  | 
|---|
|  | 966 | # _BOOST_PTHREAD_FLAG() | 
|---|
|  | 967 | # --------------------- | 
|---|
|  | 968 | # Internal helper for BOOST_THREADS.  Based on ACX_PTHREAD: | 
|---|
|  | 969 | # http://autoconf-archive.cryp.to/acx_pthread.html | 
|---|
|  | 970 | AC_DEFUN([_BOOST_PTHREAD_FLAG], | 
|---|
|  | 971 | [AC_REQUIRE([AC_PROG_CXX])dnl | 
|---|
|  | 972 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | 
|---|
|  | 973 | AC_LANG_PUSH([C++])dnl | 
|---|
|  | 974 | AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag], | 
|---|
|  | 975 | [ boost_cv_pthread_flag= | 
|---|
|  | 976 | # The ordering *is* (sometimes) important.  Some notes on the | 
|---|
|  | 977 | # individual items follow: | 
|---|
|  | 978 | # (none): in case threads are in libc; should be tried before -Kthread and | 
|---|
|  | 979 | #       other compiler flags to prevent continual compiler warnings | 
|---|
|  | 980 | # -lpthreads: AIX (must check this before -lpthread) | 
|---|
|  | 981 | # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) | 
|---|
|  | 982 | # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) | 
|---|
|  | 983 | # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) | 
|---|
|  | 984 | # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) | 
|---|
|  | 985 | # -pthreads: Solaris/GCC | 
|---|
|  | 986 | # -mthreads: MinGW32/GCC, Lynx/GCC | 
|---|
|  | 987 | # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it | 
|---|
|  | 988 | #      doesn't hurt to check since this sometimes defines pthreads too; | 
|---|
|  | 989 | #      also defines -D_REENTRANT) | 
|---|
|  | 990 | #      ... -mt is also the pthreads flag for HP/aCC | 
|---|
|  | 991 | # -lpthread: GNU Linux, etc. | 
|---|
|  | 992 | # --thread-safe: KAI C++ | 
|---|
|  | 993 | case $host_os in #( | 
|---|
|  | 994 | *solaris*) | 
|---|
|  | 995 | # On Solaris (at least, for some versions), libc contains stubbed | 
|---|
|  | 996 | # (non-functional) versions of the pthreads routines, so link-based | 
|---|
|  | 997 | # tests will erroneously succeed.  (We need to link with -pthreads/-mt/ | 
|---|
|  | 998 | # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather | 
|---|
|  | 999 | # a function called by this macro, so we could check for that, but | 
|---|
|  | 1000 | # who knows whether they'll stub that too in a future libc.)  So, | 
|---|
|  | 1001 | # we'll just look for -pthreads and -lpthread first: | 
|---|
|  | 1002 | boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( | 
|---|
|  | 1003 | *) | 
|---|
|  | 1004 | boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ | 
|---|
|  | 1005 | -pthreads -mthreads -lpthread --thread-safe -mt";; | 
|---|
|  | 1006 | esac | 
|---|
|  | 1007 | # Generate the test file. | 
|---|
|  | 1008 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>], | 
|---|
|  | 1009 | [pthread_t th; pthread_join(th, 0); | 
|---|
|  | 1010 | pthread_attr_init(0); pthread_cleanup_push(0, 0); | 
|---|
|  | 1011 | pthread_create(0,0,0,0); pthread_cleanup_pop(0);])]) | 
|---|
|  | 1012 | for boost_pthread_flag in '' $boost_pthread_flags; do | 
|---|
|  | 1013 | boost_pthread_ok=false | 
|---|
|  | 1014 | dnl Re-use the test file already generated. | 
|---|
|  | 1015 | boost_pthreads__save_LIBS=$LIBS | 
|---|
|  | 1016 | LIBS="$LIBS $boost_pthread_flag" | 
|---|
|  | 1017 | AC_LINK_IFELSE([], | 
|---|
|  | 1018 | [if grep ".*$boost_pthread_flag" conftest.err; then | 
|---|
|  | 1019 | echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD | 
|---|
|  | 1020 | else | 
|---|
|  | 1021 | boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag | 
|---|
|  | 1022 | fi]) | 
|---|
|  | 1023 | LIBS=$boost_pthreads__save_LIBS | 
|---|
|  | 1024 | $boost_pthread_ok && break | 
|---|
|  | 1025 | done | 
|---|
|  | 1026 | ]) | 
|---|
|  | 1027 | AC_LANG_POP([C++])dnl | 
|---|
|  | 1028 | ])# _BOOST_PTHREAD_FLAG | 
|---|
|  | 1029 |  | 
|---|
|  | 1030 |  | 
|---|
|  | 1031 | # _BOOST_gcc_test(MAJOR, MINOR) | 
|---|
|  | 1032 | # ----------------------------- | 
|---|
|  | 1033 | # Internal helper for _BOOST_FIND_COMPILER_TAG. | 
|---|
|  | 1034 | m4_define([_BOOST_gcc_test], | 
|---|
|  | 1035 | ["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl | 
|---|
|  | 1036 |  | 
|---|
|  | 1037 |  | 
|---|
|  | 1038 | # _BOOST_FIND_COMPILER_TAG() | 
|---|
|  | 1039 | # -------------------------- | 
|---|
|  | 1040 | # Internal.  When Boost is installed without --layout=system, each library | 
|---|
|  | 1041 | # filename will hold a suffix that encodes the compiler used during the | 
|---|
|  | 1042 | # build.  The Boost build system seems to call this a `tag'. | 
|---|
|  | 1043 | AC_DEFUN([_BOOST_FIND_COMPILER_TAG], | 
|---|
|  | 1044 | [AC_REQUIRE([AC_PROG_CXX])dnl | 
|---|
|  | 1045 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | 
|---|
|  | 1046 | AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag], | 
|---|
|  | 1047 | [boost_cv_lib_tag=unknown | 
|---|
|  | 1048 | if test x$boost_cv_inc_path != xno; then | 
|---|
|  | 1049 | AC_LANG_PUSH([C++])dnl | 
|---|
|  | 1050 | # The following tests are mostly inspired by boost/config/auto_link.hpp | 
|---|
|  | 1051 | # The list is sorted to most recent/common to oldest compiler (in order | 
|---|
|  | 1052 | # to increase the likelihood of finding the right compiler with the | 
|---|
|  | 1053 | # least number of compilation attempt). | 
|---|
|  | 1054 | # Beware that some tests are sensible to the order (for instance, we must | 
|---|
|  | 1055 | # look for MinGW before looking for GCC3). | 
|---|
|  | 1056 | # I used one compilation test per compiler with a #error to recognize | 
|---|
|  | 1057 | # each compiler so that it works even when cross-compiling (let me know | 
|---|
|  | 1058 | # if you know a better approach). | 
|---|
|  | 1059 | # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): | 
|---|
|  | 1060 | #   como, edg, kcc, bck, mp, sw, tru, xlc | 
|---|
|  | 1061 | # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines | 
|---|
|  | 1062 | # the same defines as GCC's). | 
|---|
|  | 1063 | for i in \ | 
|---|
|  | 1064 | _BOOST_gcc_test(4, 6) \ | 
|---|
|  | 1065 | _BOOST_gcc_test(4, 5) \ | 
|---|
|  | 1066 | _BOOST_gcc_test(4, 4) \ | 
|---|
|  | 1067 | _BOOST_gcc_test(4, 3) \ | 
|---|
|  | 1068 | _BOOST_gcc_test(4, 2) \ | 
|---|
|  | 1069 | _BOOST_gcc_test(4, 1) \ | 
|---|
|  | 1070 | _BOOST_gcc_test(4, 0) \ | 
|---|
|  | 1071 | "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ | 
|---|
|  | 1072 | && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ | 
|---|
|  | 1073 | || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ | 
|---|
|  | 1074 | _BOOST_gcc_test(3, 4) \ | 
|---|
|  | 1075 | _BOOST_gcc_test(3, 3) \ | 
|---|
|  | 1076 | "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ | 
|---|
|  | 1077 | "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ | 
|---|
|  | 1078 | _BOOST_gcc_test(3, 2) \ | 
|---|
|  | 1079 | "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ | 
|---|
|  | 1080 | _BOOST_gcc_test(3, 1) \ | 
|---|
|  | 1081 | _BOOST_gcc_test(3, 0) \ | 
|---|
|  | 1082 | "defined __BORLANDC__ @ bcb" \ | 
|---|
|  | 1083 | "defined __ICC && (defined __unix || defined __unix__) @ il" \ | 
|---|
|  | 1084 | "defined __ICL @ iw" \ | 
|---|
|  | 1085 | "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ | 
|---|
|  | 1086 | _BOOST_gcc_test(2, 95) \ | 
|---|
|  | 1087 | "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ | 
|---|
|  | 1088 | "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ | 
|---|
|  | 1089 | "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ | 
|---|
|  | 1090 | "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" | 
|---|
|  | 1091 | do | 
|---|
|  | 1092 | boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '` | 
|---|
|  | 1093 | boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'` | 
|---|
|  | 1094 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 
|---|
|  | 1095 | #if $boost_tag_test | 
|---|
|  | 1096 | /* OK */ | 
|---|
|  | 1097 | #else | 
|---|
|  | 1098 | # error $boost_tag_test | 
|---|
|  | 1099 | #endif | 
|---|
|  | 1100 | ]])], [boost_cv_lib_tag=$boost_tag; break], []) | 
|---|
|  | 1101 | done | 
|---|
|  | 1102 | AC_LANG_POP([C++])dnl | 
|---|
|  | 1103 | case $boost_cv_lib_tag in #( | 
|---|
|  | 1104 | # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed | 
|---|
|  | 1105 | # to "gcc41" for instance. | 
|---|
|  | 1106 | *-gcc | *'-gcc ') :;; #(  Don't re-add -gcc: it's already in there. | 
|---|
|  | 1107 | gcc*) | 
|---|
|  | 1108 | boost_tag_x= | 
|---|
|  | 1109 | case $host_os in #( | 
|---|
|  | 1110 | darwin*) | 
|---|
|  | 1111 | if test $boost_major_version -ge 136; then | 
|---|
|  | 1112 | # The `x' added in r46793 of Boost. | 
|---|
|  | 1113 | boost_tag_x=x | 
|---|
|  | 1114 | fi;; | 
|---|
|  | 1115 | esac | 
|---|
|  | 1116 | # We can specify multiple tags in this variable because it's used by | 
|---|
|  | 1117 | # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... | 
|---|
|  | 1118 | boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" | 
|---|
|  | 1119 | ;; #( | 
|---|
|  | 1120 | unknown) | 
|---|
|  | 1121 | AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]]) | 
|---|
|  | 1122 | boost_cv_lib_tag= | 
|---|
|  | 1123 | ;; | 
|---|
|  | 1124 | esac | 
|---|
|  | 1125 | fi])dnl end of AC_CACHE_CHECK | 
|---|
|  | 1126 | ])# _BOOST_FIND_COMPILER_TAG | 
|---|
|  | 1127 |  | 
|---|
|  | 1128 |  | 
|---|
|  | 1129 | # _BOOST_GUESS_WHETHER_TO_USE_MT() | 
|---|
|  | 1130 | # -------------------------------- | 
|---|
|  | 1131 | # Compile a small test to try to guess whether we should favor MT (Multi | 
|---|
|  | 1132 | # Thread) flavors of Boost.  Sets boost_guess_use_mt accordingly. | 
|---|
|  | 1133 | AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT], | 
|---|
|  | 1134 | [# Check whether we do better use `mt' even though we weren't ask to. | 
|---|
|  | 1135 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 
|---|
|  | 1136 | #if defined _REENTRANT || defined _MT || defined __MT__ | 
|---|
|  | 1137 | /* use -mt */ | 
|---|
|  | 1138 | #else | 
|---|
|  | 1139 | # error MT not needed | 
|---|
|  | 1140 | #endif | 
|---|
|  | 1141 | ]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false]) | 
|---|
|  | 1142 | ]) | 
|---|
|  | 1143 |  | 
|---|
|  | 1144 | # _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) | 
|---|
|  | 1145 | # ------------------------------------------------------------------- | 
|---|
|  | 1146 | # Fork of _AC_LINK_IFELSE that preserves conftest.o across calls.  Fragile, | 
|---|
|  | 1147 | # will break when Autoconf changes its internals.  Requires that you manually | 
|---|
|  | 1148 | # rm -f conftest.$ac_objext in between to really different tests, otherwise | 
|---|
|  | 1149 | # you will try to link a conftest.o left behind by a previous test. | 
|---|
|  | 1150 | # Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this | 
|---|
|  | 1151 | # macro). | 
|---|
|  | 1152 | # | 
|---|
|  | 1153 | # Don't use "break" in the actions, as it would short-circuit some code | 
|---|
|  | 1154 | # this macro runs after the actions. | 
|---|
|  | 1155 | m4_define([_BOOST_AC_LINK_IFELSE], | 
|---|
|  | 1156 | [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl | 
|---|
|  | 1157 | rm -f conftest$ac_exeext | 
|---|
|  | 1158 | boost_save_ac_ext=$ac_ext | 
|---|
|  | 1159 | boost_use_source=: | 
|---|
|  | 1160 | # If we already have a .o, re-use it.  We change $ac_ext so that $ac_link | 
|---|
|  | 1161 | # tries to link the existing object file instead of compiling from source. | 
|---|
|  | 1162 | test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && | 
|---|
|  | 1163 | _AS_ECHO_LOG([re-using the existing conftest.$ac_objext]) | 
|---|
|  | 1164 | AS_IF([_AC_DO_STDERR($ac_link) && { | 
|---|
|  | 1165 | test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || | 
|---|
|  | 1166 | test ! -s conftest.err | 
|---|
|  | 1167 | } && test -s conftest$ac_exeext && { | 
|---|
|  | 1168 | test "$cross_compiling" = yes || | 
|---|
|  | 1169 | $as_executable_p conftest$ac_exeext | 
|---|
|  | 1170 | dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough. | 
|---|
|  | 1171 | }], | 
|---|
|  | 1172 | [$2], | 
|---|
|  | 1173 | [if $boost_use_source; then | 
|---|
|  | 1174 | _AC_MSG_LOG_CONFTEST | 
|---|
|  | 1175 | fi | 
|---|
|  | 1176 | $3]) | 
|---|
|  | 1177 | ac_objext=$boost_save_ac_objext | 
|---|
|  | 1178 | ac_ext=$boost_save_ac_ext | 
|---|
|  | 1179 | dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) | 
|---|
|  | 1180 | dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), | 
|---|
|  | 1181 | dnl as it would interfere with the next link command. | 
|---|
|  | 1182 | rm -f core conftest.err conftest_ipa8_conftest.oo \ | 
|---|
|  | 1183 | conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl | 
|---|
|  | 1184 | ])# _BOOST_AC_LINK_IFELSE | 
|---|
|  | 1185 |  | 
|---|
|  | 1186 | # Local Variables: | 
|---|
|  | 1187 | # mode: autoconf | 
|---|
|  | 1188 | # End: | 
|---|