3 # harald at klimachs.de
6 from waflib
import Utils
7 from waflib
.Tools
import fc
,fc_config
,fc_scan
8 from waflib
.Configure
import conf
10 from waflib
.Tools
.compiler_fc
import fc_compiler
11 fc_compiler
['linux'].append('fc_solstudio')
14 def find_solstudio(conf
):
15 """Find the Solaris Studio compiler (will look in the environment variable 'FC')"""
17 fc
= conf
.find_program(['sunf95', 'f95', 'sunf90', 'f90'], var
='FC')
18 conf
.get_solstudio_version(fc
)
19 conf
.env
.FC_NAME
= 'SOL'
22 def solstudio_flags(conf
):
24 v
['FCFLAGS_fcshlib'] = ['-Kpic']
25 v
['FCFLAGS_DEBUG'] = ['-w3']
26 v
['LINKFLAGS_fcshlib'] = ['-G']
27 v
['FCSTLIB_MARKER'] = '-Bstatic'
28 v
['FCSHLIB_MARKER'] = '-Bdynamic'
29 v
['SONAME_ST'] = '-h %s'
32 def solstudio_modifier_platform(conf
):
33 dest_os
= conf
.env
['DEST_OS'] or Utils
.unversioned_sys_platform()
34 solstudio_modifier_func
= getattr(conf
, 'solstudio_modifier_' + dest_os
, None)
35 if solstudio_modifier_func
:
36 solstudio_modifier_func()
39 def get_solstudio_version(conf
, fc
):
40 """Get the compiler version"""
42 version_re
= re
.compile(r
"Sun Fortran 95 *(?P<major>\d*)\.(?P<minor>\d*)", re
.I
).search
45 out
, err
= fc_config
.getoutput(conf
,cmd
,stdin
=False)
47 match
= version_re(out
)
49 match
= version_re(err
)
51 conf
.fatal('Could not determine the Sun Studio Fortran version.')
53 conf
.env
['FC_VERSION'] = (k
['major'], k
['minor'])
60 conf
.solstudio_flags()
61 conf
.solstudio_modifier_platform()