Bug 1055441, follow up to fix a build bustage, use system sqlite on Darwin, but only if sqlite3 is at least version 3.5
authorKai Engert <kaie@kuix.de>
Mon, 23 Feb 2015 18:31:06 +0100
changeset 11366 6fda0b46524f8ab276f5695e31ce754e88831717
parent 11365 8d6b91a03005882d4eca67d8aab7741e963abaa3
child 11367 ad20f7ddeb765bef23eacf8af23e6c8c1c5384de
push id568
push userkaie@kuix.de
push dateMon, 23 Feb 2015 17:31:13 +0000
bugs1055441
Bug 1055441, follow up to fix a build bustage, use system sqlite on Darwin, but only if sqlite3 is at least version 3.5
coreconf/Darwin.mk
--- a/coreconf/Darwin.mk
+++ b/coreconf/Darwin.mk
@@ -117,10 +117,21 @@ PROCESS_MAP_FILE = grep -v ';+' $< | gre
 USE_SYSTEM_ZLIB = 1
 ZLIB_LIBS	= -lz
 
 # The system sqlite library in the latest version of Mac OS X often becomes
 # newer than the sqlite library in NSS. This may result in certain Mac OS X
 # system libraries having unresolved sqlite symbols during the shlibsign step
 # of the NSS build when we set DYLD_LIBRARY_PATH to the NSS lib directory and
 # the NSS libsqlite3.dylib is used instead of the system one. So just use the
-# system sqlite library on Mac.
-NSS_USE_SYSTEM_SQLITE = 1
+# system sqlite library on Mac, if it's sufficiently new.
+
+SYS_SQLITE3_VERSION_FULL := $(shell sqlite3 -version | awk '{print $$1}')
+SYS_SQLITE3_VERSION_MAJOR := $(shell echo $(SYS_SQLITE3_VERSION_FULL) | awk -F. '{ print $$1 }')
+SYS_SQLITE3_VERSION_MINOR := $(shell echo $(SYS_SQLITE3_VERSION_FULL) | awk -F. '{ print $$2 }')
+
+ifeq (3,$(SYS_SQLITE3_VERSION_MAJOR))
+    ifeq (,$(filter-out 0 1 2 3 4,$(SYS_SQLITE3_VERSION_MINOR)))
+        # sqlite <= 3.4.x is too old, it doesn't provide sqlite3_file_control
+    else
+        NSS_USE_SYSTEM_SQLITE = 1
+    endif
+endif