Portability fix: improve detecition of libdb-related headers.
AC_SUBST(LIB_LBER)
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,,,[
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#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"
if [ -f /usr/include/db_185.h ]; then
exit 0
fi
-if [ -f /usr/include/db.h ]; then
+if [ -f /usr/include/db.h ] && grep dbopen /usr/include/db.h; then
exit 0
fi
exit 1
#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;