bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in


From: Sam James
Subject: Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?
Date: Sat, 10 Sep 2022 14:47:50 +0100


> On 10 Sep 2022, at 14:11, Thomas Dickey <dickey@his.com> wrote:
> 
> On Fri, Sep 09, 2022 at 01:49:05AM +0100, Sam James wrote:
>> 
>> 
>>> On 9 Sep 2022, at 01:02, Sam James <sam@gentoo.org> wrote:
>>> [snip]
>>> 
>>>>> This is on a musl + Clang system (details below for how
>>>>> to reproduce).
>>>> 
>>>> none of the systems that I develop on have musl.
>>>> (you're free to submit a patch, if you use musl).
>>>> 
>>> 
>>> Thanks, I'll take a look.
>> 
>> So, if I just do e.g.
>> ```
>> --- a/Ada95/aclocal.m4
>> +++ b/Ada95/aclocal.m4
> 
> actually that would be the top-level aclocal.m4 (this particular file
> is used for building AdaCurses separately from the main sources).

Right, I just patched all the files identically but changed
some so copied that part to illustrate an example change.

> 
>> @@ -5056,6 +5056,9 @@ case "$host_os" in
>>      cf_xopen_source="-D_SGI_SOURCE"
>>      cf_XOPEN_SOURCE=
>>      ;;
>> +(linux*musl*)
>> +    CF_TRY_XOPEN_SOURCE
>> +    ;;
> 
> that part looks right
> 
>> (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
>>      CF_GNU_SOURCE($cf_XOPEN_SOURCE)
>>      ;;
>> ```
>> 
>> It's insufficient because it thinks we don't need to set it.
>> 
>> Apparently this is because when building a test program
>> with
>> #include <stdlib.h>
>> #include <string.h>
>> #include <sys/types.h>
>> This ends up enabling XOPEN_SOURCE (some header
>> is defining it, I guess).
>> 
>> Is there a reason those headers are used for the tiny test
>> programs?
> 
> The test-programs all can be built separately from the main sources.
> (That's done so they can be compared with other versions of ncurses,
> as well as other implementations of curses).

Sorry, I meant "test programs" as in "programs configure builds
for detecting macros and such".

> 
>> If I drop them from the include like so, all is well,
>> and configure adds XOPEN_SOURCE appropriately:
>> 
>> ```
>> --- a/aclocal.m4
>> +++ b/aclocal.m4
>> @@ -8377,9 +8377,6 @@ dnl can define it successfully.
>> AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
>> AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
>>      AC_TRY_COMPILE([
>> -#include <stdlib.h>
>> -#include <string.h>
>> -#include <sys/types.h>
> 
> I'd have to see what config.log showed, to advise on how to work around
> whatever problem exists with musl.  Omitting the standard headers is
> not an improvement...

Sure, ask and ye:
* Vanilla config.log (no patches): 
https://dev.gentoo.org/~sam/tmp/ncurses-musl-config.log-2022-09-10
* Patched (patch here to only add CF_TRY_XOPEN_SOURCE which proves 
insufficient(?):, 
https://dev.gentoo.org/~sam/tmp/ncurses-musl-patch-2022-09-10, config.log: 
https://dev.gentoo.org/~sam/tmp/ncurses-musl-config.log-patched-2022-09-10)

If you need anything else, just ask. Happy to provide.

And yes, that's why I asked about why the headers were there in the first
place. Could you tell me why they're there? For certain configure tests, it 
just seems like
they're introducing contagion. We're not using anything from them in this 
configure test?
Or what am I missing?

> 
>> ],[
>> #ifndef _XOPEN_SOURCE
>> make an error
>> @@ -8388,9 +8385,6 @@ make an error
>>      [cf_save="$CPPFLAGS"
>>       CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
>>       AC_TRY_COMPILE([
>> -#include <stdlib.h>
>> -#include <string.h>
>> -#include <sys/types.h>
>> ],[
>> #ifdef _XOPEN_SOURCE
>> make an error
>> @@ -9915,6 +9909,9 @@ case "$host_os" in
>>      cf_xopen_source="-D_SGI_SOURCE"
>>      cf_XOPEN_SOURCE=
>>      ;;
>> +(linux*musl*)
>> +    CF_TRY_XOPEN_SOURCE
>> +    ;;
>> (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
>>      CF_GNU_SOURCE($cf_XOPEN_SOURCE)
>>      ;;
>> ```
>> 
>> 
>>> 
>>> Best,
>>> sam
>> 
> 
> 
> 
> --
> Thomas E. Dickey <dickey@invisible-island.net>
> https://invisible-island.net
> ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]