@@ -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,42 +102,98 @@ 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_DECL_SYS_PIDFD_OPEN)
123- check_symbol_exists(SYS_waitid sys/syscall.h HAVE_DECL_SYS_WAITID)
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(
150+ SYS_pidfd_open
151+ sys/syscall.h
152+ PHP_EXT_PCNTL_HAVE_DECL_SYS_PIDFD_OPEN
153+ )
154+ set (HAVE_DECL_SYS_PIDFD_OPEN ${PHP_EXT_PCNTL_HAVE_DECL_SYS_PIDFD_OPEN} )
155+
156+ check_symbol_exists(SYS_waitid sys/syscall.h PHP_EXT_PCNTL_HAVE_DECL_SYS_WAITID)
157+ set (HAVE_DECL_SYS_WAITID ${PHP_EXT_PCNTL_HAVE_DECL_SYS_WAITID} )
158+
124159cmake_push_check_state(RESET)
125160 set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
126- check_symbol_exists(syscall "sys/syscall.h;unistd.h" HAVE_SYSCALL)
161+ check_symbol_exists(syscall "sys/syscall.h;unistd.h" PHP_EXT_PCNTL_HAVE_SYSCALL)
162+ set (HAVE_SYSCALL ${PHP_EXT_PCNTL_HAVE_SYSCALL} )
127163cmake_pop_check_state()
164+
128165cmake_push_check_state(RESET)
129166 set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
130- check_symbol_exists(unshare sched.h HAVE_UNSHARE)
167+ check_symbol_exists(unshare sched.h PHP_EXT_PCNTL_HAVE_UNSHARE)
168+ set (HAVE_UNSHARE ${PHP_EXT_PCNTL_HAVE_UNSHARE} )
131169cmake_pop_check_state()
132- check_symbol_exists(wait3 sys/wait.h HAVE_WAIT3)
133- check_symbol_exists(wait4 sys/wait.h HAVE_WAIT4)
134- check_symbol_exists(wait6 sys/wait.h HAVE_WAIT6)
135- check_symbol_exists(waitid sys/wait.h HAVE_WAITID)
136- check_symbol_exists(WCONTINUED sys/wait.h HAVE_DECL_WCONTINUED)
137- check_symbol_exists(WEXITED sys/wait.h HAVE_DECL_WEXITED)
138- check_symbol_exists(WIFCONTINUED sys/wait.h HAVE_WIFCONTINUED)
139- check_symbol_exists(WNOWAIT sys/wait.h HAVE_DECL_WNOWAIT)
140- check_symbol_exists(WSTOPPED sys/wait.h HAVE_DECL_WSTOPPED)
170+
171+ check_symbol_exists(wait6 sys/wait.h PHP_EXT_PCNTL_HAVE_WAIT6)
172+ set (HAVE_WAIT6 ${PHP_EXT_PCNTL_HAVE_WAIT6} )
173+
174+ check_symbol_exists(wait3 sys/wait.h PHP_EXT_PCNTL_HAVE_WAIT3)
175+ set (HAVE_WAIT3 ${PHP_EXT_PCNTL_HAVE_WAIT3} )
176+
177+ check_symbol_exists(wait4 sys/wait.h PHP_EXT_PCNTL_HAVE_WAIT4)
178+ set (HAVE_WAIT4 ${PHP_EXT_PCNTL_HAVE_WAIT4} )
179+
180+ check_symbol_exists(waitid sys/wait.h PHP_EXT_PCNTL_HAVE_WAITID)
181+ set (HAVE_WAITID ${PHP_EXT_PCNTL_HAVE_WAITID} )
182+
183+ check_symbol_exists(WCONTINUED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WCONTINUED)
184+ set (HAVE_DECL_WCONTINUED ${PHP_EXT_PCNTL_HAVE_DECL_WCONTINUED} )
185+
186+ check_symbol_exists(WEXITED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WEXITED)
187+ set (HAVE_DECL_WEXITED ${PHP_EXT_PCNTL_HAVE_DECL_WEXITED} )
188+
189+ check_symbol_exists(WIFCONTINUED sys/wait.h PHP_EXT_PCNTL_HAVE_WIFCONTINUED)
190+ set (HAVE_WIFCONTINUED ${PHP_EXT_PCNTL_HAVE_WIFCONTINUED} )
191+
192+ check_symbol_exists(WNOWAIT sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WNOWAIT)
193+ set (HAVE_DECL_WNOWAIT ${PHP_EXT_PCNTL_HAVE_DECL_WNOWAIT} )
194+
195+ check_symbol_exists(WSTOPPED sys/wait.h PHP_EXT_PCNTL_HAVE_DECL_WSTOPPED)
196+ set (HAVE_DECL_WSTOPPED ${PHP_EXT_PCNTL_HAVE_DECL_WSTOPPED} )
141197
142198cmake_push_check_state(RESET)
143199 # Some of these enum values require _GNU_SOURCE.
@@ -146,30 +202,34 @@ cmake_push_check_state(RESET)
146202 check_source_compiles(C [[
147203 #include <sys/wait.h>
148204 int main(void) { idtype_t e = P_ALL; (void)e; return 0; }
149- ]] HAVE_DECL_P_ALL)
205+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_ALL)
206+ set (HAVE_DECL_P_ALL ${PHP_EXT_PCNTL_HAVE_DECL_P_ALL} )
150207
151208 check_source_compiles(C [[
152209 #include <sys/wait.h>
153210 int main(void) { idtype_t e = P_JAILID; (void)e; return 0; }
154- ]] HAVE_DECL_P_JAILID)
211+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_JAILID)
212+ set (HAVE_DECL_P_JAILID ${PHP_EXT_PCNTL_HAVE_DECL_P_JAILID} )
155213
156214 check_source_compiles(C [[
157215 #include <sys/wait.h>
158216 int main(void) { idtype_t e = P_PIDFD; (void)e; return 0; }
159- ]] HAVE_DECL_P_PIDFD)
217+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_PIDFD)
218+ set (HAVE_DECL_P_PIDFD ${PHP_EXT_PCNTL_HAVE_DECL_P_PIDFD} )
160219
161220 check_source_compiles(C [[
162221 #include <sys/wait.h>
163222 int main(void) { idtype_t e = P_UID; (void)e; return 0; }
164- ]] HAVE_DECL_P_UID)
223+ ]] PHP_EXT_PCNTL_HAVE_DECL_P_UID)
224+ set (HAVE_DECL_P_UID ${PHP_EXT_PCNTL_HAVE_DECL_P_UID} )
165225cmake_pop_check_state()
166226
167227cmake_push_check_state(RESET)
168228 set (CMAKE_EXTRA_INCLUDE_FILES "signal.h" )
169- check_type_size(siginfo_t STRUCT_SIGINFO_T )
229+ check_type_size(siginfo_t PHP_EXT_PCNTL_STRUCT_SIGINFO_T )
170230cmake_pop_check_state()
171231
172- if (HAVE_STRUCT_SIGINFO_T )
232+ if (HAVE_PHP_EXT_PCNTL_STRUCT_SIGINFO_T )
173233 target_compile_definitions (php_ext_pcntl PRIVATE HAVE_STRUCT_SIGINFO_T)
174234endif ()
175235
@@ -183,13 +243,13 @@ cmake_push_check_state(RESET)
183243 HEADERS sched.h
184244 LIBRARIES
185245 gnu # Haiku
186- VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL
187- LIBRARY_VARIABLE PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY
246+ VARIABLE PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_SYMBOL
247+ LIBRARY_VARIABLE PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY
188248 )
189249
190- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_SYMBOL )
191- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY )
192- set (CMAKE_REQUIRED_LIBRARIES ${PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY } )
250+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_SYMBOL )
251+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY )
252+ set (CMAKE_REQUIRED_LIBRARIES ${PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY } )
193253 endif ()
194254 check_source_runs(C [[
195255 #include <sched.h>
@@ -200,14 +260,14 @@ cmake_push_check_state(RESET)
200260 }
201261 return 0;
202262 }
203- ]] PHP_EXT_PCNTL_HAS_SCHED_GETCPU )
263+ ]] PHP_EXT_PCNTL_HAVE_SCHED_GETCPU )
204264 endif ()
205265
206- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU )
207- if (PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY )
266+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU )
267+ if (PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY )
208268 target_link_libraries (
209269 php_ext_pcntl
210- PRIVATE ${PHP_EXT_PCNTL_HAS_SCHED_GETCPU_LIBRARY }
270+ PRIVATE ${PHP_EXT_PCNTL_HAVE_SCHED_GETCPU_LIBRARY }
211271 )
212272 endif ()
213273
0 commit comments