Diego Biurrun <[email protected]> writes:

> On Thu, May 05, 2011 at 11:22:45AM +0100, Måns Rullgård wrote:
>> Diego Biurrun <[email protected]> writes:
>> 
>> > On some (BSD) systems _POSIX_C_SOURCE masks function definitions in
>> > system header files.  Avoid the #define in that case.
>> > This allows eliminating some BSD-specific hacks.
>> > ---
>> >  configure        |    5 ++++-
>> >  doc/general.texi |    8 --------
>> >  2 files changed, 4 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/configure b/configure
>> > index 2b5aeab..db67466 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -2310,7 +2310,10 @@ if test "$?" != 0; then
>> >      die "C compiler test failed."
>> >  fi
>> >  
>> > -add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
>> > +add_cppflags -D_ISOC99_SOURCE
>> > +check_func_headers unistd.h lockf -D_POSIX_C_SOURCE=200112 &&
>> > +    ! check_func_headers unistd.h lockf &&
>> > +    add_cppflags -D_POSIX_C_SOURCE=200112
>> 
>> This looks weird.
>
> Forget about it, it won't work anyway as it is missing another
> -D_XOPEN_SOURCE=500 flag.
>
> I think we should first agree what the desired semantics are.
> We need a test that succeeds with the posix flag and, well, what 
> else exactly?  If the function is not available at all, what should
> be the fallback behavior?  Do we want the POSIX flag added or not?
>
> Also, should the test succeed w/ and w/o the posix flag or only w/
> the flag or what?

To detect the BSD weirdness we need a function that exists with not
flags and goes away with _POSIX_C_SOURCE.  If it never exists, the
system doesn't implement X/Open at all and probably doesn't care about
_POSIX_C_SOURCE, so defining it by default should be safe, and that is
also what we currently do.  If the function show up only with
_POSIX_C_SOURCE (and not without), adding it is of course the thing to do.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to