115 |
,None |
,None |
116 |
)) |
)) |
117 |
|
|
118 |
|
# Where are the Tk includes? |
119 |
|
opts.Add(PackageOption( |
120 |
|
'TK_CPPPATH' |
121 |
|
,"Where are your Tk include files?" |
122 |
|
,None |
123 |
|
)) |
124 |
|
|
125 |
|
# Where are the Tk libs? |
126 |
|
opts.Add(PackageOption( |
127 |
|
'TK_LIBPATH' |
128 |
|
,"Where are your Tk libraries?" |
129 |
|
,None |
130 |
|
)) |
131 |
|
|
132 |
|
|
133 |
# TODO: OTHER OPTIONS? |
# TODO: OTHER OPTIONS? |
134 |
|
|
180 |
import os,re |
import os,re |
181 |
|
|
182 |
def CheckSwigVersion(context): |
def CheckSwigVersion(context): |
183 |
context.Message("Checking version of SWIG") |
context.Message("Checking version of SWIG... ") |
184 |
cmd = env['SWIG']+' -version' |
cmd = env['SWIG']+' -version' |
185 |
(cin,coutcerr) = os.popen4(cmd); |
(cin,coutcerr) = os.popen4(cmd); |
186 |
output = coutcerr.read() |
output = coutcerr.read() |
222 |
cpppath_add = [] |
cpppath_add = [] |
223 |
if context.env.has_key(varprefix+'_CPPPATH'): |
if context.env.has_key(varprefix+'_CPPPATH'): |
224 |
cpppath_add = [env[varprefix+'_CPPPATH']] |
cpppath_add = [env[varprefix+'_CPPPATH']] |
225 |
|
|
226 |
|
context.env.Append( |
227 |
|
LIBPATH = libpath_add |
228 |
|
, CPPPATH = cpppath_add |
229 |
|
) |
230 |
|
|
231 |
def restore(self,context): |
def restore(self,context): |
232 |
for k in self.keep: |
for k in self.keep: |
238 |
file with the provided text, linking with the |
file with the provided text, linking with the |
239 |
library libname.""" |
library libname.""" |
240 |
|
|
241 |
context.Message( 'Checking for '+libname+'...' ) |
context.Message( 'Checking for '+libname+'... ' ) |
242 |
|
|
243 |
if varprefix==None: |
if varprefix==None: |
244 |
varprefix = libname.upper() |
varprefix = libname.upper() |
245 |
|
|
246 |
keep = KeepContext(context,varprefix) |
keep = KeepContext(context,varprefix) |
247 |
|
|
248 |
context.env.Append( |
context.env.Append(LIBS=[libname]) |
|
LIBS = libname |
|
|
, LIBPATH = libpath_add |
|
|
, CPPPATH = cpppath_add |
|
|
) |
|
249 |
|
|
250 |
is_ok = context.TryLink(text,ext) |
is_ok = context.TryLink(text,ext) |
251 |
|
|
252 |
keep.restore() |
keep.restore(context) |
253 |
|
|
254 |
context.Result(is_ok) |
context.Result(is_ok) |
255 |
return is_ok |
return is_ok |
282 |
) |
) |
283 |
|
|
284 |
#---------------- |
#---------------- |
285 |
# Tcl/Tk test |
# Tcl test |
286 |
|
|
287 |
tcl_check_text = r""" |
tcl_check_text = r""" |
288 |
#include <tcl.h> |
#include <tcl.h> |
296 |
tcl_test_text = open('checktcl.c').read() |
tcl_test_text = open('checktcl.c').read() |
297 |
|
|
298 |
def CheckTcl(context): |
def CheckTcl(context): |
299 |
|
return CheckExtLib(context,'tcl',tcl_check_text) |
300 |
|
|
301 |
|
def CheckTclVersion(context): |
302 |
keep = KeepContext(context,'TCL') |
keep = KeepContext(context,'TCL') |
303 |
context.Message("Checking for Tcl library... ") |
context.Message("Checking Tcl version... ") |
304 |
is_ok = context.TryLink(tcl_check_text,'.c') |
(is_ok,output) = context.TryRun(tcl_check_text,'.c') |
|
context.Result(is_ok) |
|
305 |
keep.restore(context) |
keep.restore(context) |
306 |
if not is_ok: |
if not is_ok: |
307 |
|
context.Result("failed to run check") |
308 |
|
return 0 |
309 |
|
context.Result(output) |
310 |
|
|
311 |
|
major,minor,patch = tuple(int(i) for i in output.split(".")) |
312 |
|
if major != 8 or minor > 3: |
313 |
|
# bad version |
314 |
return 0 |
return 0 |
315 |
|
|
316 |
|
# good version |
317 |
return 1 |
return 1 |
318 |
|
|
319 |
def CheckTclVersion(context): |
#---------------- |
320 |
keep = KeepContext(context,'TCL') |
# Tcl test |
321 |
context.Message("Checking Tcl version... ") |
|
322 |
(is_ok,output) = context.TryRun(tcl_check_text,'.c') |
tk_check_text = r""" |
323 |
|
#include <tk.h> |
324 |
|
#include <stdio.h> |
325 |
|
int main(void){ |
326 |
|
printf("%s",TK_PATCH_LEVEL); |
327 |
|
return 0; |
328 |
|
} |
329 |
|
""" |
330 |
|
def CheckTk(context): |
331 |
|
return CheckExtLib(context,'tk',tk_check_text) |
332 |
|
|
333 |
|
def CheckTkVersion(context): |
334 |
|
keep = KeepContext(context,'TK') |
335 |
|
context.Message("Checking Tk version... ") |
336 |
|
(is_ok,output) = context.TryRun(tk_check_text,'.c') |
337 |
keep.restore(context) |
keep.restore(context) |
338 |
if not is_ok: |
if not is_ok: |
339 |
context.Result("failed to run check") |
context.Result("failed to run check") |
357 |
, 'CheckCUnit' : CheckCUnit |
, 'CheckCUnit' : CheckCUnit |
358 |
, 'CheckTcl' : CheckTcl |
, 'CheckTcl' : CheckTcl |
359 |
, 'CheckTclVersion' : CheckTclVersion |
, 'CheckTclVersion' : CheckTclVersion |
360 |
|
, 'CheckTk' : CheckTk |
361 |
|
, 'CheckTkVersion' : CheckTkVersion |
362 |
# , 'CheckIsNan' : CheckIsNan |
# , 'CheckIsNan' : CheckIsNan |
363 |
# , 'CheckCppUnitConfig' : CheckCppUnitConfig |
# , 'CheckCppUnitConfig' : CheckCppUnitConfig |
364 |
} |
} |
382 |
|
|
383 |
# Tcl/Tk |
# Tcl/Tk |
384 |
|
|
385 |
if conf.CheckTcl(): |
if conf.CheckTcl() and conf.CheckTk(): |
386 |
if with_tcltk_gui and not conf.CheckTclVersion(): |
if with_tcltk_gui and not conf.CheckTclVersion(): |
387 |
print "Wrong Tcl version used. Please specify you 8.3 Tcl installation"\ |
without_tcltk_reason = "Require Tcl <= 8.3 Tcl." |
|
+" via the TCL_CPPPATH and TCL_LIBPATH options, or use"\ |
|
|
+" WITHOUT_TCLTK_GUI=1 to prevent build of Tcl/Tk components.\n" |
|
388 |
with_tcltk_gui = False |
with_tcltk_gui = False |
389 |
|
|
390 |
if with_tcltk_gui and not conf.CheckHeader('tk.h'): |
if with_tcltk_gui and not conf.CheckTkVersion(): |
391 |
with_tcltk_gui = False |
without_tcltk_reason += "Require Tk version <= 8.3. See 'scons -h'" |
392 |
|
with_tcltk_gui = False |
393 |
if with_tcltk_gui and not conf.CheckLib('tk'): |
else: |
394 |
with_tcktk_gui = False |
without_tcltk_reason = "Tcl/Tk not found." |
|
|
|
395 |
# Python... obviously we're already running python, so we just need to |
# Python... obviously we're already running python, so we just need to |
396 |
# check that we can link to the python library OK: |
# check that we can link to the python library OK: |
397 |
|
|
398 |
if platform.system()=="Windows": |
if platform.system()=="Windows": |
|
#conf.env.Append(LIBPATH='c:\Python24\libs') |
|
|
#conf.env.Append(CPPPATH='c:\Python24\include') |
|
|
#python_header='Python.h' |
|
399 |
python_lib='python24' |
python_lib='python24' |
|
#python_libpath=['c:\\Python24\\libs'] |
|
|
#python_cpppath=['c:\\Python24\\include'] |
|
400 |
else: |
else: |
|
#python_header='python2.4/Python.h' |
|
401 |
python_lib='python2.4' |
python_lib='python2.4' |
|
#python_libpath=[] |
|
|
#python_cpppath=['/usr/include/python2.4'] |
|
|
|
|
|
#if not conf.CheckLibWithHeader(python_lib,python_header,'C' |
|
|
# , LIBPATH=[distutils.sysconfig.PREFIX+"/libs"] |
|
|
# , CPPPATH=[distutils.sysconfig.get_python_inc()] |
|
|
#): |
|
|
# print "Didn't find Python 2.4 ("+python_lib+")" |
|
|
# with_python = False |
|
|
#else: |
|
402 |
|
|
403 |
# SWIG version |
# SWIG version |
404 |
|
|
426 |
env.Append(PYTHON_LIBPATH=[distutils.sysconfig.PREFIX+"/libs"]) |
env.Append(PYTHON_LIBPATH=[distutils.sysconfig.PREFIX+"/libs"]) |
427 |
env.Append(PYTHON_LIB=[python_lib]) |
env.Append(PYTHON_LIB=[python_lib]) |
428 |
env.Append(PYTHON_CPPPATH=[distutils.sysconfig.get_python_inc()]) |
env.Append(PYTHON_CPPPATH=[distutils.sysconfig.get_python_inc()]) |
|
print "PYTHON_LIBPATH =",env['PYTHON_LIBPATH'] |
|
|
print "PYTHON_CPPPATH =",env['PYTHON_CPPPATH'] |
|
429 |
|
|
430 |
if not with_python: |
if not with_python: |
431 |
print "Can't build python interface" |
print "Can't build python interface" |
525 |
if with_tcltk_gui: |
if with_tcltk_gui: |
526 |
env.SConscript(['tcltk98/generic/interface/SConscript'],'env') |
env.SConscript(['tcltk98/generic/interface/SConscript'],'env') |
527 |
else: |
else: |
528 |
print "Skipping... Tcl/Tk GUI isn't being built" |
print "Skipping... Tcl/Tk GUI isn't being built:",without_tcltk_reason |
529 |
|
|
530 |
if with_python: |
if with_python: |
531 |
env.SConscript(['pygtk/interface/SConscript'],'env') |
env.SConscript(['pygtk/interface/SConscript'],'env') |