$NetBSD: patch-ab,v 1.2 2006/02/23 01:02:21 ben Exp $

--- configure.ac.orig	2004-12-23 13:43:14.000000000 +0000
+++ configure.ac
@@ -140,11 +140,16 @@ AC_CHECK_HEADERS([crypt.h])
 
 AC_CHECK_LIB([crypt], [crypt])
 
-if test -n $HAVE_CRYPT_H; then
+if test -n $HAVE_CRYPT_H -a $HAVE_LIBCRYPT; then
 	AC_TRY_RUN(
 [
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
+#endif
 #include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 int main()
 {
@@ -156,8 +161,13 @@ AC_DEFINE(CRYPT_MD5, 1, [Enable crypt() 
 ,,)
 	AC_TRY_RUN(
 [
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
+#endif
 #include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 int main()
 {
