@@ -45,26 +45,34 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
45
45
AC_MSG_RESULT ( [ disabled] )
46
46
fi
47
47
48
- AC_CACHE_CHECK ( [ for userfaultfd faulting on write-protected memory support] , ac_phpdbg_userfaultfd_writefault , AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [ [
48
+ AC_CACHE_CHECK ( [ for userfaultfd faulting on write-protected memory support] , ac_cv_phpdbg_userfaultfd_writefault , AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [ [
49
49
#include <linux/userfaultfd.h>
50
50
#ifndef UFFDIO_WRITEPROTECT_MODE_WP
51
51
# error userfaults on write-protected memory not supported
52
52
#endif
53
- ] ] ) ] , [ ac_phpdbg_userfaultfd_writefault =yes] , [ ac_phpdbg_userfaultfd_writefault =no] ) )
54
- if test "$ac_phpdbg_userfaultfd_writefault " = "yes"; then
53
+ ] ] ) ] , [ ac_cv_phpdbg_userfaultfd_writefault =yes] , [ ac_cv_phpdbg_userfaultfd_writefault =no] ) )
54
+ if test "$ac_cv_phpdbg_userfaultfd_writefault " = "yes"; then
55
55
if test "$enable_zts" != "yes"; then
56
- dnl Add pthreads linker and compiler flags for userfaultfd background thread
57
- if test -n "$ac_cv_pthreads_lib"; then
58
- LIBS="$LIBS -l$ac_cv_pthreads_lib"
59
- fi
60
- if test -n "$ac_cv_pthreads_cflags"; then
61
- CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
56
+ CFLAGS_SAVE="$CFLAGS"
57
+ LIBS_SAVE="$LIBS"
58
+
59
+ PTHREADS_CHECK
60
+ AC_MSG_CHECKING ( [ working pthreads] ) ;
61
+
62
+ if test "$pthreads_working" = "yes"; then
63
+ AC_MSG_RESULT ( [ $ac_cv_pthreads_cflags -l$ac_cv_pthreads_lib] ) ;
64
+ PHP_PHPDBG_CFLAGS="$PHP_PHPDBG_CFLAGS $ac_cv_pthreads_cflags"
65
+ PHPDBG_EXTRA_LIBS="$PHPDBG_EXTRA_LIBS -l$ac_cv_pthreads_lib"
66
+ AC_DEFINE ( HAVE_USERFAULTFD_WRITEFAULT , 1 , [ Whether faulting on write-protected memory support can be compiled for userfaultfd] )
67
+ else
68
+ AC_MSG_WARN ( [ pthreads not available] )
62
69
fi
63
70
64
- PTHREADS_FLAGS
71
+ CFLAGS="$CLFAGS_SAVE"
72
+ LIBS="$LIBS_SAVE"
73
+ else
74
+ AC_DEFINE ( HAVE_USERFAULTFD_WRITEFAULT , 1 , [ Whether faulting on write-protected memory support can be compiled for userfaultfd] )
65
75
fi
66
-
67
- AC_DEFINE ( HAVE_USERFAULTFD_WRITEFAULT , 1 , [ Whether faulting on write-protected memory support can be compiled for userfaultfd] )
68
76
fi
69
77
70
78
PHP_SUBST(PHP_PHPDBG_CFLAGS)
0 commit comments