$NetBSD: patch-ac,v 1.3 2011/04/01 15:03:48 wiz Exp $

--- configure.orig	2004-12-23 13:43:14.000000000 +0000
+++ configure
@@ -3192,7 +3202,7 @@ _ACEOF
 fi
 
 
-if test -n $HAVE_CRYPT_H; then
+if test -n $HAVE_CRYPT_H -a $HAVE_LIBCRYPT; then
 	if test "$cross_compiling" = yes; then
   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
@@ -3207,8 +3291,13 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
+#endif
 #include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 int main()
 {
@@ -3255,8 +3344,13 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
+#endif
 #include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 int main()
 {