From 647492377897cf3b7d112d99e9a961a0f786a6b8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 30 Mar 2011 13:08:56 +0200 Subject: Add autotools test for SQLite unlock notify feature --- configure.ac | 6 ++++++ m4/libsqlite.m4 | 22 ++++++++++++++++++++++ odb/sqlite/details/config.h.in | 1 + 3 files changed, 29 insertions(+) diff --git a/configure.ac b/configure.ac index c99dab6..269564d 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,12 @@ LIBSQLITE( [], [AC_MSG_ERROR([libsqlite3 is not found; consider using CPPFLAGS/LDFLAGS to specify its location])]) +AS_IF([test x$libsqlite_unlock_notify = xyes], +AC_DEFINE([LIBODB_SQLITE_HAVE_UNLOCK_NOTIFY], [1], [Have sqlite3_unlock_notify.])) + +AS_IF([test x$threads != xnone -a x$libsqlite_unlock_notify = xno], +AC_MSG_WARN([libsqlite3 is built without sqlite3_unlock_notify support; multi-threaded support will be limited])) + # Check for libodb. # LIBODB([],[AC_MSG_ERROR([libodb is not found; consider using --with-libodb=DIR])]) diff --git a/m4/libsqlite.m4 b/m4/libsqlite.m4 index 2ad9eb1..acb4fe3 100644 --- a/m4/libsqlite.m4 +++ b/m4/libsqlite.m4 @@ -5,9 +5,12 @@ dnl license : GNU GPL v2; see accompanying LICENSE file dnl dnl LIBSQLITE([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) dnl +dnl Also sets libsqlite_unlock_notify to yes if sqlite3_unlock_notify() +dnl functionality is available. dnl AC_DEFUN([LIBSQLITE], [ libsqlite_found=no +libsqlite_unlock_notify=no AC_MSG_CHECKING([for libsqlite3]) @@ -37,6 +40,25 @@ if test x"$libsqlite_found" = xno; then LIBS="$save_LIBS" fi +# Check for unlock_notify. +# +if test x"$libsqlite_found" = xyes; then +CXX_LIBTOOL_LINK_IFELSE( +AC_LANG_SOURCE([[ +#include + +int +main () +{ + sqlite3* handle (0); + sqlite3_unlock_notify (handle, 0, 0); +} +]]), +[ +libsqlite_unlock_notify=yes +]) +fi + if test x"$libsqlite_found" = xyes; then AC_MSG_RESULT([yes]) $1 diff --git a/odb/sqlite/details/config.h.in b/odb/sqlite/details/config.h.in index ff8c029..7e3eb4a 100644 --- a/odb/sqlite/details/config.h.in +++ b/odb/sqlite/details/config.h.in @@ -10,5 +10,6 @@ #define ODB_SQLITE_DETAILS_CONFIG_H #undef LIBODB_SQLITE_STATIC_LIB +#undef LIBODB_SQLITE_HAVE_UNLOCK_NOTIFY #endif /* ODB_SQLITE_DETAILS_CONFIG_H */ -- cgit v1.1