Adding waf scripts to find CCNx and TinyXML header/libs
diff --git a/waf-tools/ccnx.py b/waf-tools/ccnx.py
new file mode 100644
index 0000000..5338b5f
--- /dev/null
+++ b/waf-tools/ccnx.py
@@ -0,0 +1,77 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+'''
+
+When using this tool, the wscript will look like:
+
+	def options(opt):
+	        opt.tool_options('ccnx', tooldir=["waf-tools"])
+
+	def configure(conf):
+		conf.load('compiler_cxx ccnx')
+
+	def build(bld):
+		bld(source='main.cpp', target='app', use='CCNX')
+
+Options are generated, in order to specify the location of ccnx includes/libraries.
+
+
+'''
+import sys
+import re
+from waflib import Utils,Logs,Errors
+from waflib.Configure import conf
+CCNX_DIR=['/usr','/usr/local','/opt/local','/sw']
+CCNX_VERSION_FILE='ccn/ccn.h'
+CCNX_VERSION_CODE='''
+#include <iostream>
+#include <ccn/ccn.h>
+int main() { std::cout << ((CCN_API_VERSION/100000) % 100) << "." << ((CCN_API_VERSION/1000) % 100) << "." << (CCN_API_VERSION % 1000); }
+'''
+
+def options(opt):
+	opt.add_option('--ccnx',type='string',default='',dest='ccnx_dir',help='''path to where CCNx is installed, e.g. /usr/local''')
+@conf
+def __ccnx_get_version_file(self,dir):
+	# Logs.pprint ('CYAN', '  + %s/%s/%s' % (dir, 'include', CCNX_VERSION_FILE))
+	try:
+		return self.root.find_dir(dir).find_node('%s/%s' % ('include', CCNX_VERSION_FILE))
+	except:
+		return None
+@conf
+def ccnx_get_version(self,dir):
+	val=self.check_cxx(fragment=CCNX_VERSION_CODE,includes=['%s/%s' % (dir, 'include')],execute=True,define_ret = True, mandatory=True)
+	return val
+@conf
+def ccnx_get_root(self,*k,**kw):
+	root=k and k[0]or kw.get('path',None)
+	# Logs.pprint ('RED', '   %s' %root)
+	if root and self.__ccnx_get_version_file(root):
+		return root
+	for dir in CCNX_DIR:
+		if self.__ccnx_get_version_file(dir):
+			return dir
+	if root:
+		self.fatal('CCNx not found in %s'%root)
+	else:
+		self.fatal('CCNx not found, please provide a --ccnx argument (see help)')
+@conf
+def check_ccnx(self,*k,**kw):
+	if not self.env['CXX']:
+		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
+
+	var=kw.get('uselib_store','CCNX')
+	self.start_msg('Checking CCNx')
+	root = self.ccnx_get_root(*k,**kw);
+	self.env.CCNX_VERSION=self.ccnx_get_version(root)
+
+	self.env['INCLUDES_%s'%var]= '%s/%s' % (root, "include");
+	self.env['LIB_%s'%var] = "ccn"
+	self.env['LIBPATH_%s'%var] = '%s/%s' % (root, "lib")
+
+	self.end_msg(self.env.CCNX_VERSION)
+	if Logs.verbose:
+		Logs.pprint('CYAN','	ccnx include : %s'%self.env['INCLUDES_%s'%var])
+		Logs.pprint('CYAN','	ccnx lib     : %s'%self.env['LIB_%s'%var])
+		Logs.pprint('CYAN','	ccnx libpath : %s'%self.env['LIBPATH_%s'%var])
diff --git a/waf-tools/tinyxml.py b/waf-tools/tinyxml.py
new file mode 100644
index 0000000..3908b38
--- /dev/null
+++ b/waf-tools/tinyxml.py
@@ -0,0 +1,76 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+'''
+
+When using this tool, the wscript will look like:
+
+	def options(opt):
+	        opt.tool_options('tinyxml', tooldir=["waf-tools"])
+
+	def configure(conf):
+		conf.load('compiler_cxx tiny')
+
+	def build(bld):
+		bld(source='main.cpp', target='app', use='TINYXML')
+
+Options are generated, in order to specify the location of tinyxml includes/libraries.
+
+
+'''
+import sys
+import re
+from waflib import Utils,Logs,Errors
+from waflib.Configure import conf
+TINYXML_DIR=['/usr','/usr/local','/opt/local','/sw']
+TINYXML_VERSION_FILE='tinyxml.h'
+TINYXML_VERSION_CODE='''
+#include <iostream>
+#include <tinyxml.h>
+int main() { std::cout << TIXML_MAJOR_VERSION << "." << TIXML_MINOR_VERSION << "." << TIXML_PATCH_VERSION; }
+'''
+
+def options(opt):
+	opt.add_option('--tinyxml',type='string',default='',dest='tinyxml_dir',help='''path to where TinyXML is installed, e.g. /usr/local''')
+@conf
+def __tinyxml_get_version_file(self,dir):
+	try:
+		return self.root.find_dir(dir).find_node('%s/%s' % ('include', TINYXML_VERSION_FILE))
+	except:
+		return None
+@conf
+def tinyxml_get_version(self,dir):
+	val=self.check_cxx(fragment=TINYXML_VERSION_CODE,includes=['%s/%s' % (dir, 'include')], execute=True, define_ret = True, mandatory=True)
+	return val
+@conf
+def tinyxml_get_root(self,*k,**kw):
+	root=k and k[0]or kw.get('path',None)
+	# Logs.pprint ('RED', '   %s' %root)
+	if root and self.__tinyxml_get_version_file(root):
+		return root
+	for dir in TINYXML_DIR:
+		if self.__tinyxml_get_version_file(dir):
+			return dir
+	if root:
+		self.fatal('TinyXML not found in %s'%root)
+	else:
+		self.fatal('TinyXML not found, please provide a --tinyxml argument (see help)')
+@conf
+def check_tinyxml(self,*k,**kw):
+	if not self.env['CXX']:
+		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
+
+	var=kw.get('uselib_store','TINYXML')
+	self.start_msg('Checking TinyXML')
+	root = self.tinyxml_get_root(*k,**kw);
+	self.env.TINYXML_VERSION=self.tinyxml_get_version(root)
+
+	self.env['INCLUDES_%s'%var]= '%s/%s' % (root, "include");
+	self.env['LIB_%s'%var] = "tinyxml"
+	self.env['LIBPATH_%s'%var] = '%s/%s' % (root, "lib")
+
+	self.end_msg(self.env.TINYXML_VERSION)
+	if Logs.verbose:
+		Logs.pprint('CYAN','	TinyXML include : %s'%self.env['INCLUDES_%s'%var])
+		Logs.pprint('CYAN','	TinyXML lib     : %s'%self.env['LIB_%s'%var])
+		Logs.pprint('CYAN','	TinyXML libpath : %s'%self.env['LIBPATH_%s'%var])
diff --git a/wscript b/wscript
index 3ace7da..d7ad109 100644
--- a/wscript
+++ b/wscript
@@ -8,26 +8,31 @@
     opt.load('compiler_cxx')
     opt.load('boost')
     opt.load('doxygen')
+    opt.load('ccnx tinyxml', tooldir=["waf-tools"])
 
 def configure(conf):
     conf.load("compiler_cxx")
     conf.check_cfg(atleast_pkgconfig_version='0.20')
     conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL')
-    conf.check_cfg(package='libxml-2.0', args=['--cflags', '--libs'], uselib_store='XML')
-    conf.define ('STANDALONE', 1)
-    # conf.define ('DIGEST_BASE64', 1) # base64 is not working and probably will not work at all
+    # conf.check_cfg(package='libxml-2.0', args=['--cflags', '--libs'], uselib_store='XML')
 
     conf.load('boost')
     conf.check_boost(lib='system iostreams test')
     
     conf.load('doxygen')
+    conf.load('ccnx tinyxml')
+    conf.check_ccnx (path=conf.options.ccnx_dir)
+    conf.check_tinyxml (path=conf.options.ccnx_dir)
 
+    conf.define ('STANDALONE', 1)
+    # conf.define ('DIGEST_BASE64', 1) # base64 is not working and probably will not work at all
+	
 def build (bld):
     bld.shlib (target=APPNAME, 
                features=['cxx', 'cxxshlib'],
                source = bld.path.ant_glob(['model/sync-*.cc',
                                            'helper/sync-*.cc']),
-               uselib = 'BOOST BOOST_IOSTREAMS SSL XML'
+               uselib = 'BOOST BOOST_IOSTREAMS SSL TINYXML CCNX'
                )
 
     # Unit tests