14760
14774
###########################
14775
# gcov coverage reporting
14776
###########################
14778
# Checks for existence of coverage tools:
14784
# Sets ac_cv_check_gcov to yes if tooling is present
14785
# and reports the executables to the variables LCOV, GCOVR and GENHTML.
14789
# Check whether --enable-gcov was given.
14790
if test "${enable_gcov+set}" = set; then :
14791
enableval=$enable_gcov; use_gcov=$enableval
14797
if test "x$use_gcov" = "xyes"; then
14799
if test "$GCC" != "yes"; then
14800
as_fn_error $? "GCC is required for --enable-gcov" "$LINENO" 5
14803
# Check if ccache is being used
14804
# Extract the first word of "shtool", so it can be a program name with args.
14805
set dummy shtool; ac_word=$2
14806
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14807
$as_echo_n "checking for $ac_word... " >&6; }
14808
if ${ac_cv_prog_SHTOOL+:} false; then :
14809
$as_echo_n "(cached) " >&6
14811
if test -n "$SHTOOL"; then
14812
ac_cv_prog_SHTOOL="$SHTOOL" # Let the user override the test.
14814
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14815
for as_dir in $PATH
14818
test -z "$as_dir" && as_dir=.
14819
for ac_exec_ext in '' $ac_executable_extensions; do
14820
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
14821
ac_cv_prog_SHTOOL="shtool"
14822
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
14831
SHTOOL=$ac_cv_prog_SHTOOL
14832
if test -n "$SHTOOL"; then
14833
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHTOOL" >&5
14834
$as_echo "$SHTOOL" >&6; }
14836
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14837
$as_echo "no" >&6; }
14841
case `$SHTOOL path $CC` in
14842
*ccache*) gcc_ccache=yes;;
14846
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
14847
as_fn_error $? "ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1." "$LINENO" 5
14850
lcov_version_list="1.6 1.7 1.8 1.9"
14851
# Extract the first word of "lcov", so it can be a program name with args.
14852
set dummy lcov; ac_word=$2
14853
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14854
$as_echo_n "checking for $ac_word... " >&6; }
14855
if ${ac_cv_prog_LCOV+:} false; then :
14856
$as_echo_n "(cached) " >&6
14858
if test -n "$LCOV"; then
14859
ac_cv_prog_LCOV="$LCOV" # Let the user override the test.
14861
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14862
for as_dir in $PATH
14865
test -z "$as_dir" && as_dir=.
14866
for ac_exec_ext in '' $ac_executable_extensions; do
14867
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
14868
ac_cv_prog_LCOV="lcov"
14869
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
14878
LCOV=$ac_cv_prog_LCOV
14879
if test -n "$LCOV"; then
14880
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5
14881
$as_echo "$LCOV" >&6; }
14883
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14884
$as_echo "no" >&6; }
14888
# Extract the first word of "genhtml", so it can be a program name with args.
14889
set dummy genhtml; ac_word=$2
14890
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14891
$as_echo_n "checking for $ac_word... " >&6; }
14892
if ${ac_cv_prog_GENHTML+:} false; then :
14893
$as_echo_n "(cached) " >&6
14895
if test -n "$GENHTML"; then
14896
ac_cv_prog_GENHTML="$GENHTML" # Let the user override the test.
14898
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14899
for as_dir in $PATH
14902
test -z "$as_dir" && as_dir=.
14903
for ac_exec_ext in '' $ac_executable_extensions; do
14904
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
14905
ac_cv_prog_GENHTML="genhtml"
14906
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
14915
GENHTML=$ac_cv_prog_GENHTML
14916
if test -n "$GENHTML"; then
14917
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5
14918
$as_echo "$GENHTML" >&6; }
14920
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14921
$as_echo "no" >&6; }
14926
if test "$LCOV"; then
14927
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lcov version" >&5
14928
$as_echo_n "checking for lcov version... " >&6; }
14929
if ${glib_cv_lcov_version+:} false; then :
14930
$as_echo_n "(cached) " >&6
14933
glib_cv_lcov_version=invalid
14934
lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
14935
for lcov_check_version in $lcov_version_list; do
14936
if test "$lcov_version" = "$lcov_check_version"; then
14937
glib_cv_lcov_version="$lcov_check_version (ok)"
14942
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_lcov_version" >&5
14943
$as_echo "$glib_cv_lcov_version" >&6; }
14945
lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
14946
as_fn_error $? "$lcov_msg" "$LINENO" 5
14949
case $glib_cv_lcov_version in
14951
lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
14952
as_fn_error $? "$lcov_msg" "$LINENO" 5
14957
if test -z "$GENHTML"; then
14958
as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5
14961
ac_cv_check_gcov=yes
14962
ac_cv_check_lcov=yes
14964
# Remove all optimization flags from CFLAGS
14966
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
14969
# Add the special gcc flags
14970
COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
14971
COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
14972
COVERAGE_LDFLAGS="-lgcov"
14974
# Check availability of gcovr
14975
# Extract the first word of "gcovr", so it can be a program name with args.
14976
set dummy gcovr; ac_word=$2
14977
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14978
$as_echo_n "checking for $ac_word... " >&6; }
14979
if ${ac_cv_prog_GCOVR+:} false; then :
14980
$as_echo_n "(cached) " >&6
14982
if test -n "$GCOVR"; then
14983
ac_cv_prog_GCOVR="$GCOVR" # Let the user override the test.
14985
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14986
for as_dir in $PATH
14989
test -z "$as_dir" && as_dir=.
14990
for ac_exec_ext in '' $ac_executable_extensions; do
14991
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
14992
ac_cv_prog_GCOVR="gcovr"
14993
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15002
GCOVR=$ac_cv_prog_GCOVR
15003
if test -n "$GCOVR"; then
15004
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCOVR" >&5
15005
$as_echo "$GCOVR" >&6; }
15007
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
15008
$as_echo "no" >&6; }
15012
if test -z "$GCOVR"; then
15013
ac_cv_check_gcovr=no
15015
ac_cv_check_gcovr=yes
15020
if test "x$ac_cv_check_gcov" = xyes; then
15022
HAVE_GCOV_FALSE='#'
15028
if test "x$ac_cv_check_lcov" = xyes; then
15030
HAVE_LCOV_FALSE='#'
15036
if test "x$ac_cv_check_gcovr" = xyes; then
15038
HAVE_GCOVR_FALSE='#'
15040
HAVE_GCOVR_TRUE='#'
15047
###########################
14762
15049
###########################