]> granicus.if.org Git - python/commitdiff
Closes #27976: Deprecate bundled full copy of libffi
authorZachary Ware <zachary.ware@gmail.com>
Sat, 10 Sep 2016 00:01:21 +0000 (17:01 -0700)
committerZachary Ware <zachary.ware@gmail.com>
Sat, 10 Sep 2016 00:01:21 +0000 (17:01 -0700)
Builds on non-OSX UNIX now default to using the system libffi, and warn if the
bundled copy is used.

Doc/whatsnew/3.6.rst
Misc/NEWS
configure
configure.ac
setup.py

index ec2f2e0e0a23a692a46acc70136217e4a0ee6f8a..d3dd3370a12db59f8edb1a3661ef939765d29139 100644 (file)
@@ -1010,6 +1010,16 @@ Build and C API Changes
 Deprecated
 ==========
 
+Deprecated Build Options
+------------------------
+
+The ``--with-system-ffi`` configure flag is now on by default on non-OSX UNIX
+platforms.  It may be disabled by using ``--without-system-ffi``, but using the
+flag is deprecated and will not be accepted in Python 3.7.  OSX is unaffected
+by this change.  Note that many OS distributors already use the
+``--with-system-ffi`` flag when building their system Python.
+
+
 New Keywords
 ------------
 
index bc323e3a7cf2ae285fe4398fdb2e0fde80b99bb6..649c3913c7f43dee84085401db4ce896ffd9274f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -311,6 +311,9 @@ Tests
 Build
 -----
 
+- Issue #27976: Deprecate building _ctypes with the bundled copy of libffi on
+  non-OSX UNIX platforms.
+
 - Issue #27983: Cause lack of llvm-profdata tool when using clang as
   required for PGO linking to be a configure time error rather than
   make time when --with-optimizations is enabled.  Also improve our
index 7138eb1776ec2fa5b390160dc2272e78689cfd48..3998a32d377c1ae06185013b82bc22b200c2b202 100755 (executable)
--- a/configure
+++ b/configure
@@ -9851,11 +9851,27 @@ $as_echo_n "checking for --with-system-ffi... " >&6; }
 # Check whether --with-system_ffi was given.
 if test "${with_system_ffi+set}" = set; then :
   withval=$with_system_ffi;
-else
-  with_system_ffi="no"
 fi
 
 
+case "$with_system_ffi" in
+    "")
+        case $ac_sys_system in
+            Darwin)
+                with_system_ffi="no"
+                ;;
+            *)
+                with_system_ffi="yes"
+                ;;
+        esac
+        ;;
+    yes|no)
+        ;;
+    *)
+        as_fn_error $? "--with-system-ffi accepts no arguments" "$LINENO" 5
+        ;;
+esac
+
 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
     LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
 else
index 57cf46f2777da5f847db4c07cce97993c5b05c28..269c41ec4216120cbe71a4664ab80f658d53587f 100644 (file)
@@ -2737,9 +2737,25 @@ AC_MSG_RESULT($with_system_expat)
 # Check for use of the system libffi library
 AC_MSG_CHECKING(for --with-system-ffi)
 AC_ARG_WITH(system_ffi,
-            AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
-            [],
-            [with_system_ffi="no"])
+            AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),,,)
+
+case "$with_system_ffi" in
+    "")
+        case $ac_sys_system in
+            Darwin)
+                with_system_ffi="no"
+                ;;
+            *)
+                with_system_ffi="yes"
+                ;;
+        esac
+        ;;
+    yes|no)
+        ;;
+    *)
+        AC_MSG_ERROR([--with-system-ffi accepts no arguments])
+        ;;
+esac
 
 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
     LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
index 581157662e08a933fd0686cf8c05d4dfe06e7ca1..d9acd97308433e9aa1b40701edd711aa5b64d194 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1911,6 +1911,9 @@ class PyBuildExt(build_ext):
             if host_platform == 'darwin':
                 return self.configure_ctypes_darwin(ext)
 
+            print('warning: building with the bundled copy of libffi is'
+                  ' deprecated on this platform.  It will not be'
+                  ' distributed with Python 3.7')
             srcdir = sysconfig.get_config_var('srcdir')
             ffi_builddir = os.path.join(self.build_temp, 'libffi')
             ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
@@ -2007,13 +2010,14 @@ class PyBuildExt(build_ext):
                      libraries=math_libs)
         self.extensions.extend([ext, ext_test])
 
-        if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
-            return
-
         if host_platform == 'darwin':
+            if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
+                return
             # OS X 10.5 comes with libffi.dylib; the include files are
             # in /usr/include/ffi
             inc_dirs.append('/usr/include/ffi')
+        elif '--without-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
+            return
 
         ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
         if not ffi_inc or ffi_inc[0] == '':