From f77c386fd5de8db1a783836689bee7ab848c1379 Mon Sep 17 00:00:00 2001 From: Advit Arora Date: Thu, 27 Aug 2026 23:25:16 +0530 Subject: [PATCH] gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS --- .../next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst | 3 +++ configure | 4 ++-- configure.ac | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-08-27-23-24-29.gh-issue-155813.LxRQu9.rst 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 6b560fe6841b72..35c5eee0060654 100755 --- a/configure +++ b/configure @@ -16220,8 +16220,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 476f13c82bbb2b..2bc1e5f6ba13a4 100644 --- a/configure.ac +++ b/configure.ac @@ -4375,8 +4375,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"} ]) ]) ])