3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # harald at klimachs.de
10 from waflib import Utils
11 from waflib.Tools import fc,fc_config,fc_scan
12 from waflib.Configure import conf
14 from waflib.Tools.compiler_fc import fc_compiler
15 fc_compiler['linux'].append('fc_solstudio')
18 def find_solstudio(conf):
19 """Find the Solaris Studio compiler (will look in the environment variable 'FC')"""
21 fc = conf.find_program(['sunf95', 'f95', 'sunf90', 'f90'], var='FC')
22 conf.get_solstudio_version(fc)
23 conf.env.FC_NAME = 'SOL'
26 def solstudio_flags(conf):
28 v['FCFLAGS_fcshlib'] = ['-Kpic']
29 v['FCFLAGS_DEBUG'] = ['-w3']
30 v['LINKFLAGS_fcshlib'] = ['-G']
31 v['FCSTLIB_MARKER'] = '-Bstatic'
32 v['FCSHLIB_MARKER'] = '-Bdynamic'
33 v['SONAME_ST'] = '-h %s'
36 def solstudio_modifier_platform(conf):
37 dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
38 solstudio_modifier_func = getattr(conf, 'solstudio_modifier_' + dest_os, None)
39 if solstudio_modifier_func:
40 solstudio_modifier_func()
43 def get_solstudio_version(conf, fc):
44 """Get the compiler version"""
46 version_re = re.compile(r"Sun Fortran 95 *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
49 out, err = fc_config.getoutput(conf,cmd,stdin=False)
51 match = version_re(out)
53 match = version_re(err)
55 conf.fatal('Could not determine the Sun Studio Fortran version.')
57 conf.env['FC_VERSION'] = (k['major'], k['minor'])
64 conf.solstudio_flags()
65 conf.solstudio_modifier_platform()