blob: ec5d2eadaeea3f6d54a697bdbb55fa8f60cca2df [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#! /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 os,sys,imp,types
6from waflib import Utils,Configure,Options,Logs,Errors
7from waflib.Tools import fc
8fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95','ifort'],'linux':['gfortran','g95','ifort'],'java':['gfortran','g95','ifort'],'default':['gfortran'],'aix':['gfortran']}
9def __list_possible_compiler(platform):
10 try:
11 return fc_compiler[platform]
12 except KeyError:
13 return fc_compiler["default"]
14def configure(conf):
15 try:test_for_compiler=conf.options.check_fc
16 except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_fc')")
17 for compiler in test_for_compiler.split():
18 conf.env.stash()
19 conf.start_msg('Checking for %r (fortran compiler)'%compiler)
20 try:
21 conf.load(compiler)
22 except conf.errors.ConfigurationError ,e:
23 conf.env.revert()
24 conf.end_msg(False)
25 Logs.debug('compiler_fortran: %r'%e)
26 else:
27 if conf.env['FC']:
28 conf.end_msg(conf.env.get_flat('FC'))
29 conf.env.COMPILER_FORTRAN=compiler
30 break
31 conf.end_msg(False)
32 else:
33 conf.fatal('could not configure a fortran compiler!')
34def options(opt):
35 opt.load_special_tools('fc_*.py')
36 build_platform=Utils.unversioned_sys_platform()
37 detected_platform=Options.platform
38 possible_compiler_list=__list_possible_compiler(detected_platform)
39 test_for_compiler=' '.join(possible_compiler_list)
40 fortran_compiler_opts=opt.add_option_group("Fortran Compiler Options")
41 fortran_compiler_opts.add_option('--check-fortran-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following Fortran Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_fc")
42 for compiler in test_for_compiler.split():
43 opt.load('%s'%compiler)