Commit a60ae503 authored by yoogx's avatar yoogx
Browse files

* Add circuitry to detect BOOST,

        BOOST m4 macros from github's tsuna/boost.m4

        For issue #5
parent a919f630
......@@ -164,6 +164,12 @@ fi],
AC_SUBST(DOC_TARGETS)
###############################################################
# Use of BOOST
###############################################################
BOOST_REQUIRE([1.55.0])
###############################################################
# Force the installation prefix to be equal to the Ocarina one
###############################################################
......
......@@ -213,7 +213,7 @@ INCLUDE += -I$(RUNTIME_PATH)/src \
-I$(RUNTIME_PATH)/include/monitoring \
-I$(RUNTIME_PATH)/src/monitoring/cheddar_scheduling
CPPFLAGS += -std=c++1y -g
CPPFLAGS += -std=c++1y -g @BOOST_CPPFLAGS@
LDFLAGS += -lstdc++
endif
......
# boost.m4: Locate Boost headers and libraries for autoconf-based projects.
# Copyright (C) 2007-2011, 2014 Benoit Sigoure <tsuna@lrde.epita.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Additional permission under section 7 of the GNU General Public
# License, version 3 ("GPLv3"):
#
# If you convey this file as part of a work that contains a
# configuration script generated by Autoconf, you may do so under
# terms of your choice.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_define([_BOOST_SERIAL], [m4_translit([
# serial 24
], [#
], [])])
# Original sources can be found at http://github.com/tsuna/boost.m4
# You can fetch the latest version of the script by doing:
# wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4
# ------ #
# README #
# ------ #
# This file provides several macros to use the various Boost libraries.
# The first macro is BOOST_REQUIRE. It will simply check if it's possible to
# find the Boost headers of a given (optional) minimum version and it will
# define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to
# your configure so that users can specify non standard locations.
# If the user's environment contains BOOST_ROOT and --with-boost was not
# specified, --with-boost=$BOOST_ROOT is implicitly used.
# For more README and documentation, go to http://github.com/tsuna/boost.m4
# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry,
# simply read the README, it will show you what to do step by step.
m4_pattern_forbid([^_?(BOOST|Boost)_])
# _BOOST_SED_CPP(SED-PROGRAM, PROGRAM,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------
# Same as AC_EGREP_CPP, but leave the result in conftest.i.
#
# SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded
# in double-quotes, so escape your double quotes.
#
# It could be useful to turn this into a macro which extracts the
# value of any macro.
m4_define([_BOOST_SED_CPP],
[AC_LANG_PUSH([C++])dnl
AC_LANG_PREPROC_REQUIRE()dnl
AC_REQUIRE([AC_PROG_SED])dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
AS_IF([dnl eval is necessary to expand ac_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
dnl Beware of Windows end-of-lines, for instance if we are running
dnl some Windows programs under Wine. In that case, boost/version.hpp
dnl is certainly using "\r\n", but the regular Unix shell will only
dnl strip `\n' with backquotes, not the `\r'. This results in
dnl boost_cv_lib_version='1_37\r' for instance, which breaks
dnl everything else.
dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
dnl
dnl Beware that GCC 5, when expanding macros, may embed # line directives
dnl a within single line:
dnl
dnl # 1 "conftest.cc"
dnl # 1 "<built-in>"
dnl # 1 "<command-line>"
dnl # 1 "conftest.cc"
dnl # 1 "/opt/local/include/boost/version.hpp" 1 3
dnl # 2 "conftest.cc" 2
dnl boost-lib-version =
dnl # 2 "conftest.cc" 3
dnl "1_56"
dnl
dnl So get rid of the # lines, and glue the remaining ones together.
(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
grep -v '#' |
tr -d '\r' |
tr -s '\n' ' ' |
$SED -n -e "$1" >conftest.i 2>&1],
[$3],
[$4])
rm -rf conftest*
AC_LANG_POP([C++])dnl
])# _BOOST_SED_CPP
# BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND])
# -----------------------------------------------
# Look for Boost. If version is given, it must either be a literal of the form
# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a
# variable "$var".
# Defines the value BOOST_CPPFLAGS. This macro only checks for headers with
# the required version, it does not check for any of the Boost libraries.
# On # success, defines HAVE_BOOST. On failure, calls the optional
# ACTION-IF-NOT-FOUND action if one was supplied.
# Otherwise aborts with an error message.
AC_DEFUN([BOOST_REQUIRE],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_GREP])dnl
echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD
boost_save_IFS=$IFS
boost_version_req=$1
IFS=.
set x $boost_version_req 0 0 0
IFS=$boost_save_IFS
shift
boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"`
boost_version_req_string=$[1].$[2].$[3]
AC_ARG_WITH([boost],
[AS_HELP_STRING([--with-boost=DIR],
[prefix of Boost $1 @<:@guess@:>@])])dnl
AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl
# If BOOST_ROOT is set and the user has not provided a value to
# --with-boost, then treat BOOST_ROOT as if it the user supplied it.
if test x"$BOOST_ROOT" != x; then
if test x"$with_boost" = x; then
AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT])
with_boost=$BOOST_ROOT
else
AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost])
fi
fi
AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],
["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl
boost_save_CPPFLAGS=$CPPFLAGS
AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string],
[boost_cv_inc_path],
[boost_cv_inc_path=no
AC_LANG_PUSH([C++])dnl
m4_pattern_allow([^BOOST_VERSION$])dnl
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp>
#if !defined BOOST_VERSION
# error BOOST_VERSION is not defined
#elif BOOST_VERSION < $boost_version_req
# error Boost headers version < $boost_version_req
#endif
]])])
# If the user provided a value to --with-boost, use it and only it.
case $with_boost in #(
''|yes) set x '' /opt/local/include /usr/local/include /opt/include \
/usr/include C:/Boost/include;; #(
*) set x "$with_boost/include" "$with_boost";;
esac
shift
for boost_dir
do
# Without --layout=system, Boost (or at least some versions) installs
# itself in <prefix>/include/boost-<version>. This inner loop helps to
# find headers in such directories.
#
# Any ${boost_dir}/boost-x_xx directories are searched in reverse version
# order followed by ${boost_dir}. The final '.' is a sentinel for
# searching $boost_dir" itself. Entries are whitespace separated.
#
# I didn't indent this loop on purpose (to avoid over-indented code)
boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \
&& ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \
&& echo .`
for boost_inc in $boost_layout_system_search_list
do
if test x"$boost_inc" != x.; then
boost_inc="$boost_dir/$boost_inc"
else
boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list
fi
if test x"$boost_inc" != x; then
# We are going to check whether the version of Boost installed
# in $boost_inc is usable by running a compilation that
# #includes it. But if we pass a -I/some/path in which Boost
# is not installed, the compiler will just skip this -I and
# use other locations (either from CPPFLAGS, or from its list
# of system include directories). As a result we would use
# header installed on the machine instead of the /some/path
# specified by the user. So in that precise case (trying
# $boost_inc), make sure the version.hpp exists.
#
# Use test -e as there can be symlinks.
test -e "$boost_inc/boost/version.hpp" || continue
CPPFLAGS="$CPPFLAGS -I$boost_inc"
fi
AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no])
if test x"$boost_cv_inc_path" = xyes; then
if test x"$boost_inc" != x; then
boost_cv_inc_path=$boost_inc
fi
break 2
fi
done
done
AC_LANG_POP([C++])dnl
])
case $boost_cv_inc_path in #(
no)
boost_errmsg="cannot find Boost headers version >= $boost_version_req_string"
m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])],
[AC_MSG_NOTICE([$boost_errmsg])])
$2
;;#(
yes)
BOOST_CPPFLAGS=
;;#(
*)
AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl
;;
esac
if test x"$boost_cv_inc_path" != xno; then
AC_DEFINE([HAVE_BOOST], [1],
[Defined if the requested minimum BOOST version is satisfied])
AC_CACHE_CHECK([for Boost's header version],
[boost_cv_lib_version],
[m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
_BOOST_SED_CPP([[/^boost-lib-version = /{s///;s/[\" ]//g;p;q;}]],
[#include <boost/version.hpp>
boost-lib-version = BOOST_LIB_VERSION],
[boost_cv_lib_version=`cat conftest.i`])])
# e.g. "134" for 1_34_1 or "135" for 1_35
boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
case $boost_major_version in #(
'' | *[[!0-9]]*)
AC_MSG_ERROR([invalid value: boost_major_version='$boost_major_version'])
;;
esac
fi
CPPFLAGS=$boost_save_CPPFLAGS
])# BOOST_REQUIRE
# BOOST_STATIC()
# --------------
# Add the "--enable-static-boost" configure argument. If this argument is given
# on the command line, static versions of the libraries will be looked up.
AC_DEFUN([BOOST_STATIC],
[AC_ARG_ENABLE([static-boost],
[AS_HELP_STRING([--enable-static-boost],
[Prefer the static boost libraries over the shared ones [no]])],
[enable_static_boost=yes],
[enable_static_boost=no])])# BOOST_STATIC
# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
# --------------------------------------------------------------------------
# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for
# some parts of the Boost library which are only made of headers and don't
# require linking (such as Boost.Foreach).
#
# Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be
# found in the first place, in which case by default a notice is issued to the
# user. Presumably if we haven't died already it's because it's OK to not have
# Boost, which is why only a notice is issued instead of a hard error.
#
# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in
# case of success # (where HEADER-NAME is written LIKE_THIS, e.g.,
# HAVE_BOOST_FOREACH_HPP).
AC_DEFUN([BOOST_FIND_HEADER],
[AC_REQUIRE([BOOST_REQUIRE])dnl
if test x"$boost_cv_inc_path" = xno; then
m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])])
else
AC_LANG_PUSH([C++])dnl
boost_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
AC_CHECK_HEADER([$1],
[m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
[Define to 1 if you have <$1>])])],
[m4_default([$2], [AC_MSG_ERROR([cannot find $1])])])
CPPFLAGS=$boost_save_CPPFLAGS
AC_LANG_POP([C++])dnl
fi
])# BOOST_FIND_HEADER
# BOOST_FIND_LIBS([COMPONENT-NAME], [CANDIDATE-LIB-NAMES],
# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
# [CXX-PROLOGUE])
# --------------------------------------------------------------
# Look for the Boost library COMPONENT-NAME (e.g., `thread', for
# libboost_thread) under the possible CANDIDATE-LIB-NAMES (e.g.,
# "thread_win32 thread"). Check that HEADER-NAME works and check that
# libboost_LIB-NAME can link with the code CXX-TEST. The optional
# argument CXX-PROLOGUE can be used to include some C++ code before
# the `main' function.
#
# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
#
# Boost libraries typically come compiled with several flavors (with different
# runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one
# or more of the following letters: sgdpn (in that order). s = static
# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build,
# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n'
# must always be used along with `p'). Additionally, PREFERRED-RT-OPT can
# start with `mt-' to indicate that there is a preference for multi-thread
# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
# ... If you want to make sure you have a specific version of Boost
# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
AC_DEFUN([BOOST_FIND_LIBS],
[AC_REQUIRE([BOOST_REQUIRE])dnl
AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
AC_REQUIRE([BOOST_STATIC])dnl
AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl
if test x"$boost_cv_inc_path" = xno; then
AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library])
else
dnl The else branch is huge and wasn't intended on purpose.
AC_LANG_PUSH([C++])dnl
AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl
AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
BOOST_FIND_HEADER([$4])
boost_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
[_BOOST_FIND_LIBS($@)])
case $Boost_lib in #(
(no) _AC_MSG_LOG_CONFTEST
AC_MSG_ERROR([cannot find the flags to link with Boost $1])
;;
esac
AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl
AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl
AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl
AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl
CPPFLAGS=$boost_save_CPPFLAGS
AS_VAR_POPDEF([Boost_lib])dnl
AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
AS_VAR_POPDEF([Boost_lib_LDPATH])dnl
AS_VAR_POPDEF([Boost_lib_LIBS])dnl
AC_LANG_POP([C++])dnl
fi
])
# BOOST_FIND_LIB([LIB-NAME],
# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
# [CXX-PROLOGUE])
# --------------------------------------------------------------
# Backward compatibility wrapper for BOOST_FIND_LIBS.
AC_DEFUN([BOOST_FIND_LIB],
[BOOST_FIND_LIBS([$1], $@)])
# _BOOST_FIND_LIBS([LIB-NAME], [CANDIDATE-LIB-NAMES],
# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
# [CXX-PROLOGUE])
# --------------------------------------------------------------
# Real implementation of BOOST_FIND_LIBS: rely on these local macros:
# Boost_lib, Boost_lib_LDFLAGS, Boost_lib_LDPATH, Boost_lib_LIBS
#
# The algorithm is as follows: first look for a given library name
# according to the user's PREFERRED-RT-OPT. For each library name, we
# prefer to use the ones that carry the tag (toolset name). Each
# library is searched through the various standard paths were Boost is
# usually installed. If we can't find the standard variants, we try
# to enforce -mt (for instance on MacOSX, libboost_thread.dylib
# doesn't exist but there's -obviously- libboost_thread-mt.dylib).
AC_DEFUN([_BOOST_FIND_LIBS],
[Boost_lib=no
case "$3" in #(
(mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
(mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$3" : 'Xmt-*\(.*\)'`;; #(
(*) boost_mt=; boost_rtopt=$3;;
esac
if test $enable_static_boost = yes; then
boost_rtopt="s$boost_rtopt"
fi
# Find the proper debug variant depending on what we've been asked to find.
case $boost_rtopt in #(
(*d*) boost_rt_d=$boost_rtopt;; #(
(*[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
(*) boost_rt_d='-d';;
esac
# If the PREFERRED-RT-OPT are not empty, prepend a `-'.
test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
$boost_guess_use_mt && boost_mt=-mt
# Look for the abs path the static archive.
# $libext is computed by Libtool but let's make sure it's non empty.
test -z "$libext" &&
AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
boost_save_ac_objext=$ac_objext
# Generate the test file.
AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$4>
$6], [$5])])
dnl Optimization hacks: compiling C++ is slow, especially with Boost. What
dnl we're trying to do here is guess the right combination of link flags
dnl (LIBS / LDFLAGS) to use a given library. This can take several
dnl iterations before it succeeds and is thus *very* slow. So what we do
dnl instead is that we compile the code first (and thus get an object file,
dnl typically conftest.o). Then we try various combinations of link flags
dnl until we succeed to link conftest.o in an executable. The problem is
dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always
dnl remove all the temporary files including conftest.o. So the trick here
dnl is to temporarily change the value of ac_objext so that conftest.o is
dnl preserved accross tests. This is obviously fragile and I will burn in
dnl hell for not respecting Autoconf's documented interfaces, but in the
dnl mean time, it optimizes the macro by a factor of 5 to 30.
dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left
dnl empty because the test file is generated only once above (before we
dnl start the for loops).
AC_COMPILE_IFELSE([],
[ac_objext=do_not_rm_me_plz],
[AC_MSG_ERROR([cannot compile a test that uses Boost $1])])
ac_objext=$boost_save_ac_objext
boost_failed_libs=
# Don't bother to ident the following nested for loops, only the 2
# innermost ones matter.
for boost_lib_ in $2; do
for boost_tag_ in -$boost_cv_lib_tag ''; do
for boost_ver_ in -$boost_cv_lib_version ''; do
for boost_mt_ in $boost_mt -mt ''; do
for boost_rtopt_ in $boost_rtopt '' -d; do
for boost_lib in \
boost_$boost_lib_$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
boost_$boost_lib_$boost_tag_$boost_rtopt_$boost_ver_ \
boost_$boost_lib_$boost_tag_$boost_mt_$boost_ver_ \
boost_$boost_lib_$boost_tag_$boost_ver_
do
# Avoid testing twice the same lib
case $boost_failed_libs in #(
(*@$boost_lib@*) continue;;
esac
# If with_boost is empty, we'll search in /lib first, which is not quite
# right so instead we'll try to a location based on where the headers are.
boost_tmp_lib=$with_boost
test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
for boost_ldpath in "$boost_tmp_lib/lib" '' \
/opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
"$with_boost" C:/Boost/lib /lib*
do
# Don't waste time with directories that don't exist.
if test x"$boost_ldpath" != x && test ! -e "$boost_ldpath"; then
continue
fi
boost_save_LDFLAGS=$LDFLAGS
# Are we looking for a static library?
case $boost_ldpath:$boost_rtopt_ in #(
(*?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
test -e "$Boost_lib_LIBS" || continue;; #(
(*) # No: use -lboost_foo to find the shared library.
Boost_lib_LIBS="-l$boost_lib";;
esac
boost_save_LIBS=$LIBS
LIBS="$Boost_lib_LIBS $LIBS"
test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath"
dnl First argument of AC_LINK_IFELSE left empty because the test file is
dnl generated only once above (before we start the for loops).
_BOOST_AC_LINK_IFELSE([],
[Boost_lib=yes], [Boost_lib=no])
ac_objext=$boost_save_ac_objext
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
if test x"$Boost_lib" = xyes; then
# Check or used cached result of whether or not using -R or
# -rpath makes sense. Some implementations of ld, such as for
# Mac OSX, require -rpath but -R is the flag known to work on
# other systems. https://github.com/tsuna/boost.m4/issues/19
AC_CACHE_VAL([boost_cv_rpath_link_ldflag],
[case $boost_ldpath in
'') # Nothing to do.
boost_cv_rpath_link_ldflag=
boost_rpath_link_ldflag_found=yes;;
*)
for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do
LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
LIBS="$boost_save_LIBS $Boost_lib_LIBS"
_BOOST_AC_LINK_IFELSE([],
[boost_rpath_link_ldflag_found=yes
break],
[boost_rpath_link_ldflag_found=no])
done
;;
esac
AS_IF([test "x$boost_rpath_link_ldflag_found" != "xyes"],
[AC_MSG_ERROR([Unable to determine whether to use -R or -rpath])])
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
])
test x"$boost_ldpath" != x &&
Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
Boost_lib_LDPATH="$boost_ldpath"
break 7
else
boost_failed_libs="$boost_failed_libs@$boost_lib@"
fi
done
done
done
done
done
done
done # boost_lib_
rm -f conftest.$ac_objext
])
# --------------------------------------- #
# Checks for the various Boost libraries. #
# --------------------------------------- #
# List of boost libraries: http://www.boost.org/libs/libraries.htm
# The page http://beta.boost.org/doc/libs is useful: it gives the first release
# version of each library (among other things).
# BOOST_DEFUN(LIBRARY, CODE)
# --------------------------
# Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE.
#
# Use indir to avoid the warning on underquoted macro name given to AC_DEFUN.
m4_define([BOOST_DEFUN],
[m4_indir([AC_DEFUN],
m4_toupper([BOOST_$1]),
[m4_pushdef([BOOST_Library], [$1])dnl
$2
m4_popdef([BOOST_Library])dnl
])
])
# BOOST_ARRAY()
# -------------
# Look for Boost.Array
BOOST_DEFUN([Array],
[BOOST_FIND_HEADER([boost/array.hpp])])
# BOOST_ASIO()
# ------------
# Look for Boost.Asio (new in Boost 1.35).
BOOST_DEFUN([Asio],
[AC_REQUIRE([BOOST_SYSTEM])dnl
BOOST_FIND_HEADER([boost/asio.hpp])])
# BOOST_BIND()
# ------------
# Look for Boost.Bind.
BOOST_DEFUN([Bind],
[BOOST_FIND_HEADER([boost/bind.hpp])])
# BOOST_CHRONO()
# --------------
# Look for Boost.Chrono.
BOOST_DEFUN([Chrono],
[# Do we have to check for Boost.System? This link-time dependency was
# added as of 1.35.0. If we have a version <1.35, we must not attempt to
# find Boost.System as it didn't exist by then.
if test $boost_major_version -ge 135; then
BOOST_SYSTEM([$1])
fi # end of the Boost.System check.
boost_filesystem_save_LIBS=$LIBS
boost_filesystem_save_LDFLAGS=$LDFLAGS
m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
LIBS="$LIBS $BOOST_SYSTEM_LIBS"
LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
BOOST_FIND_LIB([chrono], [$1],
[boost/chrono.hpp],
[boost::chrono::thread_clock d;])
if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
BOOST_CHRONO_LIBS="$BOOST_CHRONO_LIBS $BOOST_SYSTEM_LIBS"
fi
LIBS=$boost_filesystem_save_LIBS
LDFLAGS=$boost_filesystem_save_LDFLAGS
])# BOOST_CHRONO
# BOOST_CONTEXT([PREFERRED-RT-OPT])
# -----------------------------------
# Look for Boost.Context. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
# 1.51.0
BOOST_DEFUN([Context],
[BOOST_FIND_LIB([context], [$1],
[boost/context/all.hpp],[[
// creates a stack
void * stack_pointer = new void*[4096];
std::size_t const size = sizeof(void*[4096]);
// context fc uses f() as context function
// fcontext_t is placed on top of context stack
// a pointer to fcontext_t is returned
fc = ctx::make_fcontext(stack_pointer, size, f);
return ctx::jump_fcontext(&fcm, fc, 3) == 6;]],[dnl
namespace ctx = boost::context;
// context
static ctx::fcontext_t fcm, *fc;
// context-function
static void f(intptr_t i) {
ctx::jump_fcontext(fc, &fcm, i * 2);
}])
])# BOOST_CONTEXT
# BOOST_CONVERSION()
# ------------------
# Look for Boost.Conversion (cast / lexical_cast)
BOOST_DEFUN([Conversion],
[BOOST_FIND_HEADER([boost/cast.hpp])
BOOST_FIND_HEADER([boost/lexical_cast.hpp])
])# BOOST_CONVERSION
# BOOST_COROUTINE([PREFERRED-RT-OPT])
# -----------------------------------
# Look for Boost.Coroutine. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
# 1.53.0
BOOST_DEFUN([Coroutine],
[
boost_coroutine_save_LIBS=$LIBS
boost_coroutine_save_LDFLAGS=$LDFLAGS
# Link-time dependency from coroutine to context
BOOST_CONTEXT([$1])
# Starting from Boost 1.55 a dependency on Boost.System is added
if test $boost_major_version -ge 155; then
BOOST_SYSTEM([$1])
fi