]> git.sur5r.net Git - openldap/commitdiff
Teached autoconf to figure out how may arguments ctime_r expects.
authorBart Hartgers <bart@openldap.org>
Sat, 2 Jan 1999 00:56:45 +0000 (00:56 +0000)
committerBart Hartgers <bart@openldap.org>
Sat, 2 Jan 1999 00:56:45 +0000 (00:56 +0000)
Updated util-int.c to use this information.

aclocal.m4
configure.in
include/portable.h.in
libraries/libldap/util-int.c

index 73203f14384a2cbe80b2502af53dd71da8fa04a3..bdb05477eeb50664baa0c0f3e1e69c8c4907890b 100644 (file)
@@ -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
+])
+
+                                          
+                 
index 349b82b08a08d322ef2ace2fab9292f8d9d5d675..955271f7becd80f0b162ade0761e86f40f4c2a97 100644 (file)
@@ -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
index 93e1f80819b90e06e416b0d88e107540a7c28e5b..a4a67bd71a1911d3c389b970734cd45646a2e9e9 100644 (file)
 /* 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
 
index 375747bfe07d3ba432888bef71cf7f7ff235aeb0..3ace0c799b5bc6956339193bae48d4ccc3192f07 100644 (file)
@@ -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