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,Errors
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['aix'].insert(0, 'fc_xlf')
19 """Find the xlf program (will look in the environment variable 'FC')"""
21 fc = conf.find_program(['xlf2003_r', 'xlf2003', 'xlf95_r', 'xlf95', 'xlf90_r', 'xlf90', 'xlf_r', 'xlf'], var='FC')
22 conf.get_xlf_version(fc)
23 conf.env.FC_NAME='XLF'
28 v['FCDEFINES_ST'] = '-WF,-D%s'
29 v['FCFLAGS_fcshlib'] = ['-qpic=small']
30 v['FCFLAGS_DEBUG'] = ['-qhalt=w']
31 v['LINKFLAGS_fcshlib'] = ['-Wl,-shared']
34 def xlf_modifier_platform(conf):
35 dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform()
36 xlf_modifier_func = getattr(conf, 'xlf_modifier_' + dest_os, None)
41 def get_xlf_version(conf, fc):
42 """Get the compiler version"""
44 cmd = fc + ['-qversion']
46 out, err = conf.cmd_and_log(cmd, output=0)
47 except Errors.WafError:
48 conf.fatal('Could not find xlf %r' % cmd)
50 for v in (r"IBM XL Fortran.* V(?P<major>\d*)\.(?P<minor>\d*)",):
51 version_re = re.compile(v, re.I).search
52 match = version_re(out or err)
55 conf.env['FC_VERSION'] = (k['major'], k['minor'])
58 conf.fatal('Could not determine the XLF version.')
66 conf.xlf_modifier_platform()