Adding nsync for NLSR
diff --git a/nsync/wscript b/nsync/wscript
new file mode 100644
index 0000000..4dd63e9
--- /dev/null
+++ b/nsync/wscript
@@ -0,0 +1,128 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+VERSION='0.1'
+APPNAME='nsync'
+
+from waflib import Configure, Build, Logs
+
+def options(opt):
+    opt.load('compiler_c compiler_cxx boost doxygen gnu_dirs protoc')
+    # opt.load('ndnx', tooldir=["waf-tools"])
+
+    syncopt = opt.add_option_group ("ChronoSync Options")
+
+    syncopt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
+    syncopt.add_option('--log4cxx', action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx''')
+    syncopt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
+
+def configure(conf):
+    conf.load('compiler_c compiler_cxx gnu_dirs boost')
+
+    if conf.options.debug:
+        conf.define ('_DEBUG', 1)
+        conf.add_supported_cxxflags (cxxflags = ['-O0',
+                                                 '-Wall',
+                                                 '-Wno-unused-variable',
+                                                 '-g3',
+                                                 '-Wno-unused-private-field', # only clang supports
+                                                 '-fcolor-diagnostics',       # only clang supports
+                                                 '-Qunused-arguments'         # only clang supports
+                                                 ])
+    else:
+        conf.add_supported_cxxflags (cxxflags = ['-O3', '-g'])
+
+    conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDNCPP', mandatory=True)
+    
+    conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='OPENSSL', mandatory=True)
+
+    conf.check_boost(lib='system iostreams thread unit_test_framework')
+
+    if conf.options.log4cxx:
+        conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
+
+    if conf.options._test:
+      conf.define('_TEST', 1)
+
+    try:
+        conf.load('doxygen')
+    except:
+        pass
+
+    conf.load('protoc')
+
+def build (bld):
+    libsync = bld (
+        target="nsync",
+        # vnum = "1.0.0",
+        features=['cxx', 'cxxshlib'],
+        source =  bld.path.ant_glob (['src/**/*.cc', 'src/**/*.proto']),
+        use = 'BOOST NDNCPP OPENSSL',
+        includes = ['src'],
+        )
+    
+    # Unit tests
+    if bld.get_define("_TEST"):
+      unittests = bld.program (
+          target="unit-tests",
+          source = bld.path.ant_glob(['tests/**/*.cc']),
+          features=['cxx', 'cxxprogram'],
+          use = 'nsync',
+          includes = ['src'],
+          )
+
+    if bld.get_define ("HAVE_LOG4CXX"):
+        libsync.use += ' LOG4CXX'
+        if bld.get_define("_TEST"):
+            unittests.use += ' LOG4CXX'
+
+    bld.install_files (
+        dest = "%s/nsync" % bld.env['INCLUDEDIR'], 
+        files = bld.path.ant_glob(['src/**/*.h']), 
+        cwd = bld.path.find_dir ("src"),
+        relative_trick = True,
+        )
+
+    bld.install_files (
+        dest = "%s/nsync" % bld.env['INCLUDEDIR'], 
+        files = bld.path.get_bld().ant_glob(['src/**/*.h']), 
+        cwd = bld.path.get_bld().find_dir ("src"),
+        relative_trick = True,
+        )
+
+    pc = bld (
+        features = "subst",
+        source='nsync.pc.in',
+        target='nsync.pc',
+        install_path = '${LIBDIR}/pkgconfig',
+        PREFIX       = bld.env['PREFIX'],
+        INCLUDEDIR   = "%s/nsync" % bld.env['INCLUDEDIR'],
+        VERSION      = VERSION,
+        )
+
+# doxygen docs
+from waflib.Build import BuildContext
+class doxy (BuildContext):
+    cmd = "doxygen"
+    fun = "doxygen"
+
+def doxygen (bld):
+    if not bld.env.DOXYGEN:
+        bld.fatal ("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
+    bld (features="doxygen",
+         doxyfile='doc/doxygen.conf',
+         output_dir = 'doc')
+
+@Configure.conf
+def add_supported_cxxflags(self, cxxflags):
+    """
+    Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
+    """
+    self.start_msg('Checking allowed flags for c++ compiler')
+
+    supportedFlags = []
+    for flag in cxxflags:
+        if self.check_cxx (cxxflags=[flag], mandatory=False):
+            supportedFlags += [flag]
+
+    self.end_msg (' '.join (supportedFlags))
+    self.env.CXXFLAGS += supportedFlags