diff -r 9f2467e13c98 Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst Wed Sep 07 16:11:08 2016 -0700 +++ b/Doc/whatsnew/3.6.rst Wed Sep 07 16:22:33 2016 -0700 @@ -843,6 +843,16 @@ Deprecated ========== +Deprecated Build Options +------------------------ + +The ``--with-system-ffi`` configure flag now on by default on non-OSX POSIX +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 ------------ diff -r 9f2467e13c98 configure --- a/configure Wed Sep 07 16:11:08 2016 -0700 +++ b/configure Wed Sep 07 16:22:33 2016 -0700 @@ -9842,10 +9842,26 @@ # 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 - +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/ *$//'`" diff -r 9f2467e13c98 configure.ac --- a/configure.ac Wed Sep 07 16:11:08 2016 -0700 +++ b/configure.ac Wed Sep 07 16:22:33 2016 -0700 @@ -2733,9 +2733,25 @@ # 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/ *$//'`" diff -r 9f2467e13c98 setup.py --- a/setup.py Wed Sep 07 16:11:08 2016 -0700 +++ b/setup.py Wed Sep 07 16:22:33 2016 -0700 @@ -1911,6 +1911,9 @@ 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 @@ 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] == '':