https://github.com/python/cpython/commit/6839f8ce22e54cffdaa9d8fe40009b7964450b69
commit: 6839f8ce22e54cffdaa9d8fe40009b7964450b69
branch: main
author: Advit Arora <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-21T15:13:36-07:00
summary:

gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS (#156486)

Ensures that a user-specified LIBFFI_CFLAGS and LIBFFI_LIBS is honored when
building on macOS.

files:
A Misc/NEWS.d/next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst
M configure
M configure.ac

diff --git 
a/Misc/NEWS.d/next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst 
b/Misc/NEWS.d/next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst
new file mode 100644
index 00000000000000..c614826ba4c19a
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst
@@ -0,0 +1,3 @@
+On macOS, :option:`LIBFFI_CFLAGS` and :option:`LIBFFI_LIBS` are no longer
+ignored when the SDK provides ``libffi``, so :mod:`ctypes` can again be built
+against a different ``libffi``. Patch by Advit Arora.
diff --git a/configure b/configure
index ce630035cb053a..4c9059f18d8326 100755
--- a/configure
+++ b/configure
@@ -16332,8 +16332,8 @@ if test "x$ac_cv_lib_ffi_ffi_call" = xyes
 then :
 
                 have_libffi=yes
-        LIBFFI_CFLAGS="-I${SDKROOT}/usr/include/ffi -DUSING_APPLE_OS_LIBFFI=1"
-        LIBFFI_LIBS="-lffi"
+        LIBFFI_CFLAGS=${LIBFFI_CFLAGS-"-I${SDKROOT}/usr/include/ffi 
-DUSING_APPLE_OS_LIBFFI=1"}
+        LIBFFI_LIBS=${LIBFFI_LIBS-"-lffi"}
 
 fi
 
diff --git a/configure.ac b/configure.ac
index 51367b254c4590..463202793af8d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4418,8 +4418,8 @@ AS_VAR_IF([ac_sys_system], [Darwin], [
       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"
+        LIBFFI_CFLAGS=${LIBFFI_CFLAGS-"-I${SDKROOT}/usr/include/ffi 
-DUSING_APPLE_OS_LIBFFI=1"}
+        LIBFFI_LIBS=${LIBFFI_LIBS-"-lffi"}
       ])
     ])
   ])

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to