AC_SUBST(LBERLIB)
dnl Check for libdb
+dnl this is not fully functional if db.h is for a differend db version
DBLIB=
+
+dnl check that dbopen is actually defined in the header
+dnl FIXME: in case of failure undef db-related includes etc.
+AC_CHECK_DECL(dbopen,,,[
+AC_INCLUDES_DEFAULT
+#if HAVE_DB_185_H
+#include <db_185.h>
+#elif HAVE_DB_H
+#include <db.h>
+#endif])
+
dnl 1.85
AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
+AC_INCLUDES_DEFAULT
#if HAVE_DB_185_H
#include <db_185.h>
#elif HAVE_DB_H
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
#endif
-#if defined(HAVE_DB_185_H)
+
+#if HAVE_DB_185_H
#include <db_185.h>
-#elif defined(HAVE_DB_H)
+#elif HAVE_DB_H
#include <db.h>
-#else
-#include <db_185.h>
#endif
static int session_ttl = 3600;