source: waflib/Tools/gfortran.py @ ce6f652

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/applefworksfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since ce6f652 was 904702d, checked in by Paul Brossier <piem@piem.org>, 10 years ago

waf, waflib: update to 1.8.7

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import re
6from waflib import Utils
7from waflib.Tools import fc,fc_config,fc_scan,ar
8from waflib.Configure import conf
9@conf
10def find_gfortran(conf):
11        fc=conf.find_program(['gfortran','g77'],var='FC')
12        conf.get_gfortran_version(fc)
13        conf.env.FC_NAME='GFORTRAN'
14@conf
15def gfortran_flags(conf):
16        v=conf.env
17        v['FCFLAGS_fcshlib']=['-fPIC']
18        v['FORTRANMODFLAG']=['-J','']
19        v['FCFLAGS_DEBUG']=['-Werror']
20@conf
21def gfortran_modifier_win32(conf):
22        fc_config.fortran_modifier_win32(conf)
23@conf
24def gfortran_modifier_cygwin(conf):
25        fc_config.fortran_modifier_cygwin(conf)
26@conf
27def gfortran_modifier_darwin(conf):
28        fc_config.fortran_modifier_darwin(conf)
29@conf
30def gfortran_modifier_platform(conf):
31        dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform()
32        gfortran_modifier_func=getattr(conf,'gfortran_modifier_'+dest_os,None)
33        if gfortran_modifier_func:
34                gfortran_modifier_func()
35@conf
36def get_gfortran_version(conf,fc):
37        version_re=re.compile(r"GNU\s*Fortran",re.I).search
38        cmd=fc+['--version']
39        out,err=fc_config.getoutput(conf,cmd,stdin=False)
40        if out:match=version_re(out)
41        else:match=version_re(err)
42        if not match:
43                conf.fatal('Could not determine the compiler type')
44        cmd=fc+['-dM','-E','-']
45        out,err=fc_config.getoutput(conf,cmd,stdin=True)
46        if out.find('__GNUC__')<0:
47                conf.fatal('Could not determine the compiler type')
48        k={}
49        out=out.split('\n')
50        import shlex
51        for line in out:
52                lst=shlex.split(line)
53                if len(lst)>2:
54                        key=lst[1]
55                        val=lst[2]
56                        k[key]=val
57        def isD(var):
58                return var in k
59        def isT(var):
60                return var in k and k[var]!='0'
61        conf.env['FC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__'])
62def configure(conf):
63        conf.find_gfortran()
64        conf.find_ar()
65        conf.fc_flags()
66        conf.fc_add_flags()
67        conf.gfortran_flags()
68        conf.gfortran_modifier_platform()
Note: See TracBrowser for help on using the repository browser.