aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-06-19 00:07:23 +0000
committerGuy Harris <guy@alum.mit.edu>2004-06-19 00:07:23 +0000
commit7002776572e651843e3e7f7e429ccf13fea1ece5 (patch)
tree593809b9d0b8c5957cfc6c99ddb8538b37f2f05c /acinclude.m4
parent641a9fbf4787de71d4f9eb2d59b864920ae29bb3 (diff)
Pick up the stuff I did for tcpdump to figure out the right strings to
use to format 64-bit integers. Fix the RSVP dissector to use that rather than hardcoding "%ll" in. Remove the "only if G_HAVE_GINT64 is defined" bit from the discussion of 64-bit integers - we're too dependent on having them to support compilers that don't have a 64-bit integral data type. Do, however, note that neither "long" nor "long long" are acceptable, and also note that you shouldn't assume "%ll" does the trick for printing them. svn path=/trunk/; revision=11182
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m444
1 files changed, 43 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 5f474d3da3..26f7ba58e2 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2,7 +2,7 @@ dnl Macros that test for specific features.
dnl This file is part of the Autoconf packaging for Ethereal.
dnl Copyright (C) 1998-2000 by Gerald Combs.
dnl
-dnl $Id: acinclude.m4,v 1.76 2004/05/18 11:11:37 jmayer Exp $
+dnl $Id: acinclude.m4,v 1.77 2004/06/19 00:07:22 guy Exp $
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -92,6 +92,48 @@ if test $ac_cv_ethereal_struct_sa_len = yes; then
fi
])
+
+dnl
+dnl Check whether a given format can be used to print 64-bit integers
+dnl
+AC_DEFUN(AC_ETHEREAL_CHECK_64BIT_FORMAT,
+[
+ AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
+ AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+# 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, "%016$1x", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+ ]])
+ ],
+ [
+ AC_DEFINE(PRId64, "$1d", [Format for printing 64-bit signed decimal numbers])
+ AC_DEFINE(PRIo64, "$1o", [Format for printing 64-bit unsigned octal numbers])
+ AC_DEFINE(PRIx64, "$1x", [Format for printing 64-bit unsigned hexadecimal numbers])
+ AC_DEFINE(PRIu64, "$1u", [Format for printing 64-bit unsigned decimal numbers])
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ $2
+ ])
+])
+
#
# AC_ETHEREAL_IPV6_STACK
#