1# -*- mode:python -*- 2 3# Copyright (c) 2011 Advanced Micro Devices, Inc. 4# Copyright (c) 2009 The Hewlett-Packard Development Company 5# Copyright (c) 2004-2005 The Regents of The University of Michigan 6# All rights reserved. 7# 8# Redistribution and use in source and binary forms, with or without --- 502 unchanged lines hidden (view full) --- 511main['GCC'] = CXX_version and CXX_version.find('g++') >= 0 512main['CLANG'] = CXX_version and CXX_version.find('clang') >= 0 513if main['GCC'] + main['CLANG'] > 1: 514 print 'Error: How can we have two at the same time?' 515 Exit(1) 516 517# Set up default C++ compiler flags 518if main['GCC']: |
519 # Check for a supported version of gcc, >= 4.4 is needed for c++0x 520 # support. See http://gcc.gnu.org/projects/cxx0x.html for details 521 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False) 522 if compareVersions(gcc_version, "4.4") < 0: 523 print 'Error: gcc version 4.4 or newer required.' 524 print ' Installed version:', gcc_version 525 Exit(1) 526 527 main['GCC_VERSION'] = gcc_version |
528 main.Append(CCFLAGS=['-pipe']) 529 main.Append(CCFLAGS=['-fno-strict-aliasing']) 530 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef']) |
531 main.Append(CXXFLAGS=['-std=c++0x']) 532 533 # Check for versions with bugs |
534 if not compareVersions(gcc_version, '4.4.1') or \ 535 not compareVersions(gcc_version, '4.4.2'): 536 print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.' 537 main.Append(CCFLAGS=['-fno-tree-vectorize']) |
538 539 # LTO support is only really working properly from 4.6 and beyond 540 if compareVersions(gcc_version, '4.6') >= 0: 541 # Add the appropriate Link-Time Optimization (LTO) flags 542 # unless LTO is explicitly turned off. Note that these flags 543 # are only used by the fast target. 544 if not GetOption('no_lto'): 545 # Pass the LTO flag when compiling to produce GIMPLE 546 # output, we merely create the flags here and only append 547 # them later/ 548 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')] 549 550 # Use the same amount of jobs for LTO as we are running 551 # scons with, we hardcode the use of the linker plugin 552 # which requires either gold or GNU ld >= 2.21 553 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'), 554 '-fuse-linker-plugin'] 555 556elif main['CLANG']: |
557 # Check for a supported version of clang, >= 2.9 is needed to 558 # support similar features as gcc 4.4. See 559 # http://clang.llvm.org/cxx_status.html for details |
560 clang_version_re = re.compile(".* version (\d+\.\d+)") 561 clang_version_match = clang_version_re.match(CXX_version) 562 if (clang_version_match): 563 clang_version = clang_version_match.groups()[0] 564 if compareVersions(clang_version, "2.9") < 0: 565 print 'Error: clang version 2.9 or newer required.' 566 print ' Installed version:', clang_version 567 Exit(1) --- 4 unchanged lines hidden (view full) --- 572 main.Append(CCFLAGS=['-pipe']) 573 main.Append(CCFLAGS=['-fno-strict-aliasing']) 574 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef']) 575 main.Append(CCFLAGS=['-Wno-tautological-compare']) 576 main.Append(CCFLAGS=['-Wno-self-assign']) 577 # Ruby makes frequent use of extraneous parantheses in the printing 578 # of if-statements 579 main.Append(CCFLAGS=['-Wno-parentheses']) |
580 main.Append(CXXFLAGS=['-std=c++0x']) 581 # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as 582 # opposed to libstdc++ to make the transition from TR1 to 583 # C++11. See http://libcxx.llvm.org. However, clang has chosen a 584 # strict implementation of the C++11 standard, and does not allow 585 # incomplete types in template arguments (besides unique_ptr and 586 # shared_ptr), and the libc++ STL containers create problems in 587 # combination with the current gem5 code. For now, we stick with 588 # libstdc++ and use the TR1 namespace. 589 # if sys.platform == "darwin": 590 # main.Append(CXXFLAGS=['-stdlib=libc++']) |
591 |
592else: 593 print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal, 594 print "Don't know what compiler options to use for your compiler." 595 print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX'] 596 print termcap.Yellow + ' version:' + termcap.Normal, 597 if not CXX_version: 598 print termcap.Yellow + termcap.Bold + "COMMAND NOT FOUND!" +\ 599 termcap.Normal --- 119 unchanged lines hidden (view full) --- 719 asm(".globl _x; _x: .byte 0"); 720 extern int x; 721 int main() { return x; } 722 ''', extension=".c") 723 context.env.Append(LEADING_UNDERSCORE=ret) 724 context.Result(ret) 725 return ret 726 |
727# Platform-specific configuration. Note again that we assume that all 728# builds under a given build root run on the same host platform. 729conf = Configure(main, 730 conf_dir = joinpath(build_root, '.scons_config'), 731 log_file = joinpath(build_root, 'scons_config.log'), |
732 custom_tests = { 'CheckLeading' : CheckLeading }) |
733 734# Check for leading underscores. Don't really need to worry either 735# way so don't need to check the return code. 736conf.CheckLeading() 737 |
738# Check if we should compile a 64 bit binary on Mac OS X/Darwin 739try: 740 import platform 741 uname = platform.uname() 742 if uname[0] == 'Darwin' and compareVersions(uname[2], '9.0.0') >= 0: 743 if int(readCommand('sysctl -n hw.cpu64bit_capable')[0]): 744 main.Append(CCFLAGS=['-arch', 'x86_64']) 745 main.Append(CFLAGS=['-arch', 'x86_64']) --- 225 unchanged lines hidden (view full) --- 971 BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks', have_posix_clock), 972 BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 973 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False), 974 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None', 975 all_protocols), 976 ) 977 978# These variables get exported to #defines in config/*.hh (see src/SConscript). |
979export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP', 'TARGET_ISA', 'CP_ANNOTATE', 980 'USE_POSIX_CLOCK', 'PROTOCOL', 'HAVE_PROTOBUF'] |
981 982################################################### 983# 984# Define a SCons builder for configuration flag headers. 985# 986################################################### 987 988# This function generates a config header file that #defines the --- 181 unchanged lines hidden --- |