summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorStian Hvatum <stian@dream-web.no>2014-04-10 13:40:15 -0500
committerStian Hvatum <stian@dream-web.no>2014-04-10 13:40:15 -0500
commit698c4c792d9dfbf7ade3dee68ce4993c596cc17d (patch)
tree63a418b9ebabd30162cbb2db85f1692d3a792c7a /SConstruct
parent02b51afb7e6b250b4cd964cd447e71bd4f31236d (diff)
downloadgem5-698c4c792d9dfbf7ade3dee68ce4993c596cc17d.tar.xz
scons: compile on systems where python2 and python3 co-exist
Compile gem5 on systems where python2 and python3 co-exists without any changes in path. python2-config is chosen over python-config if it exists. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct9
1 files changed, 7 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index 2eafb6e6a..ff36fbccd 100755
--- a/SConstruct
+++ b/SConstruct
@@ -872,7 +872,12 @@ if main['M5_BUILD_CACHE']:
# we add them explicitly below. If you want to link in an alternate
# version of python, see above for instructions on how to invoke
# scons with the appropriate PATH set.
-py_includes = readCommand(['python-config', '--includes'],
+#
+# First we check if python2-config exists, else we use python-config
+python_config = readCommand(['which', 'python2-config'], exception='').strip()
+if not os.path.exists(python_config):
+ python_config = readCommand(['which', 'python-config'], exception='')
+py_includes = readCommand([python_config, '--includes'],
exception='').split()
# Strip the -I from the include folders before adding them to the
# CPPPATH
@@ -880,7 +885,7 @@ main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes))
# Read the linker flags and split them into libraries and other link
# flags. The libraries are added later through the call the CheckLib.
-py_ld_flags = readCommand(['python-config', '--ldflags'], exception='').split()
+py_ld_flags = readCommand([python_config, '--ldflags'], exception='').split()
py_libs = []
for lib in py_ld_flags:
if not lib.startswith('-l'):