[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: |
Fri, 9 Sep 2022 01:49:05 +0100 |
> 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
@@ -5056,6 +5056,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)
;;
```
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?
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>
],[
#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
signature.asc
Description: Message signed with OpenPGP
- Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Sam James, 2022/09/08
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Thomas Dickey, 2022/09/08
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Sam James, 2022/09/08
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?,
Sam James <=
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Thomas Dickey, 2022/09/10
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Sam James, 2022/09/10
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Thomas Dickey, 2022/09/10
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Sam James, 2022/09/10
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Thomas Dickey, 2022/09/10
- Re: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?, Sam James, 2022/09/10