aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-30 13:08:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-30 13:08:56 +0200
commit647492377897cf3b7d112d99e9a961a0f786a6b8 (patch)
tree895d94459e9cff28a0dba4fe6e3741257cee93ba
parentadc42a1c2661f0900345dd8a7c84879f76395651 (diff)
Add autotools test for SQLite unlock notify feature
-rw-r--r--configure.ac6
-rw-r--r--m4/libsqlite.m422
-rw-r--r--odb/sqlite/details/config.h.in1
3 files changed, 29 insertions, 0 deletions
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 <sqlite3.h>
+
+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 */