diff options
author | Fred Wright <fw@fwright.net> | 2016-02-09 17:17:06 -0800 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-02-09 21:53:23 -0500 |
commit | 9b1053c3eb1968542e87cf7f5619e91df5320fa1 (patch) | |
tree | 1e2524f84d608b5c56c21da996842bb64c11e96d | |
parent | 389ad5707da955706f171ae1940ac48d08fc6fe3 (diff) | |
download | gpsd-9b1053c3eb1968542e87cf7f5619e91df5320fa1.tar.gz |
Fixes build for OSX 10.4.
This is a modified version of ryandesign@macports.org'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.
-rw-r--r-- | SConstruct | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -762,13 +762,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 |