ctdb-scripts: Support storing statd-callout state in cluster filesystem
[samba4-gss.git] / third_party / waf / waflib / Tools / g95.py
blobf69ba4f3678280ece65e5453d9b7aac17ab63357
1 #! /usr/bin/env python
2 # encoding: utf-8
3 # KWS 2010
4 # Thomas Nagy 2016-2018 (ita)
6 import re
7 from waflib import Utils
8 from waflib.Tools import fc, fc_config, fc_scan, ar
9 from waflib.Configure import conf
11 @conf
12 def find_g95(conf):
13 fc = conf.find_program('g95', var='FC')
14 conf.get_g95_version(fc)
15 conf.env.FC_NAME = 'G95'
17 @conf
18 def g95_flags(conf):
19 v = conf.env
20 v.FCFLAGS_fcshlib = ['-fPIC']
21 v.FORTRANMODFLAG = ['-fmod=', ''] # template for module path
22 v.FCFLAGS_DEBUG = ['-Werror'] # why not
24 @conf
25 def g95_modifier_win32(conf):
26 fc_config.fortran_modifier_win32(conf)
28 @conf
29 def g95_modifier_cygwin(conf):
30 fc_config.fortran_modifier_cygwin(conf)
32 @conf
33 def g95_modifier_darwin(conf):
34 fc_config.fortran_modifier_darwin(conf)
36 @conf
37 def g95_modifier_platform(conf):
38 dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform()
39 g95_modifier_func = getattr(conf, 'g95_modifier_' + dest_os, None)
40 if g95_modifier_func:
41 g95_modifier_func()
43 @conf
44 def get_g95_version(conf, fc):
45 """get the compiler version"""
47 version_re = re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
48 cmd = fc + ['--version']
49 out, err = fc_config.getoutput(conf, cmd, stdin=False)
50 if out:
51 match = version_re(out)
52 else:
53 match = version_re(err)
54 if not match:
55 conf.fatal('cannot determine g95 version')
56 k = match.groupdict()
57 conf.env.FC_VERSION = (k['major'], k['minor'])
59 def configure(conf):
60 conf.find_g95()
61 conf.find_ar()
62 conf.fc_flags()
63 conf.fc_add_flags()
64 conf.g95_flags()
65 conf.g95_modifier_platform()