Skip to content

Commit bd01d89

Browse files
committed
Fix nits
- Remove CMAKE_VERBOSE_MAKEFILE option (this is already defined by CMake and available also in the GUI). - Moved return() to proper place in Zend/cmake/CheckStrerrorR.cmake. - Updated re2c download version to 4.2. - Refactored the fnmatch() check.
1 parent 22c3143 commit bd01d89

File tree

10 files changed

+43
-47
lines changed

10 files changed

+43
-47
lines changed

cmake/Zend/cmake/CheckStrerrorR.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ set(HAVE_STRERROR_R TRUE)
3434
if(DEFINED PHP_ZEND_HAS_STRERROR_R_CHAR_P)
3535
if(PHP_ZEND_HAS_STRERROR_R_CHAR_P)
3636
set(STRERROR_R_CHAR_P TRUE)
37-
return()
3837
endif()
38+
return()
3939
endif()
4040

4141
message(CHECK_START "Checking strerror_r() return type")

cmake/cmake/CMakeDefaults.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "")
2929
set(CMAKE_SHARED_MODULE_PREFIX_CXX "")
3030
set(CMAKE_STATIC_LIBRARY_PREFIX_CXX "")
3131

32-
# Whether to enable verbose output from Makefile builds.
33-
option(CMAKE_VERBOSE_MAKEFILE "Enable verbose output from Makefile builds")
34-
mark_as_advanced(CMAKE_VERBOSE_MAKEFILE)
35-
3632
# Whether to show message context in configuration log.
3733
option(
3834
CMAKE_MESSAGE_CONTEXT_SHOW

cmake/cmake/ConfigureChecks.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ endif()
406406
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckAVX512.cmake)
407407
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckCopyFileRange.cmake)
408408
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFlushIo.cmake)
409+
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFnmatch.cmake)
409410
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckFopencookie.cmake)
410411
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGetaddrinfo.cmake)
411412
include(${CMAKE_CURRENT_LIST_DIR}/checks/CheckGethostbynameR.cmake)

cmake/ext/standard/cmake/CheckFnmatch.cmake renamed to cmake/cmake/checks/CheckFnmatch.cmake

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
11
#[=============================================================================[
2-
# CheckFnmatch
2+
Check for a working POSIX 'fnmatch()' function.
33
4-
Check for a working POSIX `fnmatch()` function.
4+
This check is based on the 'AC_FUNC_FNMATCH' Autoconf macro. Some versions of
5+
Solaris (2.4), SCO, and the GNU C Library have a broken or incompatible fnmatch.
6+
In cross-compilation it is checked with the CheckSymbolExists module instead
7+
and assumed to have a POSIX-compatible implementation.
58
6-
Some versions of Solaris (2.4), SCO, and the GNU C Library have a broken or
7-
incompatible fnmatch. When cross-compiling we only enable it for Linux systems.
8-
Based on the `AC_FUNC_FNMATCH` Autoconf macro.
9-
10-
TODO: This is obsolescent. See Gnulib's fnmatch-gnu module:
9+
Gnulib provides also fnmatch-gnu module:
1110
https://www.gnu.org/software/gnulib/MODULES.html#module=fnmatch
1211
13-
## Cache variables
14-
15-
* `HAVE_FNMATCH`
12+
Result variables:
1613
17-
Whether `fnmatch` is a working POSIX variant.
14+
* HAVE_FNMATCH
15+
#]=============================================================================]
1816

19-
## Usage
17+
# PHP has fnmatch() emulation implemented on Windows.
18+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
19+
set(HAVE_FNMATCH TRUE)
20+
return()
21+
endif()
2022

21-
```cmake
22-
# CMakeLists.txt
23-
include(cmake/CheckFnmatch.cmake)
24-
```
25-
#]=============================================================================]
23+
set(HAVE_FNMATCH FALSE)
2624

27-
include_guard(GLOBAL)
25+
# Skip in consecutive configuration phases or if overridden.
26+
if(DEFINED PHP_HAS_FNMATCH)
27+
if(PHP_HAS_FNMATCH)
28+
set(HAVE_FNMATCH TRUE)
29+
endif()
2830

29-
# Skip in consecutive configuration phases.
30-
if(DEFINED HAVE_FNMATCH)
3131
return()
3232
endif()
3333

34+
include_guard(GLOBAL)
35+
3436
include(CheckSourceRuns)
37+
include(CheckSymbolExists)
3538
include(CMakePushCheckState)
3639

3740
message(CHECK_START "Checking for a working POSIX fnmatch() function")
3841

39-
if(
40-
NOT DEFINED HAVE_FNMATCH_EXITCODE
41-
AND CMAKE_CROSSCOMPILING
42-
AND NOT CMAKE_CROSSCOMPILING_EMULATOR
43-
AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
44-
)
45-
set(HAVE_FNMATCH_EXITCODE 0)
46-
endif()
47-
4842
cmake_push_check_state(RESET)
4943
set(CMAKE_REQUIRED_QUIET TRUE)
5044

45+
if(
46+
CMAKE_CROSSCOMPILING
47+
AND NOT CMAKE_CROSSCOMPILING_EMULATOR
48+
AND NOT DEFINED PHP_HAS_FNMATCH_EXITCODE
49+
)
50+
check_symbol_exists(fnmatch fnmatch.h PHP_HAS_FNMATCH)
51+
endif()
52+
5153
check_source_runs(C [[
5254
#include <fnmatch.h>
5355
#define y(a, b, c) (fnmatch (a, b, c) == 0)
@@ -64,10 +66,11 @@ cmake_push_check_state(RESET)
6466
&& n ("*x", ".x", FNM_PERIOD)
6567
&& 1));
6668
}
67-
]] HAVE_FNMATCH)
69+
]] PHP_HAS_FNMATCH)
6870
cmake_pop_check_state()
6971

70-
if(HAVE_FNMATCH)
72+
if(PHP_HAS_FNMATCH)
73+
set(HAVE_FNMATCH TRUE)
7174
message(CHECK_PASS "yes")
7275
else()
7376
message(CHECK_FAIL "no")

cmake/cmake/modules/PHP/Re2c.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ macro(_php_re2c_config)
197197

198198
# If re2c is not found on the system, set which version to download.
199199
if(NOT PHP_RE2C_VERSION_DOWNLOAD)
200-
set(PHP_RE2C_VERSION_DOWNLOAD 4.2)
200+
set(PHP_RE2C_VERSION_DOWNLOAD 4.3)
201201
endif()
202202
endmacro()
203203

cmake/cmake/platforms/Windows.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
1414
# Whether system has <dirent.h> header.
1515
set(HAVE_DIRENT_H FALSE)
1616

17-
# PHP has fnmatch() emulation implemented on Windows.
18-
set(HAVE_FNMATCH TRUE)
19-
2017
# Whether system has flock().
2118
set(HAVE_FLOCK FALSE)
2219

cmake/cmake/toolchains/template.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ set(PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE 0)
2222
# Set the exit code if flush should be called explicitly after a buffered io.
2323
set(PHP_HAS_FLUSHIO_EXITCODE 1)
2424

25+
# Set the exit code whether the fnmatch() is available and POSIX-compatible.
26+
set(PHP_HAS_FNMATCH_EXITCODE 0)
27+
2528
# Set the exit code for the getaddrinfo() check.
2629
set(PHP_HAS_GETADDRINFO_EXITCODE 0)
2730

@@ -139,9 +142,6 @@ set(PHP_PWRITE_64_EXITCODE 0)
139142
# ext/standard
140143
################################################################################
141144

142-
# Set the exit code for the POSIX fnmatch() check.
143-
set(HAVE_FNMATCH_EXITCODE 0)
144-
145145
# Set the exit codes for the algos checks when using external crypt library
146146
# (PHP_EXT_STANDARD_CRYPT_EXTERNAL).
147147
set(PHP_HAS_CRYPT_BLOWFISH_EXITCODE 0)

cmake/ext/standard/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ endif()
285285
################################################################################
286286

287287
include(cmake/CheckArmCrc32.cmake)
288-
include(cmake/CheckFnmatch.cmake)
289288
include(cmake/CheckStrptime.cmake)
290289

291290
# Check if there is a support means of creating a new process and defining which

cmake/ext/standard/cmake/config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
/* Define to 1 if you have the 'dns_search' function. */
3535
#cmakedefine HAVE_DNS_SEARCH 1
3636

37-
/* Define to 1 if your system has a working POSIX 'fnmatch' function. */
38-
#cmakedefine HAVE_FNMATCH 1
39-
4037
/* Define to 1 if you have the 'fork' function. */
4138
#cmakedefine HAVE_FORK 1
4239

cmake/main/cmake/php_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@
131131
/* Define to 1 if flush should be called explicitly after a buffered io. */
132132
#cmakedefine HAVE_FLUSHIO 1
133133

134+
/* Define to 1 if the system has a working POSIX 'fnmatch' function. */
135+
#cmakedefine HAVE_FNMATCH 1
136+
134137
/* Define to 1 if you have the 'fopencookie' function. */
135138
#cmakedefine HAVE_FOPENCOOKIE 1
136139

0 commit comments

Comments
 (0)