Subject: [PATCH 1/3] extensions: Enable extensions on MacOS X 10.5 and later.

From: Paul Eggert <[email-masked]>
Date: Fri, 22 Jul 2011 10:18:12 -0700

Recent versions of MacOS seem to have a _DARWIN_C_SOURCE flag that
has roughly the same role that _GNU_SOURCE has for GNU systems.
I pushed the following patch into gnulib, under the theory that it is
more in the line with the usual Autoconf / gnulib philosophy,
and it may fix some porting issues.

Herb, can you please try configuring coreutils with this change?
If you don't have all the autotools installed, you can simply append
"#define _DARWIN_C_SOURCE 1" to lib/config.h after running "configure".
Thanks.

* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define _DARWIN_C_SOURCE.
---
 ChangeLog        |    5 +++++
 m4/extensions.m4 |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b22ea11..46d8d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-22  Paul Eggert  <[email-masked]>
+
+	extensions: Enable extensions on MacOS X 10.5 and later.
+	* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define _DARWIN_C_SOURCE.
+
 2011-07-22  Kamil Dudka  <[email-masked]>
 
 	file-has-acl: use acl_extended_file_nofollow if available
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 1330503..22156e0 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 9  -*- Autoconf -*-
+# serial 10  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
@@ -67,6 +67,10 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
+/* Enable general extensions on MacOS X.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
@@ -95,6 +99,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
   test $ac_cv_safe_to_define___extensions__ = yes &&
     AC_DEFINE([__EXTENSIONS__])
   AC_DEFINE([_ALL_SOURCE])
+  AC_DEFINE([_DARWIN_C_SOURCE])
   AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])
-- 
1.7.4.4