build: set _GNU_SOURCE when checking for SO_PEERCRED

SO_PEERCRED is not POSIX, so might be hidden unless _GNU_SOURCE
is defined.

See [1]: cc.has_header_symbol() does not inherit the project
arguments.

[1]: https://github.com/mesonbuild/meson/issues/3301

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2023-02-18 11:29:25 +01:00 committed by Olivier Fourdan
parent 8f7279ade2
commit 636c9aa359

View File

@ -192,7 +192,7 @@ if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS')
endif
if conf_data.get('HAVE_GETPEEREID').to_int() == 0 and conf_data.get('HAVE_GETPEERUCRED').to_int() == 0
if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED')
if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED', args: '-D_GNU_SOURCE')
conf_data.set('NO_LOCAL_CLIENT_CRED', 1)
endif
endif