From a1c620d50ecbb18d5a14683fa750ca6b76faa66d Mon Sep 17 00:00:00 2001 From: FuPeiJiang <42662615+FuPeiJiang@users.noreply.github.com> Date: Sat, 1 Nov 2025 14:36:34 -0400 Subject: [PATCH] Check headers for reallocarray --- app/meson.build | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/meson.build b/app/meson.build index f7df69eb..4d4d8c19 100644 --- a/app/meson.build +++ b/app/meson.build @@ -139,9 +139,14 @@ check_functions = [ 'vasprintf', 'nrand48', 'jrand48', - 'reallocarray', ] +check_functions_in_headers = { + 'stdlib.h': [ + 'reallocarray' + ], +} + foreach f : check_functions if cc.has_function(f) define = 'HAVE_' + f.underscorify().to_upper() @@ -149,6 +154,15 @@ foreach f : check_functions endif endforeach +foreach header, f_list : check_functions_in_headers + foreach f : f_list + if cc.has_function(f) and cc.has_header_symbol(header, f, args: ['-D_GNU_SOURCE']) + define = 'HAVE_' + f.underscorify().to_upper() + conf.set(define, true) + endif + endforeach +endforeach + conf.set('HAVE_SOCK_CLOEXEC', host_machine.system() != 'windows' and cc.has_header_symbol('sys/socket.h', 'SOCK_CLOEXEC'))