meson: add "prefix: '#include <unistd.h>" to cc.has_function()

When checking for execvpe, include <unistd.h>
This commit is contained in:
Daniel Eklöf 2024-08-09 08:15:13 +02:00
parent 9d5d84a835
commit 803f712332
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -13,12 +13,15 @@ is_debug_build = get_option('buildtype').startswith('debug')
cc = meson.get_compiler('c')
if cc.has_function('memfd_create',
args: ['-D_GNU_SOURCE'], prefix: '#include <sys/mman.h>')
args: ['-D_GNU_SOURCE'],
prefix: '#include <sys/mman.h>')
add_project_arguments('-DMEMFD_CREATE', language: 'c')
endif
# Missing on DragonFly, FreeBSD < 14.1
if cc.has_function('execvpe')
if cc.has_function('execvpe',
args: ['-D_GNU_SOURCE'],
prefix: '#include <unistd.h>')
add_project_arguments('-DEXECVPE', language: 'c')
endif