SConstruct (9255:60f043573a65) SConstruct (9396:0c0ec9d87746)
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

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

175termcap = get_termcap(GetOption('use_colors'))
176
177########################################################################
178#
179# Set up the main build environment.
180#
181########################################################################
182use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
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

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

175termcap = get_termcap(GetOption('use_colors'))
176
177########################################################################
178#
179# Set up the main build environment.
180#
181########################################################################
182use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
183 'LIBRARY_PATH', 'PATH', 'PYTHONPATH', 'RANLIB', 'SWIG' ])
183 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PYTHONPATH',
184 'RANLIB', 'SWIG' ])
184
185use_env = {}
186for key,val in os.environ.iteritems():
187 if key in use_vars or key.startswith("M5"):
188 use_env[key] = val
189
190main = Environment(ENV=use_env)
191main.Decider('MD5-timestamp')

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

358global_vars_file = joinpath(build_root, 'variables.global')
359
360global_vars = Variables(global_vars_file, args=ARGUMENTS)
361
362global_vars.AddVariables(
363 ('CC', 'C compiler', environ.get('CC', main['CC'])),
364 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
365 ('SWIG', 'SWIG tool', environ.get('SWIG', main['SWIG'])),
185
186use_env = {}
187for key,val in os.environ.iteritems():
188 if key in use_vars or key.startswith("M5"):
189 use_env[key] = val
190
191main = Environment(ENV=use_env)
192main.Decider('MD5-timestamp')

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

359global_vars_file = joinpath(build_root, 'variables.global')
360
361global_vars = Variables(global_vars_file, args=ARGUMENTS)
362
363global_vars.AddVariables(
364 ('CC', 'C compiler', environ.get('CC', main['CC'])),
365 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
366 ('SWIG', 'SWIG tool', environ.get('SWIG', main['SWIG'])),
367 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
366 ('BATCH', 'Use batch pool for build and tests', False),
367 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
368 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
369 ('EXTRAS', 'Add extra directories to the compilation', '')
370 )
371
372# Update main environment with values from ARGUMENTS & global_vars_file
373global_vars.Update(main)

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

608 main['AS'] = main['BATCH_CMD'] + ' ' + main['AS']
609 main['AR'] = main['BATCH_CMD'] + ' ' + main['AR']
610 main['RANLIB'] = main['BATCH_CMD'] + ' ' + main['RANLIB']
611
612if sys.platform == 'cygwin':
613 # cygwin has some header file issues...
614 main.Append(CCFLAGS=["-Wno-uninitialized"])
615
368 ('BATCH', 'Use batch pool for build and tests', False),
369 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
370 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
371 ('EXTRAS', 'Add extra directories to the compilation', '')
372 )
373
374# Update main environment with values from ARGUMENTS & global_vars_file
375global_vars.Update(main)

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

610 main['AS'] = main['BATCH_CMD'] + ' ' + main['AS']
611 main['AR'] = main['BATCH_CMD'] + ' ' + main['AR']
612 main['RANLIB'] = main['BATCH_CMD'] + ' ' + main['RANLIB']
613
614if sys.platform == 'cygwin':
615 # cygwin has some header file issues...
616 main.Append(CCFLAGS=["-Wno-uninitialized"])
617
618# Check for the protobuf compiler
619protoc_version = readCommand([main['PROTOC'], '--version'],
620 exception='').split()
621
622# First two words should be "libprotoc x.y.z"
623if len(protoc_version) < 2 or protoc_version[0] != 'libprotoc':
624 print termcap.Yellow + termcap.Bold + \
625 'Warning: Protocol buffer compiler (protoc) not found.\n' + \
626 ' Please install protobuf-compiler for tracing support.' + \
627 termcap.Normal
628 main['PROTOC'] = False
629else:
630 # Determine the appropriate include path and library path using
631 # pkg-config, that means we also need to check for pkg-config
632 if not readCommand(['pkg-config', '--version'], exception=''):
633 print 'Error: pkg-config not found. Please install and retry.'
634 Exit(1)
635
636 main.ParseConfig('pkg-config --cflags --libs-only-L protobuf')
637
638 # Based on the availability of the compress stream wrappers,
639 # require 2.1.0
640 min_protoc_version = '2.1.0'
641 if compareVersions(protoc_version[1], min_protoc_version) < 0:
642 print 'Error: protoc version', min_protoc_version, 'or newer required.'
643 print ' Installed version:', protoc_version[1]
644 Exit(1)
645
616# Check for SWIG
617if not main.has_key('SWIG'):
618 print 'Error: SWIG utility not found.'
619 print ' Please install (see http://www.swig.org) and retry.'
620 Exit(1)
621
622# Check for appropriate SWIG version
623swig_version = readCommand([main['SWIG'], '-version'], exception='').split()

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

809# Check for zlib. If the check passes, libz will be automatically
810# added to the LIBS environment variable.
811if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
812 print 'Error: did not find needed zlib compression library '\
813 'and/or zlib.h header file.'
814 print ' Please install zlib and try again.'
815 Exit(1)
816
646# Check for SWIG
647if not main.has_key('SWIG'):
648 print 'Error: SWIG utility not found.'
649 print ' Please install (see http://www.swig.org) and retry.'
650 Exit(1)
651
652# Check for appropriate SWIG version
653swig_version = readCommand([main['SWIG'], '-version'], exception='').split()

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

839# Check for zlib. If the check passes, libz will be automatically
840# added to the LIBS environment variable.
841if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
842 print 'Error: did not find needed zlib compression library '\
843 'and/or zlib.h header file.'
844 print ' Please install zlib and try again.'
845 Exit(1)
846
847# If we have the protobuf compiler, also make sure we have the
848# development libraries. If the check passes, libprotobuf will be
849# automatically added to the LIBS environment variable. After
850# this, we can use the HAVE_PROTOBUF flag to determine if we have
851# got both protoc and libprotobuf available.
852main['HAVE_PROTOBUF'] = main['PROTOC'] and \
853 conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h',
854 'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')
855
856# If we have the compiler but not the library, treat it as an error.
857if main['PROTOC'] and not main['HAVE_PROTOBUF']:
858 print 'Error: did not find protocol buffer library and/or headers.'
859 print ' Please install libprotobuf-dev and try again.'
860 Exit(1)
861
817# Check for librt.
818have_posix_clock = \
819 conf.CheckLibWithHeader(None, 'time.h', 'C',
820 'clock_nanosleep(0,0,NULL,NULL);') or \
821 conf.CheckLibWithHeader('rt', 'time.h', 'C',
822 'clock_nanosleep(0,0,NULL,NULL);')
823
824if conf.CheckLib('tcmalloc_minimal'):

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

935 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
936 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
937 all_protocols),
938 )
939
940# These variables get exported to #defines in config/*.hh (see src/SConscript).
941export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP',
942 'TARGET_ISA', 'CP_ANNOTATE', 'USE_POSIX_CLOCK', 'PROTOCOL',
862# Check for librt.
863have_posix_clock = \
864 conf.CheckLibWithHeader(None, 'time.h', 'C',
865 'clock_nanosleep(0,0,NULL,NULL);') or \
866 conf.CheckLibWithHeader('rt', 'time.h', 'C',
867 'clock_nanosleep(0,0,NULL,NULL);')
868
869if conf.CheckLib('tcmalloc_minimal'):

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

980 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
981 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
982 all_protocols),
983 )
984
985# These variables get exported to #defines in config/*.hh (see src/SConscript).
986export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP',
987 'TARGET_ISA', 'CP_ANNOTATE', 'USE_POSIX_CLOCK', 'PROTOCOL',
943 'HAVE_STATIC_ASSERT']
988 'HAVE_STATIC_ASSERT', 'HAVE_PROTOBUF']
944
945###################################################
946#
947# Define a SCons builder for configuration flag headers.
948#
949###################################################
950
951# This function generates a config header file that #defines the

--- 181 unchanged lines hidden ---
989
990###################################################
991#
992# Define a SCons builder for configuration flag headers.
993#
994###################################################
995
996# This function generates a config header file that #defines the

--- 181 unchanged lines hidden ---