/[ascend]/trunk/SConstruct
ViewVC logotype

Annotation of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1535 - (hide annotations) (download)
Mon Jul 9 14:58:15 2007 UTC (12 years, 5 months ago) by jpye
File size: 56511 byte(s)
Little more on IPOPT. Fixed ascdev script to work with configured
solver list.
1 johnpye 955 import sys, os, commands, platform, distutils.sysconfig, os.path, re
2 johnpye 385
3 jpye 1514 version = "0.9.5.112"
4 johnpye 439
5 jpye 1466 pyversion = "%d.%d" % (sys.version_info[0],sys.version_info[1])
6    
7 johnpye 385 #------------------------------------------------------
8     # OPTIONS
9 johnpye 392 #
10     # Note that if you set the options via the command line, they will be
11     # remembered in the file 'options.cache'. It's a feature ;-)
12 johnpye 385
13     opts = Options(['options.cache', 'config.py'])
14 johnpye 464 #print "PLATFORM = ",platform.system()
15 johnpye 385
16 jpye 1488 default_tcl_cpppath = "$TCL/include"
17 jpye 1501 default_tron_envvar="TRON_PATH"
18     default_conopt_envvar="CONOPT_PATH"
19 jpye 1488
20 johnpye 464 if platform.system()=="Windows":
21 johnpye 631 default_tcl_lib = "tcl84"
22     default_tk_lib = "tk84"
23 johnpye 464 default_tktable_lib = "Tktable28"
24 johnpye 499 default_install_assets = "glade/"
25     icon_extension = '.png'
26 johnpye 521 default_tcl = "c:\\Tcl"
27 johnpye 643 if os.environ.get('MSYSTEM')=="MINGW32":
28 johnpye 642 default_tcl_libpath="$TCL\\bin"
29     else:
30     default_tcl_libpath="$TCL\\lib"
31 johnpye 627 default_rel_distdir = '.'
32 johnpye 628 default_absolute_paths = False
33 johnpye 739
34     default_ida_prefix = "c:\\MinGW"
35     if not os.path.exists(default_ida_prefix):
36     default_ida_prefix = None
37 johnpye 783
38 johnpye 800 default_conopt_prefix = "c:\\Program Files\\CONOPT"
39     default_conopt_libpath="$CONOPT_PREFIX"
40     default_conopt_cpppath="$CONOPT_PREFIX"
41 jpye 1399 default_conopt_dlpath="$CONOPT_PREFIX"
42 johnpye 800 default_conopt_lib="conopt3"
43 johnpye 935
44 jpye 1515 default_tron_prefix="c:\\Program Files\\TRON"
45     default_tron_dlpath="$TRON_PREFIX"
46     default_tron_lib="tron1"
47 jpye 1501
48 johnpye 938 default_prefix="c:\\MinGW"
49     default_libpath="$DEFAULT_PREFIX\\lib"
50     default_cpppath="$DEFAULT_PREFIX\\include"
51 johnpye 800
52 johnpye 783 if not os.path.exists(default_conopt_prefix):
53     default_conopt_prefix = None
54 johnpye 739
55 johnpye 673 need_libm = False
56 johnpye 683 python_exe = "c:\\Python24\\python.exe"
57 johnpye 816 default_with_scrollkeeper=False
58 jpye 1504 pathsep = ";"
59 johnpye 464 else:
60 johnpye 673 default_tcl_lib = "tcl8.4"
61     default_tk_lib = "tk8.4"
62 johnpye 464 default_tktable_lib = "Tktable2.8"
63 johnpye 628 default_install_assets = "$INSTALL_ASCDATA/glade/"
64 johnpye 499 icon_extension = '.svg'
65 johnpye 684 default_tcl = '/usr'
66 jpye 1488 default_tcl_libpath = "$TCL/lib"
67    
68     if os.path.exists("/etc/debian_version"):
69     default_tcl_cpppath = "/usr/include/tcl8.4"
70    
71 johnpye 627 default_rel_distdir = '../share/ascend'
72 johnpye 628 default_absolute_paths = True
73 jpye 1400 default_ida_prefix="/usr"
74 johnpye 783 default_conopt_prefix="/usr"
75 johnpye 800 default_conopt_libpath="$CONOPT_PREFIX/lib"
76     default_conopt_cpppath="$CONOPT_PREFIX/include"
77 jpye 1399 default_conopt_dlpath= default_conopt_libpath + ":/usr/local/lib"
78 johnpye 800 default_conopt_lib="consub3"
79    
80 jpye 1501 default_tron_prefix="/usr"
81     default_tron_dlpath="$TRON_PREFIX/lib"
82     default_tron_lib="tron1"
83    
84 johnpye 938 default_prefix="/usr"
85     default_libpath="$DEFAULT_PREFIX/lib"
86     default_cpppath="$DEFAULT_PREFIX/include"
87    
88 johnpye 673 need_libm = True
89 johnpye 551 if not os.path.isdir(default_tcl):
90     default_tcl = '/usr'
91 johnpye 683 python_exe = distutils.sysconfig.EXEC_PREFIX+"/bin/python"
92 johnpye 816 default_with_scrollkeeper=False
93 jpye 1504 pathsep = ":"
94 johnpye 551
95 johnpye 562 opts.Add(
96     'CC'
97     ,'C Compiler command'
98     ,None
99     )
100    
101     opts.Add(
102     'CXX'
103     ,'C++ Compiler command'
104     ,None
105     )
106    
107 johnpye 591 opts.Add(BoolOption(
108     'GCOV'
109 johnpye 593 , 'Whether to enable coverage testing in object code'
110     , False
111 johnpye 591 ))
112    
113 johnpye 526 opts.Add(BoolOption(
114     'WITH_GCCVISIBILITY'
115     ,"Whether to use GCC Visibility features (only applicable if available)"
116     ,True
117     ))
118    
119 johnpye 1142 opts.Add(BoolOption(
120     'WITH_SIGNALS'
121     ,"Whether to permit use of signals for flow control in the C-level code"
122 johnpye 1234 ,True
123 johnpye 1142 ))
124    
125 johnpye 392 # You can turn off building of Tcl/Tk interface
126 johnpye 386 opts.Add(BoolOption(
127 johnpye 542 'WITH_TCLTK'
128 johnpye 673 ,"Set to False if you don't want to build the original Tcl/Tk GUI."
129 johnpye 542 , True
130 johnpye 386 ))
131    
132 johnpye 392 # You can turn off the building of the Python interface
133 johnpye 387 opts.Add(BoolOption(
134 johnpye 542 'WITH_PYTHON'
135 johnpye 673 ,"Set to False if you don't want to build Python wrappers."
136 johnpye 542 , True
137 johnpye 387 ))
138    
139 johnpye 392 # Which solvers will we allow?
140     opts.Add(ListOption(
141     'WITH_SOLVERS'
142 johnpye 393 ,"List of the solvers you want to build. The default is the minimum that"
143 jpye 1520 +" works. The option 'LSOD' is provided for backwards compatibility"
144     +"; the value 'LSODE' is preferred."
145 jpye 1529 ,["QRSLV","CMSLV","LSODE","IDA","CONOPT","LRSLV","TRON","IPOPT"]
146 johnpye 392 ,['QRSLV','MPS','SLV','OPTSQP'
147     ,'NGSLV','CMSLV','LRSLV','MINOS','CONOPT'
148 jpye 1529 ,'LSODE','LSOD','OPTSQP',"IDA","TRON","IPOPT"
149 johnpye 392 ]
150     ))
151    
152 johnpye 393 # Where will the local copy of the help files be kept?
153 jpye 1442 opts.Add(BoolOption(
154     'WITH_DOC'
155 jpye 1443 , "Should we try to build and install help files? If not, ASCEND will access online help files"
156 jpye 1442 , True
157 johnpye 393 ))
158    
159 jpye 1443 opts.Add(BoolOption(
160     'WITH_DOC_BUILD'
161     , "If true, we'll attempt to build docs. Set false, we'll assume we already have then (eg from the tarball)"
162     , "$WITH_DOC"
163     ))
164    
165     opts.Add(BoolOption(
166     'WITH_DOC_INSTALL'
167     , "If true, SCons will install the documentation file(s). If false, assume rpm or dpkg is going to do it."
168     , "$WITH_DOC"
169     ))
170    
171 jpye 1442 opts.Add(
172     'HELP_ROOT'
173     , "Location of the main help file"
174     , "$INSTALL_DOC/book.pdf"
175     )
176    
177 johnpye 393 # Will bintoken support be enabled?
178     opts.Add(BoolOption(
179     'WITH_BINTOKEN'
180     ,"Enable bintoken support? This means compiling models as C-code before"
181     +" running them, to increase solving speed for large models."
182     ,False
183     ))
184    
185 johnpye 398 # What should the default ASCENDLIBRARY path be?
186     # Note: users can change it by editing their ~/.ascend.ini
187 johnpye 393 opts.Add(
188     'DEFAULT_ASCENDLIBRARY'
189     ,"Set the default value of the ASCENDLIBRARY -- the location where"
190     +" ASCEND will look for models when running ASCEND"
191 jpye 1519 ,"$INSTALL_MODELS"
192 johnpye 393 )
193    
194 jpye 1519 # What should the default ASCENDLIBRARY path be?
195     # Note: users can change it by editing their ~/.ascend.ini
196     opts.Add(
197     'DEFAULT_ASCENDSOLVERS'
198     ,"Set the default value of ASCENDSOLVERS -- the location where"
199     +" ASCEND will look for solver shared-library files"
200     ,"$INSTALL_SOLVERS"
201     )
202    
203 johnpye 398 # Where is SWIG?
204     opts.Add(
205     'SWIG'
206     ,"SWIG location, probably only required for MinGW and MSVC users."
207     +" Enter the location as a Windows-style path, for example"
208 johnpye 404 +" 'c:\\msys\\1.0\\home\\john\\swigwin-1.3.29\\swig.exe'."
209 johnpye 398 )
210    
211 johnpye 400 # Build the test suite?
212     opts.Add(BoolOption(
213 johnpye 593 'WITH_CUNIT'
214 johnpye 665 ,"You can disable CUnit tests with this option. This will basically stop"
215     +" SCons from parsing the SConscript files relating to the 'test'"
216     +" target, which just might make things marginally faster. Probably"
217     +" you can just ignore this option though. SCons will sniff for Cunit"
218     +" but build the tests only if you specify the 'test' target."
219     ,True
220 johnpye 400 ))
221 johnpye 393
222 johnpye 993 # Build with MMIO matrix export support?
223     opts.Add(BoolOption(
224     'WITH_MMIO'
225     ,"Include support for exporting matrices in Matrix Market format"
226     ,True
227     ))
228    
229 johnpye 938 #----- default paths -----
230     opts.Add(PackageOption(
231     'DEFAULT_PREFIX'
232     ,"Where are most of the shared libraries located on your system?"
233     ,default_prefix
234     ))
235    
236 johnpye 957 #------ install location for python extensions ------
237    
238     # (removed for the moment)
239    
240 johnpye 938 #------ cunit --------
241 johnpye 935 # Where was CUNIT installed?
242     opts.Add(PackageOption(
243     'CUNIT_PREFIX'
244     ,"Where are your CUnit files?"
245 johnpye 938 ,"$DEFAULT_PREFIX"
246 johnpye 935 ))
247    
248 johnpye 400 # Where are the CUnit includes?
249     opts.Add(PackageOption(
250     'CUNIT_CPPPATH'
251     ,"Where are your CUnit include files?"
252 johnpye 938 ,"$CUNIT_PREFIX/include"
253 johnpye 400 ))
254 johnpye 392
255 johnpye 404 # Where are the CUnit libraries?
256 johnpye 400 opts.Add(PackageOption(
257     'CUNIT_LIBPATH'
258 johnpye 404 ,"Where are your CUnit libraries?"
259 johnpye 938 ,"$CUNIT_PREFIX/lib"
260 johnpye 400 ))
261    
262 johnpye 938 #-------- ida -------
263    
264 johnpye 673 opts.Add(PackageOption(
265 jpye 1400 "SUNDIALS_PREFIX"
266 johnpye 673 ,"Prefix for your IDA install (IDA ./configure --prefix)"
267     ,default_ida_prefix
268     ))
269 johnpye 521
270 johnpye 534 opts.Add(
271 jpye 1400 'SUNDIALS_CPPPATH'
272 johnpye 673 ,"Where is your ida.h?"
273 jpye 1400 ,"$SUNDIALS_PREFIX/include"
274 johnpye 673 )
275    
276 jpye 1404 #
277 johnpye 673 opts.Add(
278 jpye 1400 'SUNDIALS_LIBPATH'
279 johnpye 673 ,"Where are your SUNDIALS libraries installed?"
280 jpye 1400 ,"$SUNDIALS_PREFIX/lib"
281 johnpye 673 )
282    
283 jpye 1404 opts.Add(
284     'SUNDIALS_LIBS'
285     ,"Where are your SUNDIALS libraries installed?"
286     ,['sundials_nvecserial','sundials_ida','m']
287     )
288    
289 johnpye 938 # ----- conopt-----
290 johnpye 783
291     opts.Add(PackageOption(
292     "CONOPT_PREFIX"
293     ,"Prefix for your CONOPT install (CONOPT ./configure --prefix)"
294 johnpye 800 ,default_conopt_prefix
295 johnpye 783 ))
296    
297 johnpye 673 opts.Add(
298 johnpye 783 "CONOPT_LIB"
299     ,"Library linked to for CONOPT"
300 johnpye 800 ,default_conopt_lib
301 johnpye 783 )
302    
303     opts.Add(
304     'CONOPT_CPPPATH'
305     ,"Where is your conopt.h?"
306 johnpye 800 ,default_conopt_cpppath
307 johnpye 783 )
308    
309     opts.Add(
310     'CONOPT_LIBPATH'
311 jpye 1399 ,"Where is your CONOPT library installed?"
312 johnpye 800 ,default_conopt_libpath
313 johnpye 783 )
314    
315     opts.Add(
316 jpye 1399 'CONOPT_DLPATH'
317     ,"What is the default search path that ASCEND should use when dlopening the CONOPT library at runtime?"
318     ,default_conopt_dlpath
319     )
320    
321     opts.Add(
322 johnpye 800 'CONOPT_ENVVAR'
323     ,"What environment variable should be used at runtime to override the default search location for CONOPT DLL/SO?"
324     ,default_conopt_envvar
325     )
326    
327 jpye 1501 #------- TRON -------
328    
329     opts.Add(
330     'TRON_ENVVAR'
331     ,"What environment variable should be used at runtime to override the default search location for TRON DLL/SO?"
332     ,default_tron_envvar
333     )
334    
335     opts.Add(
336     "TRON_LIB"
337     ,"Library linked to for TRON"
338     ,"tron"
339     )
340    
341 jpye 1515 opts.Add(
342 jpye 1501 "TRON_PREFIX"
343     ,"Prefix for your TRON install"
344     ,default_tron_prefix
345 jpye 1515 )
346 jpye 1501
347     opts.Add(
348     'TRON_DLPATH'
349     ,"What is the default search path that ASCEND should use when dlopening the TRON library at runtime?"
350     ,default_tron_dlpath
351     )
352    
353 johnpye 938 #-------- f2c ------
354    
355 johnpye 800 opts.Add(
356 johnpye 673 "F2C_LIB"
357     ,"F2C library (eg. g2c, gfortran, f2c)"
358 jpye 1387 ,"gfortran" # the default is gfortran now
359 johnpye 673 )
360    
361     opts.Add(PackageOption(
362     "F2C_LIBPATH"
363     ,"Directory containing F2C library (i.e. g2c, gfortran, f2c, etc.), if not already accessible"
364     ,"off"
365     ))
366    
367 jpye 1398 opts.Add(
368     "FORTRAN"
369     ,"Fortran compiler (eg g77, gfortran)"
370     ,"gfortran"
371     )
372    
373 johnpye 938 #------- tcl/tk --------
374    
375 johnpye 673 opts.Add(
376 johnpye 521 'TCL'
377     ,'Base of Tcl distribution'
378     ,default_tcl
379 johnpye 534 )
380 johnpye 521
381 johnpye 404 # Where are the Tcl includes?
382 johnpye 534 opts.Add(
383 johnpye 404 'TCL_CPPPATH'
384     ,"Where are your Tcl include files?"
385 jpye 1488 ,default_tcl_cpppath
386 johnpye 534 )
387 johnpye 404
388     # Where are the Tcl libs?
389 johnpye 534 opts.Add(
390 johnpye 404 'TCL_LIBPATH'
391     ,"Where are your Tcl libraries?"
392 johnpye 541 ,default_tcl_libpath
393 johnpye 534 )
394 johnpye 404
395 johnpye 428 # What is the name of the Tcl lib?
396     opts.Add(
397     'TCL_LIB'
398 johnpye 561 ,"Name of Tcl lib (eg 'tcl' or 'tcl83'), for full path to static library (if STATIC_TCLTK is set)"
399 johnpye 464 ,default_tcl_lib
400 johnpye 428 )
401    
402 johnpye 405 # Where are the Tk includes?
403 johnpye 534 opts.Add(
404 johnpye 405 'TK_CPPPATH'
405     ,"Where are your Tk include files?"
406 johnpye 464 ,'$TCL_CPPPATH'
407 johnpye 534 )
408 johnpye 404
409 johnpye 405 # Where are the Tk libs?
410 johnpye 534 opts.Add(
411 johnpye 405 'TK_LIBPATH'
412     ,"Where are your Tk libraries?"
413 johnpye 464 ,'$TCL_LIBPATH'
414 johnpye 534 )
415 johnpye 405
416 johnpye 428 # What is the name of the Tk lib?
417     opts.Add(
418     'TK_LIB'
419 johnpye 521 ,"Name of Tk lib (eg 'tk' or 'tk83'), or full path to static library"
420 johnpye 464 ,default_tk_lib
421 johnpye 435 )
422    
423 johnpye 460 # Static linking to TkTable
424    
425     opts.Add(BoolOption(
426 johnpye 521 'STATIC_TCLTK'
427 johnpye 554 ,'Set true for static linking for Tcl/Tk and TkTable. EXPERIMENTAL'
428 johnpye 460 ,False
429     ))
430    
431 johnpye 464 opts.Add(
432 johnpye 460 'TKTABLE_LIBPATH'
433     ,'Location of TkTable static library'
434 johnpye 464 ,'$TCL_LIBPATH/Tktable2.8'
435     )
436 johnpye 460
437 johnpye 435 opts.Add(
438 johnpye 460 'TKTABLE_LIB'
439 johnpye 521 ,'Stem name of TkTable (eg tktable2.8, no ".so" or "lib") shared library, or full path of static tktable (/usr/lib/...)'
440 johnpye 464 ,default_tktable_lib
441 johnpye 460 )
442    
443     opts.Add(
444 johnpye 521 'TKTABLE_CPPPATH'
445     ,'Location of TkTable header file'
446     ,'$TCL_CPPPATH'
447     )
448    
449     opts.Add(
450     'X11'
451 johnpye 554 ,'Base X11 directory. Only used when STATIC_TCLTK is turned on. EXPERIMENTAL'
452 johnpye 521 ,'/usr/X11R6'
453     )
454    
455     opts.Add(
456     'X11_LIBPATH'
457 johnpye 554 ,'Location of X11 lib. EXPERIMENTAL'
458 johnpye 521 ,'$X11/lib'
459     )
460    
461     opts.Add(
462     'X11_CPPPATH'
463 johnpye 554 ,'Location of X11 includes. EXPERIMENTAL'
464 johnpye 521 ,'$X11/include'
465     )
466    
467     opts.Add(
468     'X11_LIB'
469 johnpye 554 ,'Name of X11 lib. EXPERIMENTAL'
470 johnpye 521 ,'X11'
471     )
472    
473 johnpye 938 #----- installed file locations (for 'scons install') -----
474    
475 johnpye 521 opts.Add(
476 johnpye 435 'INSTALL_PREFIX'
477     ,'Root location for installed files'
478 johnpye 449 ,'/usr/local'
479 johnpye 428 )
480    
481 johnpye 435 opts.Add(
482     'INSTALL_BIN'
483     ,'Location to put binaries during installation'
484     ,"$INSTALL_PREFIX/bin"
485     )
486    
487     opts.Add(
488 johnpye 463 'INSTALL_LIB'
489 johnpye 683 ,'Location to put libraries during installation'
490 johnpye 463 ,"$INSTALL_PREFIX/lib"
491     )
492    
493     opts.Add(
494 ben.allan 624 'INSTALL_SHARE'
495 johnpye 628 ,'Common shared-file location on this system'
496     ,"$INSTALL_PREFIX/share"
497 johnpye 435 )
498    
499 johnpye 816 opts.Add(
500 johnpye 628 'INSTALL_ASCDATA'
501     ,"Location of ASCEND shared data (TK, python, models etc)"
502     ,"$INSTALL_SHARE/ascend"
503     )
504    
505     opts.Add(
506 jpye 1504 'INSTALL_MODELS'
507     ,"Location of ASCEND model files (.a4c,.a4l,.a4s)"
508     ,"$INSTALL_ASCDATA/models"
509     )
510    
511     opts.Add(
512     'INSTALL_SOLVERS'
513     ,"Location of ASCEND solvers"
514     ,"$INSTALL_ASCDATA/solvers"
515     )
516    
517     opts.Add(
518 jpye 1442 'INSTALL_DOC'
519     ,"Location of ASCEND documentation files"
520     ,"$INSTALL_SHARE/doc/ascend-"+version
521     )
522    
523     opts.Add(
524 johnpye 435 'INSTALL_INCLUDE'
525     ,'Location to put header files during installation'
526     ,"$INSTALL_PREFIX/include"
527     )
528    
529 johnpye 938
530 johnpye 448 opts.Add(
531 johnpye 938 'INSTALL_ROOT'
532     ,'For use by RPM only: location of %{buildroot} during rpmbuild'
533     ,""
534     )
535    
536     #----------------------
537    
538     opts.Add(
539 johnpye 455 'PYGTK_ASSETS'
540 johnpye 532 ,'Default location for Glade assets (placed in pygtk/config.py)'
541 johnpye 455 ,default_install_assets
542     )
543    
544 johnpye 508 opts.Add(BoolOption(
545     'DEBUG'
546     ,"Compile source with debugger symbols, eg for use with 'gdb'"
547     ,False
548     ))
549    
550 johnpye 597 opts.Add(BoolOption(
551     'MALLOC_DEBUG'
552     ,"Compile with debugging version of MALLOC. Required for full CUnit testing"
553     ,False
554     ))
555    
556 johnpye 938 #------ dmalloc --------
557     opts.Add(PackageOption(
558     'DMALLOC_PREFIX'
559     ,"Where are your dmalloc files?"
560     ,default_prefix
561     ))
562 johnpye 448
563 johnpye 938 opts.Add(PackageOption(
564     'DMALLOC_CPPPATH'
565     ,"Where are your dmalloc include files?"
566     ,default_cpppath
567     ))
568    
569     opts.Add(PackageOption(
570     'DMALLOC_LIBPATH'
571     ,"Where are your dmalloc libraries?"
572     ,default_libpath
573     ))
574    
575     opts.Add(BoolOption(
576     'WITH_DMALLOC'
577     ,"Link to the DMALLOC library (if available) for debugging of memory usage."
578     ,False
579     ))
580    
581 jpye 1326 #------ f --------
582 johnpye 1109 opts.Add(PackageOption(
583     'MFGRAPH_PREFIX'
584     ,"Where are your MFGRAPH files?"
585     ,default_prefix
586     ))
587    
588     opts.Add(PackageOption(
589     'MFGRAPH_CPPPATH'
590     ,"Where are your MFGRAPH include files?"
591     ,default_cpppath
592     ))
593    
594     opts.Add(PackageOption(
595     'MFGRAPH_LIBPATH'
596     ,"Where are your MFGRAPH libraries?"
597     ,default_libpath
598     ))
599    
600     opts.Add(BoolOption(
601     'WITH_MFGRAPH'
602 jpye 1326 ,"Link to the MFGRAPH library (if available, for generating incidence graphs)"
603 johnpye 1109 ,True
604     ))
605    
606 jpye 1326
607     #------ ufsparse --------
608     opts.Add(PackageOption(
609     'UFSPARSE_PREFIX'
610     ,"Where are your UFSPARSE files?"
611     ,default_prefix
612     ))
613    
614     opts.Add(PackageOption(
615     'UFSPARSE_CPPPATH'
616     ,"Where are your UFSPARSE include files?"
617     ,default_cpppath
618     ))
619    
620     opts.Add(PackageOption(
621     'UFSPARSE_LIBPATH'
622     ,"Where are your UFSPARSE libraries?"
623     ,default_libpath
624     ))
625    
626     opts.Add(BoolOption(
627     'WITH_UFSPARSE'
628     ,"Link to the UFSPARSE library (if available, for additional sparse matrix routines)"
629     ,True
630     ))
631    
632 johnpye 938 #-----------------------
633    
634 johnpye 563 opts.Add(
635     'DISTTAR_NAME'
636     ,"Stem name of the tarball created by 'scons dist'. So for 'ascend-aaa.tar.bz2', set this to 'ascend-aaa'."
637     ,"ascend-"+version
638     )
639    
640 johnpye 656 opts.Add(
641     'RELEASE'
642     ,"Release number for use in RPM spec file. This should always start with a zero for releases made by the ASCEND group, in order that third parties can make 'patch' releases of higher version numbers."
643     ,"0"
644     )
645    
646 johnpye 605 opts.Add(BoolOption(
647 johnpye 628 'ABSOLUTE_PATHS'
648 johnpye 605 ,"Whether to use absolute or relative paths in the installed Tcl/Tk interface. If you want to build an RPM, set this to false."
649 johnpye 628 ,default_absolute_paths
650 johnpye 605 ))
651    
652 johnpye 578 opts.Add(
653     'WIN_INSTALLER_NAME'
654     ,"Name of the installer .exe to create under Windows (minus the '.exe')"
655 jpye 1467 ,"ascend-"+version+"-py"+pyversion+".exe"
656 johnpye 578 )
657    
658 johnpye 594 opts.Add(BoolOption(
659     'WITH_XTERM_COLORS'
660     ,"Set to 0 if you don't want xterm colour codes in the console output"
661     ,True
662     ))
663    
664 johnpye 761 opts.Add(BoolOption(
665     'WITH_EXTFNS'
666 jpye 1504 ,"Set to 0 if you don't want to attempt to build the external modules bundled with ASCEND"
667 johnpye 761 ,True
668     ))
669    
670 johnpye 816 opts.Add(BoolOption(
671     'WITH_SCROLLKEEPER'
672     ,"Set to to 1 if you want to install an OMF file that can be read by scrollkeeper (eg Yelp on GNOME)"
673     ,default_with_scrollkeeper
674     ))
675    
676 johnpye 546 if platform.system()!="Windows":
677     opts.Add(BoolOption(
678     'WITH_GCCVISIBILITY'
679     , 'Whether to use GCC Visibility extensions when building with GCC 4.0'
680     , True
681     ))
682    
683 johnpye 832
684    
685 johnpye 392 # TODO: OTHER OPTIONS?
686     # TODO: flags for optimisation
687 johnpye 393 # TODO: turning on/off bintoken functionality
688 johnpye 427 # TODO: Where will the 'Makefile.bt' file be installed?
689 johnpye 393
690 johnpye 498 # Import the outside environment
691    
692 johnpye 800 def c_escape(str):
693     return re.sub("\\\\","/",str)
694    
695     envadditional={}
696 johnpye 740
697 jpye 1459 tools = ['lex','yacc','fortran','swig','nsis','substinfile','disttar']
698 johnpye 832 if platform.system()=="Windows":
699 johnpye 1078 if os.environ.get('OSTYPE')=='msys' or os.environ.get('MSYSTEM'):
700 johnpye 832 envenv = os.environ;
701 jpye 1459 tools += ['mingw']
702 johnpye 922 #TODO removed 'doxygen' for SCons 0.96.93
703 johnpye 832 envadditional['IS_MINGW']=True
704     else:
705 johnpye 1082 print "Assuming VC++ build environment (Note: MinGW is preferred)"
706 johnpye 832 envenv = {
707     'PATH':os.environ['PATH']
708     ,'INCLUDE':os.environ['INCLUDE']
709     ,'LIB':os.environ['LIB']
710     ,'MSVS_IGNORE_IDE_PATHS':1
711     }
712 jpye 1459 tools += ['default']
713 johnpye 922 #TODO removed 'doxygen' for SCons 0.96.93
714 johnpye 832 envadditional['CPPDEFINES']=['_CRT_SECURE_NO_DEPRECATE']
715 johnpye 498 else:
716 johnpye 832 if os.environ.get('TARGET')=='mingw':
717     envenv = os.environ
718 jpye 1459 tools += ['crossmingw']
719 jpye 1420 envadditional['CPPPATH']=['/usr/lib/gcc/i586-mingw32msvc/3.4.5/include','/usr/include']
720     envadditional['LIBS']=['gcc']
721 johnpye 832 else:
722     envenv = os.environ
723 jpye 1459 tools += ['default']
724 johnpye 922 #TODO removed 'doxygen' for SCons 0.96.93
725 johnpye 800
726 johnpye 832
727 johnpye 800 env = Environment(
728     ENV=envenv
729     , toolpath=['scons']
730     , tools=tools
731     , **envadditional
732     )
733 johnpye 498
734 jpye 1420 #print "PATH =",os.environ['PATH']
735     #print "PROGSUFFIX =",env['PROGSUFFIX']
736     #print "CPPPATH =",env['CPPPATH']
737 jpye 1380
738 johnpye 385 opts.Update(env)
739 jpye 1520
740     if 'LSOD' in env['WITH_SOLVERS']:
741     if 'LSODE' not in env['WITH_SOLVERS']:
742     env['WITH_SOLVERS'].append('LSODE')
743     env['WITH_SOLVERS'].remove('LSOD')
744    
745 johnpye 385 opts.Save('options.cache',env)
746    
747     Help(opts.GenerateHelpText(env))
748    
749 johnpye 551 with_tcltk = env.get('WITH_TCLTK')
750 johnpye 427 without_tcltk_reason = "disabled by options/config.py"
751 johnpye 386
752 johnpye 551 with_python = env.get('WITH_PYTHON')
753 johnpye 427 without_python_reason = "disabled by options/config.py"
754 johnpye 387
755 johnpye 593 with_cunit = env.get('WITH_CUNIT')
756 johnpye 427 without_cunit_reason = "not requested"
757 johnpye 400
758 johnpye 761 with_extfns = env.get('WITH_EXTFNS')
759     without_extfn_reason = "disabled by options/config.py"
760    
761 johnpye 816 with_scrollkeeper = env.get('WITH_SCROLLKEEPER')
762     without_scrollkeeper_reason = "disabled by options/config.py"
763    
764 johnpye 938 with_dmalloc = env.get('WITH_DMALLOC')
765     without_dmalloc_reason = "disabled by options/config.py"
766    
767 johnpye 1109 with_mfgraph = env.get('WITH_MFGRAPH')
768     without_mfgraph_reason = "disabled by options/config.py"
769    
770 jpye 1326 with_ufsparse = env.get('WITH_UFSPARSE')
771     without_ufsparse_reason = "disabled by options/config.py"
772    
773 johnpye 993 with_mmio = env.get('WITH_MMIO')
774     without_mmio_reason = "disabled by options/config.py"
775    
776 johnpye 1142 with_signals = env.get('WITH_SIGNALS')
777     without_signals_reason = "disabled by options/config.py"
778    
779 jpye 1442 with_doc = env.get('WITH_DOC')
780    
781 jpye 1443 with_doc_build = env.get('WITH_DOC_BUILD');
782 jpye 1470 without_doc_build_reason = "disabled by options/config.py"
783 jpye 1443 if not with_doc:
784 jpye 1470 with_doc_build = False
785     without_doc_build_reason = "disabled by with_doc"
786 jpye 1443
787 jpye 1442 with_latex2html = False
788    
789 johnpye 631 if platform.system()=="Windows":
790     with_installer=1
791     else:
792     with_installer=0
793     without_installer_reason = "only possible under Windows"
794 jpye 1529
795 jpye 1509 if 'LSODE' in env['WITH_SOLVERS']:
796 johnpye 673 with_lsode=True
797     else:
798     with_lsode=False
799     without_lsode_reason = "not requested (WITH_SOLVERS)"
800    
801     if 'IDA' in env['WITH_SOLVERS']:
802     with_ida=True
803     else:
804     with_ida=False
805     without_ida_reason = "not requested (WITH_SOLVERS)"
806    
807    
808 johnpye 783 if 'CONOPT' in env['WITH_SOLVERS']:
809     with_conopt=True
810     else:
811     with_conopt=False
812     without_conopt_reason = "not requested (WITH_SOLVERS)"
813    
814 jpye 1529 if 'IPOPT' in env['WITH_SOLVERS']:
815     with_ipopt=True
816     else:
817     with_ipopt=False
818     without_ipopt_reason = "not requested (WITH_SOLVERS)"
819 johnpye 783
820 jpye 1529
821 johnpye 464 #print "SOLVERS:",env['WITH_SOLVERS']
822     #print "WITH_BINTOKEN:",env['WITH_BINTOKEN']
823     #print "DEFAULT_ASCENDLIBRARY:",env['DEFAULT_ASCENDLIBRARY']
824 johnpye 393
825 johnpye 463 can_install = True
826     if platform.system()=='Windows':
827     can_install = False
828    
829     env['CAN_INSTALL']=can_install
830 johnpye 721
831 jpye 1437 print "TCL=",env['TCL']
832 johnpye 521 print "TCL_CPPPATH =",env['TCL_CPPPATH']
833     print "TCL_LIBPATH =",env['TCL_LIBPATH']
834     print "TCL_LIB =",env['TCL_LIB']
835 johnpye 562 print "CC =",env['CC']
836     print "CXX =",env['CXX']
837 johnpye 673 print "FORTRAN=",env.get('FORTRAN')
838 johnpye 393
839 johnpye 628 print "ABSOLUTE PATHS =",env['ABSOLUTE_PATHS']
840 jpye 1504 print "INSTALL_ASCDATA =",env['INSTALL_ASCDATA']
841 jpye 1413 print "INSTALL_PREFIX =",env['INSTALL_PREFIX']
842 jpye 1504 print "INSTALL_MODELS =",env['INSTALL_MODELS']
843     print "INSTALL_SOLVERS =",env['INSTALL_SOLVERS']
844     print "DEFAULT_ASCENDLIBRARY =",env['DEFAULT_ASCENDLIBRARY']
845 jpye 1519 print "DEFAULT_ASCENDSOLVERS =",env['DEFAULT_ASCENDSOLVERS']
846 jpye 1504
847    
848 johnpye 385 #------------------------------------------------------
849 johnpye 398 # SPECIAL CONFIGURATION TESTS
850    
851 johnpye 463 need_fortran = False
852    
853 johnpye 400 #----------------
854 jpye 1448 # CC
855    
856     cc_test_text = """
857     int main(void){
858     return 0;
859     }
860     """;
861    
862     def CheckCC(context):
863     context.Message("Checking C compiler ('%s')... " % context.env.get('CC'))
864     is_ok = context.TryCompile(cc_test_text,".c")
865     context.Result(is_ok)
866     return is_ok
867    
868     #----------------
869     # CXX
870    
871     cxx_test_text = """
872     template<class X>
873     class pair{
874     public:
875     X a;
876     X b;
877     };
878    
879     int main(void){
880     pair<double> P;
881     P.a = 0;
882     return 0;
883     }
884     """;
885    
886     def CheckCXX(context):
887     context.Message("Checking C++ compiler ('%s')... " % context.env.get('CXX'))
888     is_ok = context.TryCompile(cc_test_text,".cpp")
889     context.Result(is_ok)
890     return is_ok
891    
892    
893    
894     #----------------
895 johnpye 400 # SWIG
896    
897 johnpye 398 import os,re
898    
899 johnpye 413 def get_swig_version(env):
900 johnpye 403 cmd = env['SWIG']+' -version'
901 johnpye 427 (cin,coutcerr) = os.popen4(cmd)
902 johnpye 403 output = coutcerr.read()
903 johnpye 398
904 johnpye 403 restr = "SWIG\\s+Version\\s+(?P<maj>[0-9]+)\\.(?P<min>[0-9]+)\\.(?P<pat>[0-9]+)\\s*$"
905     expr = re.compile(restr,re.M);
906 johnpye 398 m = expr.search(output);
907     if not m:
908 johnpye 413 return None
909 johnpye 398 maj = int(m.group('maj'))
910     min = int(m.group('min'))
911     pat = int(m.group('pat'))
912 johnpye 413
913     return (maj,min,pat)
914 johnpye 398
915 johnpye 413
916     def CheckSwigVersion(context):
917    
918     try:
919     context.Message("Checking version of SWIG... ")
920     maj,min,pat = get_swig_version(context.env)
921     except:
922     context.Result("Failed to detect version, or failed to run SWIG")
923     return 0;
924    
925 johnpye 478 context.env['SWIGVERSION']=tuple([maj,min,pat])
926    
927 johnpye 398 if maj == 1 and (
928 johnpye 400 min > 3
929     or (min == 3 and pat >= 24)
930 johnpye 398 ):
931     context.Result("ok, %d.%d.%d" % (maj,min,pat))
932     return 1;
933 johnpye 401 else:
934     context.Result("too old, %d.%d.%d" % (maj,min,pat))
935     return 0;
936 johnpye 398
937 johnpye 400 #----------------
938 johnpye 816 # Scrollkeeper (Linux documentation system)
939    
940     def get_scrollkeeper_omfdir(env):
941     cmd = 'scrollkeeper-config --omfdir'
942     (cin,coutcerr) = os.popen4(cmd)
943     output = coutcerr.read()
944     return output.strip()
945    
946     def CheckScrollkeeperConfig(context):
947     try:
948     context.Message("Checking for scrollkeeper...")
949     dir=get_scrollkeeper_omfdir(context.env)
950     except:
951     context.Result("Failed to run 'scrollkeeper-config'")
952     return 0
953     context.env['OMFDIR']=dir
954     context.Result("OK, %s" % dir)
955     return 1
956    
957     #----------------
958 johnpye 400 # General purpose library-and-header test
959    
960 johnpye 404 class KeepContext:
961 johnpye 521 def __init__(self,context,varprefix,static=False):
962 johnpye 404 self.keep = {}
963 johnpye 521 for k in ['LIBS','LIBPATH','CPPPATH','LINKFLAGS']:
964 johnpye 705 #print "Keeping env %s = %s" % (k,context.env.get(k))
965     self.keep[k]=context.env.get(k)
966 johnpye 404
967     if context.env.has_key(varprefix+'_CPPPATH'):
968 johnpye 743 context.env.AppendUnique(CPPPATH=[env[varprefix+'_CPPPATH']])
969 johnpye 800 #print "Adding '"+str(env[varprefix+'_CPPPATH'])+"' to cpp path"
970 johnpye 428
971 johnpye 521 if static:
972     staticlib=env[varprefix+'_LIB']
973     #print "STATIC LIB = ",staticlib
974     context.env.Append(
975     LINKFLAGS=[staticlib]
976     )
977     else:
978     if context.env.has_key(varprefix+'_LIBPATH'):
979     context.env.Append(LIBPATH=[env[varprefix+'_LIBPATH']])
980 johnpye 800 #print "Adding '"+str(env[varprefix+'_LIBPATH'])+"' to lib path"
981 johnpye 428
982 johnpye 521 if context.env.has_key(varprefix+'_LIB'):
983     context.env.Append(LIBS=[env[varprefix+'_LIB']])
984 johnpye 705 #print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs"
985 johnpye 404
986     def restore(self,context):
987 johnpye 464 #print "RESTORING CONTEXT"
988     #print self.keep
989     #print "..."
990 johnpye 404 for k in self.keep:
991 johnpye 463 if self.keep[k]==None:
992 johnpye 521 if context.env.has_key(k):
993     #print "Clearing "+str(k)
994     del context.env[k];
995 johnpye 463 else:
996 johnpye 705 #print "Restoring %s to '%s'" %(k,self.keep.get(k))
997 johnpye 463 context.env[k]=self.keep[k];
998 johnpye 404
999 johnpye 521 def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):
1000 johnpye 400 """This method will check for variables LIBNAME_LIBPATH
1001     and LIBNAME_CPPPATH and try to compile and link the
1002     file with the provided text, linking with the
1003     library libname."""
1004    
1005 johnpye 521 if static:
1006     context.Message( 'Checking for static '+libname+'... ' )
1007     else:
1008     context.Message( 'Checking for '+libname+'... ' )
1009    
1010 johnpye 400 if varprefix==None:
1011     varprefix = libname.upper()
1012    
1013 johnpye 705 #print "LIBS is currently:",context.env.get('LIBS')
1014 johnpye 521 keep = KeepContext(context,varprefix,static)
1015 johnpye 400
1016 johnpye 428 if not context.env.has_key(varprefix+'_LIB'):
1017 johnpye 463 # if varprefix_LIB were in env, KeepContext would
1018     # have appended it already
1019 johnpye 705 context.env.Append(LIBS=[libname])
1020 johnpye 428
1021 johnpye 404 is_ok = context.TryLink(text,ext)
1022 johnpye 428
1023 johnpye 521 #print "Link success? ",(is_ok != 0)
1024 johnpye 400
1025 johnpye 405 keep.restore(context)
1026 johnpye 400
1027 johnpye 428 # print "Restored CPPPATH="+str(context.env['CPPPATH'])
1028 johnpye 705 # print "Restored LIBS="+str(context.env['LIBS'])
1029 johnpye 428 # print "Restored LIBPATH="+str(context.env['LIBPATH'])
1030    
1031 johnpye 404 context.Result(is_ok)
1032     return is_ok
1033    
1034     #----------------
1035 johnpye 502 # GCC
1036    
1037     gcc_test_text = """
1038     #ifndef __GNUC__
1039     # error "Not using GCC"
1040     #endif
1041    
1042     int main(void){
1043     return __GNUC__;
1044     }
1045     """
1046    
1047     def CheckGcc(context):
1048     context.Message("Checking for GCC... ")
1049     is_ok = context.TryCompile(gcc_test_text,".c")
1050     context.Result(is_ok)
1051     return is_ok
1052    
1053     #----------------
1054 johnpye 500 # GCC VISIBILITY feature
1055    
1056     gccvisibility_test_text = """
1057     #if __GNUC__ < 4
1058     # error "Require GCC version 4 or newer"
1059     #endif
1060    
1061     __attribute__ ((visibility("default"))) int x;
1062    
1063     int main(void){
1064     extern int x;
1065     x = 4;
1066     }
1067     """
1068    
1069     def CheckGccVisibility(context):
1070     context.Message("Checking for GCC 'visibility' capability... ")
1071 johnpye 546 if not context.env.has_key('WITH_GCCVISIBILITY') or not env['WITH_GCCVISIBILITY']:
1072     context.Result("disabled")
1073     return 0
1074 johnpye 500 is_ok = context.TryCompile(gccvisibility_test_text,".c")
1075     context.Result(is_ok)
1076     return is_ok
1077 johnpye 502
1078 johnpye 500 #----------------
1079 johnpye 502 # YACC
1080    
1081     yacc_test_text = """
1082 johnpye 646 %{
1083     #include <stdio.h>
1084 johnpye 741
1085     /* MSVC++ needs this before it can swallow Bison output */
1086     #ifdef _MSC_VER
1087     # define __STDC__
1088     #endif
1089 johnpye 646 %}
1090     %token MSG
1091 johnpye 502 %start ROOT
1092 johnpye 646 %%
1093     ROOT:
1094     MSG { printf("HELLO"); }
1095     ;
1096     %%
1097 johnpye 502 """
1098    
1099     def CheckYacc(context):
1100 johnpye 644 context.Message("Checking for Yacc ('%s')... " % context.env.get('YACC'))
1101 johnpye 502 is_ok = context.TryCompile(yacc_test_text,".y")
1102     context.Result(is_ok)
1103     return is_ok
1104    
1105     #----------------
1106 johnpye 1025 # LEX
1107    
1108     lex_test_text = """
1109     %{
1110     #include <stdio.h>
1111     %}
1112     DIGIT [0-9]
1113     ID [a-z][a-z0-9]*
1114     %%
1115     {DIGIT}+ {
1116     printf("A digit: %s\\n",yytext);
1117     }
1118    
1119     [ \\t\\n]+ /* ignore */
1120    
1121     . {
1122     printf("Unrecognized guff");
1123     }
1124     %%
1125     main(){
1126     yylex();
1127     }
1128     """
1129    
1130     def CheckLex(context):
1131     context.Message("Checking for Lex ('%s')... " % context.env.get('LEX'))
1132     is_ok = context.TryCompile(lex_test_text,".l")
1133     context.Result(is_ok)
1134     return is_ok
1135    
1136     #----------------
1137 johnpye 404 # CUnit test
1138    
1139 johnpye 400 cunit_test_text = """
1140 johnpye 451 #include <CUnit/CUnit.h>
1141 johnpye 400 int maxi(int i1, int i2){
1142     return (i1 > i2) ? i1 : i2;
1143     }
1144    
1145     void test_maxi(void){
1146     CU_ASSERT(maxi(0,2) == 2);
1147     CU_ASSERT(maxi(0,-2) == 0);
1148     CU_ASSERT(maxi(2,2) == 2);
1149    
1150     }
1151     int main(void){
1152     /* CU_initialize_registry() */
1153 johnpye 404 return 0;
1154 johnpye 400 }
1155     """
1156    
1157     def CheckCUnit(context):
1158 johnpye 451 return CheckExtLib(context,'cunit',cunit_test_text)
1159 johnpye 400
1160 johnpye 404 #----------------
1161 johnpye 938 # dmalloc test
1162    
1163     dmalloc_test_text = """
1164     #include <stdlib.h>
1165     #include <dmalloc.h>
1166    
1167     int main(void){
1168     char *c;
1169     c = malloc(100*sizeof(char));
1170     free(c);
1171     return 0;
1172     }
1173     """
1174    
1175     def CheckDMalloc(context):
1176     return CheckExtLib(context,'dmalloc',dmalloc_test_text)
1177    
1178     #----------------
1179 johnpye 1109 # mfgraph test
1180    
1181     mfgraph_test_text = """
1182     #include <mfgraph/mfg_draw_graph.h>
1183     int main(void){
1184     using namespace mfg;
1185     DrawGraph g;
1186     return 0;
1187     }
1188     """
1189    
1190     def CheckMFGraph(context):
1191     return CheckExtLib(context,'mfgraph',mfgraph_test_text,ext=".cpp")
1192    
1193     #----------------
1194 jpye 1326 # ufsparse test
1195    
1196     ufsparse_test_text = """
1197     #include <ufsparse/cs.h>
1198     int main(void){
1199     cs *A,*B,*C;
1200     C = cs_multiply(A,B);
1201     return 0;
1202     }
1203     """
1204    
1205     def CheckUFSparse(context):
1206     return CheckExtLib(context
1207     ,libname='cxsparse'
1208     ,varprefix='ufsparse'
1209     ,text=ufsparse_test_text
1210     ,ext=".c"
1211     )
1212    
1213     #----------------
1214 johnpye 673 # MATH test
1215    
1216     math_test_text = """
1217 johnpye 705 #ifndef _ALL_SOURCE
1218     # define _ALL_SOURCE
1219     #endif
1220     #ifndef _XOPEN_SOURCE
1221     # define _XOPEN_SOURCE
1222     #endif
1223     #ifndef _XOPEN_SOURCE_EXTENDED
1224     # define _XOPEN_SOURCE_EXTENDED 1
1225     #endif
1226 johnpye 673 #include <math.h>
1227     int main(void){
1228 johnpye 705 double x = 1.0; double y = 1.0; int i = 1;
1229     acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x);
1230     j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x);
1231     y0(x); y1(x); yn(i,x);
1232 jpye 1420 /* this part causes problems with crossmingw... */
1233 johnpye 705 #ifdef _THREAD_SAFE
1234     gamma_r(x,&i);
1235     lgamma_r(x,&i);
1236     #else
1237     gamma(x);
1238     lgamma(x);
1239     #endif
1240     hypot(x,y); nextafter(x,y); remainder(x,y); scalb(x,y);
1241 johnpye 673 return 0;
1242     }
1243     """
1244    
1245     def CheckMath(context):
1246 johnpye 832 context.Message('Checking for IEEE math library... ')
1247 johnpye 705 libsave=context.env.get('LIBS');
1248     context.env.AppendUnique(LIBS=['m'])
1249     is_ok=context.TryLink(math_test_text,".c")
1250     context.Result(is_ok)
1251     if not is_ok:
1252     context.env['LIBS']=libsave
1253     return is_ok
1254    
1255 johnpye 673 #----------------
1256 johnpye 957 # libpython test
1257    
1258     libpython_test_text = """
1259     #include <Python.h>
1260     int main(void){
1261     PyObject *p;
1262     p = Py_None;
1263     return 0;
1264     }
1265     """
1266    
1267     def CheckPythonLib(context):
1268     context.Message('Checking for libpython... ')
1269    
1270     if platform.system()=="Windows":
1271     python_lib='python%d%d'
1272     else:
1273     python_lib='python%d.%d'
1274 johnpye 958 python_libs = [python_lib % (sys.version_info[0],sys.version_info[1])]
1275 johnpye 957
1276     python_cpppath = [distutils.sysconfig.get_python_inc()]
1277     cfig = distutils.sysconfig.get_config_vars()
1278    
1279     lastLIBS = context.env.get('LIBS')
1280     lastLIBPATH = context.env.get('LIBPATH')
1281     lastCPPPATH = context.env.get('CPPPATH')
1282 johnpye 959 lastLINKFLAGS = context.env.get('LINKFLAGS')
1283 johnpye 957
1284     python_libpath = []
1285 johnpye 959 python_linkflags = []
1286 johnpye 965 if platform.system()=="Windows":
1287 johnpye 980 python_libpath+=[cfig['prefix']]
1288 johnpye 965 else:
1289     # checked on Linux and SunOS
1290     if cfig['LDLIBRARY']==cfig['LIBRARY']:
1291     sys.stdout.write("(static)")
1292     python_libpath += [cfig['LIBPL']]
1293     python_linkflags += cfig['LIBS'].split(' ')
1294 johnpye 957
1295 johnpye 958 context.env.AppendUnique(LIBS=python_libs)
1296 johnpye 957 context.env.AppendUnique(LIBPATH=python_libpath)
1297     context.env.AppendUnique(CPPPATH=python_cpppath)
1298 johnpye 959 context.env.AppendUnique(LINKFLAGS=python_linkflags)
1299 johnpye 957 result = context.TryLink(libpython_test_text,".c");
1300    
1301 johnpye 958 context.Result(result)
1302 johnpye 957
1303     if(result):
1304 johnpye 958 context.env['PYTHON_LIBPATH']=python_libpath
1305     context.env['PYTHON_LIB']=python_libs
1306     context.env['PYTHON_CPPPATH']=python_cpppath
1307 johnpye 959 context.env['PYTHON_LINKFLAGS']=python_linkflags
1308 johnpye 957
1309     context.env['LIBS'] = lastLIBS
1310     context.env['LIBPATH'] = lastLIBPATH
1311     context.env['CPPPATH'] = lastCPPPATH
1312 johnpye 959 context.env['LINKFLAGS'] = lastLINKFLAGS
1313 johnpye 957
1314     return result
1315    
1316     #----------------
1317 johnpye 673 # IDA test
1318    
1319 johnpye 913 sundials_version_major_required = 2
1320     sundials_version_minor_min = 2
1321     sundials_version_minor_max = 3
1322    
1323     sundials_version_text = """
1324     #include <sundials/sundials_config.h>
1325     #include <stdio.h>
1326     int main(){
1327     printf("%s",SUNDIALS_PACKAGE_VERSION);
1328     return 0;
1329     }
1330     """
1331    
1332 johnpye 673 ida_test_text = """
1333 jpye 1400 #if SUNDIALS_VERSION_MAJOR==2 && SUNDIALS_VERSION_MINOR==2
1334     # include <sundials/sundials_config.h>
1335     # include <sundials/sundials_nvector.h>
1336 jpye 1405 # include <nvector_serial.h>
1337 jpye 1400 # include <ida.h>
1338     # include <ida/ida_spgmr.h>
1339     #else
1340     # include <sundials/sundials_config.h>
1341     # include <nvector/nvector_serial.h>
1342 johnpye 907 # include <ida/ida.h>
1343 jpye 1400 #endif
1344 johnpye 673 int main(){
1345     void *ida_mem;
1346     ida_mem = IDACreate();
1347 johnpye 782 return 0;
1348 johnpye 673 }
1349     """
1350    
1351 johnpye 913 # slightly changed calling convention (IDACalcID) in newer versions of SUNDIALS,
1352     # so detect the version and act accordingly.
1353 jpye 1400 def CheckSUNDIALS(context):
1354     keep = KeepContext(context,'SUNDIALS')
1355 jpye 1402 context.Message("Checking for SUNDIALS... ")
1356 johnpye 913 (is_ok,output) = context.TryRun(sundials_version_text,'.c')
1357     keep.restore(context)
1358     if not is_ok:
1359 jpye 1402 context.Result(0)
1360 johnpye 913 return 0
1361    
1362     major,minor,patch = tuple([int(i) for i in output.split(".")])
1363     context.env['SUNDIALS_VERSION_MAJOR'] = major
1364     context.env['SUNDIALS_VERSION_MINOR'] = minor
1365     if major != sundials_version_major_required \
1366     or minor < sundials_version_minor_min \
1367     or minor > sundials_version_minor_max:
1368     context.Result(output+" (bad version)")
1369     # bad version
1370     return 0
1371    
1372     # good version
1373 johnpye 1086 context.Result("%d.%d.%d, good" % (major,minor,patch))
1374 jpye 1400
1375 johnpye 913 return 1
1376    
1377 jpye 1400
1378     def CheckIDA(context):
1379 jpye 1402 context.Message( 'Checking for IDA... ' )
1380 jpye 1400
1381 jpye 1404 keep = KeepContext(context,"SUNDIALS")
1382 jpye 1400
1383     major = context.env['SUNDIALS_VERSION_MAJOR']
1384     minor = context.env['SUNDIALS_VERSION_MINOR']
1385    
1386 jpye 1404 cppdef = context.env.get('CPPDEFINES')
1387    
1388     context.env.Append(CPPDEFINES=[
1389     ('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR")
1390     ,('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR")
1391     ])
1392    
1393     context.env['SUNDIALS_CPPPATH_EXTRA']=[]
1394     if major==2 and minor==2:
1395     context.env.Append(SUNDIALS_CPPPATH_EXTRA = ["$SUNDIALS_CPPPATH/sundials"])
1396    
1397 jpye 1400 context.env.Append(CPPDEFINES=[('SUNDIALS_VERSION_MAJOR',"$SUNDIALS_VERSION_MAJOR"),('SUNDIALS_VERSION_MINOR',"$SUNDIALS_VERSION_MINOR")])
1398 jpye 1404 context.env.AppendUnique(LIBS=context.env['SUNDIALS_LIBS'])
1399     context.env.AppendUnique(CPPPATH=context.env['SUNDIALS_CPPPATH_EXTRA'])
1400 jpye 1400
1401     is_ok = context.TryLink(ida_test_text,".c")
1402     context.Result(is_ok)
1403    
1404 jpye 1404 if cppdef:
1405     context.env['CPPDEFINES']=cppdef
1406 jpye 1400 keep.restore(context)
1407    
1408     return is_ok
1409    
1410    
1411 johnpye 673 #----------------
1412 johnpye 783 # CONOPT test
1413    
1414     conopt_test_text = """
1415 johnpye 800 #if !defined(_WIN32)
1416     # define FNAME_LCASE_DECOR
1417     #endif
1418    
1419 johnpye 783 #include <conopt.h>
1420     #include <stdlib.h>
1421     int main(){
1422     int s, *v, e;
1423     s = COIDEF_Size();
1424     v = (int *)malloc(s*sizeof(int));
1425     e = COIDEF_Ini(v);
1426     return e;
1427     }
1428     """
1429    
1430     def CheckCONOPT(context):
1431     context.Message( 'Checking for CONOPT... ' )
1432    
1433     keep = KeepContext(context,"CONOPT")
1434    
1435     is_ok = context.TryLink(conopt_test_text,".c")
1436     context.Result(is_ok)
1437    
1438     keep.restore(context)
1439    
1440     return is_ok
1441    
1442     #----------------
1443 jpye 1529 # IPOPT test
1444    
1445     ipopt_test_text = """
1446     #if !defined(_WIN32)
1447     # define FNAME_LCASE_DECOR
1448     #endif
1449    
1450     #include <ipopt/IpStdCInterface.h>
1451     int main(){
1452     Number n;
1453     IpoptProblem nlp = NULL;
1454     FreeIpoptProblem(nlp); // probably a crash if you run this
1455     return 0;
1456     }
1457     """
1458    
1459     def CheckIPOPT(context):
1460     context.Message( 'Checking for IPOPT... ' )
1461    
1462     keep = KeepContext(context,"IPOPT")
1463    
1464     is_ok = context.TryLink(ipopt_test_text,".c")
1465     context.Result(is_ok)
1466    
1467     keep.restore(context)
1468    
1469     return is_ok
1470    
1471     #----------------
1472 johnpye 405 # Tcl test
1473 johnpye 404
1474 johnpye 561 # TCL and TK required version 8.1, 8.2, 8.3, or 8.4:
1475     tcltk_minor_newest_acceptable = 4
1476     tcltk_major_required = 8
1477    
1478 johnpye 404 tcl_check_text = r"""
1479     #include <tcl.h>
1480     #include <stdio.h>
1481     int main(void){
1482     printf("%s",TCL_PATCH_LEVEL);
1483     return 0;
1484     }
1485     """
1486    
1487     def CheckTcl(context):
1488 johnpye 521 return CheckExtLib(context,'tcl',tcl_check_text,static=env['STATIC_TCLTK'])
1489 johnpye 405
1490     def CheckTclVersion(context):
1491 johnpye 521 keep = KeepContext(context,'TCL',static=env['STATIC_TCLTK'])
1492 johnpye 405 context.Message("Checking Tcl version... ")
1493     (is_ok,output) = context.TryRun(tcl_check_text,'.c')
1494 johnpye 404 keep.restore(context)
1495     if not is_ok:
1496 johnpye 405 context.Result("failed to run check")
1497 johnpye 404 return 0
1498 johnpye 405
1499 wangym 511 major,minor,patch = tuple([int(i) for i in output.split(".")])
1500 johnpye 561 if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable:
1501 johnpye 428 context.Result(output+" (bad version)")
1502 johnpye 405 # bad version
1503     return 0
1504    
1505     # good version
1506 johnpye 552 context.Result(output+", good")
1507 johnpye 404 return 1
1508    
1509 johnpye 405 #----------------
1510 johnpye 463 # Tk test
1511 johnpye 405
1512     tk_check_text = r"""
1513     #include <tk.h>
1514     #include <stdio.h>
1515     int main(void){
1516     printf("%s",TK_PATCH_LEVEL);
1517     return 0;
1518     }
1519     """
1520     def CheckTk(context):
1521 johnpye 673 return CheckExtLib(context,'tk',tk_check_text,static=env['STATIC_TCLTK'])
1522 johnpye 405
1523 johnpye 428
1524 johnpye 405 def CheckTkVersion(context):
1525 johnpye 521 keep = KeepContext(context,'TK',static=context.env['STATIC_TCLTK'])
1526 johnpye 405 context.Message("Checking Tk version... ")
1527 johnpye 521 #print "LINKFLAGS =",context.env['LINKFLAGS']
1528 johnpye 405 (is_ok,output) = context.TryRun(tk_check_text,'.c')
1529 johnpye 404 keep.restore(context)
1530     if not is_ok:
1531     context.Result("failed to run check")
1532     return 0
1533    
1534 wangym 511 major,minor,patch = tuple([int(i) for i in output.split(".")])
1535 johnpye 561 if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable:
1536 johnpye 404 # bad version
1537 johnpye 561 context.Result(output+" (bad version)")
1538 johnpye 404 return 0
1539 johnpye 400
1540 johnpye 404 # good version
1541 johnpye 561 context.Result(output+" (good)")
1542 johnpye 404 return 1
1543 johnpye 485
1544     #----------------
1545 johnpye 521 # Tktable test
1546    
1547     tktable_check_text = r"""
1548     #include <tkTable.h>
1549     #include <stdio.h>
1550     int main(void){
1551     Table mytable;
1552     return 0;
1553     }
1554     """
1555    
1556     def CheckTkTable(context):
1557     return CheckExtLib(context,'tktable',tktable_check_text,static=env['STATIC_TCLTK'])
1558    
1559     #---------------
1560     # X11 test
1561    
1562     x11_check_text = r"""
1563     #include <X11/Xlib.h>
1564     #include <X11/IntrinsicP.h>
1565     #include <X11/Intrinsic.h>
1566     #include <X11/ObjectP.h>
1567     #include <X11/Object.h>
1568     int main(void){
1569     Object mything;
1570     return 0;
1571     }
1572     """
1573    
1574     def CheckX11(context):
1575     return CheckExtLib(context,'X11',x11_check_text)
1576    
1577     #----------------
1578 johnpye 968 # Check that we can raise and catch sigint
1579    
1580     sigint_test_text = r"""
1581     #include <signal.h>
1582     #include <setjmp.h>
1583     #include <stdlib.h>
1584     static jmp_buf g_jmpenv;
1585     void sighandler(int sig){
1586     longjmp(g_jmpenv,sig);
1587     }
1588     void testsigint(){
1589     raise(SIGINT);
1590     }
1591     int main(void){
1592     signal(SIGINT,&sighandler);
1593     switch(setjmp(g_jmpenv)){
1594     case 0:
1595     testsigint();
1596     exit(1);
1597     case SIGINT:
1598     exit(0);
1599     default:
1600     exit(2);
1601     }
1602     }
1603     """
1604    
1605     def CheckSIGINT(context):
1606     context.Message("Checking SIGINT is catchable... ")
1607     (is_ok,output)=context.TryRun(sigint_test_text,".c")
1608     context.Result(is_ok)
1609     return is_ok
1610    
1611     #----------------
1612 johnpye 953 # Check that we're able to catch floating point errors
1613    
1614     sigfpe_test_text = r"""
1615     #include <signal.h>
1616     #include <setjmp.h>
1617     #include <stdlib.h>
1618     #include <fenv.h>
1619     static jmp_buf g_jmpenv;
1620     void fpehandler(int sig){
1621     longjmp(g_jmpenv,sig);
1622     }
1623     int main(void){
1624     fenv_t myfenv;
1625     fegetenv(&myfenv);
1626     fesetenv(&myfenv);
1627     feenableexcept(FE_ALL_EXCEPT);
1628     signal(SIGFPE,&fpehandler);
1629     double x;
1630     switch(setjmp(g_jmpenv)){
1631     case 0:
1632     x = 1.0 / 0.0;
1633     /* failed to catch */
1634     exit(1);
1635     case SIGFPE:
1636     exit(0);
1637     }
1638     }
1639     """
1640    
1641     def CheckFPE(context):
1642 johnpye 968 context.Message("Checking C99 FPE behaviour... ")
1643 johnpye 953 (is_ok,output) = context.TryRun(sigfpe_test_text,'.c')
1644     context.Result(is_ok)
1645     return is_ok
1646    
1647     #----------------
1648 johnpye 968 # signal reset needed?
1649    
1650     sigreset_test_text = r"""
1651     #include <signal.h>
1652     #include <setjmp.h>
1653     #include <stdlib.h>
1654     #include <stdio.h>
1655     typedef void SigHandlerFn(int);
1656     static jmp_buf g_jmpenv;
1657     void sighandler(int sig){
1658     longjmp(g_jmpenv,sig);
1659     }
1660     void testsigint(){
1661 johnpye 1002 /* fprintf(stderr,"Raising SIGINT\n"); */
1662 johnpye 968 raise(SIGINT);
1663     }
1664     int main(void){
1665     SigHandlerFn *last,*saved;
1666     saved = signal(SIGINT,&sighandler);
1667     if(saved!=SIG_DFL){
1668 johnpye 1002 fprintf(stderr,"Default handler (%p) was not correctly set\n",SIG_DFL);
1669 johnpye 968 exit(3);
1670     }
1671     switch(setjmp(g_jmpenv)){
1672     case 0:
1673     testsigint();
1674     fprintf(stderr,"Back from SIGINT\n");
1675     exit(1);
1676     case SIGINT:
1677     break;
1678     default:
1679     exit(2);
1680     };
1681 johnpye 1002 last = signal(SIGINT,SIG_DFL);
1682 johnpye 968 if(last!=&sighandler){
1683     printf("1");
1684     exit(0);
1685     }
1686     printf("0");
1687     exit(0);
1688     }
1689     """
1690    
1691     def CheckSigReset(context):
1692     context.Message("Checking signal handler reset... ")
1693     (is_ok,output) = context.TryRun(sigreset_test_text,'.c')
1694     if not is_ok:
1695     context.Result("ERROR")
1696 johnpye 1260 return False
1697 johnpye 1002 if int(output)==1:
1698 johnpye 968 context.Result("required");
1699     context.env['ASC_RESETNEEDED'] = True
1700     else:
1701     context.Result("not required");
1702     context.env['ASC_RESETNEEDED'] = False
1703     return is_ok
1704    
1705     #----------------
1706 jpye 1442 # LyX on this system?
1707    
1708     def CheckLyx(context):
1709     context.Message("Checking for LyX... ")
1710     r = context.env.WhereIs("lyx")
1711 jpye 1469 if r:
1712     context.Result(r)
1713     else:
1714     context.Result(0)
1715 jpye 1442 return r
1716    
1717     #----------------
1718     # Latex2HTML on this system?
1719    
1720     def CheckLatex2HTML(context):
1721     context.Message("Checking for latex2html...")
1722     if context.env.WhereIs("latex2html"):
1723     r = True
1724     else:
1725     r = False
1726     context.Result(r)
1727     return r
1728    
1729     #----------------
1730 johnpye 485 # GCC Version sniffing
1731    
1732     # TODO FIXME
1733    
1734     gcc_version4 = False
1735    
1736 johnpye 398 #------------------------------------------------------
1737 johnpye 385 # CONFIGURATION
1738    
1739     conf = Configure(env
1740     , custom_tests = {
1741 jpye 1448 'CheckCC' : CheckCC
1742     , 'CheckCXX' : CheckCXX
1743     , 'CheckMath' : CheckMath
1744 johnpye 673 , 'CheckSwigVersion' : CheckSwigVersion
1745 johnpye 957 , 'CheckPythonLib' : CheckPythonLib
1746 johnpye 400 , 'CheckCUnit' : CheckCUnit
1747 johnpye 938 , 'CheckDMalloc' : CheckDMalloc
1748 jpye 1442 , 'CheckLyx' : CheckLyx
1749     , 'CheckLatex2HTML' : CheckLatex2HTML
1750 johnpye 1109 , 'CheckMFGraph' : CheckMFGraph
1751 jpye 1326 , 'CheckUFSparse' : CheckUFSparse
1752 johnpye 404 , 'CheckTcl' : CheckTcl
1753     , 'CheckTclVersion' : CheckTclVersion
1754 johnpye 405 , 'CheckTk' : CheckTk
1755     , 'CheckTkVersion' : CheckTkVersion
1756 johnpye 502 , 'CheckGcc' : CheckGcc
1757 johnpye 500 , 'CheckGccVisibility' : CheckGccVisibility
1758 johnpye 502 , 'CheckYacc' : CheckYacc
1759 johnpye 1025 , 'CheckLex' : CheckLex
1760 johnpye 521 , 'CheckTkTable' : CheckTkTable
1761     , 'CheckX11' : CheckX11
1762 johnpye 673 , 'CheckIDA' : CheckIDA
1763 jpye 1400 , 'CheckSUNDIALS' : CheckSUNDIALS
1764 johnpye 783 , 'CheckCONOPT' : CheckCONOPT
1765 jpye 1529 , 'CheckIPOPT' : CheckIPOPT
1766 johnpye 816 , 'CheckScrollkeeperConfig' : CheckScrollkeeperConfig
1767 johnpye 953 , 'CheckFPE' : CheckFPE
1768 johnpye 968 , 'CheckSIGINT' : CheckSIGINT
1769     , 'CheckSigReset' : CheckSigReset
1770 johnpye 400 # , 'CheckIsNan' : CheckIsNan
1771     # , 'CheckCppUnitConfig' : CheckCppUnitConfig
1772 johnpye 385 }
1773 johnpye 459 # , config_h = "config.h"
1774 johnpye 385 )
1775    
1776 jpye 1357 def sconsversioncheck():
1777    
1778     # uncomment the following line to skip the version check:
1779     # return 1
1780    
1781     import SCons
1782     v = SCons.__version__.split(".")
1783     if v[0] != '0':
1784     return 0
1785 jpye 1431 if int(v[1]) >= 97:
1786     return 1
1787 jpye 1357 if v[1] != '96':
1788     return 0
1789     micro = int(v[2])
1790 jpye 1394 if micro == 92 or micro == 93 or micro == 96:
1791 jpye 1357 return 1;
1792     return 0
1793    
1794     if not sconsversioncheck():
1795     print "Scons version is not OK. Please try version 0.96.92 or 0.96.93,"
1796     print "or consult the developers in the case of newer versions. Modify"
1797     print "the function 'sconsversioncheck' in the file SConstruct if you"
1798     print "want to *force* SCons to continue."
1799     Exit(1)
1800    
1801 jpye 1448 # check C compiler
1802    
1803     if not conf.CheckCC():
1804     print "Failed to build simple test file with your C compiler."
1805     print "Check your compiler is installed and running correctly."
1806     Exit(1)
1807    
1808     if not conf.CheckCXX():
1809     print "Failed to build simple test file with your C++ compiler."
1810     print "Check your compiler is installed and running correctly."
1811     Exit(1)
1812    
1813 johnpye 740 # stdio -- just to check that compiler is behaving
1814 johnpye 398
1815 johnpye 740 if not conf.CheckHeader('stdio.h'):
1816 johnpye 832 print "CPPPATH =",env.get('CPPPATH')
1817 johnpye 740 print "Did not find 'stdio.h'! Check your compiler configuration."
1818 johnpye 1080 print ""
1819     print "You environment is printed here:"
1820     for k,v in os.environ.iteritems():
1821     print "%-30s%s" % ("%s :" % k, v)
1822 johnpye 740 Exit(1)
1823    
1824 johnpye 1228 if not conf.CheckFunc('snprintf'):
1825     print "Didn't find snprintf";
1826     exit(1)
1827    
1828 johnpye 385 # Math library
1829    
1830 johnpye 1262 conf.env['HAVE_IEEE']=True
1831    
1832     if need_libm and not conf.CheckMath():
1833 johnpye 1232 conf.env['HAVE_IEEE']=False
1834 johnpye 1262 print 'Did not find math library, exiting!'
1835     Exit(1)
1836 johnpye 427
1837 johnpye 385 # Where is 'isnan'?
1838    
1839 johnpye 740 if not conf.CheckFunc('isnan') and not conf.CheckFunc('_isnan'):
1840 johnpye 385 print "Didn't find isnan"
1841 johnpye 414 # Exit(1)
1842 johnpye 385
1843 johnpye 500 # GCC visibility
1844    
1845 johnpye 502 if conf.CheckGcc():
1846     conf.env['HAVE_GCC']=True;
1847 johnpye 526 if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility():
1848 johnpye 509 conf.env['HAVE_GCCVISIBILITY']=True;
1849     conf.env.Append(CCFLAGS=['-fvisibility=hidden'])
1850     conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])
1851 johnpye 709 conf.env.Append(CCFLAGS=['-Wall'])
1852 johnpye 500
1853 johnpye 968 # Catching SIGINT
1854    
1855 johnpye 1142 if env['WITH_SIGNALS']:
1856     if not conf.CheckSIGINT():
1857     with_signals = False
1858     without_signals_reason = "SIGINT uncatchable"
1859 johnpye 968
1860 johnpye 953 # Catching SIGFPE
1861    
1862     if conf.CheckFPE():
1863 johnpye 968 conf.env['HAVE_C99FPE']=True
1864 johnpye 953 else:
1865 johnpye 968 conf.env['HAVE_C99FPE']=False
1866 johnpye 953
1867 johnpye 968 # Checking for signal reset requirement
1868    
1869     if not conf.CheckSigReset():
1870     print "Unable to determine if signal reset is required"
1871 johnpye 1260 Exit(1)
1872 johnpye 968
1873 johnpye 502 # YACC
1874    
1875 johnpye 506 if not conf.CheckYacc():
1876     print "YACC NOT FOUND OR NOT WORKING"
1877     else:
1878 johnpye 502 conf.env['HAVE_YACC']=True
1879    
1880 johnpye 1025 if not conf.CheckLex():
1881     print "YACC NOT FOUND OR NOT WORKING"
1882     else:
1883     conf.env['HAVE_LEX']=True
1884 johnpye 502
1885 johnpye 387 # Tcl/Tk
1886 johnpye 386
1887 johnpye 586 if with_tcltk:
1888     if conf.CheckTcl():
1889     if conf.CheckTclVersion():
1890     if conf.CheckTk():
1891     if with_tcltk and conf.CheckTkVersion():
1892     if env['STATIC_TCLTK']:
1893     if conf.CheckTkTable():
1894     pass
1895     else:
1896     without_tcltk_reason = "TkTable not found"
1897     with_tcltk = False
1898     else:
1899     without_tcltk_reason = "Require Tk version <= 8.4. See 'scons -h'"
1900     with_tcltk = False
1901 johnpye 521 else:
1902 johnpye 586 without_tcltk_reason = "Tk not found."
1903 johnpye 551 with_tcltk = False
1904 johnpye 428 else:
1905 johnpye 586 without_tcltk_reason = "Require Tcl <= 8.4 Tcl."
1906 johnpye 551 with_tcltk = False
1907 johnpye 586
1908 johnpye 428 else:
1909 johnpye 586 without_tcltk_reason = "Tcl not found."
1910 johnpye 551 with_tcltk = False
1911 johnpye 386
1912 johnpye 521 if env['STATIC_TCLTK']:
1913     conf.CheckX11()
1914    
1915 johnpye 395 # Python... obviously we're already running python, so we just need to
1916     # check that we can link to the python library OK:
1917    
1918 johnpye 957 if not conf.CheckPythonLib():
1919     without_python_reason = 'libpython2.x not found or not linkable'
1920     with_python = False
1921 johnpye 982 env['WITH_PYTHON']=False
1922 johnpye 391
1923 johnpye 395 # SWIG version
1924    
1925 johnpye 957 if with_python and not conf.CheckSwigVersion():
1926 johnpye 413 without_python_reason = 'SWIG >= 1.3.24 is required'
1927     with_python = False
1928 johnpye 982 env['WITH_PYTHON']=False
1929 johnpye 413
1930 johnpye 400 # CUnit
1931    
1932 johnpye 593 if with_cunit:
1933 johnpye 404 if not conf.CheckCUnit():
1934 johnpye 427 without_cunit_reason = 'CUnit not found'
1935 johnpye 665 with_cunit = False
1936 johnpye 705 #print "CUNIT NOT FOUND, LIBS=",conf.env.get('LIBS')
1937 johnpye 427
1938 johnpye 938 # DMALLOC
1939    
1940     if with_dmalloc:
1941     if not conf.CheckDMalloc():
1942     without_dmalloc_reason = 'dmalloc not found'
1943     with_dmalloc = False
1944    
1945 jpye 1326 # MFGRAPH
1946 johnpye 1109
1947     if with_mfgraph:
1948     if not conf.CheckMFGraph():
1949     without_mfgraph_reason = 'mfgraph not found'
1950 johnpye 1113 with_mfgraph = False
1951 johnpye 1114 env['WITH_MFGRAPH'] = False
1952 johnpye 1109
1953 jpye 1326 # UFSPARSE
1954    
1955     if with_ufsparse:
1956     if not conf.CheckUFSparse():
1957     without_ufsparse_reason = 'mfgraph not found'
1958     with_ufsparse = False
1959     env['WITH_UFSPARSE'] = False
1960    
1961 johnpye 673 # IDA
1962    
1963     if not with_ida:
1964     without_ida_reason = "Not selected (see config option WITH_SOLVERS)"
1965 jpye 1400 elif not conf.CheckSUNDIALS():
1966     with_ida = False
1967     without_ida_reason = "SUNDIALS not found, or bad version"
1968 johnpye 673 elif not conf.CheckIDA():
1969     with_ida = False
1970 jpye 1400 without_ida_reason = "Unable to compile/link against SUNDIALS/IDA"
1971 johnpye 673
1972 johnpye 797 # CONOPT
1973 johnpye 783
1974     if not with_conopt:
1975     without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
1976     elif not conf.CheckCONOPT():
1977 johnpye 797 with_conopt = False
1978     without_conpt_reason = "CONOPT not found"
1979 johnpye 783
1980 jpye 1529 # IPOPT
1981    
1982     if not with_ipopt:
1983     without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)"
1984     elif not conf.CheckIPOPT():
1985     with_ipopt = False
1986     without_ipopt_reason = "IPOPT not found"
1987    
1988 johnpye 427 # BLAS
1989    
1990 johnpye 459 need_blas=False
1991 johnpye 673
1992     if with_lsode:
1993     need_fortran = True
1994 johnpye 459 need_blas=True
1995 johnpye 673
1996 johnpye 459 if need_blas:
1997     if conf.CheckLib('blas'):
1998     with_local_blas = False
1999     without_local_blas_reason = "Found BLAS installed on system"
2000     else:
2001     with_local_blas = True
2002     need_fortran = True
2003 johnpye 673 else:
2004     with_local_blas= False;
2005     without_local_blas_reason = "BLAS not required"
2006 johnpye 427
2007     # FORTRAN
2008    
2009     if need_fortran:
2010 johnpye 629 conf.env.Tool('fortran')
2011 jpye 1380 detect_fortran = conf.env.Detect(['gfortran','g77'])
2012 johnpye 427 if detect_fortran:
2013     # For some reason, g77 doesn't get detected properly on MinGW
2014 johnpye 673 if not env.has_key('F77') and not env.has_key('FORTRAN'):
2015 jpye 1357 print "Fixing detection of F77 on MinGW...(?)"
2016 johnpye 427 conf.env.Replace(F77=detect_fortran)
2017     conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')
2018     conf.env.Replace(F77FLAGS='')
2019 johnpye 428 #print "F77:",conf.env['F77']
2020     #print "F77COM:",conf.env['F77COM']
2021     #print "F77FLAGS:",conf.env['F77FLAGS']
2022 johnpye 427 fortran_builder = Builder(
2023     action='$F77COM'
2024     , suffix='.o'
2025     , src_suffix='.f'
2026     )
2027     conf.env.Append(BUILDERS={'Fortran':fortran_builder})
2028 johnpye 1284 if platform.system()=="Linux":
2029     conf.env.Append(SHFORTRANFLAGS=['-fPIC'])
2030 johnpye 427 else:
2031 johnpye 673 with_lsode=False;
2032     without_lsode_reason="FORTRAN-77 required but not found"
2033 johnpye 629
2034 johnpye 464 #else:
2035     # print "FORTRAN not required"
2036 johnpye 400
2037 johnpye 673 # F2C
2038    
2039     if need_fortran:
2040     if platform.system()=="Windows":
2041 jpye 1380 pass
2042     #conf.env.Append(LIBPATH='c:\mingw\lib')
2043 johnpye 673
2044 johnpye 816 # scrollkeeper
2045 johnpye 673
2046 johnpye 816 if with_scrollkeeper:
2047     if not conf.CheckScrollkeeperConfig():
2048     with_scrollkeeper=False
2049     without_scrollkeeper_reason="unable to detect scrollkeeper-config"
2050    
2051 jpye 1442 # lyx
2052    
2053 jpye 1470 if with_doc_build:
2054 jpye 1442 if not conf.CheckLyx():
2055 jpye 1470 with_doc_build = False
2056     without_doc_build_reason="unable to locate lyx"
2057 jpye 1442
2058     with_latext2html = conf.CheckLatex2HTML()
2059    
2060 johnpye 385 # TODO: -D_HPUX_SOURCE is needed
2061    
2062     # TODO: check size of void*
2063    
2064 johnpye 393 # TODO: detect if dynamic libraries are possible or not
2065    
2066 johnpye 427 if platform.system()=="Windows" and env.has_key('MSVS'):
2067 johnpye 740 _found_windows_h = conf.CheckHeader('Windows.h')
2068    
2069     if not _found_windows_h:
2070 johnpye 741 print "Could not locate 'Windows.h' in CPPPATH. Check your configuration."
2071 johnpye 740 Exit(1)
2072 johnpye 741
2073 johnpye 534 if with_python and not conf.CheckHeader(['basetsd.h','BaseTsd.h']):
2074 johnpye 427 with_python = 0;
2075     without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK."
2076    
2077 johnpye 395 conf.Finish()
2078    
2079 johnpye 507 #---------------------------------------
2080     # SUBSTITUTION DICTIONARY for .in files
2081    
2082 johnpye 658 release = env.get('RELEASE')
2083     if release=="0.":
2084     release="0"
2085    
2086 johnpye 800 #print "SUBSTITUTED CONOPT_LIBPATH:",c_escape(env.subst("$CONOPT_LIBPATH"))
2087    
2088 johnpye 507 subst_dict = {
2089     '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']
2090 jpye 1519 ,'@DEFAULT_ASCENDSOLVERS@':env['DEFAULT_ASCENDSOLVERS']
2091 johnpye 507 , '@GLADE_FILE@':'ascend.glade'
2092     , '@HELP_ROOT@':''
2093     , '@ICON_EXTENSION@':icon_extension
2094 johnpye 628 , '@INSTALL_ASCDATA@':env['INSTALL_ASCDATA']
2095 johnpye 507 , '@INSTALL_BIN@':env['INSTALL_BIN']
2096     , '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE']
2097 johnpye 683 , '@INSTALL_LIB@':env['INSTALL_LIB']
2098 johnpye 721 , '@INSTALL_MODELS@':env['INSTALL_MODELS']
2099 jpye 1504 , '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS']
2100 johnpye 507 , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']
2101     , '@VERSION@':version
2102 johnpye 658 , '@RELEASE@':release
2103 johnpye 563 , '@DISTTAR_NAME@':env['DISTTAR_NAME']
2104 johnpye 507 , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'
2105 johnpye 1228 , '@SHLIBSUFFIX@':env['SHLIBSUFFIX']
2106     , '@SHLIBPREFIX@':env['SHLIBPREFIX']
2107 johnpye 589 , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
2108 johnpye 627 , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir
2109 johnpye 683 , '@PYTHON@' : python_exe
2110 jpye 1466 , '@PYVERSION@' : pyversion
2111 johnpye 800 , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')
2112     , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')
2113 jpye 1399 , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_DLPATH"))
2114 johnpye 1174 , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))
2115 jpye 1535 , '@WITH_SOLVERS@':",".join(env.get('WITH_SOLVERS'))
2116 johnpye 507 }
2117    
2118 jpye 1442 if env.get('WITH_DOC'):
2119     print "WITH_DOC:",env['WITH_DOC']
2120     subst_dict['@HELP_ROOT@']=env['HELP_ROOT']
2121 johnpye 507
2122 johnpye 597 # bool options...
2123 johnpye 673 for k,v in {
2124 johnpye 1142 'ASC_WITH_IDA':with_ida
2125     ,'ASC_WITH_DMALLOC':with_dmalloc
2126     ,'ASC_WITH_MFGRAPH':with_mfgraph
2127 jpye 1326 ,'ASC_WITH_UFSPARSE':with_ufsparse
2128 johnpye 1142 ,'ASC_WITH_CONOPT':with_conopt
2129 jpye 1529 ,'ASC_WITH_IPOPT':with_ipopt
2130 johnpye 1142 ,'ASC_WITH_LSODE':with_lsode
2131     ,'ASC_WITH_MMIO':with_mmio
2132     ,'ASC_SIGNAL_TRAPS':with_signals
2133     ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')
2134     ,'HAVE_C99FPE':env.get('HAVE_C99FPE')
2135 johnpye 1261 ,'HAVE_IEEE':env.get('HAVE_IEEE')
2136 jpye 1412 ,'ASC_ABSOLUTE_PATHS':env.get('ABSOLUTE_PATHS')
2137 johnpye 1142 ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')
2138     ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')
2139     }.iteritems():
2140    
2141     if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k
2142 johnpye 594
2143 johnpye 507 if with_python:
2144     subst_dict['@ASCXX_USE_PYTHON@']="1"
2145 johnpye 673 env['WITH_PYTHON']=1;
2146 johnpye 507
2147 jpye 1442 if with_latex2html:
2148     env['WITH_LATEX2HTML']=1
2149    
2150 johnpye 507 if env.has_key('HAVE_GCCVISIBILITY'):
2151     subst_dict['@HAVE_GCCVISIBILITY@'] = "1"
2152    
2153     env.Append(SUBST_DICT=subst_dict)
2154    
2155 johnpye 1142 #for k,v in subst_dict.iteritems():
2156     # print "%-50s%s" % ("'%s'"%k,v)
2157 johnpye 829
2158 johnpye 1142 # REMOVED: long command-line support on Win2k
2159 johnpye 829
2160     #------------------------------------------------------
2161 johnpye 558 # RECIPE: SWIG scanner
2162    
2163     import SCons.Script
2164    
2165     SWIGScanner = SCons.Scanner.ClassicCPP(
2166     "SWIGScan"
2167     , ".i"
2168     , "CPPPATH"
2169     , '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
2170     )
2171    
2172     env.Append(SCANNERS=[SWIGScanner])
2173    
2174     #------------------------------------------------------
2175 johnpye 463 # Recipe for 'CHMOD' ACTION
2176 johnpye 439
2177     import SCons
2178     from SCons.Script.SConscript import SConsEnvironment
2179     SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
2180     lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
2181    
2182     def InstallPerm(env, dest, files, perm):
2183     obj = env.Install(dest, files)
2184     for i in obj:
2185     env.AddPostAction(i, env.Chmod(str(i), perm))
2186    
2187     SConsEnvironment.InstallPerm = InstallPerm
2188    
2189     # define wrappers
2190     SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)
2191 johnpye 578 SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2192 johnpye 629 SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2193 johnpye 463
2194 johnpye 439 #------------------------------------------------------
2195 johnpye 463 # BUILD...
2196 johnpye 385
2197 johnpye 463 # so that #include <modulename/headername.h> works across all modules...
2198 johnpye 743 env.AppendUnique(CPPPATH=['#base/generic'])
2199 johnpye 385
2200 johnpye 508 if env['DEBUG']:
2201     env.Append(CCFLAGS=['-g'])
2202    
2203 johnpye 591 if env['GCOV']:
2204     env.Append(
2205     CPPFLAGS=['-g','-fprofile-arcs','-ftest-coverage']
2206     , LIBS=['gcov']
2207     , LINKFLAGS=['-fprofile-arcs','-ftest-coverage']
2208     )
2209    
2210 johnpye 673 if with_ida:
2211     env.Append(WITH_IDA=1)
2212    
2213 johnpye 783 if with_conopt:
2214     env.Append(WITH_CONOPT=1)
2215    
2216 jpye 1529 if with_ipopt:
2217     env.Append(WITH_IPOPT=1)
2218    
2219 johnpye 463 #-------------
2220     # TCL/TK GUI
2221 johnpye 385
2222 johnpye 551 if with_tcltk:
2223 johnpye 569 env.SConscript(['tcltk/generic/interface/SConscript'],'env')
2224 johnpye 391 else:
2225 johnpye 982 print "Skipping... Tcl/Tk bindings aren't being built:",without_tcltk_reason
2226 johnpye 386
2227 johnpye 463 #-------------
2228     # PYTHON INTERFACE
2229    
2230 johnpye 387 if with_python:
2231 johnpye 532 env.SConscript(['pygtk/SConscript'],'env')
2232 johnpye 391 else:
2233 johnpye 982 print "Skipping... Python bindings aren't being built:",without_python_reason
2234 johnpye 400
2235 johnpye 463 #------------
2236     # BASE/GENERIC SUBDIRECTORIES
2237    
2238 johnpye 673 libascend_env = env.Copy()
2239    
2240 johnpye 1316 dirs = ['general','utilities','compiler','system','solver','integrator','packages','linear']
2241 johnpye 463
2242     srcs = []
2243     for d in dirs:
2244 johnpye 673 heresrcs = libascend_env.SConscript('base/generic/'+d+'/SConscript','libascend_env')
2245 johnpye 463 srcs += heresrcs
2246    
2247     #-------------
2248 johnpye 673 # IMPORTED CODE: LSODE, BLAS, etc
2249    
2250 jpye 1509 #if with_lsode:
2251     # srcs += env.SConscript(['lsod/SConscript'],'env')
2252     # srcs += env.SConscript(['linpack/SConscript'],'env')
2253     #else:
2254     # print "Skipping... LSODE won't be built:", without_lsode_reason
2255 johnpye 673
2256     if with_local_blas:
2257 jpye 1515 env['blasobjs'] = env.SConscript(['blas/SConscript'],'env')
2258 johnpye 673 else:
2259 jpye 1515 env['blasobjs'] = []
2260 johnpye 673 print "Skipping... BLAS won't be built:", without_local_blas_reason
2261    
2262     if not with_ida:
2263     print "Skipping... IDA won't be built:", without_ida_reason
2264    
2265 johnpye 993 if with_mmio:
2266     srcs += env.SConscript(['mmio/SConscript'],'env')
2267     else:
2268     print "Skipping... MMIO export won't be built:", without_mmio_reason
2269 johnpye 673 #-------------
2270 johnpye 463 # LIBASCEND -- all base/generic functionality
2271    
2272 johnpye 938 if with_dmalloc:
2273     libascend_env.Append(LIBS=['dmalloc'])
2274    
2275 jpye 1326 if with_ufsparse:
2276     libascend_env.Append(LIBS=['cxsparse'])
2277    
2278 johnpye 673 libascend = libascend_env.SharedLibrary('ascend',srcs)
2279 johnpye 463
2280 jpye 1510 # for use in declaring dependent shared libraries in SConscript files (eg solvers/*/SConscript)
2281     env['libascend'] = libascend
2282    
2283 johnpye 673 env.Alias('libascend',libascend)
2284    
2285 johnpye 463 #-------------
2286 johnpye 761 # UNIT TESTS (C CODE)
2287 johnpye 463
2288 johnpye 593 if with_cunit:
2289 jpye 1319 testdirs = ['general','solver','utilities','linear']
2290 johnpye 593 testsrcs = []
2291 johnpye 400 for testdir in testdirs:
2292     path = 'base/generic/'+testdir+'/test/'
2293     env.SConscript([path+'SConscript'],'env')
2294 johnpye 593 testsrcs += [i.path for i in env['TESTSRCS_'+testdir.upper()]]
2295    
2296     #print "TESTSRCS =",testsrcs
2297    
2298 johnpye 400 env.SConscript(['test/SConscript'],'env')
2299     env.SConscript(['base/generic/test/SConscript'],'env')
2300 johnpye 593
2301     env.Alias('test',[env.Dir('test'),env.Dir('base/generic/test')])
2302 johnpye 400
2303     else:
2304 johnpye 427 print "Skipping... CUnit tests aren't being built:",without_cunit_reason
2305 johnpye 400
2306 johnpye 761 #-------------
2307 jpye 1504 # EXTERNAL SOLVERS
2308    
2309     env['extfns']=[]
2310    
2311 jpye 1505 env.SConscript(['solvers/SConscript'],'env')
2312 jpye 1504
2313     #-------------
2314 johnpye 761 # EXTERNAL FUNCTIONS
2315    
2316 johnpye 811 modeldirs = env.SConscript(['models/SConscript'],'env')
2317    
2318     if not with_extfns:
2319 johnpye 761 print "Skipping... External modules aren't being built:",without_extfns_reason
2320    
2321 johnpye 811 env.Alias('extfns',env['extfns'])
2322 johnpye 761
2323 johnpye 463 #------------------------------------------------------
2324 johnpye 683 # CREATE ASCEND-CONFIG scriptlet
2325    
2326     ascendconfig = env.SubstInFile('ascend-config.in')
2327    
2328     #------------------------------------------------------
2329 johnpye 463 # INSTALLATION
2330 johnpye 427
2331 johnpye 552 if env.get('CAN_INSTALL'):
2332 johnpye 427
2333 jpye 1442 dirs = ['INSTALL_BIN','INSTALL_ASCDATA','INSTALL_LIB', 'INSTALL_INCLUDE','INSTALL_DOC']
2334 jpye 1436 install_dirs = [Dir(env.subst("$INSTALL_ROOT$"+d)) for d in dirs]
2335 jpye 1505 install_dirs += modeldirs + [Dir(env.subst("$INSTALL_ROOT$INSTALL_SOLVERS"))]
2336 johnpye 449
2337 johnpye 463 # TODO: add install options
2338     env.Alias('install',install_dirs)
2339 johnpye 400
2340 jpye 1436 env.InstallShared(Dir(env.subst("$INSTALL_ROOT$INSTALL_LIB")),libascend)
2341 johnpye 435
2342 jpye 1436 env.InstallProgram(Dir(env.subst("$INSTALL_ROOT$INSTALL_BIN")),ascendconfig)
2343 johnpye 683
2344 johnpye 438 #------------------------------------------------------
2345 johnpye 631 # WINDOWS INSTALLER
2346     # For the windows installer, please see pygtk/SConscript
2347    
2348     if with_installer:
2349 jpye 1467 env.Append(NSISDEFINES={
2350     'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME']
2351     ,"VERSION":version
2352     ,'PYVERSION':pyversion
2353     })
2354 jpye 1465 installer = env.Installer('installer.nsi')
2355     Depends(installer,["pygtk","tcltk","ascend.dll","models","ascend-config"])
2356     env.Alias('installer',installer)
2357 johnpye 631 else:
2358     print "Skipping... Windows installer isn't being built:",without_installer_reason
2359    
2360 jpye 1465
2361 johnpye 631 #------------------------------------------------------
2362 johnpye 673 # PROJECT FILE for MSVC
2363    
2364     env.SConscript(['base/msvc/SConscript'],['env','libascend']);
2365    
2366     #------------------------------------------------------
2367 johnpye 438 # CREATE the SPEC file for generation of RPM packages
2368    
2369 johnpye 463 if platform.system()=="Linux":
2370     env.SubstInFile('ascend.spec.in')
2371 johnpye 552
2372     #------------------------------------------------------
2373 johnpye 816 # CREATE OMF FILE FOR USE WITH SCROLLKEEPER
2374    
2375 jpye 1442 #if with_scrollkeeper:
2376     # #env.SubstInFile('#/pygtk/gnome/ascend.omf.in')
2377     # #env.InstallShared(env['INSTALL_ROOT']+env['OMFDIR'],"#/pygtk/gnome/ascend.omf")
2378 johnpye 816
2379     #------------------------------------------------------
2380 johnpye 552 # DISTRIBUTION TAR FILE
2381    
2382 johnpye 554 env['DISTTAR_FORMAT']='bz2'
2383 johnpye 556 env.Append(
2384 jpye 1443 DISTTAR_EXCLUDEEXTS=['.o','.os','.so','.a','.dll','.lib','.cc','.cache','.pyc','.cvsignore','.dblite','.log','.pl','.out','.exe','.aux','.idx','.toc','.lof','.lot','.mm','.warnings','.tm2','.swp',',tmp','.gz','.bz2','.7z']
2385 jpye 1417 , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian']
2386 johnpye 556 )
2387 johnpye 554
2388 johnpye 563 tar = env.DistTar("dist/"+env['DISTTAR_NAME']
2389 johnpye 556 , [env.Dir('#')]
2390 johnpye 554 )
2391    
2392 johnpye 680 env.Depends(tar,'ascend.spec')
2393 jpye 1442 env.Depends(tar,'#doc/book.pdf')
2394 johnpye 680
2395 johnpye 862 Alias('dist',tar)
2396    
2397 johnpye 554 #------------------------------------------------------
2398 johnpye 816 # USER'S MANUAL
2399    
2400     env.SConscript('doc/SConscript',['env'])
2401    
2402 jpye 1442
2403 johnpye 816 #------------------------------------------------------
2404 johnpye 766 # LIBASCEND DOXYGEN DOCUMENTATION
2405    
2406 jpye 1470 if not with_doc_build:
2407     print "Skipping... Windows installer isn't being built:",without_doc_build_reason
2408    
2409 johnpye 766 env.SConscript('base/doc/SConscript',['env'])
2410    
2411     #------------------------------------------------------
2412 johnpye 554 # RPM BUILD
2413    
2414 johnpye 766 # for RPM builds, 'scons dist' then 'rpmbuild -ta dist/ascend-*.tar.bz2'
2415     # (check * for the version number used to create the tarball)
2416 johnpye 554
2417     #------------------------------------------------------
2418     # DEFAULT TARGETS
2419    
2420 jpye 1504 default_targets =['libascend','solvers']
2421 johnpye 629 if with_tcltk:
2422     default_targets.append('tcltk')
2423     if with_python:
2424     default_targets.append('pygtk')
2425 johnpye 631 if with_installer:
2426     default_targets.append('installer')
2427 johnpye 761 if with_extfns:
2428     default_targets.append('extfns')
2429 jpye 1443 if with_doc_build:
2430 jpye 1442 default_targets.append('doc')
2431 johnpye 554
2432 johnpye 629 env.Default(default_targets)
2433    
2434     print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])
2435    
2436 johnpye 705 # vim: set syntax=python:

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