@@ -98,6 +98,7 @@ AC_PATH_TOOL(AR, ar)
98
98
AC_PATH_TOOL ( RANLIB , ranlib )
99
99
AC_PATH_TOOL ( STRIP , strip )
100
100
AC_PATH_TOOL ( GCOV , gcov )
101
+ AC_PATH_TOOL ( LLVM_COV , llvm-cov )
101
102
AC_PATH_PROG ( LCOV , lcov )
102
103
dnl Python 3.8 is specified in .python-version and should be used if available, see doc/dependencies.md
103
104
AC_PATH_PROGS ( [ PYTHON] , [ python3.8 python3.9 python3.10 python3.11 python3.12 python3 python] )
@@ -810,16 +811,37 @@ if test x$use_lcov = xyes; then
810
811
if test x$LCOV = x; then
811
812
AC_MSG_ERROR ( "lcov testing requested but lcov not found" )
812
813
fi
813
- if test x$GCOV = x; then
814
- AC_MSG_ERROR ( "lcov testing requested but gcov not found" )
815
- fi
816
814
if test x$PYTHON = x; then
817
815
AC_MSG_ERROR ( "lcov testing requested but python not found" )
818
816
fi
819
817
if test x$GENHTML = x; then
820
818
AC_MSG_ERROR ( "lcov testing requested but genhtml not found" )
821
819
fi
822
- LCOV="$LCOV --gcov-tool=$GCOV"
820
+
821
+ AC_MSG_CHECKING ( [ whether compiler is Clang] )
822
+ AC_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [ [
823
+ #if defined(__clang__) && defined(__llvm__)
824
+ // Compiler is Clang
825
+ #else
826
+ # error Compiler is not Clang
827
+ #endif
828
+ ] ] ) ] ,[
829
+ AC_MSG_RESULT ( [ yes] )
830
+ if test x$LLVM_COV = x; then
831
+ AC_MSG_ERROR ( [ lcov testing requested but llvm-cov not found] )
832
+ fi
833
+ COV_TOOL="$LLVM_COV gcov"
834
+ ] ,[
835
+ AC_MSG_RESULT ( [ no] )
836
+ if test x$GCOV = x; then
837
+ AC_MSG_ERROR ( [ lcov testing requested but gcov not found] )
838
+ fi
839
+ COV_TOOL="$GCOV"
840
+ ] )
841
+ AC_SUBST ( COV_TOOL )
842
+ AC_SUBST ( COV_TOOL_WRAPPER , "cov_tool_wrapper.sh" )
843
+ LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
844
+
823
845
AX_CHECK_LINK_FLAG ( [ [ --coverage] ] , [ LDFLAGS="$LDFLAGS --coverage"] ,
824
846
[ AC_MSG_ERROR ( "lcov testing requested but -- coverage linker flag does not work" ) ] )
825
847
AX_CHECK_COMPILE_FLAG ( [ --coverage] ,[ CXXFLAGS="$CXXFLAGS --coverage"] ,
0 commit comments