Added ndn_memcmp
diff --git a/config.h.in b/config.h.in
index 53e0af8..ca29f91 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,6 +6,9 @@
 /* define if the compiler supports basic C++11 syntax */
 #undef HAVE_CXX11
 
+/* 1 if have memcmp in memory.h. */
+#undef HAVE_MEMCMP
+
 /* 1 if have memcpy in memory.h. */
 #undef HAVE_MEMCPY
 
diff --git a/configure b/configure
index ffc4625..6e29ea7 100755
--- a/configure
+++ b/configure
@@ -4463,6 +4463,43 @@
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for memcmp" >&5
+$as_echo_n "checking for memcmp... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <memory.h>
+    void test() { unsigned char buffer[1]; memcmp(buffer, buffer, 1); }
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMCMP 1
+_ACEOF
+
+
+else
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMCMP 0
+_ACEOF
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memcpy" >&5
 $as_echo_n "checking for memcpy... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/configure.ac b/configure.ac
index 6863859..7021343 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,17 @@
     AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 0, [1 if have the `boost::shared_ptr' class.])
 ])
 
+AC_MSG_CHECKING([for memcmp])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+    [[#include <memory.h>]]
+    [[void test() { unsigned char buffer[1]; memcmp(buffer, buffer, 1); }]])
+], [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED([HAVE_MEMCMP], 1, [1 if have memcmp in memory.h.])
+], [
+    AC_MSG_RESULT([no])
+    AC_DEFINE_UNQUOTED([HAVE_MEMCMP], 0, [1 if have memcmp in memory.h.])
+])
 AC_MSG_CHECKING([for memcpy])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
     [[#include <memory.h>]]
diff --git a/ndn-cpp/c/util/ndn_memory.c b/ndn-cpp/c/util/ndn_memory.c
index d0e8bf4..12ee131 100644
--- a/ndn-cpp/c/util/ndn_memory.c
+++ b/ndn-cpp/c/util/ndn_memory.c
@@ -5,6 +5,24 @@
 
 #include "ndn_memory.h"
 
+#if !HAVE_MEMCMP
+int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len)
+{
+  unsigned int i;
+  
+  for (i = 0; i < len; i++) {
+    if (buf1[i] > buf2[i])
+      return 1;
+    else if (buf1[i] < buf2[i])
+      return -1;
+  }
+  
+  return 0;
+}
+#else
+int ndn_memcmp_stub_to_avoid_empty_file_warning = 0;
+#endif
+
 #if !HAVE_MEMCPY
 void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len)
 {
@@ -27,4 +45,4 @@
 }
 #else
 int ndn_memset_stub_to_avoid_empty_file_warning = 0;
-#endif
\ No newline at end of file
+#endif
diff --git a/ndn-cpp/c/util/ndn_memory.h b/ndn-cpp/c/util/ndn_memory.h
index 378b6b7..a35ef89 100644
--- a/ndn-cpp/c/util/ndn_memory.h
+++ b/ndn-cpp/c/util/ndn_memory.h
@@ -16,6 +16,19 @@
 extern "C" {
 #endif
 
+#if HAVE_MEMCMP
+#include <memory.h>
+/**
+ * Use the library version of memcmp.
+ */
+static inline int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len) { memcpy(buf1, buf2, len); }
+#else
+/**
+ * Use a local implementation of memcmp instead of the library version.
+ */
+int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len);
+#endif
+
 #if HAVE_MEMCPY
 #include <memory.h>
 /**