Added autoconf build system. Removed waf-tools.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..2cadb03
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,25 @@
+## Helloworld C++: an example project using Automake
+
+## Place generated object files (.o) into the same directory as their source
+## files, in order to avoid collisions when non-recursive make is used.
+AUTOMAKE_OPTIONS = subdir-objects
+
+## Additional flags to pass to aclocal when it is invoked automatically at
+## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment
+## to provide a way for the user to supply additional arguments.
+ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
+
+## Define an executable target "hello", which will be installed into the
+## directory named by the predefined variable $(bindir).
+bin_PROGRAMS = test1
+
+## Define the list of source files for the "hello" target. The file extension
+## .cpp is recognized by Automake, and causes it to produce rules which invoke
+## the C++ compiler to produce an object file (.o) from each source file. The
+## header files (.h) do not result in object files by themselves, but will be
+## included in distribution archives of the project.
+test1_SOURCES = test/test1.cpp
+
+## Define an independent executable script for inclusion in the distribution
+## archive. It will not be installed on an end user's system, however.
+dist_noinst_SCRIPTS = autogen.sh
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..8d8af2b
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+autoreconf --force --install --verbose "$srcdir"
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..af7095e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,33 @@
+AC_INIT([ndn-cpp], [0.5], [],
+        [ndn-cpp], [https://github.com/named-data/ndn-cpp])
+AC_PREREQ([2.59])
+AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
+
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CXX
+AC_LANG([C++])
+
+AC_MSG_CHECKING([for std::shared_ptr])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+    [[#include <memory>]]
+    [[std::shared_ptr<int> have_shared_ptr;]])
+], [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 1, [1 if have the `std::shared_ptr' class.])
+], [
+    AC_MSG_RESULT([no])
+    AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 0, [1 if have the `std::shared_ptr' class.])
+])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+    [[#include <boost/shared_ptr.hpp>]]
+    [[boost::shared_ptr<int> have_shared_ptr;]])
+], [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 1, [1 if have the `boost::shared_ptr' class.])
+], [
+    AC_MSG_RESULT([no])
+    AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 0, [1 if have the `boost::shared_ptr' class.])
+])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libndn.cxx.pc.in b/libndn.cxx.pc.in
deleted file mode 100644
index e880ea7..0000000
--- a/libndn.cxx.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix=@PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: libccnx-cpp
-Description: C++ NDN API (currently a wrapper on top of CCNx C library)
-Version: @VERSION@
-Libs: -L${libdir} -lndn.cxx
-Cflags: -I${includedir}
diff --git a/waf b/waf
deleted file mode 100755
index 240e86f..0000000
--- a/waf
+++ /dev/null
Binary files differ
diff --git a/waf-tools/sphinx_build.py b/waf-tools/sphinx_build.py
deleted file mode 100644
index e1155d1..0000000
--- a/waf-tools/sphinx_build.py
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# Hans-Martin von Gaudecker, 2012
-
-"""
-Create Sphinx documentation. Currently only LaTeX and HTML are supported.
-
-The source file **must** be the conf.py file used by Sphinx. Everything
-else has defaults, passing in the parameters is optional.
-
-Usage for getting both html and pdf docs:
-
-    ctx(features='sphinx', source='docs/conf.py')
-    ctx(features='sphinx', source='docs/conf.py', buildername='latex')
-
-Optional parameters and their defaults:
-
-    * buildername: html
-    * srcdir: confdir (the directory where conf.py lives)
-    * outdir: confdir/buildername (in the build directory tree)
-    * doctreedir: outdir/.doctrees
-    * type: pdflatex (only applies to 'latex' builder)
-
-"""
-
-
-import os
-from waflib import Task, TaskGen, Errors, Logs
-
-class RunSphinxBuild(Task.Task):
-	def scan(self):
-		"""Use Sphinx' internal environment to find the dependencies."""
-		s = self.sphinx_instance
-		msg, dummy, iterator = s.env.update(s.config, s.srcdir, s.doctreedir, s)
-		s.info(msg)
-		dep_nodes = []
-		for docname in s.builder.status_iterator(iterator, "reading sources... "):
-			filename = docname + s.config.source_suffix
-			dep_nodes.append(self.srcdir.find_node(filename))
-		for dep in s.env.dependencies.values():
-			# Need the 'str' call because Sphinx might return Unicode strings.
-			[dep_nodes.append(self.srcdir.find_node(str(d))) for d in dep]
-		return (dep_nodes, [])
-
-	def run(self):
-		"""Run the Sphinx build."""
-		self.sphinx_instance.build(force_all=False, filenames=None)
-		return None
-
-	def post_run(self):
-		"""Add everything found in the output directory tree as an output.
-		Not elegant, but pragmatic."""
-		for n in self.outdir.ant_glob("**", quiet=True, remove=False):
-			if n not in self.outputs: self.set_outputs(n)
-		super(RunSphinxBuild, self).post_run()
-
-
-def _get_main_targets(tg, s):
-	"""Return some easy targets known from the Sphinx build environment **s.env**."""
-	out_dir = tg.bld.root.find_node(s.outdir)
-	tgt_nodes = []
-	if s.builder.name == "latex":
-		for tgt_info in s.env.config.latex_documents:
-			tgt_nodes.append(out_dir.find_or_declare(tgt_info[1]))
-	elif s.builder.name == "html":
-		suffix = getattr(s.env.config, "html_file_suffix", ".html")
-		tgt_name = s.env.config.master_doc + suffix
-		tgt_nodes.append(out_dir.find_or_declare(tgt_name))
-	else:
-		raise Errors.WafError("Sphinx builder not implemented: %s" % s.builder.name)
-	return tgt_nodes
-
-
-@TaskGen.feature("sphinx")
-@TaskGen.before_method("process_source")
-def apply_sphinx(tg):
-	"""Set up the task generator with a Sphinx instance and create a task."""
-
-        from sphinx.application import Sphinx
-
-	# Put together the configuration based on defaults and tg attributes.
-	conf = tg.path.find_node(tg.source)
-	confdir = conf.parent.abspath()
-	buildername = getattr(tg, "buildername", "html")
-	srcdir = getattr(tg, "srcdir", confdir)
-	outdir = tg.path.find_or_declare (getattr(tg, "outdir", os.path.join(conf.parent.get_bld().abspath(), buildername))).abspath ()
-        
-	doctreedir = getattr(tg, "doctreedir", os.path.join(outdir, ".doctrees"))
-
-	# Set up the Sphinx instance.
-	s = Sphinx (srcdir, confdir, outdir, doctreedir, buildername, status=None)
-
-	# Get the main targets of the Sphinx build.
-	tgt_nodes = _get_main_targets(tg, s)
-
-	# Create the task and set the required attributes.  
-	task = tg.create_task("RunSphinxBuild", src=conf, tgt=tgt_nodes)
-	task.srcdir = tg.bld.root.find_node(s.srcdir)
-	task.outdir = tg.bld.root.find_node(s.outdir)
-	task.sphinx_instance = s
-
-	# Build pdf if we have the LaTeX builder, allow for building with xelatex.
-	if s.builder.name == "latex":
-		compile_type = getattr(tg, "type", "pdflatex")
-		tg.bld(features="tex", type=compile_type, source=tgt_nodes, name="sphinx_pdf", prompt=0)
-
-	# Bypass the execution of process_source by setting the source to an empty list
-	tg.source = []
diff --git a/waf-tools/tinyxml.py b/waf-tools/tinyxml.py
deleted file mode 100644
index 3908b38..0000000
--- a/waf-tools/tinyxml.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /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
deleted file mode 100644
index ef26082..0000000
--- a/wscript
+++ /dev/null
@@ -1,169 +0,0 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-VERSION='0.6.0'
-
-from waflib import Build, Logs, Utils, Task, TaskGen, Configure
-
-def options(opt):
-    opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
-    opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
-    opt.add_option('--log4cxx', action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx logging support''')
-
-    opt.load('compiler_c compiler_cxx boost ccnx doxygen gnu_dirs c_osx')
-    opt.load('tinyxml', tooldir=['waf-tools'])
-
-def configure(conf):
-    conf.load("compiler_c compiler_cxx boost ccnx gnu_dirs tinyxml doxygen c_osx")
-
-    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'])
-
-    # if Utils.unversioned_sys_platform () == "darwin":
-    #     conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=True, compile_filename='test.mm')
-    #     # conf.check_cxx(framework_name='AppKit',     uselib_store='OSX_APPKIT',     mandatory=True, compile_filename='test.mm')
-    #     conf.check_cxx(framework_name='Security',   uselib_store='OSX_SECURITY',   define_name='HAVE_SECURITY',
-    #                    use="OSX_FOUNDATION", mandatory=True, compile_filename='test.mm')
-
-    conf.define ("NDN_CXX_VERSION", VERSION)
-
-    conf.check_cfg(package='libevent', args=['--cflags', '--libs'], uselib_store='LIBEVENT', mandatory=True)
-    conf.check_cfg(package='libevent_pthreads', args=['--cflags', '--libs'], uselib_store='LIBEVENT_PTHREADS', mandatory=True)
-
-    if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
-        libcrypto = conf.check_cc(lib='crypto',
-                                  header_name='openssl/crypto.h',
-                                  define_name='HAVE_SSL',
-                                  uselib_store='SSL')
-    else:
-        conf.define ("HAVE_SSL", 1)
-    if not conf.get_define ("HAVE_SSL"):
-        conf.fatal ("Cannot find SSL libraries")
-
-    conf.check_cfg(package="libcrypto",  args=['--cflags', '--libs'], uselib_store='CRYPTO', mandatory=True)
-
-    if conf.options.log4cxx:
-        conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
-        conf.define ("HAVE_LOG4CXX", 1)
-
-    conf.check_tinyxml(path=conf.options.tinyxml_dir)
-    conf.check_doxygen(mandatory=False)
-
-    conf.check_boost(lib='system test iostreams filesystem thread date_time')
-
-    boost_version = conf.env.BOOST_VERSION.split('_')
-    if int(boost_version[0]) < 1 or int(boost_version[1]) < 46:
-        Logs.error ("Minumum required boost version is 1.46")
-        return
-
-    conf.check_ccnx (path=conf.options.ccnx_dir)
-
-    if conf.options._test:
-        conf.define ('_TESTS', 1)
-        conf.env.TEST = 1
-
-    conf.write_config_header('config.h')
-
-def build (bld):
-    executor = bld.objects (
-        target = "executor",
-        features = ["cxx"],
-        cxxflags = "-fPIC",
-        source = bld.path.ant_glob(['executor/**/*.cc']),
-        use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX',
-        includes = ".",
-        )
-
-    scheduler = bld.objects (
-        target = "scheduler",
-        features = ["cxx"],
-        cxxflags = "-fPIC",
-        source = bld.path.ant_glob(['scheduler/**/*.cc']),
-        use = 'BOOST BOOST_THREAD LIBEVENT LIBEVENT_PTHREADS LOG4CXX executor',
-        includes = ".",
-        )
-
-    libndn_cxx = bld (
-        target="ndn.cxx",
-        features=['cxx', 'cxxshlib'],
-        source = bld.path.ant_glob(['ndn.cxx/**/*.cpp', 'ndn.cxx/**/*.cc',
-                                    'logging.cc',
-                                    'libndn.cxx.pc.in']),
-        use = 'CRYPTO TINYXML BOOST BOOST_THREAD SSL CCNX LOG4CXX scheduler executor',
-        includes = ".",
-        )
-
-    # if Utils.unversioned_sys_platform () == "darwin":
-    #     libndn_cxx.mac_app = True
-    #     libndn_cxx.source += bld.path.ant_glob (['platforms/osx/**/*.mm'])
-    #     libndn_cxx.use += " OSX_FOUNDATION OSX_SECURITY"
-
-    # Unit tests
-    if bld.env['TEST']:
-      unittests = bld.program (
-          target="unit-tests",
-          features = "cxx cxxprogram",
-          defines = "WAF",
-          source = bld.path.ant_glob(['test/*.cc']),
-          use = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATE_TIME LOG4CXX ndn.cxx',
-          includes = ".",
-          install_prefix = None,
-          )
-
-    headers = bld.path.ant_glob(['ndn.cxx.h', 'ndn.cxx/**/*.h'])
-    bld.install_files("%s" % bld.env['INCLUDEDIR'], headers, relative_trick=True)
-
-@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
-
-
-# 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')
-
-# doxygen docs
-from waflib.Build import BuildContext
-class sphinx (BuildContext):
-    cmd = "sphinx"
-    fun = "sphinx"
-
-def sphinx (bld):
-    bld.load('sphinx_build', tooldir=['waf-tools'])
-
-    bld (features="sphinx",
-         outdir = "doc/html",
-         source = "doc/source/conf.py")
-
-
-@TaskGen.extension('.mm')
-def mm_hook(self, node):
-    """Alias .mm files to be compiled the same as .cc files, gcc will do the right thing."""
-    return self.create_compiled_task('cxx', node)