Skip to content

Commit bbc2260

Browse files
committed
Fix GH-20767: build failure with preserve_none attribute enabled on mac.
Established that build < 1700.4.4.1 tends to fail thus we disable the preserve_none attribute feature for these cases.
1 parent 37fe144 commit bbc2260

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

Zend/Zend.m4

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,42 @@ AC_CHECK_FUNC([sigsetjmp],,
166166
[AC_MSG_FAILURE([Required sigsetjmp not found.])],
167167
[#include <setjmp.h>])])
168168
169+
169170
ZEND_CHECK_STACK_DIRECTION
170171
ZEND_CHECK_FLOAT_PRECISION
171172
ZEND_DLSYM_CHECK
172173
ZEND_CHECK_GLOBAL_REGISTER_VARIABLES
173-
ZEND_CHECK_PRESERVE_NONE
174+
175+
case $host_os in
176+
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
199+
ZEND_CHECK_PRESERVE_NONE
200+
:
201+
])
202+
;;
203+
esac
204+
174205
ZEND_CHECK_CPUID_COUNT
175206
176207
AC_MSG_CHECKING([whether to enable thread safety])

0 commit comments

Comments
 (0)