3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
9 from waflib import Utils, Logs
10 from waflib.Tools import fc
13 'win32' : ['gfortran','ifort'],
14 'darwin' : ['gfortran', 'g95', 'ifort'],
15 'linux' : ['gfortran', 'g95', 'ifort'],
16 'java' : ['gfortran', 'g95', 'ifort'],
17 'default': ['gfortran'],
21 Dict mapping the platform names to lists of names of Fortran compilers to try, in order of preference::
23 from waflib.Tools.compiler_c import c_compiler
24 c_compiler['linux'] = ['gfortran', 'g95', 'ifort']
27 def default_compilers():
28 build_platform = Utils.unversioned_sys_platform()
29 possible_compiler_list = fc_compiler.get(build_platform, fc_compiler['default'])
30 return ' '.join(possible_compiler_list)
34 Detects a suitable Fortran compiler
36 :raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
39 test_for_compiler = conf.options.check_fortran_compiler or default_compilers()
40 except AttributeError:
41 conf.fatal("Add options(opt): opt.load('compiler_fc')")
42 for compiler in re.split('[ ,]+', test_for_compiler):
44 conf.start_msg('Checking for %r (Fortran compiler)' % compiler)
47 except conf.errors.ConfigurationError ,e:
50 Logs.debug('compiler_fortran: %r', e)
53 conf.end_msg(conf.env.get_flat('FC'))
54 conf.env.COMPILER_FORTRAN = compiler
60 conf.fatal('could not configure a Fortran compiler!')
64 This is how to provide compiler preferences on the command-line::
66 $ waf configure --check-fortran-compiler=ifort
68 test_for_compiler = default_compilers()
69 opt.load_special_tools('fc_*.py')
70 fortran_compiler_opts = opt.add_option_group('Configuration options')
71 fortran_compiler_opts.add_option('--check-fortran-compiler', default=None,
72 help='list of Fortran compiler to try [%s]' % test_for_compiler,
73 dest="check_fortran_compiler")
75 for x in test_for_compiler.split():