]> granicus.if.org Git - curl/commitdiff
curl-compilers.m4: fix compiler_num for clang
authorMarcel Raad <raad@teamviewer.com>
Wed, 31 May 2017 20:21:42 +0000 (22:21 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 1 Jun 2017 06:48:05 +0000 (08:48 +0200)
"clang -dumpversion" always returns "4.2.1", the GCC version that clang
was initially compatible to. Use "clang -v" instead, which returns the
actual clang version.

Fixes https://github.com/curl/curl/issues/1522
Closes https://github.com/curl/curl/pull/1523

m4/curl-compilers.m4

index 673f640979a345332c84876331c0c0c4e5d9fe4b..dcca88493fcf2cf1c878967a60e7652c452fe580 100644 (file)
@@ -84,7 +84,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
   if test "$curl_cv_have_def___clang__" = "yes"; then
     AC_MSG_RESULT([yes])
     compiler_id="CLANG"
-    clangver=`$CC -dumpversion`
+    clangver=`$CC -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/"`
     clangvhi=`echo $clangver | cut -d . -f1`
     clangvlo=`echo $clangver | cut -d . -f2`
     compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`