diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-05-14 09:41:12 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-05-14 17:30:04 +0530 |
commit | 5ecf37324428378ce612a8e5d4af88931c88dd0a (patch) | |
tree | 3f37a7353a88d4288a312ae2cf3a106338a145f7 | |
parent | a72159e913767a1adb021f687b202ca82d0aa06a (diff) | |
download | meson-5ecf37324428378ce612a8e5d4af88931c88dd0a.zip meson-5ecf37324428378ce612a8e5d4af88931c88dd0a.tar.gz meson-5ecf37324428378ce612a8e5d4af88931c88dd0a.tar.bz2 |
gfortran: Fix has_header implementation with GCC 10
__has_include is not accepted as a pre-processor directive in Fortran
code since GCC 10.
Closes https://github.com/mesonbuild/meson/issues/7017
-rw-r--r-- | mesonbuild/compilers/fortran.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index a83c17f..78fbace 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -208,6 +208,18 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler): def language_stdlib_only_link_flags(self): return ['-lgfortran', '-lm'] + def has_header(self, hname, prefix, env, *, extra_args=None, dependencies=None, disable_cache=False): + ''' + Derived from mixins/clike.py:has_header, but without C-style usage of + __has_include which breaks with GCC-Fortran 10: + https://github.com/mesonbuild/meson/issues/7017 + ''' + fargs = {'prefix': prefix, 'header': hname} + code = '{prefix}\n#include <{header}>' + return self.compiles(code.format(**fargs), env, extra_args=extra_args, + dependencies=dependencies, mode='preprocess', disable_cache=disable_cache) + + class ElbrusFortranCompiler(GnuFortranCompiler, ElbrusCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross, info: 'MachineInfo', exe_wrapper=None, |