/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1680 by jpye, Wed Dec 19 07:15:49 2007 UTC revision 2354 by jpye, Sat Jan 8 12:13:27 2011 UTC
# Line 1  Line 1 
1  import sys, os, commands, platform, distutils.sysconfig, os.path, re  #!/usr/bin/python invoke_using_scons
2    # This is a build script for use with SCons. Use it to compile ASCEND on
3    # Linux, Windows. It should also give some success on Mac, although this is
4    # much less tested.
5    
6    # version number for this ASCEND build:
7    version = "0.9.8"
8    
9    # shared library API numbering, for Linux (FIXME windows too?)
10    soname_major = ".1"
11    soname_minor = ".0"
12    
13  version = "0.9.5.114"  import sys, os, commands, platform, distutils.sysconfig, os.path, re, types
14    import subprocess
15    
16    # version number for python, useful on Windows
17  pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1])  pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1])
18    
19  #------------------------------------------------------  #------------------------------------------------------
20  # OPTIONS  # PLATFORM DEFAULTS
 #  
 # Note that if you set the options via the command line, they will be  
 # remembered in the file 'options.cache'. It's a feature ;-)  
21    
 opts = Options(['options.cache', 'config.py'])  
22  #print "PLATFORM = ",platform.system()  #print "PLATFORM = ",platform.system()
23    
24    default_install_prefix = '/usr/local'
25    default_install_bin = "$INSTALL_PREFIX/bin"
26    default_install_lib = "$INSTALL_PREFIX/lib"
27    default_install_models = "$INSTALL_LIB/ascend/models"
28    default_install_solvers = "$INSTALL_LIB/ascend/solvers"
29    default_install_assets = "$INSTALL_ASCDATA/glade/"
30    default_install_ascdata = "$INSTALL_SHARE/ascend"
31    default_install_include = "$INSTALL_PREFIX/include"
32    default_install_python = distutils.sysconfig.get_python_lib()
33    default_install_python_ascend = "$INSTALL_PYTHON/ascend"
34    default_tcl = '/usr'
35    default_tcl_libpath = "$TCL/lib"
36  default_tcl_cpppath = "$TCL/include"  default_tcl_cpppath = "$TCL/include"
37  default_tron_envvar="TRON_PATH"  default_tron_envvar="TRON_PATH"
38  default_conopt_envvar="CONOPT_PATH"  default_conopt_envvar="CONOPT_PATH"
39    default_with_graphviz = True
40    default_tcl_lib = "tcl8.5"
41    default_tk_lib = "tk8.5"
42    default_tktable_lib = "Tktable2.9"
43    default_ida_prefix="$DEFAULT_PREFIX"
44    default_ipopt_libpath = "$IPOPT_PREFIX/lib"
45    default_ipopt_dll = "$IPOPT_LIBPATH/Ipopt38.dll"
46    default_ipopt_libs = ["$F2C_LIB","blas","lapack","pthread","ipopt"]
47    default_conopt_prefix="$DEFAULT_PREFIX"
48    default_conopt_libpath="$CONOPT_PREFIX"
49    default_conopt_cpppath="$CONOPT_PREFIX"
50    default_conopt_dlpath="$CONOPT_PREFIX"
51    default_tron_prefix="$DEFAULT_PREFIX"
52    default_tron_dlpath="$TRON_PREFIX/lib"
53    default_tron_lib="tron1"
54    default_prefix="/usr"
55    default_libpath="$DEFAULT_PREFIX/lib"
56    default_cpppath="$DEFAULT_PREFIX/include"
57    default_fortran="gfortran"
58    default_f2c_lib="gfortran"
59    default_swig="swig"
60    
61    icon_extension = '.png'
62    
63  if platform.system()=="Windows":  if platform.system()=="Windows":
64      default_tcl_lib = "tcl84"      default_prefix="c:\\MinGW"
65      default_tk_lib = "tk84"      default_libpath="$DEFAULT_PREFIX\\lib"
66        default_cpppath="$DEFAULT_PREFIX\\include"  
67    
68        # these correspond the the version of Tcl/Tk linked to in the NSIS scripts
69        default_tcl_lib = "tcl85"
70        default_tk_lib = "tk85"
71      default_tktable_lib = "Tktable28"      default_tktable_lib = "Tktable28"
72    
73      default_install_assets = "glade/"      default_install_assets = "glade/"
     icon_extension = '.png'  
74      default_tcl = "c:\\Tcl"      default_tcl = "c:\\Tcl"
75      if os.environ.get('MSYSTEM'):      if os.environ.get('MSYSTEM'):
76          default_tcl_libpath="$TCL\\bin"          default_tcl_libpath="$TCL\\bin"
77      else:      else:
78          default_tcl_libpath="$TCL\\lib"          default_tcl_libpath="$TCL\\lib"
79      default_rel_distdir = '.'  
80        # on Windows, we build ASCEND such that it finds it support files
81        # using paths relative to the location of the executable
82      default_absolute_paths = False      default_absolute_paths = False
83        default_dist_rel_bin = '.'
84        default_tk_rel_dist = 'tcltk'
85        default_library_rel_dist = 'models'
86        default_solvers_rel_dist = 'solvers'
87            
88        # where to look for IDA solver libraries, headers, etc.
89      default_ida_prefix = "c:\\MinGW"      default_ida_prefix = "c:\\MinGW"
90      if not os.path.exists(default_ida_prefix):      
91          default_ida_prefix = None      # IPOPT
92        default_ipopt_libpath = "$IPOPT_PREFIX/lib/win32/release"
93        default_ipopt_libs = ["Ipopt"]
94    
95        # where to look for CONOPT when compiling
96      default_conopt_prefix = "c:\\Program Files\\CONOPT"      default_conopt_prefix = "c:\\Program Files\\CONOPT"
97      default_conopt_libpath="$CONOPT_PREFIX"      default_conopt_libpath="$CONOPT_PREFIX"
98      default_conopt_cpppath="$CONOPT_PREFIX"      default_conopt_cpppath="$CONOPT_PREFIX"
99      default_conopt_dlpath="$CONOPT_PREFIX"      default_conopt_dlpath="$CONOPT_PREFIX"
100      default_conopt_lib="conopt3"      default_conopt_lib="conopt3"
101    
102        # FIXME remove this
103      default_tron_prefix="c:\\Program Files\\TRON"      default_tron_prefix="c:\\Program Files\\TRON"
104      default_tron_dlpath="$TRON_PREFIX"      default_tron_dlpath="$TRON_PREFIX"
105      default_tron_lib="tron1"          
106        need_libm = False
107      default_prefix="c:\\MinGW"      python_exe = sys.executable
108      default_libpath="$DEFAULT_PREFIX\\lib"      default_with_scrollkeeper=False
109      default_cpppath="$DEFAULT_PREFIX\\include"      pathsep = ";"
110        
111        default_fortran="gfortran"
112        default_f2c_lib="gfortran"
113            
114        default_swig=WhereIs("swig.exe")
115        
116        soname_minor = ""
117        soname_major = ""
118        # still problems with Graphviz on Windows, leave it off now by default.
119    
120      if not os.path.exists(default_conopt_prefix):      if not os.path.exists(default_conopt_prefix):
121          default_conopt_prefix = None          default_conopt_prefix = None
122    
123    elif platform.system()=="Darwin":
124    
125        default_install_prefix = ''
126        default_install_bin = "$INSTALL_PREFIX/ASCEND.app/Contents"
127        default_install_lib = "$INSTALL_BIN"
128        #default_install_models = "$INSTALL_PREFIX/Library/Application Support/ASCEND/Models"
129        default_install_models = "$INSTALL_BIN/Models"
130        #default_install_solvers = "$INSTALL_PREFIX/Library/Application Support/ASCEND/Solvers"
131        default_install_solvers = "$INSTALL_BIN/Solvers"
132        default_install_ascdata = "$INSTALL_BIN/Resources"
133        default_install_include = "$INSTALL_BIN/Headers"
134        default_install_python = "$INSTALL_BIN/Python"
135        default_install_python_ascend = default_install_python
136        default_install_assets = "$INSTALL_ASCDATA/glade/"
137        # FIXME still need to work out the Tcl/Tk side of things...
138    
139        # within the bundle, we'll use relative paths
140        default_absolute_paths = False
141        default_dist_rel_bin = '.'
142        default_tk_rel_dist = 'tcltk'
143    
144        # we want these to be in /Library/ASCEND/Models and /Library/ASCEND/Solvers
145        default_library_rel_dist = 'Models'
146        default_solvers_rel_dist = 'Solvers'
147    
148        # where to look for CONOPT when compiling
149        default_conopt_prefix = "/Library/CONOPT"
150    
151        default_conopt_lib="conopt3"
152    
153        # FIXME remove this
154        default_tron_dlpath="$TRON_PREFIX"
155        default_tron_lib="tron1"
156                    
157      need_libm = False      need_libm = False
158      python_exe = sys.executable      python_exe = sys.executable
159      default_with_scrollkeeper=False      default_with_scrollkeeper=False
160      pathsep = ";"      pathsep = ";"
161            
162      default_fortran="g77"      if not os.path.exists(default_conopt_prefix):
163      default_f2c_lib="g2c"          default_conopt_prefix = None
164            
165  else:  else: # LINUX
166      default_tcl_lib = "tcl8.4"  
     default_tk_lib = "tk8.4"  
     default_tktable_lib = "Tktable2.8"  
     default_install_assets = "$INSTALL_ASCDATA/glade/"  
167      icon_extension = '.svg'      icon_extension = '.svg'
     default_tcl = '/usr'  
     default_tcl_libpath = "$TCL/lib"  
168    
169      if os.path.exists("/etc/debian_version"):      if os.path.exists("/etc/debian_version"):
170          default_tcl_cpppath = "/usr/include/tcl8.4"          default_tcl_cpppath = "/usr/include/tcl8.4"
171            default_tcl_lib = "tcl8.4"
172            default_tk_lib = "tk8.4"
173            default_tktable_lib = "Tktable2.8"
174    
175        if os.path.exists("/etc/SuSE-release"):
176            default_tcl_cpppath = "/usr/include"
177            default_tcl_lib = "tcl8.4"
178            default_tk_lib = "tk8.4"
179            default_tktable_lib = "Tktable2.9"
180    
181        if os.path.exists("/etc/lsb-release"):
182            _f = file("/etc/lsb-release")
183            _r = re.compile("([A-Z][^=]*)=(.*)")
184            LSB = {}
185            for l in _f:
186                _m = _r.match(l.strip())
187                LSB[_m.group(1)] = _m.group(2)
188                    print LSB
189            if LSB.has_key('DISTRIB_ID') and LSB['DISTRIB_ID'] == "Ubuntu":
190                if float(LSB['DISTRIB_RELEASE']) >= 9.04:
191                    default_tcl_lib = "tcl8.5"
192                    default_tk_lib = "tk8.5"
193                    default_tktable_lib = "Tktable2.9"
194                    default_tcl_cpppath = "/usr/include/tcl8.5"
195                
196    
     default_rel_distdir = '../share/ascend'  
197      default_absolute_paths = True      default_absolute_paths = True
198      default_ida_prefix="/usr"      default_dist_rel_bin = '..'
199      default_conopt_prefix="/usr"      default_tk_rel_dist = 'share/ascend/tcltk'
200        default_library_rel_dist = 'lib/ascend/models'
201        default_solvers_rel_dist = 'lib/ascend/solvers'
202    
203        default_conopt_prefix = "$DEFAULT_PREFIX"
204      default_conopt_libpath="$CONOPT_PREFIX/lib"      default_conopt_libpath="$CONOPT_PREFIX/lib"
205      default_conopt_cpppath="$CONOPT_PREFIX/include"      default_conopt_cpppath="$CONOPT_PREFIX/include"
206      default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"      default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"
207      default_conopt_lib="consub3"      default_conopt_lib="consub3"
208    
     default_tron_prefix="/usr"  
     default_tron_dlpath="$TRON_PREFIX/lib"  
     default_tron_lib="tron1"  
   
     default_prefix="/usr"  
     default_libpath="$DEFAULT_PREFIX/lib"  
     default_cpppath="$DEFAULT_PREFIX/include"  
   
209      need_libm = True      need_libm = True
210      if not os.path.isdir(default_tcl):      if not os.path.isdir(default_tcl):
211          default_tcl = '/usr'          default_tcl = '/usr'
212      python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"      python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"
213      default_with_scrollkeeper=False      default_with_scrollkeeper=False
214      pathsep = ":"      pathsep = ":"
215            
216        #default_graphviz_libs=["graph","cdt","gvc"]
217        #default_graphviz_libpath = default_libpath
218        #if os.path.exists("/usr/lib/graphviz/libgraph.so"):
219        #   # for Ubuntu 7.04
220        #   default_graphviz_libpath="/usr/lib/graphviz"
221        #   default_graphviz_rpath="$GRAPHVIZ_LIBPATH"
222    
223    if not os.path.exists(default_tron_prefix):
224        default_tron_prefix = None
225    
226    if not os.path.exists(default_ida_prefix):
227        default_ida_prefix = None
228    
229    soname_clean = "${SHLIBPREFIX}ascend${SHLIBSUFFIX}"
230    soname_full = "%s%s" % (soname_clean,soname_major)
231    
232    #------------------------------------------------------
233    # OPTIONS
234    #
235    # The following give the set of command-line parameters that can be passed to
236    # SCons from the commandline. Options will be 'remembered' by being cached
237    # in the file 'options.cache'; if you want to start with a clean slate, you
238    # should remove that file.
239    
240    vars = Variables(['options.cache', 'config.py'])
241            
242      default_fortran="gfortran"  vars.Add(
     default_f2c_lib="gfortran"  
       
 opts.Add(  
243      'CC'      'CC'
244      ,'C Compiler command'      ,'C Compiler command'
245      ,None      ,None
246  )  )
247    
248  opts.Add(  vars.Add(
249      'CXX'      'CXX'
250      ,'C++ Compiler command'      ,'C++ Compiler command'
251      ,None      ,None
252  )  )
253    
254  opts.Add(BoolOption(  vars.Add(BoolVariable(
255      'GCOV'      'GCOV'
256      , 'Whether to enable coverage testing in object code'      , 'Whether to enable coverage testing in object code'
257      , False      , False
258  ))  ))
259    
260  opts.Add(BoolOption(  if platform.system()!="Windows":
261      'WITH_GCCVISIBILITY'      vars.Add(BoolVariable(
262      ,"Whether to use GCC Visibility features (only applicable if available)"          'WITH_GCCVISIBILITY'
263      ,True          ,"Whether to use GCC Visibility features (only applicable if available)"
264  ))          ,True
265        ))
266    
267  opts.Add(BoolOption(  vars.Add(BoolVariable(
268      'WITH_SIGNALS'      'WITH_SIGNALS'
269      ,"Whether to permit use of signals for flow control in the C-level code"      ,"Whether to permit use of signals for flow control in the C-level code"
270      ,True      ,True
271  ))  ))
272    
273  # You can turn off building of Tcl/Tk interface  # You can turn off building of Tcl/Tk interface
274  opts.Add(BoolOption(  vars.Add(BoolVariable(
275      'WITH_TCLTK'      'WITH_TCLTK'
276      ,"Set to False if you don't want to build the original Tcl/Tk GUI."      ,"Set to False if you don't want to build the original Tcl/Tk GUI."
277      , True      , True
278  ))  ))
279    
280  # You can turn off the building of the Python interface  # You can turn off the building of the Python interface
281  opts.Add(BoolOption(  vars.Add(BoolVariable(
282      'WITH_PYTHON'      'WITH_PYTHON'
283      ,"Set to False if you don't want to build Python wrappers."      ,"Set to False if you don't want to build Python wrappers."
284      , True      , True
285  ))  ))
286    
287  # Which solvers will we allow?  # Which solvers will we allow?
288  opts.Add(ListOption(  vars.Add(ListVariable(
289      'WITH_SOLVERS'      'WITH_SOLVERS'
290      ,"List of the solvers you want to build. The default is the minimum that"        ,"List of the solvers you want to build. The default is the minimum that"  
291          +" works. The option 'LSOD' is provided for backwards compatibility"          +" works. The option 'LSOD' is provided for backwards compatibility"
292          +"; the value 'LSODE' is preferred."          +"; the value 'LSODE' is preferred."
293      ,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","TRON","IPOPT"]      ,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","TRON","IPOPT","DOPRI5"]
294      ,['QRSLV','MPS','SLV','OPTSQP'      ,['QRSLV','MPS','SLV','OPTSQP'
295          ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'          ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'
296          ,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT"          ,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT","DOPRI5"
297       ]       ]
298  ))  ))
299    
300  # Where will the local copy of the help files be kept?  # Where will the local copy of the help files be kept?
301  opts.Add(BoolOption(  vars.Add(BoolVariable(
302      'WITH_DOC'      'WITH_DOC'
303      , "Should we try to build and install help files? If not, ASCEND will access online help files"      , "Should we try to build and install help files? If not, ASCEND will access online help files"
304      , True      , True
305  ))  ))
306    
307  opts.Add(BoolOption(  vars.Add(BoolVariable(
308      'WITH_DOC_BUILD'      'WITH_DOC_BUILD'
309      , "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)"      , "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)"
310      , "$WITH_DOC"      , "$WITH_DOC"
311  ))  ))
312    
313  opts.Add(BoolOption(  vars.Add(BoolVariable(
314      'WITH_DOC_INSTALL'      'WITH_DOC_INSTALL'
315      , "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it."      , "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it."
316      , "$WITH_DOC"      , "$WITH_DOC"
317  ))  ))
318    
319  opts.Add(  vars.Add(
320      'HELP_ROOT'      'HELP_ROOT'
321      , "Location of the main help file"      , "Location of the main help file"
322      , "$INSTALL_DOC/book.pdf"      , "$INSTALL_DOC/book.pdf"
323  )  )
324    
325  # Will bintoken support be enabled?  # Will bintoken support be enabled?
326  opts.Add(BoolOption(  vars.Add(BoolVariable(
327      'WITH_BINTOKEN'      'WITH_BINTOKEN'
328      ,"Enable bintoken support? This means compiling models as C-code before"      ,"Enable bintoken support? This means compiling models as C-code before"
329          +" running them, to increase solving speed for large models."          +" running them, to increase solving speed for large models."
# Line 191  opts.Add(BoolOption( Line 332  opts.Add(BoolOption(
332    
333  # What should the default ASCENDLIBRARY path be?  # What should the default ASCENDLIBRARY path be?
334  # Note: users can change it by editing their ~/.ascend.ini  # Note: users can change it by editing their ~/.ascend.ini
335  opts.Add(  vars.Add(
336      'DEFAULT_ASCENDLIBRARY'      'DEFAULT_ASCENDLIBRARY'
337      ,"Set the default value of the ASCENDLIBRARY -- the location where"      ,"Set the default value of the ASCENDLIBRARY -- the location where"
338          +" ASCEND will look for models when running ASCEND"          +" ASCEND will look for models when running ASCEND"
# Line 200  opts.Add( Line 341  opts.Add(
341    
342  # What should the default ASCENDLIBRARY path be?  # What should the default ASCENDLIBRARY path be?
343  # Note: users can change it by editing their ~/.ascend.ini  # Note: users can change it by editing their ~/.ascend.ini
344  opts.Add(  vars.Add(
345      'DEFAULT_ASCENDSOLVERS'      'DEFAULT_ASCENDSOLVERS'
346      ,"Set the default value of ASCENDSOLVERS -- the location where"      ,"Set the default value of ASCENDSOLVERS -- the location where"
347          +" ASCEND will look for solver shared-library files"          +" ASCEND will look for solver shared-library files"
# Line 208  opts.Add( Line 349  opts.Add(
349  )  )
350    
351  # Where is SWIG?  # Where is SWIG?
352  opts.Add(  vars.Add(
353      'SWIG'      'SWIG'
354      ,"SWIG location, probably only required for MinGW and MSVC users."      ,"SWIG location, probably only required for MinGW and MSVC users."
355          +" Enter the location as a Windows-style path, for example"          +" Enter the location as a Windows-style path, for example"
356          +" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'."          +" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'."
357        ,default_swig
358  )  )
359    
360  # Build the test suite?  # Build the test suite?
361  opts.Add(BoolOption(  vars.Add(BoolVariable(
362      'WITH_CUNIT'      'WITH_CUNIT'
363      ,"You can disable CUnit tests with this option. This will basically stop"      ,"You can disable CUnit tests with this option. This will basically stop"
364          +" SCons from parsing the SConscript files relating to the 'test'"          +" SCons from parsing the SConscript files relating to the 'test'"
# Line 227  opts.Add(BoolOption( Line 369  opts.Add(BoolOption(
369  ))  ))
370    
371  # Build with MMIO matrix export support?  # Build with MMIO matrix export support?
372  opts.Add(BoolOption(  vars.Add(BoolVariable(
373      'WITH_MMIO'      'WITH_MMIO'
374      ,"Include support for exporting matrices in Matrix Market format"      ,"Include support for exporting matrices in Matrix Market format"
375      ,True      ,True
376  ))  ))
377    
378  #----- default paths -----  #----- default paths -----
379  opts.Add(PackageOption(  vars.Add(PackageVariable(
380      'DEFAULT_PREFIX'      'DEFAULT_PREFIX'
381      ,"Where are most of the shared libraries located on your system?"      ,"Where are most of the shared libraries located on your system?"
382      ,default_prefix      ,default_prefix
383  ))  ))
384    
 #------ install location for python extensions ------  
   
 # (removed for the moment)  
   
385  #------ cunit --------  #------ cunit --------
386    # CUnit is a unit testing library that we use to test libascend.
387    
388  # Where was CUNIT installed?  # Where was CUNIT installed?
389  opts.Add(PackageOption(  vars.Add(PackageVariable(
390      'CUNIT_PREFIX'      'CUNIT_PREFIX'
391      ,"Where are your CUnit files?"      ,"Where are your CUnit files?"
392      ,"$DEFAULT_PREFIX"      ,"$DEFAULT_PREFIX"
393  ))  ))
394    
395  # Where are the CUnit includes?  # Where are the CUnit includes?
396  opts.Add(PackageOption(  vars.Add(PackageVariable(
397      'CUNIT_CPPPATH'      'CUNIT_CPPPATH'
398      ,"Where are your CUnit include files?"      ,"Where are your CUnit include files?"
399      ,"$CUNIT_PREFIX/include"      ,"$CUNIT_PREFIX/include"
400  ))  ))
401    
402  # Where are the CUnit libraries?  # Where are the CUnit libraries?
403  opts.Add(PackageOption(  vars.Add(PackageVariable(
404      'CUNIT_LIBPATH'      'CUNIT_LIBPATH'
405      ,"Where are your CUnit libraries?"      ,"Where are your CUnit libraries?"
406      ,"$CUNIT_PREFIX/lib"      ,"$CUNIT_PREFIX/lib"
407  ))  ))
408    
 #-------- ida -------  
   
 opts.Add(PackageOption(  
     "SUNDIALS_PREFIX"  
     ,"Prefix for your IDA install (IDA ./configure --prefix)"  
     ,default_ida_prefix  
 ))  
   
 opts.Add(  
     'SUNDIALS_CPPPATH'  
     ,"Where is your ida.h?"  
     ,"$SUNDIALS_PREFIX/include"  
 )  
   
 #  
 opts.Add(  
     'SUNDIALS_LIBPATH'  
     ,"Where are your SUNDIALS libraries installed?"  
     ,"$SUNDIALS_PREFIX/lib"  
 )  
   
 opts.Add(  
     'SUNDIALS_LIBS'  
     ,"What libraries are required for SUNDIALS?"  
     ,['sundials_nvecserial','sundials_ida','m']  
 )  
   
409  # ----- conopt-----  # ----- conopt-----
410    
411  opts.Add(PackageOption(  vars.Add(PackageVariable(
412      "CONOPT_PREFIX"      "CONOPT_PREFIX"
413      ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"      ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"
414      ,default_conopt_prefix      ,default_conopt_prefix
415  ))  ))
416    
417  opts.Add(  vars.Add(
418      "CONOPT_LIB"      "CONOPT_LIB"
419      ,"Library linked to for CONOPT"      ,"Library linked to for CONOPT. This is the name of the CONOPT .so or DLL. On Windows it seems to be called 'copopt3' but on linux it seems to be called 'consub3'."
420      ,default_conopt_lib      ,default_conopt_lib
421  )  )
422    
423  opts.Add(BoolOption(  vars.Add(BoolVariable(
424      "CONOPT_LINKED"      "CONOPT_LINKED"
425      ,"Do you want to dynamically link to CONOPT (only possible if CONOPT is available at buildtime)"      ,"Do you want to dynamically link to CONOPT (only possible if CONOPT is available at buildtime)"
426      ,False      ,False
427  ))  ))
428    
429  opts.Add(  vars.Add(
430      'CONOPT_CPPPATH'      'CONOPT_CPPPATH'
431      ,"Where is your conopt.h?"      ,"Where is your conopt.h?"
432      ,default_conopt_cpppath      ,default_conopt_cpppath
433  )  )
434    
435  opts.Add(  vars.Add(
436      'CONOPT_LIBPATH'      'CONOPT_LIBPATH'
437      ,"Where is your CONOPT library installed?"      ,"Where is your CONOPT library installed?"
438      ,default_conopt_libpath      ,default_conopt_libpath
439  )  )
440    
441  opts.Add(  vars.Add(
442      'CONOPT_DLPATH'      'CONOPT_DLPATH'
443      ,"What is the default search path that ASCEND should use when dlopening the CONOPT library at runtime?"      ,"Default (fallback) search path that ASCEND should use when dlopening the CONOPT library at runtime? This is only used if the conopt environment variable doesn't exist and doesn't point to a location where the DLL/SO is found.  This is in platform-specific form (paths with ';' separator in Windows, ':' separator on Linux)."
444      ,default_conopt_dlpath      ,default_conopt_dlpath
445  )  )
446    
447  opts.Add(  vars.Add(
448      'CONOPT_ENVVAR'      'CONOPT_ENVVAR'
449      ,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?"      ,"Name of the optional environment variable which will be used for the value of the searchpath for the CONOPT DLL/SO."
450      ,default_conopt_envvar      ,default_conopt_envvar
451  )  )
452    
453  #------- IPOPT -------  #------- IPOPT -------
454    
455  opts.Add(PackageOption(  if platform.system()=="Windows":
456      "IPOPT_PREFIX"      vars.Add(PackageVariable(
457      ,"Prefix for your IPOPT install (IPOPT ./configure --prefix)"          "IPOPT_PREFIX"
458      ,default_conopt_prefix          ,"Prefix for your IPOPT install (IPOPT ./configure --prefix)"
459  ))          ,default_conopt_prefix
460        ))
461    
462  opts.Add(      vars.Add(
463      "IPOPT_LIBS"          "IPOPT_LIBS"
464      ,"Library linked to for IPOPT"          ,"Library linked to for IPOPT"
465      ,["$F2C_LIB","blas","lapack","pthread","ipopt"]          ,default_ipopt_libs
466  )      )
467    
468    
469  opts.Add(      vars.Add(
470      "IPOPT_LIBPATH"          "IPOPT_LIBPATH"
471      ,"Where is your IPOPT library installed"          ,"Where is your IPOPT library installed"
472      ,"$IPOPT_PREFIX/lib"          ,default_ipopt_libpath
473  )      )
474    
475  opts.Add(      vars.Add(
476      'IPOPT_CPPPATH'          'IPOPT_CPPPATH'
477      ,"Where is your ipopt/IpStdCInterface.h (do not include the 'ipopt' in the path)"          ,"Where is your IPOPT coin/IpStdCInterface.h (do not include the 'coin' in the path)"
478      ,"$IPOPT_PREFIX/include"          ,"$IPOPT_PREFIX/include"
479  )      )
480    
481        vars.Add(
482            'IPOPT_DLL'
483            ,"Exact path of IPOPT DLL to be included in the installer (Windows only)"
484            ,default_ipopt_dll
485        )
486    
487  #------- TRON -------  #------- TRON -------
488    
489  opts.Add(  vars.Add(
490      'TRON_ENVVAR'      'TRON_ENVVAR'
491      ,"What environment variable should be used at runtime to override the default search location for TRON DLL/SO?"      ,"What environment variable should be used at runtime to override the default search location for TRON DLL/SO?"
492      ,default_tron_envvar      ,default_tron_envvar
493  )  )
494    
495  opts.Add(  vars.Add(
496      "TRON_LIB"      "TRON_LIB"
497      ,"Library linked to for TRON"      ,"Library linked to for TRON"
498      ,"tron"      ,"tron"
499  )  )
500    
501  opts.Add(  vars.Add(
502      "TRON_PREFIX"      "TRON_PREFIX"
503      ,"Prefix for your TRON install"      ,"Prefix for your TRON install"
504      ,default_tron_prefix      ,default_tron_prefix
505  )  )
506    
507  opts.Add(  vars.Add(
508      'TRON_DLPATH'      'TRON_DLPATH'
509      ,"What is the default search path that ASCEND should use when dlopening the TRON library at runtime?"      ,"What is the default search path that ASCEND should use when dlopening the TRON library at runtime?"
510      ,default_tron_dlpath      ,default_tron_dlpath
# Line 393  opts.Add( Line 512  opts.Add(
512    
513  #-------- f2c ------  #-------- f2c ------
514    
515  opts.Add(  vars.Add(
516      "F2C_LIB"      "F2C_LIB"
517      ,"F2C library (eg. g2c, gfortran, f2c)"      ,"F2C library (eg. g2c, gfortran, f2c)"
518      ,default_f2c_lib # the default is gfortran now      ,default_f2c_lib # the default is gfortran now
519  )  )
520    
521  opts.Add(PackageOption(  vars.Add(PackageVariable(
522      "F2C_LIBPATH"      "F2C_LIBPATH"
523      ,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible"      ,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible"
524      ,"off"      ,"off"
525  ))  ))
526    
527  opts.Add(  vars.Add(
528      "FORTRAN"      "FORTRAN"
529      ,"Fortran compiler (eg g77, gfortran)"      ,"Fortran compiler (eg g77, gfortran)"
530      ,default_fortran      ,default_fortran
# Line 413  opts.Add( Line 532  opts.Add(
532    
533  #------- tcl/tk --------  #------- tcl/tk --------
534    
535  opts.Add(  vars.Add(
536      'TCL'      'TCL'
537      ,'Base of Tcl distribution'      ,'Base of Tcl distribution'
538      ,default_tcl      ,default_tcl
539  )  )
540    
541  # Where are the Tcl includes?  # Where are the Tcl includes?
542  opts.Add(  vars.Add(
543      'TCL_CPPPATH'      'TCL_CPPPATH'
544      ,"Where are your Tcl include files?"      ,"Where are your Tcl include files?"
545      ,default_tcl_cpppath      ,default_tcl_cpppath
546  )  )
547    
548  # Where are the Tcl libs?  # Where are the Tcl libs?
549  opts.Add(  vars.Add(
550      'TCL_LIBPATH'      'TCL_LIBPATH'
551      ,"Where are your Tcl libraries?"      ,"Where are your Tcl libraries?"
552      ,default_tcl_libpath      ,default_tcl_libpath
553  )  )
554    
555  # What is the name of the Tcl lib?  # What is the name of the Tcl lib?
556  opts.Add(  vars.Add(
557      'TCL_LIB'      'TCL_LIB'
558      ,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)"      ,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)"
559      ,default_tcl_lib      ,default_tcl_lib
560  )  )
561    
562  # Where are the Tk includes?  # Where are the Tk includes?
563  opts.Add(  vars.Add(
564      'TK_CPPPATH'      'TK_CPPPATH'
565      ,"Where are your Tk include files?"      ,"Where are your Tk include files?"
566      ,'$TCL_CPPPATH'      ,'$TCL_CPPPATH'
567  )  )
568    
569  # Where are the Tk libs?  # Where are the Tk libs?
570  opts.Add(  vars.Add(
571      'TK_LIBPATH'      'TK_LIBPATH'
572      ,"Where are your Tk libraries?"      ,"Where are your Tk libraries?"
573      ,'$TCL_LIBPATH'      ,'$TCL_LIBPATH'
574  )  )
575    
576  # What is the name of the Tk lib?  # What is the name of the Tk lib?
577  opts.Add(  vars.Add(
578      'TK_LIB'      'TK_LIB'
579      ,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library"      ,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library"
580      ,default_tk_lib      ,default_tk_lib
# Line 463  opts.Add( Line 582  opts.Add(
582    
583  # Static linking to TkTable  # Static linking to TkTable
584    
585  opts.Add(BoolOption(  vars.Add(BoolVariable(
586      'STATIC_TCLTK'      'STATIC_TCLTK'
587      ,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL'      ,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL'
588      ,False      ,False
589  ))  ))
590    
591  opts.Add(  vars.Add(
592      'TKTABLE_LIBPATH'      'TKTABLE_LIBPATH'
593      ,'Location of TkTable static library'      ,'Location of TkTable static library'
594      ,'$TCL_LIBPATH/Tktable2.8'      ,'$TCL_LIBPATH/Tktable2.8'
595  )  )
596    
597  opts.Add(  vars.Add(
598      'TKTABLE_LIB'      'TKTABLE_LIB'
599      ,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)'      ,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)'
600      ,default_tktable_lib      ,default_tktable_lib
601  )  )
602    
603  opts.Add(  vars.Add(
604      'TKTABLE_CPPPATH'      'TKTABLE_CPPPATH'
605      ,'Location of TkTable header file'      ,'Location of TkTable header file'
606      ,'$TCL_CPPPATH'      ,'$TCL_CPPPATH'
607  )  )
608    
609  opts.Add(  vars.Add(
610      'X11'      'X11'
611      ,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL'      ,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL'
612      ,'/usr/X11R6'      ,'/usr/X11R6'
613  )  )
614    
615  opts.Add(  vars.Add(
616      'X11_LIBPATH'      'X11_LIBPATH'
617      ,'Location of X11 lib. EXPERIMENTAL'      ,'Location of X11 lib. EXPERIMENTAL'
618      ,'$X11/lib'      ,'$X11/lib'
619  )  )
620    
621  opts.Add(  vars.Add(
622      'X11_CPPPATH'      'X11_CPPPATH'
623      ,'Location of X11 includes. EXPERIMENTAL'      ,'Location of X11 includes. EXPERIMENTAL'
624      ,'$X11/include'      ,'$X11/include'
625  )  )
626    
627  opts.Add(  vars.Add(
628      'X11_LIB'      'X11_LIB'
629      ,'Name of X11 lib. EXPERIMENTAL'      ,'Name of X11 lib. EXPERIMENTAL'
630      ,'X11'      ,'X11'
# Line 513  opts.Add( Line 632  opts.Add(
632    
633  #----- installed file locations (for 'scons install') -----  #----- installed file locations (for 'scons install') -----
634    
635  opts.Add(  vars.Add(
636      'INSTALL_PREFIX'      'INSTALL_PREFIX'
637      ,'Root location for installed files'      ,'Root location for installed files'
638      ,'/usr/local'      ,default_install_prefix
639  )  )
640    
641  opts.Add(  vars.Add(
642      'INSTALL_BIN'      'INSTALL_BIN'
643      ,'Location to put binaries during installation'      ,'Location to put binaries during installation'
644      ,"$INSTALL_PREFIX/bin"      ,default_install_bin
645  )  )
646    
647  opts.Add(  vars.Add(
648      'INSTALL_LIB'      'INSTALL_LIB'
649      ,'Location to put libraries during installation'      ,'Location to put libraries during installation'
650      ,"$INSTALL_PREFIX/lib"      ,default_install_lib
651  )  )
652    
653  opts.Add(  vars.Add(
654      'INSTALL_SHARE'      'INSTALL_SHARE'
655      ,'Common shared-file location on this system'      ,'Common shared-file location on this system'
656      ,"$INSTALL_PREFIX/share"      ,"$INSTALL_PREFIX/share"
657  )  )
658    
659  opts.Add(  vars.Add(
660      'INSTALL_ASCDATA'      'INSTALL_ASCDATA'
661      ,"Location of ASCEND shared data (TK, python, models etc)"      ,"Location of ASCEND shared data (TK, python, models etc)"
662      ,"$INSTALL_SHARE/ascend"      ,default_install_ascdata
663    )
664    
665    vars.Add(
666        'INSTALL_PYTHON'
667        ,'General location for Python extensions on this system'
668        ,default_install_python
669    )
670    
671    vars.Add(
672        'INSTALL_PYTHON_ASCEND'
673        ,'Location for installation of Python modules specific to ASCEND'
674        ,default_install_python_ascend
675    )
676    
677    vars.Add(
678        'INSTALL_TK'
679        ,'Location for Tcl/Tk files used by ASCEND Tk GUI'
680        ,"$INSTALL_ASCDATA/tcltk"
681  )  )
682    
683  opts.Add(  vars.Add(
684      'INSTALL_MODELS'      'INSTALL_MODELS'
685      ,"Location of ASCEND model files (.a4c,.a4l,.a4s)"      ,"Location of ASCEND model files (.a4c,.a4l,.a4s)"
686      ,"$INSTALL_ASCDATA/models"      ,default_install_models
687  )  )
688    
689  opts.Add(  vars.Add(
690      'INSTALL_SOLVERS'      'INSTALL_SOLVERS'
691      ,"Location of ASCEND solvers"      ,"Location of ASCEND solvers"
692      ,"$INSTALL_ASCDATA/solvers"      ,default_install_solvers
693  )  )
694    
695  opts.Add(  vars.Add(
696      'INSTALL_DOC'      'INSTALL_DOC'
697      ,"Location of ASCEND documentation files"      ,"Location of ASCEND documentation files"
698      ,"$INSTALL_SHARE/doc/ascend-"+version      ,"$INSTALL_SHARE/doc/ascend-"+version
699  )  )
700    
701  opts.Add(  vars.Add(
702      'INSTALL_INCLUDE'      'INSTALL_INCLUDE'
703      ,'Location to put header files during installation'      ,'Location to put header files during installation'
704      ,"$INSTALL_PREFIX/include"      ,default_install_include
705  )  )
706    
707    
708  opts.Add(  vars.Add(
709      'INSTALL_ROOT'      'INSTALL_ROOT'
710      ,'For use by RPM only: location of %{buildroot} during rpmbuild'      ,'For use by RPM only: location of %{buildroot} during rpmbuild'
711      ,""      ,""
712  )  )
713    
714  opts.Add(  vars.Add(
715      'EXTLIB_SUFFIX'      'EXTLIB_SUFFIX'
716      ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"      ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
717      ,"_ascend$SHLIBSUFFIX"      ,"_ascend$SHLIBSUFFIX"
718  )  )
719    
720  opts.Add(  vars.Add(
721      'EXTLIB_PREFIX'      'EXTLIB_PREFIX'
722      ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"      ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
723      ,"$SHLIBPREFIX"      ,"$SHLIBPREFIX"
# Line 588  opts.Add( Line 725  opts.Add(
725    
726  #----------------------  #----------------------
727    
728  opts.Add(  vars.Add(
729      'PYGTK_ASSETS'      'PYGTK_ASSETS'
730      ,'Default location for Glade assets (placed in pygtk/config.py)'      ,'Default location for Glade assets (will be recorded in pygtk/config.py)'
731      ,default_install_assets      ,default_install_assets
732  )  )
733    
734  opts.Add(BoolOption(  vars.Add(BoolVariable(
735      'DEBUG'      'DEBUG'
736      ,"Compile source with debugger symbols, eg for use with 'gdb'"      ,"Compile source with debugger symbols, eg for use with 'gdb'"
737      ,False      ,False
738  ))  ))
739    
740  opts.Add(BoolOption(  vars.Add(BoolVariable(
741      'MALLOC_DEBUG'      'MALLOC_DEBUG'
742      ,"Compile with debugging version of MALLOC. Required for full CUnit testing"      ,"Compile with debugging version of MALLOC. Required for full CUnit testing"
743      ,False      ,False
744  ))  ))
745    
746  #------ dmalloc --------  #------ dmalloc --------
747  opts.Add(PackageOption(  vars.Add(PackageVariable(
748      'DMALLOC_PREFIX'      'DMALLOC_PREFIX'
749      ,"Where are your dmalloc files?"      ,"Where are your dmalloc files?"
750      ,default_prefix      ,default_prefix
751  ))  ))
752    
753  opts.Add(PackageOption(  vars.Add(PackageVariable(
754      'DMALLOC_CPPPATH'      'DMALLOC_CPPPATH'
755      ,"Where are your dmalloc include files?"      ,"Where are your dmalloc include files?"
756      ,default_cpppath      ,default_cpppath
757  ))  ))
758    
759  opts.Add(PackageOption(  vars.Add(PackageVariable(
760      'DMALLOC_LIBPATH'      'DMALLOC_LIBPATH'
761      ,"Where are your dmalloc libraries?"      ,"Where are your dmalloc libraries?"
762      ,default_libpath      ,default_libpath
763  ))  ))
764    
765  opts.Add(BoolOption(  vars.Add(BoolVariable(
766      'WITH_DMALLOC'      'WITH_DMALLOC'
767      ,"Link to the DMALLOC library (if available) for debugging of memory usage."      ,"Link to the DMALLOC library (if available) for debugging of memory usage."
768      ,False      ,False
769  ))  ))
770    
771  #------ f --------  #------ Graphviz --------
772  opts.Add(PackageOption(  #   vars.Add(PackageVariable(
773      'GRAPHVIZ_PREFIX'  #       'GRAPHVIZ_PREFIX'
774      ,"Where are your GRAPHVIZ files?"  #       ,"Where are your GRAPHVIZ files?"
775      ,default_prefix  #       ,default_prefix
776  ))  #   ))
777    #
778  opts.Add(PackageOption(  #   vars.Add(PackageVariable(
779      'GRAPHVIZ_CPPPATH'  #       'GRAPHVIZ_CPPPATH'
780      ,"Where are your GRAPHVIZ include files?"  #       ,"Where are your GRAPHVIZ include files? (don't need the final '/graphviz')"
781      ,default_cpppath  #       ,default_cpppath
782  ))  #   ))
783    #
784  opts.Add(PackageOption(  #   vars.Add(PackageVariable(
785      'GRAPHVIZ_LIBPATH'  #       'GRAPHVIZ_LIBPATH'
786      ,"Where are your GRAPHVIZ libraries?"  #       ,"Where are your GRAPHVIZ libraries?"
787      ,default_libpath  #       ,default_graphviz_libpath
788  ))  #   ))
789    #
790  opts.Add(  #   vars.Add(
791      'GRAPHVIZ_LIBS'  #       'GRAPHVIZ_LIBS'
792      ,"What are your GRAPHVIZ libraries named?"  #       ,"What are your GRAPHVIZ libraries named?"
793      ,['gvc','graph','cdt']  #       ,default_graphviz_libs
794  )  #   )
795    #
796    #   vars.Add(PackageVariable(
797    #       'GRAPHVIZ_RPATH'
798    #       ,"What is your GRAPHVIZ rpath for locating libraries at runtime? (only required for old Ubuntu)"
799    #       ,default_graphviz_rpath
800    #   ))
801    
802  opts.Add(BoolOption(  vars.Add(BoolVariable(
803      'WITH_GRAPHVIZ'      'WITH_GRAPHVIZ'
804      ,"Link to the GRAPHVIZ library (if available, for generating incidence graphs)"      ,"Link to the GRAPHVIZ library (if available, for generating incidence graphs)"
805      ,True      ,default_with_graphviz
806  ))  ))
807    
808    
809  #------ ufsparse --------  #------ ufsparse --------
810  opts.Add(PackageOption(  vars.Add(PackageVariable(
811      'UFSPARSE_PREFIX'      'UFSPARSE_PREFIX'
812      ,"Where are your UFSPARSE files?"      ,"Where are your UFSPARSE files?"
813      ,default_prefix      ,default_prefix
814  ))  ))
815    
816  opts.Add(PackageOption(  vars.Add(PackageVariable(
817      'UFSPARSE_CPPPATH'      'UFSPARSE_CPPPATH'
818      ,"Where are your UFSPARSE include files?"      ,"Where are your UFSPARSE include files?"
819      ,default_cpppath      ,default_cpppath
820  ))  ))
821    
822  opts.Add(PackageOption(  vars.Add(PackageVariable(
823      'UFSPARSE_LIBPATH'      'UFSPARSE_LIBPATH'
824      ,"Where are your UFSPARSE libraries?"      ,"Where are your UFSPARSE libraries?"
825      ,default_libpath      ,default_libpath
826  ))  ))
827    
828  opts.Add(BoolOption(  vars.Add(BoolVariable(
829      'WITH_UFSPARSE'      'WITH_UFSPARSE'
830      ,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)"      ,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)"
831      ,True      ,True
# Line 690  opts.Add(BoolOption( Line 833  opts.Add(BoolOption(
833    
834  #-----------------------  #-----------------------
835    
836  opts.Add(BoolOption(  vars.Add(BoolVariable(
837      'UPDATE_NO_YACC_LEX'      'UPDATE_NO_YACC_LEX'
838      ,"Update the *_no_yacc* and *_no_lex* files in the source tree? (these files are created so that ASCEND can be compiled in the absence of those tools)"      ,"Update the *_no_yacc* and *_no_lex* files in the source tree? (these files are created so that ASCEND can be compiled in the absence of those tools)"
839      ,False      ,False
840  ))  ))
841    
842  opts.Add(  vars.Add(
843      'DISTTAR_NAME'      'DISTTAR_NAME'
844      ,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'."      ,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'."
845      ,"ascend-"+version      ,"ascend-"+version
846  )  )
847    
848  opts.Add(  vars.Add(
849      'RELEASE'      'RELEASE'
850      ,"Release number for use in RPM spec file. This should always start with a zero for releases made by the ASCEND group, in order that third parties can make 'patch' releases of higher version numbers."      ,"Release number for use in RPM spec file. This should always start with a zero for releases made by the ASCEND group, in order that third parties can make 'patch' releases of higher version numbers."
851      ,"0"      ,"0"
852  )  )
853    
854  opts.Add(BoolOption(  vars.Add(BoolVariable(
855      'ABSOLUTE_PATHS'      'ABSOLUTE_PATHS'
856      ,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false."      ,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false."
857      ,default_absolute_paths      ,default_absolute_paths
858  ))  ))
859    
860  opts.Add(  vars.Add(
861      'WIN_INSTALLER_NAME'      'WIN_INSTALLER_NAME'
862      ,"Name of the installer .exe to create under Windows (minus the '.exe')"      ,"Name of the installer .exe to create under Windows (minus the '.exe')"
863      ,"ascend-"+version+"-py"+pyversion+".exe"      ,"ascend-"+version+"-py"+pyversion+".exe"
864  )  )
865    
866  opts.Add(BoolOption(  vars.Add(BoolVariable(
867      'WITH_XTERM_COLORS'      'WITH_XTERM_COLORS'
868      ,"Set to 0 if you don't want xterm colour codes in the console output"      ,"Set to 0 if you don't want xterm colour codes in the console output"
869      ,True      ,True
870  ))  ))
871    
872  opts.Add(BoolOption(  vars.Add(BoolVariable(
873      'WITH_EXTFNS'      'WITH_EXTFNS'
874      ,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND"      ,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND"
875      ,True      ,True
876  ))  ))
877    
878  opts.Add(BoolOption(  vars.Add(BoolVariable(
879      'WITH_SCROLLKEEPER'      'WITH_SCROLLKEEPER'
880      ,"Set to to 1 if you want to install an OMF file that can be read by scrollkeeper (eg Yelp on GNOME)"      ,"Set to to 1 if you want to install an OMF file that can be read by scrollkeeper (eg Yelp on GNOME)"
881      ,default_with_scrollkeeper      ,default_with_scrollkeeper
882  ))  ))
883    
884    vars.Add(BoolVariable(
885  if platform.system()!="Windows":      'WITH_MSVCR71'
886      opts.Add(BoolOption(      ,"Attempt to link against MSVCR71.DLL, to enable passing of FILE* objects to/from python"
887          'WITH_GCCVISIBILITY'      ,False
888          , 'Whether to use GCC Visibility extensions when building with GCC 4.0'  ))
         , True  
     ))  
   
889    
890    
891  # TODO: OTHER OPTIONS?  # TODO: OTHER OPTIONS?
# Line 761  def c_escape(str): Line 901  def c_escape(str):
901  envadditional={}  envadditional={}
902    
903  tools = [  tools = [
904      'lex', 'yacc', 'fortran', 'swig', 'nsis', 'substinfile'      'lex', 'yacc', 'fortran', 'swig', 'substinfile'
905      ,'disttar', 'tar'      ,'disttar', 'tar', 'graphviz','sundials'
906  ]  ]
907  if platform.system()=="Windows":  if platform.system()=="Windows":
908        tools += ['nsis']
909        
910      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):
911          envenv = os.environ;          envenv = os.environ;
912          tools += ['mingw']          tools += ['mingw']
# Line 789  else: Line 931  else:
931          envadditional['LIBS']=['gcc']          envadditional['LIBS']=['gcc']
932      else:      else:
933          envenv = os.environ          envenv = os.environ
934          tools += ['default']          tools += ['default','doxygen','ipopt']
935          #TODO removed 'doxygen' for SCons 0.96.93  
       
       
936  env = Environment(  env = Environment(
937      ENV=envenv      ENV=envenv
938      , toolpath=['scons']      , toolpath=['scons']
# Line 804  env = Environment( Line 944  env = Environment(
944  #print "PROGSUFFIX =",env['PROGSUFFIX']  #print "PROGSUFFIX =",env['PROGSUFFIX']
945  #print "CPPPATH =",env['CPPPATH']  #print "CPPPATH =",env['CPPPATH']
946    
947  opts.Update(env)  vars.Update(env)
948    
949    for l in ['SUNDIALS','IPOPT']:
950        var = "%s_LIBS" % l
951        if env.get(var) and not isinstance(env[var],types.ListType):
952            env[var] = env[var].split(",")
953    
954  if 'LSOD' in env['WITH_SOLVERS']:  if 'LSOD' in env['WITH_SOLVERS']:
955      if 'LSODE' not in env['WITH_SOLVERS']:      if 'LSODE' not in env['WITH_SOLVERS']:
956          env['WITH_SOLVERS'].append('LSODE')          env['WITH_SOLVERS'].append('LSODE')
957      env['WITH_SOLVERS'].remove('LSOD')      env['WITH_SOLVERS'].remove('LSOD')
958    
959  opts.Save('options.cache',env)  vars.Save('options.cache',env)
960    
961  Help(opts.GenerateHelpText(env))  Help(vars.GenerateHelpText(env))
962    
963  with_tcltk = env.get('WITH_TCLTK')  with_tcltk = env.get('WITH_TCLTK')
964  without_tcltk_reason = "disabled by options/config.py"  without_tcltk_reason = "disabled by options/config.py"
# Line 860  if platform.system()=="Windows": Line 1005  if platform.system()=="Windows":
1005  else:  else:
1006      with_installer=0      with_installer=0
1007      without_installer_reason = "only possible under Windows"      without_installer_reason = "only possible under Windows"
           
 if 'LSODE' in env['WITH_SOLVERS']:  
     with_lsode=True  
 else:  
     with_lsode=False  
     without_lsode_reason = "not requested (WITH_SOLVERS)"  
       
 if 'IDA' in env['WITH_SOLVERS']:  
     with_ida=True  
 else:  
     with_ida=False  
     without_ida_reason = "not requested (WITH_SOLVERS)"  
1008    
1009    with_lsode = 'LSODE' in env['WITH_SOLVERS']
1010    without_lsode_reason = "Not selected (see config option WITH_SOLVERS)"
1011    
1012  if 'CONOPT' in env['WITH_SOLVERS']:  with_ida = 'IDA' in env['WITH_SOLVERS']
1013      with_conopt=True  without_ida_reason = "Not selected (see config option WITH_SOLVERS)"
 else:  
     with_conopt=False  
     without_conopt_reason = "not requested (WITH_SOLVERS)"  
1014    
1015  if 'IPOPT' in env['WITH_SOLVERS']:  with_dopri5 = 'DOPRI5' in env['WITH_SOLVERS']
1016      with_ipopt=True  without_dopri5_reason = "Not selected (see config option WITH_SOLVERS)"
1017  else:  
1018      with_ipopt=False  with_conopt = 'CONOPT' in env['WITH_SOLVERS']
1019      without_ipopt_reason = "not requested (WITH_SOLVERS)"  without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
1020    
1021    with_ipopt = 'IPOPT' in env['WITH_SOLVERS']
1022    without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)"
1023    
1024    
1025  #print "SOLVERS:",env['WITH_SOLVERS']  #print "SOLVERS:",env['WITH_SOLVERS']
# Line 910  print "INSTALL_ASCDATA =",env['INSTALL_A Line 1045  print "INSTALL_ASCDATA =",env['INSTALL_A
1045  print "INSTALL_PREFIX =",env['INSTALL_PREFIX']  print "INSTALL_PREFIX =",env['INSTALL_PREFIX']
1046  print "INSTALL_MODELS =",env['INSTALL_MODELS']  print "INSTALL_MODELS =",env['INSTALL_MODELS']
1047  print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS']  print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS']
1048    print "INSTALL_PYTHON =",env['INSTALL_PYTHON']
1049    print "INSTALL_PYTHON_ASCEND =",env['INSTALL_PYTHON_ASCEND']
1050    
1051  print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY']  print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY']
1052  print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS']  print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS']
1053    
# Line 987  def CheckF77(context): Line 1125  def CheckF77(context):
1125  import os,re  import os,re
1126    
1127  def get_swig_version(env):  def get_swig_version(env):
1128      cmd = env['SWIG']+' -version'      cmd = [env['SWIG'],'-version']
1129      (cin,coutcerr) = os.popen4(cmd)      p = subprocess.Popen(cmd,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1130      output = coutcerr.read()      output, err = p.communicate()
1131            
1132      restr = "SWIG\\s+Version\\s+(?P<maj>[0-9]+)\\.(?P<min>[0-9]+)\\.(?P<pat>[0-9]+)\\s*$"      restr = r"\s*SWIG\s+Version\s+(?P<maj>[0-9]+)\.(?P<min>[0-9]+)\.(?P<pat>[0-9]+)\b"
1133      expr = re.compile(restr,re.M);      expr = re.compile(restr,re.MULTILINE|re.IGNORECASE);
1134      m = expr.search(output);      m = expr.match(output);
1135      if not m:      if not m:
1136          return None          raise RuntimeError("Failed match on output '%s'"  % output)
1137      maj = int(m.group('maj'))      maj = int(m.group('maj'))
1138      min = int(m.group('min'))      min = int(m.group('min'))
1139      pat = int(m.group('pat'))      pat = int(m.group('pat'))
# Line 1008  def CheckSwigVersion(context): Line 1146  def CheckSwigVersion(context):
1146      try:      try:
1147          context.Message("Checking version of SWIG... ")          context.Message("Checking version of SWIG... ")
1148          maj,min,pat = get_swig_version(context.env)          maj,min,pat = get_swig_version(context.env)
1149      except:      except Exception,e:
1150          context.Result("Failed to detect version, or failed to run SWIG")          context.Result("Failed to detect version, or failed to run SWIG (%s)" % str(e))
1151          return 0;          return False;
1152            
1153      context.env['SWIGVERSION']=tuple([maj,min,pat])      context.env['SWIGVERSION']=tuple([maj,min,pat])
1154            
1155        msg = "too old"
1156        res = False
1157      if maj == 1 and (      if maj == 1 and (
1158              min > 3              min > 3
1159              or (min == 3 and pat >= 24)              or (min == 3 and pat >= 24)
1160          ):          ):
1161          context.Result("ok, %d.%d.%d" % (maj,min,pat))          msg = "ok"
1162          return 1;          res = True
1163      else:      elif maj == 2:
1164          context.Result("too old, %d.%d.%d" % (maj,min,pat))          msg = "ok"
1165          return 0;          res = True
1166    
1167        context.Result("%s, %d.%d.%d" % (msg, maj,min,pat))
1168        return res;
1169    
1170  #----------------  #----------------
1171  # Scrollkeeper (Linux documentation system)  # Scrollkeeper (Linux documentation system)
1172    
1173  def get_scrollkeeper_omfdir(env):  def get_scrollkeeper_omfdir(env):
1174      cmd = 'scrollkeeper-config --omfdir'      cmd = ['scrollkeeper-config','--omfdir']
1175      (cin,coutcerr) = os.popen4(cmd)      p = subprocess.Popen(cmd,stdout=subprocess.PIPE)
1176      output = coutcerr.read()      output = p.communicate()
1177      return output.strip()      return output.strip()
1178    
1179  def CheckScrollkeeperConfig(context):  def CheckScrollkeeperConfig(context):
# Line 1088  class KeepContext: Line 1231  class KeepContext:
1231                  #print "Restoring %s to '%s'" %(k,self.keep.get(k))                  #print "Restoring %s to '%s'" %(k,self.keep.get(k))
1232                  context.env[k]=self.keep[k];                  context.env[k]=self.keep[k];
1233    
1234  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False,testname=None):
1235      """This method will check for variables LIBNAME_LIBPATH      """This method will check for variables LIBNAME_LIBPATH
1236      and LIBNAME_CPPPATH and try to compile and link the      and LIBNAME_CPPPATH and try to compile and link the
1237      file with the provided text, linking with the      file with the provided text, linking with the
1238      library libname."""      library libname."""
1239    
1240        if testname is None:
1241            testname = libname
1242    
1243      if static:      if static:
1244          context.Message( 'Checking for static '+libname+'... ' )          context.Message( 'Checking for static '+testname+'... ' )
1245      else:      else:
1246          context.Message( 'Checking for '+libname+'... ' )          context.Message( 'Checking for '+testname+'... ' )
1247                    
1248      if varprefix==None:      if varprefix==None:
1249          varprefix = libname.upper()          varprefix = libname.upper()
# Line 1258  dmalloc_test_text = """ Line 1404  dmalloc_test_text = """
1404    
1405  int main(void){  int main(void){
1406      char *c;      char *c;
1407      c = malloc(100*sizeof(char));      c = (char *)malloc(100*sizeof(char));
1408      free(c);      free(c);
1409      return 0;      return 0;
1410  }  }
# Line 1271  def CheckDMalloc(context): Line 1417  def CheckDMalloc(context):
1417  # graphviz test  # graphviz test
1418    
1419  graphviz_test_text = """  graphviz_test_text = """
1420  #include <graphviz/gvc.h>  #ifdef __WIN32__
1421    # include <gvc.h>
1422    #else
1423    # include <graphviz/gvc.h>
1424    #endif
1425  int main(void){  int main(void){
1426      Agraph_t *g;      Agraph_t *g;
1427      GVC_t *gvc;      GVC_t *gvc;
# Line 1284  int main(void){ Line 1434  int main(void){
1434  def CheckGraphViz(context):  def CheckGraphViz(context):
1435      return CheckExtLib(context,'graphviz',graphviz_test_text,ext=".c")      return CheckExtLib(context,'graphviz',graphviz_test_text,ext=".c")
1436    
1437    graphviz_boolean_test = """
1438    #ifdef __WIN32__
1439    # include <types.h>
1440    #else
1441    # include <graphviz/types.h>
1442    #endif
1443    #ifndef GV_TYPES_H
1444    # error WHERE IS GV_TYPES_H?
1445    #endif
1446    int main(void){
1447        boolean x;
1448        x = TRUE;
1449        return 0;
1450    }
1451    """
1452    
1453    def CheckGraphVizBoolean(context):
1454        return CheckExtLib(context,'graphviz',graphviz_boolean_test,ext=".c" \
1455            ,testname="graphviz 'boolean' definition"
1456        )
1457    
1458  #----------------  #----------------
1459  # ufsparse test  # ufsparse test
1460    
# Line 1342  def CheckMath(context): Line 1513  def CheckMath(context):
1513      context.env.AppendUnique(LIBS=['m'])      context.env.AppendUnique(LIBS=['m'])
1514      is_ok=context.TryLink(math_test_text,".c")      is_ok=context.TryLink(math_test_text,".c")
1515      context.Result(is_ok)      context.Result(is_ok)
1516      if not is_ok:      if libsave is None:
1517            del(context.env['LIBS'])
1518        else:
1519          context.env['LIBS']=libsave          context.env['LIBS']=libsave
1520      return is_ok      return is_ok
1521    
# Line 1415  def CheckPythonLib(context): Line 1588  def CheckPythonLib(context):
1588          python_lib='python%d%d'          python_lib='python%d%d'
1589      else:      else:
1590          python_lib='python%d.%d'          python_lib='python%d.%d'
     python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])]  
1591    
1592      python_cpppath = [distutils.sysconfig.get_python_inc()]      try:
1593      cfig = distutils.sysconfig.get_config_vars()              python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])]
1594            python_cpppath = [distutils.sysconfig.get_python_inc()]
1595            cfig = distutils.sysconfig.get_config_vars()    
1596        except:
1597            context.Result("not found")
1598            return 0        
1599            
1600      lastLIBS = context.env.get('LIBS')      lastLIBS = context.env.get('LIBS')
1601      lastLIBPATH = context.env.get('LIBPATH')      lastLIBPATH = context.env.get('LIBPATH')
# Line 1429  def CheckPythonLib(context): Line 1606  def CheckPythonLib(context):
1606      python_linkflags = []      python_linkflags = []
1607      if platform.system()=="Windows":      if platform.system()=="Windows":
1608          python_libpath += [os.path.join(sys.prefix,"libs")]          python_libpath += [os.path.join(sys.prefix,"libs")]
1609        elif platform.system()=="Darwin":
1610            python_libpath += [cfig['LIBPL']]
1611                    python_linkflags += cfig['LIBS'].split(' ')
1612      else:      else:
1613          # checked on Linux and SunOS          # checked on Linux and SunOS
1614          if cfig['LDLIBRARY']==cfig['LIBRARY']:          if cfig['LDLIBRARY']==cfig['LIBRARY']:
# Line 1462  def CheckPythonLib(context): Line 1642  def CheckPythonLib(context):
1642    
1643  sundials_version_major_required = 2  sundials_version_major_required = 2
1644  sundials_version_minor_min = 2  sundials_version_minor_min = 2
1645  sundials_version_minor_max = 3  sundials_version_minor_max = 4
1646    
1647  sundials_version_text = """  sundials_version_text = """
1648  #include <sundials/sundials_config.h>  #include <sundials/sundials_config.h>
# Line 1594  ipopt_test_text = """ Line 1774  ipopt_test_text = """
1774  # define FNAME_LCASE_DECOR  # define FNAME_LCASE_DECOR
1775  #endif  #endif
1776    
1777  #include <ipopt/IpStdCInterface.h>  #include <coin/IpStdCInterface.h>
1778  int main(){  int main(){
1779      Number n;      Number n;
1780      IpoptProblem nlp = 0;      IpoptProblem nlp = 0;
1781        n = 1;
1782      FreeIpoptProblem(nlp); // probably a crash if you run this      FreeIpoptProblem(nlp); // probably a crash if you run this
1783      return 0;      return 0;
1784  }  }
# Line 1609  def CheckIPOPT(context): Line 1790  def CheckIPOPT(context):
1790      keep = KeepContext(context,"IPOPT")      keep = KeepContext(context,"IPOPT")
1791      is_ok = context.TryLink(ipopt_test_text,".c")      is_ok = context.TryLink(ipopt_test_text,".c")
1792      context.Result(is_ok)      context.Result(is_ok)
1793        
1794      keep.restore(context)      keep.restore(context)
1795                
1796      return is_ok      return is_ok
1797    
1798  #----------------  #----------------
1799  # Tcl test  # Tcl test
1800    
1801  # TCL and TK required version 8.1, 8.2, 8.3, or 8.4:  # TCL and TK required version 8.1 through 8.5:
1802  tcltk_minor_newest_acceptable = 4  tcltk_minor_newest_acceptable = 5
1803  tcltk_major_required = 8  tcltk_major_required = 8
1804    
1805  tcl_check_text = r"""  tcl_check_text = r"""
# Line 1836  int main(void){ Line 2017  int main(void){
2017    
2018  def CheckSigReset(context):  def CheckSigReset(context):
2019      context.Message("Checking signal handler reset... ")      context.Message("Checking signal handler reset... ")
2020        libsave=context.env.get('LIBS')
2021        context.env.AppendUnique(LIBS=['m'])
2022      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')
2023    
2024        if libsave is None:
2025            del(context.env['LIBS'])
2026        else:
2027            context.env['LIBS']=libsave
2028    
2029      if not is_ok:      if not is_ok:
2030          context.Result("ERROR")          context.Result("ERROR")
2031          return False          return False
# Line 1873  def CheckLatex2HTML(context): Line 2062  def CheckLatex2HTML(context):
2062      return r      return r
2063    
2064  #----------------  #----------------
2065    # 'lmodern' package for LaTeX available?
2066    
2067    lmodern_test_text = r"""
2068    \documentclass{article}
2069    \usepackage{lmodern}
2070    \title{Cartesian closed categories and the price of eggs}
2071    \author{Jane Doe}
2072    \date{September 1994}
2073    \begin{document}
2074       \maketitle
2075       Hello world!
2076    \end{document}
2077    """;
2078    
2079    def CheckLModern(context):
2080        context.Message("Checking for lmodern...")
2081        b = context.env.get("DVI")
2082        if not b:
2083            context.Result(False)
2084            return False
2085        ff = context.env.get('LATEXFLAGS')
2086        context.env.Append(LATEXFLAGS=['-interaction=nonstopmode','-halt-on-error'])
2087        is_ok = context.TryBuild(builder=b,text=lmodern_test_text,extension=".latex")
2088        print "is_ok=",is_ok
2089        if ff is not None:
2090            context.env['LATEXFLAGS'] = ff
2091        else:
2092            del context.env['LATEXFLAGS']
2093        context.Result(is_ok)
2094        return is_ok
2095    
2096    #----------------
2097  # GCC Version sniffing  # GCC Version sniffing
2098    
2099  # TODO FIXME  # TODO FIXME
# Line 1896  conf = Configure(env Line 2117  conf = Configure(env
2117          , 'CheckDMalloc' : CheckDMalloc          , 'CheckDMalloc' : CheckDMalloc
2118          , 'CheckLyx' : CheckLyx          , 'CheckLyx' : CheckLyx
2119          , 'CheckLatex2HTML' : CheckLatex2HTML          , 'CheckLatex2HTML' : CheckLatex2HTML
2120            , 'CheckLModern' : CheckLModern
2121          , 'CheckGraphViz' : CheckGraphViz          , 'CheckGraphViz' : CheckGraphViz
2122            , 'CheckGraphVizBoolean' : CheckGraphVizBoolean
2123          , 'CheckUFSparse' : CheckUFSparse          , 'CheckUFSparse' : CheckUFSparse
2124          , 'CheckTcl' : CheckTcl          , 'CheckTcl' : CheckTcl
2125          , 'CheckTclVersion' : CheckTclVersion          , 'CheckTclVersion' : CheckTclVersion
# Line 1930  def sconsversioncheck(): Line 2153  def sconsversioncheck():
2153      import SCons      import SCons
2154      v = SCons.__version__.split(".")      v = SCons.__version__.split(".")
2155      if v[0] != '0':      if v[0] != '0':
2156            if v[0] == '1' or v[0] == '2':
2157                return 1;
2158          return 0          return 0
2159      if int(v[1]) >= 97:      if int(v[1]) >= 97:
2160          return 1          return 1
# Line 1971  if conf.CheckHeader('stdio.h') is False: Line 2196  if conf.CheckHeader('stdio.h') is False:
2196          print "%-30s%s" % ("%s :" % k, v)          print "%-30s%s" % ("%s :" % k, v)
2197      Exit(1)      Exit(1)
2198    
2199    # sizes of vars used in libascend eg in gl_list etc.
2200    
2201    _sizes = {
2202        "VOID_P" : "void *"
2203        ,"INT" : "int"
2204        ,"LONG" : "long"
2205        ,"LONG_LONG" : "long long"
2206    }
2207    
2208    for _var,_type in _sizes.iteritems():
2209        _size = conf.CheckTypeSize(_type)
2210        if not _size:
2211            print "Couldn't determine 'sizeof(%s)'" % _type
2212            Exit(1)
2213        conf.env["SIZEOF_%s" % _var] = str(_size)
2214    
2215    # check for some string functions
2216    
2217  if conf.CheckFunc('snprintf') is False:  if conf.CheckFunc('snprintf') is False:
2218      print "Didn't find snprintf";      print "Didn't find snprintf";
2219      exit(1)      Exit(1)
2220    
2221  if conf.CheckFunc('strdup'):  if conf.CheckFunc('strdup'):
2222      conf.env['HAVE_STRDUP'] = True      conf.env['HAVE_STRDUP'] = True
2223    
2224    # attempt to support MSVCRT 7.1 on Windows
2225    
2226    if platform.system()=="Windows" and env.get('WITH_MSVCR71'):
2227        conf.env.Append(LIBS='msvcr71')
2228        
2229  # Math library  # Math library
2230    
2231  conf.env['HAVE_IEEE']=True  conf.env['HAVE_IEEE']=True
# Line 2011  if conf.CheckFunc('isnan') is False and Line 2259  if conf.CheckFunc('isnan') is False and
2259    
2260  if conf.CheckGcc():  if conf.CheckGcc():
2261      conf.env['HAVE_GCC']=True;      conf.env['HAVE_GCC']=True;
2262      if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility():      if env.get('WITH_GCCVISIBILITY') and conf.CheckGccVisibility():
2263          conf.env['HAVE_GCCVISIBILITY']=True;          conf.env['HAVE_GCCVISIBILITY']=True;
2264          conf.env.Append(CCFLAGS=['-fvisibility=hidden'])          conf.env.Append(CCFLAGS=['-fvisibility=hidden'])
2265          conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])          conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])
# Line 2112  if with_graphviz: Line 2360  if with_graphviz:
2360          without_graphviz_reason = 'graphviz not found'          without_graphviz_reason = 'graphviz not found'
2361          with_graphviz = False          with_graphviz = False
2362          env['WITH_GRAPHVIZ'] = False          env['WITH_GRAPHVIZ'] = False
2363        env['HAVE_GRAPHVIZ_BOOLEAN'] = conf.CheckGraphVizBoolean()      
2364    
2365  # UFSPARSE  # UFSPARSE
2366    
# Line 2123  if with_ufsparse: Line 2372  if with_ufsparse:
2372    
2373  # IDA  # IDA
2374    
2375  if not with_ida:  if with_ida:
2376      without_ida_reason = "Not selected (see config option WITH_SOLVERS)"      if not conf.CheckSUNDIALS():
2377  elif not conf.CheckSUNDIALS():          with_ida = False
2378      with_ida = False          without_ida_reason = "SUNDIALS not found, or bad version"
2379      without_ida_reason = "SUNDIALS not found, or bad version"      elif not conf.CheckIDA():
2380  elif not conf.CheckIDA():          with_ida = False
2381      with_ida = False          without_ida_reason = "Unable to compile/link against SUNDIALS/IDA"
     without_ida_reason = "Unable to compile/link against SUNDIALS/IDA"  
2382    
2383  # CONOPT  # CONOPT
2384    
# Line 2160  if with_lsode: Line 2408  if with_lsode:
2408      need_fortran_reasons.append("LSODE")      need_fortran_reasons.append("LSODE")
2409      need_blas=True      need_blas=True
2410    
2411    if with_ipopt:
2412        need_blas=True
2413    
2414  if need_blas:  if need_blas:
2415      if conf.CheckLib('blas'):      if conf.CheckLib('blas'):
2416          with_local_blas = False          with_local_blas = False
# Line 2175  else: Line 2426  else:
2426  # FORTRAN  # FORTRAN
2427    
2428  if need_fortran:  if need_fortran:
2429      conf.env.Tool('fortran')      print "NEED FORTRAN"
2430        # Removed stuff for SCons 0.97 (Ubuntu 8.04) from here -- JP
2431      detect_fortran = conf.env.Detect(['gfortran','g77'])      detect_fortran = conf.env.Detect(['gfortran','g77'])
2432      if detect_fortran:      if detect_fortran:
2433          # For some reason, g77 doesn't get detected properly on MinGW          conf.env.Tool(detect_fortran)
2434          if not env.has_key('F77') and not env.has_key('FORTRAN'):          if detect_fortran == 'g77':
2435              print "Fixing detection of F77 on MinGW...(?)"              print "Setting F2C_LIB to 'g2c' because G77 compiler in use"
2436              conf.env.Replace(F77=detect_fortran)              conf.env['F2C_LIB'] = 'g2c'
2437              conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')          #print "DETECT_FORTRAN =",detect_fortran
2438              conf.env.Replace(F77FLAGS='')          #print "NOW, FORTAN =",env['FORTRAN']
             #print "F77:",conf.env['F77']  
             #print "F77COM:",conf.env['F77COM']  
             #print "F77FLAGS:",conf.env['F77FLAGS']  
             fortran_builder = Builder(  
                 action='$F77COM'  
                 , suffix='.o'  
                 , src_suffix='.f'  
             )  
             conf.env.Append(BUILDERS={'Fortran':fortran_builder})  
         if platform.system()=="Linux":  
             conf.env.Append(SHFORTRANFLAGS=['-fPIC'])  
2439      else:      else:
2440            print "FAILED G77/FORTRAN DETECTION"
2441          with_lsode=False;          with_lsode=False;
2442          without_lsode_reason="FORTRAN-77 required but not found"          without_lsode_reason="FORTRAN required but not detected"
2443    else:
2444        print "FORTRAN WAS NOT FOUND TO BE REQUIRED"
2445    
2446  if need_fortran and conf.CheckF77() is False:  if need_fortran and conf.CheckF77() is False:
2447      print "Failed to build simple test file with your Fortran compiler."      print "Failed to build simple test file with your Fortran compiler."
# Line 2227  if with_scrollkeeper: Line 2471  if with_scrollkeeper:
2471  # lyx  # lyx
2472    
2473  if with_doc_build:  if with_doc_build:
2474      if conf.CheckLyx() is False:      if not conf.CheckLyx():
2475          with_doc_build = False          with_doc_build = False
2476          without_doc_build_reason="unable to locate lyx"          without_doc_build_reason="unable to locate LyX"
2477    
2478      with_latext2html = conf.CheckLatex2HTML()      with_latex2html = conf.CheckLatex2HTML()
2479    
2480  # TODO: -D_HPUX_SOURCE is needed      if conf.CheckLModern() is False:
2481            with_doc_build = False
2482            without_doc_build_reason="'lmodern' is not available"
2483    
2484  # TODO: check size of void*  # TODO: -D_HPUX_SOURCE is needed
2485    
2486  # TODO: detect if dynamic libraries are possible or not  # TODO: detect if dynamic libraries are possible or not
2487    
# Line 2252  if platform.system()=="Windows" and env. Line 2498  if platform.system()=="Windows" and env.
2498    
2499  conf.Finish()  conf.Finish()
2500    
2501    #print "-=-=-=-=-=-=-=-=- LIBS =",env.get('LIBS')
2502    
2503  #---------------------------------------  #---------------------------------------
2504  # SUBSTITUTION DICTIONARY for .in files  # SUBSTITUTION DICTIONARY for .in files
2505    
# Line 2273  subst_dict = { Line 2521  subst_dict = {
2521      , '@INSTALL_LIB@':env['INSTALL_LIB']      , '@INSTALL_LIB@':env['INSTALL_LIB']
2522      , '@INSTALL_MODELS@':env['INSTALL_MODELS']      , '@INSTALL_MODELS@':env['INSTALL_MODELS']
2523      , '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS']      , '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS']
2524        , '@INSTALL_PYTHON@':env['INSTALL_PYTHON']
2525        , '@INSTALL_PYTHON_ASCEND@':env['INSTALL_PYTHON_ASCEND']
2526      , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']      , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']
2527      , '@VERSION@':version      , '@VERSION@':version
2528      , '@RELEASE@':release      , '@RELEASE@':release
# Line 2283  subst_dict = { Line 2533  subst_dict = {
2533      , '@EXTLIB_SUFFIX@':env['EXTLIB_SUFFIX']      , '@EXTLIB_SUFFIX@':env['EXTLIB_SUFFIX']
2534      , '@EXTLIB_PREFIX@':env['EXTLIB_PREFIX']      , '@EXTLIB_PREFIX@':env['EXTLIB_PREFIX']
2535      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
     , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir  
2536      , '@PYTHON@' : python_exe      , '@PYTHON@' : python_exe
2537      , '@PYVERSION@' : pyversion      , '@PYVERSION@' : pyversion
     , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')  
     , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')  
     , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_DLPATH"))  
2538      , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))      , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))
     , '@WITH_SOLVERS@':",".join(env.get('WITH_SOLVERS'))  
2539      , '@WITH_GRAPHVIZ@': str(int(env.get('WITH_GRAPHVIZ')))      , '@WITH_GRAPHVIZ@': str(int(env.get('WITH_GRAPHVIZ')))
2540    #define ASC_ABSOLUTE_PATHS @ASC_ABSOLUTE_PATHS@
2541    #if ASC_ABSOLUTE_PATHS
2542    # define ASCENDDIST_DEFAULT "@ASCENDDIST_DEFAULT@"
2543    # define ASCENDTK_DEFAULT "@ASCENDTK_DEFAULT@"
2544    # define ASCENDLIBRARY_DEFAULT "@ASCENDLIBRARY_DEFAULT@"
2545    # define ASCENDSOLVERS_DEFAULT "@ASCENDSOLVERS_DEFAULT@"
2546    #else
2547    # define ASC_DIST_REL_BIN "@ASC_DIST_REL_BIN@"
2548    # define ASC_TK_REL_DIST "@ASC_TK_REL_DIST@"
2549    # define ASC_LIBRARY_REL_DIST "@ASC_LIBRARY_REL_DIST@"
2550    # define ASC_SOLVERS_REL_DIST "@ASC_SOLVERS_REL_DIST@"
2551    #endif
2552        , '@ASC_ABSOLUTE_PATHS@': str(int(env.get('ABSOLUTE_PATHS')))
2553        , '@ASCENDDIST_DEFAULT@': c_escape(env['INSTALL_PREFIX'])
2554        , '@ASCENDTK_DEFAULT@': c_escape(os.path.abspath(env.subst(env['INSTALL_TK'])))
2555        , '@ASCENDLIBRARY_DEFAULT@': c_escape(os.path.abspath(env.subst(env['DEFAULT_ASCENDLIBRARY'])))
2556        , '@ASCENDSOLVERS_DEFAULT@': c_escape(os.path.abspath(env.subst(env['DEFAULT_ASCENDSOLVERS'])))
2557        , '@ASC_DIST_REL_BIN@' : default_dist_rel_bin
2558        , '@ASC_TK_REL_DIST@' : default_tk_rel_dist
2559        , '@ASC_LIBRARY_REL_DIST@' : default_library_rel_dist
2560        , '@ASC_SOLVERS_REL_DIST@' : default_solvers_rel_dist
2561        , '@SIZEOF_VOID_P@' : env['SIZEOF_VOID_P']
2562        , '@SIZEOF_INT@' : env['SIZEOF_INT']
2563        , '@SIZEOF_LONG@' : env['SIZEOF_LONG']
2564        , '@SIZEOF_LONG_LONG@' : env['SIZEOF_LONG_LONG']
2565  }  }
2566    
2567  if env.get('WITH_DOC'):  if env.get('WITH_DOC'):
# Line 2300  if env.get('WITH_DOC'): Line 2570  if env.get('WITH_DOC'):
2570    
2571  # bool options...  # bool options...
2572  for k,v in {  for k,v in {
2573          'ASC_WITH_IDA':with_ida          'ASC_WITH_DMALLOC':with_dmalloc
         ,'ASC_WITH_DMALLOC':with_dmalloc  
2574          ,'ASC_WITH_UFSPARSE':with_ufsparse          ,'ASC_WITH_UFSPARSE':with_ufsparse
         ,'ASC_WITH_CONOPT':with_conopt  
         ,'ASC_LINKED_CONOPT':env.get('CONOPT_LINKED')  
         ,'ASC_WITH_IPOPT':with_ipopt  
         ,'ASC_WITH_LSODE':with_lsode  
2575          ,'ASC_WITH_MMIO':with_mmio          ,'ASC_WITH_MMIO':with_mmio
2576          ,'ASC_SIGNAL_TRAPS':with_signals          ,'ASC_SIGNAL_TRAPS':with_signals
2577          ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')          ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')
2578          ,'HAVE_C99FPE':env.get('HAVE_C99FPE')          ,'HAVE_C99FPE':env.get('HAVE_C99FPE')
2579          ,'HAVE_IEEE':env.get('HAVE_IEEE')          ,'HAVE_IEEE':env.get('HAVE_IEEE')
         ,'ASC_ABSOLUTE_PATHS':env.get('ABSOLUTE_PATHS')  
2580          ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')          ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')
2581          ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')          ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')
2582            ,'ASC_HAVE_LEXDESTROY':env.get('HAVE_LEXDESTROY')
2583          }.iteritems():          }.iteritems():
2584                    
2585      if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k      if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k
# Line 2362  def InstallPerm(env, dest, files, perm): Line 2627  def InstallPerm(env, dest, files, perm):
2627      obj = env.Install(dest, files)        obj = env.Install(dest, files)  
2628      for i in obj:          for i in obj:    
2629          env.AddPostAction(i, env.Chmod(str(i), perm))              env.AddPostAction(i, env.Chmod(str(i), perm))    
2630    
2631    def InstallPermAs(env, dest, filen, perm):  
2632        obj = env.InstallAs(dest, filen)    
2633        for i in obj:    
2634            env.AddPostAction(i, env.Chmod(str(i), perm))
2635        return dest
2636            
2637  SConsEnvironment.InstallPerm = InstallPerm    SConsEnvironment.InstallPerm = InstallPerm  
2638            
# Line 2369  SConsEnvironment.InstallPerm = InstallPe Line 2640  SConsEnvironment.InstallPerm = InstallPe
2640  SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)    SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)  
2641  SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)  SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2642  SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)  SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2643    SConsEnvironment.InstallSharedAs = lambda env, dest, files: InstallPermAs(env, dest, files, 0644)
2644    SConsEnvironment.InstallLibraryAs = lambda env, dest, files: InstallPermAs(env, dest, files, 0644)
2645    
2646  #------------------------------------------------------  #------------------------------------------------------
2647  # BUILD...  # BUILD...
2648    
2649  # so that #include <modulename/headername.h> works across all modules...  # so that #include <ascend/modulename/headername.h> works across all modules...
2650  env.AppendUnique(CPPPATH=['#base/generic'])  env.AppendUnique(CPPPATH=['#'])
2651    
2652  if env['DEBUG']:  if env['DEBUG']:
2653      env.Append(CCFLAGS=['-g'])      env.Append(
2654      env.Append(LINKFLAGS=['-g'])          CCFLAGS=['-g']
2655            ,LINKFLAGS=['-g']
2656        )
2657    
2658  if env['GCOV']:  if env['GCOV']:
2659      env.Append(      env.Append(
# Line 2396  if with_conopt: Line 2671  if with_conopt:
2671  if with_ipopt:  if with_ipopt:
2672      env.Append(WITH_IPOPT=1)      env.Append(WITH_IPOPT=1)
2673    
2674    if with_dopri5:
2675        env.Append(WITH_DOPRI5=1)
2676    
2677    if with_graphviz and env.get('GRAPHVIZ_RPATH'):
2678        env.Append(RPATH=env['GRAPHVIZ_RPATH'])
2679    
2680  #-------------  #-------------
2681  # TCL/TK GUI  # TCL/TK GUI
2682    
2683  if with_tcltk:  if with_tcltk:
2684      env.SConscript(['tcltk/generic/interface/SConscript'],'env')      env.SConscript(['tcltk/SConscript'],'env')
2685  else:  else:
2686      print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason      print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason
2687    
# Line 2408  else: Line 2689  else:
2689  # PYTHON INTERFACE  # PYTHON INTERFACE
2690    
2691  if with_python:  if with_python:
2692        env.SConscript(['ascxx/SConscript'],'env')
2693      env.SConscript(['pygtk/SConscript'],'env')      env.SConscript(['pygtk/SConscript'],'env')
2694  else:  else:
2695      print "Skipping... Python bindings aren't being built:",without_python_reason      print "Skipping... Python bindings aren't being built:",without_python_reason
# Line 2415  else: Line 2697  else:
2697  #------------  #------------
2698  # BASE/GENERIC SUBDIRECTORIES  # BASE/GENERIC SUBDIRECTORIES
2699    
2700  libascend_env = env.Copy()  libascend_env = env.Clone()
2701    
2702  dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']  dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']
2703    
2704  srcs = []  srcs = []
2705  for d in dirs:  for d in dirs:
2706      heresrcs = libascend_env.SConscript('base/generic/'+d+'/SConscript','libascend_env')      heresrcs = libascend_env.SConscript('ascend/'+d+'/SConscript','libascend_env')
2707      srcs += heresrcs      srcs += heresrcs
2708    
2709  #-------------  #-------------
# Line 2442  else: Line 2724  else:
2724  if not with_ida:  if not with_ida:
2725      print "Skipping... IDA won't be built:", without_ida_reason      print "Skipping... IDA won't be built:", without_ida_reason
2726    
2727    if not with_dopri5:
2728        print "Skipping... DOPRI5 won't be built:", without_dopri5_reason
2729    
2730  if with_mmio:  if with_mmio:
2731      srcs += env.SConscript(['mmio/SConscript'],'env')      srcs += env.SConscript(['mmio/SConscript'],'env')
2732  else:  else:
2733      print "Skipping... MMIO export won't be built:", without_mmio_reason      print "Skipping... MMIO export won't be built:", without_mmio_reason
2734  #-------------  #-------------
2735  # LIBASCEND -- all base/generic functionality  # LIBASCEND -- all 'core' functionality
2736    
2737    # FIXME want to move these bits to ascend/SConscript
2738    
2739    libascend_env.Append(
2740        CPPPATH=['#']
2741        ,LIBS=['m']
2742    )
2743    
2744    if platform.system()=="Linux":
2745        libascend_env.Append(LIBS=['dl'])
2746    
2747  if with_dmalloc:  if with_dmalloc:
2748      libascend_env.Append(LIBS=['dmalloc'])      libascend_env.Append(LIBS=['dmalloc'])
# Line 2455  if with_dmalloc: Line 2750  if with_dmalloc:
2750  if with_ufsparse:  if with_ufsparse:
2751      libascend_env.Append(LIBS=['cxsparse'])      libascend_env.Append(LIBS=['cxsparse'])
2752    
2753    if platform.system()=="Linux":
2754        libascend_env.Append(LINKFLAGS=['-Wl,-soname,%s' % soname_full])
2755    
2756  libascend = libascend_env.SharedLibrary('ascend',srcs)  libascend = libascend_env.SharedLibrary('ascend',srcs)
2757    
2758  # for use in declaring dependent shared libraries in SConscript files (eg solvers/*/SConscript)  # create local symlink for the soname stuff.
2759    #print "SONAME =",env.subst(soname_full)
2760    
2761  env['libascend'] = libascend  env['libascend'] = libascend
2762    libtargets = [libascend]
2763    
2764  env.Alias('libascend',libascend)  if platform.system()=="Linux":
2765        if soname_major:
2766            libascend_env.Command(soname_full,libascend,Move("$TARGET","$SOURCE"))
2767            #print "MAKING LINK, SONAME_MAJOR =",soname_major
2768            liblink = libascend_env.Command(soname_full, libascend, "ln -s $SOURCE $TARGET")
2769            libtargets.append(liblink)
2770    
2771    # for use in declaring dependent shared libraries in SConscript files (eg solvers/*/SConscript)
2772    
2773    env.Alias('libascend',libtargets)
2774    
2775  #-------------  #-------------
2776  # UNIT TESTS (C CODE)  # UNIT TESTS (C CODE)
2777    
2778    test_env = env.Clone()
2779    test_env.Append(
2780        CPPPATH="#"
2781    )
2782    
2783  if with_cunit:  if with_cunit:
2784      testdirs = ['general','solver','utilities','linear','compiler']      testdirs = ['general','solver','utilities','linear','compiler','packages']
2785      testsrcs = []      testsrcs = []
2786      for testdir in testdirs:      for testdir in testdirs:
2787          path = 'base/generic/'+testdir+'/test/'          path = 'ascend/'+testdir+'/test/'
2788          env.SConscript([path+'SConscript'],'env')          test_env.SConscript([path+'SConscript'],'test_env')
2789          testsrcs += [i.path for i in env['TESTSRCS_'+testdir.upper()]]          testsrcs += [i.path for i in test_env['TESTSRCS_'+testdir.upper()]]
2790        test_env['TESTDIRS'] = testdirs
2791    
2792      #print "TESTSRCS =",testsrcs      #print "TESTSRCS =",testsrcs
2793                    
2794      env.SConscript(['test/SConscript'],'env')      test_env.SConscript(['test/SConscript'],'test_env')
     env.SConscript(['base/generic/test/SConscript'],'env')  
2795    
2796      env.Alias('test',[env.Dir('test'),env.Dir('base/generic/test')])      env.Alias('test',[env.Dir('test')])
2797            
2798  else:  else:
2799      print "Skipping... CUnit tests aren't being built:",without_cunit_reason      print "Skipping... CUnit tests aren't being built:",without_cunit_reason
# Line 2500  if not with_extfns: Line 2815  if not with_extfns:
2815    
2816  env.Alias('extfns',env['extfns'])  env.Alias('extfns',env['extfns'])
2817    
2818    #-------------
2819    # FPROPS python bindings
2820    
2821    env.Alias('pyfprops',env['pyfprops'])
2822    
2823  #------------------------------------------------------  #------------------------------------------------------
2824  # CREATE ASCEND-CONFIG scriptlet  # CREATE ASCEND-CONFIG scriptlet
2825    
2826  ascendconfig = env.SubstInFile('ascend-config.in')  ascendconfig = env.SubstInFile('ascend-config.in')
2827    
   
 #------------------------------------------------------  
 # CREATE asc4dev scriptlet  
   
 asc4devcmd = env.SubstInFile('tcltk/asc4dev.in')  
 env.AddPostAction(asc4devcmd, 'chmod 755 $TARGET')  
2828  #------------------------------------------------------  #------------------------------------------------------
2829  # INSTALLATION  # INSTALLATION
2830    
2831  if env.get('CAN_INSTALL'):  if env.get('CAN_INSTALL'):
2832    
2833      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE','INSTALL_DOC']      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE','INSTALL_DOC','INSTALL_PYTHON']
2834      install_dirs = [Dir(env.subst("$INSTALL_ROOT$"+d)) for d in dirs]      install_dirs = [Dir(env.subst("$INSTALL_ROOT$"+d)) for d in dirs]
2835      install_dirs += modeldirs + [Dir(env.subst("$INSTALL_ROOT$INSTALL_SOLVERS"))]      install_dirs += modeldirs + [Dir(env.subst("$INSTALL_ROOT$INSTALL_SOLVERS"))]
2836    
2837      # TODO: add install options      #env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_LIB")),libascend)
2838      env.Alias('install',install_dirs)  
2839        libname = "${INSTALL_LIB}/%s%s" % (soname_full,soname_minor)
2840        install_lib = env.InstallLibraryAs("${INSTALL_ROOT}"+libname, [libascend])
2841        if env['ABSOLUTE_PATHS']:
2842            link_target = libname
2843        else:
2844            link_target = "%s%s" % (soname_full,soname_minor)
2845    
2846      env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_LIB")),libascend)      link1 = "${INSTALL_LIB}/%s" % soname_clean
2847        install_link1 = None
2848        if env.subst(link1) != env.subst(libname):
2849            #                           v--link to create       v--file to link to   command          
2850            install_link1 = env.Command("${INSTALL_ROOT}"+link1,install_lib
2851            #    v-- command to do it (note the trick about
2852                ,"ln -f -s %s $TARGET" % link_target
2853            )
2854    
2855        link2 = "${INSTALL_LIB}/%s" % soname_full
2856        install_link2 = None
2857        if soname_minor:
2858            install_link2 = env.Command("${INSTALL_ROOT}"+link2,install_lib
2859                ,"ln -f -s %s $TARGET" % link_target
2860            )
2861    
2862      env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendconfig)      env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendconfig)
2863    
2864        # MAC OS X INSTALL STUFF
2865        # in this case, we're installing to INSTALL_PREFIX, assumed to be a folder
2866        # created using Disk Utility as a new DMG which will be distributed.
2867        if platform.system()=="Darwin":
2868            # extra stuff for inside the .app
2869            env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),"mac/Info.plist")
2870            env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN/Resources/")),"mac/ascend.icns")
2871    
2872            # related files the .dmg folder
2873            env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PREFIX")),"README-osx.txt")
2874            env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PREFIX")),"LICENSE.txt")
2875            env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_PREFIX")),"CHANGELOG.txt")
2876            env.Command("$INSTALL_ROOT$INSTALL_PREFIX/Applications Folder","/Applications","ln -f -s $SOURCE $TARGET")
2877            install_dirs += [Dir(env.subst("$INSTALL_ROOT$INSTALL_PREFIX"))]
2878    
2879            # GTK libraries and related files
2880            gtkfiles = []
2881            gtksource = "dist/PyGTK.bundle/"
2882            def visit(gtkfiles,dirname,fnames):
2883                gtkfiles += Glob("%s/*" % dirname)
2884            os.path.walk(gtksource,visit,gtkfiles)
2885            
2886            #print "GTKFILES ="
2887    #
2888            for f in gtkfiles:
2889                r = os.path.commonprefix([gtksource,f.path])
2890                dirname,filename = os.path.split(f.path[len(r):])
2891                dest = os.path.join(env.subst("$INSTALL_ROOT$INSTALL_BIN/PyGTK.bundle"),dirname)
2892            #   print "%s --> %s" %(f,dest)
2893                env.Install(Dir(dest),f)
2894    
2895        # ALIAS FOR ALL INSTALLATION
2896        env.Alias('install',install_dirs)
2897    
2898  #------------------------------------------------------  #------------------------------------------------------
2899  # WINDOWS INSTALLER  # WINDOWS INSTALLER
2900    
# Line 2539  if with_installer: Line 2907  if with_installer:
2907          'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME']          'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME']
2908          ,"VERSION":version          ,"VERSION":version
2909          ,'PYVERSION':pyversion          ,'PYVERSION':pyversion
2910            ,'IPOPTDLL':os.path.normpath(env['IPOPT_DLL'])
2911      })      })
2912      installer = env.Installer('nsis/installer.nsi')      installer = env.Installer('nsis/installer.nsi')
2913      Depends(installer,["pygtk","tcltk","ascend.dll","models","ascend-config"])      env.Depends(installer,["pygtk","tcltk","ascend.dll","models","solvers","ascend-config",'pygtk/ascend'])
2914        env.Depends(installer,[os.path.normpath(env['IPOPT_DLL'])])
2915      env.Alias('installer',installer)      env.Alias('installer',installer)
2916  else:  else:
2917      print "Skipping... Windows installer isn't being built:",without_installer_reason      print "Skipping... Windows installer isn't being built:",without_installer_reason
2918    
   
 #------------------------------------------------------  
 # PROJECT FILE for MSVC  
   
 env.SConscript(['base/msvc/SConscript'],['env','libascend']);  
   
2919  #------------------------------------------------------  #------------------------------------------------------
2920  # CREATE the SPEC file for generation of RPM packages  # CREATE the SPEC file for generation of RPM packages
2921    
# Line 2570  if platform.system()=="Linux": Line 2934  if platform.system()=="Linux":
2934    
2935  env['DISTTAR_FORMAT']='bz2'  env['DISTTAR_FORMAT']='bz2'
2936  env.Append(  env.Append(
2937      DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.lib','.cc','.cache','.pyc','.cvsignore','.dblite','.log','.pl','.out','.exe','.aux','.idx','.toc','.lof','.lot','.mm','.warnings','.tm2','.swp',',tmp','.gz','.bz2','.7z']      DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.lib','.cc','.cache',
2938            '.pyc','.cvsignore','.dblite','.log','.pl','.out','.exe','.aux','.idx',
2939            '.toc','.lof','.lot','.mm','.warnings','.tm2','.swp',',tmp','.gz',
2940            '.bz2','.7z','.deb','.dsc','.changes','.bak','.tex','.tmp']
2941      , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian']      , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian']
2942        , DISTTAR_EXCLUDERES=[r"_wrap\.cc?$", r"~$", r"ascxx/ascpy\.py","ascxx/testipopt$"
2943            ,r"/lib.*\.so\.[.0-9]+$", r"tcltk/asc4dev$", r"tcltk/interface/typelex\.c$"
2944            ,r"ascend/compiler/ascParse\.[ch]$", r"ascend/solver/conoptconfig\.h$"
2945            ,r"ascend/utilities/config\.h$", r"pygtk/config\.h$", r"pygtk/config\.py$"
2946            ,r"pygtk/ascdev$", r"ascxx/testconopt$", r"ascend/compiler/scanner\.c$"
2947            ,r"tcltk/interface/ascend4$",r"ascxx/testslvreq$",r"test/test$"
2948            ,r"models/johnpye/datareader/.*\.tm2\.Z$"
2949            ,r"models/johnpye/fprops/[a-z][a-z0-9]+(.*\.exe)?$" # FPROPS test executables
2950            ,r"models/johnpye/fprops/fluids/fluids_list\.h$" # FPROPS fluids list
2951        ]
2952  )  )
2953    
2954  tar = env.DistTar("dist/"+env['DISTTAR_NAME']  tar = env.DistTar("dist/"+env['DISTTAR_NAME']
# Line 2579  tar = env.DistTar("dist/"+env['DISTTAR_N Line 2956  tar = env.DistTar("dist/"+env['DISTTAR_N
2956  )  )
2957    
2958  env.Depends(tar,'ascend.spec')  env.Depends(tar,'ascend.spec')
2959  env.Depends(tar,'#doc/book.pdf')  env.Depends(tar,'doc/book.pdf')
   
 #------------------------------------------------------  
 # DISTRIBUTION TAR FILE (new style with AccumulateBuilder)  
   
 # ...  
2960    
2961  #------------------------------------------------------  #------------------------------------------------------
2962  # DEBIAN TARBALL for use with Build Service  # DEBIAN TARBALL for use with Build Service
2963    
2964  import glob  import glob
2965  deb_manfiles = glob.glob('debian/*.man')  deb_files = glob.glob('debian/*.install')
2966    deb_files += glob.glob('debian/*.docs')
2967    deb_files += glob.glob('debian/*.dirs')
2968    deb_files += glob.glob('debian/*.man')
2969    deb_files += glob.glob('debian/*.manpages')
2970    deb_files += ['debian/%s' % s for s in ['rules','control','changelog','compat','copyright','dirs']]
2971    
2972  deb_tar = env.Tar(  deb_tar = env.Tar(
2973      'dist/debian.tar.gz'      'dist/debian.tar.gz'
2974      ,deb_manfiles + ['debian/compat','debian/copyright','debian/dirs'      ,deb_files
         ,'debian/postinst','debian/postrm']  
2975      ,TARFLAGS = ['cz']      ,TARFLAGS = ['cz']
2976  )  )
2977    
# Line 2604  Alias('dist',[tar,deb_tar]) Line 2980  Alias('dist',[tar,deb_tar])
2980  #------------------------------------------------------  #------------------------------------------------------
2981  # DOCUMENTATION  # DOCUMENTATION
2982    
2983    #print "WITH_DOC_BUILD = ",with_doc_build
2984    
2985  if not with_doc_build:  if not with_doc_build:
2986      print "Skipping... Documentation isn't being built:",without_doc_build_reason      print "Skipping... Documentation isn't being built:",without_doc_build_reason
# Line 2611  if not with_doc_build: Line 2988  if not with_doc_build:
2988  #user's manual  #user's manual
2989  env.SConscript('doc/SConscript',['env'])  env.SConscript('doc/SConscript',['env'])
2990    
 # doxygen documentation  
 env.SConscript('base/doc/SConscript',['env'])  
   
2991  #------------------------------------------------------  #------------------------------------------------------
2992  # RPM BUILD  # RPM BUILD
2993    
# Line 2627  default_targets =['libascend','solvers'] Line 3001  default_targets =['libascend','solvers']
3001  if with_tcltk:  if with_tcltk:
3002      default_targets.append('tcltk')      default_targets.append('tcltk')
3003  if with_python:  if with_python:
3004        default_targets.append('ascxx')
3005      default_targets.append('pygtk')      default_targets.append('pygtk')
3006  if with_installer:      default_targets.append('pyfprops')
3007      default_targets.append('installer')  #if with_installer:
3008    #   default_targets.append('installer')
3009  if with_extfns:  if with_extfns:
3010      default_targets.append('extfns')      default_targets.append('extfns')
3011  if with_doc_build:  if with_doc_build:

Legend:
Removed from v.1680  
changed lines
  Added in v.2354

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22