AC_CHECK_FUNCS(getopt getopt_long getopt_long_only)
AC_CHECK_FUNCS(fls flsl flsll ffs ffsl ffsll)
### Functions provided only on win32
-AC_CHECK_FUNCS(localtime_r recvmsg sendmsg usleep)
+AC_CHECK_FUNCS(localtime_r gettimeofday recvmsg sendmsg usleep getrusage)
### Functions used by libusual itself
-AC_CHECK_FUNCS(syslog mmap recvmsg sendmsg getpeerucred)
+AC_CHECK_FUNCS(syslog mmap getpeerucred)
### win32: link with ws2_32
AC_SEARCH_LIBS(WSAGetLastError, ws2_32)
AC_FUNC_STRERROR_R
dst->tv_usec = (tmp.QuadPart % FT_SEC) / 10;
}
+#ifndef HAVE_GETTIMEOFDAY
+
int gettimeofday(struct timeval * tp, void * tzp)
{
FILETIME file_time;
return 0;
}
+#endif /* !HAVE_GETTIMEOFDAY */
+
+#ifndef HAVE_LOCALTIME_R
+
struct tm *localtime_r(const time_t *tp, struct tm *dst)
{
ULARGE_INTEGER utc;
return dst;
}
+#endif /* !HAVE_LOCALTIME_R */
+
+#ifndef HAVE_GETRUSAGE
+
int getrusage(int who, struct rusage *dst)
{
FILETIME tcreate, texit, tkern, tuser;
return 0;
}
-#endif
+#endif /* !HAVE_GETRUSAGE */
+
+#endif /* WIN32 */
void reset_time_cache(void);
#ifdef WIN32
+
+
+#ifndef HAVE_GETTIMEOFDAY
+#define gettimeofday(t,z) usual_gettimeofday(t,z)
+
/** Compat: gettimeofday() */
int gettimeofday(struct timeval * tp, void * tzp);
+
+#endif
+
+
+#ifndef HAVE_LOCALTIME_R
+#define localtime_r(t,b) usual_localtime_r(t,b)
+
/** Compat: localtime_r() */
struct tm *localtime_r(const time_t *tp, struct tm *buf);
+#endif
+
#ifndef HAVE_USLEEP
+#define usleep(x) usual_usleep(x)
+
/** Compat: usleep() */
static inline void usleep(long usec) { Sleep(usec / 1000); }
+
#endif
+#ifndef HAVE_GETRUSAGE
+#define getrusage(w,d) usual_getrusage(w,d)
+
+#define RUSAGE_SELF 0
+
/** Compat: rusage for win32 */
struct rusage {
struct timeval ru_utime;
struct timeval ru_stime;
};
-#define RUSAGE_SELF 0
/** Compat: getrusage() for win32 */
int getrusage(int who, struct rusage *dst);
#endif
#endif
+
+#endif