]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: use has_header_symbol for checking declarations
authorEmil Velikov <emil.l.velikov@gmail.com>
Sun, 15 Sep 2024 18:04:19 +0000 (19:04 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 17 Sep 2024 03:01:34 +0000 (22:01 -0500)
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>
meson.build

index e543de4492eee0a9c6ceb278334c6c36c6ea3da8..047e96472be91736a0a939f0cdeb9b2956fea56c 100644 (file)
@@ -87,12 +87,12 @@ endforeach
 # 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