1# -*- mode:python -*- 2 3# Copyright (c) 2009 The Hewlett-Packard Development Company 4# Copyright (c) 2004-2005 The Regents of The University of Michigan 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions are --- 82 unchanged lines hidden (view full) --- 91'python' first or (2) explicitly invoking an alternative interpreter 92on the scons script. 93 94For more details, see: 95 http://m5sim.org/wiki/index.php/Using_a_non-default_Python_installation 96""" 97 raise 98 |
99# Global Python includes |
100import os 101import re 102import subprocess 103import sys 104 105from os import mkdir, environ 106from os.path import abspath, basename, dirname, expanduser, normpath 107from os.path import exists, isdir, isfile 108from os.path import join as joinpath, split as splitpath 109 |
110# SCons includes |
111import SCons 112import SCons.Node 113 |
114# M5 includes 115sys.path[1:1] = [ Dir('src/python').srcnode().abspath ] |
116 |
117from m5.util import compareVersions, readCommand |
118 |
119######################################################################## 120# 121# Set up the main build environment. 122# 123######################################################################## 124use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 'PATH', 125 'RANLIB' ]) 126 --- 45 unchanged lines hidden (view full) --- 172run the style hook. It is important. 173""" 174 175hg_info = "Unknown" 176if hgdir.exists(): 177 # 1) Grab repository revision if we know it. 178 cmd = "hg id -n -i -t -b" 179 try: |
180 hg_info = readCommand(cmd, cwd=main.root.abspath).strip() |
181 except OSError: 182 print mercurial_bin_not_found 183 184 # 2) Ensure that the style hook is in place. 185 try: 186 ui = None 187 if ARGUMENTS.get('IGNORE_STYLE') != 'True': 188 from mercurial import ui --- 147 unchanged lines hidden (view full) --- 336Export('extras_dir_list') 337 338# the ext directory should be on the #includes path 339main.Append(CPPPATH=[Dir('ext')]) 340 341# M5_PLY is used by isa_parser.py to find the PLY package. 342main.Append(ENV = { 'M5_PLY' : Dir('ext/ply').abspath }) 343 |
344CXX_version = readCommand([main['CXX'],'--version'], exception=False) 345CXX_V = readCommand([main['CXX'],'-V'], exception=False) |
346 347main['GCC'] = CXX_version and CXX_version.find('g++') >= 0 348main['SUNCC'] = CXX_V and CXX_V.find('Sun C++') >= 0 349main['ICC'] = CXX_V and CXX_V.find('Intel') >= 0 350if main['GCC'] + main['SUNCC'] + main['ICC'] > 1: 351 print 'Error: How can we have two at the same time?' 352 Exit(1) 353 --- 36 unchanged lines hidden (view full) --- 390 391# Check for SWIG 392if not main.has_key('SWIG'): 393 print 'Error: SWIG utility not found.' 394 print ' Please install (see http://www.swig.org) and retry.' 395 Exit(1) 396 397# Check for appropriate SWIG version |
398swig_version = readCommand(('swig', '-version'), exception='').split() |
399# First 3 words should be "SWIG Version x.y.z" 400if len(swig_version) < 3 or \ 401 swig_version[0] != 'SWIG' or swig_version[1] != 'Version': 402 print 'Error determining SWIG version.' 403 Exit(1) 404 405min_swig_version = '1.3.28' |
406if compareVersions(swig_version[2], min_swig_version) < 0: |
407 print 'Error: SWIG version', min_swig_version, 'or newer required.' 408 print ' Installed version:', swig_version[2] 409 Exit(1) 410 411# Set up SWIG flags & scanner 412swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS') 413main.Append(SWIGFLAGS=swig_flags) 414 --- 54 unchanged lines hidden (view full) --- 469# Check for leading underscores. Don't really need to worry either 470# way so don't need to check the return code. 471conf.CheckLeading() 472 473# Check if we should compile a 64 bit binary on Mac OS X/Darwin 474try: 475 import platform 476 uname = platform.uname() |
477 if uname[0] == 'Darwin' and compareVersions(uname[2], '9.0.0') >= 0: 478 if int(readCommand('sysctl -n hw.cpu64bit_capable')[0]): |
479 main.Append(CCFLAGS='-arch x86_64') 480 main.Append(CFLAGS='-arch x86_64') 481 main.Append(LINKFLAGS='-arch x86_64') 482 main.Append(ASFLAGS='-arch x86_64') 483except: 484 pass 485 486# Recent versions of scons substitute a "Null" object for Configure() --- 83 unchanged lines hidden (view full) --- 570# 571# Check for mysql. 572# 573mysql_config = WhereIs('mysql_config') 574have_mysql = bool(mysql_config) 575 576# Check MySQL version. 577if have_mysql: |
578 mysql_version = readCommand(mysql_config + ' --version') |
579 min_mysql_version = '4.1' |
580 if compareVersions(mysql_version, min_mysql_version) < 0: |
581 print 'Warning: MySQL', min_mysql_version, 'or newer required.' 582 print ' Version', mysql_version, 'detected.' 583 have_mysql = False 584 585# Set up mysql_config commands. 586if have_mysql: 587 mysql_config_include = mysql_config + ' --include' 588 if os.system(mysql_config_include + ' > /dev/null') != 0: --- 278 unchanged lines hidden --- |