$OpenBSD: patch-configure_in,v 1.2 2002/09/14 04:18:35 marcm Exp $
--- configure.in.orig	Wed Jun 19 13:49:02 2002
+++ configure.in	Sat Jul 20 16:33:11 2002
@@ -313,7 +313,7 @@ AC_SUBST(DB3_CFLAGS)
 
 CPPFLAGS_save="$CPPFLAGS"
 CPPFLAGS="$DB3_CFLAGS $CPPFLAGS"
-AC_CHECK_HEADERS(db.h db3/db.h, break)
+AC_CHECK_HEADERS(db3.h db.h db3/db.h, break)
 
 AC_CACHE_CHECK([db3 header version], ac_cv_db3_header_version,
 [
@@ -321,8 +321,12 @@ AC_CACHE_CHECK([db3 header version], ac_
 		#ifdef HAVE_DB3_DB_H
 		#include <db3/db.h>
 		#else
+		#ifdef HAVE_DB3_H
+		#include <db3.h>
+		#else
 		#include <db.h>
 		#endif
+		#endif
 	],[
 		#if DB_VERSION_MAJOR != $evolution_db_version_major || \
 		    DB_VERSION_MINOR != $evolution_db_version_minor || \
@@ -345,8 +349,12 @@ AC_CACHE_CHECK([for db3 library name], a
 			#ifdef HAVE_DB3_DB_H
 			#include <db3/db.h>
 			#else
+			#ifdef HAVE_DB3_H
+			#include <db3.h>
+			#else
 			#include <db.h>
 			#endif
+			#endif
 		],[
 			DB *db;
 			db_create (&db, 0, 0);
@@ -371,8 +379,12 @@ AC_CACHE_CHECK([that db3 library version
 		#ifdef HAVE_DB3_DB_H
 		#include <db3/db.h>
 		#else
+		#ifdef HAVE_DB3_H
+		#include <db3.h>
+		#else
 		#include <db.h>
 		#endif
+		#endif
 
 		int
 		main (void)
@@ -730,20 +742,29 @@ if test ${with_krb5:=no} != no; then
 
 	mitlibs="-lkrb5 -lk5crypto -lcom_err"
 	heimlibs="-lkrb5 -lcrypto -lasn1 -lcom_err -lroken"
+	altheimlibs="-lkrb5 -lcrypto -lasn1"
 	AC_CACHE_CHECK([for Kerberos 5], ac_cv_lib_kerberos5,
 	[
 		LDFLAGS="$LDFLAGS -L$with_krb5/lib $mitlibs"
 		AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$mitlibs",
 		[
 			LDFLAGS="$LDFLAGS_save -L$with_krb5/lib $heimlibs"
-			AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$heimlibs", ac_cv_lib_kerberos5=no)
+			AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$heimlibs",
+			[
+				LDFLAGS="$LDFLAGS_save -L$with_krb5/lib $altheimlibs"
+				AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$altheimlibs", ac_cv_lib_kerberos5=no)
+			])
 		])
 		LDFLAGS="$LDFLAGS_save"
 	])
 	if test "$ac_cv_lib_kerberos5" != no; then
 		AC_DEFINE(HAVE_KRB5)
 		msg_krb5=yes
-		KRB5_CFLAGS="-I$with_krb5/include/krb5"
+		if test "$ac_cv_lib_kerberos5" == "$altheimlibs"; then
+			KRB5_CFLAGS="-I$with_krb5/include/kerberosV"
+		else
+			KRB5_CFLAGS="-I$with_krb5/include/krb5"
+		fi
 		KRB5_LDFLAGS="-L$with_krb5/lib $ac_cv_lib_kerberos5"
 	fi
 else
