Skip to content

Commit 082c16e

Browse files
committed
Narrow test to skip dup3 and pipe2 for iOS 26 and earlier
1 parent 5e703b2 commit 082c16e

3 files changed

Lines changed: 67 additions & 94 deletions

File tree

‎configure‎

Lines changed: 46 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎configure.ac‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ if test -z "$AR"; then
439439
aarch64-apple-ios*) AR=arm64-apple-ios-ar ;;
440440
x86_64-apple-ios*-simulator) AR=x86_64-apple-ios-simulator-ar ;;
441441
*)
442-
esac
442+
esac
443443
fi
444444
if test -z "$CC"; then
445445
case "$host" in
@@ -5576,9 +5576,24 @@ fi
55765576
# found by configure), but either raise a compilation error (because the
55775577
# header definition prevents usage - autoconf doesn't use the headers), or
55785578
# raise an error if used at runtime. Force these symbols off.
5579-
if test "$ac_sys_system" != "iOS" ; then
5580-
AC_CHECK_FUNCS([getentropy getgroups system])
5581-
fi
5579+
# In particular, dup3 and pipe2 are available as of iOS 27 but were
5580+
# incorrectly detected in older simulator versions.
5581+
case "$ac_sys_system" in
5582+
iOS)
5583+
AC_MSG_CHECKING([if iOS SDK is older than 27])
5584+
ios_sdk_version=$(xcrun --sdk iphoneos --show-sdk-version 2>/dev/null | cut -d. -f1)
5585+
if test -n "$ios_sdk_version" && test "$ios_sdk_version" -ge 27; then
5586+
AC_MSG_RESULT([no])
5587+
AC_CHECK_FUNCS([dup3 pipe2])
5588+
else
5589+
AC_MSG_RESULT([yes])
5590+
fi
5591+
;;
5592+
*)
5593+
# not iOS
5594+
AC_CHECK_FUNCS([dup3 getentropy getgroups pipe2 system])
5595+
;;
5596+
esac
55825597

55835598
AC_CHECK_DECL([dirfd],
55845599
[AC_DEFINE([HAVE_DIRFD], [1],
@@ -5590,9 +5605,7 @@ AC_CHECK_DECL([dirfd],
55905605
# For some functions, having a definition is not sufficient, since
55915606
# we want to take their address.
55925607
PY_CHECK_FUNC([chroot], [@%:@include <unistd.h>])
5593-
PY_CHECK_FUNC([dup3], [@%:@include <unistd.h>])
55945608
PY_CHECK_FUNC([link], [@%:@include <unistd.h>])
5595-
PY_CHECK_FUNC([pipe2], [@%:@include <unistd.h>])
55965609
PY_CHECK_FUNC([symlink], [@%:@include <unistd.h>])
55975610
PY_CHECK_FUNC([fchdir], [@%:@include <unistd.h>])
55985611
PY_CHECK_FUNC([fsync], [@%:@include <unistd.h>])

‎pyconfig.h.in‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
/* Define to 1 if you have the 'dup2' function. */
393393
#undef HAVE_DUP2
394394

395-
/* Define if you have the 'dup3' function. */
395+
/* Define to 1 if you have the 'dup3' function. */
396396
#undef HAVE_DUP3
397397

398398
/* Define if you have the '_dyld_shared_cache_contains_path' function. */
@@ -1052,7 +1052,7 @@
10521052
/* Define to 1 if you have the 'pipe' function. */
10531053
#undef HAVE_PIPE
10541054

1055-
/* Define if you have the 'pipe2' function. */
1055+
/* Define to 1 if you have the 'pipe2' function. */
10561056
#undef HAVE_PIPE2
10571057

10581058
/* Define to 1 if you have the 'plock' function. */

0 commit comments

Comments
 (0)