Set CMake cache var PIGLIT_HAS_POSIX_CLOCKS if if clock_gettime() is
available.

Tests that need to measure time, such as GL_ARB_sync tests, will use
Posix clocks.

CC: Nicholas Mack <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
---
 CMakeLists.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ec5ddf..ac66152 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.6)
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
 
 INCLUDE (CheckCCompilerFlag)
+INCLUDE (CheckCSourceCompiles)
 INCLUDE (CheckCXXCompilerFlag)
 INCLUDE (CheckFunctionExists)
 INCLUDE (CheckIncludeFile)
@@ -266,6 +267,16 @@ else (APPLE)
        )
 endif (APPLE)
 
+check_c_source_compiles(
+       "
+       #define POSIX_C_SOURCE >= 199309L
+       #include <time.h>
+       int main() { return clock_gettime(CLOCK_MONOTONIC, NULL); }
+       "
+
+       PIGLIT_HAS_POSIX_CLOCKS
+)
+
 FIND_LIBRARY(OPENGL_egl_LIBRARY
       NAMES EGL
       PATHS /usr/lib
-- 
1.8.3.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to