mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 02:29:34 -05:00
Teached autoconf to figure out how may arguments ctime_r expects.
Updated util-int.c to use this information.
This commit is contained in:
parent
4219a94c3f
commit
f9d26dacd4
4 changed files with 39 additions and 0 deletions
25
aclocal.m4
vendored
25
aclocal.m4
vendored
|
|
@ -506,3 +506,28 @@ AC_DEFUN(AM_TYPE_PTRDIFF_T,
|
|||
fi
|
||||
])
|
||||
|
||||
dnl check arguments for ctime_r - Bart Hartgers
|
||||
|
||||
# serial 1
|
||||
AC_DEFUN(OL_NARGS_CTIME_R,
|
||||
[AC_MSG_CHECKING([number of args for ctime_r])
|
||||
AC_TRY_COMPILE([#include <time.h>],
|
||||
[time_t ti; char *buffer;
|
||||
ctime_r(&ti,buffer,32);],ol_nargs_ctime_r=3,
|
||||
ol_nargs_ctime_r=0)
|
||||
if test $ol_nargs_ctime_r = 0 ; then
|
||||
AC_TRY_COMPILE([#include <time.h>],
|
||||
[time_t ti; char *buffer;
|
||||
ctime_r(&ti,buffer);],ol_nargs_ctime_r=2 )
|
||||
fi
|
||||
AC_MSG_RESULT($ol_nargs_ctime_r)
|
||||
if test $ol_nargs_ctime_r = 2 ; then
|
||||
AC_DEFINE( ARGS_CTIME_R_2 )
|
||||
fi
|
||||
if test $ol_nargs_ctime_r = 3 ; then
|
||||
AC_DEFINE( ARGS_CTIME_R_3 )
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1232,6 +1232,8 @@ if test $ac_cv_func_strtok_r = yes \
|
|||
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT, 1)
|
||||
fi
|
||||
|
||||
OL_NARGS_CTIME_R
|
||||
|
||||
if test $ol_link_threads != no ; then
|
||||
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE, 1)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -274,6 +274,12 @@
|
|||
/* Define if you have the ctime_r function. */
|
||||
#undef HAVE_CTIME_R
|
||||
|
||||
/* Define if ctime_r takes two arguments */
|
||||
#undef ARGS_CTIME_R_2
|
||||
|
||||
/* Define if ctime_r takes three arguments */
|
||||
#undef ARGS_CTIME_R_3
|
||||
|
||||
/* Define if you have the flock function. */
|
||||
#undef HAVE_FLOCK
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,13 @@ char *ldap_int_strtok( char *str, const char *delim, char **pos )
|
|||
char *ldap_int_ctime( const time_t *tp, char *buf )
|
||||
{
|
||||
#ifdef HAVE_CTIME_R
|
||||
# if defined( ARGS_CTIME_R_2 )
|
||||
return ctime_r(tp,buf);
|
||||
# elif defined( ARGS_CTIME_R_3 )
|
||||
return ctime_r(tp,buf,26);
|
||||
# else
|
||||
Do not know how many arguments ctime_r takes, so generating error
|
||||
# endif
|
||||
#else
|
||||
return ctime(tp);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue