root/trunk/libffado/admin/pkgconfig.py

Revision 590, 1.2 kB (checked in by arnonym, 15 years ago)

This might(!) fix the issue with pkg-config getting executed during install. But I don't know if the determined flags are cached or only the result (which is [0,1])...

Line 
1 #!/usr/bin/python
2
3 #
4 # Taken from http://www.scons.org/wiki/UsingPkgConfig
5 #
6
7 #
8 # Checks for pkg-config
9 #
10 def CheckForPKGConfig( context, version='0.0.0' ):
11         context.Message( "Checking for pkg-config (at least version %s)... " % version )
12         ret = context.TryAction( "pkg-config --atleast-pkgconfig-version=%s" %version )[0]
13         context.Result( ret )
14         return ret
15
16 #
17 # Checks for the given package with an optional version-requirement
18 #
19 # The flags (which can be imported into the environment by env.MergeFlags(...)
20 # are exported as env['NAME_FLAGS'] where name is built by removing all +,-,.
21 # and upper-casing.
22 #
23 def CheckForPKG( context, name, version="" ):
24         name2 = name.replace("+","").replace(".","").replace("-","")
25
26         if version == "":
27                 context.Message( "Checking for %s... \t" % name )
28                 ret = context.TryAction( "pkg-config --exists '%s'" % name )[0]
29         else:
30                 context.Message( "Checking for %s (%s or higher)... \t" % (name,version) )
31                 ret = context.TryAction( "pkg-config --atleast-version=%s '%s'" % (version,name) )[0]
32
33         if ret:
34                 context.env['%s_FLAGS' % name2.upper()] = context.env.ParseFlags("!pkg-config --cflags --libs %s" % name)
35
36         context.Result( ret )
37         return ret
38
Note: See TracBrowser for help on using the browser.