Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: Support building with -Dc_std=c99 #654

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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.h>')
locale_prefix = '''
#define _GNU_SOURCE
#include <locale.h>
'''
if cc.has_type('locale_t', prefix: locale_prefix)
conf.set('HAVE_LOCALE_T', 1)
if cc.has_function('newlocale', prefix: '#include <locale.h>')
if cc.has_function('newlocale', prefix: locale_prefix)
conf.set('HAVE_NEWLOCALE', 1)
endif
if cc.has_function('strerror_l', prefix: '#include <string.h>')
strerror_l_prefix = '''
#define _GNU_SOURCE
#include <string.h>
'''
if cc.has_function('strerror_l', prefix: strerror_l_prefix)
conf.set('HAVE_STRERROR_L', 1)
endif
endif
Expand Down Expand Up @@ -320,12 +328,18 @@ foreach f : functions
endif
endforeach

if cc.has_function('strerror_r', prefix: '#include <string.h>')
strerror_r_code = '''
strerror_r_prefix = '''
#define _GNU_SOURCE
#ifndef __sun
#define _XOPEN_SOURCE 700
#endif

#include <errno.h>
#include <string.h>
'''

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 */
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions p11-kit/uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading