Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 778740 - Allow to use Linux kernel headers for perf events. r=khuey

  • Loading branch information...
commit 1f7f9c224d581f5184add04733c2eb52826bb705 1 parent ab6598a
Mike Hommey authored August 04, 2012
1  aclocal.m4
@@ -23,6 +23,7 @@ builtin(include, build/autoconf/expandlibs.m4)dnl
23 23
 builtin(include, build/autoconf/arch.m4)dnl
24 24
 builtin(include, build/autoconf/android.m4)dnl
25 25
 builtin(include, build/autoconf/zlib.m4)dnl
  26
+builtin(include, build/autoconf/linux.m4)dnl
26 27
 
27 28
 MOZ_PROG_CHECKMSYS()
28 29
 
39  build/autoconf/linux.m4
... ...
@@ -0,0 +1,39 @@
  1
+dnl This Source Code Form is subject to the terms of the Mozilla Public
  2
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  3
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4
+
  5
+AC_DEFUN([MOZ_LINUX_PERF_EVENT],
  6
+[
  7
+
  8
+MOZ_ARG_WITH_STRING(linux-headers,
  9
+[  --with-linux-headers=DIR
  10
+                          location where the Linux kernel headers can be found],
  11
+    linux_headers=$withval)
  12
+
  13
+LINUX_HEADERS_INCLUDES=
  14
+
  15
+if test "$linux_headers"; then
  16
+    LINUX_HEADERS_INCLUDES="-I$linux_headers"
  17
+fi
  18
+
  19
+_SAVE_CFLAGS="$CFLAGS"
  20
+CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES"
  21
+
  22
+dnl Performance measurement headers.
  23
+MOZ_CHECK_HEADER(linux/perf_event.h,
  24
+    [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
  25
+        [AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);],
  26
+        ac_cv_perf_event_open=yes,
  27
+        ac_cv_perf_event_open=no)])])
  28
+if test "$ac_cv_perf_event_open" = "yes"; then
  29
+    HAVE_LINUX_PERF_EVENT_H=1
  30
+else
  31
+    HAVE_LINUX_PERF_EVENT_H=
  32
+    LINUX_HEADERS_INCLUDES=
  33
+fi
  34
+AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
  35
+AC_SUBST(LINUX_HEADERS_INCLUDES)
  36
+
  37
+CFLAGS="$_SAVE_CFLAGS"
  38
+
  39
+])
2  configure.in
@@ -2990,6 +2990,8 @@ case $target in
2990 2990
 	;;
2991 2991
 esac
2992 2992
 
  2993
+MOZ_LINUX_PERF_EVENT
  2994
+
2993 2995
 dnl Checks for libraries.
2994 2996
 dnl ========================================================
2995 2997
 case $target in
4  js/src/Makefile.in
@@ -843,6 +843,10 @@ $(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d
843 843
 $(addsuffix .$(OBJ_SUFFIX),jsprobes jsinterp jsobj): $(CURDIR)/javascript-trace.h
844 844
 endif
845 845
 
  846
+ifdef HAVE_LINUX_PERF_EVENT_H
  847
+pm_linux.$(OBJ_SUFFIX): CXXFLAGS += $(LINUX_HEADERS_INCLUDES)
  848
+endif
  849
+
846 850
 ###############################################
847 851
 # BEGIN kludges for the Nitro assembler
848 852
 #
1  js/src/aclocal.m4
@@ -22,5 +22,6 @@ builtin(include, build/autoconf/expandlibs.m4)dnl
22 22
 builtin(include, build/autoconf/arch.m4)dnl
23 23
 builtin(include, build/autoconf/android.m4)dnl
24 24
 builtin(include, build/autoconf/zlib.m4)dnl
  25
+builtin(include, build/autoconf/linux.m4)dnl
25 26
 
26 27
 MOZ_PROG_CHECKMSYS()
39  js/src/build/autoconf/linux.m4
... ...
@@ -0,0 +1,39 @@
  1
+dnl This Source Code Form is subject to the terms of the Mozilla Public
  2
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  3
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4
+
  5
+AC_DEFUN([MOZ_LINUX_PERF_EVENT],
  6
+[
  7
+
  8
+MOZ_ARG_WITH_STRING(linux-headers,
  9
+[  --with-linux-headers=DIR
  10
+                          location where the Linux kernel headers can be found],
  11
+    linux_headers=$withval)
  12
+
  13
+LINUX_HEADERS_INCLUDES=
  14
+
  15
+if test "$linux_headers"; then
  16
+    LINUX_HEADERS_INCLUDES="-I$linux_headers"
  17
+fi
  18
+
  19
+_SAVE_CFLAGS="$CFLAGS"
  20
+CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES"
  21
+
  22
+dnl Performance measurement headers.
  23
+MOZ_CHECK_HEADER(linux/perf_event.h,
  24
+    [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
  25
+        [AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);],
  26
+        ac_cv_perf_event_open=yes,
  27
+        ac_cv_perf_event_open=no)])])
  28
+if test "$ac_cv_perf_event_open" = "yes"; then
  29
+    HAVE_LINUX_PERF_EVENT_H=1
  30
+else
  31
+    HAVE_LINUX_PERF_EVENT_H=
  32
+    LINUX_HEADERS_INCLUDES=
  33
+fi
  34
+AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
  35
+AC_SUBST(LINUX_HEADERS_INCLUDES)
  36
+
  37
+CFLAGS="$_SAVE_CFLAGS"
  38
+
  39
+])
13  js/src/configure.in
@@ -2577,18 +2577,7 @@ case $target in
2577 2577
 	;;
2578 2578
 esac
2579 2579
 
2580  
-dnl Performance measurement headers.
2581  
-MOZ_CHECK_HEADER(linux/perf_event.h,
2582  
-    [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
2583  
-        [AC_TRY_COMPILE([#include <sys/syscall.h>],[return sizeof(__NR_perf_event_open);],
2584  
-        ac_cv_perf_event_open=yes,
2585  
-        ac_cv_perf_event_open=no)])])
2586  
-if test "$ac_cv_perf_event_open" = "yes"; then
2587  
-    HAVE_LINUX_PERF_EVENT_H=1
2588  
-else
2589  
-    HAVE_LINUX_PERF_EVENT_H=
2590  
-fi
2591  
-AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
  2580
+MOZ_LINUX_PERF_EVENT
2592 2581
 
2593 2582
 dnl Checks for libraries.
2594 2583
 dnl ========================================================

0 notes on commit 1f7f9c2

Please sign in to comment.
Something went wrong with that request. Please try again.