waf: add clock_gettime clock ID checks to libreplace wscript.
authorGünther Deschner <gd@samba.org>
Mon, 7 Feb 2011 12:12:17 +0000 (13:12 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 7 Feb 2011 12:21:50 +0000 (13:21 +0100)
Guenther

lib/replace/wscript

index 9fbd3b5ffca50c5e2d5ef3e69ae695e7a0e045be..b9921c9b9ccab4deae5eef343fc208d94fc9f426 100644 (file)
@@ -202,7 +202,23 @@ def configure(conf):
         # some systems are missing the declaration
         conf.CHECK_DECLS('fdatasync')
 
-    conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True)
+    if conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True):
+        for c in ['CLOCK_MONOTONIC', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME']:
+            conf.CHECK_CODE('''
+                           #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
+                           clockid_t clk = %s''' % c,
+                           'HAVE_%s' % c,
+                           msg='Checking whether the clock_gettime clock ID %s is available' % c)
+
 
     # these headers need to be tested as a group on freebsd
     conf.CHECK_HEADERS(headers='sys/socket.h net/if.h', together=True)