Use the GLib gint64 and guint64 types instead of u_int64_t or uint64_t,

as those are what's used in Ethereal for 64-bit integers, and as there's
no guarantee that either of them will be defined on any particular
platform.

svn path=/trunk/; revision=11513
This commit is contained in:
Guy Harris 2004-07-25 08:36:34 +00:00
parent a6b4a098ff
commit 809bd53e81
2 changed files with 60 additions and 65 deletions

View File

@ -106,12 +106,13 @@ AC_DEFUN([AC_ETHEREAL_CHECK_64BIT_FORMAT],
# ifdef HAVE_INTTYPES_H
#include <inttypes.h>
# endif
#include <glib.h>
#include <stdio.h>
#include <sys/types.h>
main()
{
u_int64_t t = 1;
guint64 t = 1;
char strbuf[16+1];
sprintf(strbuf, "%016$1x", t << 32);
if (strcmp(strbuf, "0000000100000000") == 0)

View File

@ -289,70 +289,6 @@ if test "$HAVE_GNU_SED" = no ; then
esac
fi
#
# We can't just check for <inttypes.h> - some systems have one that
# doesn't define all the PRI[doxu]64 macros.
#
AC_CHECK_TYPE(
uint64_t,
ac_ethereal_uint64_t_type=uint64_t,
ac_ethereal_uint64_t_type=u_int_64_t
)
AC_CHECK_HEADERS(inttypes.h,
[
#
# OK, we have inttypes.h, but does it define those macros?
#
AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE(
[[
#include <inttypes.h>
#include <stdio.h>
#include <sys/types.h>
main()
{
printf("%" PRId64 "\n", ($ac_ethereal_uint64_t_type)1);
printf("%" PRIo64 "\n", ($ac_ethereal_uint64_t_type)1);
printf("%" PRIx64 "\n", ($ac_ethereal_uint64_t_type)1);
printf("%" PRIu64 "\n", ($ac_ethereal_uint64_t_type)1);
}
]])
],
[
AC_MSG_RESULT(yes)
ac_ethereal_inttypes_h_defines_formats=yes
],
[
AC_MSG_RESULT(no)
ac_ethereal_inttypes_h_defines_formats=no
])
],
[
#
# We don't have inttypes.h, so it obviously can't define those
# macros.
#
ac_ethereal_inttypes_h_defines_formats=no
])
if test "$ac_ethereal_inttypes_h_defines_formats" = yes; then
AC_DEFINE(INTTYPES_H_DEFINES_FORMATS,,[Define if <inttypes.h> defines PRI[doxu]64 macros])
else
AC_ETHEREAL_CHECK_64BIT_FORMAT(ll,
[
AC_ETHEREAL_CHECK_64BIT_FORMAT(L,
[
AC_ETHEREAL_CHECK_64BIT_FORMAT(q,
[
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
])
])
])
fi
# Enable/disable tethereal
AC_ARG_ENABLE(ethereal,
@ -473,6 +409,64 @@ else
have_plugins=no
fi
#
# We can't just check for <inttypes.h> - some systems have one that
# doesn't define all the PRI[doxu]64 macros.
#
AC_CHECK_HEADERS(inttypes.h,
[
#
# OK, we have inttypes.h, but does it define those macros?
#
AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE(
[[
#include <inttypes.h>
#include <glib.h>
#include <stdio.h>
#include <sys/types.h>
main()
{
printf("%" PRId64 "\n", (gint64)1);
printf("%" PRIo64 "\n", (guint64)1);
printf("%" PRIx64 "\n", (guint64)1);
printf("%" PRIu64 "\n", (guint64)1);
}
]])
],
[
AC_MSG_RESULT(yes)
ac_ethereal_inttypes_h_defines_formats=yes
],
[
AC_MSG_RESULT(no)
ac_ethereal_inttypes_h_defines_formats=no
])
],
[
#
# We don't have inttypes.h, so it obviously can't define those
# macros.
#
ac_ethereal_inttypes_h_defines_formats=no
])
if test "$ac_ethereal_inttypes_h_defines_formats" = yes; then
AC_DEFINE(INTTYPES_H_DEFINES_FORMATS,,[Define if <inttypes.h> defines PRI[doxu]64 macros])
else
AC_ETHEREAL_CHECK_64BIT_FORMAT(ll,
[
AC_ETHEREAL_CHECK_64BIT_FORMAT(L,
[
AC_ETHEREAL_CHECK_64BIT_FORMAT(q,
[
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
])
])
])
fi
AC_SUBST(ethereal_bin)
AC_SUBST(ethereal_man)