Skip to content

Commit 199edc5

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 9172b4d + ed99481 commit 199edc5

File tree

6 files changed

+114
-32
lines changed

6 files changed

+114
-32
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,16 @@ check_symbol_exists(pthread_stackseg_np pthread.h HAVE_PTHREAD_STACKSEG_NP)
442442
# POSIX.1-2001-compliant systems should have it. On Windows the setjmp() is
443443
# used instead.
444444
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
445-
check_symbol_exists(sigsetjmp setjmp.h _HAVE_SIGSETJMP)
446-
if(NOT _HAVE_SIGSETJMP)
445+
check_symbol_exists(sigsetjmp setjmp.h PHP_HAS_SIGSETJMP)
446+
if(NOT PHP_HAS_SIGSETJMP)
447+
check_symbol_exists(setjmp setjmp.h PHP_HAS_SETJMP)
448+
endif()
449+
if(NOT PHP_HAS_SIGSETJMP AND NOT PHP_HAS_SETJMP)
447450
message(
448451
FATAL_ERROR
449-
"Required function sigsetjmp() not found in setjmp.h. Please ensure the "
450-
"target system is compliant with POSIX.1-2001 standard or later and the "
451-
"setjmp.h header is available on the system."
452+
"Required function sigsetjmp()/setjmp() not found in <setjmp.h>. Please "
453+
"ensure the target system is compliant with POSIX.1-2001 standard or "
454+
"later and the <setjmp.h> header is available on the system."
452455
)
453456
endif()
454457
endif()

cmake/cmake/ConfigureChecks.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ endif()
230230
# Check for socklen_t type.
231231
cmake_push_check_state(RESET)
232232
if(HAVE_SYS_SOCKET_H)
233-
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
233+
list(APPEND CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
234+
endif()
235+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
236+
list(APPEND CMAKE_EXTRA_INCLUDE_FILES ws2tcpip.h)
234237
endif()
235238
check_type_size("socklen_t" SOCKLEN_T)
236239
cmake_pop_check_state()
@@ -372,7 +375,12 @@ check_symbol_exists(symlink unistd.h HAVE_SYMLINK)
372375
check_symbol_exists(tzset time.h HAVE_TZSET)
373376
check_symbol_exists(unsetenv stdlib.h HAVE_UNSETENV)
374377
check_symbol_exists(usleep unistd.h HAVE_USLEEP)
375-
check_symbol_exists(utime utime.h HAVE_UTIME)
378+
379+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
380+
check_symbol_exists(utime sys/utime.h HAVE_UTIME)
381+
else()
382+
check_symbol_exists(utime utime.h HAVE_UTIME)
383+
endif()
376384

377385
cmake_push_check_state(RESET)
378386
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)

cmake/cmake/platforms/Windows.cmake

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,96 @@ Specific configuration for Windows platform.
55
include_guard(GLOBAL)
66

77
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
8-
# Common compilation definitions.
9-
target_compile_definitions(
10-
php_config
11-
INTERFACE
12-
PHP_WIN32 # For PHP code
13-
_WIN32 # Defined by all compilers when targeting Windows. Left here
14-
# to match the native PHP Windows build system.
15-
WIN32 # Defined by Windows SDK and some compilers (GCC and Clang)
16-
# when targeting Windows. Left here for BC for possible PECL
17-
# extensions not being updated yet. In new code it is being
18-
# replaced with _WIN32.
19-
ZEND_WIN32 # For Zend Engine
20-
)
21-
228
# To speed up the Windows build experience with Visual Studio generators,
239
# these are always known on Windows systems.
24-
# TODO: Update and fix this better.
2510

11+
# Whether system has <alloca.h> header.
12+
set(HAVE_ALLOCA_H FALSE)
13+
14+
# Whether system has <dirent.h> header.
15+
set(HAVE_DIRENT_H FALSE)
16+
17+
# PHP has fnmatch() emulation implemented on Windows.
2618
set(HAVE_FNMATCH TRUE)
2719

28-
# PHP has unconditional getaddrinfo() support on Windows for now.
20+
# Whether system has flock().
21+
set(HAVE_FLOCK FALSE)
22+
23+
# PHP has ftok() emulation implemented on Windows.
24+
set(HAVE_FTOK TRUE)
25+
26+
# PHP has unconditional getaddrinfo() support on Windows.
2927
set(HAVE_GETADDRINFO TRUE)
3028

29+
# PHP has unconditional support for getcwd() on Windows.
30+
set(HAVE_GETCWD TRUE)
31+
3132
# PHP defines getpid as _getpid on Windows.
3233
set(HAVE_GETPID TRUE)
3334

34-
# PHP has custom nanosleep for Windows platform.
35+
# PHP has getrusage() emulation implemented on Windows.
36+
set(HAVE_GETRUSAGE TRUE)
37+
38+
# PHP has gettimeofday() emulation implemented on Windows.
39+
set(HAVE_GETTIMEOFDAY TRUE)
40+
41+
# Whether system has <grp.h> header.
42+
set(HAVE_GRP_H FALSE)
43+
44+
# Whether system has kill().
45+
set(HAVE_KILL FALSE)
46+
47+
# Windows has LoadLibrary().
48+
set(HAVE_LIBDL TRUE)
49+
50+
# PHP has nanosleep() emulation implemented on Windows.
3551
set(HAVE_NANOSLEEP TRUE)
3652

53+
# PHP has nice() emulation implemented on Windows.
3754
set(HAVE_NICE TRUE)
3855

39-
# PHP supports socketpair by the emulation in win32/sockets.c.
56+
# Whether system has <pwd.h> header.
57+
set(HAVE_PWD_H FALSE)
58+
59+
# Whether systems has setitimer().
60+
set(HAVE_SETITIMER FALSE)
61+
62+
# Windows has setjmp() in <setjmp.h> instead.
63+
set(HAVE_SIGSETJMP FALSE)
64+
65+
# PHP has socketpair() emulation implemented on Windows.
4066
set(HAVE_SOCKETPAIR TRUE)
4167

42-
# PHP defines strcasecmp in zend_config.w32.h.
68+
# PHP defines strcasecmp in Zend/zend_config.w32.h.
4369
set(HAVE_STRCASECMP TRUE)
4470

45-
# PHP has custom syslog.h for Windows platform.
71+
# Whether system has symlink().
72+
set(HAVE_SYMLINK FALSE)
73+
74+
# Whether system has <sys/file.h> header.
75+
set(HAVE_SYS_FILE_H FALSE)
76+
77+
# Whether system has <sys/socket.h> header.
78+
set(HAVE_SYS_SOCKET_H FALSE)
79+
80+
# Whether system has <sys/time.h> header.
81+
set(HAVE_SYS_TIME_H FALSE)
82+
83+
# Whether system has <sys/wait.h> header.
84+
set(HAVE_SYS_WAIT_H FALSE)
85+
86+
# PHP has syslog.h emulation implemented on Windows.
4687
set(HAVE_SYSLOG_H TRUE)
4788

48-
# PHP has custom usleep for Windows platform.
89+
# Whether 'st_blksize' is a member of 'struct stat'.
90+
set(HAVE_STRUCT_STAT_ST_BLKSIZE FALSE)
91+
92+
# Whether 'st_blocks' is a member of 'struct stat'.
93+
set(HAVE_STRUCT_STAT_ST_BLOCKS FALSE)
94+
95+
# Whether system has <unistd.h>.
96+
set(HAVE_UNISTD_H FALSE)
97+
98+
# PHP has usleep() emulation implemented on Windows.
4999
set(HAVE_USLEEP TRUE)
50100
endif()

cmake/ext/standard/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ endif()
323323
message(CHECK_START "Checking if OS can spawn processes with inherited handles")
324324
check_symbol_exists(fork unistd.h HAVE_FORK)
325325
if(NOT HAVE_FORK)
326-
check_symbol_exists(CreateProcess windows.h HAVE_CREATEPROCESS)
326+
check_symbol_exists(CreateProcess windows.h PHP_HAS_CREATEPROCESS)
327327
endif()
328-
if(HAVE_FORK OR HAVE_CREATEPROCESS)
328+
if(HAVE_FORK OR PHP_HAS_CREATEPROCESS)
329329
set(PHP_CAN_SUPPORT_PROC_OPEN TRUE)
330330

331331
message(CHECK_PASS "yes")

cmake/main/cmake/php_config.h.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define @PHP_CONFIG_HEADER_GUARD@
33

44
#if @PHP_CONFIG_H_WINDOWS@
5-
/* Define the minimum supported version */
5+
/* Define the minimum supported version. */
66
# undef _WIN32_WINNT
77
# undef NTDDI_VERSION
88
# define _WIN32_WINNT 0x0602
@@ -25,6 +25,8 @@
2525
<BaseTsd.h>. */
2626
# define ssize_t SSIZE_T
2727

28+
/* On program startup, the integer file descriptors associated with the streams
29+
stdin, stdout, and stderr are 0, 1, and 2. */
2830
# define STDIN_FILENO 0
2931
# define STDOUT_FILENO 1
3032
# define STDERR_FILENO 2
@@ -230,7 +232,9 @@
230232
/* Define to 1 if you have the 'lchown' function. */
231233
#cmakedefine HAVE_LCHOWN 1
232234

233-
/* Define to 1 if you have the 'dl' library (-ldl). */
235+
/* Define to 1 if system has some form of loading functions, such as dlopen()
236+
and other functions, for example, via the 'dl' library (-ldl), or
237+
LoadLibrary(), for example, on Windows. */
234238
#cmakedefine HAVE_LIBDL 1
235239

236240
/* Define to 1 if you have the <linux/sock_diag.h> header file. */

cmake/win32/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,26 @@ target_link_libraries(php_windows PRIVATE PHP::config)
7474
target_compile_definitions(
7575
php_config
7676
INTERFACE
77+
# Marks that target system is Windows. For PHP code.
78+
PHP_WIN32
79+
80+
# This preprocessor macro is also defined by all compilers when targeting
81+
# Windows. It is left here to match the native PHP Windows build system.
82+
_WIN32
83+
84+
# This preprocessor macro is also defined by Windows SDK and some compilers
85+
# (GCC and Clang) when targeting Windows. Left here for BC for possible PECL
86+
# extensions not being updated yet. In new code it is being replaced with
87+
# _WIN32.
88+
WIN32
89+
90+
# For Zend Engine, same as PHP_WIN32.
91+
ZEND_WIN32
92+
7793
_MBCS
7894
_USE_MATH_DEFINES
7995
PHP_EXPORTS
96+
8097
# The time_t defaults to 64-bit. Force 32-bit time_t on 32-bit architecture.
8198
# This was historically added to PHP as Visual Studio 2005 set 64-bit time_t
8299
# by default and it would break 3rdParty libs that were built with older

0 commit comments

Comments
 (0)