Currently we use has_function, which will construct local declaration
and see if the program links successfully. What we're really interested
is if the referenced header has a declaration of the respective symbol.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/131
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
# basename may be only available in libgen.h with the POSIX behavior,
# not desired here
_decls = [
- ['basename', '#include <string.h>'],
+ ['basename', 'string.h'],
]
foreach tuple : _decls
decl = tuple[0]
- prefix = tuple[1]
- have = cc.has_function(decl, prefix : prefix, args : '-D_GNU_SOURCE')
+ header = tuple[1]
+ glibc = cc.has_header_symbol(header, decl, args : '-D_GNU_SOURCE')
cdata.set10('HAVE_DECL_@0@'.format(decl.to_upper()), have)
endforeach