Define _POSIX_SOURCE in cygwin's features.h?

Samuel Thibault samuel.thibault@ens-lyon.org
Thu Jan 12 18:10:00 GMT 2006


Hi,

Christopher Faylor, le Thu 12 Jan 2006 12:59:08 -0500, a écrit :
> >>Someone on the cygwin irc channel had a problem building a package
> >>which would have been solved if Cygwin defined _POSIX_SOURCE.

If the package doesn't define _POSIX_SOURCE itself then it needs be
fixed, not cygwin.

> _POSIX_SOURCE is defined in features.h on linux under control of the
> _GNU_SOURCE macro.

Indeed.

>   /* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
>   #ifdef _GNU_SOURCE
...
>   # define _POSIX_SOURCE  1
...
>   #endif
> 
> So, let me clarify.  Should we define _POSIX_SOURCE similarly to the way
> that linux does it?  This may mean that we have to define _GNU_SOURCE
> also and maybe that's not a good idea but, again, it might solve more
> problems than it causes.

No. It can create a lot of other problems.
Maybe cygwin could #define _POSIX_SOURCE to 1 if the user _already_
defined _GNU_SOURCE.
But a portable program should _not_ assume that #defining _GNU_SOURCE
implies that _POSIX_SOURCE. If a program not only needs posix stuff but
also some GNU extras, it should #define _GNU_SOURCE _and_ _POSIX_SOURCE
itself.

Regards,
Samuel

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list