-AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])])
-dnl
-dnl ------ OpenSSL
-AC_SUBST(SSL_CFLAGS)
-openssl=default
-AC_ARG_WITH(openssl, [ --with-openssl[=PREFIX] OpenSSL library in PREFIX], [openssl=$withval])
-SSL_CFLAGS=""
-SSL_LIBPATH=""
-if test "$openssl" != "no"; then
- sslver=no
- if test "$openssl" != "yes" -a "$openssl" != "default"; then
- if test -x $openssl/bin/pkg-config; then
- if $openssl/bin/pkg-config --exists openssl; then
- SSL_CFLAGS=`$openssl/bin/pkg-config --cflags openssl`
- LIBS="$LIBS `$openssl/bin/pkg-config --libs openssl`"
- sslver=`$openssl/bin/pkg-config --modversion openssl`
+AC_CHECK_FUNC([gethostbyname], ,[AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])])
+dnl ------ libgcrypt
+libgcryptpath=NONE
+AC_ARG_WITH(libgcrypt, [ --with-libgcrypt=DIR use libgcrypt-config in DIR],[libgcryptpath=$withval])
+if test "$libgcryptpath" != "no"; then
+ if test "$libgcryptpath" = "NONE"; then
+ AC_PATH_PROG([libgcrypt],[libgcrypt-config],[NONE])
+ else
+ libgcrypt=$libgcryptpath/libgcrypt-config
+ fi
+ AC_MSG_CHECKING([for libgcrypt])
+ if "$libgcrypt" --version >/dev/null 2>&1; then
+ LIBS="$LIBS `$libgcrypt --libs`"
+ CFLAGS="$CFLAGS `$libgcrypt --cflags`"
+ libgcryptversion=`$libgcrypt --version`
+ AC_MSG_RESULT([$libgcryptversion])
+ AC_DEFINE([HAVE_GCRYPT_H],[1],[Define to 1 if libgcrypt is present])
+ else
+ AC_MSG_RESULT([no])
+ fi
+fi
+dnl ------ memcached
+memcached=default
+AC_ARG_WITH([memcached], [ --with-memcached Memcached library], [memcached=$withval])
+if test "$memcached" != "no" -a -n "$libgcryptversion"; then
+ AC_CHECK_LIB([memcached],[memcached_get])
+ if test "$ac_cv_lib_memcached_memcached_get" = "yes"; then
+ AC_CHECK_HEADERS([libmemcached/memcached.h])
+ fi
+fi
+dnl ------ GNU TLS
+AC_SUBST([SSL_CFLAGS])
+AC_SUBST([SSL_LIBS])
+gnutls=default
+AC_ARG_WITH([gnutls], [ --with-gnutls[=PREFIX] GNU TLS library in PREFIX], [gnutls=$withval])
+if test "$gnutls" != "no"; then
+ gnutlsver=no
+ if test "$gnutls" != "yes" -a "$gnutls" != "default"; then
+ if test -x $gnutls/bin/pkg-config; then
+ if $gnutls/bin/pkg-config --exists gnutls; then
+ SSL_CFLAGS=`$gnutls/bin/pkg-config --cflags gnutls`
+ SSL_LIBS="`$gnutls/bin/pkg-config --libs gnutls`"
+ gnutlsver=`$gnutls/bin/pkg-config --modversion gnutls`