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

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

504# Initialize the Link-Time Optimization (LTO) flags
505main['LTO_CCFLAGS'] = []
506main['LTO_LDFLAGS'] = []
507
508CXX_version = readCommand([main['CXX'],'--version'], exception=False)
509CXX_V = readCommand([main['CXX'],'-V'], exception=False)
510
511main['GCC'] = CXX_version and CXX_version.find('g++') >= 0
512main['SUNCC'] = CXX_V and CXX_V.find('Sun C++') >= 0
513main['ICC'] = CXX_V and CXX_V.find('Intel') >= 0
512main['CLANG'] = CXX_version and CXX_version.find('clang') >= 0
515if main['GCC'] + main['SUNCC'] + main['ICC'] + main['CLANG'] > 1:
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'])

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

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
555elif main['ICC']:
556 pass #Fix me... add warning flags once we clean up icc warnings
557elif main['SUNCC']:
558 main.Append(CCFLAGS=['-Qoption ccfe'])
559 main.Append(CCFLAGS=['-features=gcc'])
560 main.Append(CCFLAGS=['-features=extensions'])
561 main.Append(CCFLAGS=['-library=stlport4'])
562 main.Append(CCFLAGS=['-xar'])
563 #main.Append(CCFLAGS=['-instances=semiexplicit'])
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

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

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
587 else:
588 print CXX_version.replace('\n', '<nl>')
600 print " If you're trying to use a compiler other than GCC, ICC, SunCC,"
589 print " If you're trying to use a compiler other than GCC"
590 print " or clang, there appears to be something wrong with your"
591 print " environment."
592 print " "
593 print " If you are trying to use a compiler other than those listed"
594 print " above you will need to ease fix SConstruct and "
595 print " src/SConscript to support that compiler."
596 Exit(1)
597

--- 577 unchanged lines hidden ---