diff --git a/SConstruct b/SConstruct index 0b92097..ba27f1a 100644 --- a/SConstruct +++ b/SConstruct @@ -50,6 +50,7 @@ from lockprefix import checkForLockPrefix from clangtest import getVariableSize from locktype import checkForLockingType from lamerpack import checkForLamerpack +from debugmode import checkForDebugBuild conf = Configure(env,{'checkForCCOption':checkForCCOption, 'MAINTAINER_MODE':checkForMaintainerMode, @@ -57,7 +58,8 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption, 'checkPrefix':checkForUserPrefix, 'sizeOf':getVariableSize, 'checkForLockingType':checkForLockingType, - 'checkForLamerPack':checkForLamerpack + 'checkForLamerPack':checkForLamerpack, + 'checkForDebugBuild':checkForDebugBuild }) # check for CC options for option in Split(""" @@ -105,7 +107,8 @@ conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"') EFENCE = conf.MAINTAINER_MODE() if EFENCE == True: EFENCE=conf.CheckLib("efence","EF_Abort") -conf.checkForLamerPack() +conf.checkForLamerPack() +conf.checkForDebugBuild() conf.Finish() env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"") diff --git a/site_scons/debugmode.py b/site_scons/debugmode.py new file mode 100644 index 0000000..13e744d --- /dev/null +++ b/site_scons/debugmode.py @@ -0,0 +1,18 @@ +# +# SCons debug mode build tester +# +# Version 1.0 +# 04-Aug-2009 +# + +from SCons.Script import ARGUMENTS + +def checkForDebugBuild(conf): + """Check command line arguments if user requested debug mode build.""" + conf.Message("checking if we are building with extra debug code... ") + buildlamer=ARGUMENTS.get('enable-debug', 0) + if buildlamer == 0 or str(buildlamer).lower() == 'no': + conf.Result(0) + else: + conf.env.Append(CPPFLAGS = '-DDEBUG') + conf.Result(1)