Skip to content

Commit

Permalink
Better way to detect clang compiler
Browse files Browse the repository at this point in the history
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
  • Loading branch information
hadogenes committed Jan 24, 2023
1 parent 4840099 commit 4729aef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4729aef

Please sign in to comment.