Index: /trunk/libffado/SConstruct =================================================================== --- /trunk/libffado/SConstruct (revision 598) +++ /trunk/libffado/SConstruct (revision 601) @@ -103,5 +103,5 @@ if not env.GetOption('clean'): conf = Configure( env, - custom_tests={ 'CheckForPKGConfig' : CheckForPKGConfig, 'CheckForPKG' : CheckForPKG, 'CheckForApp' : CheckForApp }, + custom_tests={ 'CheckForPKGConfig' : CheckForPKGConfig, 'CheckForPKG' : CheckForPKG, 'GetPKGFlags' : GetPKGFlags, 'CheckForApp' : CheckForApp }, conf_dir="cache/" + build_base, log_file="cache/" + build_base + 'config.log' ) @@ -112,15 +112,24 @@ allpresent = 1; - allpresent &= conf.CheckForPKGConfig(); - allpresent &= conf.CheckForPKG( 'libraw1394', "1.3.0" ) - allpresent &= conf.CheckForPKG( 'libavc1394', "0.5.3" ) - allpresent &= conf.CheckForPKG( 'libiec61883', "1.1.0" ) - allpresent &= conf.CheckForPKG( 'alsa', "1.0.0" ) - allpresent &= conf.CheckForPKG( 'libxml++-2.6', "2.13.0" ) - allpresent &= conf.CheckForPKG( 'liblo', "0.22" ) - allpresent &= conf.CheckForPKG( 'dbus-1', "1.0" ) allpresent &= conf.CheckHeader( "expat.h" ) allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include ' ) + allpresent &= conf.CheckForPKGConfig(); + + pkgs = { + 'libraw1394' : '1.3.0', + 'libavc1394' : '0.5.3', + 'libiec61883' : '1.1.0', + 'alsa' : '1.0.0', + 'libxml++-2.6' : '2.13.0', + 'liblo' : '0.22', + 'dbus-1' : '1.0', + } + for pkg in pkgs: + name2 = pkg.replace("+","").replace(".","").replace("-","").upper() + env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] ) + if env['%s_FLAGS'%name2] == 0: + allpresent &= 0 + if not allpresent: print """ Index: /trunk/libffado/admin/pkgconfig.py =================================================================== --- /trunk/libffado/admin/pkgconfig.py (revision 590) +++ /trunk/libffado/admin/pkgconfig.py (revision 601) @@ -37,2 +37,27 @@ return ret +# +# Checks for the existance of the package and returns the packages flags. +# +# This should allow caching of the flags so that pkg-config is called only once. +# +def GetPKGFlags( context, name, version="" ): + import os + + if version == "": + context.Message( "Checking for %s... \t" % name ) + ret = context.TryAction( "pkg-config --exists '%s'" % name )[0] + else: + context.Message( "Checking for %s (%s or higher)... \t" % (name,version) ) + ret = context.TryAction( "pkg-config --atleast-version=%s '%s'" % (version,name) )[0] + + if not ret: + context.Result( ret ) + return ret + + out = os.popen2( "pkg-config --cflags --libs %s" % name )[1] + ret = out.read() + + context.Result( True ) + return ret +