catch errors in build time pkg-config parsing - closes #738

This commit is contained in:
Dane Springmeyer 2011-04-02 03:11:42 +00:00
parent 9b1a33be5c
commit 27cc2f0dc5
2 changed files with 16 additions and 11 deletions

View file

@ -281,7 +281,7 @@ opts.AddVariables(
('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'), ('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'),
('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''), ('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''),
('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''), ('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
EnumVariable('OPTIMIZATION','Set g++ optimization level','2', ['0','1','2','3','4']), EnumVariable('OPTIMIZATION','Set g++ optimization level','2', ['0','1','2','3','4','s']),
# Note: setting DEBUG=True will override any custom OPTIMIZATION level # Note: setting DEBUG=True will override any custom OPTIMIZATION level
BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'), BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
BoolVariable('XML_DEBUG', 'Compile a XML verbose debug version of mapnik', 'False'), BoolVariable('XML_DEBUG', 'Compile a XML verbose debug version of mapnik', 'False'),

View file

@ -21,6 +21,7 @@
import os import os
import sys
import glob import glob
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
@ -185,16 +186,20 @@ if True : # agg backend
if env['HAS_CAIRO']: if env['HAS_CAIRO']:
# attach libs to library linking environment # attach libs to library linking environment
lib_env.ParseConfig('pkg-config --libs cairomm-1.0') try:
env2 = lib_env.Clone() lib_env.ParseConfig('pkg-config --libs cairomm-1.0')
env2.Append(CXXFLAGS = '-DHAVE_CAIRO') env2 = lib_env.Clone()
# attach cflags to specific compile environment env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
env2.ParseConfig('pkg-config --cflags cairomm-1.0') # attach cflags to specific compile environment
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp'] env2.ParseConfig('pkg-config --cflags cairomm-1.0')
for cpp in fixup: fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
if cpp in source: for cpp in fixup:
source.remove(cpp) if cpp in source:
source.insert(0,env2.SharedObject(cpp)) source.remove(cpp)
source.insert(0,env2.SharedObject(cpp))
except OSError, e:
print '\nFailed to detect cairo/cairomm configuration, please re-run "python scons/scons.py configure"'
sys.exit(1)
if env['XMLPARSER'] == 'tinyxml': if env['XMLPARSER'] == 'tinyxml':
source += Split( source += Split(