make: In ndn-cpp-config.h, to avoid polluting the global name space, generate NDN_CPP_HAVE_BOOST_FUNCTION etc. instead of HAVE_BOOST_FUNCTION, etc.
diff --git a/.gitignore b/.gitignore
index 4adb8c3..7e87d32 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,9 @@
 /autom4te.cache
 /config.log
 /config.status
+/config.h
+/_configs.sed
+/stamp-h1
 /ndn-cpp/ndn-cpp-config.h
 /ndn-cpp/stamp-h1
 /aclocal.m4
diff --git a/Makefile.in b/Makefile.in
index 74f31d9..6a27ded 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -99,7 +99,7 @@
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/ndn-cpp/ndn-cpp-config.h
+CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -227,7 +227,7 @@
 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 am__v_at_0 = @
 am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/ndn-cpp
+DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
@@ -594,7 +594,8 @@
 bin_test_publish_async_SOURCES = tests/test-publish-async.cpp
 bin_test_publish_async_LDADD = libndn-cpp.la
 dist_noinst_SCRIPTS = autogen.sh
-all: all-am
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .cpp .lo .o .obj
@@ -634,20 +635,20 @@
 	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 $(am__aclocal_m4_deps):
 
-ndn-cpp/ndn-cpp-config.h: ndn-cpp/stamp-h1
-	@test -f $@ || rm -f ndn-cpp/stamp-h1
-	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) ndn-cpp/stamp-h1
+config.h: stamp-h1
+	@test -f $@ || rm -f stamp-h1
+	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
 
-ndn-cpp/stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
-	@rm -f ndn-cpp/stamp-h1
-	cd $(top_builddir) && $(SHELL) ./config.status ndn-cpp/ndn-cpp-config.h
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
 $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
 	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
-	rm -f ndn-cpp/stamp-h1
+	rm -f stamp-h1
 	touch $@
 
 distclean-hdr:
-	-rm -f ndn-cpp/ndn-cpp-config.h ndn-cpp/stamp-h1
+	-rm -f config.h stamp-h1
 
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
@@ -1343,7 +1344,7 @@
 	       exit 1; } >&2
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) config.h
 install-binPROGRAMS: install-libLTLIBRARIES
 
 installdirs:
@@ -1481,7 +1482,7 @@
 
 uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 
-.MAKE: install-am install-strip
+.MAKE: all install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
 	clean-binPROGRAMS clean-cscope clean-generic \
diff --git a/configure b/configure
index 40854b0..93c8e72 100755
--- a/configure
+++ b/configure
@@ -3230,7 +3230,12 @@
 fi
 
 
-ac_config_headers="$ac_config_headers ndn-cpp/ndn-cpp-config.h:config.h.in"
+# Create config.h without prefixes.
+ac_config_headers="$ac_config_headers config.h"
+
+# Add prefixes and output to a unique file name.
+
+ac_config_commands="$ac_config_commands ndn-cpp/ndn-cpp-config.h"
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -19320,6 +19325,7 @@
 #
 # INIT-COMMANDS
 #
+PACKAGE="$PACKAGE"
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
 
@@ -19705,7 +19711,8 @@
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "ndn-cpp/ndn-cpp-config.h") CONFIG_HEADERS="$CONFIG_HEADERS ndn-cpp/ndn-cpp-config.h:config.h.in" ;;
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "ndn-cpp/ndn-cpp-config.h") CONFIG_COMMANDS="$CONFIG_COMMANDS ndn-cpp/ndn-cpp-config.h" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
@@ -20304,6 +20311,96 @@
 
 
   case $ac_file$ac_mode in
+    "ndn-cpp/ndn-cpp-config.h":C) ac_prefix_conf_OUT=`echo ndn-cpp/ndn-cpp-config.h`
+ac_prefix_conf_DEF=`echo _$ac_prefix_conf_OUT | sed -e "y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:" -e "s/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g"`
+ac_prefix_conf_PKG=`echo $PACKAGE`
+ac_prefix_conf_LOW=`echo _$ac_prefix_conf_PKG | sed -e "y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:"`
+ac_prefix_conf_UPP=`echo $ac_prefix_conf_PKG | sed -e "y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:"  -e "/^[0123456789]/s/^/_/"`
+ac_prefix_conf_INP=`echo "" | sed -e 's/ *//'`
+if test ".$ac_prefix_conf_INP" = "."; then
+   for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
+     case "$ac_file" in
+        *.h) ac_prefix_conf_INP=$ac_file ;;
+        *)
+     esac
+     test ".$ac_prefix_conf_INP" != "." && break
+   done
+fi
+if test ".$ac_prefix_conf_INP" = "."; then
+   case "$ac_prefix_conf_OUT" in
+      */*) ac_prefix_conf_INP=`basename "$ac_prefix_conf_OUT"`
+      ;;
+      *-*) ac_prefix_conf_INP=`echo "$ac_prefix_conf_OUT" | sed -e "s/[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*-//"`
+      ;;
+      *) ac_prefix_conf_INP=config.h
+      ;;
+   esac
+fi
+if test -z "$ac_prefix_conf_PKG" ; then
+   as_fn_error $? "no prefix for _PREFIX_PKG_CONFIG_H" "$LINENO" 5
+else
+  if test ! -f "$ac_prefix_conf_INP" ; then if test -f "$srcdir/$ac_prefix_conf_INP" ; then
+     ac_prefix_conf_INP="$srcdir/$ac_prefix_conf_INP"
+  fi fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&5
+$as_echo "$as_me: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&6;}
+  if test -f $ac_prefix_conf_INP ; then
+    $as_echo "s/^#undef  *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix
+    $as_echo "s/^#undef  *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix
+    $as_echo "s/^#define  *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1\\" >> conftest.prefix
+    $as_echo "#define $ac_prefix_conf_UPP""_\\1\\2\\" >> conftest.prefix
+    $as_echo "#endif/" >> conftest.prefix
+    $as_echo "s/^#define  *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1\\" >> conftest.prefix
+    $as_echo "#define $ac_prefix_conf_LOW""_\\1\\2\\" >> conftest.prefix
+    $as_echo "#endif/" >> conftest.prefix
+    # now executing _script on _DEF input to create _OUT output file
+    echo "#ifndef $ac_prefix_conf_DEF"      >$tmp/pconfig.h
+    echo "#define $ac_prefix_conf_DEF 1" >>$tmp/pconfig.h
+    echo ' ' >>$tmp/pconfig.h
+    echo /'*' $ac_prefix_conf_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
+
+    sed -f conftest.prefix $ac_prefix_conf_INP >>$tmp/pconfig.h
+    echo ' ' >>$tmp/pconfig.h
+    echo '/* once:' $ac_prefix_conf_DEF '*/' >>$tmp/pconfig.h
+    echo "#endif" >>$tmp/pconfig.h
+    if cmp -s $ac_prefix_conf_OUT $tmp/pconfig.h 2>/dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_prefix_conf_OUT is unchanged" >&5
+$as_echo "$as_me: $ac_prefix_conf_OUT is unchanged" >&6;}
+    else
+      ac_dir=`$as_dirname -- "$ac_prefix_conf_OUT" ||
+$as_expr X"$ac_prefix_conf_OUT" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(//\)[^/]' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(//\)$' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_prefix_conf_OUT" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      as_dir="$ac_dir"; as_fn_mkdir_p
+      rm -f "$ac_prefix_conf_OUT"
+      mv $tmp/pconfig.h "$ac_prefix_conf_OUT"
+    fi
+    cp conftest.prefix _configs.sed
+  else
+    as_fn_error $? "input file $ac_prefix_conf_INP does not exist - skip generating $ac_prefix_conf_OUT" "$LINENO" 5
+  fi
+  rm -f conftest.*
+fi
+ ;;
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
diff --git a/configure.ac b/configure.ac
index 9b3002a..c422503 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,24 @@
+# To build using autotools on OS X:
+# $ sudo port install autoconf
+# $ sudo port install automake
+# $ sudo port install doxygen
+# Enter the following to show directory for m4 macros, and download the the following into there (use sudo):
+# $ aclocal --print
+# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_cxx_compile_stdcxx_11.m4
+# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_prog_doxygen.m4
+# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_openssl.m4
+# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_lib_sqlite3.m4
+# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_prefix_config_h.m4
+
 AC_PREREQ([2.59])
 AC_INIT([ndn-cpp], [0.2], [ndn-lib@lists.cs.ucla.edu], [ndn-cpp], [https://github.com/named-data/ndn-cpp])
 AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
 
 AC_CONFIG_SRCDIR([config.h.in])
-AC_CONFIG_HEADERS([ndn-cpp/ndn-cpp-config.h:config.h.in])
+# Create config.h without prefixes.
+AC_CONFIG_HEADERS(config.h)
+# Add prefixes and output to a unique file name.
+AX_PREFIX_CONFIG_H(ndn-cpp/ndn-cpp-config.h)
 AM_MAINTAINER_MODE
 AM_PROG_AR
 AC_PROG_LIBTOOL
diff --git a/libtool b/libtool
index 634e480..458a106 100755
--- a/libtool
+++ b/libtool
@@ -2,7 +2,7 @@
 
 # libtool - Provide generalized library-building support services.
 # Generated automatically by config.status (ndn-cpp) 0.2
-# Libtool was configured on host Jeffs-MacBook-Pro.local:
+# Libtool was configured on host lance.tft.ucla.edu:
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
@@ -66,13 +66,13 @@
 
 # The host system.
 host_alias=
-host=x86_64-apple-darwin12.4.0
-host_os=darwin12.4.0
+host=x86_64-apple-darwin12.5.0
+host_os=darwin12.5.0
 
 # The build system.
 build_alias=
-build=x86_64-apple-darwin12.4.0
-build_os=darwin12.4.0
+build=x86_64-apple-darwin12.5.0
+build_os=darwin12.5.0
 
 # A sed program that does not truncate output.
 SED="/usr/bin/sed"
diff --git a/ndn-cpp/c/util/ndn_memory.c b/ndn-cpp/c/util/ndn_memory.c
index ba3fc2e..8051864 100644
--- a/ndn-cpp/c/util/ndn_memory.c
+++ b/ndn-cpp/c/util/ndn_memory.c
@@ -6,7 +6,7 @@
 
 #include "ndn_memory.h"
 
-#if !HAVE_MEMCMP
+#if !NDN_CPP_HAVE_MEMCMP
 int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, size_t len)
 {
   size_t i;
@@ -24,7 +24,7 @@
 int ndn_memcmp_stub_to_avoid_empty_file_warning = 0;
 #endif
 
-#if !HAVE_MEMCPY
+#if !NDN_CPP_HAVE_MEMCPY
 void ndn_memcpy(uint8_t *dest, uint8_t *src, size_t len)
 {
   size_t i;
@@ -36,7 +36,7 @@
 int ndn_memcpy_stub_to_avoid_empty_file_warning = 0;
 #endif
 
-#if !HAVE_MEMSET
+#if !NDN_CPP_HAVE_MEMSET
 void ndn_memset(uint8_t *dest, int val, size_t len)
 {
   size_t i;
diff --git a/ndn-cpp/c/util/ndn_memory.h b/ndn-cpp/c/util/ndn_memory.h
index abf3bcf..9d23e2d 100644
--- a/ndn-cpp/c/util/ndn_memory.h
+++ b/ndn-cpp/c/util/ndn_memory.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Based on HAVE_MEMCPY and HAVE_MEMSET in ndn-cpp-config.h, use the library version or a local implementation of memcmp, memcpy and memset.
+ * Based on NDN_CPP_HAVE_MEMCPY and NDN_CPP_HAVE_MEMSET in ndn-cpp-config.h, use the library version or a local implementation of memcmp, memcpy and memset.
  */
 
 #ifndef NDN_MEMORY_H
@@ -17,7 +17,7 @@
 extern "C" {
 #endif
 
-#if HAVE_MEMCMP
+#if NDN_CPP_HAVE_MEMCMP
 #include <memory.h>
 /**
  * Use the library version of memcmp.
@@ -30,7 +30,7 @@
 int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, size_t len);
 #endif
 
-#if HAVE_MEMCPY
+#if NDN_CPP_HAVE_MEMCPY
 #include <memory.h>
 /**
  * Use the library version of memcpy.
@@ -43,7 +43,7 @@
 void ndn_memcpy(uint8_t *dest, uint8_t *src, size_t len);
 #endif
 
-#if HAVE_MEMSET
+#if NDN_CPP_HAVE_MEMSET
 #include <memory.h>
 /**
  * Use the library version of memset.
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index 74f0214..80d1874 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -13,10 +13,10 @@
 
 // Depending on where ./configure found shared_ptr, define the ptr_lib namespace.
 // We always use ndn::ptr_lib.
-#if HAVE_STD_SHARED_PTR
+#if NDN_CPP_HAVE_STD_SHARED_PTR
 #include <memory>
 namespace ndn { namespace ptr_lib = std; }
-#elif HAVE_BOOST_SHARED_PTR
+#elif NDN_CPP_HAVE_BOOST_SHARED_PTR
 #include <boost/shared_ptr.hpp>
 #include <boost/make_shared.hpp>
 namespace ndn { namespace ptr_lib = boost; }
@@ -36,10 +36,10 @@
 
 // Depending on where ./configure found function, define the func_lib namespace.
 // We always use ndn::func_lib.
-#if HAVE_STD_FUNCTION
+#if NDN_CPP_HAVE_STD_FUNCTION
 #include <functional>
 namespace ndn { namespace func_lib = std; }
-#elif HAVE_BOOST_FUNCTION
+#elif NDN_CPP_HAVE_BOOST_FUNCTION
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
 namespace ndn { namespace func_lib = boost; }
diff --git a/ndn-cpp/security/identity/basic-identity-storage.cpp b/ndn-cpp/security/identity/basic-identity-storage.cpp
index 135bbe8..5215e5f 100644
--- a/ndn-cpp/security/identity/basic-identity-storage.cpp
+++ b/ndn-cpp/security/identity/basic-identity-storage.cpp
@@ -5,10 +5,10 @@
  * See COPYING for copyright and distribution information.
  */
 
-// Only compile if ndn-cpp-config.h defines HAVE_SQLITE3.
-#include "../../c/common.h"
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_SQLITE3.
+#include "../../ndn-cpp-config.h"
 #if 0 // temporarily disable.
-//#ifdef HAVE_SQLITE3
+//#ifdef NDN_CPP_HAVE_SQLITE3
 
 #include <stdlib.h>
 #include <sstream>
@@ -674,4 +674,4 @@
         
 }
 
-#endif // HAVE_SQLITE3
+#endif // NDN_CPP_HAVE_SQLITE3
diff --git a/ndn-cpp/security/identity/basic-identity-storage.hpp b/ndn-cpp/security/identity/basic-identity-storage.hpp
index 7e8862b..5c61112 100644
--- a/ndn-cpp/security/identity/basic-identity-storage.hpp
+++ b/ndn-cpp/security/identity/basic-identity-storage.hpp
@@ -8,10 +8,10 @@
 #ifndef NDN_BASIC_IDENTITY_STORAGE_H
 #define NDN_BASIC_IDENTITY_STORAGE_H
 
-// Only compile if ndn-cpp-config.h defines HAVE_SQLITE3.
-#include "../../c/common.h"
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_SQLITE3.
+#include "../../ndn-cpp-config.h"
 #if 0 // temporarily disable.
-//#ifdef HAVE_SQLITE3
+//#ifdef NDN_CPP_HAVE_SQLITE3
 
 #include <sqlite3.h>
 #include "../../common.hpp"
@@ -207,6 +207,6 @@
 
 }
 
-#endif // HAVE_SQLITE3
+#endif // NDN_CPP_HAVE_SQLITE3
 
 #endif
diff --git a/ndn-cpp/security/identity/osx-private-key-storage.cpp b/ndn-cpp/security/identity/osx-private-key-storage.cpp
index 3efc99b..d1ea2c5 100644
--- a/ndn-cpp/security/identity/osx-private-key-storage.cpp
+++ b/ndn-cpp/security/identity/osx-private-key-storage.cpp
@@ -5,11 +5,10 @@
  * See COPYING for copyright and distribution information.
  */
 
-// Only compile if ndn-cpp-config.h defines HAVE_OSX_SECKEYCHAIN 1.
-#include "../../c/common.h"
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECKEYCHAIN 1.
+#include "../../ndn-cpp-config.h"
 #if 0 // temporarily disable.
-//#if HAVE_OSX_SECKEYCHAIN
-
+//#if NDN_CPP_HAVE_OSX_SECKEYCHAIN
 
 #include <fstream>
 #include <sstream>
@@ -514,4 +513,4 @@
   
 }
 
-#endif HAVE_OSX_SECKEYCHAIN
+#endif NDN_CPP_HAVE_OSX_SECKEYCHAIN
diff --git a/ndn-cpp/security/identity/osx-private-key-storage.hpp b/ndn-cpp/security/identity/osx-private-key-storage.hpp
index edb15db..514d660 100644
--- a/ndn-cpp/security/identity/osx-private-key-storage.hpp
+++ b/ndn-cpp/security/identity/osx-private-key-storage.hpp
@@ -8,10 +8,10 @@
 #ifndef NDN_OSX_PRIVATEKEY_STORAGE_H
 #define NDN_OSX_PRIVATEKEY_STORAGE_H
 
-// Only compile if ndn-cpp-config.h defines HAVE_OSX_SECKEYCHAIN 1.
-#include "../../c/common.h"
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECKEYCHAIN 1.
+#include "../../ndn-cpp-config.h"
 #if 0 // temporarily disable.
-//#if HAVE_OSX_SECKEYCHAIN
+//#if NDN_CPP_HAVE_OSX_SECKEYCHAIN
 
 #include "../../common.hpp"
 #include "private-key-storage.hpp"
@@ -201,6 +201,6 @@
   
 }
 
-#endif HAVE_OSX_SECKEYCHAIN
+#endif NDN_CPP_HAVE_OSX_SECKEYCHAIN
 
 #endif
diff --git a/ndn-cpp/util/logging.cpp b/ndn-cpp/util/logging.cpp
index 1ea8667..7147768 100644
--- a/ndn-cpp/util/logging.cpp
+++ b/ndn-cpp/util/logging.cpp
@@ -8,7 +8,7 @@
 
 #include "logging.hpp"
 
-#ifdef HAVE_LOG4CXX
+#ifdef NDN_CPP_HAVE_LOG4CXX
 
 #include <log4cxx/logger.h>
 #include <log4cxx/basicconfigurator.h>
diff --git a/ndn-cpp/util/logging.hpp b/ndn-cpp/util/logging.hpp
index e6a402f..87d9ad5 100644
--- a/ndn-cpp/util/logging.hpp
+++ b/ndn-cpp/util/logging.hpp
@@ -11,7 +11,7 @@
 
 #include "../common.hpp"
 
-#ifdef HAVE_LOG4CXX
+#ifdef NDN_CPP_HAVE_LOG4CXX
 
 #include <log4cxx/logger.h>
 
@@ -48,7 +48,7 @@
 void
 INIT_LOGGERS ();
 
-#else // else HAVE_LOG4CXX
+#else // else NDN_CPP_HAVE_LOG4CXX
 
 #define INIT_LOGGER(name)
 #define _LOG_FUNCTION(x)
@@ -74,6 +74,6 @@
 #define _LOG_DEBUG(x)
 #endif
 
-#endif // HAVE_LOG4CXX
+#endif // NDN_CPP_HAVE_LOG4CXX
 
 #endif
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 189397f..f5e46f6 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -20,7 +20,7 @@
 using namespace ndn;
 using namespace ptr_lib;
 using namespace func_lib;
-#if HAVE_STD_FUNCTION
+#if NDN_CPP_HAVE_STD_FUNCTION
 // In the std library, the placeholders are in a different namespace than boost.                                                           
 using namespace func_lib::placeholders;
 #endif
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index 931b1af..536e164 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -13,7 +13,7 @@
 using namespace ndn;
 using namespace ptr_lib;
 using namespace func_lib;
-#if HAVE_STD_FUNCTION
+#if NDN_CPP_HAVE_STD_FUNCTION
 // In the std library, the placeholders are in a different namespace than boost.
 using namespace func_lib::placeholders;
 #endif