SConsopts revision 13737
12023SN/A# Copyright 2018 Google, Inc.
22023SN/A#
32023SN/A# Redistribution and use in source and binary forms, with or without
42023SN/A# modification, are permitted provided that the following conditions are
52023SN/A# met: redistributions of source code must retain the above copyright
62023SN/A# notice, this list of conditions and the following disclaimer;
72023SN/A# redistributions in binary form must reproduce the above copyright
82023SN/A# notice, this list of conditions and the following disclaimer in the
92023SN/A# documentation and/or other materials provided with the distribution;
102023SN/A# neither the name of the copyright holders nor the names of its
112023SN/A# contributors may be used to endorse or promote products derived from
122023SN/A# this software without specific prior written permission.
132023SN/A#
142023SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
152023SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
162023SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
172023SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
182023SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
192023SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
202023SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
212023SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
222023SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
232023SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
242023SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
252023SN/A#
262023SN/A# Authors: Gabe Black
272023SN/A
282665Ssaidi@eecs.umich.eduImport('*')
292665Ssaidi@eecs.umich.edu
302665Ssaidi@eecs.umich.edufrom m5.util import compareVersions
312023SN/Afrom m5.util.terminal import termcap
324202Sbinkertn@umich.edu
332023SN/Adef use_systemc_check(env, warn=False):
344202Sbinkertn@umich.edu    if ('GCC_VERSION' in env and
359022Sgblack@eecs.umich.edu            compareVersions(env['GCC_VERSION'], '5.0') < 0):
364997Sgblack@eecs.umich.edu        if warn:
374202Sbinkertn@umich.edu            print(termcap.Yellow + termcap.Bold +
388780Sgblack@eecs.umich.edu                  'Warning: Systemc may not work on gcc versions less '
398780Sgblack@eecs.umich.edu                  'than 5.0.' + termcap.Normal)
408745Sgblack@eecs.umich.edu        return False
414997Sgblack@eecs.umich.edu    elif env['PLATFORM'] == 'darwin':
426313Sgblack@eecs.umich.edu        if warn:
438777Sgblack@eecs.umich.edu            print(termcap.Yellow + termcap.Bold +
448780Sgblack@eecs.umich.edu                  'Warning: Systemc may not work on Mac OS.' + termcap.Normal)
458780Sgblack@eecs.umich.edu        return False
468780Sgblack@eecs.umich.edu    return True
478777Sgblack@eecs.umich.edu
484997Sgblack@eecs.umich.edumain.AddMethod(use_systemc_check, 'UseSystemcCheck')
498780Sgblack@eecs.umich.edu
506327Sgblack@eecs.umich.edusticky_vars.AddVariables(
514202Sbinkertn@umich.edu    BoolVariable('USE_SYSTEMC', 'Enable SystemC API support',
528777Sgblack@eecs.umich.edu                 main.UseSystemcCheck())
538780Sgblack@eecs.umich.edu    )
544997Sgblack@eecs.umich.edu
554826Ssaidi@eecs.umich.eduexport_vars.append('USE_SYSTEMC')
568755Sgblack@eecs.umich.edu