1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/linux.m4 Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public 1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +AC_DEFUN([MOZ_LINUX_PERF_EVENT], 1.9 +[ 1.10 + 1.11 +MOZ_ARG_WITH_STRING(linux-headers, 1.12 +[ --with-linux-headers=DIR 1.13 + location where the Linux kernel headers can be found], 1.14 + linux_headers=$withval) 1.15 + 1.16 +LINUX_HEADERS_INCLUDES= 1.17 + 1.18 +if test "$linux_headers"; then 1.19 + LINUX_HEADERS_INCLUDES="-I$linux_headers" 1.20 +fi 1.21 + 1.22 +_SAVE_CFLAGS="$CFLAGS" 1.23 +CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES" 1.24 + 1.25 +dnl Performance measurement headers. 1.26 +MOZ_CHECK_HEADER(linux/perf_event.h, 1.27 + [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open, 1.28 + [AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);], 1.29 + ac_cv_perf_event_open=yes, 1.30 + ac_cv_perf_event_open=no)])]) 1.31 +if test "$ac_cv_perf_event_open" = "yes"; then 1.32 + HAVE_LINUX_PERF_EVENT_H=1 1.33 +else 1.34 + HAVE_LINUX_PERF_EVENT_H= 1.35 + LINUX_HEADERS_INCLUDES= 1.36 +fi 1.37 +AC_SUBST(HAVE_LINUX_PERF_EVENT_H) 1.38 +AC_SUBST(LINUX_HEADERS_INCLUDES) 1.39 + 1.40 +CFLAGS="$_SAVE_CFLAGS" 1.41 + 1.42 +])