Subject: Re: [PATCH] makefile: update detect-compiler for newer Xcode version

From: Junio C Hamano <[email-masked]>
Date: Fri, 06 Aug 2021 11:11:31 -0700

Atharva Raykar <[email-masked]> writes:

> Carlo Marcelo Arenas Belón <[email-masked]> writes:
>
> For those of us using Homebrew and using the LLVM installation from
> there, we get:
>
> $ cc --version
> Homebrew clang version 12.0.1
> ...
>> diff --git a/detect-compiler b/detect-compiler
>> index 70b754481c..c85be83c64 100755
>> --- a/detect-compiler
>> +++ b/detect-compiler
>> @@ -44,7 +44,7 @@ clang)
>>  "FreeBSD clang")
>>  	print_flags clang
>>  	;;
>> -"Apple LLVM")
>> +"Apple LLVM"|"Apple clang")
>>  	print_flags clang
>>  	;;
>>  *)
>
> So maybe we could add another case for "Homebrew clang"?

$ clang --version 2>&1 | sed -ne 's/ version .*//p'
Debian clang

It might be necessary to cope with this "$VENDOR clang version"
convention better with something like the following.

I am afraid that this patch is being a bit too aggressive about
LLVM, as I do not know if "$VENDOR LLVM version" is also a thing, or
it is just oddity only at Apple, though.

diff --git c/detect-compiler w/detect-compiler
index 70b754481c..a80442a327 100755
--- c/detect-compiler
+++ w/detect-compiler
@@ -38,13 +38,7 @@ case "$(get_family)" in
 gcc)
 	print_flags gcc
 	;;
-clang)
-	print_flags clang
-	;;
-"FreeBSD clang")
-	print_flags clang
-	;;
-"Apple LLVM")
+clang | *" clang" | *" LLVM")
 	print_flags clang
 	;;
 *)