summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-03-03 16:26:48 +0100
committerGünther Deschner <gd@samba.org>2011-03-04 00:28:27 +0100
commit9167d70e77c2f4c8e6de64fbf06bd3bee23542d2 (patch)
tree92ca807066b603888d4bf271b0452577dbc2d35b /lib
parenta5d54579ea949f4cd7c975c3f5d0006a90777735 (diff)
downloadsamba-9167d70e77c2f4c8e6de64fbf06bd3bee23542d2.tar.gz
samba-9167d70e77c2f4c8e6de64fbf06bd3bee23542d2.tar.bz2
samba-9167d70e77c2f4c8e6de64fbf06bd3bee23542d2.zip
libreplace: move "struct timespec" checks into libreplace (where timespec is already used).
Bjoern, Metze, please check. Guenther
Diffstat (limited to 'lib')
-rw-r--r--lib/replace/libreplace.m423
-rw-r--r--lib/replace/system/time.h7
-rw-r--r--lib/replace/wscript1
3 files changed, 31 insertions, 0 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 24fc5cdafe..808d5d1c06 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -303,6 +303,29 @@ if test x$libreplace_cv_have_clock_gettime = xyes ; then
SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
fi
+AC_CACHE_CHECK([for struct timespec type],libreplace_cv_struct_timespec, [
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+],[struct timespec ts;],
+ libreplace_cv_struct_timespec=yes,libreplace_cv_struct_timespec=no)])
+if test x"$libreplace_cv_struct_timespec" = x"yes"; then
+ AC_DEFINE(HAVE_STRUCT_TIMESPEC,1,[Whether we have struct timespec])
+fi
+
AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
echo "LIBREPLACE_BROKEN_CHECKS: END"
diff --git a/lib/replace/system/time.h b/lib/replace/system/time.h
index 5fce4dbc45..b6d2609289 100644
--- a/lib/replace/system/time.h
+++ b/lib/replace/system/time.h
@@ -46,6 +46,13 @@ struct utimbuf {
};
#endif
+#ifndef HAVE_STRUCT_TIMESPEC
+struct timespec {
+ time_t tv_sec; /* Seconds. */
+ long tv_nsec; /* Nanoseconds. */
+};
+#endif
+
#ifndef HAVE_MKTIME
/* define is in "replace.h" */
time_t rep_mktime(struct tm *t);
diff --git a/lib/replace/wscript b/lib/replace/wscript
index d0bbe96159..c24d6e76b3 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -219,6 +219,7 @@ def configure(conf):
'HAVE_%s' % c,
msg='Checking whether the clock_gettime clock ID %s is available' % c)
+ conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h')
# these headers need to be tested as a group on freebsd
conf.CHECK_HEADERS(headers='sys/socket.h net/if.h', together=True)