build: Making build system consistent with other NDN projects and adding unit-test framework

This commit aims only at correcting building system and adding unit-test framework.
Existing test cases (ChronoSync) are disabled temporarily and will be fixed later.
Minimum changes are made, so that the code can be built successfully.
Compiling warnings will be resolved in a later commit.

Refs: #1495

Change-Id: Ibf7119bbd77b6307cb58bbee47b61d7a7312df98
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..6556816
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,75 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014  University of Memphis,
+ *                     Regents of the University of California
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "nlsr.hpp"
+#include "nlsr_conf_processor.hpp"
+
+using namespace nlsr;
+
+int
+main(int argc, char **argv)
+{
+  src::logger lg;
+  nlsr::Nlsr nlsr_;
+  string programName(argv[0]);
+  nlsr_.setConfFileName("nlsr.conf");
+  int opt;
+  while ((opt = getopt(argc, argv, "df:p:h")) != -1)
+  {
+    switch (opt)
+      {
+      case 'f':
+        nlsr_.setConfFileName(optarg);
+        break;
+      case 'd':
+        nlsr_.setIsDaemonProcess(optarg);
+        break;
+      case 'p':
+        {
+          stringstream sst(optarg);
+          int ap;
+          sst>>ap;
+          nlsr_.setApiPort(ap);
+        }
+        break;
+      case 'h':
+      default:
+        nlsr_.usage(programName);
+        return EXIT_FAILURE;
+      }
+  }
+  ConfFileProcessor cfp(nlsr_.getConfFileName());
+  int res=cfp.processConfFile(nlsr_);
+  if ( res < 0 )
+  {
+    std::cerr<<"Error in configuration file processing! Exiting from NLSR"<<std::endl;
+    return EXIT_FAILURE;
+  }
+  nlsr_.initialize();
+  try
+  {
+    nlsr_.startEventLoop();
+  }
+  catch(std::exception &e)
+  {
+    std::cerr << "ERROR: " << e.what() << std::endl;
+  }
+  return EXIT_SUCCESS;
+}
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 13e7906..726c53a 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -94,56 +94,3 @@
 
 
 } // namespace nlsr
-
-using namespace nlsr;
-
-int
-main(int argc, char **argv)
-{
-  src::logger lg;
-  nlsr::Nlsr nlsr_;
-  string programName(argv[0]);
-  nlsr_.setConfFileName("nlsr.conf");
-  int opt;
-  while ((opt = getopt(argc, argv, "df:p:h")) != -1)
-  {
-    switch (opt)
-      {
-      case 'f':
-        nlsr_.setConfFileName(optarg);
-        break;
-      case 'd':
-        nlsr_.setIsDaemonProcess(optarg);
-        break;
-      case 'p':
-        {
-          stringstream sst(optarg);
-          int ap;
-          sst>>ap;
-          nlsr_.setApiPort(ap);
-        }
-        break;
-      case 'h':
-      default:
-        nlsr_.usage(programName);
-        return EXIT_FAILURE;
-      }
-  }
-  ConfFileProcessor cfp(nlsr_.getConfFileName());
-  int res=cfp.processConfFile(nlsr_);
-  if ( res < 0 )
-  {
-    std::cerr<<"Error in configuration file processing! Exiting from NLSR"<<std::endl;
-    return EXIT_FAILURE;
-  }
-  nlsr_.initialize();
-  try
-  {
-    nlsr_.startEventLoop();
-  }
-  catch(std::exception &e)
-  {
-    std::cerr << "ERROR: " << e.what() << std::endl;
-  }
-  return EXIT_SUCCESS;
-}
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 0c406ac..40a7de0 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -26,12 +26,18 @@
   using namespace ndn;
   using namespace std;
 
+  inline static void
+  NullDeleter(boost::asio::io_service* variable)
+  {
+    // do nothing
+  }
+
   class Nlsr
   {
   public:
     Nlsr()
-      : m_io(ndn::make_shared<boost::asio::io_service>())
-      , m_nlsrFace(make_shared<ndn::Face>(m_io))
+      : m_io(new boost::asio::io_service)
+      , m_nlsrFace(new Face(shared_ptr<boost::asio::io_service>(&*m_io, &NullDeleter)))
       , m_scheduler(*m_io)
       , m_confParam()
       , m_adl()
diff --git a/src/utility/boost-log.hpp b/src/utility/boost-log.hpp
new file mode 100644
index 0000000..53743ae
--- /dev/null
+++ b/src/utility/boost-log.hpp
@@ -0,0 +1,23 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014 University of Memphis,
+ *                    Regents of the University of California
+ *
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NLSR_UTIL_BOOST_LOG_HPP
+#define NLSR_UTIL_BOOST_LOG_HPP
+
+// suppress boost::log warnings
+#pragma GCC system_header
+#pragma clang system_header
+
+#include <boost/log/common.hpp>
+#include <boost/log/expressions.hpp>
+#include <boost/log/attributes.hpp>
+#include <boost/log/sources/logger.hpp>
+#include <boost/log/sinks/sync_frontend.hpp>
+#include <boost/log/sinks/text_file_backend.hpp>
+
+#endif // NLSR_UTIL_BOOST_LOG_HPP
diff --git a/src/utility/nlsr_logger.hpp b/src/utility/nlsr_logger.hpp
index 129fe30..ca6be3e 100644
--- a/src/utility/nlsr_logger.hpp
+++ b/src/utility/nlsr_logger.hpp
@@ -2,6 +2,7 @@
 #define NLSR_LOGGER_HPP
 
 #define BOOST_LOG_DYN_LINK 1
+#include "boost-log.hpp"
 
 #include <stdexcept>
 #include <string>
@@ -15,12 +16,9 @@
 #include <boost/smart_ptr/shared_ptr.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/date_time/local_time/local_time.hpp>
-#include <boost/log/common.hpp>
-#include <boost/log/expressions.hpp>
-#include <boost/log/attributes.hpp>
-#include <boost/log/sources/logger.hpp>
-#include <boost/log/sinks/sync_frontend.hpp>
-#include <boost/log/sinks/text_file_backend.hpp>
+
+
+
 
 namespace nlsr
 {