@@ -45,25 +45,13 @@ AS_VAR_IF([ac_cv_func_clock_gettime], [no],
45
45
] ) ] )
46
46
47
47
AC_DEFUN ( [ PHP_FPM_TRACE] ,
48
- [
49
- have_ptrace=no
50
- have_broken_ptrace=no
51
-
52
- AC_MSG_CHECKING ( [ for ptrace] )
53
-
54
- AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
48
+ [ AC_CACHE_CHECK ( [ for ptrace] , [ php_cv_func_ptrace] ,
49
+ [ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [
55
50
#include <sys/types.h>
56
- #include <sys/ptrace.h> ] ] , [ [ ptrace(0, 0, (void *) 0, 0);] ] ) ] , [
57
- have_ptrace=yes
58
- AC_MSG_RESULT ( [ yes] )
59
- ] , [
60
- AC_MSG_RESULT ( [ no] )
61
- ] )
62
-
63
- if test "$have_ptrace" = "yes"; then
64
- AC_MSG_CHECKING ( [ whether ptrace works] )
65
-
66
- AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
51
+ #include <sys/ptrace.h>
52
+ ] ,
53
+ [ ptrace(0, 0, (void *) 0, 0);] ) ] ,
54
+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
67
55
#include <unistd.h>
68
56
#include <signal.h>
69
57
#include <sys/wait.h>
@@ -85,7 +73,8 @@ AC_DEFUN([PHP_FPM_TRACE],
85
73
86
74
int main(void)
87
75
{
88
- long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */
76
+ /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */
77
+ long v1 = (unsigned int) -1;
89
78
long v2;
90
79
pid_t child;
91
80
int status;
@@ -130,40 +119,33 @@ AC_DEFUN([PHP_FPM_TRACE],
130
119
return 0;
131
120
}
132
121
}
133
- ] ] ) ] , [
134
- AC_MSG_RESULT ( [ yes] )
135
- ] , [
136
- have_ptrace=no
137
- have_broken_ptrace=yes
138
- AC_MSG_RESULT ( [ no] )
122
+ ] ) ] ,
123
+ [ php_cv_func_ptrace=yes] ,
124
+ [ php_cv_func_ptrace=no] ,
125
+ [ php_cv_func_ptrace=yes] ) ] ,
126
+ [ php_cv_func_ptrace=no] ) ] )
127
+
128
+ AS_VAR_IF ( [ php_cv_func_ptrace] , [ yes] ,
129
+ [ AC_DEFINE ( [ HAVE_PTRACE] , [ 1] ,
130
+ [ Define to 1 if you have the 'ptrace' function.] ) ] ,
131
+ [ AC_CACHE_CHECK ( [ for mach_vm_read] , [ php_cv_func_mach_vm_read] ,
132
+ [ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ #include <mach/mach.h>
133
+ #include <mach/mach_vm.h>
139
134
] , [
140
- AC_MSG_RESULT ( [ skipped (cross-compiling)] )
141
- ] )
142
- fi
143
-
144
- if test "$have_ptrace" = "yes"; then
145
- AC_DEFINE ( [ HAVE_PTRACE] , 1 , [ do we have ptrace?] )
146
- fi
147
-
148
- AS_VAR_IF ( [ have_broken_ptrace] , [ yes] ,
149
- [ AC_CACHE_CHECK ( [ for mach_vm_read] , [ php_cv_have_mach_vm_read] ,
150
- [ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ #include <mach/mach.h>
151
- #include <mach/mach_vm.h>
152
- ] , [
153
- mach_vm_read(
154
- (vm_map_t)0,
155
- (mach_vm_address_t)0,
156
- (mach_vm_size_t)0,
157
- (vm_offset_t *)0,
158
- (mach_msg_type_number_t*)0);
159
- ] ) ] ,
160
- [ php_cv_have_mach_vm_read=yes] ,
161
- [ php_cv_have_mach_vm_read=no] ) ] )
162
- ] )
135
+ mach_vm_read(
136
+ (vm_map_t)0,
137
+ (mach_vm_address_t)0,
138
+ (mach_vm_size_t)0,
139
+ (vm_offset_t *)0,
140
+ (mach_msg_type_number_t*)0);
141
+ ] ) ] ,
142
+ [ php_cv_func_mach_vm_read=yes] ,
143
+ [ php_cv_func_mach_vm_read=no] ) ] )
144
+ ] )
163
145
164
- AS_VAR_IF ( [ php_cv_have_mach_vm_read ] , [ yes] ,
165
- [ AC_DEFINE ( [ HAVE_MACH_VM_READ] , [ 1] ,
166
- [ Define to 1 if you have the 'mach_vm_read'.] ) ] )
146
+ AS_VAR_IF ( [ php_cv_func_mach_vm_read ] , [ yes] ,
147
+ [ AC_DEFINE ( [ HAVE_MACH_VM_READ] , [ 1] ,
148
+ [ Define to 1 if you have the 'mach_vm_read' function .] ) ] )
167
149
168
150
proc_mem_file=""
169
151
@@ -222,13 +204,13 @@ AC_DEFUN([PHP_FPM_TRACE],
222
204
223
205
fpm_trace_type=""
224
206
225
- if test "$have_ptrace " = "yes"; then
207
+ if test "$php_cv_func_ptrace " = "yes"; then
226
208
fpm_trace_type=ptrace
227
209
228
210
elif test -n "$proc_mem_file"; then
229
211
fpm_trace_type=pread
230
212
231
- elif test "$php_cv_have_mach_vm_read " = "yes" ; then
213
+ elif test "$php_cv_func_mach_vm_read " = "yes" ; then
232
214
fpm_trace_type=mach
233
215
234
216
else
0 commit comments