compiler options test externalised
This commit is contained in:
parent
f87cfcc407
commit
93618dd883
25
SConstruct
25
SConstruct
|
|
@ -38,20 +38,6 @@ env.Replace(CCFLAGS = str(env['CCFLAGS']).split(' '))
|
||||||
|
|
||||||
#################### Tests ###################
|
#################### 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
|
# check for user-supplied lock prefix
|
||||||
def checkForLockPrefix(conf):
|
def checkForLockPrefix(conf):
|
||||||
conf.Message("checking for user supplied lockprefix... ")
|
conf.Message("checking for user supplied lockprefix... ")
|
||||||
|
|
@ -105,16 +91,18 @@ main ()
|
||||||
conf.Result(rc)
|
conf.Result(rc)
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
############ Start configuration ##############
|
############ Start configuration ##############
|
||||||
|
|
||||||
from maintainer import checkForMaintainerMode
|
from maintainer import checkForMaintainerMode
|
||||||
conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
|
from compilertest import checkForCCOption
|
||||||
|
|
||||||
|
conf = Configure(env,{'checkForCCOption':checkForCCOption,
|
||||||
'MAINTAINER_MODE':checkForMaintainerMode,
|
'MAINTAINER_MODE':checkForMaintainerMode,
|
||||||
'checkForLockPrefix':checkForLockPrefix,
|
'checkForLockPrefix':checkForLockPrefix,
|
||||||
'checkPrefix':checkForUserPrefix,
|
'checkPrefix':checkForUserPrefix,
|
||||||
'sizeOf':getVarSize
|
'sizeOf':getVarSize
|
||||||
})
|
})
|
||||||
#check for GCC options
|
# check for CC options
|
||||||
for option in Split("""
|
for option in Split("""
|
||||||
-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow
|
-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow
|
||||||
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
|
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
|
||||||
|
|
@ -128,7 +116,8 @@ for option in Split("""
|
||||||
-Wpointer-arith -Wno-unused-parameter
|
-Wpointer-arith -Wno-unused-parameter
|
||||||
-Wunreachable-code
|
-Wunreachable-code
|
||||||
"""):
|
"""):
|
||||||
conf.checkForGCCOption(option)
|
conf.checkForCCOption(option)
|
||||||
|
|
||||||
#portability build time config
|
#portability build time config
|
||||||
if conf.CheckFunc('srandomdev'):
|
if conf.CheckFunc('srandomdev'):
|
||||||
conf.env.Append(CPPFLAGS = '-DHAVE_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