[tracker] configure.ac: Make sure sqlite is compiled thread-safe
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] configure.ac: Make sure sqlite is compiled thread-safe
- Date: Wed, 6 Oct 2010 10:22:18 +0000 (UTC)
commit 9961f2d1571d8a667d8a214cdf2b2a920ffa30dd
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Oct 6 09:47:32 2010 +0200
configure.ac: Make sure sqlite is compiled thread-safe
configure.ac | 17 ++++++++++++---
m4/sqlite-threadsafe.m4 | 48 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9914ea6..ef4d8c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -739,6 +739,12 @@ PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= $SQLITE_REQUIRED])
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
+# Make sure SQLite is compiled thread-safe
+AX_SQLITE_THREADSAFE
+if test "x$ax_cv_sqlite_threadsafe" != "xyes"; then
+ AC_MSG_ERROR([sqlite3 is not compiled thread-safe])
+fi
+
##################################################################
# Enable Gnome Keyring support to store credentials (for web miners)
##################################################################
@@ -2034,14 +2040,17 @@ Writeback:
Frameworks:
Support Maemo $enable_maemo
+"
-Warning:
-
- You must make sure SQLite is compiled with --enable-threadsafe
+if test "x$old_exec_message" != "x" -o \
+ "x$old_data_message" != "x" -o \
+ "x$old_file_action" != "x"; then
+echo "
+Warnings:
$old_exec_message
$old_data_message
$old_file_action
-
"
+fi
diff --git a/m4/sqlite-threadsafe.m4 b/m4/sqlite-threadsafe.m4
new file mode 100644
index 0000000..bfa20a8
--- /dev/null
+++ b/m4/sqlite-threadsafe.m4
@@ -0,0 +1,48 @@
+# sqlite-threadsafe.m4 serial 1
+
+dnl Copyright (C) 2010 Aleksander Morgado <aleksander gnu org>
+dnl This file is free software; unlimited permission to copy and/or distribute
+dnl it is given, with or without modifications, as long as this notice is
+dnl preserved.
+
+dnl This program will execute the sqlite3_threadsafe() method to check
+dnl whether the sqlite3 library was compiled in threadsafe mode or not,
+dnl and will fill the ax_cv_sqlite_threadsafe cached variable accordingly.
+dnl See http://sqlite.org/c3ref/threadsafe.html for more information.
+
+dnl Once this m4 macro has been evaluated, you can for example issue an error
+dnl when sqlite3 was not compiled thread-safe:
+dnl
+dnl AX_SQLITE_THREADSAFE
+dnl if test "x$ax_cv_sqlite_threadsafe" != "xyes"; then
+dnl AC_MSG_ERROR([sqlite3 is not compiled in a thread-safe mode])
+dnl fi
+
+
+AC_DEFUN([AX_SQLITE_THREADSAFE],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ AC_CHECK_HEADERS([sqlite3.h])
+ AC_CHECK_LIB([sqlite3],[sqlite3_threadsafe])
+
+ AC_CACHE_CHECK([whether sqlite was compiled thread-safe],
+ [ax_cv_sqlite_threadsafe],
+ [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sqlite3.h>
+int main ()
+{
+ /* sqlite3_threadsafe() returns the value of the SQLITE_THREADSAFE
+ * preprocessor macro used when compiling. If this is 0, sqlite3
+ * library was NOT compiled in a thread-safe mode */
+
+ return sqlite3_threadsafe () == 0 ? -1 : 0;
+}
+
+ ]])],
+ [ax_cv_sqlite_threadsafe=yes],
+ [ax_cv_sqlite_threadsafe=no],
+ [ax_cv_sqlite_threadsafe=no])])
+])
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]