Skip to content

Commit 1dfba42

Browse files
authored
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.
1 parent a46438e commit 1dfba42

File tree

1 file changed

+12
-35
lines changed

1 file changed

+12
-35
lines changed

sapi/fpm/config.m4

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,11 @@ if test "$PHP_FPM" != "no"; then
491491
if test "$PHP_FPM_ACL" != "no" ; then
492492
AC_CHECK_HEADERS([sys/acl.h])
493493

494-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
495-
int main(void)
496-
{
494+
dnl *BSD has acl_* built into libc, macOS doesn't have user/group support.
495+
LIBS_save="$LIBS"
496+
AC_SEARCH_LIBS([acl_free], [acl], [
497+
AC_MSG_CHECKING([for acl user/group permissions support])
498+
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
497499
acl_t acl;
498500
acl_entry_t user, group;
499501
acl = acl_init(1);
@@ -502,39 +504,14 @@ if test "$PHP_FPM" != "no"; then
502504
acl_create_entry(&acl, &group);
503505
acl_set_tag_type(user, ACL_GROUP);
504506
acl_free(acl);
505-
return 0;
506-
}
507-
]])], [
508-
AC_CHECK_LIB(acl, acl_free,
509-
[PHP_ADD_LIBRARY(acl)
510-
have_fpm_acl=yes
511-
],[
512-
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
513-
int main(void)
514-
{
515-
acl_t acl;
516-
acl_entry_t user, group;
517-
acl = acl_init(1);
518-
acl_create_entry(&acl, &user);
519-
acl_set_tag_type(user, ACL_USER);
520-
acl_create_entry(&acl, &group);
521-
acl_set_tag_type(user, ACL_GROUP);
522-
acl_free(acl);
523-
return 0;
524-
}
525-
]])],[have_fpm_acl=yes],[have_fpm_acl=no],[have_fpm_acl=no])
526-
])
527-
], [
528-
have_fpm_acl=no
507+
])], [
508+
AC_MSG_RESULT([yes])
509+
AC_DEFINE([HAVE_FPM_ACL], [1], [Whether FPM has acl support])
510+
], [
511+
AC_MSG_RESULT([no])
512+
LIBS="$LIBS_save"
513+
])
529514
])
530-
531-
AC_MSG_CHECKING([for acl user/group permissions support])
532-
if test "$have_fpm_acl" = "yes"; then
533-
AC_MSG_RESULT([yes])
534-
AC_DEFINE([HAVE_FPM_ACL], 1, [do we have acl support?])
535-
else
536-
AC_MSG_RESULT([no])
537-
fi
538515
fi
539516

540517
if test "x$PHP_FPM_APPARMOR" != "xno" ; then

0 commit comments

Comments
 (0)