Add "PSYNC_" prefix to access specifier macros to avoid conflicts

Also, sync boost.py waf tool with ndn-cxx

Change-Id: I75ed79725706313c3e64913de0fac17e2c182b8c
diff --git a/wscript b/wscript
index 9412e7d..11ae785 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,6 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-from waflib import Logs, Utils, Context
+from waflib import Context, Logs, Utils
 import os, subprocess
 
 VERSION = '0.1.0'
@@ -13,79 +13,77 @@
               'boost', 'doxygen', 'sphinx_build'],
              tooldir=['.waf-tools'])
 
-    opt.add_option('--with-examples', action='store_true', default=False,
-                   help='Build examples')
-
-    opt.add_option('--with-tests', action='store_true', default=False,
-                   help='Build unit tests')
+    optgrp = opt.add_option_group('PSync Options')
+    optgrp.add_option('--with-examples', action='store_true', default=False,
+                      help='Build examples')
+    optgrp.add_option('--with-tests', action='store_true', default=False,
+                      help='Build unit tests')
 
 def configure(conf):
     conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs',
                'default-compiler-flags', 'boost',
                'doxygen', 'sphinx_build'])
 
+    conf.env.WITH_EXAMPLES = conf.options.with_examples
+    conf.env.WITH_TESTS = conf.options.with_tests
+
     if 'PKG_CONFIG_PATH' not in os.environ:
         os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
+    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX')
 
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
-                   uselib_store='NDN_CXX', mandatory=True)
-
-    conf.env['WITH_TESTS'] = conf.options.with_tests
-    conf.env['WITH_EXAMPLES'] = conf.options.with_examples
-
-    boost_libs = 'system thread log log_setup iostreams'
-    if conf.env['WITH_TESTS']:
-        conf.define('WITH_TESTS', 1);
-        boost_libs += ' unit_test_framework'
+    boost_libs = ['system', 'iostreams']
+    if conf.env.WITH_TESTS:
+        boost_libs.append('unit_test_framework')
 
     conf.check_boost(lib=boost_libs, mt=True)
 
     conf.check_compiler_flags()
 
+    # Loading "late" to prevent tests from being compiled with profiling flags
     conf.load('coverage')
-
     conf.load('sanitizers')
 
     # If there happens to be a static library, waf will put the corresponding -L flags
     # before dynamic library flags.  This can result in compilation failure when the
     # system has a different version of the PSync library installed.
-    conf.env['STLIBPATH'] = ['.'] + conf.env['STLIBPATH']
+    conf.env.prepend_value('STLIBPATH', ['.'])
 
-    conf.write_config_header('PSync/detail/config.hpp')
+    conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS)
+    # The config header will contain all defines that were added using conf.define()
+    # or conf.define_cond().  Everything that was added directly to conf.env.DEFINES
+    # will not appear in the config header, but will instead be passed directly to the
+    # compiler on the command line.
+    conf.write_config_header('PSync/detail/config.hpp', define_prefix='PSYNC_')
 
 def build(bld):
     bld.shlib(
         target='PSync',
         vnum=VERSION,
         cnum=VERSION,
-        source =  bld.path.ant_glob('PSync/**/*.cpp'),
-        use = 'BOOST NDN_CXX',
-        includes = '.',
-        export_includes='.',
-        )
+        source=bld.path.ant_glob('PSync/**/*.cpp'),
+        use='BOOST NDN_CXX',
+        includes='.',
+        export_includes='.')
+
+    if bld.env.WITH_TESTS:
+        bld.recurse('tests')
+
+    if bld.env.WITH_EXAMPLES:
+        bld.recurse('examples')
 
     headers = bld.path.ant_glob('PSync/**/*.hpp')
-
     bld.install_files(bld.env['INCLUDEDIR'], headers, relative_trick=True)
 
     bld.install_files('${INCLUDEDIR}/PSync/detail',
                       bld.path.find_resource('PSync/detail/config.hpp'))
 
-    pc = bld(
-        features = "subst",
+    bld(features='subst',
         source='PSync.pc.in',
         target='PSync.pc',
         install_path = '${LIBDIR}/pkgconfig',
         PREFIX       = bld.env['PREFIX'],
         INCLUDEDIR   = bld.env['INCLUDEDIR'],
-        VERSION      = VERSION,
-        )
-
-    if bld.env['WITH_TESTS']:
-        bld.recurse('tests')
-
-    if bld.env['WITH_EXAMPLES']:
-        bld.recurse('examples')
+        VERSION      = VERSION)
 
 def docs(bld):
     from waflib import Options