config: Put HAVE_STDINT in common.h and use to define uint8_t.
diff --git a/config.h.in b/config.h.in
index b24da11..ec9b6bc 100644
--- a/config.h.in
+++ b/config.h.in
@@ -30,6 +30,9 @@
/* 1 if have memset in memory.h. */
#undef HAVE_MEMSET
+/* 1 if have stdint.h. */
+#undef HAVE_STDINT
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/configure b/configure
index b34a2c8..341eb59 100755
--- a/configure
+++ b/configure
@@ -15809,6 +15809,44 @@
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdint" >&5
+$as_echo_n "checking for stdint... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdint.h>
+ void test() { uint8_t x; }
+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_STDINT 1
+_ACEOF
+
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STDINT 0
+_ACEOF
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
diff --git a/configure.ac b/configure.ac
index 036b00f..28ea80f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,18 @@
AC_DEFINE_UNQUOTED([HAVE_MEMSET], 0, [1 if have memset in memory.h.])
])
+AC_MSG_CHECKING([for stdint])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[#include <stdint.h>]]
+ [[void test() { uint8_t x; }]])
+], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED([HAVE_STDINT], 1, [1 if have stdint.h.])
+], [
+ AC_MSG_RESULT([no])
+ AC_DEFINE_UNQUOTED([HAVE_STDINT], 0, [1 if have stdint.h.])
+])
+
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index 4e451a9..8a23ad0 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -49,6 +49,15 @@
namespace ndn { namespace func_lib = ndnboost; }
#endif
+// Need to define uint8_t. There may be no stdint.h since since it is only part of the C standard since 1999.
+#if HAVE_STDINT
+#include <stdint.h>
+#else
+#endif
+#ifndef _UINT8_T
+#define _UINT8_T
+typedef unsigned char uint8_t;
+#endif
namespace ndn {
/**