From 0a776142acb6d7977abf6589982ac2610e4d9f23 Mon Sep 17 00:00:00 2001 From: Radim Kolar <> Date: Tue, 18 Aug 2009 20:18:59 +0200 Subject: [PATCH] added support for building clients with/without timeout --- SConstruct | 5 ++++- site_scons/timeout.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 site_scons/timeout.py diff --git a/SConstruct b/SConstruct index ba27f1a..f48cb87 100644 --- a/SConstruct +++ b/SConstruct @@ -51,6 +51,7 @@ from clangtest import getVariableSize from locktype import checkForLockingType from lamerpack import checkForLamerpack from debugmode import checkForDebugBuild +from timeout import checkForClientTimeout conf = Configure(env,{'checkForCCOption':checkForCCOption, 'MAINTAINER_MODE':checkForMaintainerMode, @@ -59,7 +60,8 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption, 'sizeOf':getVariableSize, 'checkForLockingType':checkForLockingType, 'checkForLamerPack':checkForLamerpack, - 'checkForDebugBuild':checkForDebugBuild + 'checkForDebugBuild':checkForDebugBuild, + 'checkForClientTimeout':checkForClientTimeout }) # check for CC options for option in Split(""" @@ -109,6 +111,7 @@ if EFENCE == True: EFENCE=conf.CheckLib("efence","EF_Abort") conf.checkForLamerPack() conf.checkForDebugBuild() +conf.checkForClientTimeout() conf.Finish() env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"") diff --git a/site_scons/timeout.py b/site_scons/timeout.py new file mode 100644 index 0000000..96e9dec --- /dev/null +++ b/site_scons/timeout.py @@ -0,0 +1,22 @@ +# +# SCons checker for enabling client timeout feature +# +# Version 1.0 +# 18-Aug-2009 +# + +from SCons.Script import ARGUMENTS + +def checkForClientTimeout(conf): + """Check command line arguments if user requested disabling timeouts.""" + conf.Message("Checking if client commands can time out... ") + timeout=ARGUMENTS.get('disable-timeout', 0) + try: + timeout2=int(timeout) + except ValueError: + timeout2=None + if timeout2 == 0 or str(timeout).lower() == 'no': + conf.env.Append(CPPFLAGS = '-DCLIENT_TIMEOUT') + conf.Result(1) + else: + conf.Result(0)