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_nag')
15 """Find the NAG Fortran Compiler (will look in the environment variable 'FC')"""
17 fc = conf.find_program(['nagfor'], var='FC')
18 conf.get_nag_version(fc)
19 conf.env.FC_NAME = 'NAG'
20 conf.env.FC_MOD_CAPITALIZATION = 'lower'
25 v.FCFLAGS_DEBUG = ['-C=all']
26 v.FCLNK_TGT_F = ['-o', '']
27 v.FC_TGT_F = ['-c', '-o', '']
30 def nag_modifier_platform(conf):
31 dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
32 nag_modifier_func = getattr(conf, 'nag_modifier_' + dest_os, None)
37 def get_nag_version(conf, fc):
38 """Get the NAG compiler version"""
40 version_re = re.compile(r"^NAG Fortran Compiler *Release *(?P<major>\d*)\.(?P<minor>\d*)", re.M).search
43 out, err = fc_config.getoutput(conf,cmd,stdin=False)
45 match = version_re(out)
47 match = version_re(err)
48 else: match = version_re(err)
50 conf.fatal('Could not determine the NAG version.')
52 conf.env['FC_VERSION'] = (k['major'], k['minor'])
60 conf.nag_modifier_platform()