1From c82fe8888aacfe784476112edd3878256d2e30bc Mon Sep 17 00:00:00 2001
2From: Joshua Boyd <jdboyd@Joshua-Boyds-Mac-mini.local>
3Date: Wed, 23 Mar 2016 17:54:41 -0400
4Subject: [PATCH] Detect missing itimerspec on OSX.
5
6Set define to compiler accordingly.
7
8This fixes cmake on osx support.
9---
10 CMakeLists.txt | 8 ++++++++
11 1 file changed, 8 insertions(+)
12
13diff --git a/CMakeLists.txt b/CMakeLists.txt
14index e271e31..1d413e8 100644
15--- a/CMakeLists.txt
16+++ b/CMakeLists.txt
17@@ -193,6 +193,14 @@ if(NOT HAVE_SYS_TIME_H)
18     endif(MSVC)
19 endif(NOT HAVE_SYS_TIME_H)
20
21+# OSX has sys/time.h, but it still lacks itimerspec
22+if(HAVE_SYS_TIME_H)
23+    check_struct_member("struct itimerspec" it_value "sys/time.h" HAVE_STRUCT_ITIMERSPEC_IT_VALUE)
24+    if(NOT HAVE_STRUCT_ITIMERSPEC_IT_VALUE)
25+        add_definitions(-DSTRUCT_ITIMERSPEC_DEFINITION_MISSING=1)
26+        set(STRUCT_ITIMERSPEC_DEFINITION_MISSING 1)
27+    endif(NOT HAVE_STRUCT_ITIMERSPEC_IT_VALUE)
28+endif(HAVE_SYS_TIME_H)
29
30 ###############################################################################
31 # Check for integer types
32