| 1 | ## -*- mode: m4 -*- |
|---|
| 2 | dnl Copyright (c) 2000 Dirk Mueller <dirk@licq.org> |
|---|
| 3 | |
|---|
| 4 | dnl Check for sys_errlist[] and sys_nerr, check for declaration |
|---|
| 5 | dnl Check nicked from aclocal.m4 used by GNU bash 2.01 |
|---|
| 6 | AC_DEFUN([LICQ_SYS_ERRLIST], |
|---|
| 7 | [AC_MSG_CHECKING([for sys_errlist and sys_nerr]) |
|---|
| 8 | AC_CACHE_VAL(ac_cv_sys_errlist, |
|---|
| 9 | [AC_TRY_LINK([#include <errno.h>], |
|---|
| 10 | [extern char *sys_errlist[]; |
|---|
| 11 | extern int sys_nerr; |
|---|
| 12 | char *msg = sys_errlist[sys_nerr - 1];], |
|---|
| 13 | ac_cv_sys_errlist=yes, ac_cv_sys_errlist=no)])dnl |
|---|
| 14 | AC_MSG_RESULT($ac_cv_sys_errlist) |
|---|
| 15 | if test $ac_cv_sys_errlist = yes; then |
|---|
| 16 | AC_DEFINE_UNQUOTED(HAVE_SYS_ERRLIST, 1, [Define if sys_errlist available]) |
|---|
| 17 | fi |
|---|
| 18 | ]) |
|---|
| 19 | |
|---|
| 20 | AC_DEFUN([LICQ_FIND_FILE], |
|---|
| 21 | [ |
|---|
| 22 | $3="" |
|---|
| 23 | for i in $2; |
|---|
| 24 | do |
|---|
| 25 | for j in $1; |
|---|
| 26 | do |
|---|
| 27 | if test -r "$i/$j"; then |
|---|
| 28 | $3=$i |
|---|
| 29 | break 2 |
|---|
| 30 | fi |
|---|
| 31 | done |
|---|
| 32 | done |
|---|
| 33 | ]) |
|---|
| 34 | |
|---|
| 35 | AC_DEFUN([LICQ_CHECK_GETHOSTBYNAME], |
|---|
| 36 | [ |
|---|
| 37 | AC_SEARCH_LIBS(gethostbyname, nsl) |
|---|
| 38 | ]) |
|---|
| 39 | |
|---|
| 40 | AC_DEFUN([LICQ_CHECK_LICQ], |
|---|
| 41 | [ |
|---|
| 42 | AC_MSG_CHECKING([for licq header files]) |
|---|
| 43 | |
|---|
| 44 | AC_ARG_WITH(licq-includes, |
|---|
| 45 | [ --with-licq-includes where the Licq daemon includes are located.], |
|---|
| 46 | [ licq_licq_includes="$withval" ]) |
|---|
| 47 | |
|---|
| 48 | if test -n "$licq_licq_includes"; then |
|---|
| 49 | relpath="`(cd $licq_licq_includes && pwd) 2>/dev/null`" |
|---|
| 50 | if test -n "$relpath"; then |
|---|
| 51 | licq_licq_includes="$relpath" |
|---|
| 52 | fi |
|---|
| 53 | LICQ_FIND_FILE(licq_icqd.h, $licq_licq_includes, licq_inc) |
|---|
| 54 | else |
|---|
| 55 | licq_paths="$prefix/include/licq \ |
|---|
| 56 | /usr/local/include/licq \ |
|---|
| 57 | /usr/include/licq" |
|---|
| 58 | |
|---|
| 59 | relpath=`cd $srcdir/../../include && pwd` |
|---|
| 60 | |
|---|
| 61 | if test -r $relpath/licq_icqd.h; then |
|---|
| 62 | LICQ_FIND_FILE(licq_icqd.h, $relpath, licq_inc) |
|---|
| 63 | else |
|---|
| 64 | LICQ_FIND_FILE(licq_icqd.h, $licq_paths, licq_inc) |
|---|
| 65 | fi |
|---|
| 66 | fi |
|---|
| 67 | |
|---|
| 68 | if test -z "$licq_inc"; then |
|---|
| 69 | have_licq_inc=no |
|---|
| 70 | else |
|---|
| 71 | have_licq_inc=yes |
|---|
| 72 | fi |
|---|
| 73 | if test "$have_licq_inc" = yes; then |
|---|
| 74 | AC_MSG_RESULT(["$licq_inc"]) |
|---|
| 75 | LICQ_INCLUDES="$licq_inc" |
|---|
| 76 | else |
|---|
| 77 | AC_MSG_RESULT(["not found"]) |
|---|
| 78 | fi |
|---|
| 79 | |
|---|
| 80 | AC_SUBST(LICQ_INCLUDES) |
|---|
| 81 | |
|---|
| 82 | if test "$have_licq_inc" = "no"; then |
|---|
| 83 | AC_MSG_ERROR([ |
|---|
| 84 | I can't find the Licq header files. Make sure that you ran |
|---|
| 85 | "make install" for the Licq daemon or installed the licq header |
|---|
| 86 | files RPM. |
|---|
| 87 | |
|---|
| 88 | Most likely you just need to set --prefix to the correct value. |
|---|
| 89 | |
|---|
| 90 | You could also try the --with-licq-includes=<path> configure switch to |
|---|
| 91 | overwrite this check if you have installed them in an unusual place. |
|---|
| 92 | ]) |
|---|
| 93 | fi |
|---|
| 94 | ]) |
|---|
| 95 | |
|---|
| 96 | dnl Check if it is possible to turn off exceptions/rtti support |
|---|
| 97 | AC_DEFUN([LICQ_CXX_FLAGS], |
|---|
| 98 | [ |
|---|
| 99 | AC_ARG_ENABLE(debug, |
|---|
| 100 | [ --enable-debug creates debugging code], |
|---|
| 101 | [ licq_use_debug="$enableval"], [licq_use_debug="no"]) |
|---|
| 102 | |
|---|
| 103 | if test "$licq_use_debug" = "no"; then |
|---|
| 104 | CXXFLAGS="`echo $CXXFLAGS | sed 's/-g[[^ ]]*//'`" |
|---|
| 105 | CFLAGS="`echo $CFLAGS | sed 's/-g[[^ ]]*//'`" |
|---|
| 106 | else |
|---|
| 107 | CXXFLAGS="$CXXFLAGS -g" |
|---|
| 108 | CFLAGS="$CFLAGS -g" |
|---|
| 109 | fi |
|---|
| 110 | ]) |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | dnl Check if it is possible to turn off exceptions support |
|---|
| 114 | AC_DEFUN([LICQDAEMON_CXX_FLAGS], |
|---|
| 115 | [ |
|---|
| 116 | AC_ARG_ENABLE(debug, |
|---|
| 117 | [ --enable-debug creates debugging code], |
|---|
| 118 | [ licqdaemon_use_debug="$enableval"], [licqdaemon_use_debug="no"]) |
|---|
| 119 | if test "$licqdaemon_use_debug" = "no"; then |
|---|
| 120 | CXXFLAGS="`echo $CXXFLAGS | sed 's/-g[[^ ]]*//'`" |
|---|
| 121 | CFLAGS="`echo $CFLAGS | sed 's/-g[[^ ]]*//'`" |
|---|
| 122 | else |
|---|
| 123 | CXXFLAGS="$CXXFLAGS -g" |
|---|
| 124 | CFLAGS="$CFLAGS -g" |
|---|
| 125 | fi |
|---|
| 126 | ]) |
|---|
| 127 | |
|---|
| 128 | dnl Check if we should use -Wextra or -W to get extra warnings |
|---|
| 129 | AC_DEFUN([LICQ_CXX_WEXTRA], |
|---|
| 130 | [ |
|---|
| 131 | AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl |
|---|
| 132 | old_CFLAGS="$CFLAGS" |
|---|
| 133 | CFLAGS="$CFLAGS -Wextra" |
|---|
| 134 | AC_COMPILE_IFELSE([void foo (void) { }], ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no) |
|---|
| 135 | CFLAGS="$old_CFLAGS"]) |
|---|
| 136 | AC_SUBST(WEXTRA) |
|---|
| 137 | AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W]) |
|---|
| 138 | ]) |
|---|
| 139 | |
|---|
| 140 | dnl Check if the type socklen_t is defined anywhere |
|---|
| 141 | AC_DEFUN([AC_C_SOCKLEN_T], |
|---|
| 142 | [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t, |
|---|
| 143 | [ |
|---|
| 144 | AC_TRY_COMPILE([ |
|---|
| 145 | #include <sys/types.h> |
|---|
| 146 | #include <sys/socket.h> |
|---|
| 147 | ],[ |
|---|
| 148 | socklen_t foo; |
|---|
| 149 | ],[ |
|---|
| 150 | ac_cv_c_socklen_t=yes |
|---|
| 151 | ],[ |
|---|
| 152 | ac_cv_c_socklen_t=no |
|---|
| 153 | ]) |
|---|
| 154 | ]) |
|---|
| 155 | if test $ac_cv_c_socklen_t = no; then |
|---|
| 156 | AC_DEFINE(socklen_t, int, [define to int if socklen_t not available]) |
|---|
| 157 | fi |
|---|
| 158 | |
|---|
| 159 | ]) |
|---|
| 160 | |
|---|
| 161 | dnl Check if the type socklen_t is defined anywhere |
|---|
| 162 | AC_DEFUN([AC_C_SOCKLEN_T_AND_SOCKS], |
|---|
| 163 | [AC_CACHE_CHECK(for SOCKS socklen_t, ac_cv_c_socklen_t, |
|---|
| 164 | |
|---|
| 165 | ]); |
|---|
| 166 | |
|---|
| 167 | ]) |
|---|
| 168 | |
|---|
| 169 | AC_DEFUN([_AM_PATH_GPGME_CONFIG], |
|---|
| 170 | [ AC_ARG_WITH(gpgme-prefix, |
|---|
| 171 | AC_HELP_STRING([--with-gpgme-prefix=PFX], |
|---|
| 172 | [prefix where GPGME is installed (optional)]), |
|---|
| 173 | gpgme_config_prefix="$withval", gpgme_config_prefix="") |
|---|
| 174 | if test "x$gpgme_config_prefix" != x ; then |
|---|
| 175 | GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config" |
|---|
| 176 | fi |
|---|
| 177 | AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) |
|---|
| 178 | ]) |
|---|
| 179 | |
|---|
| 180 | dnl AM_PATH_GPGME([MINIMUM-VERSION, |
|---|
| 181 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) |
|---|
| 182 | dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. |
|---|
| 183 | dnl |
|---|
| 184 | AC_DEFUN([LICQ_CHECK_GPGME], |
|---|
| 185 | [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl |
|---|
| 186 | tmp=ifelse([$1], ,1:0.4.2,$1) |
|---|
| 187 | if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then |
|---|
| 188 | req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` |
|---|
| 189 | min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` |
|---|
| 190 | else |
|---|
| 191 | req_gpgme_api=0 |
|---|
| 192 | min_gpgme_version="$tmp" |
|---|
| 193 | fi |
|---|
| 194 | |
|---|
| 195 | AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) |
|---|
| 196 | ok=no |
|---|
| 197 | if test "$GPGME_CONFIG" != "no" ; then |
|---|
| 198 | gpgme_version=`$GPGME_CONFIG --version` |
|---|
| 199 | gpgme_version_major=`echo $gpgme_version | \ |
|---|
| 200 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
|---|
| 201 | gpgme_version_minor=`echo $gpgme_version | \ |
|---|
| 202 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
|---|
| 203 | gpgme_version_micro=`echo $gpgme_version | \ |
|---|
| 204 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` |
|---|
| 205 | req_major=`echo $min_gpgme_version | \ |
|---|
| 206 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
|---|
| 207 | req_minor=`echo $min_gpgme_version | \ |
|---|
| 208 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
|---|
| 209 | req_micro=`echo $min_gpgme_version | \ |
|---|
| 210 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
|---|
| 211 | if test "$gpgme_version_major" -gt "$req_major"; then |
|---|
| 212 | ok=yes |
|---|
| 213 | else |
|---|
| 214 | if test "$gpgme_version_major" -eq "$req_major"; then |
|---|
| 215 | if test "$gpgme_version_minor" -gt "$req_minor"; then |
|---|
| 216 | ok=yes |
|---|
| 217 | else |
|---|
| 218 | if test "$gpgme_version_minor" -eq "$req_minor"; then |
|---|
| 219 | if test "$gpgme_version_micro" -ge "$req_micro"; then |
|---|
| 220 | ok=yes |
|---|
| 221 | fi |
|---|
| 222 | fi |
|---|
| 223 | fi |
|---|
| 224 | fi |
|---|
| 225 | fi |
|---|
| 226 | fi |
|---|
| 227 | if test $ok = yes; then |
|---|
| 228 | # If we have a recent GPGME, we should also check that the |
|---|
| 229 | # API is compatible. |
|---|
| 230 | if test "$req_gpgme_api" -gt 0 ; then |
|---|
| 231 | tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` |
|---|
| 232 | if test "$tmp" -gt 0 ; then |
|---|
| 233 | if test "$req_gpgme_api" -ne "$tmp" ; then |
|---|
| 234 | ok=no |
|---|
| 235 | fi |
|---|
| 236 | fi |
|---|
| 237 | fi |
|---|
| 238 | fi |
|---|
| 239 | |
|---|
| 240 | if test $ok = yes; then |
|---|
| 241 | CPPFLAGS_SAVE="$CPPFLAGS" |
|---|
| 242 | LIBS_SAVE="$LIBS" |
|---|
| 243 | |
|---|
| 244 | GPGME_CFLAGS=`$GPGME_CONFIG --cflags` |
|---|
| 245 | GPGME_LIBS=`$GPGME_CONFIG --libs` |
|---|
| 246 | CPPFLAGS="$CPPFLAGS $GPGME_CFLAGS" |
|---|
| 247 | LIBS="$LIBS $GPGME_LIBS" |
|---|
| 248 | |
|---|
| 249 | AC_TRY_LINK([ |
|---|
| 250 | #include <gpgme.h> |
|---|
| 251 | ],[ |
|---|
| 252 | gpgme_data_t data; |
|---|
| 253 | if (gpgme_data_new(&data) == GPG_ERR_NO_ERROR) |
|---|
| 254 | gpgme_data_release(data); |
|---|
| 255 | ],[ |
|---|
| 256 | ok=yes |
|---|
| 257 | ],[ |
|---|
| 258 | ok=no |
|---|
| 259 | ]) |
|---|
| 260 | |
|---|
| 261 | CPPFLAGS="$CPPFLAGS_SAVE" |
|---|
| 262 | LIBS="$LIBS_SAVE" |
|---|
| 263 | fi |
|---|
| 264 | |
|---|
| 265 | if test $ok = yes; then |
|---|
| 266 | GPGME_CFLAGS=`$GPGME_CONFIG --cflags` |
|---|
| 267 | GPGME_LIBS=`$GPGME_CONFIG --libs` |
|---|
| 268 | AC_MSG_RESULT(yes) |
|---|
| 269 | LIBS="$LIBS $GPGME_LIBS" |
|---|
| 270 | CPPFLAGS="$CPPFLAGS $GPGME_CFLAGS" |
|---|
| 271 | AC_DEFINE_UNQUOTED(HAVE_LIBGPGME, 1, [Define if GPGME is available]) |
|---|
| 272 | WITH_GPGME="yes" |
|---|
| 273 | else |
|---|
| 274 | AC_MSG_RESULT(no) |
|---|
| 275 | WITH_GPGME="no" |
|---|
| 276 | fi |
|---|
| 277 | ]) |
|---|
| 278 | |
|---|
| 279 | AC_DEFUN([LICQ_CHECK_OPENSSL], |
|---|
| 280 | [ |
|---|
| 281 | AC_MSG_CHECKING(if OpenSSL support is desired) |
|---|
| 282 | |
|---|
| 283 | AC_ARG_ENABLE( |
|---|
| 284 | openssl, |
|---|
| 285 | [ --disable-openssl disable OpenSSL support], |
|---|
| 286 | WITH_OPENSSL="$enableval", WITH_OPENSSL="yes") |
|---|
| 287 | |
|---|
| 288 | AC_ARG_WITH( |
|---|
| 289 | openssl-inc, |
|---|
| 290 | [ --with-openssl-inc=PATH include path for OpenSSL headers], |
|---|
| 291 | openssl_incdir="$withval", openssl_incdir="no") |
|---|
| 292 | |
|---|
| 293 | AC_ARG_WITH( |
|---|
| 294 | openssl-lib, |
|---|
| 295 | [ --with-openssl-lib=PATH library path for OpenSSL libraries], |
|---|
| 296 | openssl_libdir="$withval", openssl_libdir="no") |
|---|
| 297 | |
|---|
| 298 | if test "$WITH_OPENSSL" = "no"; then |
|---|
| 299 | AC_MSG_RESULT(no) |
|---|
| 300 | else |
|---|
| 301 | AC_MSG_RESULT(yes) |
|---|
| 302 | |
|---|
| 303 | dnl AC_MSG_CHECKING(for the OpenSSL headers) |
|---|
| 304 | temp=$CPPFLAGS |
|---|
| 305 | dnl Extra search path for kerberos includes, Redhat 9 needs this for OpenSSL |
|---|
| 306 | if test -d "/usr/kerberos/include"; then |
|---|
| 307 | kerberos_incdir="-I/usr/kerberos/include" |
|---|
| 308 | CPPFLAGS="$CPPFLAGS $kerberos_incdir" |
|---|
| 309 | fi |
|---|
| 310 | |
|---|
| 311 | if test "$openssl_incdir" != "no"; then |
|---|
| 312 | CPPFLAGS="$CPPFLAGS -I$openssl_incdir" |
|---|
| 313 | fi |
|---|
| 314 | AC_CHECK_HEADER(openssl/ssl.h, WITH_OPENSSL="yes", WITH_OPENSSL="no") |
|---|
| 315 | if test "$WITH_OPENSSL" = "no"; then |
|---|
| 316 | CPPFLAGS="$temp" |
|---|
| 317 | fi |
|---|
| 318 | |
|---|
| 319 | if test "$WITH_OPENSSL" = "yes"; then |
|---|
| 320 | dnl AC_MSG_CHECKING(for the OpenSSL library) |
|---|
| 321 | temp="$LIBS" |
|---|
| 322 | if test "$openssl_libdir" != "no"; then |
|---|
| 323 | LIBS="$LIBS -L$openssl_libdir" |
|---|
| 324 | fi |
|---|
| 325 | AC_CHECK_LIB(crypto, DH_free) |
|---|
| 326 | if test "$ac_cv_lib_crypto_DH_free" = "yes"; then |
|---|
| 327 | AC_CHECK_LIB(ssl, SSL_new, WITH_OPENSSL="yes", WITH_OPENSSL="no") |
|---|
| 328 | else |
|---|
| 329 | WITH_OPENSSL="no" |
|---|
| 330 | fi |
|---|
| 331 | if test "$WITH_OPENSSL" = "no"; then |
|---|
| 332 | LIBS="$temp" |
|---|
| 333 | else |
|---|
| 334 | LIBS="-lssl $LIBS" |
|---|
| 335 | fi |
|---|
| 336 | fi |
|---|
| 337 | |
|---|
| 338 | AC_MSG_CHECKING(if OpenSSL support can be enabled) |
|---|
| 339 | if test "$WITH_OPENSSL" = "yes"; then |
|---|
| 340 | AC_DEFINE_UNQUOTED(USE_OPENSSL, 1, [Define if OpenSSL is available]) |
|---|
| 341 | AC_MSG_RESULT(yes) |
|---|
| 342 | else |
|---|
| 343 | AC_MSG_RESULT(no) |
|---|
| 344 | fi |
|---|
| 345 | fi |
|---|
| 346 | ]) |
|---|
| 347 | |
|---|
| 348 | dnl @synopsis AX_BOOST([MINIMUM-VERSION]) |
|---|
| 349 | dnl |
|---|
| 350 | dnl Test for the Boost C++ libraries of a particular version (or newer) |
|---|
| 351 | dnl |
|---|
| 352 | dnl If no path to the installed boost library is given the macro |
|---|
| 353 | dnl searchs under /usr, /usr/local, and /opt, and evaluates the |
|---|
| 354 | dnl $BOOST_ROOT environment variable. Further documentation is |
|---|
| 355 | dnl available at <http://randspringer.de/boost/index.html>. |
|---|
| 356 | dnl |
|---|
| 357 | dnl This macro sets: |
|---|
| 358 | dnl |
|---|
| 359 | dnl HAVE_BOOST |
|---|
| 360 | dnl |
|---|
| 361 | dnl @category InstalledPackages |
|---|
| 362 | dnl @category Cxx |
|---|
| 363 | dnl @author Thomas Porschberg <thomas@randspringer.de> |
|---|
| 364 | dnl @version 2006-06-15 |
|---|
| 365 | dnl @license AllPermissive |
|---|
| 366 | AC_DEFUN([AX_BOOST_BASE], |
|---|
| 367 | [ |
|---|
| 368 | AC_ARG_WITH([boost], |
|---|
| 369 | AS_HELP_STRING([--with-boost-dir@<:@=DIR@:>@], [specify boost directory (optional)]), |
|---|
| 370 | [ |
|---|
| 371 | if test "$withval" = "yes"; then |
|---|
| 372 | ac_boost_path="" |
|---|
| 373 | else |
|---|
| 374 | ac_boost_path="$withval" |
|---|
| 375 | fi |
|---|
| 376 | ]) |
|---|
| 377 | |
|---|
| 378 | boost_lib_version_req=ifelse([$1], ,1.31.0,$1) |
|---|
| 379 | boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` |
|---|
| 380 | boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` |
|---|
| 381 | boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` |
|---|
| 382 | boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` |
|---|
| 383 | if test "x$boost_lib_version_req_sub_minor" = "x" ; then |
|---|
| 384 | boost_lib_version_req_sub_minor="0" |
|---|
| 385 | fi |
|---|
| 386 | WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` |
|---|
| 387 | AC_MSG_CHECKING(for Boost >= $boost_lib_version_req) |
|---|
| 388 | succeeded=no |
|---|
| 389 | |
|---|
| 390 | dnl first we check the system location for boost libraries |
|---|
| 391 | dnl this location ist chosen if boost libraries are installed with the --layout=system option |
|---|
| 392 | dnl or if you install boost with RPM |
|---|
| 393 | if test "$ac_boost_path" != ""; then |
|---|
| 394 | BOOST_LDFLAGS="-L$ac_boost_path/lib" |
|---|
| 395 | BOOST_CPPFLAGS="-I$ac_boost_path/include" |
|---|
| 396 | else |
|---|
| 397 | for ac_boost_path_tmp in /usr /usr/local /opt ; do |
|---|
| 398 | if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then |
|---|
| 399 | BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" |
|---|
| 400 | BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" |
|---|
| 401 | break; |
|---|
| 402 | fi |
|---|
| 403 | done |
|---|
| 404 | fi |
|---|
| 405 | |
|---|
| 406 | CPPFLAGS_SAVED="$CPPFLAGS" |
|---|
| 407 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
|---|
| 408 | export CPPFLAGS |
|---|
| 409 | |
|---|
| 410 | LDFLAGS_SAVED="$LDFLAGS" |
|---|
| 411 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
|---|
| 412 | export LDFLAGS |
|---|
| 413 | |
|---|
| 414 | AC_LANG_PUSH(C++) |
|---|
| 415 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 416 | @%:@include <boost/version.hpp> |
|---|
| 417 | ]], [[ |
|---|
| 418 | #if BOOST_VERSION >= $WANT_BOOST_VERSION |
|---|
| 419 | // Everything is okay |
|---|
| 420 | #else |
|---|
| 421 | # error Boost version is too old |
|---|
| 422 | #endif |
|---|
| 423 | ]])],[ |
|---|
| 424 | AC_MSG_RESULT(yes) |
|---|
| 425 | succeeded=yes |
|---|
| 426 | found_system=yes |
|---|
| 427 | ],[ |
|---|
| 428 | ]) |
|---|
| 429 | AC_LANG_POP([C++]) |
|---|
| 430 | |
|---|
| 431 | dnl if we found no boost with system layout we search for boost libraries |
|---|
| 432 | dnl built and installed without the --layout=system option or for a staged(not installed) version |
|---|
| 433 | if test "x$succeeded" != "xyes"; then |
|---|
| 434 | _version=0 |
|---|
| 435 | if test "$ac_boost_path" != ""; then |
|---|
| 436 | BOOST_LDFLAGS="-L$ac_boost_path/lib" |
|---|
| 437 | if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then |
|---|
| 438 | for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do |
|---|
| 439 | _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` |
|---|
| 440 | V_CHECK=`expr $_version_tmp \> $_version` |
|---|
| 441 | if test "$V_CHECK" = "1" ; then |
|---|
| 442 | _version=$_version_tmp |
|---|
| 443 | fi |
|---|
| 444 | VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` |
|---|
| 445 | BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" |
|---|
| 446 | done |
|---|
| 447 | fi |
|---|
| 448 | else |
|---|
| 449 | for ac_boost_path in /usr /usr/local /opt ; do |
|---|
| 450 | if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then |
|---|
| 451 | for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do |
|---|
| 452 | _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` |
|---|
| 453 | V_CHECK=`expr $_version_tmp \> $_version` |
|---|
| 454 | if test "$V_CHECK" = "1" ; then |
|---|
| 455 | _version=$_version_tmp |
|---|
| 456 | best_path=$ac_boost_path |
|---|
| 457 | fi |
|---|
| 458 | done |
|---|
| 459 | fi |
|---|
| 460 | done |
|---|
| 461 | |
|---|
| 462 | VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` |
|---|
| 463 | BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" |
|---|
| 464 | BOOST_LDFLAGS="-L$best_path/lib" |
|---|
| 465 | |
|---|
| 466 | if test "x$BOOST_ROOT" != "x"; then |
|---|
| 467 | if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then |
|---|
| 468 | version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` |
|---|
| 469 | stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` |
|---|
| 470 | stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` |
|---|
| 471 | V_CHECK=`expr $stage_version_shorten \>\= $_version` |
|---|
| 472 | if test "$V_CHECK" = "1" ; then |
|---|
| 473 | AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) |
|---|
| 474 | BOOST_CPPFLAGS="-I$BOOST_ROOT" |
|---|
| 475 | BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" |
|---|
| 476 | fi |
|---|
| 477 | fi |
|---|
| 478 | fi |
|---|
| 479 | fi |
|---|
| 480 | |
|---|
| 481 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
|---|
| 482 | export CPPFLAGS |
|---|
| 483 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
|---|
| 484 | export LDFLAGS |
|---|
| 485 | |
|---|
| 486 | AC_LANG_PUSH(C++) |
|---|
| 487 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 488 | @%:@include <boost/version.hpp> |
|---|
| 489 | ]], [[ |
|---|
| 490 | #if BOOST_VERSION >= $WANT_BOOST_VERSION |
|---|
| 491 | // Everything is okay |
|---|
| 492 | #else |
|---|
| 493 | # error Boost version is too old |
|---|
| 494 | #endif |
|---|
| 495 | ]])],[ |
|---|
| 496 | AC_MSG_RESULT(yes) |
|---|
| 497 | succeeded=yes |
|---|
| 498 | found_system=yes |
|---|
| 499 | ],[ |
|---|
| 500 | ]) |
|---|
| 501 | AC_LANG_POP([C++]) |
|---|
| 502 | fi |
|---|
| 503 | |
|---|
| 504 | CPPFLAGS="$CPPFLAGS_SAVED" |
|---|
| 505 | LDFLAGS="$LDFLAGS_SAVED" |
|---|
| 506 | |
|---|
| 507 | if test "$succeeded" != "yes" ; then |
|---|
| 508 | if test "$_version" = "0" ; then |
|---|
| 509 | AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten 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.]]) |
|---|
| 510 | else |
|---|
| 511 | AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) |
|---|
| 512 | fi |
|---|
| 513 | else |
|---|
| 514 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
|---|
| 515 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" |
|---|
| 516 | AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) |
|---|
| 517 | fi |
|---|
| 518 | ]) |
|---|
| 519 | |
|---|