diff options
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/SConstruct b/SConstruct index 792cb7554..f7798b25e 100644 --- a/SConstruct +++ b/SConstruct @@ -424,11 +424,42 @@ scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re)) # replace the scanners list that has what we want env['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 + # Platform-specific configuration. Note again that we assume that all # builds under a given build root run on the same host platform. conf = Configure(env, conf_dir = joinpath(build_root, '.scons_config'), - log_file = joinpath(build_root, 'scons_config.log')) + log_file = joinpath(build_root, 'scons_config.log'), + custom_tests = { 'CheckLeading' : CheckLeading }) + +# 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: @@ -596,9 +627,6 @@ sticky_opts.AddOptions( BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False), - ('PYTHONHOME', - 'Override the default PYTHONHOME for this system (use with caution)', - '%s:%s' % (sys.prefix, sys.exec_prefix)), ) nonsticky_opts.AddOptions( @@ -609,7 +637,7 @@ nonsticky_opts.AddOptions( env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 'USE_MYSQL', 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', \ 'FAST_ALLOC_STATS', 'SS_COMPATIBLE_FP', \ - 'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA'] + 'USE_CHECKER', 'TARGET_ISA'] # Define a handy 'no-op' action def no_action(target, source, env): |