Skip to content

Commit 9185f61

Browse files
authored
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
1 parent c2cbbd9 commit 9185f61

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

sapi/fpm/config.m4

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ if test "$PHP_FPM" != "no"; then
430430
[no],
431431
[no])
432432

433-
PHP_ARG_WITH([fpm-acl],,
433+
PHP_ARG_WITH([fpm-acl],
434+
[whether to use Access Control Lists (ACL) in PHP-FPM],
434435
[AS_HELP_STRING([--with-fpm-acl],
435436
[Use POSIX Access Control Lists])],
436437
[no],
@@ -467,14 +468,15 @@ if test "$PHP_FPM" != "no"; then
467468
php_fpm_systemd=simple
468469
fi
469470

470-
if test "$PHP_FPM_ACL" != "no" ; then
471+
AS_VAR_IF([PHP_FPM_ACL], [no],, [
471472
AC_CHECK_HEADERS([sys/acl.h])
472473
473474
dnl *BSD has acl_* built into libc, macOS doesn't have user/group support.
474-
LIBS_save="$LIBS"
475-
AC_SEARCH_LIBS([acl_free], [acl], [
476-
AC_MSG_CHECKING([for acl user/group permissions support])
477-
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
475+
LIBS_save=$LIBS
476+
AC_SEARCH_LIBS([acl_free], [acl],
477+
[AC_CACHE_CHECK([for ACL user/group permissions support],
478+
[php_cv_lib_acl_user_group],
479+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
478480
acl_t acl;
479481
acl_entry_t user, group;
480482
acl = acl_init(1);
@@ -483,15 +485,18 @@ if test "$PHP_FPM" != "no"; then
483485
acl_create_entry(&acl, &group);
484486
acl_set_tag_type(user, ACL_GROUP);
485487
acl_free(acl);
486-
])], [
487-
AC_MSG_RESULT([yes])
488-
AC_DEFINE([HAVE_FPM_ACL], [1], [Whether FPM has acl support])
489-
], [
490-
AC_MSG_RESULT([no])
491-
LIBS="$LIBS_save"
488+
])],
489+
[php_cv_lib_acl_user_group=yes],
490+
[php_cv_lib_acl_user_group=no])])
491+
AS_VAR_IF([php_cv_lib_acl_user_group], [yes], [
492+
AC_DEFINE([HAVE_FPM_ACL], [1],
493+
[Define to 1 if PHP-FPM has ACL support.])
494+
AS_VAR_IF([ac_cv_search_acl_free], ["none required"],,
495+
[AS_VAR_APPEND([FPM_EXTRA_LIBS], [" $ac_cv_search_acl_free"])])
492496
])
493497
])
494-
fi
498+
LIBS=$LIBS_save
499+
])
495500

496501
if test "x$PHP_FPM_APPARMOR" != "xno" ; then
497502
PKG_CHECK_MODULES([APPARMOR], [libapparmor], [
@@ -611,4 +616,5 @@ if test "$PHP_FPM" != "no"; then
611616

612617
PHP_SUBST([SAPI_FPM_PATH])
613618
PHP_SUBST([BUILD_FPM])
619+
PHP_SUBST([FPM_EXTRA_LIBS])
614620
fi

0 commit comments

Comments
 (0)