Skip to content

Commit

Permalink
gh-100540: Remove obsolete '--with-system-ffi' configure option (GH-1…
Browse files Browse the repository at this point in the history
…00544)

It has had no effect on non-macOS platforms for a long time, and has had
the non-obvious effect of invoking `pkg_config` and not setting
`-DUSING_APPLE_OS_LIBFFI` on macOS since GH-22855.
  • Loading branch information
zware authored Dec 28, 2022
1 parent fd4b55f commit 25590eb
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 156 deletions.
5 changes: 0 additions & 5 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,6 @@ Libraries options
Build the :mod:`pyexpat` module using an installed ``expat`` library
(default is no).

.. cmdoption:: --with-system-ffi

Build the :mod:`_ctypes` extension module using an installed ``ffi``
library, see the :mod:`ctypes` module (default is system-dependent).

.. cmdoption:: --with-system-libmpdec

Build the ``_decimal`` extension module using an installed ``mpdec``
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Removed the ``--with-system-ffi`` ``configure`` option; ``libffi`` must
now always be supplied by the system on all non-Windows platforms. The
option has had no effect on non-Darwin platforms for several releases, and
in 3.11 only had the non-obvious effect of invoking ``pkg-config`` to
find ``libffi`` and never setting ``-DUSING_APPLE_OS_LIBFFI``. Now on
Darwin platforms ``configure`` will first check for the OS ``libffi`` and
then fall back to the same processing as other platforms if it is not
found.
174 changes: 65 additions & 109 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 14 additions & 42 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3705,36 +3705,22 @@ AS_VAR_IF([with_system_expat], [yes], [
AC_SUBST([LIBEXPAT_CFLAGS])
AC_SUBST([LIBEXPAT_INTERNAL])

# 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, see Doc/library/ctypes.rst (default is system-dependent)]),,,)

if test "$ac_sys_system" = "Darwin"
then
case "$with_system_ffi" in
"")
with_system_ffi="no"
;;
yes|no)
;;
*)
AC_MSG_ERROR([--with-system-ffi accepts no arguments])
;;
esac
AC_MSG_RESULT($with_system_ffi)
else
AC_MSG_RESULT(yes)
if test "$with_system_ffi" != ""
then
AC_MSG_WARN([--with(out)-system-ffi is ignored on this platform])
fi
with_system_ffi="yes"
fi

dnl detect libffi
have_libffi=missing
AS_VAR_IF([with_system_ffi], [yes], [
AS_VAR_IF([ac_sys_system], [Darwin], [
WITH_SAVE_ENV([
CFLAGS="-I${SDKROOT}/usr/include/ffi $CFLAGS"
AC_CHECK_HEADER([ffi.h], [
AC_CHECK_LIB([ffi], [ffi_call], [
dnl use ffi from SDK root
have_libffi=yes
LIBFFI_CFLAGS="-I${SDKROOT}/usr/include/ffi -DUSING_APPLE_OS_LIBFFI=1"
LIBFFI_LIBS="-lffi"
])
])
])
])
AS_VAR_IF([have_libffi], [missing], [
PKG_CHECK_MODULES([LIBFFI], [libffi], [have_libffi=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
Expand All @@ -3748,20 +3734,6 @@ AS_VAR_IF([with_system_ffi], [yes], [
])
])
])
], [
AS_VAR_IF([ac_sys_system], [Darwin], [
WITH_SAVE_ENV([
CFLAGS="-I${SDKROOT}/usr/include/ffi $CFLAGS"
AC_CHECK_HEADER([ffi.h], [
AC_CHECK_LIB([ffi], [ffi_call], [
dnl use ffi from SDK root
have_libffi=yes
LIBFFI_CFLAGS="-I${SDKROOT}/usr/include/ffi -DUSING_APPLE_OS_LIBFFI=1"
LIBFFI_LIBS="-lffi"
], [have_libffi=no])
])
])
])
])

AS_VAR_IF([have_libffi], [yes], [
Expand Down

0 comments on commit 25590eb

Please sign in to comment.