SConstruct (10428:0caf62b57dfd) SConstruct (10453:d0365cc3d05f)
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

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

178AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
179 help='Disable style checking hooks')
180AddLocalOption('--no-lto', dest='no_lto', action='store_true',
181 help='Disable Link-Time Optimization for fast')
182AddLocalOption('--update-ref', dest='update_ref', action='store_true',
183 help='Update test reference outputs')
184AddLocalOption('--verbose', dest='verbose', action='store_true',
185 help='Print full tool command lines')
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

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

178AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
179 help='Disable style checking hooks')
180AddLocalOption('--no-lto', dest='no_lto', action='store_true',
181 help='Disable Link-Time Optimization for fast')
182AddLocalOption('--update-ref', dest='update_ref', action='store_true',
183 help='Update test reference outputs')
184AddLocalOption('--verbose', dest='verbose', action='store_true',
185 help='Print full tool command lines')
186AddLocalOption('--without-python', dest='without_python',
187 action='store_true',
188 help='Build without Python configuration support')
186
187termcap = get_termcap(GetOption('use_colors'))
188
189########################################################################
190#
191# Set up the main build environment.
192#
193########################################################################

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

879
880 conf = NullConf(main)
881
882# Cache build files in the supplied directory.
883if main['M5_BUILD_CACHE']:
884 print 'Using build cache located at', main['M5_BUILD_CACHE']
885 CacheDir(main['M5_BUILD_CACHE'])
886
189
190termcap = get_termcap(GetOption('use_colors'))
191
192########################################################################
193#
194# Set up the main build environment.
195#
196########################################################################

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

882
883 conf = NullConf(main)
884
885# Cache build files in the supplied directory.
886if main['M5_BUILD_CACHE']:
887 print 'Using build cache located at', main['M5_BUILD_CACHE']
888 CacheDir(main['M5_BUILD_CACHE'])
889
887# Find Python include and library directories for embedding the
888# interpreter. We rely on python-config to resolve the appropriate
889# includes and linker flags. ParseConfig does not seem to understand
890# the more exotic linker flags such as -Xlinker and -export-dynamic so
891# we add them explicitly below. If you want to link in an alternate
892# version of python, see above for instructions on how to invoke
893# scons with the appropriate PATH set.
894#
895# First we check if python2-config exists, else we use python-config
896python_config = readCommand(['which', 'python2-config'], exception='').strip()
897if not os.path.exists(python_config):
898 python_config = readCommand(['which', 'python-config'],
890if not GetOption('without_python'):
891 # Find Python include and library directories for embedding the
892 # interpreter. We rely on python-config to resolve the appropriate
893 # includes and linker flags. ParseConfig does not seem to understand
894 # the more exotic linker flags such as -Xlinker and -export-dynamic so
895 # we add them explicitly below. If you want to link in an alternate
896 # version of python, see above for instructions on how to invoke
897 # scons with the appropriate PATH set.
898 #
899 # First we check if python2-config exists, else we use python-config
900 python_config = readCommand(['which', 'python2-config'],
899 exception='').strip()
901 exception='').strip()
900py_includes = readCommand([python_config, '--includes'],
901 exception='').split()
902# Strip the -I from the include folders before adding them to the
903# CPPPATH
904main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes))
902 if not os.path.exists(python_config):
903 python_config = readCommand(['which', 'python-config'],
904 exception='').strip()
905 py_includes = readCommand([python_config, '--includes'],
906 exception='').split()
907 # Strip the -I from the include folders before adding them to the
908 # CPPPATH
909 main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes))
905
910
906# Read the linker flags and split them into libraries and other link
907# flags. The libraries are added later through the call the CheckLib.
908py_ld_flags = readCommand([python_config, '--ldflags'], exception='').split()
909py_libs = []
910for lib in py_ld_flags:
911 if not lib.startswith('-l'):
912 main.Append(LINKFLAGS=[lib])
913 else:
914 lib = lib[2:]
915 if lib not in py_libs:
916 py_libs.append(lib)
911 # Read the linker flags and split them into libraries and other link
912 # flags. The libraries are added later through the call the CheckLib.
913 py_ld_flags = readCommand([python_config, '--ldflags'],
914 exception='').split()
915 py_libs = []
916 for lib in py_ld_flags:
917 if not lib.startswith('-l'):
918 main.Append(LINKFLAGS=[lib])
919 else:
920 lib = lib[2:]
921 if lib not in py_libs:
922 py_libs.append(lib)
917
923
918# verify that this stuff works
919if not conf.CheckHeader('Python.h', '<>'):
920 print "Error: can't find Python.h header in", py_includes
921 print "Install Python headers (package python-dev on Ubuntu and RedHat)"
922 Exit(1)
923
924for lib in py_libs:
925 if not conf.CheckLib(lib):
926 print "Error: can't find library %s required by python" % lib
924 # verify that this stuff works
925 if not conf.CheckHeader('Python.h', '<>'):
926 print "Error: can't find Python.h header in", py_includes
927 print "Install Python headers (package python-dev on Ubuntu and RedHat)"
927 Exit(1)
928
928 Exit(1)
929
930 for lib in py_libs:
931 if not conf.CheckLib(lib):
932 print "Error: can't find library %s required by python" % lib
933 Exit(1)
934
929# On Solaris you need to use libsocket for socket ops
930if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
931 if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
932 print "Can't find library with socket calls (e.g. accept())"
933 Exit(1)
934
935# Check for zlib. If the check passes, libz will be automatically
936# added to the LIBS environment variable.

--- 448 unchanged lines hidden ---
935# On Solaris you need to use libsocket for socket ops
936if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
937 if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
938 print "Can't find library with socket calls (e.g. accept())"
939 Exit(1)
940
941# Check for zlib. If the check passes, libz will be automatically
942# added to the LIBS environment variable.

--- 448 unchanged lines hidden ---