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/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)