Skip to content

Commit 734f686

Browse files
authored
Simplify UFFDIO_WRITEPROTECT_MODE_WP Autoconf check (#13564)
AC_CHECK_DECL can check whether preprocessor macro is defined in the given includes.
1 parent 7f01871 commit 734f686

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

sapi/phpdbg/config.m4

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@ if test "$PHP_PHPDBG" != "no"; then
4545
AC_MSG_RESULT([disabled])
4646
fi
4747

48-
AC_CACHE_CHECK([for userfaultfd faulting on write-protected memory support], ac_cv_phpdbg_userfaultfd_writefault, AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
49-
#include <linux/userfaultfd.h>
50-
#ifndef UFFDIO_WRITEPROTECT_MODE_WP
51-
# error userfaults on write-protected memory not supported
52-
#endif
53-
]])], [ac_cv_phpdbg_userfaultfd_writefault=yes], [ac_cv_phpdbg_userfaultfd_writefault=no]))
54-
if test "$ac_cv_phpdbg_userfaultfd_writefault" = "yes"; then
48+
AC_CHECK_DECL([UFFDIO_WRITEPROTECT_MODE_WP], [
5549
if test "$enable_zts" != "yes"; then
5650
CFLAGS_SAVE="$CFLAGS"
5751
LIBS_SAVE="$LIBS"
@@ -73,7 +67,7 @@ if test "$PHP_PHPDBG" != "no"; then
7367
else
7468
AC_DEFINE(HAVE_USERFAULTFD_WRITEFAULT, 1, [Whether faulting on write-protected memory support can be compiled for userfaultfd])
7569
fi
76-
fi
70+
],,[#include <linux/userfaultfd.h>])
7771

7872
PHP_SUBST(PHPDBG_EXTRA_LIBS)
7973

0 commit comments

Comments
 (0)