]> arthur.barton.de Git - netatalk.git/blobdiff - macros/ssl-check.m4
apply parts of the netbsd build patch by Patrick Welche <prlw1@newn.cam.ac.uk>, mostl...
[netatalk.git] / macros / ssl-check.m4
index 13171f600976cbf244c0697730f78d0337270557..66c8f7a8caecd5c1b7473fb9c890e8859a126d33 100644 (file)
@@ -1,6 +1,42 @@
-dnl $Id: ssl-check.m4,v 1.7 2003-01-26 16:51:22 srittau Exp $
+dnl $Id: ssl-check.m4,v 1.12 2004-01-14 16:10:29 bfernhomberg Exp $
 dnl Autoconf macro to check for SSL or OpenSSL
 
+AC_DEFUN([AC_PATH_GCRYPT], [
+
+       GCRYPT_CFLAGS=""
+       GCRYPT_LIBS=""
+
+       search="yes"
+       errifnotfound="no"
+
+       AC_ARG_ENABLE(gcrypt, [  --disable-gcrypt        disable compilation with libgcrypt], [
+               if test "x$enableval" != "xno"; then
+                       errifnotfound="yes"
+               else
+                       search="no"
+               fi
+       ])
+
+       GCRYPT_CONFIG=""
+       if test "x$search" == "xyes"; then
+               AC_PATH_PROG([GCRYPT_CONFIG], [libgcrypt-config], [no])
+
+               if test "x$GCRYPT_CONFIG" == "xno"; then
+                       if test "x$errifnotfound" == "xyes"; then
+                               AC_MSG_ERROR([libgcrypt-config not found])
+                       fi
+               else
+                       GCRYPT_CFLAGS="`$GCRYPT_CONFIG --cflags`"
+                       GCRYPT_LIBS="`$GCRYPT_CONFIG --libs`"
+                       AC_DEFINE(HAVE_GCRYPT, 1, [Define if libgcrypt is available])
+               fi
+       fi
+
+       AC_SUBST(GCRYPT_CFLAGS)
+       AC_SUBST(GCRYPT_LIBS)
+       AM_CONDITIONAL(HAVE_GCRYPT, test "x$GCRYPT_CONFIG" != "xno")
+])
+
 AC_DEFUN([AC_PATH_SSL], [
        AC_ARG_WITH(ssl-dir, [  --with-ssl-dir=PATH     specify path to OpenSSL installation (must contain
                           lib and include dirs)],
@@ -33,14 +69,8 @@ AC_DEFUN([AC_PATH_SSL], [
                                fi
                                AC_MSG_RESULT([$ssldir (enabling RANDNUM and DHX support)])
 
-dnl FIXME: The following looks crude and probably doesn't work properly.
-                               dnl Check for the crypto library:
-                               AC_CHECK_LIB(crypto, main)
-                               dnl Check for "DES" library (for SSLeay, not openssl):
-                               AC_CHECK_LIB(des, main)
-
-                               AC_DEFINE(OPENSSL_DHX,  1)
-                               AC_DEFINE(UAM_DHX,      1)
+                               AC_DEFINE(OPENSSL_DHX,  1, [Define if the OpenSSL DHX modules should be built])
+                               AC_DEFINE(UAM_DHX,      1, [Define if the DHX UAM modules should be compiled])
                                compile_ssl=yes
                                break
                        fi