summaryrefslogtreecommitdiff
blob: cf87d60e628af96181f6ae22ea6de3bc43386179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
This patch fixes several database-related problems.

dbm_open has been moved into gdbm_compat, so we check for that and include it.

ndbm.h is located in /usr/include/gdbm on Gentoo, so we only check
there, given that we don't support normal dbm installations, and we
patch database.c as well. Not portable beyond Gentoo, but will work
for us.

The checks for Berkeley DB only took into account up to version
3. Added checks to deal with several versions 4 as well.

--- xemacs-21.4.19/configure.in	2005-12-24 01:48:14.000000000 +0100
+++ xemacs-21.4.19-db/configure.in	2006-06-11 22:43:52.000000000 +0200
@@ -4502,7 +4502,7 @@
 
 dnl Check for ndbm.h, required for either kind of DBM support.
 if test "$with_database_gdbm $with_database_dbm" != "no no"; then
-  AC_CHECK_HEADER(ndbm.h, [:], [
+  AC_CHECK_HEADER(gdbm/ndbm.h, [:], [
     test "$with_database_gdbm" = "yes" -o \
          "$with_database_dbm"  = "yes" && \
       XE_DIE("Required DBM support cannot be provided.")
@@ -4513,10 +4513,13 @@
 if test "$with_database_gdbm" != "no"; then
   AC_CHECK_LIB(gdbm, dbm_open, [
    with_database_gdbm=yes with_database_dbm=no libdbm=-lgdbm], [
+	AC_CHECK_LIB(gdbm_compat, dbm_open, [
+	with_database_gdbm=yes with_database_dbm=no libdbm="-lgdbm_compat -lgdbm"], [
    if test "$with_database_gdbm" = "yes"; then
      XE_DIE("Required GNU DBM support cannot be provided.")
    fi
-   with_database_gdbm=no])
+   with_database_gdbm=no], -lgdbm)
+  ])
 fi
 
 dnl Check for DBM support in libc and libdbm.
@@ -4614,11 +4617,30 @@
 #if DB_VERSION_MAJOR > 2
 yes
 #endif
-], [AC_MSG_RESULT(3); dbfunc=db_create],[
-    AC_MSG_RESULT(2); dbfunc=db_open])],[
-    AC_MSG_RESULT(1); dbfunc=dbopen])
+], [AC_EGREP_CPP(yes,
+[#include <$db_h_file>
+#if DB_VERSION_MAJOR > 3
+yes
+#endif
+], [AC_MSG_RESULT(4); dbfunc=db_create; dbver=4],[
+    AC_MSG_RESULT(3); dbfunc=db_create; dbver=3])],[
+    AC_MSG_RESULT(2); dbfunc=db_open; dbver=2])],[
+    AC_MSG_RESULT(1); dbfunc=dbopen; dbver=1])
     AC_CHECK_FUNC($dbfunc,     with_database_berkdb=yes need_libdb=no, [
-    AC_CHECK_LIB(db, $dbfunc,  with_database_berkdb=yes need_libdb=yes)])
+    AC_CHECK_LIB(db, db_create_4002,  with_database_berkdb=yes need_libdb=yes)])
+  fi
+
+  dnl Berk db 4.1 decorates public functions with version information
+  if test "$have_database_berkdb" != "yes" -a "$dbver" = "4"; then
+    rm -f $tempcname
+    echo "#include <$db_h_file>" > $tempcname
+    echo "configure___ dbfunc=db_create" >> $tempcname
+    define(TAB, [       ])dnl
+    eval `$CPP -Isrc $tempcname \
+        | sed -n -e "s/[[ TAB]]*=[[ TAB\"]]*/='/" -e "s/[[ TAB\"]]*\$/'/" -e "s/^configure___//p"`
+    rm -f $tempcname
+    AC_MSG_WARN("db_create is really $dbfunc")
+    AC_CHECK_LIB(db, $dbfunc,  have_database_berkdb=yes need_libdb=yes)
   fi
 
   if test "$with_database_berkdb" = "yes"; then
--- xemacs-21.4.19/src/database.c	2005-12-24 01:52:35.000000000 +0100
+++ xemacs-21.4.19-db/src/database.c	2006-06-13 21:00:01.000000000 +0200
@@ -82,7 +82,7 @@
 #endif /* HAVE_BERKELEY_DB */
 
 #ifdef HAVE_DBM
-#include <ndbm.h>
+#include <gdbm/ndbm.h>
 Lisp_Object Qdbm;
 #endif /* HAVE_DBM */