Bug 1523851 - Remove system sqlite compile option tests. r=mak
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 31 Jan 2019 09:58:29 +0000
changeset 456234 d7d0d7ad4c0bc5dad1031d2101dd2e46777f9f7c
parent 456233 699954de14e37c54a20651b01351365c30c5f932
child 456235 6a22ba01cdfbe4dbc4b0cee28d008b2bc7f53958
push id111603
push userrmaries@mozilla.com
push dateThu, 31 Jan 2019 17:05:49 +0000
treeherdermozilla-inbound@81112cc261ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1523851
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523851 - Remove system sqlite compile option tests. r=mak Those tests rely on the build not being a cross-compile, which is fine most of the time, but more importantly, rely on the fact that the version of sqlite that Firefox is being built against is the same as the one it will be running against, which is not likely to be true. So, all in all, it's better to do the checks at runtime. And while they could be restricted to when building against system sqlite, we still run them for in-tree sqlite, to ensure that we actually built it with the expected options. Differential Revision: https://phabricator.services.mozilla.com/D18057
db/sqlite3/src/sqlite.symbols
old-configure.in
storage/mozStorageService.cpp
--- a/db/sqlite3/src/sqlite.symbols
+++ b/db/sqlite3/src/sqlite.symbols
@@ -31,16 +31,17 @@ sqlite3_column_int
 sqlite3_column_int64
 sqlite3_column_name
 sqlite3_column_name16
 sqlite3_column_text
 sqlite3_column_text16
 sqlite3_column_type
 sqlite3_column_value
 sqlite3_commit_hook
+sqlite3_compileoption_used
 sqlite3_complete
 sqlite3_complete16
 sqlite3_config
 sqlite3_create_collation
 sqlite3_create_collation16
 sqlite3_create_function
 sqlite3_create_function16
 sqlite3_create_module
--- a/old-configure.in
+++ b/old-configure.in
@@ -2425,161 +2425,16 @@ MOZ_SYSTEM_SQLITE= )
 
 if test -n "$MOZ_SYSTEM_SQLITE"
 then
     dnl ============================
     dnl === SQLite Version check ===
     dnl ============================
     dnl Check to see if the system SQLite package is new enough.
     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
-
-    dnl ==================================
-    dnl === SQLITE_SECURE_DELETE check ===
-    dnl ==================================
-    dnl Check to see if the system SQLite package is compiled with
-    dnl SQLITE_SECURE_DELETE enabled.
-    AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
-            }],
-            ac_cv_sqlite_secure_delete=yes,
-            ac_cv_sqlite_secure_delete=no,
-            ac_cv_sqlite_secure_delete=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
-    fi
-
-    dnl ===============================
-    dnl === SQLITE_THREADSAFE check ===
-    dnl ===============================
-    dnl Check to see if the system SQLite package is compiled with
-    dnl SQLITE_THREADSAFE enabled.
-    AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
-            }],
-            ac_cv_sqlite_threadsafe=yes,
-            ac_cv_sqlite_threadsafe=no,
-            ac_cv_sqlite_threadsafe=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
-    fi
-
-    dnl ================================
-    dnl === SQLITE_ENABLE_FTS3 check ===
-    dnl ================================
-    dnl check to see if the system SQLite package is compiled with
-    dnl SQLITE_ENABLE_FTS3 enabled.
-    AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
-            }],
-            ac_cv_sqlite_enable_fts3=yes,
-            ac_cv_sqlite_enable_fts3=no,
-            ac_cv_sqlite_enable_fts3=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
-    fi
-
-    dnl =========================================
-    dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
-    dnl =========================================
-    dnl check to see if the system SQLite package is compiled with
-    dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
-    AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
-            }],
-            ac_cv_sqlite_enable_unlock_notify=yes,
-            ac_cv_sqlite_enable_unlock_notify=no,
-            ac_cv_sqlite_enable_unlock_notify=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
-    fi
-
-    dnl =========================================
-    dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
-    dnl =========================================
-    dnl check to see if the system SQLite package is compiled with
-    dnl SQLITE_ENABLE_DBSTAT_VTAB.
-    AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
-            }],
-            ac_cv_sqlite_dbstat_vtab=yes,
-            ac_cv_sqlite_dbstat_vtab=no,
-            ac_cv_sqlite_dbstat_vtab=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
-    fi
 else
     dnl ==============================
     dnl === SQLite fdatasync check ===
     dnl ==============================
     dnl Check to see if fdatasync is available
     AC_CHECK_FUNC(fdatasync)
 fi
 
--- a/storage/mozStorageService.cpp
+++ b/storage/mozStorageService.cpp
@@ -182,27 +182,33 @@ Service *Service::gService = nullptr;
 already_AddRefed<Service> Service::getSingleton() {
   if (gService) {
     return do_AddRef(gService);
   }
 
   // Ensure that we are using the same version of SQLite that we compiled with
   // or newer.  Our configure check ensures we are using a new enough version
   // at compile time.
-  if (SQLITE_VERSION_NUMBER > ::sqlite3_libversion_number()) {
+  if (SQLITE_VERSION_NUMBER > ::sqlite3_libversion_number() ||
+      !::sqlite3_compileoption_used("SQLITE_SECURE_DELETE") ||
+      !::sqlite3_compileoption_used("SQLITE_THREADSAFE=1") ||
+      !::sqlite3_compileoption_used("SQLITE_ENABLE_FTS3") ||
+      !::sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY") ||
+      !::sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB")) {
     nsCOMPtr<nsIPromptService> ps(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
     if (ps) {
       nsAutoString title, message;
       title.AppendLiteral("SQLite Version Error");
       message.AppendLiteral(
           "The application has been updated, but the SQLite "
           "library wasn't updated properly and the application "
           "cannot run. Please try to launch the application again. "
           "If that should still fail, please try reinstalling "
-          "it, or visit https://support.mozilla.org/.");
+          "it, or contact the support of where you got the "
+          "application from.");
       (void)ps->Alert(nullptr, title.get(), message.get());
     }
     MOZ_CRASH("SQLite Version Error");
   }
 
   // The first reference to the storage service must be obtained on the
   // main thread.
   NS_ENSURE_TRUE(NS_IsMainThread(), nullptr);