summaryrefslogtreecommitdiff
path: root/netlib.c
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-01-21 13:35:39 -0500
committerEric S. Raymond <esr@thyrsus.com>2016-01-21 13:35:39 -0500
commitb436b11635c5f95f7ec5fef455ff197ae96106da (patch)
tree7ebd80196c04ac278515e66a090a1f6dc4235241 /netlib.c
parentd47101a2759b3af0ba2b56348d680d379b5e8362 (diff)
downloadgpsd-b436b11635c5f95f7ec5fef455ff197ae96106da.tar.gz
Fix build on OS/X < 10.6
OSX versions earlier than 10.6 fail to define IPV6_TCLASS, causing the compile of gpsd.c to fail. There is already a fallback definition for Gnu/Hurd. The attached patch: 1) Extends the existing Gnu/Hurd fallback definition to include a case for OSX. This is currently based on _APPLE_. Basing it on Darwin might be more appropriate, but that would need to be tested. 2) Duplicates this fallback setup in netlib.c, where it was missing. 3) Adds an ifdef to gpsd.c so that other cases that fail to define IPV6_TCLASS will simply omit the IPTOS_LOWDELAY setup, rather than failing to build. It's not entirely clear that sweeping the problem under the rug is preferable to getting an error and having the builder figure out what to do, but it is consistent with netlib.c, which includes a similar ifdef. The patch is originally from jeremyhu@macports.org, updated for 3.14 by ryandesign@macports.org, and then updated by me for 3.16.
Diffstat (limited to 'netlib.c')
-rw-r--r--netlib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/netlib.c b/netlib.c
index 2652835f..a0403cdd 100644
--- a/netlib.c
+++ b/netlib.c
@@ -21,6 +21,15 @@
#include "gpsd.h"
#include "sockaddr.h"
+/* work around the unfinished ipv6 implementation on hurd and OSX <10.6 */
+#ifndef IPV6_TCLASS
+# if defined(__GNU__)
+# define IPV6_TCLASS 61
+# elif defined(__APPLE__)
+# define IPV6_TCLASS 36
+# endif
+#endif
+
socket_t netlib_connectsock(int af, const char *host, const char *service,
const char *protocol)
{