~ubuntu-branches/ubuntu/quantal/python-demgengeo/quantal

« back to all changes in this revision

Viewing changes to .pc/fix-rpath.patch/build/m4/boost.m4

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2011-11-18 21:47:18 UTC
  • Revision ID: package-import@ubuntu.com-20111118214718-gjk95t39zc25p9ra
Tags: 0.99~bzr106-1
Initian Debian packaging. (Closes: #649001)

Show diffs side-by-side

added added

removed removed

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