From de6dec5feafd066c4a90262a77987a435cbc2175 Mon Sep 17 00:00:00 2001
From: Sven Weidauer <sven.weidauer@gmail.com>
Date: Thu, 6 Jan 2011 15:01:25 +0100
Subject: [PATCH 3/4] Compile/link fixes for OS X standard library functions

---
 utils/config.h |    4 ++--
 utils/log.c    |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/utils/config.h b/utils/config.h
index 4445f8c..058662a 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -24,7 +24,7 @@
 
 /* Try to detect which features the target OS supports */
 
-#if (defined(_GNU_SOURCE))
+#if (defined(_GNU_SOURCE) && !defined(__APPLE__))
 #define HAVE_STRNDUP
 #else
 #undef HAVE_STRNDUP
@@ -40,7 +40,7 @@ char *strcasestr(const char *haystack, const char *needle);
 
 /* For some reason, UnixLib defines this unconditionally. 
  * Assume we're using UnixLib if building for RISC OS. */
-#if (defined(_GNU_SOURCE) || defined(riscos))
+#if ((defined(_GNU_SOURCE) && !defined(__APPLE__)) || defined(riscos))
 #define HAVE_STRCHRNUL
 #else
 #undef HAVE_STRCHRNUL
diff --git a/utils/log.c b/utils/log.c
index 0e3d69e..ba9b65a 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -21,6 +21,9 @@
  */
 
 #include <stdio.h>
+#if defined(__APPLE__)
+#define _DARWIN_C_SOURCE
+#endif
 #include <sys/time.h>
 #include "desktop/netsurf.h"
 
-- 
1.7.1.1

