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: Thomas Dickey
Subject: Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?
Date: Sat, 10 Sep 2022 09:11:53 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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).

> @@ -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).
 
> 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...

>  ],[
>  #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: PGP signature


reply via email to

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