Add check_via_pkg_config to wscript
authorCarl Hetherington <cth@carlh.net>
Sat, 20 May 2023 20:50:54 +0000 (22:50 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 6 May 2024 18:42:08 +0000 (20:42 +0200)
wscript

diff --git a/wscript b/wscript
index 801c3b156a48d73829831553a1c9a2dba5da98ef..7defd05d729fc2f55f2fc71f36c4e6d6d9a4180d 100644 (file)
--- a/wscript
+++ b/wscript
@@ -251,6 +251,16 @@ def configure(conf):
     # linked and others that should be dynamic.  This doesn't work too well with waf
     # as it wants them separate.
 
+    def check_via_pkg_config(conf, package, uselib_store, mandatory, static, minimum_version):
+        args = package if minimum_version is None else '%s >= %s' % (package, minimum_version)
+        args += ' --cflags'
+        if not static:
+            args += ' --libs'
+        msg = 'Checking for %s' % package
+        if minimum_version is not None:
+            msg += ' >= %s' % minimum_version
+        conf.check_cfg(package=package, args=args, uselib_store=uselib_store, mandatory=mandatory, msg=msg)
+
     # libcurl
     if conf.options.static_curl:
         conf.env.STLIB_CURL = ['curl']