* add configure detection for solaris localtime_r, it needs to know the size of the...
authorWilfried Göesgens <willi@citadel.org>
Mon, 1 Mar 2010 20:50:38 +0000 (20:50 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 1 Mar 2010 20:50:38 +0000 (20:50 +0000)
webcit/configure.ac
webcit/http_datestring.c

index 53a13c0d01bf2b160c14dff774e6385204974aed..5fe05bc1fd5e5dd2a6931a7769245ca044135280 100644 (file)
@@ -88,6 +88,33 @@ dnl Checks for header files.
 AC_HEADER_STDC
 dnl AC_HEADER_SYS_WAIT
 
+AC_CACHE_CHECK(
+       [for call semantics from getpwuid_r], 
+       ac_cv_call_getpwuid_r,
+       [AC_TRY_COMPILE([#include <sys/types.h>
+#include <pwd.h>], 
+                         [
+                               struct passwd pw, *pwp;
+                               char pwbuf[64];
+                               uid_t uid;
+
+                               getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+                       ],
+                       ac_cv_call_getpwuid_r=yes, 
+                       ac_cv_call_getpwuid_r=no)
+       ])
+
+if test $ac_cv_call_getpwuid_r = no; then
+       AC_DEFINE(SOLARIS_GETPWUID,[],[do we need to use solaris call syntax?])
+       AC_DEFINE(SOLARIS_LOCALTIME_R,[], [do we need to use soralis call syntax?])
+       AC_DEFINE(F_UID_T, "%ld", [whats the matching format string for uid_t?])
+       AC_DEFINE(F_PID_T, "%ld",  [whats the matching format string for pid_t?])
+       AC_DEFINE(F_XPID_T, "%lx",  [whats the matching format string for xpid_t?])
+else
+       AC_DEFINE(F_UID_T, "%d",  [whats the matching format string for uid_t?])
+       AC_DEFINE(F_PID_T, "%d",  [whats the matching format string for pid_t?])
+       AC_DEFINE(F_XPID_T, "%x",  [whats the matching format string for xpid_t?])
+fi
 
 
 
index 2e2bef8dafbde31c11dee9811a0a652acdb97cd9..50cfae68f8d5abfbdbbd94f1d9611bc3806cac96 100644 (file)
@@ -71,7 +71,11 @@ void tmplput_nowstr(StrBuf *Target, WCTemplputParams *TP)
        time_t now;
        
        now = time(NULL);
+#ifdef HAVE_SOLARIS_LOCALTIME_R
+       asctime_r(localtime(&now), buf, sizeof(buf));
+#else
        asctime_r(localtime(&now), buf);
+#endif
        bufused = strlen(buf);
        if ((bufused > 0) && (buf[bufused - 1] == '\n')) {
                buf[bufused - 1] = '\0';