@@ -105,6 +105,7 @@ AC_PATH_TOOL(AR, ar)
105
105
AC_PATH_TOOL ( RANLIB , ranlib )
106
106
AC_PATH_TOOL ( STRIP , strip )
107
107
AC_PATH_TOOL ( GCOV , gcov )
108
+ AC_PATH_TOOL ( LLVM_COV , llvm-cov )
108
109
AC_PATH_PROG ( LCOV , lcov )
109
110
dnl Python 3.5 is specified in .python-version and should be used if available, see doc/dependencies.md
110
111
AC_PATH_PROGS ( [ PYTHON] , [ python3.5 python3.6 python3.7 python3.8 python3 python] )
@@ -680,16 +681,37 @@ if test x$use_lcov = xyes; then
680
681
if test x$LCOV = x; then
681
682
AC_MSG_ERROR ( "lcov testing requested but lcov not found" )
682
683
fi
683
- if test x$GCOV = x; then
684
- AC_MSG_ERROR ( "lcov testing requested but gcov not found" )
685
- fi
686
684
if test x$PYTHON = x; then
687
685
AC_MSG_ERROR ( "lcov testing requested but python not found" )
688
686
fi
689
687
if test x$GENHTML = x; then
690
688
AC_MSG_ERROR ( "lcov testing requested but genhtml not found" )
691
689
fi
692
- LCOV="$LCOV --gcov-tool=$GCOV"
690
+
691
+ AC_MSG_CHECKING ( [ whether compiler is Clang] )
692
+ AC_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [ [
693
+ #if defined(__clang__) && defined(__llvm__)
694
+ // Compiler is Clang
695
+ #else
696
+ # error Compiler is not Clang
697
+ #endif
698
+ ] ] ) ] ,[
699
+ AC_MSG_RESULT ( [ yes] )
700
+ if test x$LLVM_COV = x; then
701
+ AC_MSG_ERROR ( [ lcov testing requested but llvm-cov not found] )
702
+ fi
703
+ COV_TOOL="$LLVM_COV gcov"
704
+ ] ,[
705
+ AC_MSG_RESULT ( [ no] )
706
+ if test x$GCOV = x; then
707
+ AC_MSG_ERROR ( [ lcov testing requested but gcov not found] )
708
+ fi
709
+ COV_TOOL="$GCOV"
710
+ ] )
711
+ AC_SUBST ( COV_TOOL )
712
+ AC_SUBST ( COV_TOOL_WRAPPER , "cov_tool_wrapper.sh" )
713
+ LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
714
+
693
715
AX_CHECK_LINK_FLAG ( [ [ --coverage] ] , [ LDFLAGS="$LDFLAGS --coverage"] ,
694
716
[ AC_MSG_ERROR ( "lcov testing requested but -- coverage linker flag does not work" ) ] )
695
717
AX_CHECK_COMPILE_FLAG ( [ --coverage] ,[ CXXFLAGS="$CXXFLAGS --coverage"] ,
0 commit comments