Commit 2eb1115e126bf4b1f2aecc3faa68d477b8e2eb2e

Authored by Georg Hopp
1 parent b478943e

add missing m4 macros

Showing 2 changed files with 95 additions and 0 deletions
  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 + AM_CONDITIONAL(HAVE_GCOV, test "x$use_gcov" = "xyes")
  16 +
  17 + if test "x$use_gcov" = "xyes"; then
  18 + # we need gcc:
  19 + if test "$GCC" != "yes"; then
  20 + AC_MSG_ERROR([GCC is required for --enable-gcov])
  21 + fi
  22 +
  23 + # Check if ccache is being used
  24 + AC_CHECK_PROG(SHTOOL, shtool, shtool)
  25 + case `$SHTOOL path $CC` in
  26 + *ccache*[)] gcc_ccache=yes;;
  27 + *[)] gcc_ccache=no;;
  28 + esac
  29 +
  30 + if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
  31 + AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
  32 + fi
  33 +
  34 + lcov_version_list="1.6 1.7 1.8 1.9 1.10"
  35 + AC_CHECK_PROG(LCOV, lcov, lcov)
  36 + AC_CHECK_PROG(GENHTML, genhtml, genhtml)
  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 + # Remove all optimization flags from CFLAGS
  66 + changequote({,})
  67 + CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
  68 + changequote([,])
  69 +
  70 + # Add the special gcc flags
  71 + COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
  72 + COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
  73 + COVERAGE_LDFLAGS="-lgcov"
  74 + AC_SUBST(COVERAGE_CFLAGS)
  75 + AC_SUBST(COVERAGE_CXXFLAGS)
  76 + AC_SUBST(COVERAGE_LDFLAGS)
  77 +
  78 +fi
  79 +]) # AC_TDD_GCOV
  80 +
... ...
  1 +AC_DEFUN([AC_OPENSSL],
  2 +[
  3 + AC_ARG_ENABLE(openssl,
  4 + AC_HELP_STRING([--disable-openssl],
  5 + [disable usage of openssl]))
  6 +
  7 + AS_IF([test "x$enable_openssl" != "xno"], [
  8 + AC_MSG_NOTICE("Use openssl if available")
  9 + m4_include([m4/ax_check_openssl.m4])
  10 + AX_CHECK_OPENSSL([OPENSSL="-DHAS_OPENSSL"],[OPENSSL=""])
  11 + AC_SUBST([OPENSSL])
  12 + ])
  13 +])
  14 +
  15 +# vim: set ft=m4 ts=2 sw=2:
... ...
Please register or login to post a comment