From 78e79d87b7c0149edb4c50f07cdf638b9ef26cf5 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sun, 14 Feb 2010 18:12:41 +0100 Subject: [PATCH] Add check for sqlite3_threadsafe() in configure --- bacula/autoconf/config.h.in | 3 +++ bacula/autoconf/configure.in | 1 + bacula/src/cats/sqlite.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 15e4ea5086..1c1791cc35 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -612,6 +612,9 @@ /* Set if have PQputCopyData */ #undef HAVE_PQ_COPY +/* Set if have sqlite3_threadsafe */ +#undef HAVE_SQLITE3_THREADSAFE + /* Define to 1 if you have the `prctl' function. */ #undef HAVE_PRCTL diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index afa83b7492..d44f152b4d 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1791,6 +1791,7 @@ if test x$DB_TYPE = xdbi; then if test $DB_PROG = sqlite3; then A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock` pkg=$? + AC_CHECK_LIB(sqlite3, sqlite3_threadsafe, AC_DEFINE(HAVE_SQLITE3_THREADSAFE, 1, [Set if have sqlite3_threadsafe])) fi if test $pkg = 0; then diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index d18b24e891..85bd3258f7 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -268,10 +268,12 @@ db_close_database(JCR *jcr, B_DB *mdb) void db_check_backend_thread_safe() { #ifdef HAVE_BATCH_FILE_INSERT +# ifdef HAVE_SQLITE3_THREADSAFE if (!sqlite3_threadsafe()) { Emsg0(M_ABORT, 0, _("SQLite3 client library must be thread-safe " "when using BatchMode.\n")); } +# endif #endif } -- 2.39.5