summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-11-08 17:45:58 -0500
committerAli Saidi <saidi@eecs.umich.edu>2007-11-08 17:45:58 -0500
commitc01421a82dcbb6b26540461c88a7cae06e38c9c2 (patch)
tree9900472f37509a014df588c64b69926f1dc5ebff
parent067302968967cf74a9c9ed8fb81e1f53c6ead176 (diff)
downloadgem5-c01421a82dcbb6b26540461c88a7cae06e38c9c2.tar.xz
Compiling: If possible compile a 64 bit binary on Mac OS X.
--HG-- extra : convert_revision : 23d7c3744bfb20adaa31c999e0478e9055b4f657
-rw-r--r--SConstruct20
1 files changed, 19 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 4bd787b1d..c87ac50f5 100644
--- a/SConstruct
+++ b/SConstruct
@@ -65,7 +65,6 @@
import sys
import os
-import subprocess
from os.path import isdir, join as joinpath
@@ -77,6 +76,10 @@ from os.path import isdir, join as joinpath
# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
EnsurePythonVersion(2,4)
+# Import subprocess after we check the version since it doesn't exist in
+# Python < 2.4.
+import subprocess
+
# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
# 3-element version number.
min_scons_version = (0,96,91)
@@ -329,6 +332,21 @@ 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,