Make Clang version detection work for clang-cl

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 28 November 2015 01:44 UTC

...which does not behave as expected with the given command line arguments, so just strip "-cl.exe" (and any hard-coded command line arguments following it in $CC, but that's probably rather harmless here). Expects that clang-cl is given with an ".exe" extension in $CC (not assuming that and stripping "-cl" and everything that might follow could be a bit too agressive).

###

diff --git a/configure.ac b/configure.ac
index 01d24e9..c02189b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3762,8 +3762,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[

if test "$COM_IS_CLANG" = TRUE; then
AC_MSG_CHECKING([the Clang version])
- clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
- CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
+ clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
+ CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)

687d97b Make Clang version detection work for clang-cl
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Upstream: cgit.freedesktop.org


  • Share