what is _XOPEN_SOURCE=500 needed for?
Soeren Sandmann
sandmann at redhat.com
Wed May 25 14:35:04 PDT 2005
Daniel Stone wrote:
>So, at a guess, we do something like this:
>x11proto.pc.in: Cflags: $(FDBITSFLAGS)
>
>
I basically agree that this is right.
The other possibility is to add a new installed header file, called
something like
Xproto-config.h, then conditionally include that in all public headers.
The advantage
of that would be fewer -D's on the compile lines. The big disadvantage
is that we would
add weird
#ifdef HAVE_XPROTO_CONFIG
#include <xproto-config.h>
#endif
lines in the public headers, and we would still require all users of
xproto to define HAVE_XPROTO_CONFIG. For this reason, adding -D's to the
command line (which
is automatable with pkg-config) is better.
> configure.ac:
> case "$platform" in
> *-gnu-*)
> FDBITSFLAGS="-D_XOPEN_SOURCE=500"
> ;;
> esac
> AC_SUBST([FDBITSFLAGS])
One of the advantages of auto* over imake is that it has the ability to
detect at compile-time
what flags are needed. If possible using that feature is better than
just magically
asserting that "_XOPEN_SOURCE is needed on Linux". So I prefer something
like
the following instead:
# Find out what defines are necessary to make struct fd_set contain
# fds_bits
#
fds_bits_found=false;
# No defines necessary?
if test x$fds_bits_found = xfalse ; then
AC_CHECK_MEMBER(fd_set.fds_bits,
[
fds_bits_found=true
],,
[
#include <sys/select.h>
])
fi
# With _XOPEN_SOURCE?
unset ac_cv_member_fd_set_fds_bits
if test x$fds_bits_found = xfalse ; then
AC_CHECK_MEMBER(fd_set.fds_bits,
[
fds_bits_found=true
PROTO_DEFINES="$PROTO_DEFINES -D_XOPEN_SOURCE"
],,
[
#define _XOPEN_SOURCE
#include <sys/select.h>
])
fi
Søren
More information about the xorg-modular
mailing list