Bug 551260 - Upgrade to SQLite 3.6.23
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Mon, 22 Mar 2010 11:54:18 -0700
changeset 39713 2ba69e5220c4b541bc38ba4de5683f5389e4d6fd
parent 39712 1a9e1f27803923d4d2a71efcc62bdfbca94f35b6
child 39714 4bb83011e8902dd89a18b55f44065773400cf02f
push id12357
push usersdwilsh@shawnwilsher.com
push dateMon, 22 Mar 2010 18:54:31 +0000
treeherdermozilla-central@4bb83011e890 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs551260
milestone1.9.3a4pre
Bug 551260 - Upgrade to SQLite 3.6.23 This contains the changes to configure.in (adding some checks for system SQLite) and the changes to the README.mozilla file. r=asuth r=ted
configure.in
db/sqlite3/README.MOZILLA
db/sqlite3/src/Makefile.in
--- a/configure.in
+++ b/configure.in
@@ -127,17 +127,17 @@ GTK2_VERSION=2.10.0
 WINDRES_VERSION=2.14.90
 W32API_VERSION=3.8
 GNOMEVFS_VERSION=2.0
 GNOMEUI_VERSION=2.2.0
 GCONF_VERSION=1.2.1
 GIO_VERSION=2.0
 STARTUP_NOTIFICATION_VERSION=0.8
 DBUS_VERSION=0.60
-SQLITE_VERSION=3.6.22
+SQLITE_VERSION=3.6.23
 LIBNOTIFY_VERSION=0.4
 
 MSMANIFEST_TOOL=
 
 dnl Set various checks
 dnl ========================================================
 MISSING_X=
 AC_PROG_AWK
@@ -6365,86 +6365,107 @@ MOZ_ARG_ENABLE_BOOL(system-sqlite,
 MOZ_NATIVE_SQLITE=1,
 MOZ_NATIVE_SQLITE= )
 
 if test -z "$MOZ_NATIVE_SQLITE"
 then
     SQLITE_CFLAGS=
     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
 else
+    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 checks ===
-    dnl ===================================
-    dnl check to see if the system sqlite package is compiled with
+
+    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)
+    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"
-            #include <stdio.h>
-            #include <assert.h>
 
             int main(int argc, char **argv){
-              sqlite3 *db;
-              sqlite3_uint64 r;
-              char *zFilename;
-              FILE *in;
-              int i;
-              int rc;
-              char *zBuf;
-              const int bufSize = 1024*3;
-
-              zBuf = malloc(bufSize*sizeof(char));
-              assert( zBuf );
-              rc = sqlite3_open(":memory:", &db);
-              assert( rc==SQLITE_OK );
-              sqlite3_close(db);
-              sqlite3_randomness(sizeof(r), &r);
-              zFilename = sqlite3_mprintf("test_db_%llu.sqlite", r);
-              rc = sqlite3_open(zFilename, &db);
-              assert( rc==SQLITE_OK );
-              rc = sqlite3_exec(db, 
-                "BEGIN;"
-                "CREATE TABLE t1(x);"
-                "INSERT INTO t1 VALUES(zeroblob(1000)||'abcdefghijklmnopqrstuvwxyz');"
-                "COMMIT;"
-                "DELETE FROM t1;",
-                0, 0, 0
-              );
-              assert( rc==SQLITE_OK );
-              sqlite3_close(db);
-              in = fopen(zFilename, "r");
-              assert( in!=0 );
-              rc = fread(zBuf, 1, bufSize, in);
-              assert( rc==bufSize );
-              fclose(in);
-              unlink(zFilename);
-              free( zBuf );
-              for(i=0; i<bufSize-11; i++){
-                if( *(zBuf+i)=='h' && memcmp(zBuf+i, "hijklmnopq", 10)==0 ){
-                  return 1;
-                }
-              }
-              return 0;
+              return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE=1");
             }],
             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.])
+        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_THREADSAFE 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=1");
+            }],
+            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
 fi
 
 AC_SUBST(MOZ_NATIVE_SQLITE)
 
 dnl ========================================================
 dnl = Enable help viewer (off by default)
 dnl ========================================================
--- a/db/sqlite3/README.MOZILLA
+++ b/db/sqlite3/README.MOZILLA
@@ -1,11 +1,11 @@
-This is sqlite 3.6.22
+This is sqlite 3.6.23
 
--- Shawn Wilsher <me@shawnwilsher.com>, 01/2010
+-- Shawn Wilsher <me@shawnwilsher.com>, 03/2010
 
 See http://www.sqlite.org/ for more info.
 
 We have a mozilla-specific Makefile.in in src/ (normally no
 Makefile.in there) that we use to build.
 
 To move to a new version:
 
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -95,16 +95,17 @@ EXPORTS = \
 CSRCS = \
   sqlite3.c \
   $(NULL)
 
 # -DSQLITE_SECURE_DELETE=1 will cause SQLITE to 0-fill delete data so we
 # don't have to vacuum to make sure the data is not visible in the file.
 # -DSQLITE_ENABLE_FTS3=1 enables the full-text index module.
 # -DSQLITE_CORE=1 statically links that module into the SQLite library.
+# Note: Be sure to update the configure.in checks when these change!
 DEFINES = \
   -DSQLITE_SECURE_DELETE=1 \
   -DSQLITE_THREADSAFE=1 \
   -DSQLITE_CORE=1 \
   -DSQLITE_ENABLE_FTS3=1 \
   $(NULL)
 
 # -DSQLITE_ENABLE_LOCKING_STYLE=1 to help with AFP folders