Skip to content

Commit 5f81220

Browse files
committed
Use CheckIncludeFiles instead of CheckIncludeFile
CMake has 3 modules for checking headers: - CheckIncludeFiles (for checking one or more C or C++ headers) - CheckIncludeFile (for checking one C header) - CheckIncludeFileCXX (for checking one C++ header) which can be simplified to use only CheckIncludeFiles usage everywhere.
1 parent 7d5d65f commit 5f81220

File tree

19 files changed

+95
-97
lines changed

19 files changed

+95
-97
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ project(
4545
LANGUAGES C ASM
4646
)
4747

48-
include(CheckIncludeFile)
48+
include(CheckIncludeFiles)
4949
include(CheckSourceCompiles)
5050
include(CheckSymbolExists)
5151
include(CMakeDependentOption)
@@ -393,8 +393,8 @@ install(
393393
# Configuration checks.
394394
################################################################################
395395

396-
check_include_file(cpuid.h HAVE_CPUID_H)
397-
check_include_file(libproc.h HAVE_LIBPROC_H)
396+
check_include_files(cpuid.h HAVE_CPUID_H)
397+
check_include_files(libproc.h HAVE_LIBPROC_H)
398398

399399
check_symbol_exists(getpid "unistd.h" HAVE_GETPID)
400400

@@ -413,7 +413,7 @@ cmake_pop_check_state()
413413

414414
# BSD-based systems have pthread_attr_get_np in pthread_np.h.
415415
block()
416-
check_include_file(pthread_np.h _HAVE_PTHREAD_NP_H)
416+
check_include_files(pthread_np.h _HAVE_PTHREAD_NP_H)
417417

418418
if(_HAVE_PTHREAD_NP_H)
419419
set(headers "pthread_np.h")

cmake/Zend/cmake/Fibers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ include(cmake/Fibers.cmake)
3535

3636
include_guard(GLOBAL)
3737

38-
include(CheckIncludeFile)
38+
include(CheckIncludeFiles)
3939
include(CheckSourceRuns)
4040
include(CMakePushCheckState)
4141

@@ -202,7 +202,7 @@ block()
202202
)
203203
endif()
204204

205-
check_include_file(ucontext.h ZEND_FIBER_UCONTEXT)
205+
check_include_files(ucontext.h ZEND_FIBER_UCONTEXT)
206206
cmake_pop_check_state()
207207

208208
if(NOT ZEND_FIBER_UCONTEXT)

cmake/cmake/ConfigureChecks.cmake

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Project-wide configuration checks.
55
include_guard(GLOBAL)
66

77
include(CheckFunctionExists)
8-
include(CheckIncludeFile)
98
include(CheckIncludeFiles)
109
include(CheckSourceCompiles)
1110
include(CheckStructHasMember)
@@ -20,72 +19,72 @@ include(PHP/SearchLibraries)
2019
# Check headers.
2120
################################################################################
2221

23-
check_include_file(alloca.h HAVE_ALLOCA_H)
24-
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
25-
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
22+
check_include_files(alloca.h HAVE_ALLOCA_H)
23+
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
24+
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
2625

2726
if(HAVE_SYS_TYPES_H)
2827
# On Solaris/illumos arpa/nameser.h depends on sys/types.h.
2928
check_include_files("sys/types.h;arpa/nameser.h" HAVE_ARPA_NAMESER_H)
3029
else()
31-
check_include_file(arpa/nameser.h HAVE_ARPA_NAMESER_H)
30+
check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H)
3231
endif()
3332

34-
check_include_file(dirent.h HAVE_DIRENT_H)
35-
check_include_file(dlfcn.h HAVE_DLFCN_H)
36-
check_include_file(dns.h HAVE_DNS_H)
37-
check_include_file(fcntl.h HAVE_FCNTL_H)
38-
check_include_file(grp.h HAVE_GRP_H)
39-
check_include_file(ieeefp.h HAVE_IEEEFP_H)
40-
check_include_file(langinfo.h HAVE_LANGINFO_H)
41-
check_include_file(linux/sock_diag.h HAVE_LINUX_SOCK_DIAG_H)
42-
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
43-
check_include_file(poll.h HAVE_POLL_H)
44-
check_include_file(pty.h HAVE_PTY_H)
45-
check_include_file(pwd.h HAVE_PWD_H)
33+
check_include_files(dirent.h HAVE_DIRENT_H)
34+
check_include_files(dlfcn.h HAVE_DLFCN_H)
35+
check_include_files(dns.h HAVE_DNS_H)
36+
check_include_files(fcntl.h HAVE_FCNTL_H)
37+
check_include_files(grp.h HAVE_GRP_H)
38+
check_include_files(ieeefp.h HAVE_IEEEFP_H)
39+
check_include_files(langinfo.h HAVE_LANGINFO_H)
40+
check_include_files(linux/sock_diag.h HAVE_LINUX_SOCK_DIAG_H)
41+
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
42+
check_include_files(poll.h HAVE_POLL_H)
43+
check_include_files(pty.h HAVE_PTY_H)
44+
check_include_files(pwd.h HAVE_PWD_H)
4645

4746
# BSD-based systems (FreeBSD<=13) need also netinet/in.h for resolv.h to work.
4847
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182466
4948
if(HAVE_NETINET_IN_H)
5049
check_include_files("netinet/in.h;resolv.h" HAVE_RESOLV_H)
5150
else()
52-
check_include_file(resolv.h HAVE_RESOLV_H)
51+
check_include_files(resolv.h HAVE_RESOLV_H)
5352
endif()
5453

55-
check_include_file(strings.h HAVE_STRINGS_H)
56-
check_include_file(sys/file.h HAVE_SYS_FILE_H)
57-
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
58-
check_include_file(sys/ipc.h HAVE_SYS_IPC_H)
59-
check_include_file(sys/loadavg.h HAVE_SYS_LOADAVG_H)
60-
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
61-
check_include_file(sys/mount.h HAVE_SYS_MOUNT_H)
62-
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
63-
check_include_file(sys/poll.h HAVE_SYS_POLL_H)
64-
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
65-
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
66-
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
67-
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
68-
check_include_file(sys/statfs.h HAVE_SYS_STATFS_H)
69-
check_include_file(sys/statvfs.h HAVE_SYS_STATVFS_H)
70-
check_include_file(sys/sysexits.h HAVE_SYS_SYSEXITS_H)
71-
check_include_file(sys/time.h HAVE_SYS_TIME_H)
72-
check_include_file(sys/uio.h HAVE_SYS_UIO_H)
73-
check_include_file(sys/utsname.h HAVE_SYS_UTSNAME_H)
54+
check_include_files(strings.h HAVE_STRINGS_H)
55+
check_include_files(sys/file.h HAVE_SYS_FILE_H)
56+
check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
57+
check_include_files(sys/ipc.h HAVE_SYS_IPC_H)
58+
check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H)
59+
check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
60+
check_include_files(sys/mount.h HAVE_SYS_MOUNT_H)
61+
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
62+
check_include_files(sys/poll.h HAVE_SYS_POLL_H)
63+
check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
64+
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
65+
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
66+
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
67+
check_include_files(sys/statfs.h HAVE_SYS_STATFS_H)
68+
check_include_files(sys/statvfs.h HAVE_SYS_STATVFS_H)
69+
check_include_files(sys/sysexits.h HAVE_SYS_SYSEXITS_H)
70+
check_include_files(sys/time.h HAVE_SYS_TIME_H)
71+
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
72+
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
7473
# Solaris <= 10, other systems have sys/statvfs.h.
75-
check_include_file(sys/vfs.h HAVE_SYS_VFS_H)
76-
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
77-
check_include_file(sysexits.h HAVE_SYSEXITS_H)
78-
check_include_file(syslog.h HAVE_SYSLOG_H)
79-
check_include_file(unistd.h HAVE_UNISTD_H)
74+
check_include_files(sys/vfs.h HAVE_SYS_VFS_H)
75+
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
76+
check_include_files(sysexits.h HAVE_SYSEXITS_H)
77+
check_include_files(syslog.h HAVE_SYSLOG_H)
78+
check_include_files(unistd.h HAVE_UNISTD_H)
8079
# QNX requires unix.h to allow functions in libunix to work properly.
81-
check_include_file(unix.h HAVE_UNIX_H)
82-
check_include_file(utime.h HAVE_UTIME_H)
80+
check_include_files(unix.h HAVE_UNIX_H)
81+
check_include_files(utime.h HAVE_UTIME_H)
8382

8483
# Intel Intrinsics headers.
85-
check_include_file(tmmintrin.h HAVE_TMMINTRIN_H)
86-
check_include_file(nmmintrin.h HAVE_NMMINTRIN_H)
87-
check_include_file(wmmintrin.h HAVE_WMMINTRIN_H)
88-
check_include_file(immintrin.h HAVE_IMMINTRIN_H)
84+
check_include_files(tmmintrin.h HAVE_TMMINTRIN_H)
85+
check_include_files(nmmintrin.h HAVE_NMMINTRIN_H)
86+
check_include_files(wmmintrin.h HAVE_WMMINTRIN_H)
87+
check_include_files(immintrin.h HAVE_IMMINTRIN_H)
8988

9089
################################################################################
9190
# Check structs.
@@ -802,7 +801,7 @@ if(PHP_VALGRIND)
802801
if(TARGET Valgrind::Valgrind)
803802
cmake_push_check_state(RESET)
804803
set(CMAKE_REQUIRED_LIBRARIES Valgrind::Valgrind)
805-
check_include_file(valgrind/cachegrind.h HAVE_VALGRIND_CACHEGRIND_H)
804+
check_include_files(valgrind/cachegrind.h HAVE_VALGRIND_CACHEGRIND_H)
806805
cmake_pop_check_state()
807806
endif()
808807

cmake/cmake/modules/FindTidy.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ find_package(Tidy)
3232
```
3333
#]=============================================================================]
3434

35-
include(CheckIncludeFile)
35+
include(CheckIncludeFiles)
3636
include(CMakePushCheckState)
3737
include(FeatureSummary)
3838
include(FindPackageHandleStandardArgs)
@@ -89,11 +89,11 @@ if(Tidy_INCLUDE_DIR)
8989
# Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
9090
# that the found library is tidy-html5 and not the legacy htmltidy. The two
9191
# are compatible, except the legacy doesn't have this header.
92-
check_include_file(tidybuffio.h HAVE_TIDYBUFFIO_H)
92+
check_include_files(tidybuffio.h HAVE_TIDYBUFFIO_H)
9393

94-
check_include_file(tidy.h HAVE_TIDY_H)
94+
check_include_files(tidy.h HAVE_TIDY_H)
9595
if(NOT HAVE_TIDY_H)
96-
check_include_file(tidyp.h HAVE_TIDYP_H)
96+
check_include_files(tidyp.h HAVE_TIDYP_H)
9797
endif()
9898
cmake_pop_check_state()
9999
endif()

cmake/cmake/modules/PHP/CheckFlushIo.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(DEFINED HAVE_FLUSHIO)
2222
return()
2323
endif()
2424

25-
include(CheckIncludeFile)
25+
include(CheckIncludeFiles)
2626
include(CheckSourceRuns)
2727
include(CMakePushCheckState)
2828

@@ -44,7 +44,7 @@ endif()
4444
cmake_push_check_state(RESET)
4545
set(CMAKE_REQUIRED_QUIET TRUE)
4646

47-
check_include_file(unistd.h HAVE_UNISTD_H)
47+
check_include_files(unistd.h HAVE_UNISTD_H)
4848

4949
if(HAVE_UNISTD_H)
5050
set(CMAKE_REQUIRED_DEFINITIONS -DHAVE_UNISTD_H)

cmake/cmake/modules/PHP/CheckSysMacros.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ if(DEFINED _PHP_HAVE_SYS_MACROS_CHECKED)
7676
return()
7777
endif()
7878

79-
include(CheckIncludeFile)
79+
include(CheckIncludeFiles)
8080
include(CheckSymbolExists)
8181

8282
message(CHECK_START "Checking for major, minor and makedev")
8383

84-
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
85-
check_include_file(sys/mkdev.h HAVE_SYS_MKDEV_H)
86-
check_include_file(sys/sysmacros.h HAVE_SYS_SYSMACROS_H)
84+
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
85+
check_include_files(sys/mkdev.h HAVE_SYS_MKDEV_H)
86+
check_include_files(sys/sysmacros.h HAVE_SYS_SYSMACROS_H)
8787

8888
block()
8989
set(headers "")

cmake/cmake/modules/PHP/CheckWrite.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if(DEFINED PHP_WRITE_STDOUT)
2424
return()
2525
endif()
2626

27-
include(CheckIncludeFile)
27+
include(CheckIncludeFiles)
2828
include(CheckSourceRuns)
2929
include(CMakePushCheckState)
3030

@@ -42,7 +42,7 @@ endif()
4242
cmake_push_check_state(RESET)
4343
set(CMAKE_REQUIRED_QUIET TRUE)
4444

45-
check_include_file(unistd.h HAVE_UNISTD_H)
45+
check_include_files(unistd.h HAVE_UNISTD_H)
4646

4747
if(HAVE_UNISTD_H)
4848
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_UNISTD_H)

cmake/cmake/modules/PHP/SystemExtensions.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ endif()
9494

9595
include_guard(GLOBAL)
9696

97-
include(CheckIncludeFile)
97+
include(CheckIncludeFiles)
9898
include(CheckSourceCompiles)
9999
include(CheckTypeSize)
100100
include(CMakePushCheckState)
@@ -145,10 +145,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
145145
set(CMAKE_REQUIRED_QUIET TRUE)
146146
endif()
147147

148-
check_include_file(strings.h HAVE_STRINGS_H)
149-
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
150-
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
151-
check_include_file(unistd.h HAVE_UNISTD_H)
148+
check_include_files(strings.h HAVE_STRINGS_H)
149+
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
150+
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
151+
check_include_files(unistd.h HAVE_UNISTD_H)
152152

153153
if(HAVE_STRINGS_H)
154154
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STRINGS_H)

cmake/ext/com_dotnet/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
3434
return()
3535
endif()
3636

37-
include(CheckIncludeFile)
37+
include(CheckIncludeFiles)
3838
include(CMakeDependentOption)
3939
include(FeatureSummary)
4040

@@ -91,7 +91,7 @@ target_compile_definitions(
9191

9292
target_link_libraries(php_ext_com_dotnet PRIVATE oleaut32)
9393

94-
check_include_file(mscoree.h HAVE_MSCOREE_H)
94+
check_include_files(mscoree.h HAVE_MSCOREE_H)
9595

9696
set(HAVE_COM_DOTNET TRUE)
9797

cmake/ext/curl/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project(
2727
LANGUAGES C
2828
)
2929

30-
include(CheckIncludeFile)
30+
include(CheckIncludeFiles)
3131
include(CheckLibraryExists)
3232
include(CheckSourceRuns)
3333
include(CMakeDependentOption)
@@ -158,7 +158,7 @@ if(PHP_THREAD_SAFETY AND CURL_SSL_FOUND)
158158
if(TARGET OpenSSL::Crypto)
159159
cmake_push_check_state(RESET)
160160
set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto)
161-
check_include_file(openssl/crypto.h HAVE_OPENSSL_CRYPTO_H)
161+
check_include_files(openssl/crypto.h HAVE_OPENSSL_CRYPTO_H)
162162
cmake_pop_check_state()
163163
endif()
164164
endif()

0 commit comments

Comments
 (0)