From: Emil Velikov Date: Sun, 15 Sep 2024 18:04:19 +0000 (+0100) Subject: meson: use has_header_symbol for checking declarations X-Git-Tag: v34~337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2396d385bbd86caaec1302f8ec69e746bd037c8;p=thirdparty%2Fkmod.git meson: use has_header_symbol for checking declarations 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 Link: https://github.com/kmod-project/kmod/pull/131 Signed-off-by: Lucas De Marchi --- diff --git a/meson.build b/meson.build index e543de44..047e9647 100644 --- a/meson.build +++ b/meson.build @@ -87,12 +87,12 @@ endforeach # basename may be only available in libgen.h with the POSIX behavior, # not desired here _decls = [ - ['basename', '#include '], + ['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