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

2011-07-24 Thread Voelker, Bernhard
Paul Eggert wrote:

> On 07/24/11 22:59, Voelker, Bernhard wrote:
>
>>>  #ifndef _ALL_SOURCE
>>>  # undef _ALL_SOURCE
>>>  #endif
>>> +/* Enable general extensions on MacOS X.  */
>>> +#ifndef _DARWIN_C_SOURCE
>>> +# undef _DARWIN_C_SOURCE
>>> +#endif
>> 
>> maybe it's too early in the morning for me ... but isn't this a NOP:
>> "if X is not defined, then undefine it"?
>
> Later shell magic edits the file to define it.
> In that sense, it's just like _ALL_SOURCE,
> which already works.

Thanks for the clarification. I knew I should get a cup of coffee
before hitting the 'send' button. ;-)

Have a nice day,
Berny





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

2011-07-24 Thread Paul Eggert
On 07/24/11 22:59, Voelker, Bernhard wrote:

>>  #ifndef _ALL_SOURCE
>>  # undef _ALL_SOURCE
>>  #endif
>> +/* Enable general extensions on MacOS X.  */
>> +#ifndef _DARWIN_C_SOURCE
>> +# undef _DARWIN_C_SOURCE
>> +#endif
> 
> maybe it's too early in the morning for me ... but isn't this a NOP:
> "if X is not defined, then undefine it"?

Later shell magic edits the file to define it.
In that sense, it's just like _ALL_SOURCE,
which already works.





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

2011-07-24 Thread Voelker, Bernhard
Paul Eggert wrote:

> 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

maybe it's too early in the morning for me ... but isn't this a NOP:
"if X is not defined, then undefine it"?

Berny









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

2011-07-23 Thread Paul Eggert
On 07/22/11 17:23, Bruno Haible wrote:
> The usual idiom in the MacOS X header files is
> 
>   #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
> 
> So, I expect that your change will be a no-op for almost everyone.

Thanks for the clarification.

I looked through what I could glean from Google searches, and
found some places that do not use the above pattern.  For example,

says something like this:

int  pselect(int, fd_set * __restrict, fd_set * __restrict,
fd_set * __restrict, const struct timespec * __restrict,
const sigset_t * __restrict)
#if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT)
__DARWIN_EXTSN_C(pselect)
#else
#  if defined(__LP64__) && !__DARWIN_NON_CANCELABLE
__DARWIN_1050(pselect)
#  else
__DARWIN_ALIAS_C(pselect)
#  endif
#endif
;

and 
says something like this:

#if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) 
|| defined(_DARWIN_BETTER_REALPATH)
char*realpath(const char * __restrict, char * __restrict) 
__DARWIN_EXTSN(realpath);
#else
char*realpath(const char * __restrict, char * __restrict) 
__DARWIN_ALIAS(realpath);
#endif

which suggests that realpath and pselect have "extended" runtime behavior if
_DARWIN_C_SOURCE is defined.

My guess is that these runtime differences are in the same spirit
as _GNU_SOURCE, i.e., they enable desirable changes that POSIX
would otherwise prohibit.  If so, the patch should be kept.
But if these changes are undesirable, the patch should be backed out.





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

2011-07-22 Thread Bruno Haible
Paul Eggert wrote:
> 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.

It's not "roughly the same". _GNU_SOURCE makes some symbols visible that are
not visible by default. Whereas _DARWIN_C_SOURCE makes some symbols visible
that are already visible by default but hidden when _POSIX_C_SOURCE is defined.

The usual idiom in the MacOS X header files is

  #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)

So, I expect that your change will be a no-op for almost everyone.

Bruno
-- 
In memoriam Dmitry Pavlov 





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

2011-07-22 Thread Paul Eggert
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  
+
+   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  
 
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