# replace the scanners list that has what we want
main['SCANNERS'] = scanners
-# Add a custom Check function to the Configure context so that we can
-# figure out if the compiler adds leading underscores to global
-# variables. This is needed for the autogenerated asm files that we
-# use for embedding the python code.
-def CheckLeading(context):
- context.Message("Checking for leading underscore in global variables...")
- # 1) Define a global variable called x from asm so the C compiler
- # won't change the symbol at all.
- # 2) Declare that variable.
- # 3) Use the variable
- #
- # If the compiler prepends an underscore, this will successfully
- # link because the external symbol 'x' will be called '_x' which
- # was defined by the asm statement. If the compiler does not
- # prepend an underscore, this will not successfully link because
- # '_x' will have been defined by assembly, while the C portion of
- # the code will be trying to use 'x'
- ret = context.TryLink('''
- asm(".globl _x; _x: .byte 0");
- extern int x;
- int main() { return x; }
- ''', extension=".c")
- context.env.Append(LEADING_UNDERSCORE=ret)
- context.Result(ret)
- return ret
-
# Add a custom Check function to test for structure members.
def CheckMember(context, include, decl, member, include_quotes="<>"):
context.Message("Checking for member %s in %s..." %
conf_dir = joinpath(build_root, '.scons_config'),
log_file = joinpath(build_root, 'scons_config.log'),
custom_tests = {
- 'CheckLeading' : CheckLeading,
'CheckMember' : CheckMember,
})
-# Check for leading underscores. Don't really need to worry either
-# way so don't need to check the return code.
-conf.CheckLeading()
-
# Check if we should compile a 64 bit binary on Mac OS X/Darwin
try:
import platform