compiler options test externalised
This commit is contained in:
parent
f87cfcc407
commit
93618dd883
23
SConstruct
23
SConstruct
|
|
@ -38,20 +38,6 @@ env.Replace(CCFLAGS = str(env['CCFLAGS']).split(' '))
|
|||
|
||||
#################### Tests ###################
|
||||
|
||||
# check for other GCC options
|
||||
def checkForGCCOption(conf,option):
|
||||
conf.Message("checking whether GCC supports "+option+" ")
|
||||
lastCFLAGS=conf.env['CCFLAGS']
|
||||
conf.env.Append(CCFLAGS = option)
|
||||
rc = conf.TryCompile("""
|
||||
void dummy(void);
|
||||
void dummy(void) {}
|
||||
""",'.c')
|
||||
if not rc:
|
||||
conf.env.Replace(CCFLAGS = lastCFLAGS)
|
||||
conf.Result(rc)
|
||||
return rc
|
||||
|
||||
# check for user-supplied lock prefix
|
||||
def checkForLockPrefix(conf):
|
||||
conf.Message("checking for user supplied lockprefix... ")
|
||||
|
|
@ -108,13 +94,15 @@ main ()
|
|||
############ Start configuration ##############
|
||||
|
||||
from maintainer import checkForMaintainerMode
|
||||
conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
|
||||
from compilertest import checkForCCOption
|
||||
|
||||
conf = Configure(env,{'checkForCCOption':checkForCCOption,
|
||||
'MAINTAINER_MODE':checkForMaintainerMode,
|
||||
'checkForLockPrefix':checkForLockPrefix,
|
||||
'checkPrefix':checkForUserPrefix,
|
||||
'sizeOf':getVarSize
|
||||
})
|
||||
#check for GCC options
|
||||
# check for CC options
|
||||
for option in Split("""
|
||||
-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow
|
||||
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
|
||||
|
|
@ -128,7 +116,8 @@ for option in Split("""
|
|||
-Wpointer-arith -Wno-unused-parameter
|
||||
-Wunreachable-code
|
||||
"""):
|
||||
conf.checkForGCCOption(option)
|
||||
conf.checkForCCOption(option)
|
||||
|
||||
#portability build time config
|
||||
if conf.CheckFunc('srandomdev'):
|
||||
conf.env.Append(CPPFLAGS = '-DHAVE_SRANDOMDEV')
|
||||
|
|
|
|||
24
site_scons/compilertest.py
Normal file
24
site_scons/compilertest.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
# Scons compiler tester
|
||||
#
|
||||
# Version 1.0
|
||||
# 16-Jun-2009
|
||||
#
|
||||
|
||||
def checkForCCOption(conf,option):
|
||||
"""Checks if CC compiler supports given command line option.
|
||||
|
||||
Adds option to CCFLAGS option is supported by compiler.
|
||||
|
||||
"""
|
||||
conf.Message("checking whether %s supports %s " % (conf.env['CC'],option))
|
||||
lastCFLAGS=conf.env['CCFLAGS']
|
||||
conf.env.Append(CCFLAGS = option)
|
||||
rc = conf.TryCompile("""
|
||||
void dummy(void);
|
||||
void dummy(void) {}
|
||||
""",'.c')
|
||||
if not rc:
|
||||
conf.env.Replace(CCFLAGS = lastCFLAGS)
|
||||
conf.Result(rc)
|
||||
return rc
|
||||
Loading…
Reference in New Issue
Block a user