Deleted Added
sdiff udiff text old ( 9419:54d5c0e5852a ) new ( 9420:965d857ac791 )
full compact
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 main.Append(CCFLAGS=['-pipe'])
520 main.Append(CCFLAGS=['-fno-strict-aliasing'])
521 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
522 # Read the GCC version to check for versions with bugs
523 # Note CCVERSION doesn't work here because it is run with the CC
524 # before we override it from the command line
525 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
526 main['GCC_VERSION'] = gcc_version
527 if not compareVersions(gcc_version, '4.4.1') or \
528 not compareVersions(gcc_version, '4.4.2'):
529 print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
530 main.Append(CCFLAGS=['-fno-tree-vectorize'])
531 # c++0x support in gcc is useful already from 4.4, see
532 # http://gcc.gnu.org/projects/cxx0x.html for details
533 if compareVersions(gcc_version, '4.4') >= 0:
534 main.Append(CXXFLAGS=['-std=c++0x'])
535
536 # LTO support is only really working properly from 4.6 and beyond
537 if compareVersions(gcc_version, '4.6') >= 0:
538 # Add the appropriate Link-Time Optimization (LTO) flags
539 # unless LTO is explicitly turned off. Note that these flags
540 # are only used by the fast target.
541 if not GetOption('no_lto'):
542 # Pass the LTO flag when compiling to produce GIMPLE
543 # output, we merely create the flags here and only append
544 # them later/
545 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
546
547 # Use the same amount of jobs for LTO as we are running
548 # scons with, we hardcode the use of the linker plugin
549 # which requires either gold or GNU ld >= 2.21
550 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'),
551 '-fuse-linker-plugin']
552
553elif main['CLANG']:
554 clang_version_re = re.compile(".* version (\d+\.\d+)")
555 clang_version_match = clang_version_re.match(CXX_version)
556 if (clang_version_match):
557 clang_version = clang_version_match.groups()[0]
558 if compareVersions(clang_version, "2.9") < 0:
559 print 'Error: clang version 2.9 or newer required.'
560 print ' Installed version:', clang_version
561 Exit(1)

--- 4 unchanged lines hidden (view full) ---

566 main.Append(CCFLAGS=['-pipe'])
567 main.Append(CCFLAGS=['-fno-strict-aliasing'])
568 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
569 main.Append(CCFLAGS=['-Wno-tautological-compare'])
570 main.Append(CCFLAGS=['-Wno-self-assign'])
571 # Ruby makes frequent use of extraneous parantheses in the printing
572 # of if-statements
573 main.Append(CCFLAGS=['-Wno-parentheses'])
574
575 # clang 2.9 does not play well with c++0x as it ships with C++
576 # headers that produce errors, this was fixed in 3.0
577 if compareVersions(clang_version, "3") >= 0:
578 main.Append(CXXFLAGS=['-std=c++0x'])
579else:
580 print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
581 print "Don't know what compiler options to use for your compiler."
582 print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX']
583 print termcap.Yellow + ' version:' + termcap.Normal,
584 if not CXX_version:
585 print termcap.Yellow + termcap.Bold + "COMMAND NOT FOUND!" +\
586 termcap.Normal

--- 119 unchanged lines hidden (view full) ---

706 asm(".globl _x; _x: .byte 0");
707 extern int x;
708 int main() { return x; }
709 ''', extension=".c")
710 context.env.Append(LEADING_UNDERSCORE=ret)
711 context.Result(ret)
712 return ret
713
714# Test for the presence of C++11 static asserts. If the compiler lacks
715# support for static asserts, base/compiler.hh enables a macro that
716# removes any static asserts in the code.
717def CheckStaticAssert(context):
718 context.Message("Checking for C++11 static_assert support...")
719 ret = context.TryCompile('''
720 static_assert(1, "This assert is always true");
721 ''', extension=".cc")
722 context.env.Append(HAVE_STATIC_ASSERT=ret)
723 context.Result(ret)
724 return ret
725
726# Platform-specific configuration. Note again that we assume that all
727# builds under a given build root run on the same host platform.
728conf = Configure(main,
729 conf_dir = joinpath(build_root, '.scons_config'),
730 log_file = joinpath(build_root, 'scons_config.log'),
731 custom_tests = { 'CheckLeading' : CheckLeading,
732 'CheckStaticAssert' : CheckStaticAssert,
733 })
734
735# Check for leading underscores. Don't really need to worry either
736# way so don't need to check the return code.
737conf.CheckLeading()
738
739# Check for C++11 features we want to use if they exist
740conf.CheckStaticAssert()
741
742# Check if we should compile a 64 bit binary on Mac OS X/Darwin
743try:
744 import platform
745 uname = platform.uname()
746 if uname[0] == 'Darwin' and compareVersions(uname[2], '9.0.0') >= 0:
747 if int(readCommand('sysctl -n hw.cpu64bit_capable')[0]):
748 main.Append(CCFLAGS=['-arch', 'x86_64'])
749 main.Append(CFLAGS=['-arch', 'x86_64'])

--- 225 unchanged lines hidden (view full) ---

975 BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks', have_posix_clock),
976 BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
977 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
978 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
979 all_protocols),
980 )
981
982# These variables get exported to #defines in config/*.hh (see src/SConscript).
983export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP',
984 'TARGET_ISA', 'CP_ANNOTATE', 'USE_POSIX_CLOCK', 'PROTOCOL',
985 'HAVE_STATIC_ASSERT', 'HAVE_PROTOBUF']
986
987###################################################
988#
989# Define a SCons builder for configuration flag headers.
990#
991###################################################
992
993# This function generates a config header file that #defines the

--- 181 unchanged lines hidden ---