From 8b74a301fbf61db07d948cbf77807ed409530851 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 22 Mar 2007 10:54:44 +0000 Subject: [PATCH] Be explicit about threading model Added THREADING enum options (defaults to 'multi') --- SConstruct | 15 ++++++++++----- bindings/python/SConscript | 13 +++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index 8a58833fe..d23e138a0 100644 --- a/SConstruct +++ b/SConstruct @@ -51,8 +51,10 @@ opts.Add(ListOption('BINDINGS','Language bindings to build','all',['python'])) opts.Add('DEBUG', 'Compile a debug version of mapnik', '') opts.Add('DESTDIR', 'The root directory to install into. Useful mainly for binary package building', '/') opts.Add('BIDI', 'BIDI support', '') +opts.Add(EnumOption('THREADING','Set threading support','multi', ['multi','single'])) env = Environment(ENV=os.environ, options=opts) + env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA env['PLATFORM'] = platform.uname()[0] print "Building on %s ..." % env['PLATFORM'] @@ -107,7 +109,7 @@ if env['BIDI'] : C_LIBSHEADERS.append(['fribidi','fribidi/fribidi.h',True]) BOOST_LIBSHEADERS = [ ['thread', 'boost/thread/mutex.hpp', True], - # ['system', 'boost/system/system_error.hpp', True], # comment this out if building on Darwin + boost_1_35 + # ['system', 'boost/system/system_error.hpp', True], # uncomment this on Darwin + boost_1_35 ['filesystem', 'boost/filesystem/operations.hpp', True], ['regex', 'boost/regex.hpp', True], ['program_options', 'boost/program_options.hpp', False] @@ -120,16 +122,19 @@ for libinfo in C_LIBSHEADERS: if len(env['BOOST_TOOLKIT']): - env['BOOST_APPEND'] = '-%s-mt' % env['BOOST_TOOLKIT'] + env['BOOST_APPEND'] = '-%s' % env['BOOST_TOOLKIT'] else: env['BOOST_APPEND']='' for count, libinfo in enumerate(BOOST_LIBSHEADERS): - if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++'): - if not conf.CheckLibWithHeader('boost_%s%s-mt' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++') and libinfo[2] and count == 0: + if env['THREADING'] == 'multi' : + if not conf.CheckLibWithHeader('boost_%s%s-mt' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++') and libinfo[2] : print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0] Exit(1) - + elif not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++') : + print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0] + Exit(1) + Export('env') inputplugins = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] diff --git a/bindings/python/SConscript b/bindings/python/SConscript index 108dc6228..d980c16bc 100644 --- a/bindings/python/SConscript +++ b/bindings/python/SConscript @@ -26,13 +26,18 @@ Import('env') prefix = env['PYTHON_PREFIX'] + '/'+ 'lib' + '/python' + env['PYTHON_VERSION'] + '/site-packages/' install_prefix = env['DESTDIR'] + '/' + prefix -libraries = ['mapnik', 'boost_python%s' % env['BOOST_APPEND']] +linkflags = '' +if env['THREADING'] == 'multi': + libraries = ['mapnik', 'boost_python%s-mt' % env['BOOST_APPEND']] +else : + libraries = ['mapnik', 'boost_python%s' % env['BOOST_APPEND']] if env['PLATFORM'] == 'Darwin': - libraries.append('boost_regex%s' % env['BOOST_APPEND']) + if env['THREADING'] == 'multi': + libraries.append('boost_regex%s-mt' % env['BOOST_APPEND']) + else : + libraries.append('boost_regex%s' % env['BOOST_APPEND']) linkflags = '-F/ -framework Python' -else : - linkflags = '' headers = [env['PYTHON_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] + env['CPPPATH']