diff --git a/SConstruct b/SConstruct index 9bc152641..d51b9c86b 100644 --- a/SConstruct +++ b/SConstruct @@ -304,6 +304,7 @@ opts.AddVariables( ('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG), BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'), BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'), + BoolVariable('NO_DLCLOSE', 'Will prevent plugins from being unloaded', 'False'), # http://www.scons.org/wiki/GoFastButton # http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'), @@ -1731,6 +1732,9 @@ if not preconfigured: if env['NO_ATEXIT']: env.Append(CPPDEFINES = '-DMAPNIK_NO_ATEXIT') + if env['NO_DLCLOSE'] or env['COVERAGE']: + env.Append(CPPDEFINES = '-DMAPNIK_NO_DLCLOSE') + # Mac OSX (Darwin) special settings if env['PLATFORM'] == 'Darwin': pthread = '' diff --git a/src/plugin.cpp b/src/plugin.cpp index 7b057284e..af9bef3fb 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -93,7 +93,9 @@ PluginInfo::~PluginInfo() */ if (module_->dl && name_ != "gdal" && name_ != "ogr") { +#ifndef MAPNIK_NO_DLCLOSE dlclose(module_->dl),module_->dl=0; +#endif } #endif delete module_;