| 1 |
johnpye |
385 |
import os, commands, platform |
| 2 |
|
|
|
| 3 |
|
|
#------------------------------------------------------ |
| 4 |
|
|
# OPTIONS |
| 5 |
|
|
|
| 6 |
|
|
env = Environment(ENV=os.environ) |
| 7 |
|
|
opts = Options(['options.cache', 'config.py']) |
| 8 |
|
|
print "PLATFORM = ",platform.system() |
| 9 |
|
|
|
| 10 |
|
|
# TODO: add install options |
| 11 |
|
|
|
| 12 |
|
|
# TODO: OTHER OPTIONS? |
| 13 |
|
|
|
| 14 |
|
|
# TODO: flags for optimisation |
| 15 |
|
|
|
| 16 |
|
|
# Package linking option |
| 17 |
johnpye |
386 |
opts.Add(EnumOption( |
| 18 |
|
|
'PACKAGE_LINKING' |
| 19 |
johnpye |
385 |
, 'Style of linking for external libraries' |
| 20 |
|
|
, 'DYNAMIC_PACKAGES' |
| 21 |
johnpye |
386 |
, ['DYNAMIC_PACKAGES', 'STATIC_PACKAGES', 'NO_PACKAGES'] |
| 22 |
|
|
)) |
| 23 |
johnpye |
385 |
|
| 24 |
johnpye |
386 |
opts.Add(BoolOption( |
| 25 |
|
|
'WITHOUT_TCLTK_GUI' |
| 26 |
|
|
,"Set to True if you don't want to build the original Tcl/Tk GUI." |
| 27 |
|
|
, False |
| 28 |
|
|
)) |
| 29 |
|
|
|
| 30 |
johnpye |
387 |
opts.Add(BoolOption( |
| 31 |
|
|
'WITHOUT_PYTHON' |
| 32 |
|
|
,"Set to True if you don't want to build Python wrappers." |
| 33 |
|
|
, False |
| 34 |
|
|
)) |
| 35 |
|
|
|
| 36 |
johnpye |
385 |
opts.Update(env) |
| 37 |
|
|
opts.Save('options.cache',env) |
| 38 |
|
|
|
| 39 |
|
|
Help(opts.GenerateHelpText(env)) |
| 40 |
|
|
|
| 41 |
|
|
env.Append(CPPDEFINES=env['PACKAGE_LINKING']) |
| 42 |
|
|
|
| 43 |
johnpye |
386 |
with_tcltk_gui = (env['WITHOUT_TCLTK_GUI']==False) |
| 44 |
|
|
|
| 45 |
johnpye |
387 |
with_python = (env['WITHOUT_PYTHON']==False) |
| 46 |
|
|
|
| 47 |
johnpye |
385 |
#------------------------------------------------------ |
| 48 |
|
|
# CONFIGURATION |
| 49 |
|
|
|
| 50 |
|
|
conf = Configure(env |
| 51 |
|
|
, custom_tests = { |
| 52 |
|
|
# 'CheckIsNan' : CheckIsNan |
| 53 |
|
|
# ,'CheckCppUnitConfig' : CheckCppUnitConfig |
| 54 |
|
|
} |
| 55 |
|
|
, config_h = "config.h" |
| 56 |
|
|
) |
| 57 |
|
|
|
| 58 |
|
|
# Math library |
| 59 |
|
|
if not conf.CheckLibWithHeader(['m','c','libc'], 'math.h', 'C'): |
| 60 |
|
|
print 'Did not find libm.a or m.lib, exiting!' |
| 61 |
|
|
Exit(1) |
| 62 |
|
|
|
| 63 |
|
|
# Where is 'isnan'? |
| 64 |
|
|
|
| 65 |
|
|
if not conf.CheckFunc('isnan'): |
| 66 |
|
|
print "Didn't find isnan" |
| 67 |
|
|
Exit(1) |
| 68 |
|
|
|
| 69 |
johnpye |
387 |
# Tcl/Tk |
| 70 |
johnpye |
386 |
if not conf.CheckHeader('tcl.h'): |
| 71 |
|
|
with_tcltk_gui = False |
| 72 |
|
|
|
| 73 |
|
|
if not conf.CheckHeader('tk.h'): |
| 74 |
|
|
with_tcltk_gui = False |
| 75 |
|
|
|
| 76 |
|
|
if not conf.CheckLib('tcl'): |
| 77 |
|
|
with_tcltk_gui = False |
| 78 |
|
|
|
| 79 |
|
|
if not conf.CheckLib('tk'): |
| 80 |
|
|
with_tcktk_gui = False |
| 81 |
|
|
|
| 82 |
johnpye |
387 |
# Python |
| 83 |
|
|
if not conf.CheckHeader('python2.4/Python.h'): |
| 84 |
|
|
print "Didn't find Python 2.4" |
| 85 |
|
|
with_python = False |
| 86 |
|
|
else: |
| 87 |
|
|
env.Append(CPPPATH=['/usr/include/python2.4']) |
| 88 |
|
|
|
| 89 |
johnpye |
385 |
# TODO: -D_HPUX_SOURCE is needed |
| 90 |
|
|
|
| 91 |
|
|
# TODO: check size of void* |
| 92 |
|
|
|
| 93 |
|
|
#------------------------------------------------------ |
| 94 |
|
|
# SUBDIRECTORIES.... |
| 95 |
|
|
|
| 96 |
|
|
env.Append(CPPPATH=['..']) |
| 97 |
|
|
|
| 98 |
|
|
env.SConscript(['base/generic/general/SConscript'],'env') |
| 99 |
|
|
|
| 100 |
|
|
env.SConscript(['base/generic/utilities/SConscript'],'env') |
| 101 |
|
|
|
| 102 |
|
|
env.SConscript(['base/generic/compiler/SConscript'],'env') |
| 103 |
|
|
|
| 104 |
|
|
env.SConscript(['base/generic/solver/SConscript'],'env') |
| 105 |
|
|
|
| 106 |
|
|
env.SConscript(['base/generic/packages/SConscript'],'env') |
| 107 |
johnpye |
386 |
|
| 108 |
|
|
if with_tcltk_gui: |
| 109 |
|
|
env.SConscript(['tcltk98/generic/interface/SConscript'],'env') |
| 110 |
|
|
|
| 111 |
johnpye |
387 |
if with_python: |
| 112 |
|
|
env.SConscript(['pygtk/interface/SConscript'],'env') |