## -*- mode: m4 -*- dnl Copyright (c) 2000 Dirk Mueller dnl Check for sys_errlist[] and sys_nerr, check for declaration dnl Check nicked from aclocal.m4 used by GNU bash 2.01 AC_DEFUN([LICQ_SYS_ERRLIST], [AC_MSG_CHECKING([for sys_errlist and sys_nerr]) AC_CACHE_VAL(ac_cv_sys_errlist, [AC_TRY_LINK([#include ], [extern char *sys_errlist[]; extern int sys_nerr; char *msg = sys_errlist[sys_nerr - 1];], ac_cv_sys_errlist=yes, ac_cv_sys_errlist=no)])dnl AC_MSG_RESULT($ac_cv_sys_errlist) if test $ac_cv_sys_errlist = yes; then AC_DEFINE_UNQUOTED(HAVE_SYS_ERRLIST, 1, [Define if sys_errlist available]) fi ]) AC_DEFUN([LICQ_FIND_FILE], [ $3="" for i in $2; do for j in $1; do if test -r "$i/$j"; then $3=$i break 2 fi done done ]) AC_DEFUN([LICQ_CHECK_GETHOSTBYNAME], [ AC_SEARCH_LIBS(gethostbyname, nsl) ]) AC_DEFUN([LICQ_CHECK_LICQ], [ AC_MSG_CHECKING([for licq header files]) AC_ARG_WITH(licq-includes, [ --with-licq-includes where the Licq daemon includes are located.], [ licq_licq_includes="$withval" ]) if test -n "$licq_licq_includes"; then relpath="`(cd $licq_licq_includes && pwd) 2>/dev/null`" if test -n "$relpath"; then licq_licq_includes="$relpath" fi LICQ_FIND_FILE(licq_icqd.h, $licq_licq_includes, licq_inc) else licq_paths="$prefix/include/licq \ /usr/local/include/licq \ /usr/include/licq" relpath=`cd $srcdir/../../include && pwd` if test -r $relpath/licq_icqd.h; then LICQ_FIND_FILE(licq_icqd.h, $relpath, licq_inc) else LICQ_FIND_FILE(licq_icqd.h, $licq_paths, licq_inc) fi fi if test -z "$licq_inc"; then have_licq_inc=no else have_licq_inc=yes fi if test "$have_licq_inc" = yes; then AC_MSG_RESULT(["$licq_inc"]) LICQ_INCLUDES="$licq_inc" else AC_MSG_RESULT(["not found"]) fi AC_SUBST(LICQ_INCLUDES) if test "$have_licq_inc" = "no"; then AC_MSG_ERROR([ I can't find the Licq header files. Make sure that you ran "make install" for the Licq daemon or installed the licq header files RPM. Most likely you just need to set --prefix to the correct value. You could also try the --with-licq-includes= configure switch to overwrite this check if you have installed them in an unusual place. ]) fi ]) dnl Check if it is possible to turn off exceptions/rtti support AC_DEFUN([LICQ_CXX_FLAGS], [ AC_ARG_ENABLE(debug, [ --enable-debug creates debugging code], [ licq_use_debug="$enableval"], [licq_use_debug="no"]) if test "$licq_use_debug" = "no"; then CXXFLAGS="`echo $CXXFLAGS | sed 's/-g[[^ ]]*//'`" CFLAGS="`echo $CFLAGS | sed 's/-g[[^ ]]*//'`" else CXXFLAGS="$CXXFLAGS -g" CFLAGS="$CFLAGS -g" fi ]) dnl Check if it is possible to turn off exceptions support AC_DEFUN([LICQDAEMON_CXX_FLAGS], [ AC_ARG_ENABLE(debug, [ --enable-debug creates debugging code], [ licqdaemon_use_debug="$enableval"], [licqdaemon_use_debug="no"]) if test "$licqdaemon_use_debug" = "no"; then CXXFLAGS="`echo $CXXFLAGS | sed 's/-g[[^ ]]*//'`" CFLAGS="`echo $CFLAGS | sed 's/-g[[^ ]]*//'`" else CXXFLAGS="$CXXFLAGS -g" CFLAGS="$CFLAGS -g" fi ]) dnl Check if we should use -Wextra or -W to get extra warnings AC_DEFUN([LICQ_CXX_WEXTRA], [ AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wextra" AC_COMPILE_IFELSE([void foo (void) { }], ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no) CFLAGS="$old_CFLAGS"]) AC_SUBST(WEXTRA) AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W]) ]) dnl Check if the type socklen_t is defined anywhere AC_DEFUN([AC_C_SOCKLEN_T], [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t, [ AC_TRY_COMPILE([ #include #include ],[ socklen_t foo; ],[ ac_cv_c_socklen_t=yes ],[ ac_cv_c_socklen_t=no ]) ]) if test $ac_cv_c_socklen_t = no; then AC_DEFINE(socklen_t, int, [define to int if socklen_t not available]) fi ]) dnl Check if the type socklen_t is defined anywhere AC_DEFUN([AC_C_SOCKLEN_T_AND_SOCKS], [AC_CACHE_CHECK(for SOCKS socklen_t, ac_cv_c_socklen_t, ]); ]) AC_DEFUN([_AM_PATH_GPGME_CONFIG], [ AC_ARG_WITH(gpgme-prefix, AC_HELP_STRING([--with-gpgme-prefix=PFX], [prefix where GPGME is installed (optional)]), gpgme_config_prefix="$withval", gpgme_config_prefix="") if test "x$gpgme_config_prefix" != x ; then GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config" fi AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) ]) dnl AM_PATH_GPGME([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. dnl AC_DEFUN([LICQ_CHECK_GPGME], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl tmp=ifelse([$1], ,1:0.4.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_gpgme_api=0 min_gpgme_version="$tmp" fi AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then gpgme_version=`$GPGME_CONFIG --version` gpgme_version_major=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` gpgme_version_minor=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` gpgme_version_micro=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` req_major=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes else if test "$gpgme_version_minor" -eq "$req_minor"; then if test "$gpgme_version_micro" -ge "$req_micro"; then ok=yes fi fi fi fi fi fi if test $ok = yes; then # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no fi fi fi fi if test $ok = yes; then CPPFLAGS_SAVE="$CPPFLAGS" LIBS_SAVE="$LIBS" GPGME_CFLAGS=`$GPGME_CONFIG --cflags` GPGME_LIBS=`$GPGME_CONFIG --libs` CPPFLAGS="$CPPFLAGS $GPGME_CFLAGS" LIBS="$LIBS $GPGME_LIBS" AC_TRY_LINK([ #include ],[ gpgme_data_t data; if (gpgme_data_new(&data) == GPG_ERR_NO_ERROR) gpgme_data_release(data); ],[ ok=yes ],[ ok=no ]) CPPFLAGS="$CPPFLAGS_SAVE" LIBS="$LIBS_SAVE" fi if test $ok = yes; then GPGME_CFLAGS=`$GPGME_CONFIG --cflags` GPGME_LIBS=`$GPGME_CONFIG --libs` AC_MSG_RESULT(yes) LIBS="$LIBS $GPGME_LIBS" CPPFLAGS="$CPPFLAGS $GPGME_CFLAGS" AC_DEFINE_UNQUOTED(HAVE_LIBGPGME, 1, [Define if GPGME is available]) WITH_GPGME="yes" else AC_MSG_RESULT(no) WITH_GPGME="no" fi ]) AC_DEFUN([LICQ_CHECK_OPENSSL], [ AC_MSG_CHECKING(if OpenSSL support is desired) AC_ARG_ENABLE( openssl, [ --disable-openssl disable OpenSSL support], WITH_OPENSSL="$enableval", WITH_OPENSSL="yes") AC_ARG_WITH( openssl-inc, [ --with-openssl-inc=PATH include path for OpenSSL headers], openssl_incdir="$withval", openssl_incdir="no") AC_ARG_WITH( openssl-lib, [ --with-openssl-lib=PATH library path for OpenSSL libraries], openssl_libdir="$withval", openssl_libdir="no") if test "$WITH_OPENSSL" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) dnl AC_MSG_CHECKING(for the OpenSSL headers) temp=$CPPFLAGS dnl Extra search path for kerberos includes, Redhat 9 needs this for OpenSSL if test -d "/usr/kerberos/include"; then kerberos_incdir="-I/usr/kerberos/include" CPPFLAGS="$CPPFLAGS $kerberos_incdir" fi if test "$openssl_incdir" != "no"; then CPPFLAGS="$CPPFLAGS -I$openssl_incdir" fi AC_CHECK_HEADER(openssl/ssl.h, WITH_OPENSSL="yes", WITH_OPENSSL="no") if test "$WITH_OPENSSL" = "no"; then CPPFLAGS="$temp" fi if test "$WITH_OPENSSL" = "yes"; then dnl AC_MSG_CHECKING(for the OpenSSL library) temp="$LIBS" if test "$openssl_libdir" != "no"; then LIBS="$LIBS -L$openssl_libdir" fi AC_CHECK_LIB(crypto, DH_free) if test "$ac_cv_lib_crypto_DH_free" = "yes"; then AC_CHECK_LIB(ssl, SSL_new, WITH_OPENSSL="yes", WITH_OPENSSL="no") else WITH_OPENSSL="no" fi if test "$WITH_OPENSSL" = "no"; then LIBS="$temp" else LIBS="-lssl $LIBS" fi fi AC_MSG_CHECKING(if OpenSSL support can be enabled) if test "$WITH_OPENSSL" = "yes"; then AC_DEFINE_UNQUOTED(USE_OPENSSL, 1, [Define if OpenSSL is available]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi ]) dnl @synopsis AX_BOOST([MINIMUM-VERSION]) dnl dnl Test for the Boost C++ libraries of a particular version (or newer) dnl dnl If no path to the installed boost library is given the macro dnl searchs under /usr, /usr/local, and /opt, and evaluates the dnl $BOOST_ROOT environment variable. Further documentation is dnl available at . dnl dnl This macro sets: dnl dnl HAVE_BOOST dnl dnl @category InstalledPackages dnl @category Cxx dnl @author Thomas Porschberg dnl @version 2006-06-15 dnl @license AllPermissive AC_DEFUN([AX_BOOST_BASE], [ AC_ARG_WITH([boost], AS_HELP_STRING([--with-boost-dir@<:@=DIR@:>@], [specify boost directory (optional)]), [ if test "$withval" = "yes"; then ac_boost_path="" else ac_boost_path="$withval" fi ]) boost_lib_version_req=ifelse([$1], ,1.31.0,$1) boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$boost_lib_version_req_sub_minor" = "x" ; then boost_lib_version_req_sub_minor="0" fi WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` AC_MSG_CHECKING(for Boost >= $boost_lib_version_req) succeeded=no dnl first we check the system location for boost libraries dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl or if you install boost with RPM if test "$ac_boost_path" != ""; then BOOST_LDFLAGS="-L$ac_boost_path/lib" BOOST_CPPFLAGS="-I$ac_boost_path/include" else for ac_boost_path_tmp in /usr /usr/local /opt ; do if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" break; fi done fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) dnl if we found no boost with system layout we search for boost libraries dnl built and installed without the --layout=system option or for a staged(not installed) version if test "x$succeeded" != "xyes"; then _version=0 if test "$ac_boost_path" != ""; then BOOST_LDFLAGS="-L$ac_boost_path/lib" if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" done fi else for ac_boost_path in /usr /usr/local /opt ; do if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$ac_boost_path fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_LDFLAGS="-L$best_path/lib" if test "x$BOOST_ROOT" != "x"; then if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" ; then AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then 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 . See http://randspringer.de/boost for more documentation.]]) else AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) fi else CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) fi ])