SConstruct (3049:2f90320192d3) SConstruct (3053:b0c9652cf9b9)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

114
115# helper function: find last occurrence of element in list
116def rfind(l, elt, offs = -1):
117 for i in range(len(l)+offs, 0, -1):
118 if l[i] == elt:
119 return i
120 raise ValueError, "element not found"
121
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

114
115# helper function: find last occurrence of element in list
116def rfind(l, elt, offs = -1):
117 for i in range(len(l)+offs, 0, -1):
118 if l[i] == elt:
119 return i
120 raise ValueError, "element not found"
121
122# helper function: compare dotted version numbers.
123# E.g., compare_version('1.3.25', '1.4.1')
124# returns -1, 0, 1 if v1 is <, ==, > v2
125def compare_versions(v1, v2):
126 # Convert dotted strings to lists
127 v1 = map(int, v1.split('.'))
128 v2 = map(int, v2.split('.'))
129 # Compare corresponding elements of lists
130 for n1,n2 in zip(v1, v2):
131 if n1 < n2: return -1
132 if n1 > n2: return 1
133 # all corresponding values are equal... see if one has extra values
134 if len(v1) < len(v2): return -1
135 if len(v1) > len(v2): return 1
136 return 0
137
122# Each target must have 'build' in the interior of the path; the
123# directory below this will determine the build parameters. For
124# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
125# recognize that ALPHA_SE specifies the configuration because it
126# follow 'build' in the bulid path.
127
128# Generate a list of the unique build roots and configs that the
129# collected targets reference.

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

197
198# include path, e.g. /usr/local/include/python2.4
199env.Append(CPPPATH = os.path.join(sys.exec_prefix, 'include', py_version_name))
200env.Append(LIBS = py_version_name)
201# add library path too if it's not in the default place
202if sys.exec_prefix != '/usr':
203 env.Append(LIBPATH = os.path.join(sys.exec_prefix, 'lib'))
204
138# Each target must have 'build' in the interior of the path; the
139# directory below this will determine the build parameters. For
140# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
141# recognize that ALPHA_SE specifies the configuration because it
142# follow 'build' in the bulid path.
143
144# Generate a list of the unique build roots and configs that the
145# collected targets reference.

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

213
214# include path, e.g. /usr/local/include/python2.4
215env.Append(CPPPATH = os.path.join(sys.exec_prefix, 'include', py_version_name))
216env.Append(LIBS = py_version_name)
217# add library path too if it's not in the default place
218if sys.exec_prefix != '/usr':
219 env.Append(LIBPATH = os.path.join(sys.exec_prefix, 'lib'))
220
205# Set up SWIG flags & scanner
221# Check for SWIG
222if not env.has_key('SWIG'):
223 print 'Error: SWIG utility not found.'
224 print ' Please install (see http://www.swig.org) and retry.'
225 Exit(1)
206
226
227# Check for appropriate SWIG version
228swig_version = os.popen('swig -version').read().split()
229# First 3 words should be "SWIG Version x.y.z"
230if swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
231 print 'Error determining SWIG version.'
232 Exit(1)
233
234min_swig_version = '1.3.28'
235if compare_versions(swig_version[2], min_swig_version) < 0:
236 print 'Error: SWIG version', min_swig_version, 'or newer required.'
237 print ' Installed version:', swig_version[2]
238 Exit(1)
239
240# Set up SWIG flags & scanner
207env.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
208
209import SCons.Scanner
210
211swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
212
213swig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
214 swig_inc_re)
215
216env.Append(SCANNERS = swig_scanner)
217
241env.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
242
243import SCons.Scanner
244
245swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
246
247swig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
248 swig_inc_re)
249
250env.Append(SCANNERS = swig_scanner)
251
218# Other default libraries
219env.Append(LIBS=['z'])
220
221# Platform-specific configuration. Note again that we assume that all
222# builds under a given build root run on the same host platform.
223conf = Configure(env,
224 conf_dir = os.path.join(build_root, '.scons_config'),
225 log_file = os.path.join(build_root, 'scons_config.log'))
226
252# Platform-specific configuration. Note again that we assume that all
253# builds under a given build root run on the same host platform.
254conf = Configure(env,
255 conf_dir = os.path.join(build_root, '.scons_config'),
256 log_file = os.path.join(build_root, 'scons_config.log'))
257
258# Check for zlib. If the check passes, libz will be automatically
259# added to the LIBS environment variable.
260if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++'):
261 print 'Error: did not find needed zlib compression library '\
262 'and/or zlib.h header file.'
263 print ' Please install zlib and try again.'
264 Exit(1)
265
227# Check for <fenv.h> (C99 FP environment control)
228have_fenv = conf.CheckHeader('fenv.h', '<>')
229if not have_fenv:
230 print "Warning: Header file <fenv.h> not found."
231 print " This host has no IEEE FP rounding mode control."
232
233# Check for mysql.
234mysql_config = WhereIs('mysql_config')
235have_mysql = mysql_config != None
236
237# Check MySQL version.
238if have_mysql:
239 mysql_version = os.popen(mysql_config + ' --version').read()
266# Check for <fenv.h> (C99 FP environment control)
267have_fenv = conf.CheckHeader('fenv.h', '<>')
268if not have_fenv:
269 print "Warning: Header file <fenv.h> not found."
270 print " This host has no IEEE FP rounding mode control."
271
272# Check for mysql.
273mysql_config = WhereIs('mysql_config')
274have_mysql = mysql_config != None
275
276# Check MySQL version.
277if have_mysql:
278 mysql_version = os.popen(mysql_config + ' --version').read()
240 mysql_version = mysql_version.split('.')
241 mysql_major = int(mysql_version[0])
242 mysql_minor = int(mysql_version[1])
243 # This version check is probably overly conservative, but it deals
244 # with the versions we have installed.
245 if mysql_major < 4 or (mysql_major == 4 and mysql_minor < 1):
246 print "Warning: MySQL v4.1 or newer required."
279 min_mysql_version = '4.1'
280 if compare_versions(mysql_version, min_mysql_version) < 0:
281 print 'Warning: MySQL', min_mysql_version, 'or newer required.'
282 print ' Version', mysql_version, 'detected.'
247 have_mysql = False
248
249# Set up mysql_config commands.
250if have_mysql:
251 mysql_config_include = mysql_config + ' --include'
252 if os.system(mysql_config_include + ' > /dev/null') != 0:
253 # older mysql_config versions don't support --include, use
254 # --cflags instead

--- 256 unchanged lines hidden ---
283 have_mysql = False
284
285# Set up mysql_config commands.
286if have_mysql:
287 mysql_config_include = mysql_config + ' --include'
288 if os.system(mysql_config_include + ' > /dev/null') != 0:
289 # older mysql_config versions don't support --include, use
290 # --cflags instead

--- 256 unchanged lines hidden ---