From a2396d385bbd86caaec1302f8ec69e746bd037c8 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 15 Sep 2024 19:04:19 +0100 Subject: [PATCH] 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 --- meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.47.2