From d8226945d497cc33b23ef5cb803103c2c8e6cea3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Sat, 10 Jan 2009 12:08:55 +0000 Subject: [PATCH] + improved pkg-config logic --- SConstruct | 20 +++++++++++++++++--- bindings/python/SConscript | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index ce8838054..c11d6ddd5 100644 --- a/SConstruct +++ b/SConstruct @@ -85,7 +85,20 @@ if env['PLATFORM'] == 'FreeBSD': thread_suffix = '' 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 #### @@ -134,8 +147,8 @@ for prereq in ('BOOST', 'PNG', 'JPEG', 'TIFF', 'PGSQL', 'PROJ', 'GDAL',): uniq_add(env, 'LIBPATH', lib_path) 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.Append(CXXFLAGS = '-DHAVE_CAIRO') @@ -224,6 +237,7 @@ for count, libinfo in enumerate(BOOST_LIBSHEADERS): Exit(1) Export('env') +Export('conf') inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] diff --git a/bindings/python/SConscript b/bindings/python/SConscript index 2fee0cb0a..d054af42e 100644 --- a/bindings/python/SConscript +++ b/bindings/python/SConscript @@ -24,8 +24,9 @@ import re import os 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.Append(CXXFLAGS = '-DHAVE_PYCAIRO');