Change everything to use the cached virtPort rather than created their own each time.
[gem5.git] / SConstruct
index 12f735a9dace5474a42a05e92f10539a1fcab360..792cb7554e86db973af5074e5b4b3fdab31334a9 100644 (file)
 #
 ###################################################
 
-# Python library imports
 import sys
 import os
-import subprocess
-from os.path import join as joinpath
+import re
+
+from os.path import isdir, isfile, join as joinpath
+
+import SCons
 
 # Check for recent-enough Python and SCons versions.  If your system's
 # default installation of Python is not recent enough, you can use a
@@ -77,16 +79,72 @@ from os.path import join as joinpath
 # scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
 EnsurePythonVersion(2,4)
 
-# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
-# 3-element version number.
-min_scons_version = (0,96,91)
-try:
-    EnsureSConsVersion(*min_scons_version)
-except:
-    print "Error checking current SCons version."
-    print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
-    Exit(2)
-    
+# Import subprocess after we check the version since it doesn't exist in
+# Python < 2.4.
+import subprocess
+
+# helper function: compare arrays or strings of version numbers.
+# E.g., compare_version((1,3,25), (1,4,1)')
+# returns -1, 0, 1 if v1 is <, ==, > v2
+def compare_versions(v1, v2):
+    def make_version_list(v):
+        if isinstance(v, (list,tuple)):
+            return v
+        elif isinstance(v, str):
+            return map(int, v.split('.'))
+        else:
+            raise TypeError
+
+    v1 = make_version_list(v1)
+    v2 = make_version_list(v2)
+    # Compare corresponding elements of lists
+    for n1,n2 in zip(v1, v2):
+        if n1 < n2: return -1
+        if n1 > n2: return  1
+    # all corresponding values are equal... see if one has extra values
+    if len(v1) < len(v2): return -1
+    if len(v1) > len(v2): return  1
+    return 0
+
+# SCons version numbers need special processing because they can have
+# charecters and an release date embedded in them. This function does
+# the magic to extract them in a similar way to the SCons internal function
+# function does and then checks that the current version is not contained in
+# a list of version tuples (bad_ver_strs)
+def CheckSCons(bad_ver_strs):
+    def scons_ver(v):
+        num_parts = v.split(' ')[0].split('.')
+        major = int(num_parts[0])
+        minor = int(re.match('\d+', num_parts[1]).group())
+        rev = 0
+        rdate = 0
+        if len(num_parts) > 2:
+            try: rev = int(re.match('\d+', num_parts[2]).group())
+            except: pass
+            rev_parts = num_parts[2].split('d')
+            if len(rev_parts) > 1:
+                rdate = int(re.match('\d+', rev_parts[1]).group())
+
+        return (major, minor, rev, rdate)
+
+    sc_ver = scons_ver(SCons.__version__)
+    for bad_ver in bad_ver_strs:
+        bv = (scons_ver(bad_ver[0]), scons_ver(bad_ver[1]))
+        if  compare_versions(sc_ver, bv[0]) != -1 and\
+            compare_versions(sc_ver, bv[1]) != 1:
+            print "The version of SCons that you have installed: ", SCons.__version__
+            print "has a bug that prevents it from working correctly with M5."
+            print "Please install a version NOT contained within the following",
+            print "ranges (inclusive):"
+            for bad_ver in bad_ver_strs:
+                print "    %s - %s" % bad_ver
+            Exit(2)
+
+CheckSCons(( 
+    # We need a version that is 0.96.91 or newer
+    ('0.0.0', '0.96.90'), 
+    ))
+
 
 # The absolute path to the current directory (where this file lives).
 ROOT = Dir('.').abspath
@@ -97,6 +155,34 @@ SRCDIR = joinpath(ROOT, 'src')
 # tell python where to find m5 python code
 sys.path.append(joinpath(ROOT, 'src/python'))
 
+def check_style_hook(ui):
+    ui.readconfig(joinpath(ROOT, '.hg', 'hgrc'))
+    style_hook = ui.config('hooks', 'pretxncommit.style', None)
+
+    if not style_hook:
+        print """\
+You're missing the M5 style hook.
+Please install the hook so we can ensure that all code fits a common style.
+
+All you'd need to do is add the following lines to your repository .hg/hgrc
+or your personal .hgrc
+----------------
+
+[extensions]
+style = %s/util/style.py
+
+[hooks]
+pretxncommit.style = python:style.check_whitespace
+""" % (ROOT)
+        sys.exit(1)
+
+if ARGUMENTS.get('IGNORE_STYLE') != 'True' and isdir(joinpath(ROOT, '.hg')):
+    try:
+        from mercurial import ui
+        check_style_hook(ui.ui())
+    except ImportError:
+        pass
+
 ###################################################
 #
 # Figure out which configurations to set up based on the path(s) of
@@ -114,22 +200,6 @@ def rfind(l, elt, offs = -1):
             return i
     raise ValueError, "element not found"
 
-# helper function: compare dotted version numbers.
-# E.g., compare_version('1.3.25', '1.4.1')
-# returns -1, 0, 1 if v1 is <, ==, > v2
-def compare_versions(v1, v2):
-    # Convert dotted strings to lists
-    v1 = map(int, v1.split('.'))
-    v2 = map(int, v2.split('.'))
-    # Compare corresponding elements of lists
-    for n1,n2 in zip(v1, v2):
-        if n1 < n2: return -1
-        if n1 > n2: return  1
-    # all corresponding values are equal... see if one has extra values
-    if len(v1) < len(v2): return -1
-    if len(v1) > len(v2): return  1
-    return 0
-
 # Each target must have 'build' in the interior of the path; the
 # directory below this will determine the build parameters.  For
 # example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
@@ -172,6 +242,10 @@ for t in abs_targets:
     if build_path not in build_paths:
         build_paths.append(build_path)
 
+# Make sure build_root exists (might not if this is the first build there)
+if not isdir(build_root):
+    os.mkdir(build_root)
+
 ###################################################
 #
 # Set up the default build environment.  This environment is copied
@@ -183,13 +257,7 @@ env = Environment(ENV = os.environ,  # inherit user's environment vars
                   ROOT = ROOT,
                   SRCDIR = SRCDIR)
 
-#Parse CC/CXX early so that we use the correct compiler for 
-# to test for dependencies/versions/libraries/includes
-if ARGUMENTS.get('CC', None):
-    env['CC'] = ARGUMENTS.get('CC')
-
-if ARGUMENTS.get('CXX', None):
-    env['CXX'] = ARGUMENTS.get('CXX')
+Export('env')
 
 env.SConsignFile(joinpath(build_root,"sconsign"))
 
@@ -205,21 +273,78 @@ env.SetOption('duplicate', 'soft-copy')
 if False:
     env.TargetSignatures('content')
 
+#
+# Set up global sticky options... these are common to an entire build
+# tree (not specific to a particular build like ALPHA_SE)
+#
+
+# Option validators & converters for global sticky options
+def PathListMakeAbsolute(val):
+    if not val:
+        return val
+    f = lambda p: os.path.abspath(os.path.expanduser(p))
+    return ':'.join(map(f, val.split(':')))
+
+def PathListAllExist(key, val, env):
+    if not val:
+        return
+    paths = val.split(':')
+    for path in paths:
+        if not isdir(path):
+            raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
+
+global_sticky_opts_file = joinpath(build_root, 'options.global')
+
+global_sticky_opts = Options(global_sticky_opts_file, args=ARGUMENTS)
+
+global_sticky_opts.AddOptions(
+    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
+    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
+    ('BATCH', 'Use batch pool for build and tests', False),
+    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
+    ('EXTRAS', 'Add Extra directories to the compilation', '',
+     PathListAllExist, PathListMakeAbsolute)
+    )    
+
+
+# base help text
+help_text = '''
+Usage: scons [scons options] [build options] [target(s)]
+
+'''
+
+help_text += "Global sticky options:\n" \
+             + global_sticky_opts.GenerateHelpText(env)
+
+# Update env with values from ARGUMENTS & file global_sticky_opts_file
+global_sticky_opts.Update(env)
+
+# Save sticky option settings back to current options file
+global_sticky_opts.Save(global_sticky_opts_file, env)
+
+# Parse EXTRAS option to build list of all directories where we're
+# look for sources etc.  This list is exported as base_dir_list.
+base_dir_list = [joinpath(ROOT, 'src')]
+if env['EXTRAS']:
+    base_dir_list += env['EXTRAS'].split(':')
+
+Export('base_dir_list')
+
 # M5_PLY is used by isa_parser.py to find the PLY package.
-env.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
+env.Append(ENV = { 'M5_PLY' : str(Dir('ext/ply')) })
 env['GCC'] = False
 env['SUNCC'] = False
 env['ICC'] = False
-env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 
-        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
+env['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True,
+        stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
         close_fds=True).communicate()[0].find('GCC') >= 0
-env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
-        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
+env['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
+        stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
         close_fds=True).communicate()[0].find('Sun C++') >= 0
-env['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
-        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
+env['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True,
+        stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
         close_fds=True).communicate()[0].find('Intel') >= 0
-if env['GCC'] + env['SUNCC'] env['ICC'] > 1:
+if env['GCC'] + env['SUNCC'] env['ICC'] > 1:
     print 'Error: How can we have two at the same time?'
     Exit(1)
 
@@ -243,6 +368,12 @@ else:
     print '       Please fix SConstruct and src/SConscript and try again.'
     Exit(1)
 
+# Do this after we save setting back, or else we'll tack on an
+# extra 'qdo' every time we run scons.
+if env['BATCH']:
+    env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
+    env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
+
 if sys.platform == 'cygwin':
     # cygwin has some header file issues...
     env.Append(CCFLAGS=Split("-Wno-uninitialized"))
@@ -257,7 +388,8 @@ if not env.has_key('SWIG'):
 # Check for appropriate SWIG version
 swig_version = os.popen('swig -version').read().split()
 # First 3 words should be "SWIG Version x.y.z"
-if swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
+if len(swig_version) < 3 or \
+        swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
     print 'Error determining SWIG version.'
     Exit(1)
 
@@ -268,16 +400,29 @@ if compare_versions(swig_version[2], min_swig_version) < 0:
     Exit(1)
 
 # Set up SWIG flags & scanner
-env.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
+swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
+env.Append(SWIGFLAGS=swig_flags)
 
-import SCons.Scanner
+# filter out all existing swig scanners, they mess up the dependency
+# stuff for some reason
+scanners = []
+for scanner in env['SCANNERS']:
+    skeys = scanner.skeys
+    if skeys == '.i':
+        continue
 
-swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
+    if isinstance(skeys, (list, tuple)) and '.i' in skeys:
+        continue
 
-swig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
-                                        swig_inc_re)
+    scanners.append(scanner)
 
-env.Append(SCANNERS = swig_scanner)
+# add the new swig scanner that we like better
+from SCons.Scanner import ClassicCPP as CPPScanner
+swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
+scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
+
+# replace the scanners list that has what we want
+env['SCANNERS'] = scanners
 
 # Platform-specific configuration.  Note again that we assume that all
 # builds under a given build root run on the same host platform.
@@ -285,6 +430,40 @@ conf = Configure(env,
                  conf_dir = joinpath(build_root, '.scons_config'),
                  log_file = joinpath(build_root, 'scons_config.log'))
 
+# Check if we should compile a 64 bit binary on Mac OS X/Darwin
+try:
+    import platform
+    uname = platform.uname()
+    if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0:
+        if int(subprocess.Popen('sysctl -n hw.cpu64bit_capable', shell=True,
+               stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+               close_fds=True).communicate()[0][0]):
+            env.Append(CCFLAGS='-arch x86_64')
+            env.Append(CFLAGS='-arch x86_64')
+            env.Append(LINKFLAGS='-arch x86_64')
+            env.Append(ASFLAGS='-arch x86_64')
+except:
+    pass
+
+# Recent versions of scons substitute a "Null" object for Configure()
+# when configuration isn't necessary, e.g., if the "--help" option is
+# present.  Unfortuantely this Null object always returns false,
+# breaking all our configuration checks.  We replace it with our own
+# more optimistic null object that returns True instead.
+if not conf:
+    def NullCheck(*args, **kwargs):
+        return True
+
+    class NullConf:
+        def __init__(self, env):
+            self.env = env
+        def Finish(self):
+            return self.env
+        def __getattr__(self, mname):
+            return NullCheck
+
+    conf = NullConf(env)
+
 # Find Python include and library directories for embedding the
 # interpreter.  For consistency, we will use the same Python
 # installation used to run scons (and thus this script).  If you want
@@ -363,31 +542,49 @@ if have_mysql:
 env = conf.Finish()
 
 # Define the universe of supported ISAs
-env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
+all_isa_list = [ ]
+Export('all_isa_list')
 
 # Define the universe of supported CPU models
-env['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',
-                       'O3CPU', 'OzoneCPU']
-
-if os.path.isdir(joinpath(SRCDIR, 'encumbered/cpu/full')):
-    env['ALL_CPU_LIST'] += ['FullCPU']
+all_cpu_list = [ ]
+default_cpus = [ ]
+Export('all_cpu_list', 'default_cpus')
 
 # Sticky options get saved in the options file so they persist from
 # one invocation to the next (unless overridden, in which case the new
 # value becomes sticky).
 sticky_opts = Options(args=ARGUMENTS)
+Export('sticky_opts')
+
+# Non-sticky options only apply to the current build.
+nonsticky_opts = Options(args=ARGUMENTS)
+Export('nonsticky_opts')
+
+# Walk the tree and execute all SConsopts scripts that wil add to the
+# above options
+for base_dir in base_dir_list:
+    for root, dirs, files in os.walk(base_dir):
+        if 'SConsopts' in files:
+            print "Reading", joinpath(root, 'SConsopts')
+            SConscript(joinpath(root, 'SConsopts'))
+
+all_isa_list.sort()
+all_cpu_list.sort()
+default_cpus.sort()
+
 sticky_opts.AddOptions(
-    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', env['ALL_ISA_LIST']),
+    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
     BoolOption('FULL_SYSTEM', 'Full-system support', False),
     # There's a bug in scons 0.96.1 that causes ListOptions with list
     # values (more than one value) not to be able to be restored from
     # a saved option file.  If this causes trouble then upgrade to
     # scons 0.96.90 or later.
-    ListOption('CPU_MODELS', 'CPU models', 'AtomicSimpleCPU,TimingSimpleCPU,O3CPU',
-               env['ALL_CPU_LIST']),
-    BoolOption('ALPHA_TLASER',
-               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
+    ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list),
     BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
+    BoolOption('FAST_ALLOC_DEBUG', 'Enable fast object allocator debugging',
+               False),
+    BoolOption('FAST_ALLOC_STATS', 'Enable fast object allocator statistics',
+               False),
     BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
                False),
     BoolOption('SS_COMPATIBLE_FP',
@@ -399,24 +596,19 @@ 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),
-    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
-    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
-    BoolOption('BATCH', 'Use batch pool for build and tests', False),
-    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
     ('PYTHONHOME',
      'Override the default PYTHONHOME for this system (use with caution)',
-     '%s:%s' % (sys.prefix, sys.exec_prefix))
+     '%s:%s' % (sys.prefix, sys.exec_prefix)),
     )
 
-# Non-sticky options only apply to the current build.
-nonsticky_opts = Options(args=ARGUMENTS)
 nonsticky_opts.AddOptions(
     BoolOption('update_ref', 'Update test reference outputs', False)
     )
 
 # These options get exported to #defines in config/*.hh (see src/SConscript).
 env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
-                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
+                     'USE_MYSQL', 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', \
+                     'FAST_ALLOC_STATS', 'SS_COMPATIBLE_FP', \
                      'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
 
 # Define a handy 'no-op' action
@@ -463,7 +655,7 @@ def config_emitter(target, source, env):
         val = int(val)
     elif isinstance(val, str):
         val = '"' + val + '"'
-        
+
     # Sources are option name & value (packaged in SCons Value nodes)
     return ([target], [Value(option), Value(val)])
 
@@ -497,12 +689,6 @@ concat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
 env.Append(BUILDERS = { 'Concat' : concat_builder })
 
 
-# base help text
-help_text = '''
-Usage: scons [scons options] [build options] [target(s)]
-
-'''
-
 # libelf build is shared across all configs in the build root.
 env.SConscript('ext/libelf/SConscript',
                build_dir = joinpath(build_root, 'libelf'),
@@ -514,27 +700,28 @@ env.SConscript('ext/libelf/SConscript',
 #
 ###################################################
 
+env['ALL_ISA_LIST'] = all_isa_list
 def make_switching_dir(dirname, switch_headers, env):
     # Generate the header.  target[0] is the full path of the output
     # header to generate.  'source' is a dummy variable, since we get the
     # list of ISAs from env['ALL_ISA_LIST'].
     def gen_switch_hdr(target, source, env):
-       fname = str(target[0])
-       basename = os.path.basename(fname)
-       f = open(fname, 'w')
-       f.write('#include "arch/isa_specific.hh"\n')
-       cond = '#if'
-       for isa in env['ALL_ISA_LIST']:
-           f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
-                   % (cond, isa.upper(), dirname, isa, basename))
-           cond = '#elif'
-       f.write('#else\n#error "THE_ISA not set"\n#endif\n')
-       f.close()
-       return 0
+        fname = str(target[0])
+        basename = os.path.basename(fname)
+        f = open(fname, 'w')
+        f.write('#include "arch/isa_specific.hh"\n')
+        cond = '#if'
+        for isa in all_isa_list:
+            f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
+                    % (cond, isa.upper(), dirname, isa, basename))
+            cond = '#elif'
+        f.write('#else\n#error "THE_ISA not set"\n#endif\n')
+        f.close()
+        return 0
 
     # String to print when generating header
     def gen_switch_hdr_string(target, source, env):
-       return "Generating switch header " + str(target[0])
+        return "Generating switch header " + str(target[0])
 
     # Build SCons Action object. 'varlist' specifies env vars that this
     # action depends on; when env['ALL_ISA_LIST'] changes these actions
@@ -545,8 +732,7 @@ def make_switching_dir(dirname, switch_headers, env):
     # Instantiate actions for each header
     for hdr in switch_headers:
         env.Command(hdr, [], switch_hdr_action)
-
-env.make_switching_dir = make_switching_dir
+Export('make_switching_dir')
 
 ###################################################
 #
@@ -559,11 +745,14 @@ base_env = env
 
 for build_path in build_paths:
     print "Building in", build_path
+
+    # Make a copy of the build-root environment to use for this config.
+    env = base_env.Copy()
+    env['BUILDDIR'] = build_path
+
     # build_dir is the tail component of build path, and is used to
     # determine the build parameters (e.g., 'ALPHA_SE')
     (build_root, build_dir) = os.path.split(build_path)
-    # Make a copy of the build-root environment to use for this config.
-    env = base_env.Copy()
 
     # Set env options according to the build directory config.
     sticky_opts.files = []
@@ -571,7 +760,7 @@ for build_path in build_paths:
     # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
     # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
     current_opts_file = joinpath(build_root, 'options', build_dir)
-    if os.path.isfile(current_opts_file):
+    if isfile(current_opts_file):
         sticky_opts.files.append(current_opts_file)
         print "Using saved options file %s" % current_opts_file
     else:
@@ -579,7 +768,7 @@ for build_path in build_paths:
 
         # Make sure the directory is there so we can create it later
         opt_dir = os.path.dirname(current_opts_file)
-        if not os.path.isdir(opt_dir):
+        if not isdir(opt_dir):
             os.mkdir(opt_dir)
 
         # Get default build options from source tree.  Options are
@@ -587,7 +776,7 @@ for build_path in build_paths:
         # overriden by 'default=' arg on command line.
         default_opts_file = joinpath('build_opts',
                                      ARGUMENTS.get('default', build_dir))
-        if os.path.isfile(default_opts_file):
+        if isfile(default_opts_file):
             sticky_opts.files.append(default_opts_file)
             print "Options file %s not found,\n  using defaults in %s" \
                   % (current_opts_file, default_opts_file)
@@ -600,7 +789,7 @@ for build_path in build_paths:
     sticky_opts.Update(env)
     nonsticky_opts.Update(env)
 
-    help_text += "Sticky options for %s:\n" % build_dir \
+    help_text += "\nSticky options for %s:\n" % build_dir \
                  + sticky_opts.GenerateHelpText(env) \
                  + "\nNon-sticky options for %s:\n" % build_dir \
                  + nonsticky_opts.GenerateHelpText(env)
@@ -632,12 +821,6 @@ for build_path in build_paths:
     # Save sticky option settings back to current options file
     sticky_opts.Save(current_opts_file, env)
 
-    # Do this after we save setting back, or else we'll tack on an
-    # extra 'qdo' every time we run scons.
-    if env['BATCH']:
-        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
-        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
-
     if env['USE_SSE2']:
         env.Append(CCFLAGS='-msse2')