1# -*- mode:python -*- 2 |
3# Copyright (c) 2013 ARM Limited 4# All rights reserved. 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating 9# to a hardware implementation of the functionality of the software 10# licensed hereunder. You may use the software subject to the license 11# terms below provided that you ensure that this notice is replicated 12# unmodified and in its entirety in all distributions of the software, 13# modified or unmodified, in source code or in binary form. 14# |
15# Copyright (c) 2011 Advanced Micro Devices, Inc. 16# Copyright (c) 2009 The Hewlett-Packard Development Company 17# Copyright (c) 2004-2005 The Regents of The University of Michigan 18# All rights reserved. 19# 20# Redistribution and use in source and binary forms, with or without 21# modification, are permitted provided that the following conditions are 22# met: redistributions of source code must retain the above copyright --- 65 unchanged lines hidden (view full) --- 88 EnsureSConsVersion(0, 98, 1) 89except SystemExit, e: 90 print """ 91For more details, see: 92 http://gem5.org/Dependencies 93""" 94 raise 95 |
96# We ensure the python version early because because python-config 97# requires python 2.5 |
98try: |
99 EnsurePythonVersion(2, 5) |
100except SystemExit, e: 101 print """ 102You can use a non-default installation of the Python interpreter by |
103rearranging your PATH so that scons finds the non-default 'python' and 104'python-config' first. |
105 106For more details, see: 107 http://gem5.org/wiki/index.php/Using_a_non-default_Python_installation 108""" 109 raise 110 111# Global Python includes 112import os --- 720 unchanged lines hidden (view full) --- 833 self.env = env 834 def Finish(self): 835 return self.env 836 def __getattr__(self, mname): 837 return NullCheck 838 839 conf = NullConf(main) 840 |
841# Cache build files in the supplied directory. 842if main['M5_BUILD_CACHE']: 843 print 'Using build cache located at', main['M5_BUILD_CACHE'] 844 CacheDir(main['M5_BUILD_CACHE']) 845 |
846# Find Python include and library directories for embedding the 847# interpreter. We rely on python-config to resolve the appropriate 848# includes and linker flags. ParseConfig does not seem to understand 849# the more exotic linker flags such as -Xlinker and -export-dynamic so 850# we add them explicitly below. If you want to link in an alternate 851# version of python, see above for instructions on how to invoke 852# scons with the appropriate PATH set. 853py_includes = readCommand(['python-config', '--includes'], 854 exception='').split() 855# Strip the -I from the include folders before adding them to the 856# CPPPATH 857main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes)) |
858 |
859# Read the linker flags and split them into libraries and other link 860# flags. The libraries are added later through the call the CheckLib. 861py_ld_flags = readCommand(['python-config', '--ldflags'], exception='').split() 862py_libs = [] 863for lib in py_ld_flags: 864 if not lib.startswith('-l'): 865 main.Append(LINKFLAGS=[lib]) 866 else: 867 lib = lib[2:] 868 if lib not in py_libs: 869 py_libs.append(lib) 870 |
871# verify that this stuff works 872if not conf.CheckHeader('Python.h', '<>'): 873 print "Error: can't find Python.h header in", py_includes 874 print "Install Python headers (package python-dev on Ubuntu and RedHat)" 875 Exit(1) 876 877for lib in py_libs: 878 if not conf.CheckLib(lib): --- 381 unchanged lines hidden --- |