Skip to content

Commit e59715d

Browse files
committed
apply suggestion
1 parent 9327fb3 commit e59715d

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

Zend/Zend.m4

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,23 @@ ZEND_CHECK_GLOBAL_REGISTER_VARIABLES
174174
175175
case $host_os in
176176
darwin*)
177-
dnl versions prior to this lead to compilation failure
178-
min_apple_clang_train=1700.4.4.1
179-
180-
apple_line=`$CC --version 2>/dev/null | head -n 1`
181-
echo "$apple_line" | grep -q "Apple clang" || apple_line=`$CC -v 2>&1 | head -n 1`
182-
183-
apple_train=`echo "$apple_line" | sed -n 's/.*(clang-\([0-9][0-9.]*\)).*/\1/p'`
184-
have_preserve_none=yes
185-
186-
AS_IF([test -n "$apple_train"], [
187-
AC_MSG_CHECKING([Apple clang build train >= $min_apple_clang_train])
188-
AS_VERSION_COMPARE([$apple_train], [$min_apple_clang_train],
189-
[have_preserve_none=no],
190-
[],
191-
[]
192-
)
193-
AS_IF([test "x$have_preserve_none" = xyes],
194-
[ZEND_CHECK_PRESERVE_NONE],
195-
[AC_MSG_NOTICE([Skipping preserve_none])]
196-
)
197-
], [
198-
dnl Not Apple clang (could be Homebrew clang, GCC, etc.) -> keep enabled
177+
dnl versions prior to this lead to compilation failure
178+
dnl Prefer __apple_build_version__ (reliable, numeric) when available.
179+
dnl The known-good minimum corresponds to 17000404 (see PR discussion).
180+
min_apple_build_version=17000404
181+
apple_build_version=`echo | $CC -dM -E -x c - 2>/dev/null | sed -n 's/^#define __apple_build_version__ \([0-9][0-9]*\)$/\1/p'`
182+
183+
AS_IF([test -n "$apple_build_version"], [
184+
AC_MSG_CHECKING([Apple clang __apple_build_version__ >= $min_apple_build_version])
185+
AS_IF([test "$apple_build_version" -ge "$min_apple_build_version"], [
186+
AC_MSG_RESULT([yes])
199187
ZEND_CHECK_PRESERVE_NONE
200-
:
201188
])
202-
;;
189+
], [
190+
dnl Not Apple clang (could be Homebrew clang, GCC, etc.) -> keep enabled
191+
ZEND_CHECK_PRESERVE_NONE
192+
])
193+
;;
203194
*)
204195
ZEND_CHECK_PRESERVE_NONE
205196
;;

0 commit comments

Comments
 (0)