]> git.proxmox.com Git - mirror_lxc.git/commitdiff
build: use cc.links() to check for static libcap
authorChristian Brauner <brauner@kernel.org>
Mon, 13 Jun 2022 09:04:17 +0000 (11:04 +0200)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Mon, 13 Jun 2022 09:04:17 +0000 (11:04 +0200)
Fixes: #4144
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
meson.build

index f48694ee5b18e5b290594ec22148016c590c7b56..ace66c0c8b75e562b675e9889fe0bea2a6ccb849 100644 (file)
@@ -382,7 +382,16 @@ if want_capabilities
         # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
         libcap_static = cc.find_library('cap', required: false, static: true)
     endif
-    srcconf.set10('HAVE_STATIC_LIBCAP', libcap_static.found())
+
+    code = '''
+int main(int argc, char *argv[]) { return 0; };
+'''
+    if libcap_static.found()
+        libcap_static_linkable = cc.links(code, args: '-static', dependencies: libcap_static)
+        srcconf.set10('HAVE_STATIC_LIBCAP', libcap_static_linkable)
+    else
+        srcconf.set10('HAVE_STATIC_LIBCAP', false)
+    endif
 else
     srcconf.set10('HAVE_LIBCAP', false)
     srcconf.set10('HAVE_STATIC_LIBCAP', false)