$NetBSD: patch-aa,v 1.4 2006/01/22 02:26:54 joerg Exp $

--- configure.ac.orig	2005-03-24 10:55:19.000000000 +0000
+++ configure.ac
@@ -238,19 +238,28 @@ dnl Check for OpenSSL
 AC_ARG_ENABLE(openssl,
 	[  --enable-openssl    Attempt to use OpenSSL for SSL support.],
 	[ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=yes])
-if test x"$ac_cv_enable_openssl" = xyes; then
-	PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7, :, ac_cv_enable_openssl=no)
-	if test x$ac_cv_enable_openssl = xyes; then
-		AC_DEFINE(USE_OPENSSL, 1, Define if you want OpenSSL support)
-	fi
+if test $ac_cv_enable_openssl = yes; then
+        AC_MSG_CHECKING([if openssl is available])
+        OPENSSL_LIBS="$LIBS -lssl -lcrypto"
+        AC_TRY_LINK([
+#include <openssl/opensslv.h>
+],      [ return OPENSSL_VERSION_NUMBER; ],
+        [ AC_MSG_RESULT(yes)
+          AC_DEFINE(USE_OPENSSL, 1, Define if you want OpenSSL support.) ],
+        [ AC_MSG_RESULT(no)
+          OPENSSL_LIBS="$ac_save_LIBS"
+	  ac_cv_enable_openssl=no ])
+else
+	AC_MSG_RESULT(no)
 fi
+
 AC_SUBST(OPENSSL_CFLAGS)
 AC_SUBST(OPENSSL_LIBS)
 
 dnl password encryption
 OLDLIBS=$LIBS
 LIBS=
-AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
+AC_SEARCH_LIBS(encrypt, crypt cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
 CRYPT_LIBS=$LIBS
 AC_SUBST(CRYPT_LIBS)
 LIBS=$OLDLIBS
