https://github.com/python/cpython/commit/56c01857903b2aeef9cb5aa7e2cde4a0aee5685c
commit: 56c01857903b2aeef9cb5aa7e2cde4a0aee5685c
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-21T23:07:44Z
summary:

[3.15] gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS 
(GH-156486) (#160129)

Ensures that a user-specified LIBFFI_CFLAGS and LIBFFI_LIBS is honored when
building on macOS.
(cherry picked from commit 6839f8ce22e54cffdaa9d8fe40009b7964450b69)

Co-authored-by: Advit Arora <[email protected]>

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 000000000000000..c614826ba4c19ad
--- /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 5a728e8ba68a3a1..c9678e24ddf1166 100755
--- a/configure
+++ b/configure
@@ -15931,8 +15931,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 08cfd620afb1eeb..719b3cc5baac9bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4286,8 +4286,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