Allow for vendor prefix on clang version numbers.

Correctly detects the version of OpenBSD's native clang, as well as
Apple's.  Spotted tb@, ok djm@.
This commit is contained in:
Darren Tucker 2023-11-21 14:02:18 +11:00
parent c52db01148
commit 2a19e02f36
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -189,10 +189,11 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
AC_MSG_CHECKING([clang version])
ver="`$CC -v 2>&1`"
if echo "$ver" | grep "Apple" >/dev/null; then
CLANG_VER="apple-`echo "$ver" | \
awk '/Apple LLVM/ {print $4"-"$5}'`"
CLANG_VER=apple-`echo "$ver" | grep 'clang version' | \
$SED 's/.*clang version //g' | $AWK '{print $1}'`
else
CLANG_VER=`echo "$ver" | $AWK '/clang version /{print $3}'`
CLANG_VER=`echo "$ver" | grep 'clang version' | \
$SED 's/.*clang version //g' | $AWK '{print $1}'`
fi
AC_MSG_RESULT([$CLANG_VER])