From: Christian Brauner Date: Mon, 13 Jun 2022 09:04:17 +0000 (+0200) Subject: build: use cc.links() to check for static libcap X-Git-Tag: lxc-5.0.0~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de4543d8f86208c5cba0140e1de85a5624a0c8f1;p=thirdparty%2Flxc.git build: use cc.links() to check for static libcap Fixes: #4144 Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/meson.build b/meson.build index f48694ee5..ace66c0c8 100644 --- a/meson.build +++ b/meson.build @@ -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)