From 72a472bdcd30aa3a76b7b2e4b46bdf0c748e0ffa Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 8 Apr 2010 12:33:19 +0300 Subject: [PATCH] Require BDB >= 4.5 for sanity's sake - replace unused feature tests in configure.ac with a simple version check --- configure.ac | 26 ++++++++------------------ lib/backend/db3.c | 6 ------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 40990df..e5fd6ba 100644 --- a/configure.ac +++ b/configure.ac @@ -310,24 +310,14 @@ esac], case "$with_external_db" in yes ) AC_CHECK_HEADERS([db.h],[ - AC_CHECK_TYPE([db_threadid_t],[], - [AC_MSG_WARN([missing type db_threadid_t])], - [#include ]) - save_LIBS="$LIBS" - AC_CHECK_LIB([db],[db_create],[],[ - AC_MSG_ERROR([missing db_create in libdb]) - ]) - AC_CHECK_LIB([db],[db_env_create],[],[ - AC_MSG_ERROR([missing db_env_create in libdb]) - ]) - AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[ - AC_MSG_ERROR([missing db_env_set_func_fsync in libdb]) - ]) - AC_CHECK_LIB([db],[db_strerror],[],[ - AC_MSG_ERROR([missing db_strerror in libdb]) - ]) - WITH_DB_LIB=-ldb - LIBS="$save_LIBS" + AC_PREPROC_IFELSE([ + #include + #if !(DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5) + #error Berkeley DB too old + #endif + ],[ WITH_DB_LIB=-ldb ], + [ AC_MSG_ERROR([Berkeley DB version >= 4.5 required]) + ]) ],[ AC_MSG_ERROR([missing required header db.h]) ]) diff --git a/lib/backend/db3.c b/lib/backend/db3.c index 549e4cd..0bb6e18 100644 --- a/lib/backend/db3.c +++ b/lib/backend/db3.c @@ -68,7 +68,6 @@ static int fsync_disable(int fd) return 0; } -#if (DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5) /* * dbenv->failchk() callback method for determining is the given pid/tid * is alive. We only care about pid's though. @@ -88,7 +87,6 @@ static int isalive(DB_ENV *dbenv, pid_t pid, db_threadid_t tid, uint32_t flags) return alive; } -#endif static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp) { @@ -116,14 +114,12 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp) dbenv->set_errcall(dbenv, NULL); dbenv->set_errpfx(dbenv, _errpfx); -#if (DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5) /* * These enable automatic stale lock removal. * thread_count 8 is some kind of "magic minimum" value... */ dbenv->set_thread_count(dbenv, 8); dbenv->set_isalive(dbenv, isalive); -#endif dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, (dbi->dbi_verbose & DB_VERB_DEADLOCK)); @@ -152,13 +148,11 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp) if (rc) goto errxit; -#if (DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5) /* stale lock removal */ rc = dbenv->failchk(dbenv, 0); rc = cvtdberr(dbi, "dbenv->failchk", rc, _debug); if (rc) goto errxit; -#endif *dbenvp = dbenv; -- 2.7.4