1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Simplify FPM ACL check (#13604)

Instead of running the user/group permissions check (unknown when
cross-compiling), check with linking (AC_LINK_IFELSE) can be sufficient
to test if ACL_USER and ACL_GROUP are available (missing on macOS). The
AC_SEARCH_LIBS is used to test the ACL availability in c or acl library.
This commit is contained in:
Peter Kokot
2024-03-08 20:38:31 +01:00
committed by GitHub
parent a46438e87f
commit 1dfba4273f

View File

@@ -491,9 +491,11 @@ if test "$PHP_FPM" != "no"; then
if test "$PHP_FPM_ACL" != "no" ; then
AC_CHECK_HEADERS([sys/acl.h])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
int main(void)
{
dnl *BSD has acl_* built into libc, macOS doesn't have user/group support.
LIBS_save="$LIBS"
AC_SEARCH_LIBS([acl_free], [acl], [
AC_MSG_CHECKING([for acl user/group permissions support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
acl_t acl;
acl_entry_t user, group;
acl = acl_init(1);
@@ -502,39 +504,14 @@ if test "$PHP_FPM" != "no"; then
acl_create_entry(&acl, &group);
acl_set_tag_type(user, ACL_GROUP);
acl_free(acl);
return 0;
}
]])], [
AC_CHECK_LIB(acl, acl_free,
[PHP_ADD_LIBRARY(acl)
have_fpm_acl=yes
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
int main(void)
{
acl_t acl;
acl_entry_t user, group;
acl = acl_init(1);
acl_create_entry(&acl, &user);
acl_set_tag_type(user, ACL_USER);
acl_create_entry(&acl, &group);
acl_set_tag_type(user, ACL_GROUP);
acl_free(acl);
return 0;
}
]])],[have_fpm_acl=yes],[have_fpm_acl=no],[have_fpm_acl=no])
])
], [
have_fpm_acl=no
])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_FPM_ACL], [1], [Whether FPM has acl support])
], [
AC_MSG_RESULT([no])
LIBS="$LIBS_save"
])
])
AC_MSG_CHECKING([for acl user/group permissions support])
if test "$have_fpm_acl" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_FPM_ACL], 1, [do we have acl support?])
else
AC_MSG_RESULT([no])
fi
fi
if test "x$PHP_FPM_APPARMOR" != "xno" ; then