/[ascend]/trunk/SConstruct
ViewVC logotype

Annotation of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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

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