Check headers for reallocarray

This commit is contained in:
FuPeiJiang 2025-11-01 14:36:34 -04:00
parent 3281fda6ef
commit a1c620d50e

View file

@ -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'))