X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=SConstruct;h=8fb649143a3636f24b6bd9642d7d31c67178a5c4;hb=df7f0892ed5f4522a4582aaed7e49622e3a33d9f;hp=a96f8a6855a0b090a36ea13ff2aa6df180450b22;hpb=3f6dc3c5718198bcfbb5842bf5f07e99fc8b3cbe;p=gem5.git diff --git a/SConstruct b/SConstruct index a96f8a685..8fb649143 100755 --- a/SConstruct +++ b/SConstruct @@ -173,6 +173,9 @@ AddLocalOption('--colors', dest='use_colors', action='store_true', help="Add color to abbreviated scons output") AddLocalOption('--no-colors', dest='use_colors', action='store_false', help="Don't add color to abbreviated scons output") +AddLocalOption('--with-cxx-config', dest='with_cxx_config', + action='store_true', + help="Build with support for C++-based configuration") AddLocalOption('--default', dest='default', type='string', action='store', help='Override which build_opts file to use for defaults') AddLocalOption('--ignore-style', dest='ignore_style', action='store_true', @@ -183,6 +186,14 @@ AddLocalOption('--update-ref', dest='update_ref', action='store_true', help='Update test reference outputs') AddLocalOption('--verbose', dest='verbose', action='store_true', help='Print full tool command lines') +AddLocalOption('--without-python', dest='without_python', + action='store_true', + help='Build without Python configuration support') +AddLocalOption('--without-tcmalloc', dest='without_tcmalloc', + action='store_true', + help='Disable linking against tcmalloc') +AddLocalOption('--with-ubsan', dest='with_ubsan', action='store_true', + help='Build with Undefined Behavior Sanitizer if available') termcap = get_termcap(GetOption('use_colors')) @@ -596,6 +607,15 @@ if main['GCC']: 'binutils to 2.23.' + \ termcap.Normal + # Make sure we warn if the user has requested to compile with the + # Undefined Benahvior Sanitizer and this version of gcc does not + # support it. + if GetOption('with_ubsan') and \ + compareVersions(gcc_version, '4.9') < 0: + print termcap.Yellow + termcap.Bold + \ + 'Warning: UBSan is only supported using gcc 4.9 and later.' + \ + termcap.Normal + # Add the appropriate Link-Time Optimization (LTO) flags # unless LTO is explicitly turned off. Note that these flags # are only used by the fast target. @@ -884,48 +904,51 @@ if main['M5_BUILD_CACHE']: print 'Using build cache located at', main['M5_BUILD_CACHE'] CacheDir(main['M5_BUILD_CACHE']) -# Find Python include and library directories for embedding the -# interpreter. We rely on python-config to resolve the appropriate -# includes and linker flags. ParseConfig does not seem to understand -# the more exotic linker flags such as -Xlinker and -export-dynamic so -# we add them explicitly below. If you want to link in an alternate -# version of python, see above for instructions on how to invoke -# scons with the appropriate PATH set. -# -# First we check if python2-config exists, else we use python-config -python_config = readCommand(['which', 'python2-config'], exception='').strip() -if not os.path.exists(python_config): - python_config = readCommand(['which', 'python-config'], +if not GetOption('without_python'): + # Find Python include and library directories for embedding the + # interpreter. We rely on python-config to resolve the appropriate + # includes and linker flags. ParseConfig does not seem to understand + # the more exotic linker flags such as -Xlinker and -export-dynamic so + # we add them explicitly below. If you want to link in an alternate + # version of python, see above for instructions on how to invoke + # scons with the appropriate PATH set. + # + # First we check if python2-config exists, else we use python-config + python_config = readCommand(['which', 'python2-config'], exception='').strip() -py_includes = readCommand([python_config, '--includes'], - exception='').split() -# Strip the -I from the include folders before adding them to the -# CPPPATH -main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes)) - -# Read the linker flags and split them into libraries and other link -# flags. The libraries are added later through the call the CheckLib. -py_ld_flags = readCommand([python_config, '--ldflags'], exception='').split() -py_libs = [] -for lib in py_ld_flags: - if not lib.startswith('-l'): - main.Append(LINKFLAGS=[lib]) - else: - lib = lib[2:] - if lib not in py_libs: - py_libs.append(lib) - -# verify that this stuff works -if not conf.CheckHeader('Python.h', '<>'): - print "Error: can't find Python.h header in", py_includes - print "Install Python headers (package python-dev on Ubuntu and RedHat)" - Exit(1) - -for lib in py_libs: - if not conf.CheckLib(lib): - print "Error: can't find library %s required by python" % lib + if not os.path.exists(python_config): + python_config = readCommand(['which', 'python-config'], + exception='').strip() + py_includes = readCommand([python_config, '--includes'], + exception='').split() + # Strip the -I from the include folders before adding them to the + # CPPPATH + main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes)) + + # Read the linker flags and split them into libraries and other link + # flags. The libraries are added later through the call the CheckLib. + py_ld_flags = readCommand([python_config, '--ldflags'], + exception='').split() + py_libs = [] + for lib in py_ld_flags: + if not lib.startswith('-l'): + main.Append(LINKFLAGS=[lib]) + else: + lib = lib[2:] + if lib not in py_libs: + py_libs.append(lib) + + # verify that this stuff works + if not conf.CheckHeader('Python.h', '<>'): + print "Error: can't find Python.h header in", py_includes + print "Install Python headers (package python-dev on Ubuntu and RedHat)" Exit(1) + for lib in py_libs: + if not conf.CheckLib(lib): + print "Error: can't find library %s required by python" % lib + Exit(1) + # On Solaris you need to use libsocket for socket ops if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'): if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'): @@ -967,15 +990,16 @@ have_posix_timers = \ conf.CheckLibWithHeader([None, 'rt'], [ 'time.h', 'signal.h' ], 'C', 'timer_create(CLOCK_MONOTONIC, NULL, NULL);') -if conf.CheckLib('tcmalloc'): - main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) -elif conf.CheckLib('tcmalloc_minimal'): - main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) -else: - print termcap.Yellow + termcap.Bold + \ - "You can get a 12% performance improvement by installing tcmalloc "\ - "(libgoogle-perftools-dev package on Ubuntu or RedHat)." + \ - termcap.Normal +if not GetOption('without_tcmalloc'): + if conf.CheckLib('tcmalloc'): + main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) + elif conf.CheckLib('tcmalloc_minimal'): + main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) + else: + print termcap.Yellow + termcap.Bold + \ + "You can get a 12% performance improvement by "\ + "installing tcmalloc (libgoogle-perftools-dev package "\ + "on Ubuntu or RedHat)." + termcap.Normal if not have_posix_clock: print "Can't find library for POSIX clocks." @@ -1175,6 +1199,10 @@ main.SConscript('ext/fputils/SConscript', main.SConscript('ext/dramsim2/SConscript', variant_dir = joinpath(build_root, 'dramsim2')) +# DRAMPower build is shared across all configs in the build root. +main.SConscript('ext/drampower/SConscript', + variant_dir = joinpath(build_root, 'drampower')) + ################################################### # # This function is used to set up a directory with switching headers