/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 1387 by jpye, Sat Apr 7 14:43:31 2007 UTC revision 2029 by jpye, Thu Apr 30 09:19:48 2009 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.6"
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.108"  import sys, os, commands, platform, distutils.sysconfig, os.path, re, types
14    
15    # version number for python, useful on Windows
16    pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1])
17    
18  #------------------------------------------------------  #------------------------------------------------------
19  # 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 ;-)  
20    
 opts = Options(['options.cache', 'config.py'])  
21  #print "PLATFORM = ",platform.system()  #print "PLATFORM = ",platform.system()
22    
23    default_tcl_cpppath = "$TCL/include"
24    default_tron_envvar="TRON_PATH"
25    default_conopt_envvar="CONOPT_PATH"
26    default_with_graphviz = True
27    
28  if platform.system()=="Windows":  if platform.system()=="Windows":
29        # these correspond the the version of Tcl/Tk linked to in the NSIS scripts
30      default_tcl_lib = "tcl84"      default_tcl_lib = "tcl84"
31      default_tk_lib = "tk84"      default_tk_lib = "tk84"
32      default_tktable_lib = "Tktable28"      default_tktable_lib = "Tktable28"
33    
34      default_install_assets = "glade/"      default_install_assets = "glade/"
35      icon_extension = '.png'      icon_extension = '.png'
36      default_tcl = "c:\\Tcl"      default_tcl = "c:\\Tcl"
37      if os.environ.get('MSYSTEM')=="MINGW32":      if os.environ.get('MSYSTEM'):
38          default_tcl_libpath="$TCL\\bin"          default_tcl_libpath="$TCL\\bin"
39      else:      else:
40          default_tcl_libpath="$TCL\\lib"          default_tcl_libpath="$TCL\\lib"
41      default_rel_distdir = '.'  
42        # on Windows, we build ASCEND such that it finds it support files
43        # using paths relative to the location of the executable
44      default_absolute_paths = False      default_absolute_paths = False
45        default_dist_rel_bin = '.'
46        default_tk_rel_dist = 'tcltk'
47        default_library_rel_dist = 'models'
48        default_solvers_rel_dist = 'solvers'
49            
50        # where to look for IDA solver libraries, headers, etc.
51      default_ida_prefix = "c:\\MinGW"      default_ida_prefix = "c:\\MinGW"
52      if not os.path.exists(default_ida_prefix):      if not os.path.exists(default_ida_prefix):
53          default_ida_prefix = None          default_ida_prefix = None
54    
55        # where to look for CONOPT when compiling
56      default_conopt_prefix = "c:\\Program Files\\CONOPT"      default_conopt_prefix = "c:\\Program Files\\CONOPT"
57      default_conopt_libpath="$CONOPT_PREFIX"      default_conopt_libpath="$CONOPT_PREFIX"
58      default_conopt_cpppath="$CONOPT_PREFIX"      default_conopt_cpppath="$CONOPT_PREFIX"
59        default_conopt_dlpath="$CONOPT_PREFIX"
60      default_conopt_lib="conopt3"      default_conopt_lib="conopt3"
61      default_conopt_envvar="CONOPT_PATH"      if not os.path.exists(default_conopt_prefix):
62            default_conopt_prefix = None
63    
64        # FIXME remove this
65        default_tron_prefix="c:\\Program Files\\TRON"
66        default_tron_dlpath="$TRON_PREFIX"
67        default_tron_lib="tron1"
68    
69      default_prefix="c:\\MinGW"      default_prefix="c:\\MinGW"
70      default_libpath="$DEFAULT_PREFIX\\lib"      default_libpath="$DEFAULT_PREFIX\\lib"
71      default_cpppath="$DEFAULT_PREFIX\\include"      default_cpppath="$DEFAULT_PREFIX\\include"  
       
     if not os.path.exists(default_conopt_prefix):  
         default_conopt_prefix = None  
72                    
73      need_libm = False      need_libm = False
74      python_exe = "c:\\Python24\\python.exe"      python_exe = sys.executable
75      default_with_scrollkeeper=False      default_with_scrollkeeper=False
76        pathsep = ";"
77        
78        default_fortran="g77"
79        default_f2c_lib="g2c"
80        default_python = distutils.sysconfig.get_python_lib()
81        
82        soname_minor = ""
83        soname_major = ""
84        # still problems with Graphviz on Windows, leave it off now by default.
85        
86  else:  else:
87      default_tcl_lib = "tcl8.4"      default_tcl_lib = "tcl8.5"
88      default_tk_lib = "tk8.4"      default_tk_lib = "tk8.5"
89      default_tktable_lib = "Tktable2.8"      default_tktable_lib = "Tktable2.9"
90      default_install_assets = "$INSTALL_ASCDATA/glade/"      default_install_assets = "$INSTALL_ASCDATA/glade/"
91      icon_extension = '.svg'      icon_extension = '.svg'
92      default_tcl = '/usr'      default_tcl = '/usr'
93      default_tcl_libpath = "$TCL/lib"          default_tcl_libpath = "$TCL/lib"
94      default_rel_distdir = '../share/ascend'      default_python = distutils.sysconfig.get_python_lib()
95    
96        if os.path.exists("/etc/debian_version"):
97            default_tcl_cpppath = "/usr/include/tcl8.4"
98            default_tcl_lib = "tcl8.4"
99            default_tk_lib = "tk8.4"
100            default_tktable_lib = "Tktable2.8"
101    
102        if os.path.exists("/etc/lsb-release"):
103            _f = file("/etc/lsb-release")
104            _r = re.compile("([A-Z][^=]*)=(.*)")
105            LSB = {}
106            for l in _f:
107                _m = _r.match(l.strip())
108                LSB[_m.group(1)] = _m.group(2)
109            if LSB['DISTRIB_ID'] == "Ubuntu":
110                if float(LSB['DISTRIB_RELEASE']) >= 9.04:
111                    default_tcl_lib = "tcl8.5"
112                    default_tk_lib = "tk8.5"
113                    default_tktable_lib = "Tktable2.9"
114                    default_tcl_cpppath = "/usr/include/tcl8.5"
115                
116    
117      default_absolute_paths = True      default_absolute_paths = True
118      default_ida_prefix="/usr/local"      default_dist_rel_bin = '..'
119        default_tk_rel_dist = 'share/ascend/tcltk'
120        default_library_rel_dist = 'lib/ascend/models'
121        default_solvers_rel_dist = 'lib/ascend/solvers'
122    
123        default_ida_prefix="/usr"
124      default_conopt_prefix="/usr"      default_conopt_prefix="/usr"
125      default_conopt_libpath="$CONOPT_PREFIX/lib"      default_conopt_libpath="$CONOPT_PREFIX/lib"
126      default_conopt_cpppath="$CONOPT_PREFIX/include"      default_conopt_cpppath="$CONOPT_PREFIX/include"
127        default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"
128      default_conopt_lib="consub3"      default_conopt_lib="consub3"
129      default_conopt_envvar="CONOPT_PATH"  
130        default_tron_prefix="/usr"
131        default_tron_dlpath="$TRON_PREFIX/lib"
132        default_tron_lib="tron1"
133    
134      default_prefix="/usr"      default_prefix="/usr"
135      default_libpath="$DEFAULT_PREFIX/lib"      default_libpath="$DEFAULT_PREFIX/lib"
# Line 71  else: Line 140  else:
140          default_tcl = '/usr'          default_tcl = '/usr'
141      python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"      python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"
142      default_with_scrollkeeper=False      default_with_scrollkeeper=False
143        pathsep = ":"
144        
145        default_fortran="gfortran"
146        default_f2c_lib="gfortran"
147        
148        #default_graphviz_libs=["graph","cdt","gvc"]
149        #default_graphviz_libpath = default_libpath
150        #if os.path.exists("/usr/lib/graphviz/libgraph.so"):
151        #   # for Ubuntu 7.04
152        #   default_graphviz_libpath="/usr/lib/graphviz"
153        #   default_graphviz_rpath="$GRAPHVIZ_LIBPATH"
154    
155    soname_clean = "${SHLIBPREFIX}ascend${SHLIBSUFFIX}"
156    soname_full = "%s%s" % (soname_clean,soname_major)
157    
158    #------------------------------------------------------
159    # OPTIONS
160    #
161    # The following give the set of command-line parameters that can be passed to
162    # SCons from the commandline. Options will be 'remembered' by being cached
163    # in the file 'options.cache'; if you want to start with a clean slate, you
164    # should remove that file.
165    
166    opts = Options(['options.cache', 'config.py'])
167        
168  opts.Add(  opts.Add(
169      'CC'      'CC'
170      ,'C Compiler command'      ,'C Compiler command'
# Line 90  opts.Add(BoolOption( Line 183  opts.Add(BoolOption(
183      , False      , False
184  ))  ))
185    
186  # Package linking option  if platform.system()!="Windows":
187  opts.Add(EnumOption(      opts.Add(BoolOption(
188      'PACKAGE_LINKING'          'WITH_GCCVISIBILITY'
189      , 'Style of linking for external libraries'          ,"Whether to use GCC Visibility features (only applicable if available)"
190      , 'DYNAMIC_PACKAGES'          ,True
191      , ['DYNAMIC_PACKAGES', 'STATIC_PACKAGES', 'NO_PACKAGES']      ))
 ))  
   
 opts.Add(BoolOption(  
     'WITH_GCCVISIBILITY'  
     ,"Whether to use GCC Visibility features (only applicable if available)"  
     ,True  
 ))  
192    
193  opts.Add(BoolOption(  opts.Add(BoolOption(
194      'WITH_SIGNALS'      'WITH_SIGNALS'
# Line 128  opts.Add(BoolOption( Line 214  opts.Add(BoolOption(
214  opts.Add(ListOption(  opts.Add(ListOption(
215      'WITH_SOLVERS'      'WITH_SOLVERS'
216      ,"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"  
217          +" works."          +" works. The option 'LSOD' is provided for backwards compatibility"
218      ,["QRSLV","CMSLV","LSOD","IDA","CONOPT","LRSLV"]          +"; the value 'LSODE' is preferred."
219        ,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","TRON","IPOPT","DOPRI5"]
220      ,['QRSLV','MPS','SLV','OPTSQP'      ,['QRSLV','MPS','SLV','OPTSQP'
221          ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'          ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'
222          ,'LSOD','OPTSQP',"IDA"          ,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT","DOPRI5"
223       ]       ]
224  ))  ))
225    
226  # Where will the local copy of the help files be kept?  # Where will the local copy of the help files be kept?
227  opts.Add(PackageOption(  opts.Add(BoolOption(
228      'WITH_LOCAL_HELP'      'WITH_DOC'
229      , "Directory containing the local copy of the help files (optional)"      , "Should we try to build and install help files? If not, ASCEND will access online help files"
230      , "no"      , True
231    ))
232    
233    opts.Add(BoolOption(
234        'WITH_DOC_BUILD'
235        , "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)"
236        , "$WITH_DOC"
237    ))
238    
239    opts.Add(BoolOption(
240        'WITH_DOC_INSTALL'
241        , "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it."
242        , "$WITH_DOC"
243  ))  ))
244    
245    opts.Add(
246        'HELP_ROOT'
247        , "Location of the main help file"
248        , "$INSTALL_DOC/book.pdf"
249    )
250    
251  # Will bintoken support be enabled?  # Will bintoken support be enabled?
252  opts.Add(BoolOption(  opts.Add(BoolOption(
253      'WITH_BINTOKEN'      'WITH_BINTOKEN'
# Line 157  opts.Add( Line 262  opts.Add(
262      'DEFAULT_ASCENDLIBRARY'      'DEFAULT_ASCENDLIBRARY'
263      ,"Set the default value of the ASCENDLIBRARY -- the location where"      ,"Set the default value of the ASCENDLIBRARY -- the location where"
264          +" ASCEND will look for models when running ASCEND"          +" ASCEND will look for models when running ASCEND"
265      ,"$INSTALL_ASCDATA/models"      ,"$INSTALL_MODELS"
266    )
267    
268    # What should the default ASCENDLIBRARY path be?
269    # Note: users can change it by editing their ~/.ascend.ini
270    opts.Add(
271        'DEFAULT_ASCENDSOLVERS'
272        ,"Set the default value of ASCENDSOLVERS -- the location where"
273            +" ASCEND will look for solver shared-library files"
274        ,"$INSTALL_SOLVERS"
275  )  )
276    
277  # Where is SWIG?  # Where is SWIG?
# Line 193  opts.Add(PackageOption( Line 307  opts.Add(PackageOption(
307      ,default_prefix      ,default_prefix
308  ))  ))
309    
 #------ install location for python extensions ------  
   
 # (removed for the moment)  
   
310  #------ cunit --------  #------ cunit --------
311    # CUnit is a unit testing library that we use to test libascend.
312    
313  # Where was CUNIT installed?  # Where was CUNIT installed?
314  opts.Add(PackageOption(  opts.Add(PackageOption(
315      'CUNIT_PREFIX'      'CUNIT_PREFIX'
# Line 222  opts.Add(PackageOption( Line 334  opts.Add(PackageOption(
334  #-------- ida -------  #-------- ida -------
335    
336  opts.Add(PackageOption(  opts.Add(PackageOption(
337      "IDA_PREFIX"      "SUNDIALS_PREFIX"
338      ,"Prefix for your IDA install (IDA ./configure --prefix)"      ,"Prefix for your IDA install (IDA ./configure --prefix)"
339      ,default_ida_prefix      ,default_ida_prefix
340  ))  ))
341    
342  opts.Add(  opts.Add(
343      "IDA_LIB"      'SUNDIALS_CPPPATH'
344      ,"Libraries linked to for IDA"      ,"Where is your ida.h?"
345      ,['sundials_nvecserial','sundials_ida','m']      ,"$SUNDIALS_PREFIX/include"
346  )  )
347    
348    #
349  opts.Add(  opts.Add(
350      'IDA_CPPPATH'      'SUNDIALS_LIBPATH'
351      ,"Where is your ida.h?"      ,"Where are your SUNDIALS libraries installed?"
352      ,"$IDA_PREFIX/include"      ,"$SUNDIALS_PREFIX/lib"
353  )  )
354    
355  opts.Add(  opts.Add(
356      'IDA_LIBPATH'      'SUNDIALS_LIBS'
357      ,"Where are your SUNDIALS libraries installed?"      ,"What libraries are required for SUNDIALS?"
358      ,"$IDA_PREFIX/lib"      ,['sundials_nvecserial','sundials_ida','m']
359  )  )
360    
361  # ----- conopt-----  # ----- conopt-----
# Line 255  opts.Add(PackageOption( Line 368  opts.Add(PackageOption(
368    
369  opts.Add(  opts.Add(
370      "CONOPT_LIB"      "CONOPT_LIB"
371      ,"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'."
372      ,default_conopt_lib      ,default_conopt_lib
373  )  )
374    
375    opts.Add(BoolOption(
376        "CONOPT_LINKED"
377        ,"Do you want to dynamically link to CONOPT (only possible if CONOPT is available at buildtime)"
378        ,False
379    ))
380    
381  opts.Add(  opts.Add(
382      'CONOPT_CPPPATH'      'CONOPT_CPPPATH'
383      ,"Where is your conopt.h?"      ,"Where is your conopt.h?"
# Line 267  opts.Add( Line 386  opts.Add(
386    
387  opts.Add(  opts.Add(
388      'CONOPT_LIBPATH'      'CONOPT_LIBPATH'
389      ,"Where is your CONOPT libraries installed?"      ,"Where is your CONOPT library installed?"
390      ,default_conopt_libpath      ,default_conopt_libpath
391  )  )
392    
393  opts.Add(  opts.Add(
394        'CONOPT_DLPATH'
395        ,"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)."
396        ,default_conopt_dlpath
397    )
398    
399    opts.Add(
400      'CONOPT_ENVVAR'      'CONOPT_ENVVAR'
401      ,"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."
402      ,default_conopt_envvar      ,default_conopt_envvar
403  )  )
404    
405    #------- IPOPT -------
406    
407    opts.Add(PackageOption(
408        "IPOPT_PREFIX"
409        ,"Prefix for your IPOPT install (IPOPT ./configure --prefix)"
410        ,default_conopt_prefix
411    ))
412    
413    opts.Add(
414        "IPOPT_LIBS"
415        ,"Library linked to for IPOPT"
416        ,["$F2C_LIB","blas","lapack","pthread","ipopt"]
417    )
418    
419    
420    opts.Add(
421        "IPOPT_LIBPATH"
422        ,"Where is your IPOPT library installed"
423        ,"$IPOPT_PREFIX/lib"
424    )
425    
426    opts.Add(
427        'IPOPT_CPPPATH'
428        ,"Where is your IPOPT coin/IpStdCInterface.h (do not include the 'coin' in the path)"
429        ,"$IPOPT_PREFIX/include"
430    )
431    
432    
433    #------- TRON -------
434    
435    opts.Add(
436        'TRON_ENVVAR'
437        ,"What environment variable should be used at runtime to override the default search location for TRON DLL/SO?"
438        ,default_tron_envvar
439    )
440    
441    opts.Add(
442        "TRON_LIB"
443        ,"Library linked to for TRON"
444        ,"tron"
445    )
446    
447    opts.Add(
448        "TRON_PREFIX"
449        ,"Prefix for your TRON install"
450        ,default_tron_prefix
451    )
452    
453    opts.Add(
454        'TRON_DLPATH'
455        ,"What is the default search path that ASCEND should use when dlopening the TRON library at runtime?"
456        ,default_tron_dlpath
457    )
458    
459  #-------- f2c ------  #-------- f2c ------
460    
461  opts.Add(  opts.Add(
462      "F2C_LIB"      "F2C_LIB"
463      ,"F2C library (eg. g2c, gfortran, f2c)"      ,"F2C library (eg. g2c, gfortran, f2c)"
464      ,"gfortran" # the default is gfortran now      ,default_f2c_lib # the default is gfortran now
465  )  )
466    
467  opts.Add(PackageOption(  opts.Add(PackageOption(
# Line 291  opts.Add(PackageOption( Line 470  opts.Add(PackageOption(
470      ,"off"      ,"off"
471  ))  ))
472    
473    opts.Add(
474        "FORTRAN"
475        ,"Fortran compiler (eg g77, gfortran)"
476        ,default_fortran
477    )
478    
479  #------- tcl/tk --------  #------- tcl/tk --------
480    
481  opts.Add(  opts.Add(
# Line 303  opts.Add( Line 488  opts.Add(
488  opts.Add(  opts.Add(
489      'TCL_CPPPATH'      'TCL_CPPPATH'
490      ,"Where are your Tcl include files?"      ,"Where are your Tcl include files?"
491      ,"$TCL/include"      ,default_tcl_cpppath
492  )  )
493    
494  # Where are the Tcl libs?  # Where are the Tcl libs?
# Line 424  opts.Add( Line 609  opts.Add(
609  )  )
610    
611  opts.Add(  opts.Add(
612        'INSTALL_PYTHON'
613        ,'Common shared-file location on this system'
614        ,os.path.join(default_python,"ascend")
615    )
616    
617    opts.Add(
618        'INSTALL_TK'
619        ,'Location for Tcl/Tk files used by ASCEND Tk GUI'
620        ,"$INSTALL_ASCDATA/tcltk"
621    )
622    
623    opts.Add(
624        'INSTALL_MODELS'
625        ,"Location of ASCEND model files (.a4c,.a4l,.a4s)"
626        ,"$INSTALL_LIB/ascend/models"
627    )
628    
629    opts.Add(
630        'INSTALL_SOLVERS'
631        ,"Location of ASCEND solvers"
632        ,"$INSTALL_LIB/ascend/solvers"
633    )
634    
635    opts.Add(
636        'INSTALL_DOC'
637        ,"Location of ASCEND documentation files"
638        ,"$INSTALL_SHARE/doc/ascend-"+version
639    )
640    
641    opts.Add(
642      'INSTALL_INCLUDE'      'INSTALL_INCLUDE'
643      ,'Location to put header files during installation'      ,'Location to put header files during installation'
644      ,"$INSTALL_PREFIX/include"      ,"$INSTALL_PREFIX/include"
# Line 436  opts.Add( Line 651  opts.Add(
651      ,""      ,""
652  )  )
653    
654    opts.Add(
655        'EXTLIB_SUFFIX'
656        ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
657        ,"_ascend$SHLIBSUFFIX"
658    )
659    
660    opts.Add(
661        'EXTLIB_PREFIX'
662        ,"Filename suffix for ASCEND 'external libraries' (for use with IMPORT"
663        ,"$SHLIBPREFIX"
664    )
665    
666  #----------------------  #----------------------
667    
668  opts.Add(  opts.Add(
669      'PYGTK_ASSETS'      'PYGTK_ASSETS'
670      ,'Default location for Glade assets (placed in pygtk/config.py)'      ,'Default location for Glade assets (will be recorded in pygtk/config.py)'
671      ,default_install_assets      ,default_install_assets
672  )  )
673    
# Line 481  opts.Add(BoolOption( Line 708  opts.Add(BoolOption(
708      ,False      ,False
709  ))  ))
710    
711  #------ f --------  #------ Graphviz --------
712  opts.Add(PackageOption(  #   opts.Add(PackageOption(
713      'MFGRAPH_PREFIX'  #       'GRAPHVIZ_PREFIX'
714      ,"Where are your MFGRAPH files?"  #       ,"Where are your GRAPHVIZ files?"
715      ,default_prefix  #       ,default_prefix
716  ))  #   ))
717    #
718  opts.Add(PackageOption(  #   opts.Add(PackageOption(
719      'MFGRAPH_CPPPATH'  #       'GRAPHVIZ_CPPPATH'
720      ,"Where are your MFGRAPH include files?"  #       ,"Where are your GRAPHVIZ include files? (don't need the final '/graphviz')"
721      ,default_cpppath  #       ,default_cpppath
722  ))  #   ))
723    #
724  opts.Add(PackageOption(  #   opts.Add(PackageOption(
725      'MFGRAPH_LIBPATH'  #       'GRAPHVIZ_LIBPATH'
726      ,"Where are your MFGRAPH libraries?"  #       ,"Where are your GRAPHVIZ libraries?"
727      ,default_libpath  #       ,default_graphviz_libpath
728  ))  #   ))
729    #
730    #   opts.Add(
731    #       'GRAPHVIZ_LIBS'
732    #       ,"What are your GRAPHVIZ libraries named?"
733    #       ,default_graphviz_libs
734    #   )
735    #
736    #   opts.Add(PackageOption(
737    #       'GRAPHVIZ_RPATH'
738    #       ,"What is your GRAPHVIZ rpath for locating libraries at runtime? (only required for old Ubuntu)"
739    #       ,default_graphviz_rpath
740    #   ))
741    
742  opts.Add(BoolOption(  opts.Add(BoolOption(
743      'WITH_MFGRAPH'      'WITH_GRAPHVIZ'
744      ,"Link to the MFGRAPH library (if available, for generating incidence graphs)"      ,"Link to the GRAPHVIZ library (if available, for generating incidence graphs)"
745      ,True      ,default_with_graphviz
746  ))  ))
747    
748    
# Line 534  opts.Add(BoolOption( Line 773  opts.Add(BoolOption(
773    
774  #-----------------------  #-----------------------
775    
776    opts.Add(BoolOption(
777        'UPDATE_NO_YACC_LEX'
778        ,"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)"
779        ,False
780    ))
781    
782  opts.Add(  opts.Add(
783      'DISTTAR_NAME'      'DISTTAR_NAME'
784      ,"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'."
# Line 555  opts.Add(BoolOption( Line 800  opts.Add(BoolOption(
800  opts.Add(  opts.Add(
801      'WIN_INSTALLER_NAME'      'WIN_INSTALLER_NAME'
802      ,"Name of the installer .exe to create under Windows (minus the '.exe')"      ,"Name of the installer .exe to create under Windows (minus the '.exe')"
803      ,"ascend-"+version      ,"ascend-"+version+"-py"+pyversion+".exe"
804  )  )
805    
806  opts.Add(BoolOption(  opts.Add(BoolOption(
# Line 566  opts.Add(BoolOption( Line 811  opts.Add(BoolOption(
811    
812  opts.Add(BoolOption(  opts.Add(BoolOption(
813      'WITH_EXTFNS'      'WITH_EXTFNS'
814      ,"Set to 0 if you don't want to attempt to build external modules bundled"      ,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND"
         + " with ASCEND."  
815      ,True      ,True
816  ))  ))
817    
# Line 577  opts.Add(BoolOption( Line 821  opts.Add(BoolOption(
821      ,default_with_scrollkeeper      ,default_with_scrollkeeper
822  ))  ))
823    
824  if platform.system()!="Windows":  opts.Add(BoolOption(
825      opts.Add(BoolOption(      'WITH_MSVCR71'
826          'WITH_GCCVISIBILITY'      ,"Attempt to link against MSVCR71.DLL, to enable passing of FILE* objects to/from python"
827          , 'Whether to use GCC Visibility extensions when building with GCC 4.0'      ,False
828          , True  ))
     ))  
   
829    
830    
831  # TODO: OTHER OPTIONS?  # TODO: OTHER OPTIONS?
# Line 598  def c_escape(str): Line 840  def c_escape(str):
840    
841  envadditional={}  envadditional={}
842    
843    tools = [
844        'lex', 'yacc', 'fortran', 'swig', 'nsis', 'substinfile'
845        ,'disttar', 'tar', 'graphviz'
846    ]
847  if platform.system()=="Windows":  if platform.system()=="Windows":
848      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):      if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):
849          envenv = os.environ;          envenv = os.environ;
850          tools = ['mingw','lex','yacc','fortran','swig','disttar','nsis']          tools += ['mingw']
851          #TODO removed 'doxygen' for SCons 0.96.93          #TODO removed 'doxygen' for SCons 0.96.93
852          envadditional['IS_MINGW']=True          envadditional['IS_MINGW']=True
853      else:      else:
# Line 612  if platform.system()=="Windows": Line 858  if platform.system()=="Windows":
858              ,'LIB':os.environ['LIB']              ,'LIB':os.environ['LIB']
859              ,'MSVS_IGNORE_IDE_PATHS':1              ,'MSVS_IGNORE_IDE_PATHS':1
860          }          }
861          tools=['default','lex','yacc','fortran','swig','disttar','nsis']              tools += ['default']
862          #TODO removed 'doxygen' for SCons 0.96.93          #TODO removed 'doxygen' for SCons 0.96.93
863          envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE']          envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE']
864  else:  else:
865      if os.environ.get('TARGET')=='mingw':      if os.environ.get('TARGET')=='mingw':
866          envenv = os.environ          envenv = os.environ
867          tools=['crossmingw','lex','yacc','disttar','nsis','doxygen']          tools += ['crossmingw']
868          envadditional['CPPPATH']=['/usr/local/lib/gcc/i386-mingw32/3.4.5/include','/usr/include']          envadditional['CPPPATH']=['/usr/lib/gcc/i586-mingw32msvc/3.4.5/include','/usr/include']
869            envadditional['LIBS']=['gcc']
870      else:      else:
871          envenv = os.environ          envenv = os.environ
872          tools=['default','lex','yacc','fortran','swig','disttar','nsis']          tools += ['default']
873          #TODO removed 'doxygen' for SCons 0.96.93          #TODO removed 'doxygen' for SCons 0.96.93
874            
875            
# Line 633  env = Environment( Line 880  env = Environment(
880      , **envadditional      , **envadditional
881  )  )
882    
883  print "PATH =",os.environ['PATH']  #print "PATH =",os.environ['PATH']
884    #print "PROGSUFFIX =",env['PROGSUFFIX']
885    #print "CPPPATH =",env['CPPPATH']
886    
887  opts.Update(env)  opts.Update(env)
888    
889    for l in ['SUNDIALS','IPOPT']:
890        var = "%s_LIBS" % l
891        if not isinstance(env[var],types.ListType):
892            env[var] = env[var].split(",")
893    
894    if 'LSOD' in env['WITH_SOLVERS']:
895        if 'LSODE' not in env['WITH_SOLVERS']:
896            env['WITH_SOLVERS'].append('LSODE')
897        env['WITH_SOLVERS'].remove('LSOD')
898    
899  opts.Save('options.cache',env)  opts.Save('options.cache',env)
900    
901  Help(opts.GenerateHelpText(env))  Help(opts.GenerateHelpText(env))
# Line 658  without_scrollkeeper_reason = "disabled Line 918  without_scrollkeeper_reason = "disabled
918  with_dmalloc = env.get('WITH_DMALLOC')  with_dmalloc = env.get('WITH_DMALLOC')
919  without_dmalloc_reason = "disabled by options/config.py"  without_dmalloc_reason = "disabled by options/config.py"
920    
921  with_mfgraph = env.get('WITH_MFGRAPH')  with_graphviz = env.get('WITH_GRAPHVIZ')
922  without_mfgraph_reason = "disabled by options/config.py"  without_graphiviz_reason = "disabled by options/config.py"
923    
924  with_ufsparse = env.get('WITH_UFSPARSE')  with_ufsparse = env.get('WITH_UFSPARSE')
925  without_ufsparse_reason = "disabled by options/config.py"  without_ufsparse_reason = "disabled by options/config.py"
# Line 670  without_mmio_reason = "disabled by optio Line 930  without_mmio_reason = "disabled by optio
930  with_signals = env.get('WITH_SIGNALS')  with_signals = env.get('WITH_SIGNALS')
931  without_signals_reason = "disabled by options/config.py"  without_signals_reason = "disabled by options/config.py"
932    
933    with_doc = env.get('WITH_DOC')
934    
935    with_doc_build = env.get('WITH_DOC_BUILD');
936    without_doc_build_reason = "disabled by options/config.py"
937    if not with_doc:
938        with_doc_build = False
939        without_doc_build_reason = "disabled by with_doc"
940    
941    with_latex2html = False
942    
943  if platform.system()=="Windows":  if platform.system()=="Windows":
944      with_installer=1      with_installer=1
945  else:  else:
946      with_installer=0      with_installer=0
947      without_installer_reason = "only possible under Windows"      without_installer_reason = "only possible under Windows"
948    
949  if 'LSOD' in env['WITH_SOLVERS']:  with_lsode = 'LSODE' in env['WITH_SOLVERS']
950      with_lsode=True  without_lsode_reason = "Not selected (see config option WITH_SOLVERS)"
 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)"  
951    
952    with_ida = 'IDA' in env['WITH_SOLVERS']
953    without_ida_reason = "Not selected (see config option WITH_SOLVERS)"
954    
955  if 'CONOPT' in env['WITH_SOLVERS']:  with_dopri5 = 'DOPRI5' in env['WITH_SOLVERS']
956      with_conopt=True  without_dopri5_reason = "Not selected (see config option WITH_SOLVERS)"
957  else:  
958      with_conopt=False  with_conopt = 'CONOPT' in env['WITH_SOLVERS']
959      without_conopt_reason = "not requested (WITH_SOLVERS)"  without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
960    
961    with_ipopt = 'IPOPT' in env['WITH_SOLVERS']
962    without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)"
963    
964    
965  #print "SOLVERS:",env['WITH_SOLVERS']  #print "SOLVERS:",env['WITH_SOLVERS']
# Line 705  if platform.system()=='Windows': Line 971  if platform.system()=='Windows':
971      can_install = False      can_install = False
972    
973  env['CAN_INSTALL']=can_install  env['CAN_INSTALL']=can_install
 env['INSTALL_MODELS']=env['INSTALL_ASCDATA']+"/models/"  
974    
975    print "TCL=",env['TCL']
976  print "TCL_CPPPATH =",env['TCL_CPPPATH']  print "TCL_CPPPATH =",env['TCL_CPPPATH']
977  print "TCL_LIBPATH =",env['TCL_LIBPATH']  print "TCL_LIBPATH =",env['TCL_LIBPATH']
978  print "TCL_LIB =",env['TCL_LIB']  print "TCL_LIB =",env['TCL_LIB']
# Line 715  print "CXX =",env['CXX'] Line 981  print "CXX =",env['CXX']
981  print "FORTRAN=",env.get('FORTRAN')  print "FORTRAN=",env.get('FORTRAN')
982    
983  print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS']  print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS']
984    print "INSTALL_ASCDATA =",env['INSTALL_ASCDATA']
985    print "INSTALL_PREFIX =",env['INSTALL_PREFIX']
986    print "INSTALL_MODELS =",env['INSTALL_MODELS']
987    print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS']
988    print "INSTALL_PYTHON =",env['INSTALL_PYTHON']
989    print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY']
990    print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS']
991    
992    
993  #------------------------------------------------------  #------------------------------------------------------
994  # SPECIAL CONFIGURATION TESTS  # SPECIAL CONFIGURATION TESTS
995    
996  need_fortran = False  need_fortran = False
997    need_fortran_reasons = []
998    
999  #----------------  #----------------
1000    # CC
1001    
1002    cc_test_text = """
1003    int main(void){
1004        return 0;
1005    }
1006    """;
1007    
1008    def CheckCC(context):
1009        context.Message("Checking C compiler ('%s')... " % context.env.get('CC'))
1010        is_ok = context.TryCompile(cc_test_text,".c")
1011        context.Result(is_ok)
1012        return is_ok
1013    
1014    #----------------
1015    # CXX
1016    
1017    cxx_test_text = """
1018    template<class X>
1019    class pair{
1020    public:
1021        X a;
1022        X b;
1023    };
1024    
1025    int main(void){
1026        pair<double> P;
1027        P.a = 0;
1028        return 0;
1029    }
1030    """;
1031    
1032    def CheckCXX(context):
1033        context.Message("Checking C++ compiler ('%s')... " % context.env.get('CXX'))
1034        if not context.env.get('CXX'):
1035            context.Result("not found")
1036            return False
1037        is_ok = context.TryCompile(cxx_test_text,".cpp")
1038        context.Result(is_ok)
1039        return is_ok
1040    
1041    #----------------
1042    
1043    f77_test_text = """
1044    C     Hello World in Fortran 77
1045    
1046          PROGRAM HELLO
1047          PRINT*, 'Hello World!'
1048          END  
1049    """;
1050    
1051    def CheckF77(context):
1052        context.Message("Checking Fortran 77 compiler ('%s')..." % context.env.get('FORTRAN'))
1053        if not context.env.get('FORTRAN'):
1054            context.Result('not found')
1055            return False
1056        is_ok = context.TryCompile(f77_test_text,".f")
1057        context.Result(is_ok)
1058        return is_ok
1059        
1060    #----------------
1061  # SWIG  # SWIG
1062    
1063  import os,re  import os,re
# Line 811  class KeepContext: Line 1148  class KeepContext:
1148              if context.env.has_key(varprefix+'_LIB'):              if context.env.has_key(varprefix+'_LIB'):
1149                  context.env.Append(LIBS=[env[varprefix+'_LIB']])                  context.env.Append(LIBS=[env[varprefix+'_LIB']])
1150                  #print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs"                      #print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs"    
1151                elif context.env.has_key(varprefix+'_LIBS'):
1152                    context.env.AppendUnique(LIBS=env[varprefix+'_LIBS'])
1153    
1154      def restore(self,context):      def restore(self,context):
1155          #print "RESTORING CONTEXT"          #print "RESTORING CONTEXT"
# Line 825  class KeepContext: Line 1164  class KeepContext:
1164                  #print "Restoring %s to '%s'" %(k,self.keep.get(k))                  #print "Restoring %s to '%s'" %(k,self.keep.get(k))
1165                  context.env[k]=self.keep[k];                  context.env[k]=self.keep[k];
1166    
1167  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False,testname=None):
1168      """This method will check for variables LIBNAME_LIBPATH      """This method will check for variables LIBNAME_LIBPATH
1169      and LIBNAME_CPPPATH and try to compile and link the      and LIBNAME_CPPPATH and try to compile and link the
1170      file with the provided text, linking with the      file with the provided text, linking with the
1171      library libname."""      library libname."""
1172    
1173        if testname is None:
1174            testname = libname
1175    
1176      if static:      if static:
1177          context.Message( 'Checking for static '+libname+'... ' )          context.Message( 'Checking for static '+testname+'... ' )
1178      else:      else:
1179          context.Message( 'Checking for '+libname+'... ' )          context.Message( 'Checking for '+testname+'... ' )
1180                    
1181      if varprefix==None:      if varprefix==None:
1182          varprefix = libname.upper()          varprefix = libname.upper()
# Line 842  def CheckExtLib(context,libname,text,ext Line 1184  def CheckExtLib(context,libname,text,ext
1184      #print "LIBS is currently:",context.env.get('LIBS')      #print "LIBS is currently:",context.env.get('LIBS')
1185      keep = KeepContext(context,varprefix,static)      keep = KeepContext(context,varprefix,static)
1186    
1187      if not context.env.has_key(varprefix+'_LIB'):      if not context.env.has_key(varprefix+'_LIB') and not context.env.has_key(varprefix+'_LIBS'):
1188          # if varprefix_LIB were in env, KeepContext would          # if varprefix_LIB were in env, KeepContext would
1189          # have appended it already          # have appended it already
1190          context.env.Append(LIBS=[libname])          context.env.Append(LIBS=[libname])
# Line 995  dmalloc_test_text = """ Line 1337  dmalloc_test_text = """
1337    
1338  int main(void){  int main(void){
1339      char *c;      char *c;
1340      c = malloc(100*sizeof(char));      c = (char *)malloc(100*sizeof(char));
1341      free(c);      free(c);
1342      return 0;      return 0;
1343  }  }
# Line 1005  def CheckDMalloc(context): Line 1347  def CheckDMalloc(context):
1347      return CheckExtLib(context,'dmalloc',dmalloc_test_text)      return CheckExtLib(context,'dmalloc',dmalloc_test_text)
1348    
1349  #----------------  #----------------
1350  # mfgraph test  # graphviz test
1351    
1352  mfgraph_test_text = """  graphviz_test_text = """
1353  #include <mfgraph/mfg_draw_graph.h>  #ifdef __WIN32__
1354    # include <gvc.h>
1355    #else
1356    # include <graphviz/gvc.h>
1357    #endif
1358  int main(void){  int main(void){
1359      using namespace mfg;      Agraph_t *g;
1360      DrawGraph g;      GVC_t *gvc;
1361        gvc = gvContext();
1362        g = agopen("g", AGDIGRAPH);
1363      return 0;      return 0;
1364  }  }
1365  """  """
1366    
1367  def CheckMFGraph(context):  def CheckGraphViz(context):
1368      return CheckExtLib(context,'mfgraph',mfgraph_test_text,ext=".cpp")      return CheckExtLib(context,'graphviz',graphviz_test_text,ext=".c")
1369    
1370    graphviz_boolean_test = """
1371    #ifdef __WIN32__
1372    # include <types.h>
1373    #else
1374    # include <graphviz/types.h>
1375    #endif
1376    #ifndef GV_TYPES_H
1377    # error WHERE IS GV_TYPES_H?
1378    #endif
1379    int main(void){
1380        boolean x;
1381        x = TRUE;
1382        return 0;
1383    }
1384    """
1385    
1386    def CheckGraphVizBoolean(context):
1387        return CheckExtLib(context,'graphviz',graphviz_boolean_test,ext=".c" \
1388            ,testname="graphviz 'boolean' definition"
1389        )
1390    
1391  #----------------  #----------------
1392  # ufsparse test  # ufsparse test
# Line 1058  int main(void){ Line 1427  int main(void){
1427      acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x);      acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x);
1428      j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x);      j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x);
1429      y0(x); y1(x); yn(i,x);      y0(x); y1(x); yn(i,x);
1430    /* this part causes problems with crossmingw... */
1431  #ifdef _THREAD_SAFE  #ifdef _THREAD_SAFE
1432      gamma_r(x,&i);      gamma_r(x,&i);
1433      lgamma_r(x,&i);      lgamma_r(x,&i);
# Line 1076  def CheckMath(context): Line 1446  def CheckMath(context):
1446      context.env.AppendUnique(LIBS=['m'])      context.env.AppendUnique(LIBS=['m'])
1447      is_ok=context.TryLink(math_test_text,".c")      is_ok=context.TryLink(math_test_text,".c")
1448      context.Result(is_ok)      context.Result(is_ok)
1449      if not is_ok:      if libsave is None:
1450            del(context.env['LIBS'])
1451        else:
1452          context.env['LIBS']=libsave          context.env['LIBS']=libsave
1453      return is_ok      return is_ok
1454    
1455  #----------------  #----------------
1456    # malloc.h test
1457    
1458    malloc_test_text = """
1459    #include <stdlib.h>
1460    int main(){
1461        double *x;
1462        x = malloc(sizeof(double)*5);
1463        x[4] = 3.3;
1464        free(x);
1465    }
1466    """
1467    
1468    def CheckMalloc(context):
1469        context.Message("Checking for malloc...")
1470        is_ok = context.TryLink(malloc_test_text,".c")
1471        context.Result(is_ok)
1472        return is_ok
1473    
1474    #----------------
1475    # dlopen test
1476    
1477    dlopen_test_text = """
1478    #ifdef __WIN32__
1479    # include <windows.h>
1480    #else
1481    # include <dlfcn.h>
1482    #endif
1483    int main(){
1484    #ifdef __WIN32__
1485        HINSTANCE d;
1486        LoadLibrary("imaginary_and_nonexistent.dll");
1487    #else
1488        void *d;
1489        d = dlopen("imaginary_and_nonexistent.so", 1);
1490    #endif
1491        return 0;
1492    }
1493    """
1494    
1495    def CheckDLOpen(context):
1496        context.Message("Checking for ability to load shared libraries at runtime...")
1497        libsave=context.env.get('LIBS');
1498        if platform.system()!="Windows":
1499            context.env.Append(LIBS=['dl'])
1500        is_ok = context.TryLink(dlopen_test_text,".c")
1501        context.Result(is_ok)
1502        context.env['LIBS'] = libsave
1503        return is_ok
1504    
1505    #----------------
1506  # libpython test  # libpython test
1507    
1508  libpython_test_text = """  libpython_test_text = """
# Line 1099  def CheckPythonLib(context): Line 1521  def CheckPythonLib(context):
1521          python_lib='python%d%d'          python_lib='python%d%d'
1522      else:      else:
1523          python_lib='python%d.%d'          python_lib='python%d.%d'
     python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])]  
1524    
1525      python_cpppath = [distutils.sysconfig.get_python_inc()]      try:
1526      cfig = distutils.sysconfig.get_config_vars()              python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])]
1527            python_cpppath = [distutils.sysconfig.get_python_inc()]
1528            cfig = distutils.sysconfig.get_config_vars()    
1529        except:
1530            context.Result("not found")
1531            return 0        
1532            
1533      lastLIBS = context.env.get('LIBS')      lastLIBS = context.env.get('LIBS')
1534      lastLIBPATH = context.env.get('LIBPATH')      lastLIBPATH = context.env.get('LIBPATH')
# Line 1112  def CheckPythonLib(context): Line 1538  def CheckPythonLib(context):
1538      python_libpath = []      python_libpath = []
1539      python_linkflags = []      python_linkflags = []
1540      if platform.system()=="Windows":      if platform.system()=="Windows":
1541          python_libpath+=[cfig['prefix']]          python_libpath += [os.path.join(sys.prefix,"libs")]
1542      else:      else:
1543          # checked on Linux and SunOS          # checked on Linux and SunOS
1544          if cfig['LDLIBRARY']==cfig['LIBRARY']:          if cfig['LDLIBRARY']==cfig['LIBRARY']:
# Line 1158  int main(){ Line 1584  int main(){
1584  """  """
1585    
1586  ida_test_text = """  ida_test_text = """
1587  # include <ida/ida.h>  #if SUNDIALS_VERSION_MAJOR==2 && SUNDIALS_VERSION_MINOR==2
1588  # include <nvector/nvector_serial.h>  # include <sundials/sundials_config.h>
1589    # include <sundials/sundials_nvector.h>
1590    # include <nvector_serial.h>
1591    # include <ida.h>
1592  # include <ida/ida_spgmr.h>  # include <ida/ida_spgmr.h>
1593    #else
1594    # include <sundials/sundials_config.h>
1595    # include <nvector/nvector_serial.h>
1596    # include <ida/ida.h>
1597    #endif
1598  int main(){  int main(){
1599      void *ida_mem;      void *ida_mem;
1600      ida_mem = IDACreate();      ida_mem = IDACreate();
# Line 1168  int main(){ Line 1602  int main(){
1602  }  }
1603  """  """
1604    
 def CheckIDA(context):  
     context.Message( 'Checking for IDA (SUNDIALS)... ' )  
   
     keep = KeepContext(context,"IDA")  
       
     is_ok = context.TryLink(ida_test_text,".c")  
     context.Result(is_ok)  
       
     keep.restore(context)  
           
     return is_ok  
   
1605  # slightly changed calling convention (IDACalcID) in newer versions of SUNDIALS,  # slightly changed calling convention (IDACalcID) in newer versions of SUNDIALS,
1606  # so detect the version and act accordingly.  # so detect the version and act accordingly.
1607  def CheckIDAVersion(context):  def CheckSUNDIALS(context):
1608      keep = KeepContext(context,'IDA')      keep = KeepContext(context,'SUNDIALS')
1609      context.Message("Checking SUNDIALS version... ")      context.Message("Checking for SUNDIALS... ")
1610      (is_ok,output) = context.TryRun(sundials_version_text,'.c')      (is_ok,output) = context.TryRun(sundials_version_text,'.c')
1611      keep.restore(context)      keep.restore(context)
1612      if not is_ok:      if not is_ok:
1613          context.Result("failed to run check")          context.Result(0)
1614          return 0          return 0
1615    
1616      major,minor,patch = tuple([int(i) for i in output.split(".")])      major,minor,patch = tuple([int(i) for i in output.split(".")])
# Line 1203  def CheckIDAVersion(context): Line 1625  def CheckIDAVersion(context):
1625                    
1626      # good version      # good version
1627      context.Result("%d.%d.%d, good" % (major,minor,patch))      context.Result("%d.%d.%d, good" % (major,minor,patch))
1628    
1629      return 1      return 1
1630            
1631    
1632    def CheckIDA(context):
1633        context.Message( 'Checking for IDA... ' )
1634    
1635        keep = KeepContext(context,"SUNDIALS")
1636    
1637        major = context.env['SUNDIALS_VERSION_MAJOR']
1638        minor = context.env['SUNDIALS_VERSION_MINOR']
1639    
1640        cppdef = context.env.get('CPPDEFINES')
1641    
1642        context.env.Append(CPPDEFINES=[
1643            ('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR")
1644            ,('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR")
1645        ])
1646    
1647        context.env['SUNDIALS_CPPPATH_EXTRA']=[]
1648        if major==2 and minor==2:
1649            context.env.Append(SUNDIALS_CPPPATH_EXTRA = ["$SUNDIALS_CPPPATH/sundials"])
1650    
1651        context.env.Append(CPPDEFINES=[('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR"),('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR")])
1652        context.env.AppendUnique(LIBS=context.env['SUNDIALS_LIBS'])
1653        context.env.AppendUnique(CPPPATH=context.env['SUNDIALS_CPPPATH_EXTRA'])
1654    
1655        is_ok = context.TryLink(ida_test_text,".c")
1656        context.Result(is_ok)
1657        
1658        if cppdef:
1659            context.env['CPPDEFINES']=cppdef
1660        else:
1661            del context.env['CPPDEFINES']
1662    
1663        keep.restore(context)
1664            
1665        return is_ok
1666    
1667    
1668  #----------------  #----------------
1669  # CONOPT test  # CONOPT test
1670    
# Line 1237  def CheckCONOPT(context): Line 1697  def CheckCONOPT(context):
1697      return is_ok      return is_ok
1698    
1699  #----------------  #----------------
1700    # IPOPT test
1701    
1702    ipopt_test_text = """
1703    #if !defined(_WIN32)
1704    # define FNAME_LCASE_DECOR
1705    #endif
1706    
1707    #include <coin/IpStdCInterface.h>
1708    int main(){
1709        Number n;
1710        IpoptProblem nlp = 0;
1711        n = 1;
1712        FreeIpoptProblem(nlp); // probably a crash if you run this
1713        return 0;
1714    }
1715    """
1716    
1717    def CheckIPOPT(context):
1718        context.Message( 'Checking for IPOPT... ' )
1719    
1720        keep = KeepContext(context,"IPOPT")
1721        is_ok = context.TryLink(ipopt_test_text,".c")
1722        context.Result(is_ok)
1723        
1724        keep.restore(context)
1725            
1726        return is_ok
1727    
1728    #----------------
1729  # Tcl test  # Tcl test
1730    
1731  # TCL and TK required version 8.1, 8.2, 8.3, or 8.4:  # TCL and TK required version 8.1 through 8.5:
1732  tcltk_minor_newest_acceptable = 4  tcltk_minor_newest_acceptable = 5
1733  tcltk_major_required = 8  tcltk_major_required = 8
1734    
1735  tcl_check_text = r"""  tcl_check_text = r"""
# Line 1458  int main(void){ Line 1947  int main(void){
1947    
1948  def CheckSigReset(context):  def CheckSigReset(context):
1949      context.Message("Checking signal handler reset... ")      context.Message("Checking signal handler reset... ")
1950        libsave=context.env.get('LIBS')
1951        context.env.AppendUnique(LIBS=['m'])
1952      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')      (is_ok,output) = context.TryRun(sigreset_test_text,'.c')
1953    
1954        if libsave is None:
1955            del(context.env['LIBS'])
1956        else:
1957            context.env['LIBS']=libsave
1958    
1959      if not is_ok:      if not is_ok:
1960          context.Result("ERROR")          context.Result("ERROR")
1961          return False          return False
# Line 1468  def CheckSigReset(context): Line 1965  def CheckSigReset(context):
1965      else:      else:
1966          context.Result("not required");          context.Result("not required");
1967          context.env['ASC_RESETNEEDED'] = False          context.env['ASC_RESETNEEDED'] = False
1968        return True
1969    
1970    #----------------
1971    # LyX on this system?
1972    
1973    def CheckLyx(context):
1974        context.Message("Checking for LyX... ")
1975        r = context.env.WhereIs("lyx")
1976        if r:
1977            context.Result(r)
1978        else:
1979            context.Result(0)
1980        return r
1981    
1982    #----------------
1983    # Latex2HTML on this system?
1984    
1985    def CheckLatex2HTML(context):
1986        context.Message("Checking for latex2html...")
1987        if context.env.WhereIs("latex2html"):
1988            r = True
1989        else:
1990            r = False
1991        context.Result(r)
1992        return r
1993    
1994    #----------------
1995    # 'lmodern' package for LaTeX available?
1996    
1997    lmodern_test_text = r"""
1998    \documentclass{article}
1999    \usepackage{lmodern}
2000    \title{Cartesian closed categories and the price of eggs}
2001    \author{Jane Doe}
2002    \date{September 1994}
2003    \begin{document}
2004       \maketitle
2005       Hello world!
2006    \end{document}
2007    """;
2008    
2009    def CheckLModern(context):
2010        context.Message("Checking for lmodern...")
2011        b = context.env.get("DVI")
2012        if not b:
2013            context.Result(False)
2014            return False
2015        ff = context.env.get('LATEXFLAGS')
2016        context.env.Append(LATEXFLAGS=['-interaction=nonstopmode','-halt-on-error'])
2017        is_ok = context.TryBuild(builder=b,text=lmodern_test_text,extension=".latex")
2018        print "is_ok=",is_ok
2019        if ff is not None:
2020            context.env['LATEXFLAGS'] = ff
2021        else:
2022            del context.env['LATEXFLAGS']
2023        context.Result(is_ok)
2024      return is_ok      return is_ok
2025    
2026  #----------------  #----------------
# Line 1482  gcc_version4 = False Line 2035  gcc_version4 = False
2035    
2036  conf = Configure(env  conf = Configure(env
2037      , custom_tests = {      , custom_tests = {
2038          'CheckMath' : CheckMath          'CheckCC' : CheckCC
2039            , 'CheckCXX' : CheckCXX
2040            , 'CheckF77' : CheckF77
2041            , 'CheckMath' : CheckMath
2042            , 'CheckMalloc' : CheckMalloc
2043            , 'CheckDLOpen' : CheckDLOpen
2044          , 'CheckSwigVersion' : CheckSwigVersion          , 'CheckSwigVersion' : CheckSwigVersion
2045          , 'CheckPythonLib' : CheckPythonLib          , 'CheckPythonLib' : CheckPythonLib
2046          , 'CheckCUnit' : CheckCUnit          , 'CheckCUnit' : CheckCUnit
2047          , 'CheckDMalloc' : CheckDMalloc          , 'CheckDMalloc' : CheckDMalloc
2048          , 'CheckMFGraph' : CheckMFGraph          , 'CheckLyx' : CheckLyx
2049            , 'CheckLatex2HTML' : CheckLatex2HTML
2050            , 'CheckLModern' : CheckLModern
2051            , 'CheckGraphViz' : CheckGraphViz
2052            , 'CheckGraphVizBoolean' : CheckGraphVizBoolean
2053          , 'CheckUFSparse' : CheckUFSparse          , 'CheckUFSparse' : CheckUFSparse
2054          , 'CheckTcl' : CheckTcl          , 'CheckTcl' : CheckTcl
2055          , 'CheckTclVersion' : CheckTclVersion          , 'CheckTclVersion' : CheckTclVersion
# Line 1500  conf = Configure(env Line 2062  conf = Configure(env
2062          , 'CheckTkTable' : CheckTkTable          , 'CheckTkTable' : CheckTkTable
2063          , 'CheckX11' : CheckX11          , 'CheckX11' : CheckX11
2064          , 'CheckIDA' : CheckIDA          , 'CheckIDA' : CheckIDA
2065          , 'CheckIDAVersion' : CheckIDAVersion          , 'CheckSUNDIALS' : CheckSUNDIALS
2066          , 'CheckCONOPT' : CheckCONOPT          , 'CheckCONOPT' : CheckCONOPT
2067            , 'CheckIPOPT' : CheckIPOPT
2068          , 'CheckScrollkeeperConfig' : CheckScrollkeeperConfig          , 'CheckScrollkeeperConfig' : CheckScrollkeeperConfig
2069          , 'CheckFPE' : CheckFPE          , 'CheckFPE' : CheckFPE
2070          , 'CheckSIGINT' : CheckSIGINT          , 'CheckSIGINT' : CheckSIGINT
# Line 1520  def sconsversioncheck(): Line 2083  def sconsversioncheck():
2083      import SCons      import SCons
2084      v = SCons.__version__.split(".")      v = SCons.__version__.split(".")
2085      if v[0] != '0':      if v[0] != '0':
2086            if v[0] == '1':
2087                return 1;
2088          return 0          return 0
2089        if int(v[1]) >= 97:
2090            return 1
2091      if v[1] != '96':      if v[1] != '96':
2092          return 0          return 0
2093      micro = int(v[2])      micro = int(v[2])
2094      if micro == 92 or micro == 93:      if micro == 92 or micro == 93 or micro == 96:
2095          return 1;          return 1;
2096      return 0      return 0
2097    
# Line 1535  if not sconsversioncheck(): Line 2102  if not sconsversioncheck():
2102      print "want to *force* SCons to continue."      print "want to *force* SCons to continue."
2103      Exit(1)      Exit(1)
2104    
2105    # check C compiler
2106    
2107    if conf.CheckCC() is False:
2108        print "Failed to build simple test file with your C compiler."
2109        print "Check your compiler is installed and running correctly."
2110        Exit(1)
2111    
2112    if conf.CheckCXX() is False:
2113        print "Failed to build simple test file with your C++ compiler."
2114        print "Check your compiler is installed and running correctly."
2115        print "You can set your C++ compiler using the CXX scons option."
2116        Exit(1)
2117    
2118  # stdio -- just to check that compiler is behaving  # stdio -- just to check that compiler is behaving
2119    
2120  if not conf.CheckHeader('stdio.h'):  if conf.CheckHeader('stdio.h') is False:
2121      print "CPPPATH =",env.get('CPPPATH')      print "CPPPATH =",env.get('CPPPATH')
2122      print "Did not find 'stdio.h'! Check your compiler configuration."      print "Did not find 'stdio.h'! Check your compiler configuration."
2123      print ""      print ""
# Line 1546  if not conf.CheckHeader('stdio.h'): Line 2126  if not conf.CheckHeader('stdio.h'):
2126          print "%-30s%s" % ("%s :" % k, v)          print "%-30s%s" % ("%s :" % k, v)
2127      Exit(1)      Exit(1)
2128    
2129  if not conf.CheckFunc('snprintf'):  if conf.CheckFunc('snprintf') is False:
2130      print "Didn't find snprintf";      print "Didn't find snprintf";
2131      exit(1)      exit(1)
2132    
2133    if conf.CheckFunc('strdup'):
2134        conf.env['HAVE_STRDUP'] = True
2135    
2136    if platform.system()=="Windows" and env.get('WITH_MSVCR71'):
2137        conf.env.Append(LIBS='msvcr71')
2138        
2139  # Math library  # Math library
2140    
2141  conf.env['HAVE_IEEE']=True  conf.env['HAVE_IEEE']=True
2142    
2143  if need_libm and not conf.CheckMath():  if need_libm and (conf.CheckMath() is False):
2144      conf.env['HAVE_IEEE']=False      conf.env['HAVE_IEEE']=False
2145      print 'Did not find math library, exiting!'      print 'Did not find math library, exiting!'
2146      Exit(1)      Exit(1)
2147    
2148    # Malloc
2149    
2150    if conf.CheckMalloc() is False:
2151        conf.env['HAVE_MALLOC']=False
2152        print "Did not find functioning 'malloc', exiting!"
2153        Exit(1)
2154    
2155    # dlopen/LoadLibrary
2156    
2157    # CURRENTLY BREAKS LATER TEST (libsave?)
2158    #if conf.CheckDLOpen() is False:
2159    #   print "Did not find functioning dlopen/LoadLibrary, exiting!"
2160    #   Exit(1)
2161    
2162  # Where is 'isnan'?  # Where is 'isnan'?
2163    
2164  if not conf.CheckFunc('isnan') and not conf.CheckFunc('_isnan'):  if conf.CheckFunc('isnan') is False and conf.CheckFunc('_isnan') is False:
2165      print "Didn't find isnan"      print "Didn't find isnan"
2166  #   Exit(1)  #   Exit(1)
2167    
# Line 1569  if not conf.CheckFunc('isnan') and not c Line 2169  if not conf.CheckFunc('isnan') and not c
2169    
2170  if conf.CheckGcc():  if conf.CheckGcc():
2171      conf.env['HAVE_GCC']=True;      conf.env['HAVE_GCC']=True;
2172      if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility():      if env.get('WITH_GCCVISIBILITY') and conf.CheckGccVisibility():
2173          conf.env['HAVE_GCCVISIBILITY']=True;          conf.env['HAVE_GCCVISIBILITY']=True;
2174          conf.env.Append(CCFLAGS=['-fvisibility=hidden'])          conf.env.Append(CCFLAGS=['-fvisibility=hidden'])
2175          conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])          conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])
# Line 1591  else: Line 2191  else:
2191    
2192  # Checking for signal reset requirement  # Checking for signal reset requirement
2193    
2194  if not conf.CheckSigReset():  if conf.CheckSigReset() is False:
2195      print "Unable to determine if signal reset is required"      print "Unable to determine if signal reset is required"
2196      Exit(1)      Exit(1)
2197    
2198  # YACC  # YACC
2199    
2200  if not conf.CheckYacc():  if conf.CheckYacc():
     print "YACC NOT FOUND OR NOT WORKING"  
 else:  
2201      conf.env['HAVE_YACC']=True      conf.env['HAVE_YACC']=True
2202    
2203  if not conf.CheckLex():  if conf.CheckLex():
     print "YACC NOT FOUND OR NOT WORKING"  
 else:  
2204      conf.env['HAVE_LEX']=True      conf.env['HAVE_LEX']=True
2205    
2206  # Tcl/Tk  # Tcl/Tk
# Line 1647  if not conf.CheckPythonLib(): Line 2243  if not conf.CheckPythonLib():
2243    
2244  # SWIG version  # SWIG version
2245    
2246  if with_python and not conf.CheckSwigVersion():  if with_python and conf.CheckSwigVersion() is False:
2247      without_python_reason = 'SWIG >= 1.3.24 is required'      without_python_reason = 'SWIG >= 1.3.24 is required'
2248      with_python = False      with_python = False
2249      env['WITH_PYTHON']=False      env['WITH_PYTHON']=False
# Line 1667  if with_dmalloc: Line 2263  if with_dmalloc:
2263          without_dmalloc_reason = 'dmalloc not found'          without_dmalloc_reason = 'dmalloc not found'
2264          with_dmalloc = False          with_dmalloc = False
2265    
2266  # MFGRAPH  # GRAPHVIZ
2267    
2268  if with_mfgraph:  if with_graphviz:
2269      if not conf.CheckMFGraph():      if not conf.CheckGraphViz():
2270          without_mfgraph_reason = 'mfgraph not found'          without_graphviz_reason = 'graphviz not found'
2271          with_mfgraph = False          with_graphviz = False
2272          env['WITH_MFGRAPH'] = False          env['WITH_GRAPHVIZ'] = False
2273        env['HAVE_GRAPHVIZ_BOOLEAN'] = conf.CheckGraphVizBoolean()      
2274    
2275  # UFSPARSE  # UFSPARSE
2276    
2277  if with_ufsparse:  if with_ufsparse:
2278      if not conf.CheckUFSparse():      if not conf.CheckUFSparse():
2279          without_ufsparse_reason = 'mfgraph not found'          without_ufsparse_reason = 'ufsparse not found'
2280          with_ufsparse = False          with_ufsparse = False
2281          env['WITH_UFSPARSE'] = False          env['WITH_UFSPARSE'] = False
2282    
2283  # IDA  # IDA
2284    
2285  if not with_ida:  if with_ida:
2286      without_ida_reason = "Not selected (see config option WITH_SOLVERS)"      if not conf.CheckSUNDIALS():
2287  elif not conf.CheckIDA():          with_ida = False
2288      with_ida = False          without_ida_reason = "SUNDIALS not found, or bad version"
2289      without_ida_reason = "IDA not found"      elif not conf.CheckIDA():
2290  elif not conf.CheckIDAVersion():          with_ida = False
2291      with_ida = False          without_ida_reason = "Unable to compile/link against SUNDIALS/IDA"
     without_ida_reason = "Unsupported (or undetected) SUNDIALS version"  
2292    
2293  # CONOPT  # CONOPT
2294    
2295  if not with_conopt:  if not with_conopt:
2296      without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"      without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
2297  elif not conf.CheckCONOPT():  elif conf.CheckCONOPT() is False:
2298      with_conopt = False      if conf.env.get('CONOPT_LINKED'):
2299      without_conpt_reason = "CONOPT not found"          conf.env['CONOPT_LINKED'] = False
2300        # we no longer require CONOPT at buildtime in order to build support for it
2301        #with_conopt = False
2302        #without_conpt_reason = "CONOPT not found"
2303    
2304    # IPOPT
2305    
2306    if not with_ipopt:
2307        without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)"
2308    elif not conf.CheckIPOPT():
2309        with_ipopt = False
2310        without_ipopt_reason = "IPOPT not found"
2311    
2312  # BLAS  # BLAS
2313    
# Line 1708  need_blas=False Line 2315  need_blas=False
2315    
2316  if with_lsode:  if with_lsode:
2317      need_fortran = True      need_fortran = True
2318        need_fortran_reasons.append("LSODE")
2319        need_blas=True
2320    
2321    if with_ipopt:
2322      need_blas=True      need_blas=True
2323    
2324  if need_blas:  if need_blas:
# Line 1717  if need_blas: Line 2328  if need_blas:
2328      else:      else:
2329          with_local_blas = True          with_local_blas = True
2330          need_fortran = True          need_fortran = True
2331            need_fortran_reasons.append("BLAS")
2332  else:  else:
2333      with_local_blas= False;      with_local_blas= False;
2334      without_local_blas_reason = "BLAS not required"      without_local_blas_reason = "BLAS not required"
# Line 1724  else: Line 2336  else:
2336  # FORTRAN  # FORTRAN
2337    
2338  if need_fortran:  if need_fortran:
2339      conf.env.Tool('fortran')      print "NEED FORTRAN"
2340        import SCons
2341        if SCons.__version__[0:4]=="0.97":
2342            # Older SCons verions 0.97 (eg Ubuntu 8.04) doesn't have the 'gfortran' tool'.
2343            # On this system, the 'fortran' tool seems to detect gfortran OK.
2344            conf.env.Tool('fortran')
2345        else:
2346            conf.env.Tool('g77')
2347            conf.env.Tool('gfortran')
2348      detect_fortran = conf.env.Detect(['gfortran','g77'])      detect_fortran = conf.env.Detect(['gfortran','g77'])
2349      if detect_fortran:      if detect_fortran:
2350          # For some reason, g77 doesn't get detected properly on MinGW          # For some reason, g77 doesn't get detected properly on MinGW
# Line 1743  if need_fortran: Line 2363  if need_fortran:
2363              )              )
2364              conf.env.Append(BUILDERS={'Fortran':fortran_builder})              conf.env.Append(BUILDERS={'Fortran':fortran_builder})
2365          if platform.system()=="Linux":          if platform.system()=="Linux":
2366                print "APPARENTLY FORTRAN WAS DETECTED"
2367              conf.env.Append(SHFORTRANFLAGS=['-fPIC'])              conf.env.Append(SHFORTRANFLAGS=['-fPIC'])
2368      else:      else:
2369            print "FAILED FORTRAN DETECTION"
2370          with_lsode=False;          with_lsode=False;
2371          without_lsode_reason="FORTRAN-77 required but not found"          without_lsode_reason="FORTRAN-77 required but not found"
2372    else:
2373        print "FORTRAN WAS NOT FOUND TO BE REQUIRED"
2374    
2375    if need_fortran and conf.CheckF77() is False:
2376        print "Failed to build simple test file with your Fortran compiler."
2377        print "Check your compiler is installed and running correctly."
2378        print "You can set your Fortran compiler using the FORTRAN scons option."
2379        print "The fortran compiler is REQUIRED to build:",", ".join(need_fortran_reasons)
2380        print "Perhaps try examining the value of your WITH_SOLVERS option (remove LSODE, etc)."
2381        Exit(1)
2382    
2383  #else:  #else:
2384  #   print "FORTRAN not required"  #   print "FORTRAN not required"
# Line 1761  if need_fortran: Line 2393  if need_fortran:
2393  # scrollkeeper  # scrollkeeper
2394    
2395  if with_scrollkeeper:  if with_scrollkeeper:
2396      if not conf.CheckScrollkeeperConfig():      if conf.CheckScrollkeeperConfig() is False:
2397          with_scrollkeeper=False          with_scrollkeeper=False
2398          without_scrollkeeper_reason="unable to detect scrollkeeper-config"          without_scrollkeeper_reason="unable to detect scrollkeeper-config"
2399    
2400    # lyx
2401    
2402    if with_doc_build:
2403        if not conf.CheckLyx():
2404            with_doc_build = False
2405            without_doc_build_reason="unable to locate LyX"
2406    
2407        with_latex2html = conf.CheckLatex2HTML()
2408    
2409        if conf.CheckLModern() is False:
2410            with_doc_build = False
2411            without_doc_build_reason="'lmodern' is not available"
2412    
2413  # TODO: -D_HPUX_SOURCE is needed  # TODO: -D_HPUX_SOURCE is needed
2414    
2415  # TODO: check size of void*  # TODO: check size of void*
# Line 1778  if platform.system()=="Windows" and env. Line 2423  if platform.system()=="Windows" and env.
2423          print "Could not locate 'Windows.h' in CPPPATH. Check your configuration."          print "Could not locate 'Windows.h' in CPPPATH. Check your configuration."
2424          Exit(1)          Exit(1)
2425    
2426      if with_python and not conf.CheckHeader(['basetsd.h','BaseTsd.h']):      if with_python and conf.CheckHeader(['basetsd.h','BaseTsd.h']) is False:
2427          with_python = 0;          with_python = 0;
2428          without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK."          without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK."
2429    
 conf.env.Append(CPPDEFINES=env['PACKAGE_LINKING'])  
   
2430  conf.Finish()  conf.Finish()
2431    
2432    #print "-=-=-=-=-=-=-=-=- LIBS =",env.get('LIBS')
2433    
2434  #---------------------------------------  #---------------------------------------
2435  # SUBSTITUTION DICTIONARY for .in files  # SUBSTITUTION DICTIONARY for .in files
2436    
# Line 1797  if release=="0.": Line 2442  if release=="0.":
2442    
2443  subst_dict = {  subst_dict = {
2444      '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']      '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']
2445        ,'@DEFAULT_ASCENDSOLVERS@':env['DEFAULT_ASCENDSOLVERS']
2446      , '@GLADE_FILE@':'ascend.glade'      , '@GLADE_FILE@':'ascend.glade'
2447      , '@HELP_ROOT@':''      , '@HELP_ROOT@':''
2448      , '@ICON_EXTENSION@':icon_extension      , '@ICON_EXTENSION@':icon_extension
# Line 1805  subst_dict = { Line 2451  subst_dict = {
2451      , '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE']      , '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE']
2452      , '@INSTALL_LIB@':env['INSTALL_LIB']      , '@INSTALL_LIB@':env['INSTALL_LIB']
2453      , '@INSTALL_MODELS@':env['INSTALL_MODELS']      , '@INSTALL_MODELS@':env['INSTALL_MODELS']
2454        , '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS']
2455        , '@INSTALL_PYTHON@':env['INSTALL_PYTHON']
2456      , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']      , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']
2457      , '@VERSION@':version      , '@VERSION@':version
2458      , '@RELEASE@':release      , '@RELEASE@':release
2459      , '@DISTTAR_NAME@':env['DISTTAR_NAME']      , '@DISTTAR_NAME@':env['DISTTAR_NAME']
2460      , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'      , '@WEBHELPROOT@':'http://ascendwiki.cheme.cmu.edu/Category:Documentation'
2461      , '@SHLIBSUFFIX@':env['SHLIBSUFFIX']      , '@SHLIBSUFFIX@':env['SHLIBSUFFIX']
2462      , '@SHLIBPREFIX@':env['SHLIBPREFIX']      , '@SHLIBPREFIX@':env['SHLIBPREFIX']
2463        , '@EXTLIB_SUFFIX@':env['EXTLIB_SUFFIX']
2464        , '@EXTLIB_PREFIX@':env['EXTLIB_PREFIX']
2465      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'      , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
     , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir  
2466      , '@PYTHON@' : python_exe      , '@PYTHON@' : python_exe
2467      , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')      , '@PYVERSION@' : pyversion
     , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')  
     , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_LIBPATH"))  
2468      , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))      , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))
2469        , '@WITH_GRAPHVIZ@': str(int(env.get('WITH_GRAPHVIZ')))
2470    #define ASC_ABSOLUTE_PATHS @ASC_ABSOLUTE_PATHS@
2471    #if ASC_ABSOLUTE_PATHS
2472    # define ASCENDDIST_DEFAULT "@ASCENDDIST_DEFAULT@"
2473    # define ASCENDTK_DEFAULT "@ASCENDTK_DEFAULT@"
2474    # define ASCENDLIBRARY_DEFAULT "@ASCENDLIBRARY_DEFAULT@"
2475    # define ASCENDSOLVERS_DEFAULT "@ASCENDSOLVERS_DEFAULT@"
2476    #else
2477    # define ASC_DIST_REL_BIN "@ASC_DIST_REL_BIN@"
2478    # define ASC_TK_REL_DIST "@ASC_TK_REL_DIST@"
2479    # define ASC_LIBRARY_REL_DIST "@ASC_LIBRARY_REL_DIST@"
2480    # define ASC_SOLVERS_REL_DIST "@ASC_SOLVERS_REL_DIST@"
2481    #endif
2482        , '@ASC_ABSOLUTE_PATHS@': str(int(env.get('ABSOLUTE_PATHS')))
2483        , '@ASCENDDIST_DEFAULT@': c_escape(env['INSTALL_PREFIX'])
2484        , '@ASCENDTK_DEFAULT@': c_escape(os.path.abspath(env.subst(env['INSTALL_TK'])))
2485        , '@ASCENDLIBRARY_DEFAULT@': c_escape(os.path.abspath(env.subst(env['DEFAULT_ASCENDLIBRARY'])))
2486        , '@ASCENDSOLVERS_DEFAULT@': c_escape(os.path.abspath(env.subst(env['DEFAULT_ASCENDSOLVERS'])))
2487        , '@ASC_DIST_REL_BIN@' : default_dist_rel_bin
2488        , '@ASC_TK_REL_DIST@' : default_tk_rel_dist
2489        , '@ASC_LIBRARY_REL_DIST@' : default_library_rel_dist
2490        , '@ASC_SOLVERS_REL_DIST@' : default_solvers_rel_dist
2491  }  }
2492    
2493  if env.get('WITH_LOCAL_HELP'):  if env.get('WITH_DOC'):
2494      print "WITH_LOCAL_HELP:",env['WITH_LOCAL_HELP']      print "WITH_DOC:",env['WITH_DOC']
2495      subst_dict['@HELP_ROOT@']=env['WITH_LOCAL_HELP']      subst_dict['@HELP_ROOT@']=env['HELP_ROOT']
2496    
2497  # bool options...  # bool options...
2498  for k,v in {  for k,v in {
2499          'ASC_WITH_IDA':with_ida          'ASC_WITH_DMALLOC':with_dmalloc
         ,'ASC_WITH_DMALLOC':with_dmalloc  
         ,'ASC_WITH_MFGRAPH':with_mfgraph  
2500          ,'ASC_WITH_UFSPARSE':with_ufsparse          ,'ASC_WITH_UFSPARSE':with_ufsparse
         ,'ASC_WITH_CONOPT':with_conopt  
         ,'ASC_WITH_LSODE':with_lsode  
2501          ,'ASC_WITH_MMIO':with_mmio          ,'ASC_WITH_MMIO':with_mmio
2502          ,'ASC_SIGNAL_TRAPS':with_signals          ,'ASC_SIGNAL_TRAPS':with_signals
2503          ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')          ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')
2504          ,'HAVE_C99FPE':env.get('HAVE_C99FPE')          ,'HAVE_C99FPE':env.get('HAVE_C99FPE')
2505          ,'HAVE_IEEE':env.get('HAVE_IEEE')          ,'HAVE_IEEE':env.get('HAVE_IEEE')
         ,'ASC_ABSOLUTE_PATHS':env.get('ASC_ABSOLUTE_PATHS')  
2506          ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')          ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')
2507          ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')          ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')
2508          }.iteritems():          }.iteritems():
# Line 1849  if with_python: Line 2513  if with_python:
2513      subst_dict['@ASCXX_USE_PYTHON@']="1"      subst_dict['@ASCXX_USE_PYTHON@']="1"
2514      env['WITH_PYTHON']=1;      env['WITH_PYTHON']=1;
2515    
2516    if with_latex2html:
2517        env['WITH_LATEX2HTML']=1
2518    
2519  if env.has_key('HAVE_GCCVISIBILITY'):  if env.has_key('HAVE_GCCVISIBILITY'):
2520      subst_dict['@HAVE_GCCVISIBILITY@'] = "1"      subst_dict['@HAVE_GCCVISIBILITY@'] = "1"
2521    
# Line 1874  SWIGScanner = SCons.Scanner.ClassicCPP( Line 2541  SWIGScanner = SCons.Scanner.ClassicCPP(
2541  env.Append(SCANNERS=[SWIGScanner])  env.Append(SCANNERS=[SWIGScanner])
2542    
2543  #------------------------------------------------------  #------------------------------------------------------
 # RECIPE: 'SubstInFile', used in pygtk SConscript  
   
 import re  
 from SCons.Script import *  # the usual scons stuff you get in a SConscript  
   
 def TOOL_SUBST(env):  
     """Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT  
     from the source to the target.  
     The values of SUBST_DICT first have any construction variables expanded  
     (its keys are not expanded).  
     If a value of SUBST_DICT is a python callable function, it is called and  
     the result is expanded as the value.  
     If there's more than one source and more than one target, each target gets  
     substituted from the corresponding source.  
     """  
     env.Append(TOOLS = 'SUBST')  
     def do_subst_in_file(targetfile, sourcefile, dict):  
         """Replace all instances of the keys of dict with their values.  
         For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},  
         then all instances of %VERSION% in the file will be replaced with 1.2345 etc.  
         """  
         try:  
             f = open(sourcefile, 'rb')  
             contents = f.read()  
             f.close()  
         except:  
             raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile  
         for (k,v) in dict.items():  
             try:  
                 #print "%s ---> %s" % (k,v)  
                 contents = re.sub(k, v, contents)  
             except Exception,e:  
                 sys.stderr.write("Failed to substute '%s' with '%s': %s\n" % (k,v,e))  
           
         try:  
             f = open(targetfile, 'wb')  
             f.write(contents)  
             f.close()  
         except:  
             raise SCons.Errors.UserError, "Can't write target file %s"%targetfile  
         return 0 # success  
   
     def subst_in_file(target, source, env):  
         if not env.has_key('SUBST_DICT'):  
             raise SCons.Errors.UserError, "SubstInFile requires SUBST_DICT to be set."  
         d = dict(env['SUBST_DICT']) # copy it  
         for (k,v) in d.items():  
             if callable(v):  
                 d[k] = env.subst(v())  
             elif SCons.Util.is_String(v):  
                 d[k]=env.subst(v)  
             else:  
                 raise SCons.Errors.UserError, "SubstInFile: key %s: %s must be a string or callable"%(k, repr(v))  
         for (t,s) in zip(target, source):  
             return do_subst_in_file(str(t), str(s), d)  
   
     def subst_in_file_string(target, source, env):  
         """This is what gets printed on the console."""  
         return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t))  
                           for (t,s) in zip(target, source)])  
   
     def subst_emitter(target, source, env):  
         """Add dependency from substituted SUBST_DICT to target.  
         Returns original target, source tuple unchanged.  
         """  
         d = env['SUBST_DICT'].copy() # copy it  
         for (k,v) in d.items():  
             if callable(v):  
                 d[k] = env.subst(v())  
             elif SCons.Util.is_String(v):  
                 d[k]=env.subst(v)  
         Depends(target, SCons.Node.Python.Value(d))  
         return target, source  
   
     subst_action=SCons.Action.Action(subst_in_file, subst_in_file_string)  
     env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter)  
   
 TOOL_SUBST(env)  
   
 #------------------------------------------------------  
2544  # Recipe for 'CHMOD' ACTION        # Recipe for 'CHMOD' ACTION      
2545            
2546  import SCons      import SCons    
# Line 1965  def InstallPerm(env, dest, files, perm): Line 2552  def InstallPerm(env, dest, files, perm):
2552      obj = env.Install(dest, files)        obj = env.Install(dest, files)  
2553      for i in obj:          for i in obj:    
2554          env.AddPostAction(i, env.Chmod(str(i), perm))              env.AddPostAction(i, env.Chmod(str(i), perm))    
2555    
2556    def InstallPermAs(env, dest, filen, perm):  
2557        obj = env.InstallAs(dest, filen)    
2558        for i in obj:    
2559            env.AddPostAction(i, env.Chmod(str(i), perm))
2560        return dest
2561            
2562  SConsEnvironment.InstallPerm = InstallPerm    SConsEnvironment.InstallPerm = InstallPerm  
2563            
# Line 1972  SConsEnvironment.InstallPerm = InstallPe Line 2565  SConsEnvironment.InstallPerm = InstallPe
2565  SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)    SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)  
2566  SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)  SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2567  SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)  SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2568    SConsEnvironment.InstallLibraryAs = lambda env, dest, files: InstallPermAs(env, dest, files, 0644)
2569    
2570  #------------------------------------------------------  #------------------------------------------------------
2571  # BUILD...  # BUILD...
2572    
2573  # so that #include <modulename/headername.h> works across all modules...  # so that #include <ascend/modulename/headername.h> works across all modules...
2574  env.AppendUnique(CPPPATH=['#base/generic'])  env.AppendUnique(CPPPATH=['#'])
2575    
2576  if env['DEBUG']:  if env['DEBUG']:
2577      env.Append(CCFLAGS=['-g'])      env.Append(CCFLAGS=['-g'])
2578        env.Append(LINKFLAGS=['-g'])
2579    
2580  if env['GCOV']:  if env['GCOV']:
2581      env.Append(      env.Append(
# Line 1995  if with_ida: Line 2590  if with_ida:
2590  if with_conopt:  if with_conopt:
2591      env.Append(WITH_CONOPT=1)      env.Append(WITH_CONOPT=1)
2592    
2593    if with_ipopt:
2594        env.Append(WITH_IPOPT=1)
2595    
2596    if with_dopri5:
2597        env.Append(WITH_DOPRI5=1)
2598    
2599    if with_graphviz and env.get('GRAPHVIZ_RPATH'):
2600        env.Append(RPATH=env['GRAPHVIZ_RPATH'])
2601    
2602  #-------------  #-------------
2603  # TCL/TK GUI  # TCL/TK GUI
2604    
2605  if with_tcltk:  if with_tcltk:
2606      env.SConscript(['tcltk/generic/interface/SConscript'],'env')      env.SConscript(['tcltk/SConscript'],'env')
2607  else:  else:
2608      print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason      print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason
2609    
# Line 2014  else: Line 2618  else:
2618  #------------  #------------
2619  # BASE/GENERIC SUBDIRECTORIES  # BASE/GENERIC SUBDIRECTORIES
2620    
2621  libascend_env = env.Copy()  libascend_env = env.Clone()
2622    
2623  dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']  dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']
2624    
2625  srcs = []  srcs = []
2626  for d in dirs:  for d in dirs:
2627      heresrcs = libascend_env.SConscript('base/generic/'+d+'/SConscript','libascend_env')      heresrcs = libascend_env.SConscript('ascend/'+d+'/SConscript','libascend_env')
2628      srcs += heresrcs      srcs += heresrcs
2629    
2630  #-------------  #-------------
2631  # IMPORTED CODE: LSODE, BLAS, etc  # IMPORTED CODE: LSODE, BLAS, etc
2632    
2633  if with_lsode:  #if with_lsode:
2634      srcs += env.SConscript(['lsod/SConscript'],'env')  #   srcs += env.SConscript(['lsod/SConscript'],'env')
2635      srcs += env.SConscript(['linpack/SConscript'],'env')  #   srcs += env.SConscript(['linpack/SConscript'],'env')
2636  else:  #else:
2637      print "Skipping... LSODE won't be built:", without_lsode_reason  #   print "Skipping... LSODE won't be built:", without_lsode_reason
2638    
2639  if with_local_blas:  if with_local_blas:
2640      srcs += env.SConscript(['blas/SConscript'],'env')      env['blasobjs'] = env.SConscript(['blas/SConscript'],'env')
2641  else:  else:
2642        env['blasobjs'] = []
2643      print "Skipping... BLAS won't be built:", without_local_blas_reason      print "Skipping... BLAS won't be built:", without_local_blas_reason
2644    
2645  if not with_ida:  if not with_ida:
2646      print "Skipping... IDA won't be built:", without_ida_reason      print "Skipping... IDA won't be built:", without_ida_reason
2647    
2648    if not with_dopri5:
2649        print "Skipping... DOPRI5 won't be built:", without_dopri5_reason
2650    
2651  if with_mmio:  if with_mmio:
2652      srcs += env.SConscript(['mmio/SConscript'],'env')      srcs += env.SConscript(['mmio/SConscript'],'env')
2653  else:  else:
2654      print "Skipping... MMIO export won't be built:", without_mmio_reason      print "Skipping... MMIO export won't be built:", without_mmio_reason
2655  #-------------  #-------------
2656  # LIBASCEND -- all base/generic functionality  # LIBASCEND -- all 'core' functionality
2657    
2658    # FIXME want to move these bits to ascend/SConscript
2659    
2660    libascend_env.Append(
2661        CPPPATH=['#']
2662        ,LIBS=['m']
2663    )
2664    
2665    if platform.system()=="Linux":
2666        libascend_env.Append(LIBS=['dl'])
2667    
2668  if with_dmalloc:  if with_dmalloc:
2669      libascend_env.Append(LIBS=['dmalloc'])      libascend_env.Append(LIBS=['dmalloc'])
# Line 2053  if with_dmalloc: Line 2671  if with_dmalloc:
2671  if with_ufsparse:  if with_ufsparse:
2672      libascend_env.Append(LIBS=['cxsparse'])      libascend_env.Append(LIBS=['cxsparse'])
2673    
2674    if platform.system()=="Linux":
2675        libascend_env.Append(LINKFLAGS=['-Wl,-soname,%s' % soname_full])
2676    
2677  libascend = libascend_env.SharedLibrary('ascend',srcs)  libascend = libascend_env.SharedLibrary('ascend',srcs)
2678    
2679  env.Alias('libascend',libascend)  # create local symlink for the soname stuff.
2680    print "SONAME =",env.subst(soname_full)
2681    
2682    env['libascend'] = libascend
2683    libtargets = [libascend]
2684    
2685    if platform.system()=="Linux":
2686        if soname_major:
2687            libascend_env.Command(soname_full,libascend,Move("$TARGET","$SOURCE"))
2688            print "MAKING LINK, SONAME_MAJOR =",soname_major
2689            liblink = libascend_env.Command(soname_full, libascend, "ln -s $SOURCE $TARGET")
2690            libtargets.append(liblink)
2691    
2692    # for use in declaring dependent shared libraries in SConscript files (eg solvers/*/SConscript)
2693    
2694    env.Alias('libascend',libtargets)
2695    
2696  #-------------  #-------------
2697  # UNIT TESTS (C CODE)  # UNIT TESTS (C CODE)
2698    
2699    test_env = env.Clone()
2700    test_env.Append(
2701        CPPPATH="#"
2702    )
2703    
2704  if with_cunit:  if with_cunit:
2705      testdirs = ['general','solver','utilities','linear']      testdirs = ['general','solver','utilities','linear','compiler']
2706      testsrcs = []      testsrcs = []
2707      for testdir in testdirs:      for testdir in testdirs:
2708          path = 'base/generic/'+testdir+'/test/'          path = 'ascend/'+testdir+'/test/'
2709          env.SConscript([path+'SConscript'],'env')          test_env.SConscript([path+'SConscript'],'test_env')
2710          testsrcs += [i.path for i in env['TESTSRCS_'+testdir.upper()]]          testsrcs += [i.path for i in test_env['TESTSRCS_'+testdir.upper()]]
2711    
2712      #print "TESTSRCS =",testsrcs      #print "TESTSRCS =",testsrcs
2713                    
2714      env.SConscript(['test/SConscript'],'env')      test_env.SConscript(['test/SConscript'],'test_env')
     env.SConscript(['base/generic/test/SConscript'],'env')  
2715    
2716      env.Alias('test',[env.Dir('test'),env.Dir('base/generic/test')])      env.Alias('test',[env.Dir('test')])
2717            
2718  else:  else:
2719      print "Skipping... CUnit tests aren't being built:",without_cunit_reason      print "Skipping... CUnit tests aren't being built:",without_cunit_reason
2720    
2721  #-------------  #-------------
2722  # EXTERNAL FUNCTIONS  # EXTERNAL SOLVERS
2723    
2724  env['extfns']=[]  env['extfns']=[]
2725    
2726    env.SConscript(['solvers/SConscript'],'env')
2727    
2728    #-------------
2729    # EXTERNAL FUNCTIONS
2730    
2731  modeldirs = env.SConscript(['models/SConscript'],'env')  modeldirs = env.SConscript(['models/SConscript'],'env')
2732    
2733  if not with_extfns:  if not with_extfns:
# Line 2099  ascendconfig = env.SubstInFile('ascend-c Line 2745  ascendconfig = env.SubstInFile('ascend-c
2745    
2746  if env.get('CAN_INSTALL'):  if env.get('CAN_INSTALL'):
2747    
2748      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE']      dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE','INSTALL_DOC','INSTALL_PYTHON']
2749      install_dirs = [env.Entry(env['INSTALL_ROOT']+env[d]) for d in dirs]      install_dirs = [Dir(env.subst("$INSTALL_ROOT$"+d)) for d in dirs]
2750      install_dirs += modeldirs      install_dirs += modeldirs + [Dir(env.subst("$INSTALL_ROOT$INSTALL_SOLVERS"))]
2751    
2752      # TODO: add install options      # TODO: add install options
2753      env.Alias('install',install_dirs)      env.Alias('install',install_dirs)
2754    
2755      env.InstallShared(env['INSTALL_ROOT']+env['INSTALL_LIB'],libascend)      #env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_LIB")),libascend)
2756    
2757        libname = "${INSTALL_LIB}/%s%s" % (soname_full,soname_minor)
2758        install_lib = env.InstallLibraryAs("${INSTALL_ROOT}"+libname, [libascend])
2759        if env['ABSOLUTE_PATHS']:
2760            link_target = libname
2761        else:
2762            link_target = "%s%s" % (soname_full,soname_minor)
2763    
2764        link1 = "${INSTALL_LIB}/%s" % soname_clean
2765        install_link1 = None
2766        if env.subst(link1) != env.subst(libname):
2767            #                           v--link to create       v--file to link to   command          
2768            install_link1 = env.Command("${INSTALL_ROOT}"+link1,install_lib
2769            #    v-- command to do it (note the trick about
2770                ,"ln -f -s %s $TARGET" % link_target
2771            )
2772    
2773        link2 = "${INSTALL_LIB}/%s" % soname_full
2774        install_link2 = None
2775        if soname_minor:
2776            install_link2 = env.Command("${INSTALL_ROOT}"+link2,install_lib
2777                ,"ln -f -s %s $TARGET" % link_target
2778            )
2779    
2780      env.InstallProgram(env['INSTALL_ROOT']+env['INSTALL_BIN'],ascendconfig)      env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendconfig)
2781    
2782  #------------------------------------------------------  #------------------------------------------------------
2783  # WINDOWS INSTALLER  # WINDOWS INSTALLER
2784  # For the windows installer, please see pygtk/SConscript  
2785    if not env.get('NSIS'):
2786        with_installer = False
2787        without_installer_reason = "NSIS not found"
2788    
2789  if with_installer:  if with_installer:
2790      pass      env.Append(NSISDEFINES={
2791            'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME']
2792            ,"VERSION":version
2793            ,'PYVERSION':pyversion
2794        })
2795        installer = env.Installer('nsis/installer.nsi')
2796        Depends(installer,["pygtk","tcltk","ascend.dll","models","solvers","ascend-config",'pygtk/ascend'])
2797        env.Alias('installer',installer)
2798  else:  else:
2799      print "Skipping... Windows installer isn't being built:",without_installer_reason      print "Skipping... Windows installer isn't being built:",without_installer_reason
2800    
2801  #------------------------------------------------------  #------------------------------------------------------
 # PROJECT FILE for MSVC  
   
 env.SConscript(['base/msvc/SConscript'],['env','libascend']);  
   
 #------------------------------------------------------  
2802  # CREATE the SPEC file for generation of RPM packages  # CREATE the SPEC file for generation of RPM packages
2803    
2804  if platform.system()=="Linux":  if platform.system()=="Linux":
# Line 2133  if platform.system()=="Linux": Line 2807  if platform.system()=="Linux":
2807  #------------------------------------------------------  #------------------------------------------------------
2808  # CREATE OMF FILE FOR USE WITH SCROLLKEEPER  # CREATE OMF FILE FOR USE WITH SCROLLKEEPER
2809    
2810  if with_scrollkeeper:  #if with_scrollkeeper:
2811      env.SubstInFile('#/pygtk/gnome/ascend.omf.in')  #   #env.SubstInFile('#/pygtk/gnome/ascend.omf.in')
2812      env.InstallShared(env['INSTALL_ROOT']+env['OMFDIR'],"#/pygtk/gnome/ascend.omf")  #   #env.InstallShared(env['INSTALL_ROOT']+env['OMFDIR'],"#/pygtk/gnome/ascend.omf")
2813    
2814  #------------------------------------------------------  #------------------------------------------------------
2815  # DISTRIBUTION TAR FILE  # DISTRIBUTION TAR FILE
2816    
2817  env['DISTTAR_FORMAT']='bz2'  env['DISTTAR_FORMAT']='bz2'
2818  env.Append(  env.Append(
2819      DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.cc','.cache','.pyc','.cvsignore','.dblite','.log','.pl','.out']      DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.lib','.cc','.cache',
2820      , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist']          '.pyc','.cvsignore','.dblite','.log','.pl','.out','.exe','.aux','.idx',
2821            '.toc','.lof','.lot','.mm','.warnings','.tm2','.swp',',tmp','.gz',
2822            '.bz2','.7z','.deb','.dsc','.changes']
2823        , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian']
2824  )  )
2825    
2826  tar = env.DistTar("dist/"+env['DISTTAR_NAME']  tar = env.DistTar("dist/"+env['DISTTAR_NAME']
# Line 2151  tar = env.DistTar("dist/"+env['DISTTAR_N Line 2828  tar = env.DistTar("dist/"+env['DISTTAR_N
2828  )  )
2829    
2830  env.Depends(tar,'ascend.spec')  env.Depends(tar,'ascend.spec')
2831    env.Depends(tar,'#doc/book.pdf')
 Alias('dist',tar)  
2832    
2833  #------------------------------------------------------  #------------------------------------------------------
2834  # USER'S MANUAL  # DEBIAN TARBALL for use with Build Service
2835    
2836  env.SConscript('doc/SConscript',['env'])  import glob
2837    deb_files = glob.glob('debian/*.install')
2838    deb_files += glob.glob('debian/*.docs')
2839    deb_files += glob.glob('debian/*.dirs')
2840    deb_files += glob.glob('debian/*.man')
2841    deb_files += glob.glob('debian/*.manpages')
2842    deb_files += ['debian/%s' % s for s in ['rules','control','changelog','compat','copyright','dirs']]
2843    
2844    deb_tar = env.Tar(
2845        'dist/debian.tar.gz'
2846        ,deb_files
2847        ,TARFLAGS = ['cz']
2848    )
2849    
2850    Alias('dist',[tar,deb_tar])
2851    
2852  #------------------------------------------------------  #------------------------------------------------------
2853  # LIBASCEND DOXYGEN DOCUMENTATION  # DOCUMENTATION
2854    
2855  env.SConscript('base/doc/SConscript',['env'])  #print "WITH_DOC_BUILD = ",with_doc_build
2856    
2857    if not with_doc_build:
2858        print "Skipping... Documentation isn't being built:",without_doc_build_reason
2859    
2860    #user's manual
2861    env.SConscript('doc/SConscript',['env'])
2862    
2863  #------------------------------------------------------  #------------------------------------------------------
2864  # RPM BUILD  # RPM BUILD
# Line 2173  env.SConscript('base/doc/SConscript',['e Line 2869  env.SConscript('base/doc/SConscript',['e
2869  #------------------------------------------------------  #------------------------------------------------------
2870  # DEFAULT TARGETS  # DEFAULT TARGETS
2871    
2872  default_targets =['libascend']  default_targets =['libascend','solvers']
2873  if with_tcltk:  if with_tcltk:
2874      default_targets.append('tcltk')      default_targets.append('tcltk')
2875  if with_python:  if with_python:
# Line 2182  if with_installer: Line 2878  if with_installer:
2878      default_targets.append('installer')      default_targets.append('installer')
2879  if with_extfns:  if with_extfns:
2880      default_targets.append('extfns')      default_targets.append('extfns')
2881    if with_doc_build:
2882        default_targets.append('doc')
2883    
2884  env.Default(default_targets)  env.Default(default_targets)
2885    

Legend:
Removed from v.1387  
changed lines
  Added in v.2029

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