diff --git a/.waf-tools/coverage.py b/.waf-tools/coverage.py
index ce92883..cc58165 100644
--- a/.waf-tools/coverage.py
+++ b/.waf-tools/coverage.py
@@ -1,15 +1,15 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-from waflib import TaskGen, Logs
+from waflib import TaskGen
 
 def options(opt):
-    opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
-                   help='''Set compiler flags for gcc to enable code coverage information''')
+    opt.add_option('--with-coverage', action='store_true', default=False,
+                   help='Add compiler flags to enable code coverage information')
 
 def configure(conf):
     if conf.options.with_coverage:
         if not conf.options.debug:
-            conf.fatal("Code coverage flags require debug mode compilation (add --debug)")
+            conf.fatal('Code coverage flags require debug mode compilation (add --debug)')
         conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
                        linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
 
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 2999e8f..54db7ea 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -1,44 +1,67 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-from waflib import Logs, Configure, Utils
+from waflib import Configure, Logs, Utils
 
 def options(opt):
-    opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
-                   help='''Compile in debugging mode without optimizations (-O0 or -Og)''')
+    opt.add_option('--debug', '--with-debug', action='store_true', default=False,
+                   help='Compile in debugging mode with minimal optimizations (-O0 or -Og)')
 
 def configure(conf):
-    cxx = conf.env['CXX_NAME'] # CXX_NAME represents generic name of the compiler
-    if cxx == 'gcc':
-        flags = GccFlags()
-    elif cxx == 'clang':
-        flags = ClangFlags()
-    else:
-        flags = CompilerFlags()
-        Logs.warn('The code has not yet been tested with %s compiler' % cxx)
+    conf.start_msg('Checking C++ compiler version')
 
-    areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
+    cxx = conf.env.CXX_NAME # generic name of the compiler
+    ccver = tuple(int(i) for i in conf.env.CC_VERSION)
+    ccverstr = '.'.join(conf.env.CC_VERSION)
+    errmsg = ''
+    warnmsg = ''
+    if cxx == 'gcc':
+        if ccver < (4, 8, 2):
+            errmsg = ('The version of gcc you are using is too old.\n'
+                      'The minimum supported gcc version is 4.8.2.')
+        conf.flags = GccFlags()
+    elif cxx == 'clang':
+        if ccver < (3, 4, 0):
+            errmsg = ('The version of clang you are using is too old.\n'
+                      'The minimum supported clang version is 3.4.0.')
+        conf.flags = ClangFlags()
+    else:
+        warnmsg = 'Note: %s compiler is unsupported' % cxx
+        conf.flags = CompilerFlags()
+
+    if errmsg:
+        conf.end_msg(ccverstr, color='RED')
+        conf.fatal(errmsg)
+    elif warnmsg:
+        conf.end_msg(ccverstr, color='YELLOW')
+        Logs.warn(warnmsg)
+    else:
+        conf.end_msg(ccverstr)
+
+    conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
 
     # General flags are always applied (e.g., selecting C++11 mode)
-    generalFlags = flags.getGeneralFlags(conf)
+    generalFlags = conf.flags.getGeneralFlags(conf)
     conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
     conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
     conf.env.DEFINES += generalFlags['DEFINES']
 
+@Configure.conf
+def check_compiler_flags(conf):
     # Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
     # corresponding environment variables are not set.
     # DEFINES are always applied.
     if conf.options.debug:
-        extraFlags = flags.getDebugFlags(conf)
-        if areCustomCxxflagsPresent:
+        extraFlags = conf.flags.getDebugFlags(conf)
+        if conf.areCustomCxxflagsPresent:
             missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS]
-            if len(missingFlags) > 0:
-                Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
-                          % " ".join(conf.env.CXXFLAGS))
-                Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
+            if missingFlags:
+                Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"'
+                          % ' '.join(conf.env.CXXFLAGS))
+                Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags))
     else:
-        extraFlags = flags.getOptimizedFlags(conf)
+        extraFlags = conf.flags.getOptimizedFlags(conf)
 
-    if not areCustomCxxflagsPresent:
+    if not conf.areCustomCxxflagsPresent:
         conf.add_supported_cxxflags(extraFlags['CXXFLAGS'])
         conf.add_supported_linkflags(extraFlags['LINKFLAGS'])
 
@@ -55,9 +78,10 @@
     self.start_msg('Checking supported CXXFLAGS')
 
     supportedFlags = []
-    for flag in cxxflags:
-        if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
-            supportedFlags += [flag]
+    for flags in cxxflags:
+        flags = Utils.to_list(flags)
+        if self.check_cxx(cxxflags=['-Werror'] + flags, mandatory=False):
+            supportedFlags += flags
 
     self.end_msg(' '.join(supportedFlags))
     self.env.prepend_value('CXXFLAGS', supportedFlags)
@@ -73,15 +97,19 @@
     self.start_msg('Checking supported LINKFLAGS')
 
     supportedFlags = []
-    for flag in linkflags:
-        if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
-            supportedFlags += [flag]
+    for flags in linkflags:
+        flags = Utils.to_list(flags)
+        if self.check_cxx(linkflags=['-Werror'] + flags, mandatory=False):
+            supportedFlags += flags
 
     self.end_msg(' '.join(supportedFlags))
     self.env.prepend_value('LINKFLAGS', supportedFlags)
 
 
 class CompilerFlags(object):
+    def getCompilerVersion(self, conf):
+        return tuple(int(i) for i in conf.env.CC_VERSION)
+
     def getGeneralFlags(self, conf):
         """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
         return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
@@ -98,18 +126,26 @@
     """
     This class defines basic flags that work for both gcc and clang compilers
     """
+    def getGeneralFlags(self, conf):
+        flags = super(GccBasicFlags, self).getGeneralFlags(conf)
+        flags['CXXFLAGS'] += ['-std=c++11']
+        return flags
+
     def getDebugFlags(self, conf):
         flags = super(GccBasicFlags, self).getDebugFlags(conf)
         flags['CXXFLAGS'] += ['-O0',
+                              '-Og', # gcc >= 4.8, clang >= 4.0
                               '-g3',
                               '-pedantic',
                               '-Wall',
                               '-Wextra',
                               '-Werror',
-                              '-Wno-unused-parameter',
-                              '-Wno-error=maybe-uninitialized', # Bug #1615
+                              '-Wnon-virtual-dtor',
                               '-Wno-error=deprecated-declarations', # Bug #3795
+                              '-Wno-error=maybe-uninitialized', # Bug #1615
+                              '-Wno-unused-parameter',
                               ]
+        flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
         return flags
 
     def getOptimizedFlags(self, conf):
@@ -119,36 +155,23 @@
                               '-pedantic',
                               '-Wall',
                               '-Wextra',
+                              '-Wnon-virtual-dtor',
                               '-Wno-unused-parameter',
                               ]
+        flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
         return flags
 
 class GccFlags(GccBasicFlags):
-    def getGeneralFlags(self, conf):
-        flags = super(GccFlags, self).getGeneralFlags(conf)
-        version = tuple(int(i) for i in conf.env['CC_VERSION'])
-        if version < (4, 8, 2):
-            conf.fatal('The version of gcc you are using (%s) is too old.\n' %
-                       '.'.join(conf.env['CC_VERSION']) +
-                       'The minimum supported gcc version is 4.8.2.')
-        else:
-            flags['CXXFLAGS'] += ['-std=c++11']
-        return flags
-
     def getDebugFlags(self, conf):
         flags = super(GccFlags, self).getDebugFlags(conf)
-        version = tuple(int(i) for i in conf.env['CC_VERSION'])
-        if version < (5, 1, 0):
+        if self.getCompilerVersion(conf) < (5, 1, 0):
             flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
-        flags['CXXFLAGS'] += ['-Og', # gcc >= 4.8
-                              '-fdiagnostics-color', # gcc >= 4.9
-                              ]
+        flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
         return flags
 
     def getOptimizedFlags(self, conf):
         flags = super(GccFlags, self).getOptimizedFlags(conf)
-        version = tuple(int(i) for i in conf.env['CC_VERSION'])
-        if version < (5, 1, 0):
+        if self.getCompilerVersion(conf) < (5, 1, 0):
             flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
         flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
         return flags
@@ -156,26 +179,36 @@
 class ClangFlags(GccBasicFlags):
     def getGeneralFlags(self, conf):
         flags = super(ClangFlags, self).getGeneralFlags(conf)
-        flags['CXXFLAGS'] += ['-std=c++11']
-        if Utils.unversioned_sys_platform() == 'darwin':
-            flags['CXXFLAGS'] += ['-stdlib=libc++']
-            flags['LINKFLAGS'] += ['-stdlib=libc++']
+        if Utils.unversioned_sys_platform() == 'darwin' and self.getCompilerVersion(conf) >= (9, 0, 0):
+            # Bug #4296
+            flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
+                                  ['-isystem', '/opt/local/include']] # for MacPorts
         return flags
 
     def getDebugFlags(self, conf):
         flags = super(ClangFlags, self).getDebugFlags(conf)
         flags['CXXFLAGS'] += ['-fcolor-diagnostics',
-                              '-Wno-unused-local-typedef', # Bugs #2657 and #3209
-                              '-Wno-error=unneeded-internal-declaration', # Bug #1588
+                              '-Wextra-semi',
+                              '-Wundefined-func-template',
                               '-Wno-error=deprecated-register',
-                              '-Wno-error=keyword-macro', # Bug #3235
                               '-Wno-error=infinite-recursion', # Bug #3358
+                              '-Wno-error=keyword-macro', # Bug #3235
+                              '-Wno-error=unneeded-internal-declaration', # Bug #1588
+                              '-Wno-unused-local-typedef', # Bugs #2657 and #3209
                               ]
+        version = self.getCompilerVersion(conf)
+        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
+            flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
         return flags
 
     def getOptimizedFlags(self, conf):
         flags = super(ClangFlags, self).getOptimizedFlags(conf)
         flags['CXXFLAGS'] += ['-fcolor-diagnostics',
+                              '-Wextra-semi',
+                              '-Wundefined-func-template',
                               '-Wno-unused-local-typedef', # Bugs #2657 and #3209
                               ]
+        version = self.getCompilerVersion(conf)
+        if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
+            flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
         return flags
diff --git a/.waf-tools/dependency-checker.py b/.waf-tools/dependency-checker.py
index 629fbfd..63199a5 100644
--- a/.waf-tools/dependency-checker.py
+++ b/.waf-tools/dependency-checker.py
@@ -4,10 +4,10 @@
 from waflib.Configure import conf
 
 def addDependencyOptions(self, opt, name, extraHelp=''):
-    opt.add_option('--with-%s' % name, type='string', default=None,
-                   dest='with_%s' % name,
+    opt.add_option('--with-%s' % name, metavar='PATH',
                    help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
-setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
+
+setattr(Options.OptionsContext, 'addDependencyOptions', addDependencyOptions)
 
 @conf
 def checkDependency(self, name, **kw):
@@ -18,8 +18,8 @@
     kw['mandatory'] = kw.get('mandatory', True)
 
     if root:
-        isOk = self.check_cxx(includes="%s/include" % root,
-                              libpath="%s/lib" % root,
+        isOk = self.check_cxx(includes='%s/include' % root,
+                              libpath='%s/lib' % root,
                               **kw)
     else:
         isOk = self.check_cxx(**kw)
diff --git a/.waf-tools/pch.py b/.waf-tools/pch.py
deleted file mode 100644
index 08cc5de..0000000
--- a/.waf-tools/pch.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#! /usr/bin/env python
-# encoding: utf-8
-# Alexander Afanasyev (UCLA), 2014
-
-"""
-Enable precompiled C++ header support (currently only clang++ and g++ are supported)
-
-To use this tool, wscript should look like:
-
-	def options(opt):
-		opt.load('pch')
-		# This will add `--with-pch` configure option.
-		# Unless --with-pch during configure stage specified, the precompiled header support is disabled
-
-	def configure(conf):
-		conf.load('pch')
-		# this will set conf.env.WITH_PCH if --with-pch is specified and the supported compiler is used
-		# Unless conf.env.WITH_PCH is set, the precompiled header support is disabled
-
-	def build(bld):
-		bld(features='cxx pch',
-			target='precompiled-headers',
-			name='precompiled-headers',
-			headers='a.h b.h c.h', # headers to pre-compile into `precompiled-headers`
-
-			# Other parameters to compile precompiled headers
-			# includes=...,
-			# export_includes=...,
-			# use=...,
-			# ...
-
-			# Exported parameters will be propagated even if precompiled headers are disabled
-		)
-
-		bld(
-			target='test',
-			features='cxx cxxprogram',
-			source='a.cpp b.cpp d.cpp main.cpp',
-			use='precompiled-headers',
-		)
-
-		# or
-
-		bld(
-			target='test',
-			features='pch cxx cxxprogram',
-			source='a.cpp b.cpp d.cpp main.cpp',
-			headers='a.h b.h c.h',
-		)
-
-Note that precompiled header must have multiple inclusion guards.  If the guards are missing, any benefit of precompiled header will be voided and compilation may fail in some cases.
-"""
-
-import os
-from waflib import Task, TaskGen, Logs, Utils
-from waflib.Tools import c_preproc, cxx
-
-
-PCH_COMPILER_OPTIONS = {
-	'clang++': [['-include'], '.pch', ['-x', 'c++-header']],
-	'g++':     [['-include'], '.gch', ['-x', 'c++-header']],
-}
-
-
-def options(opt):
-	opt.add_option('--without-pch', action='store_false', default=True, dest='with_pch', help='''Try to use precompiled header to speed up compilation (only g++ and clang++)''')
-
-def configure(conf):
-	if (conf.options.with_pch and conf.env['COMPILER_CXX'] in PCH_COMPILER_OPTIONS.keys()):
-		conf.env.WITH_PCH = True
-		flags = PCH_COMPILER_OPTIONS[conf.env['COMPILER_CXX']]
-		conf.env.CXXPCH_F = flags[0]
-		conf.env.CXXPCH_EXT = flags[1]
-		conf.env.CXXPCH_FLAGS = flags[2]
-
-
-@TaskGen.feature('pch')
-@TaskGen.before('process_source')
-def apply_pch(self):
-	if not self.env.WITH_PCH:
-		return
-
-	if getattr(self.bld, 'pch_tasks', None) is None:
-		self.bld.pch_tasks = {}
-
-	if getattr(self, 'headers', None) is None:
-		return
-
-	self.headers = self.to_nodes(self.headers)
-
-	if getattr(self, 'name', None):
-		try:
-			task = self.bld.pch_tasks[self.name]
-			self.bld.fatal("Duplicated 'pch' task with name %r" % self.name)
-		except KeyError:
-			pass
-
-	out = '%s.%d%s' % (self.target, self.idx, self.env['CXXPCH_EXT'])
-	out = self.path.find_or_declare(out)
-	task = self.create_task('gchx', self.headers, out)
-
-	# target should be an absolute path of `out`, but without precompiled header extension
-	task.target = out.abspath()[:-len(out.suffix())]
-
-	self.pch_task = task
-	if getattr(self, 'name', None):
-		self.bld.pch_tasks[self.name] = task
-
-@TaskGen.feature('cxx')
-@TaskGen.after_method('process_source', 'propagate_uselib_vars')
-def add_pch(self):
-	if not (self.env['WITH_PCH'] and getattr(self, 'use', None) and getattr(self, 'compiled_tasks', None) and getattr(self.bld, 'pch_tasks', None)):
-		return
-
-	pch = None
-	# find pch task, if any
-
-	if getattr(self, 'pch_task', None):
-		pch = self.pch_task
-	else:
-		for use in Utils.to_list(self.use):
-			try:
-				pch = self.bld.pch_tasks[use]
-			except KeyError:
-				pass
-
-	if pch:
-		for x in self.compiled_tasks:
-			x.env.append_value('CXXFLAGS', self.env['CXXPCH_F'] + [pch.target])
-
-class gchx(Task.Task):
-	run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${CXXPCH_FLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXXPCH_F:SRC} ${CXX_SRC_F}${SRC[0].abspath()} ${CXX_TGT_F}${TGT[0].abspath()}'
-	scan    = c_preproc.scan
-	color   = 'BLUE'
-	ext_out=['.h']
-
-	def runnable_status(self):
-		try:
-			node_deps = self.generator.bld.node_deps[self.uid()]
-		except KeyError:
-			node_deps = []
-		ret = Task.Task.runnable_status(self)
-		if ret == Task.SKIP_ME and self.env.CXX_NAME == 'clang':
-			t = os.stat(self.outputs[0].abspath()).st_mtime
-			for n in self.inputs + node_deps:
-				if os.stat(n.abspath()).st_mtime > t:
-					return Task.RUN_ME
-		return ret
diff --git a/.waf-tools/sqlite3.py b/.waf-tools/sqlite3.py
index 28dd57c..7ddbf0f 100644
--- a/.waf-tools/sqlite3.py
+++ b/.waf-tools/sqlite3.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # encoding: utf-8
 
-from waflib import Options
+from waflib import Options, Logs
 from waflib.Configure import conf
 
 def options(opt):
@@ -19,6 +19,9 @@
     mandatory = kw.get('mandatory', True)
     var = kw.get('uselib_store', 'SQLITE3')
 
+    if not self.options.with_sqlite_locking:
+        conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
+
     if root:
         self.check_cxx(lib='sqlite3',
                        msg='Checking for SQLite3 library',
@@ -31,6 +34,8 @@
         try:
             self.check_cfg(package='sqlite3',
                            args=['--cflags', '--libs'],
+                           global_define=True,
+                           define_name='HAVE_%s' % var,
                            uselib_store='SQLITE3',
                            mandatory=True)
         except:
