-AC_ARG_WITH(intel_pt,
- AS_HELP_STRING([--with-intel-pt], [include Intel Processor Trace support (auto/yes/no)]),
- [], [with_intel_pt=auto])
-AC_MSG_CHECKING([whether to use intel pt])
-AC_MSG_RESULT([$with_intel_pt])
-
-if test "${with_intel_pt}" = no; then
- AC_MSG_WARN([Intel Processor Trace support disabled; some features may be unavailable.])
- HAVE_LIBIPT=no
-else
- AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
-#include <linux/perf_event.h>
-#ifndef PERF_ATTR_SIZE_VER5
-# error
-#endif
- ]])], [perf_event=yes], [perf_event=no])
- if test "$perf_event" != yes; then
- if test "$with_intel_pt" = yes; then
- AC_MSG_ERROR([linux/perf_event.h missing or too old])
- else
- AC_MSG_WARN([linux/perf_event.h missing or too old; some features may be unavailable.])
- fi
- fi
-
- AC_LIB_HAVE_LINKFLAGS([ipt], [], [#include "intel-pt.h"], [pt_insn_alloc_decoder (0);])
- if test "$HAVE_LIBIPT" != yes; then
- if test "$with_intel_pt" = yes; then
- AC_MSG_ERROR([libipt is missing or unusable])
- else
- AC_MSG_WARN([libipt is missing or unusable; some features may be unavailable.])
- fi
- else
- save_LIBS=$LIBS
- LIBS="$LIBS $LIBIPT"
- AC_CHECK_FUNCS(pt_insn_event)
- AC_CHECK_MEMBERS([struct pt_insn.enabled, struct pt_insn.resynced], [], [],
- [#include <intel-pt.h>])
- LIBS=$save_LIBS
- fi
-fi
-