SConstruct (10196:be0e1724eb39) SConstruct (10238:b21b3aad6bd1)
1# -*- mode:python -*-
2
3# Copyright (c) 2013 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

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

563 print " environment."
564 print " "
565 print " If you are trying to use a compiler other than those listed"
566 print " above you will need to ease fix SConstruct and "
567 print " src/SConscript to support that compiler."
568 Exit(1)
569
570if main['GCC']:
1# -*- mode:python -*-
2
3# Copyright (c) 2013 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

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

563 print " environment."
564 print " "
565 print " If you are trying to use a compiler other than those listed"
566 print " above you will need to ease fix SConstruct and "
567 print " src/SConscript to support that compiler."
568 Exit(1)
569
570if main['GCC']:
571 # Check for a supported version of gcc, >= 4.4 is needed for c++0x
572 # support. See http://gcc.gnu.org/projects/cxx0x.html for details
571 # Check for a supported version of gcc. >= 4.6 is chosen for its
572 # level of c++11 support. See
573 # http://gcc.gnu.org/projects/cxx0x.html for details. 4.6 is also
574 # the first version with proper LTO support.
573 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
575 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
574 if compareVersions(gcc_version, "4.4") < 0:
575 print 'Error: gcc version 4.4 or newer required.'
576 if compareVersions(gcc_version, "4.6") < 0:
577 print 'Error: gcc version 4.6 or newer required.'
576 print ' Installed version:', gcc_version
577 Exit(1)
578
579 main['GCC_VERSION'] = gcc_version
580
578 print ' Installed version:', gcc_version
579 Exit(1)
580
581 main['GCC_VERSION'] = gcc_version
582
581 # Check for versions with bugs
582 if not compareVersions(gcc_version, '4.4.1') or \
583 not compareVersions(gcc_version, '4.4.2'):
584 print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
585 main.Append(CCFLAGS=['-fno-tree-vectorize'])
583 # Add the appropriate Link-Time Optimization (LTO) flags
584 # unless LTO is explicitly turned off. Note that these flags
585 # are only used by the fast target.
586 if not GetOption('no_lto'):
587 # Pass the LTO flag when compiling to produce GIMPLE
588 # output, we merely create the flags here and only append
589 # them later/
590 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
586
591
587 # LTO support is only really working properly from 4.6 and beyond
588 if compareVersions(gcc_version, '4.6') >= 0:
589 # Add the appropriate Link-Time Optimization (LTO) flags
590 # unless LTO is explicitly turned off. Note that these flags
591 # are only used by the fast target.
592 if not GetOption('no_lto'):
593 # Pass the LTO flag when compiling to produce GIMPLE
594 # output, we merely create the flags here and only append
595 # them later/
596 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
592 # Use the same amount of jobs for LTO as we are running
593 # scons with, we hardcode the use of the linker plugin
594 # which requires either gold or GNU ld >= 2.21
595 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'),
596 '-fuse-linker-plugin']
597
597
598 # Use the same amount of jobs for LTO as we are running
599 # scons with, we hardcode the use of the linker plugin
600 # which requires either gold or GNU ld >= 2.21
601 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'),
602 '-fuse-linker-plugin']
603
604 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
605 '-fno-builtin-realloc', '-fno-builtin-free'])
606
607elif main['CLANG']:
598 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
599 '-fno-builtin-realloc', '-fno-builtin-free'])
600
601elif main['CLANG']:
608 # Check for a supported version of clang, >= 2.9 is needed to
609 # support similar features as gcc 4.4. See
602 # Check for a supported version of clang, >= 3.0 is needed to
603 # support similar features as gcc 4.6. See
610 # http://clang.llvm.org/cxx_status.html for details
611 clang_version_re = re.compile(".* version (\d+\.\d+)")
612 clang_version_match = clang_version_re.search(CXX_version)
613 if (clang_version_match):
614 clang_version = clang_version_match.groups()[0]
604 # http://clang.llvm.org/cxx_status.html for details
605 clang_version_re = re.compile(".* version (\d+\.\d+)")
606 clang_version_match = clang_version_re.search(CXX_version)
607 if (clang_version_match):
608 clang_version = clang_version_match.groups()[0]
615 if compareVersions(clang_version, "2.9") < 0:
616 print 'Error: clang version 2.9 or newer required.'
609 if compareVersions(clang_version, "3.0") < 0:
610 print 'Error: clang version 3.0 or newer required.'
617 print ' Installed version:', clang_version
618 Exit(1)
619 else:
620 print 'Error: Unable to determine clang version.'
621 Exit(1)
622
623 # clang has a few additional warnings that we disable,
624 # tautological comparisons are allowed due to unsigned integers

--- 735 unchanged lines hidden ---
611 print ' Installed version:', clang_version
612 Exit(1)
613 else:
614 print 'Error: Unable to determine clang version.'
615 Exit(1)
616
617 # clang has a few additional warnings that we disable,
618 # tautological comparisons are allowed due to unsigned integers

--- 735 unchanged lines hidden ---