SConstruct (11497:bfed9fdf0ac7) SConstruct (11500:024291dab733)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 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

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

670 print " environment."
671 print " "
672 print " If you are trying to use a compiler other than those listed"
673 print " above you will need to ease fix SConstruct and "
674 print " src/SConscript to support that compiler."
675 Exit(1)
676
677if main['GCC']:
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 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

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

670 print " environment."
671 print " "
672 print " If you are trying to use a compiler other than those listed"
673 print " above you will need to ease fix SConstruct and "
674 print " src/SConscript to support that compiler."
675 Exit(1)
676
677if main['GCC']:
678 # Check for a supported version of gcc. >= 4.7 is chosen for its
678 # Check for a supported version of gcc. >= 4.8 is chosen for its
679 # level of c++11 support. See
680 # http://gcc.gnu.org/projects/cxx0x.html for details.
681 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
679 # level of c++11 support. See
680 # http://gcc.gnu.org/projects/cxx0x.html for details.
681 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
682 if compareVersions(gcc_version, "4.7") < 0:
683 print 'Error: gcc version 4.7 or newer required.'
682 if compareVersions(gcc_version, "4.8") < 0:
683 print 'Error: gcc version 4.8 or newer required.'
684 print ' Installed version:', gcc_version
685 Exit(1)
686
687 main['GCC_VERSION'] = gcc_version
688
689 # gcc from version 4.8 and above generates "rep; ret" instructions
690 # to avoid performance penalties on certain AMD chips. Older
691 # assemblers detect this as an error, "Error: expecting string
692 # instruction after `rep'"
684 print ' Installed version:', gcc_version
685 Exit(1)
686
687 main['GCC_VERSION'] = gcc_version
688
689 # gcc from version 4.8 and above generates "rep; ret" instructions
690 # to avoid performance penalties on certain AMD chips. Older
691 # assemblers detect this as an error, "Error: expecting string
692 # instruction after `rep'"
693 if compareVersions(gcc_version, "4.8") > 0:
694 as_version_raw = readCommand([main['AS'], '-v', '/dev/null'],
695 exception=False).split()
693 as_version_raw = readCommand([main['AS'], '-v', '/dev/null'],
694 exception=False).split()
696
695
697 # version strings may contain extra distro-specific
698 # qualifiers, so play it safe and keep only what comes before
699 # the first hyphen
700 as_version = as_version_raw[-1].split('-')[0] if as_version_raw \
701 else None
696 # version strings may contain extra distro-specific
697 # qualifiers, so play it safe and keep only what comes before
698 # the first hyphen
699 as_version = as_version_raw[-1].split('-')[0] if as_version_raw else None
702
700
703 if not as_version or compareVersions(as_version, "2.23") < 0:
704 print termcap.Yellow + termcap.Bold + \
705 'Warning: This combination of gcc and binutils have' + \
706 ' known incompatibilities.\n' + \
707 ' If you encounter build problems, please update ' + \
708 'binutils to 2.23.' + \
709 termcap.Normal
701 if not as_version or compareVersions(as_version, "2.23") < 0:
702 print termcap.Yellow + termcap.Bold + \
703 'Warning: This combination of gcc and binutils have' + \
704 ' known incompatibilities.\n' + \
705 ' If you encounter build problems, please update ' + \
706 'binutils to 2.23.' + \
707 termcap.Normal
710
711 # Make sure we warn if the user has requested to compile with the
712 # Undefined Benahvior Sanitizer and this version of gcc does not
713 # support it.
714 if GetOption('with_ubsan') and \
715 compareVersions(gcc_version, '4.9') < 0:
716 print termcap.Yellow + termcap.Bold + \
717 'Warning: UBSan is only supported using gcc 4.9 and later.' + \

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

734 '-fno-builtin-realloc', '-fno-builtin-free'])
735
736 # add option to check for undeclared overrides
737 if compareVersions(gcc_version, "5.0") > 0:
738 main.Append(CCFLAGS=['-Wno-error=suggest-override'])
739
740elif main['CLANG']:
741 # Check for a supported version of clang, >= 3.1 is needed to
708
709 # Make sure we warn if the user has requested to compile with the
710 # Undefined Benahvior Sanitizer and this version of gcc does not
711 # support it.
712 if GetOption('with_ubsan') and \
713 compareVersions(gcc_version, '4.9') < 0:
714 print termcap.Yellow + termcap.Bold + \
715 'Warning: UBSan is only supported using gcc 4.9 and later.' + \

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

732 '-fno-builtin-realloc', '-fno-builtin-free'])
733
734 # add option to check for undeclared overrides
735 if compareVersions(gcc_version, "5.0") > 0:
736 main.Append(CCFLAGS=['-Wno-error=suggest-override'])
737
738elif main['CLANG']:
739 # Check for a supported version of clang, >= 3.1 is needed to
742 # support similar features as gcc 4.7. See
740 # support similar features as gcc 4.8. See
743 # http://clang.llvm.org/cxx_status.html for details
744 clang_version_re = re.compile(".* version (\d+\.\d+)")
745 clang_version_match = clang_version_re.search(CXX_version)
746 if (clang_version_match):
747 clang_version = clang_version_match.groups()[0]
748 if compareVersions(clang_version, "3.1") < 0:
749 print 'Error: clang version 3.1 or newer required.'
750 print ' Installed version:', clang_version

--- 804 unchanged lines hidden ---
741 # http://clang.llvm.org/cxx_status.html for details
742 clang_version_re = re.compile(".* version (\d+\.\d+)")
743 clang_version_match = clang_version_re.search(CXX_version)
744 if (clang_version_match):
745 clang_version = clang_version_match.groups()[0]
746 if compareVersions(clang_version, "3.1") < 0:
747 print 'Error: clang version 3.1 or newer required.'
748 print ' Installed version:', clang_version

--- 804 unchanged lines hidden ---