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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-01-31 09:58:29 +00:00
parent 9f9fcb476e
commit b3d350e01f
3 changed files with 9 additions and 147 deletions

View File

@ -36,6 +36,7 @@ sqlite3_column_text16
sqlite3_column_type
sqlite3_column_value
sqlite3_commit_hook
sqlite3_compileoption_used
sqlite3_complete
sqlite3_complete16
sqlite3_config

View File

@ -2430,151 +2430,6 @@ then
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 ===

View File

@ -187,7 +187,12 @@ already_AddRefed<Service> Service::getSingleton() {
// 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;
@ -197,7 +202,8 @@ already_AddRefed<Service> Service::getSingleton() {
"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");