/[ascend]/trunk/SConstruct
ViewVC logotype

Annotation of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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

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