[ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
AC_SUBST(ABS_TAPSET_DIR)
+dnl ************************************
+dnl *** Enable lcov coverage reports ***
+dnl ************************************
+
+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.7 1.8"
+ AC_CHECK_PROG(LTP, lcov, lcov)
+ AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
+
+ if test "$LTP"; then
+ AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
+ glib_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
+ glib_cv_ltp_version="$ltp_check_version (ok)"
+ fi
+ done
+ ])
+ else
+ ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
+ AC_MSG_ERROR([$ltp_msg])
+ fi
+
+ case $glib_cv_ltp_version in
+ ""|invalid[)]
+ ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
+ AC_MSG_ERROR([$ltp_msg])
+ LTP="exit 0;"
+ ;;
+ esac
+
+ if test -z "$LTP_GENHTML"; then
+ AC_MSG_ERROR([Could not find genhtml from the LTP package])
+ fi
+
+ AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
+
+ dnl Remove all optimization flags from CFLAGS
+ changequote({,})
+ CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
+ changequote([,])
+
+ dnl Add the special gcc flags
+ CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -lgcov"
+fi
+
dnl ******************************
dnl *** output the whole stuff ***
dnl ******************************
AC_SUBST(DBUS1_LIBS)
AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
+dnl
+dnl Check for -Bsymbolic-functions linker flag used to avoid
+dnl intra-library PLT jumps, if available.
+dnl
+SAVED_LDFLAGS="${LDFLAGS}"
+AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
+LDFLAGS=-Wl,-Bsymbolic-functions
+AC_TRY_LINK([], [int main (void) { return 0; }],
+ GLIB_LINK_FLAGS=-Wl[,]-Bsymbolic-functions
+ AC_MSG_RESULT(yes),
+ GLIB_LINK_FLAGS=
+ AC_MSG_RESULT(no))
+AC_SUBST(GLIB_LINK_FLAGS)
+LDFLAGS="${SAVED_LDFLAGS}"
+
AC_CONFIG_FILES([
glib-2.0.pc
glib-2.0-uninstalled.pc