fix compiling of FS after Gabe's last compile
[gem5.git] / SConstruct
index 7e8c6c2f032247770c086e22a7df80a9d895956f..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
@@ -206,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"))
@@ -293,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.'
@@ -331,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',