check for user prefix externalized

This commit is contained in:
Radim Kolar 2009-07-24 22:28:40 +02:00
parent 93618dd883
commit 087c072e50
2 changed files with 21 additions and 12 deletions

View File

@ -49,17 +49,6 @@ def checkForLockPrefix(conf):
else: else:
conf.Result(0) conf.Result(0)
# check for user-supplied prefix
def checkForUserPrefix(conf):
global PREFIX
conf.Message("checking for user supplied prefix... ")
lp = ARGUMENTS.get('prefix', 0)
if lp:
conf.Result(1)
PREFIX=lp
else:
conf.Result(0)
def getVarSize(conf,var): def getVarSize(conf,var):
conf.Message("checking for size of "+var+" ") conf.Message("checking for size of "+var+" ")
rc = conf.TryCompile(""" rc = conf.TryCompile("""
@ -95,6 +84,7 @@ main ()
from maintainer import checkForMaintainerMode from maintainer import checkForMaintainerMode
from compilertest import checkForCCOption from compilertest import checkForCCOption
from prefix import checkForUserPrefix
conf = Configure(env,{'checkForCCOption':checkForCCOption, conf = Configure(env,{'checkForCCOption':checkForCCOption,
'MAINTAINER_MODE':checkForMaintainerMode, 'MAINTAINER_MODE':checkForMaintainerMode,
@ -170,7 +160,7 @@ elif fun_flock:
else: else:
conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING') conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
conf.checkForLockPrefix() conf.checkForLockPrefix()
conf.checkPrefix() PREFIX=conf.checkPrefix(PREFIX)
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"') conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')
EFENCE = conf.MAINTAINER_MODE() EFENCE = conf.MAINTAINER_MODE()
if EFENCE == True: if EFENCE == True:

19
site_scons/prefix.py Normal file
View File

@ -0,0 +1,19 @@
#
# SCons user-supplied prefix tester
#
# Version 1.0
# 16-Jun-2009
#
from SCons.Script import ARGUMENTS
def checkForUserPrefix(conf,oldprefix=None):
"""Returns prefix specified on command line or oldprefix if none is found."""
conf.Message("checking for user supplied prefix... ")
lp = ARGUMENTS.get('prefix', 0)
if lp:
conf.Result(1)
return lp
else:
conf.Result(0)
return oldprefix