From 8739e1c3bef653415ad4b9b9c318ccfa76c43da6 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 31 Mar 2022 15:00:24 -0700 Subject: [PATCH] Check for clang before guessing gcc or lcc clang --version can yield a string like below when its installed into such a directory clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9) Target: aarch64-yoe-linux Thread model: posix InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux as you can see InstallDir has 'xt-' subtring and this trips the check to guess gcc if 'Free Software Foundation' in out or 'xt-' in out: Therefore, check if compiler is clang then there is no point of running this check anyway. Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/10218] Signed-off-by: Khem Raj --- mesonbuild/compilers/detect.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 53948b01a..ba335cf39 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -427,13 +427,14 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin version = search_version(out) guess_gcc_or_lcc: T.Optional[str] = None - if 'Free Software Foundation' in out or 'xt-' in out: - guess_gcc_or_lcc = 'gcc' - if 'e2k' in out and 'lcc' in out: - guess_gcc_or_lcc = 'lcc' - if 'Microchip Technology' in out: - # this output has "Free Software Foundation" in its version - guess_gcc_or_lcc = None + if not 'clang' in compiler_name: + if 'Free Software Foundation' in out or 'xt-' in out: + guess_gcc_or_lcc = 'gcc' + if 'e2k' in out and 'lcc' in out: + guess_gcc_or_lcc = 'lcc' + if 'Microchip Technology' in out: + # this output has "Free Software Foundation" in its version + guess_gcc_or_lcc = None if guess_gcc_or_lcc: defines = _get_gnu_compiler_defines(compiler) -- 2.35.1