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 | |
---|
5 | import os,sys,imp,types,re |
---|
6 | from waflib import Utils,Configure,Options,Logs,Errors |
---|
7 | from waflib.Tools import fc |
---|
8 | fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95','ifort'],'linux':['gfortran','g95','ifort'],'java':['gfortran','g95','ifort'],'default':['gfortran'],'aix':['gfortran']} |
---|
9 | def default_compilers(): |
---|
10 | build_platform=Utils.unversioned_sys_platform() |
---|
11 | possible_compiler_list=fc_compiler.get(build_platform,fc_compiler['default']) |
---|
12 | return' '.join(possible_compiler_list) |
---|
13 | def configure(conf): |
---|
14 | try:test_for_compiler=conf.options.check_fortran_compiler or default_compilers() |
---|
15 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_fc')") |
---|
16 | for compiler in re.split('[ ,]+',test_for_compiler): |
---|
17 | conf.env.stash() |
---|
18 | conf.start_msg('Checking for %r (Fortran compiler)'%compiler) |
---|
19 | try: |
---|
20 | conf.load(compiler) |
---|
21 | except conf.errors.ConfigurationError ,e: |
---|
22 | conf.env.revert() |
---|
23 | conf.end_msg(False) |
---|
24 | Logs.debug('compiler_fortran: %r'%e) |
---|
25 | else: |
---|
26 | if conf.env['FC']: |
---|
27 | conf.end_msg(conf.env.get_flat('FC')) |
---|
28 | conf.env.COMPILER_FORTRAN=compiler |
---|
29 | break |
---|
30 | conf.end_msg(False) |
---|
31 | else: |
---|
32 | conf.fatal('could not configure a Fortran compiler!') |
---|
33 | def options(opt): |
---|
34 | test_for_compiler=default_compilers() |
---|
35 | opt.load_special_tools('fc_*.py') |
---|
36 | fortran_compiler_opts=opt.add_option_group('Configuration options') |
---|
37 | fortran_compiler_opts.add_option('--check-fortran-compiler',default=None,help='list of Fortran compiler to try [%s]'%test_for_compiler,dest="check_fortran_compiler") |
---|
38 | for x in test_for_compiler.split(): |
---|
39 | opt.load('%s'%x) |
---|