diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-09-25 10:28:37 -0700 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-01-27 09:38:53 -0800 |
| commit | 1eaab0253bea69432d69a1eddab377fbbd9ed74d (patch) | |
| tree | 2f2c3e34b36f7a43cf9d8a571e5d16f26a0eac31 /mesonbuild/compilers/detect.py | |
| parent | d6e54b499cb2b7a533e6b1ad97637b8155c0a66c (diff) | |
| download | meson-1eaab0253bea69432d69a1eddab377fbbd9ed74d.tar.gz | |
compilers: Check if GCC has support for ObjC and/or ObjC++
Since this is optional, we should not accept that GCC is a valid ObjC or
G++ is a valid ObjC++ Compiler unless we've tested that they can
actually do a basic compile.
This requires fixing a number of tests that have broken assumptions. In
some cases I've split tests where issues with one language would hide
the other. It would be great if we had a competent test framework that
allowed subtests to skip, unfortunately we have python's unittest
instead. Because of that we can't avoid extra tests by use of subtests.
Diffstat (limited to 'mesonbuild/compilers/detect.py')
| -rw-r--r-- | mesonbuild/compilers/detect.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 7bd48d10c..d4ad4bade 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -897,9 +897,13 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', lang: str, for_machine: version = _get_gnu_version_from_defines(defines) comp = objc.GnuObjCCompiler if lang == 'objc' else objcpp.GnuObjCPPCompiler linker = guess_nix_linker(env, compiler, comp, version, for_machine) - return comp( + c = comp( ccache, compiler, version, for_machine, is_cross, info, defines, linker=linker) + if not c.compiles('int main(void) { return 0; }', env)[0]: + popen_exceptions[join_args(compiler)] = f'GCC was not built with support for {"objective-c" if lang == "objc" else "objective-c++"}' + continue + return c if 'clang' in out: linker = None defines = _get_clang_compiler_defines(compiler, lang) |
