Skip to content

Commit 83cd1c2

Browse files
authored
Autotools: Refactor mach_vm_read check in FPM (php#14830)
- Check wrapped in AC_CACHE_CHECK - Synced CS
1 parent d7ddf83 commit 83cd1c2

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

sapi/fpm/config.m4

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,25 @@ AC_DEFUN([PHP_FPM_TRACE],
145145
AC_DEFINE([HAVE_PTRACE], 1, [do we have ptrace?])
146146
fi
147147
148-
have_mach_vm_read=no
149-
150-
if test "$have_broken_ptrace" = "yes"; then
151-
AC_MSG_CHECKING([for mach_vm_read])
152-
153-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach/mach.h>
154-
#include <mach/mach_vm.h>
155-
]], [[
156-
mach_vm_read((vm_map_t)0, (mach_vm_address_t)0, (mach_vm_size_t)0, (vm_offset_t *)0, (mach_msg_type_number_t*)0);
157-
]])], [
158-
have_mach_vm_read=yes
159-
AC_MSG_RESULT([yes])
160-
], [
161-
AC_MSG_RESULT([no])
162-
])
163-
fi
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+
])
164163
165-
if test "$have_mach_vm_read" = "yes"; then
166-
AC_DEFINE([HAVE_MACH_VM_READ], 1, [do we have mach_vm_read?])
167-
fi
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'.])])
168167
169168
proc_mem_file=""
170169
@@ -229,7 +228,7 @@ AC_DEFUN([PHP_FPM_TRACE],
229228
elif test -n "$proc_mem_file"; then
230229
fpm_trace_type=pread
231230
232-
elif test "$have_mach_vm_read" = "yes" ; then
231+
elif test "$php_cv_have_mach_vm_read" = "yes" ; then
233232
fpm_trace_type=mach
234233
235234
else

0 commit comments

Comments
 (0)