fix compiling of FS after Gabe's last compile
[gem5.git] / SConstruct
index b9a2defda51a365df3f6bb143f0345e9e1b4ae3c..0a3d6de027faf9239b4a77b2bd483e769d1d1977 100644 (file)
@@ -66,6 +66,7 @@
 # Python library imports
 import sys
 import os
+import subprocess
 from os.path import join as joinpath
 
 # Check for recent-enough Python and SCons versions.  If your system's
@@ -106,13 +107,6 @@ sys.path.append(joinpath(ROOT, 'src/python'))
 # Find default configuration & binary.
 Default(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
 
-# Ask SCons which directory it was invoked from.
-launch_dir = GetLaunchDir()
-
-# Make targets relative to invocation directory
-abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
-                  BUILD_TARGETS)
-
 # helper function: find last occurrence of element in list
 def rfind(l, elt, offs = -1):
     for i in range(len(l)+offs, 0, -1):
@@ -142,6 +136,19 @@ def compare_versions(v1, v2):
 # recognize that ALPHA_SE specifies the configuration because it
 # follow 'build' in the bulid path.
 
+# Generate absolute paths to targets so we can see where the build dir is
+if COMMAND_LINE_TARGETS:
+    # Ask SCons which directory it was invoked from
+    launch_dir = GetLaunchDir()
+    # Make targets relative to invocation directory
+    abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
+                      COMMAND_LINE_TARGETS)
+else:
+    # Default targets are relative to root of tree
+    abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
+                      DEFAULT_TARGETS)
+
+
 # Generate a list of the unique build roots and configs that the
 # collected targets reference.
 build_paths = []
@@ -200,11 +207,42 @@ if False:
 
 # M5_PLY is used by isa_parser.py to find the PLY package.
 env.Append(ENV = { 'M5_PLY' : 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, 
+        close_fds=True).communicate()[0].find('GCC') >= 0
+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, 
+        close_fds=True).communicate()[0].find('Intel') >= 0
+if env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
+    print 'Error: How can we have two at the same time?'
+    Exit(1)
+
 
 # Set up default C++ compiler flags
-env.Append(CCFLAGS='-pipe')
-env.Append(CCFLAGS='-fno-strict-aliasing')
-env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
+if env['GCC']:
+    env.Append(CCFLAGS='-pipe')
+    env.Append(CCFLAGS='-fno-strict-aliasing')
+    env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
+elif env['ICC']:
+    pass #Fix me... add warning flags once we clean up icc warnings
+elif env['SUNCC']:
+    env.Append(CCFLAGS='-Qoption ccfe')
+    env.Append(CCFLAGS='-features=gcc')
+    env.Append(CCFLAGS='-features=extensions')
+    env.Append(CCFLAGS='-library=stlport4')
+    env.Append(CCFLAGS='-xar')
+#    env.Append(CCFLAGS='-instances=semiexplicit')
+else:
+    print 'Error: Don\'t know what compiler options to use for your compiler.'
+    print '       Please fix SConstruct and src/SConscript and try again.'
+    Exit(1)
+
 if sys.platform == 'cygwin':
     # cygwin has some header file issues...
     env.Append(CCFLAGS=Split("-Wno-uninitialized"))
@@ -287,7 +325,7 @@ if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
 
 # Check for zlib.  If the check passes, libz will be automatically
 # added to the LIBS environment variable.
-if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++'):
+if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
     print 'Error: did not find needed zlib compression library '\
           'and/or zlib.h header file.'
     print '       Please install zlib and try again.'
@@ -325,7 +363,7 @@ if have_mysql:
 env = conf.Finish()
 
 # Define the universe of supported ISAs
-env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
+env['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips', 'x86']
 
 # Define the universe of supported CPU models
 env['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',