summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey B Kirpichev <skirpichev@gmail.com>2024-10-30 09:12:39 (GMT)
committerGitHub <noreply@github.com>2024-10-30 09:12:39 (GMT)
commitdcad8fecbd5c8f1542f7a46e0c7bb7e1f27ab115 (patch)
treee242ea16254f09c39a7b24702c91167b6b1ae8c1
parent35df4eb959b3923c08aaaeff728c5ed1706f31cf (diff)
downloadcpython-dcad8fecbd5c8f1542f7a46e0c7bb7e1f27ab115.zip
cpython-dcad8fecbd5c8f1542f7a46e0c7bb7e1f27ab115.tar.gz
cpython-dcad8fecbd5c8f1542f7a46e0c7bb7e1f27ab115.tar.bz2
gh-125206: Correct detection of complex numbers support in libffi (#126104)
-rw-r--r--Misc/NEWS.d/next/Library/2024-10-29-07-24-52.gh-issue-125322.sstOM-.rst1
-rwxr-xr-xconfigure19
-rw-r--r--configure.ac8
3 files changed, 22 insertions, 6 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-10-29-07-24-52.gh-issue-125322.sstOM-.rst b/Misc/NEWS.d/next/Library/2024-10-29-07-24-52.gh-issue-125322.sstOM-.rst
new file mode 100644
index 0000000..e0cc91d
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-10-29-07-24-52.gh-issue-125322.sstOM-.rst
@@ -0,0 +1 @@
+Correct detection of complex numbers support in libffi.
diff --git a/configure b/configure
index 7a778b4..70eea29 100755
--- a/configure
+++ b/configure
@@ -15037,8 +15037,15 @@ if test ${ac_cv_ffi_complex_double_supported+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_save_cc="$CC"
-CC="$CC -lffi"
+ save_CFLAGS=$CFLAGS
+save_CPPFLAGS=$CPPFLAGS
+save_LDFLAGS=$LDFLAGS
+save_LIBS=$LIBS
+
+
+ CPPFLAGS="$LIBFFI_CFLAGS $CPPFLAGS"
+ LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ LIBS="$LIBFFI_LIBS $LIBS"
if test "$cross_compiling" = yes
then :
ac_cv_ffi_complex_double_supported=no
@@ -15080,7 +15087,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-CC="$ac_save_cc"
+
+CFLAGS=$save_CFLAGS
+CPPFLAGS=$save_CPPFLAGS
+LDFLAGS=$save_LDFLAGS
+LIBS=$save_LIBS
+
+
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ffi_complex_double_supported" >&5
printf "%s\n" "$ac_cv_ffi_complex_double_supported" >&6; }
diff --git a/configure.ac b/configure.ac
index 42daf1c..86e7075 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4090,8 +4090,10 @@ AS_VAR_IF([have_libffi], [yes], [
# See https://github.com/python/cpython/issues/125206 for more details.
#
AC_CACHE_CHECK([libffi has complex type support], [ac_cv_ffi_complex_double_supported],
-[ac_save_cc="$CC"
-CC="$CC -lffi"
+[WITH_SAVE_ENV([
+ CPPFLAGS="$LIBFFI_CFLAGS $CPPFLAGS"
+ LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ LIBS="$LIBFFI_LIBS $LIBS"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <complex.h>
#include <ffi.h>
@@ -4118,7 +4120,7 @@ int main(void)
]])], [ac_cv_ffi_complex_double_supported=yes],
[ac_cv_ffi_complex_double_supported=no],
[ac_cv_ffi_complex_double_supported=no])
-CC="$ac_save_cc"])
+])])
if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
AC_DEFINE([Py_FFI_SUPPORT_C_COMPLEX], [1],
[Defined if _Complex C type can be used with libffi.])