build: Add optional pthread flag when detecting Crypto++

This commit also includes a small fix to support Python3

Change-Id: Ifa0c547bd872ab749745b5bdc778d4b3269bb87e
Refs: #1590
diff --git a/.gitignore b/.gitignore
index 416246d..21772b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
 
 # waf build system
 .waf-1*
+.waf3-*
 .lock*
 build/
 
diff --git a/.waf-tools/cryptopp.py b/.waf-tools/cryptopp.py
index bf92a3c..2f95504 100644
--- a/.waf-tools/cryptopp.py
+++ b/.waf-tools/cryptopp.py
@@ -60,9 +60,11 @@
     if not self.env['CXX']:
         self.fatal('Load a c++ compiler first, e.g., conf.load("compiler_cxx")')
 
-    var = kw.get('uselib_store','CRYPTOPP')
+    var = kw.get('uselib_store', 'CRYPTOPP')
     mandatory = kw.get('mandatory', True)
 
+    use = kw.get('use', 'PTHREAD')
+
     self.start_msg('Checking Crypto++ lib')
     (root, file) = self.__cryptopp_find_root_and_version_file(*k, **kw)
 
@@ -85,4 +87,5 @@
                          cxxflags="-I%s/include" % root,
                          linkflags="-L%s/lib" % root,
                          mandatory=mandatory,
+                         use=use,
                          uselib_store=var)
diff --git a/docs/conf.py b/docs/conf.py
index 8131fcb..3fe24dd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -37,13 +37,11 @@
     try:
         __import__(extension)
         extensions.append(extension)
-    except ImportError, e:
-        print e
+    except ImportError:
         sys.stderr.write("Extension '%s' in not available. "
                          "Some documentation may not build correctly.\n" % extension)
         sys.stderr.write("To install, use \n"
                          "  sudo pip install %s\n" % extension.replace('.', '-'))
-        pass
 
 addExtensionIfExists('sphinxcontrib.doxylink')
 
diff --git a/tools/wscript b/tools/wscript
index eaa35cc..21671c6 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -1,5 +1,7 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
+from waflib import Utils
+
 top = '..'
 
 def configure(conf):
@@ -13,10 +15,10 @@
             use = 'ndn-cxx',
             )
 
-    bld (features = "subst",
-         source = bld.path.ant_glob(['wrapper/*.sh']),
-         target = ['%s' % node.change_ext('', '.sh')
-                   for node in bld.path.ant_glob(['wrapper/*.sh'])],
-         install_path = "${BINDIR}",
-         chmod = 0755,
-        )
+    bld(features = "subst",
+        source = bld.path.ant_glob(['wrapper/*.sh']),
+        target = ['%s' % node.change_ext('', '.sh')
+                  for node in bld.path.ant_glob(['wrapper/*.sh'])],
+        install_path = "${BINDIR}",
+        chmod = Utils.O755,
+       )
diff --git a/wscript b/wscript
index 2e46ff5..e397ee9 100644
--- a/wscript
+++ b/wscript
@@ -45,11 +45,16 @@
 
     conf.find_program('sh', var='SH', mandatory=True)
 
+    conf.check_cxx(lib='pthread', uselib_store='PTHREAD', define_name='HAVE_PTHREAD',
+                   mandatory=False)
+    conf.check_cxx(lib='rt', uselib_store='RT', define_name='HAVE_RT', mandatory=False)
+    conf.check_cxx(cxxflags=['-fPIC'], uselib_store='cxxstlib', mandatory=False)
+
     conf.check_osx_security(mandatory=False)
 
     conf.check_openssl(mandatory=True)
     conf.check_sqlite3(mandatory=True)
-    conf.check_cryptopp(mandatory=True)
+    conf.check_cryptopp(mandatory=True, use='PTHREAD')
 
     if conf.options.log4cxx:
         conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX',
@@ -78,11 +83,6 @@
                     " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
         return
 
-    conf.check_cxx(lib='pthread', uselib_store='PTHREAD', define_name='HAVE_PTHREAD',
-                   mandatory=False)
-    conf.check_cxx(lib='rt', uselib_store='RT', define_name='HAVE_RT', mandatory=False)
-    conf.check_cxx(cxxflags=['-fPIC'], uselib_store='cxxstlib', mandatory=False)
-
     if not conf.options.with_sqlite_locking:
         conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)