29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozekdnl A macro to check the availability of systemtap user-space probes
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub HrozekAC_DEFUN([AM_CHECK_SYSTEMTAP],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek[
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_ARG_ENABLE([systemtap],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [AS_HELP_STRING([--enable-systemtap],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [Enable inclusion of systemtap trace support])],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek if test "x${ENABLE_SYSTEMTAP}" = xyes; then
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_CHECK_PROGS(DTRACE, dtrace)
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek if test -z "$DTRACE"; then
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_MSG_ERROR([dtrace not found])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek fi
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [SDT_H_FOUND='no';
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if systemtap is enabled])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek HAVE_SYSTEMTAP=1
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_ARG_WITH([tapset-install-dir],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [AS_HELP_STRING([--with-tapset-install-dir],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [The absolute path where the tapset dir will be installed])],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [if test "x${withval}" = x; then
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek tapset_dir="\$(datadir)/systemtap/tapset"
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek else
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek tapset_dir="${withval}"
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek fi],
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek [tapset_dir="\$(datadir)/systemtap/tapset"])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AC_SUBST(tapset_dir)
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek fi
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek AM_CONDITIONAL([BUILD_SYSTEMTAP], [test x$HAVE_SYSTEMTAP = x1])
29c5542feb4c45865ea61be97e0e84a1d1f04918Jakub Hrozek])