/[ascend]/trunk/SConstruct
ViewVC logotype

Annotation of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1547 - (hide annotations) (download)
Mon Jul 23 06:25:49 2007 UTC (12 years, 4 months ago) by jpye
File size: 57453 byte(s)
Fixed build of asc_ipopt.c. Small comment added in relman. IPOPT_LIB replaced by IPOPT_LIBS due to multiple linking requirement of that library.
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 johnpye 980 python_libpath+=[cfig['prefix']]
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 1400 keep.restore(context)
1443    
1444     return is_ok
1445    
1446    
1447 johnpye 673 #----------------
1448 johnpye 783 # CONOPT test
1449    
1450     conopt_test_text = """
1451 johnpye 800 #if !defined(_WIN32)
1452     # define FNAME_LCASE_DECOR
1453     #endif
1454    
1455 johnpye 783 #include <conopt.h>
1456     #include <stdlib.h>
1457     int main(){
1458     int s, *v, e;
1459     s = COIDEF_Size();
1460     v = (int *)malloc(s*sizeof(int));
1461     e = COIDEF_Ini(v);
1462     return e;
1463     }
1464     """
1465    
1466     def CheckCONOPT(context):
1467     context.Message( 'Checking for CONOPT... ' )
1468    
1469     keep = KeepContext(context,"CONOPT")
1470    
1471     is_ok = context.TryLink(conopt_test_text,".c")
1472     context.Result(is_ok)
1473    
1474     keep.restore(context)
1475    
1476     return is_ok
1477    
1478     #----------------
1479 jpye 1529 # IPOPT test
1480    
1481     ipopt_test_text = """
1482     #if !defined(_WIN32)
1483     # define FNAME_LCASE_DECOR
1484     #endif
1485    
1486     #include <ipopt/IpStdCInterface.h>
1487     int main(){
1488     Number n;
1489 jpye 1546 IpoptProblem nlp = 0;
1490 jpye 1529 FreeIpoptProblem(nlp); // probably a crash if you run this
1491     return 0;
1492     }
1493     """
1494    
1495     def CheckIPOPT(context):
1496     context.Message( 'Checking for IPOPT... ' )
1497    
1498     keep = KeepContext(context,"IPOPT")
1499     is_ok = context.TryLink(ipopt_test_text,".c")
1500     context.Result(is_ok)
1501    
1502     keep.restore(context)
1503    
1504     return is_ok
1505    
1506     #----------------
1507 johnpye 405 # Tcl test
1508 johnpye 404
1509 johnpye 561 # TCL and TK required version 8.1, 8.2, 8.3, or 8.4:
1510     tcltk_minor_newest_acceptable = 4
1511     tcltk_major_required = 8
1512    
1513 johnpye 404 tcl_check_text = r"""
1514     #include <tcl.h>
1515     #include <stdio.h>
1516     int main(void){
1517     printf("%s",TCL_PATCH_LEVEL);
1518     return 0;
1519     }
1520     """
1521    
1522     def CheckTcl(context):
1523 johnpye 521 return CheckExtLib(context,'tcl',tcl_check_text,static=env['STATIC_TCLTK'])
1524 johnpye 405
1525     def CheckTclVersion(context):
1526 johnpye 521 keep = KeepContext(context,'TCL',static=env['STATIC_TCLTK'])
1527 johnpye 405 context.Message("Checking Tcl version... ")
1528     (is_ok,output) = context.TryRun(tcl_check_text,'.c')
1529 johnpye 404 keep.restore(context)
1530     if not is_ok:
1531 johnpye 405 context.Result("failed to run check")
1532 johnpye 404 return 0
1533 johnpye 405
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 428 context.Result(output+" (bad version)")
1537 johnpye 405 # bad version
1538     return 0
1539    
1540     # good version
1541 johnpye 552 context.Result(output+", good")
1542 johnpye 404 return 1
1543    
1544 johnpye 405 #----------------
1545 johnpye 463 # Tk test
1546 johnpye 405
1547     tk_check_text = r"""
1548     #include <tk.h>
1549     #include <stdio.h>
1550     int main(void){
1551     printf("%s",TK_PATCH_LEVEL);
1552     return 0;
1553     }
1554     """
1555     def CheckTk(context):
1556 johnpye 673 return CheckExtLib(context,'tk',tk_check_text,static=env['STATIC_TCLTK'])
1557 johnpye 405
1558 johnpye 428
1559 johnpye 405 def CheckTkVersion(context):
1560 johnpye 521 keep = KeepContext(context,'TK',static=context.env['STATIC_TCLTK'])
1561 johnpye 405 context.Message("Checking Tk version... ")
1562 johnpye 521 #print "LINKFLAGS =",context.env['LINKFLAGS']
1563 johnpye 405 (is_ok,output) = context.TryRun(tk_check_text,'.c')
1564 johnpye 404 keep.restore(context)
1565     if not is_ok:
1566     context.Result("failed to run check")
1567     return 0
1568    
1569 wangym 511 major,minor,patch = tuple([int(i) for i in output.split(".")])
1570 johnpye 561 if major != tcltk_major_required or minor > tcltk_minor_newest_acceptable:
1571 johnpye 404 # bad version
1572 johnpye 561 context.Result(output+" (bad version)")
1573 johnpye 404 return 0
1574 johnpye 400
1575 johnpye 404 # good version
1576 johnpye 561 context.Result(output+" (good)")
1577 johnpye 404 return 1
1578 johnpye 485
1579     #----------------
1580 johnpye 521 # Tktable test
1581    
1582     tktable_check_text = r"""
1583     #include <tkTable.h>
1584     #include <stdio.h>
1585     int main(void){
1586     Table mytable;
1587     return 0;
1588     }
1589     """
1590    
1591     def CheckTkTable(context):
1592     return CheckExtLib(context,'tktable',tktable_check_text,static=env['STATIC_TCLTK'])
1593    
1594     #---------------
1595     # X11 test
1596    
1597     x11_check_text = r"""
1598     #include <X11/Xlib.h>
1599     #include <X11/IntrinsicP.h>
1600     #include <X11/Intrinsic.h>
1601     #include <X11/ObjectP.h>
1602     #include <X11/Object.h>
1603     int main(void){
1604     Object mything;
1605     return 0;
1606     }
1607     """
1608    
1609     def CheckX11(context):
1610     return CheckExtLib(context,'X11',x11_check_text)
1611    
1612     #----------------
1613 johnpye 968 # Check that we can raise and catch sigint
1614    
1615     sigint_test_text = r"""
1616     #include <signal.h>
1617     #include <setjmp.h>
1618     #include <stdlib.h>
1619     static jmp_buf g_jmpenv;
1620     void sighandler(int sig){
1621     longjmp(g_jmpenv,sig);
1622     }
1623     void testsigint(){
1624     raise(SIGINT);
1625     }
1626     int main(void){
1627     signal(SIGINT,&sighandler);
1628     switch(setjmp(g_jmpenv)){
1629     case 0:
1630     testsigint();
1631     exit(1);
1632     case SIGINT:
1633     exit(0);
1634     default:
1635     exit(2);
1636     }
1637     }
1638     """
1639    
1640     def CheckSIGINT(context):
1641     context.Message("Checking SIGINT is catchable... ")
1642     (is_ok,output)=context.TryRun(sigint_test_text,".c")
1643     context.Result(is_ok)
1644     return is_ok
1645    
1646     #----------------
1647 johnpye 953 # Check that we're able to catch floating point errors
1648    
1649     sigfpe_test_text = r"""
1650     #include <signal.h>
1651     #include <setjmp.h>
1652     #include <stdlib.h>
1653     #include <fenv.h>
1654     static jmp_buf g_jmpenv;
1655     void fpehandler(int sig){
1656     longjmp(g_jmpenv,sig);
1657     }
1658     int main(void){
1659     fenv_t myfenv;
1660     fegetenv(&myfenv);
1661     fesetenv(&myfenv);
1662     feenableexcept(FE_ALL_EXCEPT);
1663     signal(SIGFPE,&fpehandler);
1664     double x;
1665     switch(setjmp(g_jmpenv)){
1666     case 0:
1667     x = 1.0 / 0.0;
1668     /* failed to catch */
1669     exit(1);
1670     case SIGFPE:
1671     exit(0);
1672     }
1673     }
1674     """
1675    
1676     def CheckFPE(context):
1677 johnpye 968 context.Message("Checking C99 FPE behaviour... ")
1678 johnpye 953 (is_ok,output) = context.TryRun(sigfpe_test_text,'.c')
1679     context.Result(is_ok)
1680     return is_ok
1681    
1682     #----------------
1683 johnpye 968 # signal reset needed?
1684    
1685     sigreset_test_text = r"""
1686     #include <signal.h>
1687     #include <setjmp.h>
1688     #include <stdlib.h>
1689     #include <stdio.h>
1690     typedef void SigHandlerFn(int);
1691     static jmp_buf g_jmpenv;
1692     void sighandler(int sig){
1693     longjmp(g_jmpenv,sig);
1694     }
1695     void testsigint(){
1696 johnpye 1002 /* fprintf(stderr,"Raising SIGINT\n"); */
1697 johnpye 968 raise(SIGINT);
1698     }
1699     int main(void){
1700     SigHandlerFn *last,*saved;
1701     saved = signal(SIGINT,&sighandler);
1702     if(saved!=SIG_DFL){
1703 johnpye 1002 fprintf(stderr,"Default handler (%p) was not correctly set\n",SIG_DFL);
1704 johnpye 968 exit(3);
1705     }
1706     switch(setjmp(g_jmpenv)){
1707     case 0:
1708     testsigint();
1709     fprintf(stderr,"Back from SIGINT\n");
1710     exit(1);
1711     case SIGINT:
1712     break;
1713     default:
1714     exit(2);
1715     };
1716 johnpye 1002 last = signal(SIGINT,SIG_DFL);
1717 johnpye 968 if(last!=&sighandler){
1718     printf("1");
1719     exit(0);
1720     }
1721     printf("0");
1722     exit(0);
1723     }
1724     """
1725    
1726     def CheckSigReset(context):
1727     context.Message("Checking signal handler reset... ")
1728     (is_ok,output) = context.TryRun(sigreset_test_text,'.c')
1729     if not is_ok:
1730     context.Result("ERROR")
1731 johnpye 1260 return False
1732 johnpye 1002 if int(output)==1:
1733 johnpye 968 context.Result("required");
1734     context.env['ASC_RESETNEEDED'] = True
1735     else:
1736     context.Result("not required");
1737     context.env['ASC_RESETNEEDED'] = False
1738     return is_ok
1739    
1740     #----------------
1741 jpye 1442 # LyX on this system?
1742    
1743     def CheckLyx(context):
1744     context.Message("Checking for LyX... ")
1745     r = context.env.WhereIs("lyx")
1746 jpye 1469 if r:
1747     context.Result(r)
1748     else:
1749     context.Result(0)
1750 jpye 1442 return r
1751    
1752     #----------------
1753     # Latex2HTML on this system?
1754    
1755     def CheckLatex2HTML(context):
1756     context.Message("Checking for latex2html...")
1757     if context.env.WhereIs("latex2html"):
1758     r = True
1759     else:
1760     r = False
1761     context.Result(r)
1762     return r
1763    
1764     #----------------
1765 johnpye 485 # GCC Version sniffing
1766    
1767     # TODO FIXME
1768    
1769     gcc_version4 = False
1770    
1771 johnpye 398 #------------------------------------------------------
1772 johnpye 385 # CONFIGURATION
1773    
1774     conf = Configure(env
1775     , custom_tests = {
1776 jpye 1448 'CheckCC' : CheckCC
1777     , 'CheckCXX' : CheckCXX
1778     , 'CheckMath' : CheckMath
1779 johnpye 673 , 'CheckSwigVersion' : CheckSwigVersion
1780 johnpye 957 , 'CheckPythonLib' : CheckPythonLib
1781 johnpye 400 , 'CheckCUnit' : CheckCUnit
1782 johnpye 938 , 'CheckDMalloc' : CheckDMalloc
1783 jpye 1442 , 'CheckLyx' : CheckLyx
1784     , 'CheckLatex2HTML' : CheckLatex2HTML
1785 johnpye 1109 , 'CheckMFGraph' : CheckMFGraph
1786 jpye 1326 , 'CheckUFSparse' : CheckUFSparse
1787 johnpye 404 , 'CheckTcl' : CheckTcl
1788     , 'CheckTclVersion' : CheckTclVersion
1789 johnpye 405 , 'CheckTk' : CheckTk
1790     , 'CheckTkVersion' : CheckTkVersion
1791 johnpye 502 , 'CheckGcc' : CheckGcc
1792 johnpye 500 , 'CheckGccVisibility' : CheckGccVisibility
1793 johnpye 502 , 'CheckYacc' : CheckYacc
1794 johnpye 1025 , 'CheckLex' : CheckLex
1795 johnpye 521 , 'CheckTkTable' : CheckTkTable
1796     , 'CheckX11' : CheckX11
1797 johnpye 673 , 'CheckIDA' : CheckIDA
1798 jpye 1400 , 'CheckSUNDIALS' : CheckSUNDIALS
1799 johnpye 783 , 'CheckCONOPT' : CheckCONOPT
1800 jpye 1529 , 'CheckIPOPT' : CheckIPOPT
1801 johnpye 816 , 'CheckScrollkeeperConfig' : CheckScrollkeeperConfig
1802 johnpye 953 , 'CheckFPE' : CheckFPE
1803 johnpye 968 , 'CheckSIGINT' : CheckSIGINT
1804     , 'CheckSigReset' : CheckSigReset
1805 johnpye 400 # , 'CheckIsNan' : CheckIsNan
1806     # , 'CheckCppUnitConfig' : CheckCppUnitConfig
1807 johnpye 385 }
1808 johnpye 459 # , config_h = "config.h"
1809 johnpye 385 )
1810    
1811 jpye 1357 def sconsversioncheck():
1812    
1813     # uncomment the following line to skip the version check:
1814     # return 1
1815    
1816     import SCons
1817     v = SCons.__version__.split(".")
1818     if v[0] != '0':
1819     return 0
1820 jpye 1431 if int(v[1]) >= 97:
1821     return 1
1822 jpye 1357 if v[1] != '96':
1823     return 0
1824     micro = int(v[2])
1825 jpye 1394 if micro == 92 or micro == 93 or micro == 96:
1826 jpye 1357 return 1;
1827     return 0
1828    
1829     if not sconsversioncheck():
1830     print "Scons version is not OK. Please try version 0.96.92 or 0.96.93,"
1831     print "or consult the developers in the case of newer versions. Modify"
1832     print "the function 'sconsversioncheck' in the file SConstruct if you"
1833     print "want to *force* SCons to continue."
1834     Exit(1)
1835    
1836 jpye 1448 # check C compiler
1837    
1838     if not conf.CheckCC():
1839     print "Failed to build simple test file with your C compiler."
1840     print "Check your compiler is installed and running correctly."
1841     Exit(1)
1842    
1843     if not conf.CheckCXX():
1844     print "Failed to build simple test file with your C++ compiler."
1845     print "Check your compiler is installed and running correctly."
1846     Exit(1)
1847    
1848 johnpye 740 # stdio -- just to check that compiler is behaving
1849 johnpye 398
1850 johnpye 740 if not conf.CheckHeader('stdio.h'):
1851 johnpye 832 print "CPPPATH =",env.get('CPPPATH')
1852 johnpye 740 print "Did not find 'stdio.h'! Check your compiler configuration."
1853 johnpye 1080 print ""
1854     print "You environment is printed here:"
1855     for k,v in os.environ.iteritems():
1856     print "%-30s%s" % ("%s :" % k, v)
1857 johnpye 740 Exit(1)
1858    
1859 johnpye 1228 if not conf.CheckFunc('snprintf'):
1860     print "Didn't find snprintf";
1861     exit(1)
1862    
1863 johnpye 385 # Math library
1864    
1865 johnpye 1262 conf.env['HAVE_IEEE']=True
1866    
1867     if need_libm and not conf.CheckMath():
1868 johnpye 1232 conf.env['HAVE_IEEE']=False
1869 johnpye 1262 print 'Did not find math library, exiting!'
1870     Exit(1)
1871 johnpye 427
1872 johnpye 385 # Where is 'isnan'?
1873    
1874 johnpye 740 if not conf.CheckFunc('isnan') and not conf.CheckFunc('_isnan'):
1875 johnpye 385 print "Didn't find isnan"
1876 johnpye 414 # Exit(1)
1877 johnpye 385
1878 johnpye 500 # GCC visibility
1879    
1880 johnpye 502 if conf.CheckGcc():
1881     conf.env['HAVE_GCC']=True;
1882 johnpye 526 if env['WITH_GCCVISIBILITY'] and conf.CheckGccVisibility():
1883 johnpye 509 conf.env['HAVE_GCCVISIBILITY']=True;
1884     conf.env.Append(CCFLAGS=['-fvisibility=hidden'])
1885     conf.env.Append(CPPDEFINES=['HAVE_GCCVISIBILITY'])
1886 johnpye 709 conf.env.Append(CCFLAGS=['-Wall'])
1887 johnpye 500
1888 johnpye 968 # Catching SIGINT
1889    
1890 johnpye 1142 if env['WITH_SIGNALS']:
1891     if not conf.CheckSIGINT():
1892     with_signals = False
1893     without_signals_reason = "SIGINT uncatchable"
1894 johnpye 968
1895 johnpye 953 # Catching SIGFPE
1896    
1897     if conf.CheckFPE():
1898 johnpye 968 conf.env['HAVE_C99FPE']=True
1899 johnpye 953 else:
1900 johnpye 968 conf.env['HAVE_C99FPE']=False
1901 johnpye 953
1902 johnpye 968 # Checking for signal reset requirement
1903    
1904     if not conf.CheckSigReset():
1905     print "Unable to determine if signal reset is required"
1906 johnpye 1260 Exit(1)
1907 johnpye 968
1908 johnpye 502 # YACC
1909    
1910 johnpye 506 if not conf.CheckYacc():
1911     print "YACC NOT FOUND OR NOT WORKING"
1912     else:
1913 johnpye 502 conf.env['HAVE_YACC']=True
1914    
1915 johnpye 1025 if not conf.CheckLex():
1916     print "YACC NOT FOUND OR NOT WORKING"
1917     else:
1918     conf.env['HAVE_LEX']=True
1919 johnpye 502
1920 johnpye 387 # Tcl/Tk
1921 johnpye 386
1922 johnpye 586 if with_tcltk:
1923     if conf.CheckTcl():
1924     if conf.CheckTclVersion():
1925     if conf.CheckTk():
1926     if with_tcltk and conf.CheckTkVersion():
1927     if env['STATIC_TCLTK']:
1928     if conf.CheckTkTable():
1929     pass
1930     else:
1931     without_tcltk_reason = "TkTable not found"
1932     with_tcltk = False
1933     else:
1934     without_tcltk_reason = "Require Tk version <= 8.4. See 'scons -h'"
1935     with_tcltk = False
1936 johnpye 521 else:
1937 johnpye 586 without_tcltk_reason = "Tk not found."
1938 johnpye 551 with_tcltk = False
1939 johnpye 428 else:
1940 johnpye 586 without_tcltk_reason = "Require Tcl <= 8.4 Tcl."
1941 johnpye 551 with_tcltk = False
1942 johnpye 586
1943 johnpye 428 else:
1944 johnpye 586 without_tcltk_reason = "Tcl not found."
1945 johnpye 551 with_tcltk = False
1946 johnpye 386
1947 johnpye 521 if env['STATIC_TCLTK']:
1948     conf.CheckX11()
1949    
1950 johnpye 395 # Python... obviously we're already running python, so we just need to
1951     # check that we can link to the python library OK:
1952    
1953 johnpye 957 if not conf.CheckPythonLib():
1954     without_python_reason = 'libpython2.x not found or not linkable'
1955     with_python = False
1956 johnpye 982 env['WITH_PYTHON']=False
1957 johnpye 391
1958 johnpye 395 # SWIG version
1959    
1960 johnpye 957 if with_python and not conf.CheckSwigVersion():
1961 johnpye 413 without_python_reason = 'SWIG >= 1.3.24 is required'
1962     with_python = False
1963 johnpye 982 env['WITH_PYTHON']=False
1964 johnpye 413
1965 johnpye 400 # CUnit
1966    
1967 johnpye 593 if with_cunit:
1968 johnpye 404 if not conf.CheckCUnit():
1969 johnpye 427 without_cunit_reason = 'CUnit not found'
1970 johnpye 665 with_cunit = False
1971 johnpye 705 #print "CUNIT NOT FOUND, LIBS=",conf.env.get('LIBS')
1972 johnpye 427
1973 johnpye 938 # DMALLOC
1974    
1975     if with_dmalloc:
1976     if not conf.CheckDMalloc():
1977     without_dmalloc_reason = 'dmalloc not found'
1978     with_dmalloc = False
1979    
1980 jpye 1326 # MFGRAPH
1981 johnpye 1109
1982     if with_mfgraph:
1983     if not conf.CheckMFGraph():
1984     without_mfgraph_reason = 'mfgraph not found'
1985 johnpye 1113 with_mfgraph = False
1986 johnpye 1114 env['WITH_MFGRAPH'] = False
1987 johnpye 1109
1988 jpye 1326 # UFSPARSE
1989    
1990     if with_ufsparse:
1991     if not conf.CheckUFSparse():
1992     without_ufsparse_reason = 'mfgraph not found'
1993     with_ufsparse = False
1994     env['WITH_UFSPARSE'] = False
1995    
1996 johnpye 673 # IDA
1997    
1998     if not with_ida:
1999     without_ida_reason = "Not selected (see config option WITH_SOLVERS)"
2000 jpye 1400 elif not conf.CheckSUNDIALS():
2001     with_ida = False
2002     without_ida_reason = "SUNDIALS not found, or bad version"
2003 johnpye 673 elif not conf.CheckIDA():
2004     with_ida = False
2005 jpye 1400 without_ida_reason = "Unable to compile/link against SUNDIALS/IDA"
2006 johnpye 673
2007 johnpye 797 # CONOPT
2008 johnpye 783
2009     if not with_conopt:
2010     without_conopt_reason = "Not selected (see config option WITH_SOLVERS)"
2011     elif not conf.CheckCONOPT():
2012 jpye 1541 if conf.env.get('CONOPT_LINKED'):
2013     conf.env['CONOPT_LINKED'] = False
2014     # we no longer require CONOPT at buildtime in order to build support for it
2015     #with_conopt = False
2016     #without_conpt_reason = "CONOPT not found"
2017 johnpye 783
2018 jpye 1529 # IPOPT
2019    
2020     if not with_ipopt:
2021     without_ipopt_reason = "Not selected (see config option WITH_SOLVERS)"
2022     elif not conf.CheckIPOPT():
2023     with_ipopt = False
2024     without_ipopt_reason = "IPOPT not found"
2025    
2026 johnpye 427 # BLAS
2027    
2028 johnpye 459 need_blas=False
2029 johnpye 673
2030     if with_lsode:
2031     need_fortran = True
2032 johnpye 459 need_blas=True
2033 johnpye 673
2034 johnpye 459 if need_blas:
2035     if conf.CheckLib('blas'):
2036     with_local_blas = False
2037     without_local_blas_reason = "Found BLAS installed on system"
2038     else:
2039     with_local_blas = True
2040     need_fortran = True
2041 johnpye 673 else:
2042     with_local_blas= False;
2043     without_local_blas_reason = "BLAS not required"
2044 johnpye 427
2045     # FORTRAN
2046    
2047     if need_fortran:
2048 johnpye 629 conf.env.Tool('fortran')
2049 jpye 1380 detect_fortran = conf.env.Detect(['gfortran','g77'])
2050 johnpye 427 if detect_fortran:
2051     # For some reason, g77 doesn't get detected properly on MinGW
2052 johnpye 673 if not env.has_key('F77') and not env.has_key('FORTRAN'):
2053 jpye 1357 print "Fixing detection of F77 on MinGW...(?)"
2054 johnpye 427 conf.env.Replace(F77=detect_fortran)
2055     conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')
2056     conf.env.Replace(F77FLAGS='')
2057 johnpye 428 #print "F77:",conf.env['F77']
2058     #print "F77COM:",conf.env['F77COM']
2059     #print "F77FLAGS:",conf.env['F77FLAGS']
2060 johnpye 427 fortran_builder = Builder(
2061     action='$F77COM'
2062     , suffix='.o'
2063     , src_suffix='.f'
2064     )
2065     conf.env.Append(BUILDERS={'Fortran':fortran_builder})
2066 johnpye 1284 if platform.system()=="Linux":
2067     conf.env.Append(SHFORTRANFLAGS=['-fPIC'])
2068 johnpye 427 else:
2069 johnpye 673 with_lsode=False;
2070     without_lsode_reason="FORTRAN-77 required but not found"
2071 johnpye 629
2072 johnpye 464 #else:
2073     # print "FORTRAN not required"
2074 johnpye 400
2075 johnpye 673 # F2C
2076    
2077     if need_fortran:
2078     if platform.system()=="Windows":
2079 jpye 1380 pass
2080     #conf.env.Append(LIBPATH='c:\mingw\lib')
2081 johnpye 673
2082 johnpye 816 # scrollkeeper
2083 johnpye 673
2084 johnpye 816 if with_scrollkeeper:
2085     if not conf.CheckScrollkeeperConfig():
2086     with_scrollkeeper=False
2087     without_scrollkeeper_reason="unable to detect scrollkeeper-config"
2088    
2089 jpye 1442 # lyx
2090    
2091 jpye 1470 if with_doc_build:
2092 jpye 1442 if not conf.CheckLyx():
2093 jpye 1470 with_doc_build = False
2094     without_doc_build_reason="unable to locate lyx"
2095 jpye 1442
2096     with_latext2html = conf.CheckLatex2HTML()
2097    
2098 johnpye 385 # TODO: -D_HPUX_SOURCE is needed
2099    
2100     # TODO: check size of void*
2101    
2102 johnpye 393 # TODO: detect if dynamic libraries are possible or not
2103    
2104 johnpye 427 if platform.system()=="Windows" and env.has_key('MSVS'):
2105 johnpye 740 _found_windows_h = conf.CheckHeader('Windows.h')
2106    
2107     if not _found_windows_h:
2108 johnpye 741 print "Could not locate 'Windows.h' in CPPPATH. Check your configuration."
2109 johnpye 740 Exit(1)
2110 johnpye 741
2111 johnpye 534 if with_python and not conf.CheckHeader(['basetsd.h','BaseTsd.h']):
2112 johnpye 427 with_python = 0;
2113     without_python_reason = "Header file 'basetsd.h' not found. Install the MS Platform SDK."
2114    
2115 johnpye 395 conf.Finish()
2116    
2117 johnpye 507 #---------------------------------------
2118     # SUBSTITUTION DICTIONARY for .in files
2119    
2120 johnpye 658 release = env.get('RELEASE')
2121     if release=="0.":
2122     release="0"
2123    
2124 johnpye 800 #print "SUBSTITUTED CONOPT_LIBPATH:",c_escape(env.subst("$CONOPT_LIBPATH"))
2125    
2126 johnpye 507 subst_dict = {
2127     '@DEFAULT_ASCENDLIBRARY@':env['DEFAULT_ASCENDLIBRARY']
2128 jpye 1519 ,'@DEFAULT_ASCENDSOLVERS@':env['DEFAULT_ASCENDSOLVERS']
2129 johnpye 507 , '@GLADE_FILE@':'ascend.glade'
2130     , '@HELP_ROOT@':''
2131     , '@ICON_EXTENSION@':icon_extension
2132 johnpye 628 , '@INSTALL_ASCDATA@':env['INSTALL_ASCDATA']
2133 johnpye 507 , '@INSTALL_BIN@':env['INSTALL_BIN']
2134     , '@INSTALL_INCLUDE@':env['INSTALL_INCLUDE']
2135 johnpye 683 , '@INSTALL_LIB@':env['INSTALL_LIB']
2136 johnpye 721 , '@INSTALL_MODELS@':env['INSTALL_MODELS']
2137 jpye 1504 , '@INSTALL_SOLVERS@':env['INSTALL_SOLVERS']
2138 johnpye 507 , '@PYGTK_ASSETS@':env['PYGTK_ASSETS']
2139     , '@VERSION@':version
2140 johnpye 658 , '@RELEASE@':release
2141 johnpye 563 , '@DISTTAR_NAME@':env['DISTTAR_NAME']
2142 johnpye 507 , '@WEBHELPROOT@':'http://pye.dyndns.org/ascend/manual/'
2143 johnpye 1228 , '@SHLIBSUFFIX@':env['SHLIBSUFFIX']
2144     , '@SHLIBPREFIX@':env['SHLIBPREFIX']
2145 johnpye 589 , '@ASC_ENV_TK_DEFAULT@' : '$$ASCENDDIST/tcltk'
2146 johnpye 627 , '@ASC_DISTDIR_REL_BIN@' : default_rel_distdir
2147 johnpye 683 , '@PYTHON@' : python_exe
2148 jpye 1466 , '@PYVERSION@' : pyversion
2149 johnpye 800 , '@ASC_CONOPT_LIB@':env.get('CONOPT_LIB')
2150     , '@ASC_CONOPT_ENVVAR@':env.get('CONOPT_ENVVAR')
2151 jpye 1399 , '@ASC_CONOPT_DLPATH@':c_escape(env.subst("$CONOPT_DLPATH"))
2152 johnpye 1174 , '@SOURCE_ROOT@':c_escape(os.path.abspath(str(env.Dir("#"))))
2153 jpye 1535 , '@WITH_SOLVERS@':",".join(env.get('WITH_SOLVERS'))
2154 johnpye 507 }
2155    
2156 jpye 1442 if env.get('WITH_DOC'):
2157     print "WITH_DOC:",env['WITH_DOC']
2158     subst_dict['@HELP_ROOT@']=env['HELP_ROOT']
2159 johnpye 507
2160 johnpye 597 # bool options...
2161 johnpye 673 for k,v in {
2162 johnpye 1142 'ASC_WITH_IDA':with_ida
2163     ,'ASC_WITH_DMALLOC':with_dmalloc
2164     ,'ASC_WITH_MFGRAPH':with_mfgraph
2165 jpye 1326 ,'ASC_WITH_UFSPARSE':with_ufsparse
2166 johnpye 1142 ,'ASC_WITH_CONOPT':with_conopt
2167 jpye 1541 ,'ASC_LINKED_CONOPT':env.get('CONOPT_LINKED')
2168 jpye 1529 ,'ASC_WITH_IPOPT':with_ipopt
2169 johnpye 1142 ,'ASC_WITH_LSODE':with_lsode
2170     ,'ASC_WITH_MMIO':with_mmio
2171     ,'ASC_SIGNAL_TRAPS':with_signals
2172     ,'ASC_RESETNEEDED':env.get('ASC_RESETNEEDED')
2173     ,'HAVE_C99FPE':env.get('HAVE_C99FPE')
2174 johnpye 1261 ,'HAVE_IEEE':env.get('HAVE_IEEE')
2175 jpye 1412 ,'ASC_ABSOLUTE_PATHS':env.get('ABSOLUTE_PATHS')
2176 johnpye 1142 ,'ASC_XTERM_COLORS':env.get('WITH_XTERM_COLORS')
2177     ,'MALLOC_DEBUG':env.get('MALLOC_DEBUG')
2178     }.iteritems():
2179    
2180     if v: subst_dict["/\\* #define %s @%s@ \\*/" % (k,k)]='# define %s 1 ' % k
2181 johnpye 594
2182 johnpye 507 if with_python:
2183     subst_dict['@ASCXX_USE_PYTHON@']="1"
2184 johnpye 673 env['WITH_PYTHON']=1;
2185 johnpye 507
2186 jpye 1442 if with_latex2html:
2187     env['WITH_LATEX2HTML']=1
2188    
2189 johnpye 507 if env.has_key('HAVE_GCCVISIBILITY'):
2190     subst_dict['@HAVE_GCCVISIBILITY@'] = "1"
2191    
2192     env.Append(SUBST_DICT=subst_dict)
2193    
2194 johnpye 1142 #for k,v in subst_dict.iteritems():
2195     # print "%-50s%s" % ("'%s'"%k,v)
2196 johnpye 829
2197 johnpye 1142 # REMOVED: long command-line support on Win2k
2198 johnpye 829
2199     #------------------------------------------------------
2200 johnpye 558 # RECIPE: SWIG scanner
2201    
2202     import SCons.Script
2203    
2204     SWIGScanner = SCons.Scanner.ClassicCPP(
2205     "SWIGScan"
2206     , ".i"
2207     , "CPPPATH"
2208     , '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
2209     )
2210    
2211     env.Append(SCANNERS=[SWIGScanner])
2212    
2213     #------------------------------------------------------
2214 johnpye 463 # Recipe for 'CHMOD' ACTION
2215 johnpye 439
2216     import SCons
2217     from SCons.Script.SConscript import SConsEnvironment
2218     SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
2219     lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
2220    
2221     def InstallPerm(env, dest, files, perm):
2222     obj = env.Install(dest, files)
2223     for i in obj:
2224     env.AddPostAction(i, env.Chmod(str(i), perm))
2225    
2226     SConsEnvironment.InstallPerm = InstallPerm
2227    
2228     # define wrappers
2229     SConsEnvironment.InstallProgram = lambda env, dest, files: InstallPerm(env, dest, files, 0755)
2230 johnpye 578 SConsEnvironment.InstallHeader = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2231 johnpye 629 SConsEnvironment.InstallShared = lambda env, dest, files: InstallPerm(env, dest, files, 0644)
2232 johnpye 463
2233 johnpye 439 #------------------------------------------------------
2234 johnpye 463 # BUILD...
2235 johnpye 385
2236 johnpye 463 # so that #include <modulename/headername.h> works across all modules...
2237 johnpye 743 env.AppendUnique(CPPPATH=['#base/generic'])
2238 johnpye 385
2239 johnpye 508 if env['DEBUG']:
2240     env.Append(CCFLAGS=['-g'])
2241    
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     if with_installer:
2388 jpye 1467 env.Append(NSISDEFINES={
2389     'OUTFILE':"#dist/"+env['WIN_INSTALLER_NAME']
2390     ,"VERSION":version
2391     ,'PYVERSION':pyversion
2392     })
2393 jpye 1465 installer = env.Installer('installer.nsi')
2394     Depends(installer,["pygtk","tcltk","ascend.dll","models","ascend-config"])
2395     env.Alias('installer',installer)
2396 johnpye 631 else:
2397     print "Skipping... Windows installer isn't being built:",without_installer_reason
2398    
2399 jpye 1465
2400 johnpye 631 #------------------------------------------------------
2401 johnpye 673 # PROJECT FILE for MSVC
2402    
2403     env.SConscript(['base/msvc/SConscript'],['env','libascend']);
2404    
2405     #------------------------------------------------------
2406 johnpye 438 # CREATE the SPEC file for generation of RPM packages
2407    
2408 johnpye 463 if platform.system()=="Linux":
2409     env.SubstInFile('ascend.spec.in')
2410 johnpye 552
2411     #------------------------------------------------------
2412 johnpye 816 # CREATE OMF FILE FOR USE WITH SCROLLKEEPER
2413    
2414 jpye 1442 #if with_scrollkeeper:
2415     # #env.SubstInFile('#/pygtk/gnome/ascend.omf.in')
2416     # #env.InstallShared(env['INSTALL_ROOT']+env['OMFDIR'],"#/pygtk/gnome/ascend.omf")
2417 johnpye 816
2418     #------------------------------------------------------
2419 johnpye 552 # DISTRIBUTION TAR FILE
2420    
2421 johnpye 554 env['DISTTAR_FORMAT']='bz2'
2422 johnpye 556 env.Append(
2423 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']
2424 jpye 1417 , DISTTAR_EXCLUDEDIRS=['CVS','.svn','.sconf_temp', 'dist','debian']
2425 johnpye 556 )
2426 johnpye 554
2427 johnpye 563 tar = env.DistTar("dist/"+env['DISTTAR_NAME']
2428 johnpye 556 , [env.Dir('#')]
2429 johnpye 554 )
2430    
2431 johnpye 680 env.Depends(tar,'ascend.spec')
2432 jpye 1442 env.Depends(tar,'#doc/book.pdf')
2433 johnpye 680
2434 johnpye 862 Alias('dist',tar)
2435    
2436 johnpye 554 #------------------------------------------------------
2437 johnpye 816 # USER'S MANUAL
2438    
2439     env.SConscript('doc/SConscript',['env'])
2440    
2441 jpye 1442
2442 johnpye 816 #------------------------------------------------------
2443 johnpye 766 # LIBASCEND DOXYGEN DOCUMENTATION
2444    
2445 jpye 1470 if not with_doc_build:
2446     print "Skipping... Windows installer isn't being built:",without_doc_build_reason
2447    
2448 johnpye 766 env.SConscript('base/doc/SConscript',['env'])
2449    
2450     #------------------------------------------------------
2451 johnpye 554 # RPM BUILD
2452    
2453 johnpye 766 # for RPM builds, 'scons dist' then 'rpmbuild -ta dist/ascend-*.tar.bz2'
2454     # (check * for the version number used to create the tarball)
2455 johnpye 554
2456     #------------------------------------------------------
2457     # DEFAULT TARGETS
2458    
2459 jpye 1504 default_targets =['libascend','solvers']
2460 johnpye 629 if with_tcltk:
2461     default_targets.append('tcltk')
2462     if with_python:
2463     default_targets.append('pygtk')
2464 johnpye 631 if with_installer:
2465     default_targets.append('installer')
2466 johnpye 761 if with_extfns:
2467     default_targets.append('extfns')
2468 jpye 1443 if with_doc_build:
2469 jpye 1442 default_targets.append('doc')
2470 johnpye 554
2471 johnpye 629 env.Default(default_targets)
2472    
2473     print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])
2474    
2475 johnpye 705 # vim: set syntax=python:

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