diff --git a/SConstruct b/SConstruct index cf3c743..6beee8c 100644 --- a/SConstruct +++ b/SConstruct @@ -3,10 +3,13 @@ import os # init Scons EnsureSConsVersion(0,96) +EnsurePythonVersion(2,2) + +# set defaults PREFIX='/usr/local' PACKAGE='fsp' VERSION='2.8.1b25' -EFENCE=0 +EFENCE=False env = Environment(CPPPATH='#/include', LIBPATH=['/usr/lib','/usr/local/lib']) # Turn CPPFLAGS to list @@ -55,21 +58,6 @@ void dummy(void) {} conf.Result(rc) return rc -# check for maintainer mode -def checkForMaintainerMode(conf): - global EFENCE - conf.Message("checking whether to enable maintainer mode... ") - if ARGUMENTS.get('maintainer-mode', 0) or \ - ARGUMENTS.get('enable-maintainer-mode', 0): - conf.Result(1) - conf.env.Append(CCFLAGS = '-O0') - conf.env.Append(CPPFLAGS = '-DMAINTAINER_MODE') - EFENCE=1 - else: - conf.Result(0) - conf.env.Append(CCFLAGS = '-O') - EFENCE=0 - # check for user-supplied lock prefix def checkForLockPrefix(conf): conf.Message("checking for user supplied lockprefix... ") @@ -124,6 +112,9 @@ main () return rc ############ Start configuration ############## + +from maintainer import checkForMaintainerMode + conf = Configure(env,{'checkForGCCOption':checkForGCCOption, 'MAINTAINER_MODE':checkForMaintainerMode, 'checkForLockPrefix':checkForLockPrefix, @@ -199,8 +190,8 @@ else: conf.checkForLockPrefix() conf.checkPrefix() conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"') -conf.MAINTAINER_MODE() -if EFENCE == 1: +EFENCE = conf.MAINTAINER_MODE() +if EFENCE == True: EFENCE=conf.CheckLib("efence","EF_Abort") conf.Finish() diff --git a/site_scons/maintainer.py b/site_scons/maintainer.py new file mode 100644 index 0000000..89ad031 --- /dev/null +++ b/site_scons/maintainer.py @@ -0,0 +1,21 @@ +# +# SCons check for maintainer mode +# +# Version 1.1 +# 24-Jul-2009 +# + +from SCons.Script import ARGUMENTS + +def checkForMaintainerMode(conf): + """Check if user wants to enable maintainer compilation mode.""" + conf.Message("checking whether to enable maintainer mode... ") + if ARGUMENTS.get('maintainer-mode', 0) or \ + ARGUMENTS.get('enable-maintainer-mode', 0): + conf.Result(1) + conf.env.Append(CCFLAGS = '-O0') + conf.env.Append(CPPFLAGS = '-DMAINTAINER_MODE') + return True + else: + conf.Result(0) + return False