3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # harald at klimachs.de
10 from waflib.Tools import fc, fc_config, fc_scan
11 from waflib.Configure import conf
13 from waflib.Tools.compiler_fc import fc_compiler
14 fc_compiler['linux'].append('fc_pgfortran')
17 def find_pgfortran(conf):
18 """Find the PGI fortran compiler (will look in the environment variable 'FC')"""
19 fc = conf.find_program(['pgfortran', 'pgf95', 'pgf90'], var='FC')
20 conf.get_pgfortran_version(fc)
21 conf.env.FC_NAME = 'PGFC'
24 def pgfortran_flags(conf):
26 v['FCFLAGS_fcshlib'] = ['-shared']
27 v['FCFLAGS_DEBUG'] = ['-Minform=inform', '-Mstandard'] # why not
28 v['FCSTLIB_MARKER'] = '-Bstatic'
29 v['FCSHLIB_MARKER'] = '-Bdynamic'
30 v['SONAME_ST'] = '-soname %s'
33 def get_pgfortran_version(conf,fc):
34 version_re = re.compile(r"The Portland Group", re.I).search
36 out,err = fc_config.getoutput(conf, cmd, stdin=False)
38 match = version_re(out)
40 match = version_re(err)
42 conf.fatal('Could not verify PGI signature')
43 cmd = fc + ['-help=variable']
44 out,err = fc_config.getoutput(conf, cmd, stdin=False)
45 if out.find('COMPVER')<0:
46 conf.fatal('Could not determine the compiler type')
49 out = out.splitlines()
51 lst = line.partition('=')
59 prevk = line.partition(' ')[0]
63 return var in k and k[var]!='0'
64 conf.env['FC_VERSION'] = (k['COMPVER'].split('.'))
71 conf.pgfortran_flags()