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
+])
+
+
+
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
/* 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
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