make it compile with Berkeley DB 4.0.x
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 13 Dec 2001 22:29:58 +0000 (22:29 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 13 Dec 2001 22:29:58 +0000 (22:29 +0000)
citadel/ChangeLog
citadel/configure.ac
citadel/database_sleepycat.c

index 90ee29cf32d17eccf0284c040c74d1e981af88d6..8fd390b3e3585ed8902216a5e8cf49f9459d846d 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 590.3  2001/12/13 22:29:57  nbryant
+ make it compile with Berkeley DB 4.0.x
+
  Revision 590.2  2001/12/11 21:31:07  nbryant
   - test for -ldb3 before -ldb
 
@@ -2948,4 +2951,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 70abfdf55eeba75b249f261f93d71c43dfe1aca3..dcab5bf0138bf9604e49eb162028213193676ddc 100644 (file)
@@ -220,8 +220,10 @@ dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
+
 test "$db_dir" && CPPFLAGS="$CPPFLAGS -I$db_dir/include"
-AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h termios.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h utmp.h utmpx.h paths.h db3/db.h)
+
+AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h termios.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db3/db.h)
 
 AC_CHECK_HEADER(resolv.h, [SMTP=modules/libsmtp.la; DOMAIN=domain.c])
 AC_SUBST(SMTP)
index 203192305c0b1927ffb95f69438e38bfffd3fc44..45cff4dc2e30c46c9a679b5a1ebac9e6ad67b50e 100644 (file)
 #include <sys/stat.h>
 #include <dirent.h>
 
-#ifdef HAVE_DB3_DB_H
+#ifdef HAVE_DB_H
+#include <db.h>
+#elif defined(HAVE_DB3_DB_H)
 #include <db3/db.h>
 #else
-#include <db.h>
+#error Neither <db.h> nor <db3/db.h> was found by configure. Install db3-devel.
 #endif
 
 #include <pthread.h>
@@ -191,6 +193,8 @@ static void cdb_cull_logs(void) {
        /* Get the list of names. */
 #if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR < 3
        if ((ret = log_archive(dbenv, &list, flags, NULL)) != 0) {
+#elif DB_VERSION_MAJOR >= 4
+       if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) {
 #else
        if ((ret = log_archive(dbenv, &list, flags)) != 0) {
 #endif
@@ -218,7 +222,11 @@ static void cdb_checkpoint(void) {
        int ret;
        static time_t last_cull = 0L;
 
+#if DB_VERSION_MAJOR >= 4
+       ret = dbenv->txn_checkpoint(dbenv,
+#else
        ret = txn_checkpoint(dbenv,
+#endif
                                MAX_CHECKPOINT_KBYTES,
                                MAX_CHECKPOINT_MINUTES,
                                0);
@@ -345,7 +353,11 @@ void close_databases(void)
 
        cdb_free_tsd();
 
+#if DB_VERSION_MAJOR >= 4
+       if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
+#else
        if ((ret = txn_checkpoint(dbenv, 0, 0, 0))) {
+#endif
                lprintf(1, "cdb_*: txn_checkpoint: %s\n", db_strerror(ret));
                abort();
        }