diff --git a/meson.build b/meson.build index 0b89542c..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 @@ -320,12 +328,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 */ @@ -354,7 +368,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 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