From bd59061232490384ec7bd02982d3bfa2b8042fab Mon Sep 17 00:00:00 2001 From: djm Date: Sat, 23 Sep 2000 03:12:24 +0000 Subject: [PATCH] - (djm) Seperate tests for int64_t and u_int64_t types --- ChangeLog | 1 + acconfig.h | 2 ++ configure.in | 26 ++++++++++++++++++++++++++ defines.h | 41 +++++++++++++++++++++++------------------ loginrec.c | 1 - 5 files changed, 52 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef8407e1..9adb880d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - (djm) Fix address logging in utmp from Kevin Steves - (djm) Redhat spec and manpage fixes from Pekka Savola + - (djm) Seperate tests for int64_t and u_int64_t types 20000920 - (djm) Fix bad path substitution. Report from Andrew Miner diff --git a/acconfig.h b/acconfig.h index e129ef33..1b860d66 100644 --- a/acconfig.h +++ b/acconfig.h @@ -207,6 +207,8 @@ #undef HAVE_INTXX_T #undef HAVE_U_INTXX_T #undef HAVE_UINTXX_T +#undef HAVE_INT64_T +#undef HAVE_U_INT64_T #undef HAVE_SOCKLEN_T #undef HAVE_SIZE_T #undef HAVE_SSIZE_T diff --git a/configure.in b/configure.in index 774529d3..305d9a49 100644 --- a/configure.in +++ b/configure.in @@ -487,6 +487,19 @@ if test "x$ac_cv_have_intxx_t" = "xyes" ; then have_intxx_t=1 fi +AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ + AC_TRY_COMPILE( + [ #include ], + [ int64_t a; a = 1;], + [ ac_cv_have_int64_t="yes" ], + [ ac_cv_have_int64_t="no" ] + ) +]) +if test "x$ac_cv_have_int64_t" = "xyes" ; then + AC_DEFINE(HAVE_INT64_T) + have_int64_t=1 +fi + AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ AC_TRY_COMPILE( [ #include ], @@ -500,6 +513,19 @@ if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then have_u_intxx_t=1 fi +AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ + AC_TRY_COMPILE( + [ #include ], + [ u_int64_t a; a = 1;], + [ ac_cv_have_u_int64_t="yes" ], + [ ac_cv_have_u_int64_t="no" ] + ) +]) +if test "x$ac_cv_have_u_int64_t" = "xyes" ; then + AC_DEFINE(HAVE_U_INT64_T) + have_u_int64_t=1 +fi + if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ test "x$ac_cv_header_sys_bitypes_h" = "xyes") then diff --git a/defines.h b/defines.h index 0ac3e96b..cf2a3429 100644 --- a/defines.h +++ b/defines.h @@ -123,16 +123,6 @@ typedef int int32_t; # else # error "32 bit int type not found." # endif -# if (SIZEOF_LONG_INT == 8) -typedef long int int64_t; -# else -# if (SIZEOF_LONG_LONG_INT == 8) -typedef long long int int64_t; -# define HAVE_INTXX_T 1 -# else -# error "64 bit int type not found." -# endif -# endif #endif /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ @@ -141,7 +131,6 @@ typedef long long int int64_t; typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; # define HAVE_U_INTXX_T 1 # else # if (SIZEOF_CHAR == 1) @@ -159,15 +148,31 @@ typedef unsigned int u_int32_t; # else # error "32 bit int type not found." # endif -# if (SIZEOF_LONG_INT == 8) -typedef unsigned long int u_int64_t; +# endif +#endif + +/* 64-bit types */ +#ifndef HAVE_INT64_T +# if (SIZEOF_LONG_INT == 8) +typedef long int int64_t; +# else +# if (SIZEOF_LONG_LONG_INT == 8) +typedef long long int int64_t; +# define HAVE_INTXX_T 1 # else -# if (SIZEOF_LONG_LONG_INT == 8) +# error "64 bit int type not found." +# endif +# endif +#endif +#ifndef HAVE_U_INT64_T +# if (SIZEOF_LONG_INT == 8) +typedef unsigned long int u_int64_t; +# else +# if (SIZEOF_LONG_LONG_INT == 8) typedef unsigned long long int u_int64_t; -# define HAVE_U_INTXX_T 1 -# else -# error "64 bit int type not found." -# endif +# define HAVE_U_INTXX_T 1 +# else +# error "64 bit int type not found." # endif # endif #endif diff --git a/loginrec.c b/loginrec.c index 4f9f30ad..6fca9f82 100644 --- a/loginrec.c +++ b/loginrec.c @@ -681,7 +681,6 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx) /* this is just a 32-bit IP address */ if (li->hostaddr.sa.sa_family == AF_INET) utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; - # endif # endif # ifdef HAVE_SYSLEN_IN_UTMPX /* ut_syslen is the length of the utx_host string */ -- 2.45.2