summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorHaithem Ben Ghorbal <haithem.benghorbal_ext@softathome.com>2014-03-18 16:27:13 +0000
committerMartyn Russell <martyn@lanedo.com>2014-03-18 16:27:13 +0000
commitdf04124c17e34f26e2df2756bb1021d533d8a697 (patch)
treecc3d356b155a9498a366114721c5ed51c08fe58a /m4
parent8092dd15705e67a52438085754e609ea7ef0cc73 (diff)
downloadtracker-df04124c17e34f26e2df2756bb1021d533d8a697.tar.gz
build: Move FTS feature check to m4 file with cache check too
This is to avoid checking for the FTS features in cross-compilation situations where the check will fail and we've previously done the check anyway (knowing it works). We use M4 caching for this.
Diffstat (limited to 'm4')
-rw-r--r--m4/sqlite-builtin-fts4.m432
1 files changed, 32 insertions, 0 deletions
diff --git a/m4/sqlite-builtin-fts4.m4 b/m4/sqlite-builtin-fts4.m4
new file mode 100644
index 000000000..acf8e5811
--- /dev/null
+++ b/m4/sqlite-builtin-fts4.m4
@@ -0,0 +1,32 @@
+AC_DEFUN([AX_SQLITE_BUILTIN_FTS4],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ OLD_CFLAGS="$CFLAGS"
+ OLD_LIBS="$LIBS"
+ CFLAGS="$SQLITE3_CFLAGS"
+ LIBS="$SQLITE3_LIBS"
+
+ AC_CHECK_HEADERS([sqlite3.h])
+
+ AC_CACHE_CHECK([whether SQLite3 has required FTS features],
+ [ax_cv_sqlite_builtin_fts4],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([[#include <sqlite3.h>]],
+ [[sqlite3 *db;
+ int rc;
+ rc = sqlite3_open(":memory:", &db);
+ if (rc!=SQLITE_OK) return -1;
+ rc = sqlite3_exec(db, "create table a(text)", 0, 0, 0);
+ if (rc!=SQLITE_OK) return -1;
+ rc = sqlite3_exec(db, "create virtual table t using fts4(content='a',text)", 0, 0, 0);
+ if (rc!=SQLITE_OK) return -1;]])],
+ [ax_cv_sqlite_builtin_fts4=yes],
+ [ax_cv_sqlite_builtin_fts4=no],
+ [ax_cv_sqlite_builtin_fts4=no])])
+
+ CFLAGS="$OLD_CFLAGS"
+ LIBS="$OLD_LIBS"
+])
+