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'].insert(0, 'fc_open64')
14 def find_openf95(conf):
15 """Find the Open64 Fortran Compiler (will look in the environment variable 'FC')"""
17 fc = conf.find_program(['openf95', 'openf90'], var='FC')
18 conf.get_open64_version(fc)
19 conf.env.FC_NAME = 'OPEN64'
20 conf.env.FC_MOD_CAPITALIZATION = 'UPPER.mod'
23 def openf95_flags(conf):
25 v['FCFLAGS_DEBUG'] = ['-fullwarn']
28 def openf95_modifier_platform(conf):
29 dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
30 openf95_modifier_func = getattr(conf, 'openf95_modifier_' + dest_os, None)
31 if openf95_modifier_func:
32 openf95_modifier_func()
35 def get_open64_version(conf, fc):
36 """Get the Open64 compiler version"""
38 version_re = re.compile(r"Open64 Compiler Suite: *Version *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
39 cmd = fc + ['-version']
41 out, err = fc_config.getoutput(conf,cmd,stdin=False)
43 match = version_re(out)
45 match = version_re(err)
47 conf.fatal('Could not determine the Open64 version.')
49 conf.env['FC_VERSION'] = (k['major'], k['minor'])
57 conf.openf95_modifier_platform()