From 050dcf80af99521ea8fee9dff0f71843a3e636f6 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Mon, 18 Nov 2019 12:08:40 -0500 Subject: fortran: note there is no has_function for Fortran It would be very challenging if not futile to make has_function work for Fortran. The meson.get_compiler('fortran').links() works very well instead. As a reference, CMake's check_fortran_function_exists is completely broken in general. This change raises a useful MesonException instead of giving bizarre errors. --- mesonbuild/compilers/fortran.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 0d9429785..8b2f73e3f 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -32,7 +32,7 @@ from .mixins.pgi import PGICompiler from .. import mlog from mesonbuild.mesonlib import ( - EnvironmentException, MachineChoice, LibType + EnvironmentException, MesonException, MachineChoice, LibType ) if typing.TYPE_CHECKING: @@ -51,6 +51,12 @@ class FortranCompiler(CLikeCompiler, Compiler): def get_display_language(self): return 'Fortran' + def has_function(self, funcname, prefix, env, *, extra_args=None, dependencies=None): + raise MesonException('Fortran does not have "has_function" capability.\n' + 'It is better to test if a Fortran capability is working like:\n\n' + "meson.get_compiler('fortran').links('block; end block; end program')\n\n" + 'that example is to see if the compiler has Fortran 2008 Block element.') + def sanity_check(self, work_dir: Path, environment): """ Check to be sure a minimal program can compile and execute -- cgit v1.2.3