michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: AC_DEFUN([MOZ_LINUX_PERF_EVENT], michael@0: [ michael@0: michael@0: MOZ_ARG_WITH_STRING(linux-headers, michael@0: [ --with-linux-headers=DIR michael@0: location where the Linux kernel headers can be found], michael@0: linux_headers=$withval) michael@0: michael@0: LINUX_HEADERS_INCLUDES= michael@0: michael@0: if test "$linux_headers"; then michael@0: LINUX_HEADERS_INCLUDES="-I$linux_headers" michael@0: fi michael@0: michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES" michael@0: michael@0: dnl Performance measurement headers. michael@0: MOZ_CHECK_HEADER(linux/perf_event.h, michael@0: [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open, michael@0: [AC_TRY_COMPILE([#include ],[return sizeof(__NR_perf_event_open);], michael@0: ac_cv_perf_event_open=yes, michael@0: ac_cv_perf_event_open=no)])]) michael@0: if test "$ac_cv_perf_event_open" = "yes"; then michael@0: HAVE_LINUX_PERF_EVENT_H=1 michael@0: else michael@0: HAVE_LINUX_PERF_EVENT_H= michael@0: LINUX_HEADERS_INCLUDES= michael@0: fi michael@0: AC_SUBST(HAVE_LINUX_PERF_EVENT_H) michael@0: AC_SUBST(LINUX_HEADERS_INCLUDES) michael@0: michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: michael@0: ])