Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 1 | # =========================================================================== |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 2 | # https://www.gnu.org/software/autoconf-archive/ax_boost_base.html |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 3 | # =========================================================================== |
David Reiss | 2d2aa14 | 2008-03-26 07:22:26 +0000 | [diff] [blame] | 4 | # |
| 5 | # SYNOPSIS |
| 6 | # |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 7 | # AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
David Reiss | 2d2aa14 | 2008-03-26 07:22:26 +0000 | [diff] [blame] | 8 | # |
| 9 | # DESCRIPTION |
| 10 | # |
| 11 | # Test for the Boost C++ libraries of a particular version (or newer) |
| 12 | # |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 13 | # If no path to the installed boost library is given the macro searchs |
| 14 | # under /usr, /usr/local, /opt and /opt/local and evaluates the |
| 15 | # $BOOST_ROOT environment variable. Further documentation is available at |
| 16 | # <http://randspringer.de/boost/index.html>. |
David Reiss | 2d2aa14 | 2008-03-26 07:22:26 +0000 | [diff] [blame] | 17 | # |
| 18 | # This macro calls: |
| 19 | # |
| 20 | # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) |
| 21 | # |
| 22 | # And sets: |
| 23 | # |
| 24 | # HAVE_BOOST |
| 25 | # |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 26 | # LICENSE |
David Reiss | 2d2aa14 | 2008-03-26 07:22:26 +0000 | [diff] [blame] | 27 | # |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 28 | # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de> |
| 29 | # Copyright (c) 2009 Peter Adolphs |
David Reiss | 2d2aa14 | 2008-03-26 07:22:26 +0000 | [diff] [blame] | 30 | # |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 31 | # Copying and distribution of this file, with or without modification, are |
| 32 | # permitted in any medium without royalty provided the copyright notice |
| 33 | # and this notice are preserved. This file is offered as-is, without any |
| 34 | # warranty. |
| 35 | |
James E. King III | 56ac72e | 2018-12-17 09:32:24 -0500 | [diff] [blame] | 36 | #serial 45 |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 37 | |
| 38 | # example boost program (need to pass version) |
| 39 | m4_define([_AX_BOOST_BASE_PROGRAM], |
| 40 | [AC_LANG_PROGRAM([[ |
| 41 | #include <boost/version.hpp> |
| 42 | ]],[[ |
| 43 | (void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))])); |
| 44 | ]])]) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 45 | |
| 46 | AC_DEFUN([AX_BOOST_BASE], |
| 47 | [ |
| 48 | AC_ARG_WITH([boost], |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 49 | [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], |
| 50 | [use Boost library from a standard location (ARG=yes), |
| 51 | from the specified location (ARG=<path>), |
| 52 | or disable it (ARG=no) |
| 53 | @<:@ARG=yes@:>@ ])], |
| 54 | [ |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 55 | AS_CASE([$withval], |
| 56 | [no],[want_boost="no";_AX_BOOST_BASE_boost_path=""], |
| 57 | [yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""], |
| 58 | [want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"]) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 59 | ], |
Marc Slemko | 75c2f70 | 2007-01-17 07:59:38 +0000 | [diff] [blame] | 60 | [want_boost="yes"]) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 61 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 62 | |
| 63 | AC_ARG_WITH([boost-libdir], |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 64 | [AS_HELP_STRING([--with-boost-libdir=LIB_DIR], |
| 65 | [Force given directory for boost libraries. |
| 66 | Note that this will override library path detection, |
| 67 | so use this parameter only if default library detection fails |
| 68 | and you know exactly where your boost libraries are located.])], |
| 69 | [ |
| 70 | AS_IF([test -d "$withval"], |
| 71 | [_AX_BOOST_BASE_boost_lib_path="$withval"], |
| 72 | [AC_MSG_ERROR([--with-boost-libdir expected directory name])]) |
| 73 | ], |
| 74 | [_AX_BOOST_BASE_boost_lib_path=""]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 75 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 76 | BOOST_LDFLAGS="" |
| 77 | BOOST_CPPFLAGS="" |
| 78 | AS_IF([test "x$want_boost" = "xyes"], |
| 79 | [_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])]) |
| 80 | AC_SUBST(BOOST_CPPFLAGS) |
| 81 | AC_SUBST(BOOST_LDFLAGS) |
| 82 | ]) |
| 83 | |
| 84 | |
| 85 | # convert a version string in $2 to numeric and affect to polymorphic var $1 |
| 86 | AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[ |
| 87 | AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"]) |
| 88 | _AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'` |
| 89 | _AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'` |
| 90 | AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"], |
| 91 | [AC_MSG_ERROR([You should at least specify libboost major version])]) |
| 92 | _AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'` |
| 93 | AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"], |
| 94 | [_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"]) |
| 95 | _AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` |
| 96 | AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"], |
| 97 | [_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"]) |
| 98 | _AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor` |
| 99 | AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET) |
| 100 | ]) |
| 101 | |
| 102 | dnl Run the detection of boost should be run only if $want_boost |
| 103 | AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[ |
| 104 | _AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 105 | succeeded=no |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 106 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 107 | |
| 108 | AC_REQUIRE([AC_CANONICAL_HOST]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 109 | dnl On 64-bit systems check for system libraries in both lib64 and lib. |
| 110 | dnl The former is specified by FHS, but e.g. Debian does not adhere to |
| 111 | dnl this (as it rises problems for generic multi-arch support). |
| 112 | dnl The last entry in the list is chosen by default when no libraries |
| 113 | dnl are found, e.g. when only header-only libraries are installed! |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 114 | AS_CASE([${host_cpu}], |
| 115 | [x86_64],[libsubdirs="lib64 libx32 lib lib64"], |
Huang Yang | 607cd54 | 2024-09-04 11:11:18 +0800 | [diff] [blame] | 116 | [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|loongarch64],[libsubdirs="lib64 lib lib64"], |
James E. King III | 56ac72e | 2018-12-17 09:32:24 -0500 | [diff] [blame] | 117 | [libsubdirs="lib"] |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 118 | ) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 119 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 120 | dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give |
| 121 | dnl them priority over the other paths since, if libs are found there, they |
| 122 | dnl are almost assuredly the ones desired. |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 123 | AS_CASE([${host_cpu}], |
| 124 | [i?86],[multiarch_libsubdir="lib/i386-${host_os}"], |
| 125 | [multiarch_libsubdir="lib/${host_cpu}-${host_os}"] |
| 126 | ) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 127 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 128 | dnl first we check the system location for boost libraries |
| 129 | dnl this location ist chosen if boost libraries are installed with the --layout=system option |
| 130 | dnl or if you install boost with RPM |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 131 | AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[ |
| 132 | AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"]) |
| 133 | AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[ |
| 134 | AC_MSG_RESULT([yes]) |
| 135 | BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include" |
| 136 | for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do |
| 137 | AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"]) |
| 138 | AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[ |
| 139 | AC_MSG_RESULT([yes]) |
| 140 | BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"; |
| 141 | break; |
| 142 | ], |
| 143 | [AC_MSG_RESULT([no])]) |
| 144 | done],[ |
| 145 | AC_MSG_RESULT([no])]) |
| 146 | ],[ |
| 147 | if test X"$cross_compiling" = Xyes; then |
| 148 | search_libsubdirs=$multiarch_libsubdir |
| 149 | else |
| 150 | search_libsubdirs="$multiarch_libsubdir $libsubdirs" |
| 151 | fi |
| 152 | for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do |
| 153 | if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then |
| 154 | for libsubdir in $search_libsubdirs ; do |
| 155 | if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 156 | done |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 157 | BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir" |
| 158 | BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include" |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 159 | break; |
| 160 | fi |
| 161 | done |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 162 | ]) |
Christian Lavoie | 4f42ef7 | 2010-11-04 18:51:42 +0000 | [diff] [blame] | 163 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 164 | dnl overwrite ld flags if we have required special directory with |
| 165 | dnl --with-boost-libdir parameter |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 166 | AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"], |
| 167 | [BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 168 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 169 | AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 170 | CPPFLAGS_SAVED="$CPPFLAGS" |
| 171 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
| 172 | export CPPFLAGS |
| 173 | |
| 174 | LDFLAGS_SAVED="$LDFLAGS" |
| 175 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
| 176 | export LDFLAGS |
| 177 | |
| 178 | AC_REQUIRE([AC_PROG_CXX]) |
| 179 | AC_LANG_PUSH(C++) |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 180 | AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[ |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 181 | AC_MSG_RESULT(yes) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 182 | succeeded=yes |
| 183 | found_system=yes |
| 184 | ],[ |
| 185 | ]) |
| 186 | AC_LANG_POP([C++]) |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 187 | |
| 188 | |
| 189 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 190 | dnl if we found no boost with system layout we search for boost libraries |
| 191 | dnl built and installed without the --layout=system option or for a staged(not installed) version |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 192 | if test "x$succeeded" != "xyes" ; then |
| 193 | CPPFLAGS="$CPPFLAGS_SAVED" |
| 194 | LDFLAGS="$LDFLAGS_SAVED" |
| 195 | BOOST_CPPFLAGS= |
| 196 | if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then |
| 197 | BOOST_LDFLAGS= |
| 198 | fi |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 199 | _version=0 |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 200 | if test -n "$_AX_BOOST_BASE_boost_path" ; then |
| 201 | if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then |
| 202 | for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do |
| 203 | _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 204 | V_CHECK=`expr $_version_tmp \> $_version` |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 205 | if test "x$V_CHECK" = "x1" ; then |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 206 | _version=$_version_tmp |
| 207 | fi |
| 208 | VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 209 | BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE" |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 210 | done |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 211 | dnl if nothing found search for layout used in Windows distributions |
| 212 | if test -z "$BOOST_CPPFLAGS"; then |
| 213 | if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then |
| 214 | BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path" |
| 215 | fi |
| 216 | fi |
| 217 | dnl if we found something and BOOST_LDFLAGS was unset before |
| 218 | dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here. |
| 219 | if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then |
| 220 | for libsubdir in $libsubdirs ; do |
| 221 | if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi |
| 222 | done |
| 223 | BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir" |
| 224 | fi |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 225 | fi |
| 226 | else |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 227 | if test "x$cross_compiling" != "xyes" ; then |
| 228 | for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do |
| 229 | if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then |
| 230 | for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do |
| 231 | _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 232 | V_CHECK=`expr $_version_tmp \> $_version` |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 233 | if test "x$V_CHECK" = "x1" ; then |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 234 | _version=$_version_tmp |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 235 | best_path=$_AX_BOOST_BASE_boost_path |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 236 | fi |
| 237 | done |
| 238 | fi |
| 239 | done |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 240 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 241 | VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` |
| 242 | BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 243 | if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 244 | for libsubdir in $libsubdirs ; do |
| 245 | if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi |
| 246 | done |
| 247 | BOOST_LDFLAGS="-L$best_path/$libsubdir" |
| 248 | fi |
| 249 | fi |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 250 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 251 | if test -n "$BOOST_ROOT" ; then |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 252 | for libsubdir in $libsubdirs ; do |
| 253 | if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi |
| 254 | done |
| 255 | if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then |
| 256 | version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` |
| 257 | stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` |
| 258 | stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` |
| 259 | V_CHECK=`expr $stage_version_shorten \>\= $_version` |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 260 | if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 261 | AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) |
| 262 | BOOST_CPPFLAGS="-I$BOOST_ROOT" |
| 263 | BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" |
| 264 | fi |
| 265 | fi |
| 266 | fi |
| 267 | fi |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 268 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 269 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
| 270 | export CPPFLAGS |
| 271 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
| 272 | export LDFLAGS |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 273 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 274 | AC_LANG_PUSH(C++) |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 275 | AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[ |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 276 | AC_MSG_RESULT(yes) |
| 277 | succeeded=yes |
| 278 | found_system=yes |
| 279 | ],[ |
| 280 | ]) |
| 281 | AC_LANG_POP([C++]) |
| 282 | fi |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 283 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 284 | if test "x$succeeded" != "xyes" ; then |
| 285 | if test "x$_version" = "x0" ; then |
| 286 | AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]]) |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 287 | else |
| 288 | AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) |
| 289 | fi |
| 290 | # execute ACTION-IF-NOT-FOUND (if present): |
| 291 | ifelse([$3], , :, [$3]) |
| 292 | else |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 293 | AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) |
| 294 | # execute ACTION-IF-FOUND (if present): |
| 295 | ifelse([$2], , :, [$2]) |
| 296 | fi |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 297 | |
Roger Meier | 73b58a2 | 2014-05-11 17:39:34 +0200 | [diff] [blame] | 298 | CPPFLAGS="$CPPFLAGS_SAVED" |
| 299 | LDFLAGS="$LDFLAGS_SAVED" |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 300 | |
| 301 | ]) |