gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 3/3] Fixes build for OSX 10.4.


From: Fred Wright
Subject: [gpsd-dev] [PATCH 3/3] Fixes build for OSX 10.4.
Date: Tue, 9 Feb 2016 17:17:06 -0800

This is a modified version of address@hidden's patch,
originally applied to 3.14 and brought forward to 3.15/3.16.  The
original patch attempted to handle earlier OSX versions as well, but
that was obviously untested, since the 10.3 version of the define is
actually _TIMESPEC_DECLARED, not _TIMESPEC_DEFINED (though MacPorts
doesn't support anything older than 10.4, anyway).  It turns out that
building for 10.3 is broken for other reasons, but this patch should
at least fix this particular problem for 10.3 (and earlier?) as well
as 10.4.

Aside from expanding the #ifndef, this adds a #define _STRUCT_TIMESPEC
inside the conditional, for consistency with other such usage, even
though it's unlikely that these particular headers will be included
multiple times.

TESTED:
Verified that building for OSX 10.4 fails without this patch, and
succeeds with it.  Also tested builds for 10.5 and 10.9 (both x86 and
PPC in the former case), as well as Linux and xxxBSD builds.  Ran
regression tests in all cases except the failing 10.4 case.
---
 SConstruct | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/SConstruct b/SConstruct
index aa880e1..36b847b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -759,13 +759,20 @@ extern "C" {
 typedef int clockid_t;
 #define CLOCKID_T_DEFINED
 # endif
-/* OS X uses _STRUCT_TIMESPEC, but no clock_gettime */
-#ifndef _STRUCT_TIMESPEC
+/*
+ * OS X 10.5 and later use _STRUCT_TIMESPEC (like other OSes)
+ * 10.4 uses _TIMESPEC
+ * 10.3 and earlier use _TIMESPEC_DECLARED
+ */
+#if !defined(_STRUCT_TIMESPEC) \
+    && !defined(_TIMESPEC) && !defined(_TIMESPEC_DECLARED)
+#define _STRUCT_TIMESPEC
 struct timespec {
     time_t  tv_sec;
     long    tv_nsec;
 };
 #endif
+/* OS X does not have clock_gettime */
 #define CLOCK_REALTIME 0
 int clock_gettime(clockid_t, struct timespec *);
 # ifdef __cplusplus
-- 
2.7.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]