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'),
('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>', ''),
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
BoolVariable('DEBUG', 'Compile a 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 sys
import glob
from subprocess import Popen, PIPE
@ -185,16 +186,20 @@ if True : # agg backend
if env['HAS_CAIRO']:
# attach libs to library linking environment
lib_env.ParseConfig('pkg-config --libs cairomm-1.0')
env2 = lib_env.Clone()
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
# attach cflags to specific compile environment
env2.ParseConfig('pkg-config --cflags cairomm-1.0')
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
for cpp in fixup:
if cpp in source:
source.remove(cpp)
source.insert(0,env2.SharedObject(cpp))
try:
lib_env.ParseConfig('pkg-config --libs cairomm-1.0')
env2 = lib_env.Clone()
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
# attach cflags to specific compile environment
env2.ParseConfig('pkg-config --cflags cairomm-1.0')
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
for cpp in fixup:
if cpp in source:
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':
source += Split(