From 9185f613e0d3683aaf20040979d60980327d233d Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 9 Jul 2024 18:42:31 +0200 Subject: [PATCH] Autotools: Use FPM_EXTRA_LIBS for ACL library (#14881) - ACL user/group check wrapped in AC_CACHE_CHECK - instead of appending -lacl to global LIBS variable, this adds it as needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM invocation --- sapi/fpm/config.m4 | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index fe8e1898491..70156793dad 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -430,7 +430,8 @@ if test "$PHP_FPM" != "no"; then [no], [no]) - PHP_ARG_WITH([fpm-acl],, + PHP_ARG_WITH([fpm-acl], + [whether to use Access Control Lists (ACL) in PHP-FPM], [AS_HELP_STRING([--with-fpm-acl], [Use POSIX Access Control Lists])], [no], @@ -467,14 +468,15 @@ if test "$PHP_FPM" != "no"; then php_fpm_systemd=simple fi - if test "$PHP_FPM_ACL" != "no" ; then + AS_VAR_IF([PHP_FPM_ACL], [no],, [ AC_CHECK_HEADERS([sys/acl.h]) 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 ], [ + LIBS_save=$LIBS + AC_SEARCH_LIBS([acl_free], [acl], + [AC_CACHE_CHECK([for ACL user/group permissions support], + [php_cv_lib_acl_user_group], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [ acl_t acl; acl_entry_t user, group; acl = acl_init(1); @@ -483,15 +485,18 @@ if test "$PHP_FPM" != "no"; then acl_create_entry(&acl, &group); acl_set_tag_type(user, ACL_GROUP); acl_free(acl); - ])], [ - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FPM_ACL], [1], [Whether FPM has acl support]) - ], [ - AC_MSG_RESULT([no]) - LIBS="$LIBS_save" + ])], + [php_cv_lib_acl_user_group=yes], + [php_cv_lib_acl_user_group=no])]) + AS_VAR_IF([php_cv_lib_acl_user_group], [yes], [ + AC_DEFINE([HAVE_FPM_ACL], [1], + [Define to 1 if PHP-FPM has ACL support.]) + AS_VAR_IF([ac_cv_search_acl_free], ["none required"],, + [AS_VAR_APPEND([FPM_EXTRA_LIBS], [" $ac_cv_search_acl_free"])]) ]) ]) - fi + LIBS=$LIBS_save + ]) if test "x$PHP_FPM_APPARMOR" != "xno" ; then PKG_CHECK_MODULES([APPARMOR], [libapparmor], [ @@ -611,4 +616,5 @@ if test "$PHP_FPM" != "no"; then PHP_SUBST([SAPI_FPM_PATH]) PHP_SUBST([BUILD_FPM]) + PHP_SUBST([FPM_EXTRA_LIBS]) fi