build: do not look for unneeded libraries

Change-Id: Ifcf45442b947bf23355e270f1f9bda298792d4a2
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index 4eddec7..4b2ede5 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -56,6 +56,7 @@
 
 BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
 BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
+
 BOOST_VERSION_FILE = 'boost/version.hpp'
 BOOST_VERSION_CODE = '''
 #include <iostream>
@@ -90,13 +91,18 @@
 
 BOOST_LOG_CODE = '''
 #include <boost/log/trivial.hpp>
+int main() { BOOST_LOG_TRIVIAL(info) << "boost_log is working"; }
+'''
+
+BOOST_LOG_SETUP_CODE = '''
+#include <boost/log/trivial.hpp>
 #include <boost/log/utility/setup/console.hpp>
 #include <boost/log/utility/setup/common_attributes.hpp>
 int main() {
 	using namespace boost::log;
 	add_common_attributes();
 	add_console_log(std::clog, keywords::format = "%Message%");
-	BOOST_LOG_TRIVIAL(debug) << "log is working" << std::endl;
+	BOOST_LOG_TRIVIAL(info) << "boost_log_setup is working";
 }
 '''
 
@@ -452,12 +458,15 @@
 			self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
 		if has_lib('thread'):
 			self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)
-		if has_lib('log'):
+		if has_lib('log') or has_lib('log_setup'):
 			if not has_lib('thread'):
 				self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
-			if has_shlib('log'):
+			if has_shlib('log') or has_shlib('log_setup'):
 				self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
-			self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
+			if has_lib('log_setup'):
+				self.check_cxx(fragment=BOOST_LOG_SETUP_CODE, use=var, execute=False)
+			else:
+				self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
 
 	if params.get('linkage_autodetect', False):
 		self.start_msg('Attempting to detect boost linkage flags')
diff --git a/.waf-tools/openssl.py b/.waf-tools/openssl.py
index de0f9dc..b35795f 100644
--- a/.waf-tools/openssl.py
+++ b/.waf-tools/openssl.py
@@ -19,23 +19,20 @@
 '''
 
 import re
-from waflib import Utils, Logs
+from waflib import Utils
 from waflib.Configure import conf
 
-OPENSSL_VERSION_FILE = 'opensslv.h'
 OPENSSL_DIR_OSX = ['/usr/local', '/opt/local', '/usr/local/opt/openssl']
 OPENSSL_DIR = ['/usr', '/usr/local', '/opt/local', '/sw']
 
 def options(opt):
     opt.add_option('--with-openssl', type='string', default=None, dest='openssl_dir',
-                   help='''Path to where OpenSSL is installed, e.g., /usr/local''')
-
+                   help='directory where OpenSSL is installed, e.g., /usr/local')
 
 @conf
 def __openssl_get_version_file(self, dir):
     try:
-        return self.root.find_dir(dir).find_node('%s/%s' % ('include/openssl',
-                                                            OPENSSL_VERSION_FILE))
+        return self.root.find_dir(dir).find_node('include/openssl/opensslv.h')
     except:
         return None
 
@@ -47,8 +44,8 @@
     if root and file:
         return (root, file)
 
-    openssl_dir = [];
-    if Utils.unversioned_sys_platform() == "darwin":
+    openssl_dir = []
+    if Utils.unversioned_sys_platform() == 'darwin':
         openssl_dir = OPENSSL_DIR_OSX
     else:
         openssl_dir = OPENSSL_DIR
@@ -66,10 +63,7 @@
 
 @conf
 def check_openssl(self, *k, **kw):
-    atleast_version = kw.get('atleast_version', 0)
-    var = kw.get('uselib_store', 'OPENSSL')
-
-    self.start_msg('Checking for OpenSSL lib')
+    self.start_msg('Checking for OpenSSL version')
     (root, file) = self.__openssl_find_root_and_version_file(*k, **kw)
 
     try:
@@ -88,18 +82,21 @@
     except:
         self.fatal('OpenSSL version file is not found or is not usable')
 
+    atleast_version = kw.get('atleast_version', 0)
     if int(version, 16) < atleast_version:
-        self.fatal("The version of OpenSSL is too old\n" +
-                   "Please upgrade your distribution or install newer version of OpenSSL library")
+        self.fatal('The version of OpenSSL is too old\n'
+                   'Please upgrade your distribution or manually install a newer version of OpenSSL')
 
-    kwargs = {}
+    if 'msg' not in kw:
+        kw['msg'] = 'Checking if OpenSSL library works'
+    if 'lib' not in kw:
+        kw['lib'] = ['ssl', 'crypto']
+    if 'uselib_store' not in kw:
+        kw['uselib_store'] = 'OPENSSL'
+    if 'define_name' not in kw:
+        kw['define_name'] = 'HAVE_%s' % kw['uselib_store']
     if root:
-        kwargs['includes'] = "%s/include" % root
-        kwargs['libpath'] = "%s/lib" % root
+        kw['includes'] = '%s/include' % root
+        kw['libpath'] = '%s/lib' % root
 
-    libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
-                               msg='Checking if OpenSSL library works',
-                               define_name='HAVE_%s' % var,
-                               uselib_store=var,
-                               mandatory=True,
-                               **kwargs)
+    self.check_cxx(**kw)
diff --git a/.waf-tools/sqlite3.py b/.waf-tools/sqlite3.py
index 3d4e46e..4f2c016 100644
--- a/.waf-tools/sqlite3.py
+++ b/.waf-tools/sqlite3.py
@@ -1,16 +1,15 @@
 #! /usr/bin/env python
 # encoding: utf-8
 
-from waflib import Options, Logs
 from waflib.Configure import conf
 
 def options(opt):
-    opt.add_option('--with-sqlite3', type='string', default=None,
-                   dest='with_sqlite3', help='''Path to SQLite3, e.g., /usr/local''')
+    opt.add_option('--with-sqlite3', type='string', default=None, dest='sqlite3_dir',
+                   help='directory where SQLite3 is installed, e.g., /usr/local')
 
 @conf
 def check_sqlite3(self, *k, **kw):
-    root = k and k[0] or kw.get('path', None) or Options.options.with_sqlite3
+    root = k and k[0] or kw.get('path', self.options.sqlite3_dir)
     mandatory = kw.get('mandatory', True)
     var = kw.get('uselib_store', 'SQLITE3')
 
@@ -20,8 +19,8 @@
                        define_name='HAVE_%s' % var,
                        uselib_store=var,
                        mandatory=mandatory,
-                       includes="%s/include" % root,
-                       libpath="%s/lib" % root)
+                       includes='%s/include' % root,
+                       libpath='%s/lib' % root)
     else:
         try:
             self.check_cfg(package='sqlite3',