what is _XOPEN_SOURCE=500 needed for?

Daniel Stone daniel at fooishbar.org
Wed May 25 00:24:08 PDT 2005


On Wed, May 25, 2005 at 09:05:56AM +0200, Martin Waitz wrote:
> On Mon, May 23, 2005 at 11:21:25PM -0600, Matthieu Herrb wrote:
> > I'm trying to build the modular tree on OpenBSD. One problem I noticed 
> > is that -D_XOPEN_SOURCE=500 is now added unconditionnaly to all CFLAGS.
> > This breaks things on OpenBSD, so It should probably be defined only on 
> > systems that needs it.
> 
> I had a similar problem with another project.
> It needed pread/pwrite which are only defined with _XOPEN_SOURCE on
> glibc systems. And it broke on OpenBSD, too.
> 
> We fixed it with the following code in configure.ac:
> # _GNU_SOURCE is needed for glibcs pread/pwrite
> AH_VERBATIM([_GNU_SOURCE],
> ¯˙˙˙˙˙˙˙    [/* Enable GNU extensions on systems that have them.  */
> #ifndef _GNU_SOURCE
> # define _GNU_SOURCE
> #endif])
> 
> 
> glibc will automatically define _XOPEN_SOURCE=600 when _GNU_SOURCE
> is set. OpenBSD ignores _GNU_SOURCE and all is well.

I'm not so sure relying on this behaviour is such a great idea,
particularly when you throw in alternative libcs in an otherwise-GNU
userland.  It'd probably just be better to define this only for glibc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20050525/f7f9c9e5/attachment.pgp>


More information about the xorg mailing list