Skip to content

Commit 3d8fede

Browse files
committed
Refactor HAVE_SCHED_GETCPU check
1 parent b66578e commit 3d8fede

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

cmake/cmake/toolchains/template.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ set(PHP_EXT_OPCACHE_HAS_SHM_MMAP_POSIX_EXITCODE 0)
114114
# ext/pcntl
115115
################################################################################
116116

117-
# Set the exit code of the sched_getcpu check.
118-
set(HAVE_SCHED_GETCPU_EXITCODE 0)
117+
# Set the exit code of the sched_getcpu() check.
118+
set(PHP_EXT_PCNTL_HAS_SCHED_GETCPU_EXITCODE 0)
119119

120120
################################################################################
121121
# ext/pcre

cmake/ext/pcntl/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ cmake_push_check_state(RESET)
171171
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
172172

173173
# Check if sched_getcpu() is supported. Value -1 means ENOSYS in this context.
174-
block()
174+
block(PROPAGATE HAVE_SCHED_GETCPU)
175175
php_search_libraries(
176176
sched_getcpu
177177
HEADERS sched.h
178178
LIBRARIES
179179
gnu # Haiku
180-
VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU
180+
VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL
181181
LIBRARY_VARIABLE library
182182
)
183183

184-
if(PHP_EXT_PCNTL_HAS_SCHED_GETCPU)
184+
if(PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL)
185185
if(library)
186186
set(CMAKE_REQUIRED_LIBRARIES ${library})
187187
endif()
@@ -194,11 +194,15 @@ cmake_push_check_state(RESET)
194194
}
195195
return 0;
196196
}
197-
]] HAVE_SCHED_GETCPU)
197+
]] PHP_EXT_PCNTL_HAS_SCHED_GETCPU)
198198
endif()
199199

200-
if(HAVE_SCHED_GETCPU AND library)
201-
target_link_libraries(php_ext_pcntl PRIVATE ${library})
200+
if(PHP_EXT_PCNTL_HAS_SCHED_GETCPU)
201+
if(library)
202+
target_link_libraries(php_ext_pcntl PRIVATE ${library})
203+
endif()
204+
205+
set(HAVE_SCHED_GETCPU TRUE)
202206
endif()
203207
endblock()
204208
cmake_pop_check_state()

0 commit comments

Comments
 (0)