From 39c4fe7e342e6da5599adcbe91d10d18afd3a863 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 4 Mar 2005 23:50:45 +0000 Subject: [PATCH] hpux10 has gmtime_r with wrong return type, breaking asn.1 encoder The hpux10 gmtime_r returns int (0 means success), whereas the POSIX gmtime_r returns a pointer (NULL means failure). * configure.in: Check return type of gmtime_r, and define GMTIME_R_RETURNS_INT if it returns int. If the return type can't be determined, pretend the function isn't there. ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17117 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 6 ++++++ src/include/configure.in | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index d4c0cded0..b1de45f49 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,9 @@ +2005-03-04 Ken Raeburn + + * configure.in: Check return type of gmtime_r, and define + GMTIME_R_RETURNS_INT if it returns int. If the return type can't + be determined, pretend the function isn't there. + 2005-02-08 Ken Raeburn * k5-platform.h (PROGRAM_EXITING) [__GNUC__ && !_WIN32 && diff --git a/src/include/configure.in b/src/include/configure.in index d3ded13b6..721865be2 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -98,6 +98,29 @@ if test "$ac_cv_func_getpwuid_r" = yes; then fi fi +if test "$ac_cv_func_gmtime_r" = yes; then + AC_MSG_CHECKING([whether gmtime_r returns int]) + AC_CACHE_VAL(krb5_cv_gmtime_r_returns_int, + [AC_TRY_COMPILE([#include + extern int gmtime_r ();], [1;], return_int=yes, return_int=no) + AC_TRY_COMPILE([#include + extern struct tm *gmtime_r ();], [1;], return_ptr=yes, return_ptr=no) + case $return_int/$return_ptr in + yes/no) krb5_cv_gmtime_r_returns_int=yes ;; + no/yes) krb5_cv_gmtime_r_returns_int=no ;; + *) # Can't figure it out, punt the function. + ac_cv_func_gmtime_r=no ;; + esac]) + if test "$ac_cv_func_gmtime_r" = no; then + AC_MSG_RESULT(unknown -- ignoring gmtime_r) + else + AC_MSG_RESULT($krb5_cv_gmtime_r_returns_int) + if test "$krb5_cv_gmtime_r_returns_int" = yes; then + AC_DEFINE(GMTIME_R_RETURNS_INT,1,[Define if gmtime_r returns int instead of struct tm pointer, as on old HP-UX systems.]) + fi + fi +fi + AC_CHECK_FUNC(getservbyname_r,[ ac_cv_func_getservbyname_r=yes if test "$ac_cv_func_getservbyname_r" = yes; then -- 2.26.2