|
@@ -91,11 +91,18 @@ else
|
|
|
compat_sources += 'compat/strndup.c'
|
|
|
endif
|
|
|
|
|
|
-#if cc.has_function('clock_gettime', prefix: '#include <time.h>', args: test_args)
|
|
|
-# conf_data.set('HAVE_CLOCK_GETTIME', 1)
|
|
|
-#else
|
|
|
-# compat_sources += 'compat/clock_gettime.c'
|
|
|
-#endif
|
|
|
+if cc.has_function('clock_gettime', prefix: '#include <time.h>',
|
|
|
+ dependencies: dep_thread)
|
|
|
+ conf_data.set('HAVE_CLOCK_GETTIME', 1)
|
|
|
+else
|
|
|
+ dep_rt = cc.find_library('rt', required: false)
|
|
|
+ if cc.has_function('clock_gettime', prefix: '#include <time.h>',
|
|
|
+ dependencies: [dep_rt, dep_thread])
|
|
|
+ conf_data.set('HAVE_CLOCK_GETTIME', 1)
|
|
|
+ else
|
|
|
+ compat_sources += 'compat/clock_gettime.c'
|
|
|
+ endif
|
|
|
+endif
|
|
|
|
|
|
if cc.has_function('pipe')
|
|
|
conf_data.set('HAVE_PIPE', 1)
|