Bug 1294803 - Move MOZ_SYSTEM_FFI to moz.configure in preparation for moving libffi to our build system. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 15 Aug 2016 12:59:18 -0700
changeset 400778 8aca3d731545376e5465127f3f823818572a9e4c
parent 399698 233ab21b64b5d5e9f2f16ea2d4cfb4c8b293c5c4
child 400779 7bcd37b292e8d87b24bb8feba9588e5fc96b0ca5
push id26283
push usercmanchester@mozilla.com
push dateMon, 15 Aug 2016 20:44:20 +0000
bugs1294803
milestone51.0a1
Bug 1294803 - Move MOZ_SYSTEM_FFI to moz.configure in preparation for moving libffi to our build system. MozReview-Commit-ID: DtSDPoZSPcx
build/autoconf/ffi.m4
build/moz.configure/ffi.configure
build/moz.configure/old.configure
js/src/old-configure.in
moz.configure
old-configure.in
--- a/build/autoconf/ffi.m4
+++ b/build/autoconf/ffi.m4
@@ -1,32 +1,12 @@
 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_CONFIG_FFI], [
-
-MOZ_ARG_ENABLE_BOOL(system-ffi,
-[  --enable-system-ffi       Use system libffi (located with pkgconfig)],
-    MOZ_SYSTEM_FFI=1 )
-
-if test -n "$MOZ_SYSTEM_FFI"; then
-    # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
-    # for non-GCC compilers.
-    if test -z "$GNU_CC"; then
-        PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
-    else
-        PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
-    fi
-fi
-
-AC_SUBST(MOZ_SYSTEM_FFI)
-
-])
-
 AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
 if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
 
   if test "$BUILD_CTYPES" -a -z "$MOZ_SYSTEM_FFI"; then
     # Run the libffi 'configure' script.
     ac_configure_args="--disable-shared --enable-static --disable-raw-api"
     if test "$MOZ_DEBUG"; then
       ac_configure_args="$ac_configure_args --enable-debug"
new file mode 100644
--- /dev/null
+++ b/build/moz.configure/ffi.configure
@@ -0,0 +1,24 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+js_option('--with-system-ffi',
+          help='Use system libffi (located with pkgconfig)')
+
+use_system_ffi = depends_if('--with-system-ffi')(lambda _: True)
+
+@depends(use_system_ffi, c_compiler)
+def system_ffi_spec(system_ffi, info):
+    if system_ffi:
+        # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
+        # for non-GCC compilers.
+        if info.type == 'gcc':
+            return 'libffi >= 3.0.9'
+        return 'libffi > 3.0.9'
+
+system_ffi = pkg_check_modules('MOZ_FFI', system_ffi_spec, use_system_ffi)
+
+set_config('MOZ_SYSTEM_FFI', system_ffi)
+add_old_configure_assignment('MOZ_SYSTEM_FFI', system_ffi)
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -238,17 +238,16 @@ def old_configure_options(*options):
     '--enable-startup-notification',
     '--enable-startupcache',
     '--enable-stdcxx-compat',
     '--enable-strip',
     '--enable-synth-pico',
     '--enable-synth-speechd',
     '--enable-system-cairo',
     '--enable-system-extension-dirs',
-    '--enable-system-ffi',
     '--enable-system-pixman',
     '--enable-system-sqlite',
     '--enable-tasktracer',
     '--enable-thread-sanitizer',
     '--enable-trace-logging',
     '--enable-tree-freetype',
     '--enable-ui-locale',
     '--enable-universalchardet',
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1595,21 +1595,16 @@ fi
 MOZ_ZLIB_CHECK([1.2.3])
 
 if test -n "$ZLIB_IN_MOZGLUE"; then
     AC_DEFINE(ZLIB_IN_MOZGLUE)
 fi
 AC_SUBST(ZLIB_IN_MOZGLUE)
 
 dnl ========================================================
-dnl system libffi Support
-dnl ========================================================
-MOZ_CONFIG_FFI()
-
-dnl ========================================================
 dnl =
 dnl = Application
 dnl =
 dnl ========================================================
 
 MOZ_ARG_HEADER(Application)
 
 dnl ========================================================
--- a/moz.configure
+++ b/moz.configure
@@ -96,16 +96,18 @@ add_old_configure_assignment('MOZ_DEBUG'
 include_when('build/moz.configure/toolchain.configure',
              when='--enable-compile-environment')
 include_when('build/moz.configure/memory.configure',
              when='--enable-compile-environment')
 include_when('build/moz.configure/headers.configure',
              when='--enable-compile-environment')
 include_when('build/moz.configure/warnings.configure',
              when='--enable-compile-environment')
+include_when('build/moz.configure/ffi.configure',
+             when='--enable-compile-environment')
 
 @depends('--help')
 @imports(_from='mozbuild.backend', _import='backends')
 def build_backends_choices(help):
     return tuple(backends)
 
 
 @deprecated_option('--enable-build-backend', nargs='+',
--- a/old-configure.in
+++ b/old-configure.in
@@ -2373,21 +2373,16 @@ if test "$MOZ_SYSTEM_PNG" != 1 -a "$CPU_
     esac
 fi
 
 fi # SKIP_LIBRARY_CHECKS
 
 AC_SUBST(MOZ_PNG_ARM_NEON)
 
 dnl ========================================================
-dnl system libffi Support
-dnl ========================================================
-MOZ_CONFIG_FFI()
-
-dnl ========================================================
 dnl =
 dnl = Application
 dnl =
 dnl ========================================================
 
 MOZ_ARG_HEADER(Application)
 
 ENABLE_SYSTEM_EXTENSION_DIRS=1