/[ascend]/trunk/SConstruct
ViewVC logotype

Contents of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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

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