[tracker] build: Move FTS feature check to m4 file with cache check too



commit df04124c17e34f26e2df2756bb1021d533d8a697
Author: Haithem Ben Ghorbal <haithem benghorbal_ext softathome com>
Date:   Tue Mar 18 16:27:13 2014 +0000

    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.

 configure.ac              |   28 +++++-----------------------
 m4/sqlite-builtin-fts4.m4 |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b729e91..1bbfd30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -712,30 +712,12 @@ fi
 if test "x$have_tracker_fts" = "xyes"; then
    AC_DEFINE(HAVE_TRACKER_FTS, [1], [Define to 1 if tracker FTS is compiled])
 
-   OLD_CFLAGS="$CFLAGS"
-   OLD_LIBS="$LIBS"
-   CFLAGS="$SQLITE3_CFLAGS"
-   LIBS="$SQLITE3_LIBS"
-
-   AC_MSG_CHECKING(whether SQLite3 has required FTS features)
-   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;]])],
-                     [have_builtin_fts4=yes],
-                     [have_builtin_fts4=no])
-   AC_MSG_RESULT($have_builtin_fts4)
-
-   CFLAGS="$OLD_CFLAGS"
-   LIBS="$OLD_LIBS"
-
-   if test "x$have_builtin_fts4" = "xyes" ; then
+   AX_SQLITE_BUILTIN_FTS4
+   if test "x$ax_cv_sqlite_builtin_fts4" = "xyes" ; then
+      have_builtin_fts4="yes"
       AC_DEFINE(HAVE_BUILTIN_FTS, [], [Defined if Sqlite has FTS4 compiled in])
+   else
+      have_builtin_fts4="no"
    fi
 else
    AC_DEFINE(HAVE_TRACKER_FTS, [0], [Define to 0 if tracker FTS is not compiled])
diff --git a/m4/sqlite-builtin-fts4.m4 b/m4/sqlite-builtin-fts4.m4
new file mode 100644
index 0000000..acf8e58
--- /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"
+])
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]