summaryrefslogtreecommitdiff
path: root/build/configure.ac.analysis
blob: f0d41dfdd25707fb0489e08640039ccfe19d6a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
dnl ===========================================================================
dnl
dnl LCOV
dnl
cairo_has_lcov=no
AC_ARG_ENABLE(gcov,
  AS_HELP_STRING([--enable-gcov],
		 [Enable gcov]),
  [use_gcov=$enableval], [use_gcov=no])

if test "x$use_gcov" = "xyes"; then
  dnl we need gcc:
  if test "$GCC" != "yes"; then
    AC_MSG_ERROR([GCC is required for --enable-gcov])
  fi

  dnl Check if ccache is being used
  AC_CHECK_PROG(SHTOOL, shtool, shtool)
  case `$SHTOOL path $CC` in
    *ccache*[)] gcc_ccache=yes;;
    *[)] gcc_ccache=no;;
  esac

  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
  fi

  ltp_version_list="1.6 1.5 1.4"
  AC_CHECK_PROG(LTP, lcov, lcov)
  AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)

  if test "$LTP"; then
    AC_CACHE_CHECK([for ltp version], cairo_cv_ltp_version, [
      cairo_cv_ltp_version=invalid
      ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
      for ltp_check_version in $ltp_version_list; do
        if test "$ltp_version" = "$ltp_check_version"; then
          cairo_cv_ltp_version="$ltp_check_version (ok)"
        fi
      done
    ])
  fi

  case $cairo_cv_ltp_version in
    ""|invalid[)]
      ;;
    *)
      cairo_has_lcov=yes
      ;;
  esac

  if test "x$cairo_has_lcov" != "xyes"; then
    AC_MSG_ERROR([[To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list.
Please install the Linux Test Project [http://ltp.sourceforge.net/], and try again.]])
   fi

  if test -z "$LTP_GENHTML"; then
    AC_MSG_ERROR([[Could not find genhtml from the LTP package.
Please install the Linux Test Project [http://ltp.sourceforge.net/], and try again.]])
  fi

  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
dnl  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir)

  dnl Remove all optimization flags from CFLAGS
  changequote({,})
  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
  CAIRO_CFLAGS=`echo "$CAIRO_CFLAGS" | $SED -e 's/-O[0-9]*//g'`
  changequote([,])

  dnl Add the special gcc flags
  dnl In order to workaround a debian bug in libtool where they strip
  dnl $dependency_libs from the link line and CFLAGS, we need to pass
  dnl --coverage via LDFLAGS.
  CAIRO_CC_TRY_FLAG([--coverage], [CAIRO_CFLAGS="$CAIRO_CFLAGS -O0 --coverage"])
fi
AM_CONDITIONAL(CAIRO_HAS_LCOV, test "x$cairo_has_lcov" = "xyes")