@@ -87,9 +87,9 @@ target_compile_definitions(php_ext_pcntl PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE
8787
8888# Check for required functions.
8989block()
90- check_symbol_exists(fork unistd.h HAVE_FORK )
91- check_symbol_exists(sigaction signal.h HAVE_SIGACTION )
92- check_symbol_exists(waitpid sys/wait.h HAVE_WAITPID )
90+ check_symbol_exists(fork unistd.h PHP_HAVE_FORK )
91+ check_symbol_exists(sigaction signal.h PHP_HAVE_SIGACTION )
92+ check_symbol_exists(waitpid sys/wait.h PHP_HAVE_WAITPID )
9393
9494 foreach (function fork sigaction waitpid)
9595 string (TOUPPER ${function} const)
@@ -102,36 +102,82 @@ block()
102102 endforeach ()
103103endblock()
104104
105- check_symbol_exists(forkx sys/fork.h HAVE_FORKX)
106- check_symbol_exists(getcpuid sys/processor.h HAVE_GETCPUID)
107- check_symbol_exists(getpriority sys/resource .h HAVE_GETPRIORITY)
108- check_symbol_exists(pset_bind sys/pset.h HAVE_PSET_BIND)
105+ check_symbol_exists(forkx sys/fork.h PHP_EXT_PCNTL_HAVE_FORKX)
106+ set (HAVE_FORKX ${PHP_EXT_PCNTL_HAVE_FORKX} )
107+
108+ check_symbol_exists(getcpuid sys/processor.h PHP_EXT_PCNTL_HAVE_GETCPUID)
109+ set (HAVE_GETCPUID ${PHP_EXT_PCNTL_HAVE_GETCPUID} )
110+
111+ check_symbol_exists(getpriority sys/resource .h PHP_EXT_PCNTL_HAVE_GETPRIORITY)
112+ set (HAVE_GETPRIORITY ${PHP_EXT_PCNTL_HAVE_GETPRIORITY} )
113+
114+ check_symbol_exists(pset_bind sys/pset.h PHP_EXT_PCNTL_HAVE_PSET_BIND)
115+ set (HAVE_PSET_BIND ${PHP_EXT_PCNTL_HAVE_PSET_BIND} )
116+
109117check_symbol_exists(
110118 pthread_set_qos_class_self_np
111119 pthread/qos.h
120+ PHP_EXT_PCNTL_HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP
121+ )
122+ set (
112123 HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP
124+ ${PHP_EXT_PCNTL_HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP}
113125)
114- check_symbol_exists(rfork unistd.h HAVE_RFORK)
126+
127+ check_symbol_exists(rfork unistd.h PHP_EXT_PCNTL_HAVE_RFORK)
128+ set (HAVE_RFORK ${PHP_EXT_PCNTL_HAVE_RFORK} )
129+
115130cmake_push_check_state(RESET)
116131 set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
117- check_symbol_exists(sched_setaffinity sched.h HAVE_SCHED_SETAFFINITY)
132+ check_symbol_exists(
133+ sched_setaffinity
134+ sched.h
135+ PHP_EXT_PCNTL_HAVE_SCHED_SETAFFINITY
136+ )
137+ set (HAVE_SCHED_SETAFFINITY ${PHP_EXT_PCNTL_HAVE_SCHED_SETAFFINITY} )
118138cmake_pop_check_state()
119- check_symbol_exists(setpriority sys/resource .h HAVE_SETPRIORITY)
120- check_symbol_exists(sigtimedwait signal.h HAVE_SIGTIMEDWAIT)
121- check_symbol_exists(sigwaitinfo signal.h HAVE_SIGWAITINFO)
122- check_symbol_exists(SYS_pidfd_open sys/syscall.h HAVE_PIDFD_OPEN)
139+
140+ check_symbol_exists(setpriority sys/resource .h PHP_EXT_PCNTL_HAVE_SETPRIORITY)
141+ set (HAVE_SETPRIORITY ${PHP_EXT_PCNTL_HAVE_SETPRIORITY} )
142+
143+ check_symbol_exists(sigtimedwait signal.h PHP_EXT_PCNTL_HAVE_SIGTIMEDWAIT)
144+ set (HAVE_SIGTIMEDWAIT ${PHP_EXT_PCNTL_HAVE_SIGTIMEDWAIT} )
145+
146+ check_symbol_exists(sigwaitinfo signal.h PHP_EXT_PCNTL_HAVE_SIGWAITINFO)
147+ set (HAVE_SIGWAITINFO ${PHP_EXT_PCNTL_HAVE_SIGWAITINFO} )
148+
149+ check_symbol_exists(SYS_pidfd_open sys/syscall.h PHP_EXT_PCNTL_HAVE_PIDFD_OPEN)
150+ set (HAVE_PIDFD_OPEN ${PHP_EXT_PCNTL_HAVE_PIDFD_OPEN} )
151+
123152cmake_push_check_state(RESET)
124153 set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
125- check_symbol_exists(unshare sched.h HAVE_UNSHARE)
154+ check_symbol_exists(unshare sched.h PHP_EXT_PCNTL_HAVE_UNSHARE)
155+ set (HAVE_UNSHARE ${PHP_EXT_PCNTL_HAVE_UNSHARE} )
126156cmake_pop_check_state()
127- check_symbol_exists(wait3 sys/wait.h HAVE_WAIT3)
128- check_symbol_exists(wait4 sys/wait.h HAVE_WAIT4)
129- check_symbol_exists(waitid sys/wait.h HAVE_WAITID)
130- check_symbol_exists(WCONTINUED sys/wait.h HAVE_DECL_WCONTINUED)
131- check_symbol_exists(WEXITED sys/wait.h HAVE_DECL_WEXITED)
132- check_symbol_exists(WIFCONTINUED sys/wait.h HAVE_WIFCONTINUED)
133- check_symbol_exists(WNOWAIT sys/wait.h HAVE_DECL_WNOWAIT)
134- check_symbol_exists(WSTOPPED sys/wait.h HAVE_DECL_WSTOPPED)
157+
158+ check_symbol_exists(wait3 sys/wait.h PHP_EXT_PCNTL_HAVE_WAIT3)
159+ set (HAVE_WAIT3 ${PHP_EXT_PCNTL_HAVE_WAIT3} )
160+
161+ check_symbol_exists(wait4 sys/wait.h PHP_EXT_PCNTL_HAVE_WAIT4)
162+ set (HAVE_WAIT4 ${PHP_EXT_PCNTL_HAVE_WAIT4} )
163+
164+ check_symbol_exists(waitid sys/wait.h PHP_EXT_PCNTL_HAVE_WAITID)
165+ set (HAVE_WAITID ${PHP_EXT_PCNTL_HAVE_WAITID} )
166+
167+ check_symbol_exists(WCONTINUED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WCONTINUED)
168+ set (HAVE_DECL_WCONTINUED ${PHP_EXT_PCNTL_HAVE_DECL_WCONTINUED} )
169+
170+ check_symbol_exists(WEXITED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WEXITED)
171+ set (HAVE_DECL_WEXITED ${PHP_EXT_PCNTL_HAVE_DECL_WEXITED} )
172+
173+ check_symbol_exists(WIFCONTINUED sys/wait.h PHP_EXT_PCNTL_HAVE_WIFCONTINUED)
174+ set (HAVE_WIFCONTINUED ${PHP_EXT_PCNTL_HAVE_WIFCONTINUED} )
175+
176+ check_symbol_exists(WNOWAIT sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WNOWAIT)
177+ set (HAVE_DECL_WNOWAIT ${PHP_EXT_PCNTL_HAVE_DECL_WNOWAIT} )
178+
179+ check_symbol_exists(WSTOPPED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WSTOPPED)
180+ set (HAVE_DECL_WSTOPPED ${PHP_EXT_PCNTL_HAVE_DECL_WSTOPPED} )
135181
136182cmake_push_check_state(RESET)
137183 # Some of these enum values require _GNU_SOURCE.
@@ -140,30 +186,34 @@ cmake_push_check_state(RESET)
140186 check_source_compiles(C [[
141187 #include <sys/wait.h>
142188 int main(void) { idtype_t e = P_ALL; (void)e; return 0; }
143- ]] HAVE_DECL_P_ALL)
189+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_ALL)
190+ set (HAVE_DECL_P_ALL ${PHP_EXT_PCNTL_HAVE_DECL_P_ALL} )
144191
145192 check_source_compiles(C [[
146193 #include <sys/wait.h>
147194 int main(void) { idtype_t e = P_JAILID; (void)e; return 0; }
148- ]] HAVE_DECL_P_JAILID)
195+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_JAILID)
196+ set (HAVE_DECL_P_JAILID ${PHP_EXT_PCNTL_HAVE_DECL_P_JAILID} )
149197
150198 check_source_compiles(C [[
151199 #include <sys/wait.h>
152200 int main(void) { idtype_t e = P_PIDFD; (void)e; return 0; }
153- ]] HAVE_DECL_P_PIDFD)
201+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_PIDFD)
202+ set (HAVE_DECL_P_PIDFD ${PHP_EXT_PCNTL_HAVE_DECL_P_PIDFD} )
154203
155204 check_source_compiles(C [[
156205 #include <sys/wait.h>
157206 int main(void) { idtype_t e = P_UID; (void)e; return 0; }
158- ]] HAVE_DECL_P_UID)
207+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_UID)
208+ set (HAVE_DECL_P_UID ${PHP_EXT_PCNTL_HAVE_DECL_P_UID} )
159209cmake_pop_check_state()
160210
161211cmake_push_check_state(RESET)
162212 set (CMAKE_EXTRA_INCLUDE_FILES "signal.h" )
163- check_type_size(siginfo_t STRUCT_SIGINFO_T )
213+ check_type_size(siginfo_t PHP_EXT_PCNTL_STRUCT_SIGINFO_T )
164214cmake_pop_check_state()
165215
166- if (HAVE_STRUCT_SIGINFO_T )
216+ if (HAVE_PHP_EXT_PCNTL_STRUCT_SIGINFO_T )
167217 target_compile_definitions (php_ext_pcntl PRIVATE HAVE_STRUCT_SIGINFO_T)
168218endif ()
169219
@@ -177,13 +227,13 @@ cmake_push_check_state(RESET)
177227 HEADERS sched.h
178228 LIBRARIES
179229 gnu # Haiku
180- VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL
181- LIBRARY_VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY
230+ VARIABLE PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_SYMBOL
231+ LIBRARY_VARIABLE PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY
182232 )
183233
184- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL )
185- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY )
186- set (CMAKE_REQUIRED_LIBRARIES ${PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY } )
234+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_SYMBOL )
235+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY )
236+ set (CMAKE_REQUIRED_LIBRARIES ${PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY } )
187237 endif ()
188238 check_source_runs(C [[
189239 #include <sched.h>
@@ -194,14 +244,14 @@ cmake_push_check_state(RESET)
194244 }
195245 return 0;
196246 }
197- ]] PHP_EXT_PCNTL_HAS_SCHED_GETCPU )
247+ ]] PHP_EXT_PCNTL_HAVE_SCHED_GETCPU )
198248 endif ()
199249
200- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU )
201- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY )
250+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU )
251+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY )
202252 target_link_libraries (
203253 php_ext_pcntl
204- PRIVATE ${PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY }
254+ PRIVATE ${PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY }
205255 )
206256 endif ()
207257
0 commit comments