SConstruct (9926:45a013c50eff) SConstruct (9986:7cab06691984)
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

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

789 asm(".globl _x; _x: .byte 0");
790 extern int x;
791 int main() { return x; }
792 ''', extension=".c")
793 context.env.Append(LEADING_UNDERSCORE=ret)
794 context.Result(ret)
795 return ret
796
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

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

789 asm(".globl _x; _x: .byte 0");
790 extern int x;
791 int main() { return x; }
792 ''', extension=".c")
793 context.env.Append(LEADING_UNDERSCORE=ret)
794 context.Result(ret)
795 return ret
796
797# Add a custom Check function to test for structure members.
798def CheckMember(context, include, decl, member, include_quotes="<>"):
799 context.Message("Checking for member %s in %s..." %
800 (member, decl))
801 text = """
802#include %(header)s
803int main(){
804 %(decl)s test;
805 (void)test.%(member)s;
806 return 0;
807};
808""" % { "header" : include_quotes[0] + include + include_quotes[1],
809 "decl" : decl,
810 "member" : member,
811 }
812
813 ret = context.TryCompile(text, extension=".cc")
814 context.Result(ret)
815 return ret
816
797# Platform-specific configuration. Note again that we assume that all
798# builds under a given build root run on the same host platform.
799conf = Configure(main,
800 conf_dir = joinpath(build_root, '.scons_config'),
801 log_file = joinpath(build_root, 'scons_config.log'),
817# Platform-specific configuration. Note again that we assume that all
818# builds under a given build root run on the same host platform.
819conf = Configure(main,
820 conf_dir = joinpath(build_root, '.scons_config'),
821 log_file = joinpath(build_root, 'scons_config.log'),
802 custom_tests = { 'CheckLeading' : CheckLeading })
822 custom_tests = {
823 'CheckLeading' : CheckLeading,
824 'CheckMember' : CheckMember,
825 })
803
804# Check for leading underscores. Don't really need to worry either
805# way so don't need to check the return code.
806conf.CheckLeading()
807
808# Check if we should compile a 64 bit binary on Mac OS X/Darwin
809try:
810 import platform

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

959 host_isa = platform.machine()
960 except:
961 print "Warning: Failed to determine host ISA."
962 return False
963
964 return host_isa in isa_comp_table.get(isa, [])
965
966
826
827# Check for leading underscores. Don't really need to worry either
828# way so don't need to check the return code.
829conf.CheckLeading()
830
831# Check if we should compile a 64 bit binary on Mac OS X/Darwin
832try:
833 import platform

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

982 host_isa = platform.machine()
983 except:
984 print "Warning: Failed to determine host ISA."
985 return False
986
987 return host_isa in isa_comp_table.get(isa, [])
988
989
990# Check if the exclude_host attribute is available. We want this to
991# get accurate instruction counts in KVM.
992main['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember(
993 'linux/perf_event.h', 'struct perf_event_attr', 'exclude_host')
994
995
967######################################################################
968#
969# Finish the configuration
970#
971main = conf.Finish()
972
973######################################################################
974#

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

1060 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
1061 BoolVariable('USE_KVM', 'Enable hardware virtualized (KVM) CPU models', have_kvm),
1062 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
1063 all_protocols),
1064 )
1065
1066# These variables get exported to #defines in config/*.hh (see src/SConscript).
1067export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP', 'TARGET_ISA', 'CP_ANNOTATE',
996######################################################################
997#
998# Finish the configuration
999#
1000main = conf.Finish()
1001
1002######################################################################
1003#

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

1089 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False),
1090 BoolVariable('USE_KVM', 'Enable hardware virtualized (KVM) CPU models', have_kvm),
1091 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
1092 all_protocols),
1093 )
1094
1095# These variables get exported to #defines in config/*.hh (see src/SConscript).
1096export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP', 'TARGET_ISA', 'CP_ANNOTATE',
1068 'USE_POSIX_CLOCK', 'PROTOCOL', 'HAVE_PROTOBUF']
1097 'USE_POSIX_CLOCK', 'PROTOCOL', 'HAVE_PROTOBUF',
1098 'HAVE_PERF_ATTR_EXCLUDE_HOST']
1069
1070###################################################
1071#
1072# Define a SCons builder for configuration flag headers.
1073#
1074###################################################
1075
1076# This function generates a config header file that #defines the

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

1238 print "Warning: Can not enable KVM, host seems to lack support " \
1239 "for POSIX timers"
1240 env['USE_KVM'] = False
1241 elif not is_isa_kvm_compatible(env['TARGET_ISA']):
1242 print "Info: KVM support disabled due to unsupported host and " \
1243 "target ISA combination"
1244 env['USE_KVM'] = False
1245
1099
1100###################################################
1101#
1102# Define a SCons builder for configuration flag headers.
1103#
1104###################################################
1105
1106# This function generates a config header file that #defines the

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

1268 print "Warning: Can not enable KVM, host seems to lack support " \
1269 "for POSIX timers"
1270 env['USE_KVM'] = False
1271 elif not is_isa_kvm_compatible(env['TARGET_ISA']):
1272 print "Info: KVM support disabled due to unsupported host and " \
1273 "target ISA combination"
1274 env['USE_KVM'] = False
1275
1276 # Warn about missing optional functionality
1277 if env['USE_KVM']:
1278 if not main['HAVE_PERF_ATTR_EXCLUDE_HOST']:
1279 print "Warning: perf_event headers lack support for the " \
1280 "exclude_host attribute. KVM instruction counts will " \
1281 "be inaccurate."
1282
1246 # Save sticky variable settings back to current variables file
1247 sticky_vars.Save(current_vars_file, env)
1248
1249 if env['USE_SSE2']:
1250 env.Append(CCFLAGS=['-msse2'])
1251
1252 # The src/SConscript file sets up the build rules in 'env' according
1253 # to the configured variables. It returns a list of environments,

--- 22 unchanged lines hidden ---
1283 # Save sticky variable settings back to current variables file
1284 sticky_vars.Save(current_vars_file, env)
1285
1286 if env['USE_SSE2']:
1287 env.Append(CCFLAGS=['-msse2'])
1288
1289 # The src/SConscript file sets up the build rules in 'env' according
1290 # to the configured variables. It returns a list of environments,

--- 22 unchanged lines hidden ---