+ improved pkg-config logic

This commit is contained in:
Artem Pavlenko 2009-01-10 12:08:55 +00:00
parent dd12ac8e36
commit d8226945d4
2 changed files with 19 additions and 4 deletions

View file

@ -85,7 +85,20 @@ if env['PLATFORM'] == 'FreeBSD':
thread_suffix = '' thread_suffix = ''
env.Append(LIBS = 'pthread') env.Append(LIBS = 'pthread')
conf = Configure(env) def CheckPKGConfig(context, version):
context.Message( 'Checking for pkg-config... ' )
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
context.Result( ret )
return ret
def CheckPKG(context, name):
context.Message( 'Checking for %s... ' % name )
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
context.Result( ret )
return ret
conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
'CheckPKG' : CheckPKG })
#### Libraries and headers dependency checks #### #### Libraries and headers dependency checks ####
@ -135,7 +148,7 @@ for prereq in ('BOOST', 'PNG', 'JPEG', 'TIFF', 'PGSQL', 'PROJ', 'GDAL',):
env.ParseConfig(env['FREETYPE_CONFIG'] + ' --libs --cflags') env.ParseConfig(env['FREETYPE_CONFIG'] + ' --libs --cflags')
if env.Execute('pkg-config --exists cairomm-1.0') == 0: if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('cairomm-1.0'):
env.ParseConfig('pkg-config --libs --cflags cairomm-1.0') env.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
env.Append(CXXFLAGS = '-DHAVE_CAIRO') env.Append(CXXFLAGS = '-DHAVE_CAIRO')
@ -224,6 +237,7 @@ for count, libinfo in enumerate(BOOST_LIBSHEADERS):
Exit(1) Exit(1)
Export('env') Export('env')
Export('conf')
inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]

View file

@ -24,8 +24,9 @@ import re
import os import os
Import('env') Import('env')
Import('conf')
if env.Execute('pkg-config --exists pycairo') == 0: if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
env.ParseConfig('pkg-config --cflags pycairo') env.ParseConfig('pkg-config --cflags pycairo')
env.Append(CXXFLAGS = '-DHAVE_PYCAIRO'); env.Append(CXXFLAGS = '-DHAVE_PYCAIRO');