diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 70156793dad0c..5a0beb16b512c 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -45,25 +45,13 @@ AS_VAR_IF([ac_cv_func_clock_gettime], [no], ])]) AC_DEFUN([PHP_FPM_TRACE], -[ - have_ptrace=no - have_broken_ptrace=no - - AC_MSG_CHECKING([for ptrace]) - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +[AC_CACHE_CHECK([for ptrace], [php_cv_func_ptrace], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include - #include ]], [[ptrace(0, 0, (void *) 0, 0);]])], [ - have_ptrace=yes - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - if test "$have_ptrace" = "yes"; then - AC_MSG_CHECKING([whether ptrace works]) - - AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + ], + [ptrace(0, 0, (void *) 0, 0);])], + [AC_RUN_IFELSE([AC_LANG_SOURCE([ #include #include #include @@ -85,7 +73,8 @@ AC_DEFUN([PHP_FPM_TRACE], int main(void) { - long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */ + /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */ + long v1 = (unsigned int) -1; long v2; pid_t child; int status; @@ -130,40 +119,33 @@ AC_DEFUN([PHP_FPM_TRACE], return 0; } } - ]])], [ - AC_MSG_RESULT([yes]) - ], [ - have_ptrace=no - have_broken_ptrace=yes - AC_MSG_RESULT([no]) + ])], + [php_cv_func_ptrace=yes], + [php_cv_func_ptrace=no], + [php_cv_func_ptrace=yes])], + [php_cv_func_ptrace=no])]) + +AS_VAR_IF([php_cv_func_ptrace], [yes], + [AC_DEFINE([HAVE_PTRACE], [1], + [Define to 1 if you have the 'ptrace' function.])], + [AC_CACHE_CHECK([for mach_vm_read], [php_cv_func_mach_vm_read], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include + #include ], [ - AC_MSG_RESULT([skipped (cross-compiling)]) - ]) - fi - - if test "$have_ptrace" = "yes"; then - AC_DEFINE([HAVE_PTRACE], 1, [do we have ptrace?]) - fi - - AS_VAR_IF([have_broken_ptrace], [yes], - [AC_CACHE_CHECK([for mach_vm_read], [php_cv_have_mach_vm_read], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include - #include - ], [ - 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); - ])], - [php_cv_have_mach_vm_read=yes], - [php_cv_have_mach_vm_read=no])]) - ]) + 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); + ])], + [php_cv_func_mach_vm_read=yes], + [php_cv_func_mach_vm_read=no])]) +]) - AS_VAR_IF([php_cv_have_mach_vm_read], [yes], - [AC_DEFINE([HAVE_MACH_VM_READ], [1], - [Define to 1 if you have the 'mach_vm_read'.])]) +AS_VAR_IF([php_cv_func_mach_vm_read], [yes], + [AC_DEFINE([HAVE_MACH_VM_READ], [1], + [Define to 1 if you have the 'mach_vm_read' function.])]) proc_mem_file="" @@ -222,13 +204,13 @@ AC_DEFUN([PHP_FPM_TRACE], fpm_trace_type="" - if test "$have_ptrace" = "yes"; then + if test "$php_cv_func_ptrace" = "yes"; then fpm_trace_type=ptrace elif test -n "$proc_mem_file"; then fpm_trace_type=pread - elif test "$php_cv_have_mach_vm_read" = "yes" ; then + elif test "$php_cv_func_mach_vm_read" = "yes" ; then fpm_trace_type=mach else