Bug 1298536 - Move --with-linux-headers to Python configure. r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Wed, 31 Aug 2016 14:29:29 -0700
changeset 353620 3f398fa60de08dc4c6c0076105c38135afac9ebd
parent 353619 a4df9ee747c39bbb79a17ef999fc64eb5c2c19c2
child 353621 1f2c133d78b14c9b3faea5c31f70b94e90df0b8d
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1298536
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1298536 - Move --with-linux-headers to Python configure. r=glandium MozReview-Commit-ID: FWovXD9rjed
aclocal.m4
build/autoconf/linux.m4
build/moz.configure/headers.configure
build/moz.configure/old.configure
js/src/aclocal.m4
js/src/moz.build
js/src/old-configure.in
old-configure.in
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -18,17 +18,16 @@ builtin(include, build/autoconf/mozprog.
 builtin(include, build/autoconf/mozheader.m4)dnl
 builtin(include, build/autoconf/lto.m4)dnl
 builtin(include, build/autoconf/frameptr.m4)dnl
 builtin(include, build/autoconf/compiler-opts.m4)dnl
 builtin(include, build/autoconf/expandlibs.m4)dnl
 builtin(include, build/autoconf/arch.m4)dnl
 builtin(include, build/autoconf/android.m4)dnl
 builtin(include, build/autoconf/zlib.m4)dnl
-builtin(include, build/autoconf/linux.m4)dnl
 builtin(include, build/autoconf/icu.m4)dnl
 builtin(include, build/autoconf/ffi.m4)dnl
 builtin(include, build/autoconf/clang-plugin.m4)dnl
 builtin(include, build/autoconf/alloc.m4)dnl
 builtin(include, build/autoconf/ios.m4)dnl
 builtin(include, build/autoconf/jemalloc.m4)dnl
 builtin(include, build/autoconf/sanitize.m4)dnl
 
deleted file mode 100644
--- a/build/autoconf/linux.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-AC_DEFUN([MOZ_LINUX_PERF_EVENT],
-[
-
-MOZ_ARG_WITH_STRING(linux-headers,
-[  --with-linux-headers=DIR
-                          location where the Linux kernel headers can be found],
-    linux_headers=$withval)
-
-LINUX_HEADERS_INCLUDES=
-
-if test "$linux_headers"; then
-    LINUX_HEADERS_INCLUDES="-I$linux_headers"
-fi
-
-_SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES"
-
-dnl Performance measurement headers.
-MOZ_CHECK_HEADER(linux/perf_event.h,
-    [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
-        [AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);],
-        ac_cv_perf_event_open=yes,
-        ac_cv_perf_event_open=no)])])
-if test "$ac_cv_perf_event_open" = "yes"; then
-    HAVE_LINUX_PERF_EVENT_H=1
-else
-    HAVE_LINUX_PERF_EVENT_H=
-    LINUX_HEADERS_INCLUDES=
-fi
-AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
-AC_SUBST(LINUX_HEADERS_INCLUDES)
-
-CFLAGS="$_SAVE_CFLAGS"
-
-])
--- a/build/moz.configure/headers.configure
+++ b/build/moz.configure/headers.configure
@@ -56,8 +56,36 @@ check_header('sys/queue.h',
              when=non_msvc_compiler)
 
 check_headers(
     'sys/types.h',
     'netinet/in.h',
     'byteswap.h',
     when=non_msvc_compiler,
 )
+
+# TODO: Move these checks to file specific to --enable-project=js.
+have_perf_event_h = check_header('linux/perf_event.h',
+                                 when=building_linux)
+
+js_option('--with-linux-headers',
+          help='location where the Linux kernel headers can be found',
+          nargs=1)
+
+passed_linux_header_flags = depends_if('--with-linux-headers')(lambda v: ['-I%s' % v[0]])
+
+@depends_when(try_compile(includes=['asm/unistd.h'],
+                          body='return sizeof(__NR_perf_event_open);',
+                          flags=passed_linux_header_flags,
+                          check_msg='for perf_event_open system call'),
+              when=have_perf_event_h)
+def have_perf_event_open(have_perf_event_open):
+    if have_perf_event_open:
+        return True
+
+set_config('HAVE_LINUX_PERF_EVENT_H', have_perf_event_open)
+
+@depends(passed_linux_header_flags, have_perf_event_open)
+def linux_headers_includes(passed_linux_header_flags, have_perf_event_open):
+    if have_perf_event_open and passed_linux_header_flags:
+        return passed_linux_header_flags[0]
+
+set_config('LINUX_HEADERS_INCLUDES', linux_headers_includes)
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -265,17 +265,16 @@ def old_configure_options(*options):
     '--with-doc-include-dirs',
     '--with-doc-input-dirs',
     '--with-doc-output-dir',
     '--with-float-abi',
     '--with-fpu',
     '--with-intl-api',
     '--with-ios-sdk',
     '--with-jitreport-granularity',
-    '--with-linux-headers',
     '--with-macbundlename-prefix',
     '--with-macos-private-frameworks',
     '--with-macos-sdk',
     '--with-nspr-cflags',
     '--with-nspr-exec-prefix',
     '--with-nspr-libs',
     '--with-nspr-prefix',
     '--with-nss-exec-prefix',
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -17,17 +17,16 @@ builtin(include, ../../build/autoconf/mo
 builtin(include, ../../build/autoconf/mozheader.m4)dnl
 builtin(include, ../../build/autoconf/lto.m4)dnl
 builtin(include, ../../build/autoconf/frameptr.m4)dnl
 builtin(include, ../../build/autoconf/compiler-opts.m4)dnl
 builtin(include, ../../build/autoconf/expandlibs.m4)dnl
 builtin(include, ../../build/autoconf/arch.m4)dnl
 builtin(include, ../../build/autoconf/android.m4)dnl
 builtin(include, ../../build/autoconf/zlib.m4)dnl
-builtin(include, ../../build/autoconf/linux.m4)dnl
 builtin(include, ../../build/autoconf/icu.m4)dnl
 builtin(include, ../../build/autoconf/ffi.m4)dnl
 builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
 builtin(include, ../../build/autoconf/alloc.m4)dnl
 builtin(include, ../../build/autoconf/jemalloc.m4)dnl
 builtin(include, ../../build/autoconf/sanitize.m4)dnl
 builtin(include, ../../build/autoconf/ios.m4)dnl
 
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -597,17 +597,18 @@ if CONFIG['MOZ_VTUNE']:
     SOURCES += [
         'vtune/jitprofiling.c'
     ]
 
 if CONFIG['HAVE_LINUX_PERF_EVENT_H']:
     SOURCES += [
         'perf/pm_linux.cpp'
     ]
-    SOURCES['perf/pm_linux.cpp'].flags += [CONFIG['LINUX_HEADERS_INCLUDES']]
+    if CONFIG['LINUX_HEADERS_INCLUDES']:
+        SOURCES['perf/pm_linux.cpp'].flags += [CONFIG['LINUX_HEADERS_INCLUDES']]
 else:
     SOURCES += [
         'perf/pm_stub.cpp'
     ]
 
 HostSimplePrograms([
     'host_jskwgen',
 ])
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1068,18 +1068,16 @@ if test "x$enable_dtrace" = "xyes"; then
   if test -n "$HAVE_DTRACE"; then
       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
   else
       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
   fi
 fi
 AC_SUBST(HAVE_DTRACE)
 
-MOZ_LINUX_PERF_EVENT
-
 dnl Checks for libraries.
 dnl ========================================================
 AC_CHECK_LIB(c_r, gethostbyname_r)
 
 dnl We don't want to link with libdl even if it's present on OS X, since
 dnl it's not used and not part of the default installation. OS/2 has dlfcn
 dnl in libc.
 dnl We don't want to link against libm or libpthread on Darwin since
--- a/old-configure.in
+++ b/old-configure.in
@@ -1454,18 +1454,16 @@ if test "x$enable_dtrace" = "xyes"; then
   if test -n "$HAVE_DTRACE"; then
       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
   else
       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
   fi
 fi
 AC_SUBST(HAVE_DTRACE)
 
-MOZ_LINUX_PERF_EVENT
-
 dnl Checks for libraries.
 dnl ========================================================
 AC_CHECK_LIB(c_r, gethostbyname_r)
 
 dnl We don't want to link with libdl even if it's present on OS X, since
 dnl it's not used and not part of the default installation. OS/2 has dlfcn
 dnl in libc.
 dnl We don't want to link against libm or libpthread on Darwin since