From 4729aefebb98d229e542609c2b6c92545c7a69d8 Mon Sep 17 00:00:00 2001 From: Jacek Szafarkiewicz Date: Tue, 24 Jan 2023 10:15:01 +0100 Subject: [PATCH] Better way to detect clang compiler Signed-off-by: Jacek Szafarkiewicz --- dkms.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dkms.in b/dkms.in index e3a35a25..417a4082 100644 --- a/dkms.in +++ b/dkms.in @@ -1037,10 +1037,12 @@ prepare_build() done if [[ -e "${kernel_config}" ]]; then - cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' "${kernel_config}") - if command -v "$cc" >/dev/null; then - export CC="$cc" - export KERNEL_CC="$cc" + if grep -q 'CONFIG_CC_IS_CLANG=y' "${kernel_config}"; then + cc=clang + if command -v "$cc" >/dev/null; then + export CC="$cc" + export KERNEL_CC="$cc" + fi fi if grep -q 'CONFIG_LD_IS_LLD=y' "${kernel_config}"; then