diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-03-19 20:44:51 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2019-03-27 10:54:56 -0400 |
commit | f4da210f464446d92600456508439d2f926e6cea (patch) | |
tree | 453a9a73eebc21dc055e20fa3911c0093d265245 /mesonbuild/compilers/fortran.py | |
parent | b565eff084faeea8a8952ec2c1fe40483705aaef (diff) | |
download | meson-f4da210f464446d92600456508439d2f926e6cea.tar.gz |
Sanity check with external args
Previously cross, but not native, external args were used. Then in
d451a4bd97f827bb492fd0c0e357cb20b6056ed9 the cross special cases were
removed, so external args are never used.
This commit switches that so they are always used. Sanity checking works
just the same as compiler checks like has header / has library.
Diffstat (limited to 'mesonbuild/compilers/fortran.py')
-rw-r--r-- | mesonbuild/compilers/fortran.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index a16f2b554..5afbb3d32 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -31,7 +31,9 @@ from .compilers import ( PGICompiler ) -from mesonbuild.mesonlib import EnvironmentException, is_osx, LibType +from mesonbuild.mesonlib import ( + EnvironmentException, MachineChoice, is_osx, LibType +) class FortranCompiler(Compiler): @@ -79,7 +81,13 @@ class FortranCompiler(Compiler): binary_name = os.path.join(work_dir, 'sanitycheckf') with open(source_name, 'w') as ofile: ofile.write('print *, "Fortran compilation is working."; end') - pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name]) + if environment.is_cross_build() and not self.is_cross: + for_machine = MachineChoice.BUILD + else: + for_machine = MachineChoice.HOST + extra_flags = environment.coredata.get_external_args(for_machine, self.language) + extra_flags += environment.coredata.get_external_link_args(for_machine, self.language) + pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name]) pc.wait() if pc.returncode != 0: raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) @@ -223,6 +231,9 @@ class FortranCompiler(Compiler): def gen_import_library_args(self, implibname): return CCompiler.gen_import_library_args(self, implibname) + def _get_basic_compiler_args(self, env, mode): + return CCompiler._get_basic_compiler_args(self, env, mode) + def _get_compiler_check_args(self, env, extra_args, dependencies, mode='compile'): return CCompiler._get_compiler_check_args(self, env, extra_args, dependencies, mode='compile') |