~chasedouglas/frame/ubuntu-upstream-xi

« back to all changes in this revision

Viewing changes to m4/gcov.m4

  • Committer: Chase Douglas
  • Date: 2011-12-09 01:36:45 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: chase.douglas@ubuntu.com-20111209013645-n24l4myiumblzsfu
* New upstream release.
  - Version 2 adds a new API built on top of XInput multitouch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Checks for existence of coverage tools:
 
2
#  * gcov
 
3
#  * lcov
 
4
#  * genhtml
 
5
#  * gcovr
 
6
 
7
# Sets ac_cv_check_gcov to yes if tooling is present
 
8
# and reports the executables to the variables LCOV, GCOVR and GENHTML.
 
9
AC_DEFUN([AC_TDD_GCOV],
 
10
[
 
11
  AC_ARG_ENABLE(gcov,
 
12
  AS_HELP_STRING([--enable-gcov],
 
13
                 [enable coverage testing with gcov]),
 
14
  [use_gcov=$enableval], [use_gcov=no])
 
15
 
 
16
  if test "x$use_gcov" = "xyes"; then
 
17
  # we need gcc:
 
18
  if test "$GCC" != "yes"; then
 
19
    AC_MSG_ERROR([GCC is required for --enable-gcov])
 
20
  fi
 
21
 
 
22
  # Check if ccache is being used
 
23
  AC_CHECK_PROG(SHTOOL, shtool, shtool)
 
24
  case `$SHTOOL path $CC` in
 
25
    *ccache*[)] gcc_ccache=yes;;
 
26
    *[)] gcc_ccache=no;;
 
27
  esac
 
28
 
 
29
  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
 
30
    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
 
31
  fi
 
32
 
 
33
  lcov_version_list="1.6 1.7 1.8 1.9"
 
34
  AC_CHECK_PROG(LCOV, lcov, lcov)
 
35
  AC_CHECK_PROG(GENHTML, genhtml, genhtml)
 
36
  AC_CHECK_PROG(GCOVR, gcovr, gcovr)
 
37
 
 
38
  if test "$LCOV"; then
 
39
    AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
 
40
      glib_cv_lcov_version=invalid
 
41
      lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
 
42
      for lcov_check_version in $lcov_version_list; do
 
43
        if test "$lcov_version" = "$lcov_check_version"; then
 
44
          glib_cv_lcov_version="$lcov_check_version (ok)"
 
45
        fi
 
46
      done
 
47
    ])
 
48
  else
 
49
    lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
 
50
    AC_MSG_ERROR([$lcov_msg])
 
51
  fi
 
52
 
 
53
  case $glib_cv_lcov_version in
 
54
    ""|invalid[)]
 
55
      lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
 
56
      AC_MSG_ERROR([$lcov_msg])
 
57
      LCOV="exit 0;"
 
58
      ;;
 
59
  esac
 
60
 
 
61
  if test -z "$GENHTML"; then
 
62
    AC_MSG_ERROR([Could not find genhtml from the lcov package])
 
63
  fi
 
64
 
 
65
  if test -z "$GCOVR"; then
 
66
    AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])
 
67
  fi
 
68
 
 
69
  ac_cv_check_gcov=yes
 
70
 
 
71
  # Remove all optimization flags from CFLAGS
 
72
  changequote({,})
 
73
  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
 
74
  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
 
75
  changequote([,])
 
76
 
 
77
  # Add the special gcc flags
 
78
  COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
 
79
  COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"        
 
80
  COVERAGE_LDFLAGS="-lgcov"
 
81
 
 
82
  # Define verbose versions of the tools
 
83
  AC_SUBST(LCOV_verbose, '$(LCOV_verbose_$(V))')
 
84
  AC_SUBST(LCOV_verbose_, '$(LCOV_verbose_$(AM_DEFAULT_VERBOSITY))')
 
85
  AC_SUBST(LCOV_verbose_0, '@$(LCOV) --quiet')
 
86
  AC_SUBST(LCOV_verbose_1, '$(LCOV)')
 
87
 
 
88
  AC_SUBST(GENHTML_verbose, '$(GENHTML_verbose_$(V))')
 
89
  AC_SUBST(GENHTML_verbose_, '$(GENHTML_verbose_$(AM_DEFAULT_VERBOSITY))')
 
90
  AC_SUBST(GENHTML_verbose_0, '@LANG=C $(GENHTML) --quiet')
 
91
  AC_SUBST(GENHTML_verbose_1, 'LANG=C $(GENHTML)')
 
92
 
 
93
  AC_SUBST(GCOVR_verbose, '$(GCOVR_verbose_$())')
 
94
  AC_SUBST(GCOVR_verbose_, '$(GCOVR_verbose_$(AM_DEFAULT_VERBOSITY))')
 
95
  AC_SUBST(GCOVR_verbose_0, '@$(GCOVR)')
 
96
  AC_SUBST(GCOVR_verbose_1, '$(GCOVR) -v')
 
97
 
 
98
fi
 
99
]) # AC_TDD_GCOV
 
100