SConstruct (9552:460cf901acba) SConstruct (9556:463684ff6fd1)
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

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

510
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
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

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

510
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'] or main['CLANG']:
519 # As gcc and clang share many flags, do the common parts here
520 main.Append(CCFLAGS=['-pipe'])
521 main.Append(CCFLAGS=['-fno-strict-aliasing'])
522 # Enable -Wall and then disable the few warnings that we
523 # consistently violate
524 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
525 # We always compile using C++11, but only gcc >= 4.7 and clang 3.1
526 # actually use that name, so we stick with c++0x
527 main.Append(CXXFLAGS=['-std=c++0x'])
528 # Add selected sanity checks from -Wextra
529 main.Append(CXXFLAGS=['-Wmissing-field-initializers',
530 '-Woverloaded-virtual'])
531else:
532 print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
533 print "Don't know what compiler options to use for your compiler."
534 print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX']
535 print termcap.Yellow + ' version:' + termcap.Normal,
536 if not CXX_version:
537 print termcap.Yellow + termcap.Bold + "COMMAND NOT FOUND!" +\
538 termcap.Normal
539 else:
540 print CXX_version.replace('\n', '<nl>')
541 print " If you're trying to use a compiler other than GCC"
542 print " or clang, there appears to be something wrong with your"
543 print " environment."
544 print " "
545 print " If you are trying to use a compiler other than those listed"
546 print " above you will need to ease fix SConstruct and "
547 print " src/SConscript to support that compiler."
548 Exit(1)
549
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
550if main['GCC']:
551 # Check for a supported version of gcc, >= 4.4 is needed for c++0x
552 # support. See http://gcc.gnu.org/projects/cxx0x.html for details
553 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
554 if compareVersions(gcc_version, "4.4") < 0:
555 print 'Error: gcc version 4.4 or newer required.'
556 print ' Installed version:', gcc_version
557 Exit(1)
558
559 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=['-Wmissing-field-initializers',
532 '-Woverloaded-virtual'])
533 main.Append(CXXFLAGS=['-std=c++0x'])
534
535 # Check for versions with bugs
536 if not compareVersions(gcc_version, '4.4.1') or \
537 not compareVersions(gcc_version, '4.4.2'):
538 print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
539 main.Append(CCFLAGS=['-fno-tree-vectorize'])
540
541 # LTO support is only really working properly from 4.6 and beyond

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

566 if compareVersions(clang_version, "2.9") < 0:
567 print 'Error: clang version 2.9 or newer required.'
568 print ' Installed version:', clang_version
569 Exit(1)
570 else:
571 print 'Error: Unable to determine clang version.'
572 Exit(1)
573
560
561 # Check for versions with bugs
562 if not compareVersions(gcc_version, '4.4.1') or \
563 not compareVersions(gcc_version, '4.4.2'):
564 print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
565 main.Append(CCFLAGS=['-fno-tree-vectorize'])
566
567 # LTO support is only really working properly from 4.6 and beyond

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

592 if compareVersions(clang_version, "2.9") < 0:
593 print 'Error: clang version 2.9 or newer required.'
594 print ' Installed version:', clang_version
595 Exit(1)
596 else:
597 print 'Error: Unable to determine clang version.'
598 Exit(1)
599
574 main.Append(CCFLAGS=['-pipe'])
575 main.Append(CCFLAGS=['-fno-strict-aliasing'])
576 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
577 main.Append(CCFLAGS=['-Wno-tautological-compare'])
578 main.Append(CCFLAGS=['-Wno-self-assign'])
579 # Ruby makes frequent use of extraneous parantheses in the printing
580 # of if-statements
581 main.Append(CCFLAGS=['-Wno-parentheses'])
582 main.Append(CXXFLAGS=['-Wmissing-field-initializers',
583 '-Woverloaded-virtual'])
584 main.Append(CXXFLAGS=['-std=c++0x'])
600 # clang has a few additional warnings that we disable,
601 # tautological comparisons are allowed due to unsigned integers
602 # being compared to constants that happen to be 0, and extraneous
603 # parantheses are allowed due to Ruby's printing of the AST,
604 # finally self assignments are allowed as the generated CPU code
605 # is relying on this
606 main.Append(CCFLAGS=['-Wno-tautological-compare',
607 '-Wno-parentheses',
608 '-Wno-self-assign'])
609
585 # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as
586 # opposed to libstdc++ to make the transition from TR1 to
587 # C++11. See http://libcxx.llvm.org. However, clang has chosen a
588 # strict implementation of the C++11 standard, and does not allow
589 # incomplete types in template arguments (besides unique_ptr and
590 # shared_ptr), and the libc++ STL containers create problems in
591 # combination with the current gem5 code. For now, we stick with
592 # libstdc++ and use the TR1 namespace.

--- 597 unchanged lines hidden ---
610 # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as
611 # opposed to libstdc++ to make the transition from TR1 to
612 # C++11. See http://libcxx.llvm.org. However, clang has chosen a
613 # strict implementation of the C++11 standard, and does not allow
614 # incomplete types in template arguments (besides unique_ptr and
615 # shared_ptr), and the libc++ STL containers create problems in
616 # combination with the current gem5 code. For now, we stick with
617 # libstdc++ and use the TR1 namespace.

--- 597 unchanged lines hidden ---