+#
+# We can't just check for <inttypes.h> - some systems have one that
+# doesn't define all the PRI[doxu]64 macros.
+#
+
+for ac_header in inttypes.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:8002: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 8008 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:8012: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:8018: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:8037: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+ #
+ # OK, we have inttypes.h, but does it define those macros?
+ #
+ echo "$as_me:8047: checking whether inttypes.h defines the PRI[doxu]64 macros" >&5
+echo $ECHO_N "checking whether inttypes.h defines the PRI[doxu]64 macros... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line 8051 "configure"
+#include "confdefs.h"
+
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ printf("%" PRId64 "\n", (u_int64_t)1);
+ printf("%" PRIo64 "\n", (u_int64_t)1);
+ printf("%" PRIx64 "\n", (u_int64_t)1);
+ printf("%" PRIu64 "\n", (u_int64_t)1);
+ }
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8068: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:8071: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:8074: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:8077: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:8080: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ ac_lbl_inttypes_h_defines_formats=yes
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ echo "$as_me:8088: result: no" >&5
+echo "${ECHO_T}no" >&6
+ ac_lbl_inttypes_h_defines_formats=no
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+else
+
+ #
+ # We don't have inttypes.h, so it obviously can't define those
+ # macros.
+ #
+ ac_lbl_inttypes_h_defines_formats=no
+
+fi
+done
+
+if test "$ac_lbl_inttypes_h_defines_formats" = yes; then
+ cat >>confdefs.h <<\EOF
+#define INTTYPES_H_DEFINES_FORMATS 1
+EOF
+
+else
+
+ echo "$as_me:8113: checking whether %llx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %llx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:8116: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line 8122 "configure"
+#include "confdefs.h"
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016llx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:8144: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:8147: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:8149: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:8152: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\EOF
+#define PRId64 "lld"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIo64 "llo"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIx64 "llx"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIu64 "llu"
+EOF
+
+ echo "$as_me:8171: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ echo "$as_me:8179: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+ echo "$as_me:8182: checking whether %Lx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %Lx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:8185: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line 8191 "configure"
+#include "confdefs.h"
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016Lx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:8213: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:8216: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:8218: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:8221: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\EOF
+#define PRId64 "Ld"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIo64 "Lo"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIx64 "Lx"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIu64 "Lu"
+EOF
+
+ echo "$as_me:8240: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ echo "$as_me:8248: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+ echo "$as_me:8251: checking whether %qx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %qx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:8254: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line 8260 "configure"
+#include "confdefs.h"
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016qx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:8282: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:8285: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:8287: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:8290: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\EOF
+#define PRId64 "qd"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIo64 "qo"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIx64 "qx"
+EOF
+
+ cat >>confdefs.h <<\EOF
+#define PRIu64 "qu"
+EOF
+
+ echo "$as_me:8309: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ echo "$as_me:8317: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+ { { echo "$as_me:8320: error: neither %llx nor %Lx nor %qx worked on a 64-bit integer" >&5
+echo "$as_me: error: neither %llx nor %Lx nor %qx worked on a 64-bit integer" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+