Skip to content

Commit ed99481

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents f6f957f + 9c497a1 commit ed99481

File tree

6 files changed

+112
-33
lines changed

6 files changed

+112
-33
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,16 @@ check_symbol_exists(pthread_stackseg_np pthread.h HAVE_PTHREAD_STACKSEG_NP)
440440
# POSIX.1-2001-compliant systems should have it. On Windows the setjmp() is
441441
# used instead.
442442
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
443-
check_symbol_exists(sigsetjmp setjmp.h _HAVE_SIGSETJMP)
444-
if(NOT _HAVE_SIGSETJMP)
443+
check_symbol_exists(sigsetjmp setjmp.h PHP_HAS_SIGSETJMP)
444+
if(NOT PHP_HAS_SIGSETJMP)
445+
check_symbol_exists(setjmp setjmp.h PHP_HAS_SETJMP)
446+
endif()
447+
if(NOT PHP_HAS_SIGSETJMP AND NOT PHP_HAS_SETJMP)
445448
message(
446449
FATAL_ERROR
447-
"Required function sigsetjmp() not found in setjmp.h. Please ensure the "
448-
"target system is compliant with POSIX.1-2001 standard or later and the "
449-
"setjmp.h header is available on the system."
450+
"Required function sigsetjmp()/setjmp() not found in <setjmp.h>. Please "
451+
"ensure the target system is compliant with POSIX.1-2001 standard or "
452+
"later and the <setjmp.h> header is available on the system."
450453
)
451454
endif()
452455
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()
@@ -370,7 +373,12 @@ check_symbol_exists(symlink unistd.h HAVE_SYMLINK)
370373
check_symbol_exists(tzset time.h HAVE_TZSET)
371374
check_symbol_exists(unsetenv stdlib.h HAVE_UNSETENV)
372375
check_symbol_exists(usleep unistd.h HAVE_USLEEP)
373-
check_symbol_exists(utime utime.h HAVE_UTIME)
376+
377+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
378+
check_symbol_exists(utime sys/utime.h HAVE_UTIME)
379+
else()
380+
check_symbol_exists(utime utime.h HAVE_UTIME)
381+
endif()
374382

375383
cmake_push_check_state(RESET)
376384
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)

cmake/cmake/platforms/Windows.cmake

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +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 glob() implemented on Windows.
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+
# PHP has glob() emulation implemented on Windows.
3542
set(HAVE_GLOB TRUE)
3643

37-
# PHP has custom nanosleep for Windows platform.
44+
# Whether system has <grp.h> header.
45+
set(HAVE_GRP_H FALSE)
46+
47+
# Whether system has kill().
48+
set(HAVE_KILL FALSE)
49+
50+
# Windows has LoadLibrary().
51+
set(HAVE_LIBDL TRUE)
52+
53+
# PHP has nanosleep() emulation implemented on Windows.
3854
set(HAVE_NANOSLEEP TRUE)
3955

56+
# PHP has nice() emulation implemented on Windows.
4057
set(HAVE_NICE TRUE)
4158

42-
# PHP supports socketpair by the emulation in win32/sockets.c.
59+
# Whether system has <pwd.h> header.
60+
set(HAVE_PWD_H FALSE)
61+
62+
# Whether systems has setitimer().
63+
set(HAVE_SETITIMER FALSE)
64+
65+
# PHP has socketpair() emulation implemented on Windows.
4366
set(HAVE_SOCKETPAIR TRUE)
4467

45-
# PHP defines strcasecmp in zend_config.w32.h.
68+
# PHP defines strcasecmp in Zend/zend_config.w32.h.
4669
set(HAVE_STRCASECMP TRUE)
4770

48-
# 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.
4987
set(HAVE_SYSLOG_H TRUE)
5088

51-
# 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.
5299
set(HAVE_USLEEP TRUE)
53100
endif()

cmake/ext/standard/CMakeLists.txt

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

332332
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
@@ -227,7 +229,9 @@
227229
/* Define to 1 if you have the 'lchown' function. */
228230
#cmakedefine HAVE_LCHOWN 1
229231

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

233237
/* 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
@@ -76,9 +76,26 @@ target_link_libraries(php_windows PRIVATE PHP::config)
7676
target_compile_definitions(
7777
php_config
7878
INTERFACE
79+
# Marks that target system is Windows. For PHP code.
80+
PHP_WIN32
81+
82+
# This preprocessor macro is also defined by all compilers when targeting
83+
# Windows. It is left here to match the native PHP Windows build system.
84+
_WIN32
85+
86+
# This preprocessor macro is also defined by Windows SDK and some compilers
87+
# (GCC and Clang) when targeting Windows. Left here for BC for possible PECL
88+
# extensions not being updated yet. In new code it is being replaced with
89+
# _WIN32.
90+
WIN32
91+
92+
# For Zend Engine, same as PHP_WIN32.
93+
ZEND_WIN32
94+
7995
_MBCS
8096
_USE_MATH_DEFINES
8197
PHP_EXPORTS
98+
8299
# The time_t defaults to 64-bit. Force 32-bit time_t on 32-bit architecture.
83100
# This was historically added to PHP as Visual Studio 2005 set 64-bit time_t
84101
# by default and it would break 3rdParty libs that were built with older

0 commit comments

Comments
 (0)