aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-05-29 06:56:07 +0000
committerGuy Harris <guy@alum.mit.edu>2007-05-29 06:56:07 +0000
commitd2ac4f7133b977b267c0b121aa2bdcb9507e0422 (patch)
tree7e4f2588b513edda09dc228f9704dc099692792d /acinclude.m4
parent2a5ff70caab499848de0c327052d564a831ba559 (diff)
Check for G_GINT64_MODIFIER in Wireshark as we do in Wiretap.
In all the places where a cast to "long long" or "unsigned long long" was done, use G_GINT64_MODIFIER and get rid of the cast, as 1) there's no guarantee that "%ll" works and 2) there's no guarantee that "long long" works (the latter definitely does *NOT* work with MSVC++; the former doesn't work with regular printf in MSVC++, but it might work with the GLib printf-based functions). svn path=/trunk/; revision=21978
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m438
1 files changed, 38 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 338df76287..9647b6a751 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1568,6 +1568,44 @@ AC_DEFUN([AC_WIRESHARK_KRB5_CHECK],
AC_SUBST(KRB5_LIBS)
])
+dnl
+dnl Check whether a given format can be used to print 64-bit integers
+dnl
+AC_DEFUN([AC_WIRESHARK_CHECK_64BIT_FORMAT],
+[
+ AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
+ AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+ #include <glib.h>
+ #if GTK_MAJOR_VERSION >= 2
+ #include <glib/gprintf.h>
+ #endif
+ #include <stdio.h>
+
+ main()
+ {
+ guint64 t = 1;
+ char strbuf[16+1];
+ g_snprintf(strbuf, sizeof strbuf, "%016$1x", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+ ]])
+ ],
+ [
+ AC_DEFINE(G_GINT64_MODIFIER, "$1", [Format modifier for printing 64-bit numbers])
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ $2
+ ])
+])
+
#
# AC_WIRESHARK_GCC_CFLAGS_CHECK
#