From a9cfa9e0c4b9bd7e418f8a6a1e86495aeb7469de Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sun, 4 Aug 2024 09:18:36 +0900 Subject: [PATCH 1/4] p11-kit: Include from This pulls in CRYPTOKI_GNU definitions moved to in commit 5332245664f7b82ef190f13894a4a4f4ffb15922. Signed-off-by: Daiki Ueno --- p11-kit/uri.h | 1 + 1 file changed, 1 insertion(+) diff --git a/p11-kit/uri.h b/p11-kit/uri.h index d83e1ca9..6e198049 100644 --- a/p11-kit/uri.h +++ b/p11-kit/uri.h @@ -35,6 +35,7 @@ #ifndef P11_KIT_URI_H #define P11_KIT_URI_H +#include "p11-kit/p11-kit.h" #include "p11-kit/pkcs11.h" #ifdef __cplusplus From 4e69ce691184d7dab5ed520f6c2c1afb7a99a15c Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sun, 4 Aug 2024 13:02:23 +0900 Subject: [PATCH 2/4] meson: Set _XOPEN_SOURCE while checking strerror_r Otherwise it cannot detect either version of strerror_r, when compiled with -Dc_std=c99. Signed-off-by: Daiki Ueno --- meson.build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 0b89542c..788681bc 100644 --- a/meson.build +++ b/meson.build @@ -320,12 +320,18 @@ foreach f : functions endif endforeach -if cc.has_function('strerror_r', prefix: '#include ') - strerror_r_code = ''' +strerror_r_prefix = ''' #define _GNU_SOURCE +#ifndef __sun +#define _XOPEN_SOURCE 700 +#endif + #include #include +''' +if cc.has_function('strerror_r', prefix: strerror_r_prefix) + strerror_r_code = strerror_r_prefix + ''' int main (void) { /* GNU strerror_r returns char *, XSI returns int */ From 822bd4f54919c7848a93df5c653fe422346d4a58 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sun, 4 Aug 2024 13:05:03 +0900 Subject: [PATCH 3/4] meson: Set _GNU_SOURCE when checking reallocarray Otherwise the function is not detected when compiled with -Dc_std=c99. Signed-off-by: Daiki Ueno --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 788681bc..341d567f 100644 --- a/meson.build +++ b/meson.build @@ -360,7 +360,8 @@ conf.set10('HAVE_DECL_VASPRINTF', prefix: '#define _GNU_SOURCE')) conf.set10('HAVE_DECL_REALLOCARRAY', - cc.has_header_symbol('stdlib.h', 'reallocarray')) + cc.has_header_symbol('stdlib.h', 'reallocarray', + prefix: '#define _GNU_SOURCE')) # -------------------------------------------------------------------- # libffi From 2b5105f5b4a94d43eb6d88ea57474bb37c62f901 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sun, 4 Aug 2024 13:18:53 +0900 Subject: [PATCH 4/4] meson: Set _GNU_SOURCE when checking type and functions Otherwise neither locale_t, newlocale, nor strerror_l is detected under -Dc_std=c99. Signed-off-by: Daiki Ueno --- meson.build | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 341d567f..559ce90d 100644 --- a/meson.build +++ b/meson.build @@ -170,12 +170,20 @@ if host_system != 'windows' if cc.has_header('locale.h') conf.set('HAVE_LOCALE_H', 1) - if cc.has_type('locale_t', prefix: '#include ') + locale_prefix = ''' +#define _GNU_SOURCE +#include +''' + if cc.has_type('locale_t', prefix: locale_prefix) conf.set('HAVE_LOCALE_T', 1) - if cc.has_function('newlocale', prefix: '#include ') + if cc.has_function('newlocale', prefix: locale_prefix) conf.set('HAVE_NEWLOCALE', 1) endif - if cc.has_function('strerror_l', prefix: '#include ') + strerror_l_prefix = ''' +#define _GNU_SOURCE +#include +''' + if cc.has_function('strerror_l', prefix: strerror_l_prefix) conf.set('HAVE_STRERROR_L', 1) endif endif