Skip to content

Commit fb5d64c

Browse files
authored
Autotools: Use FPM_EXTRA_LIBS for SELinux library (#14885)
Instead of appending -lselinux to global LIBS variable, this adds it as needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM invocation. Follow-up of GH-14881
1 parent 2ea79c0 commit fb5d64c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

sapi/fpm/config.m4

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ if test "$PHP_FPM" != "no"; then
427427
[no],
428428
[no])
429429

430-
PHP_ARG_WITH([fpm-selinux],,
430+
PHP_ARG_WITH([fpm-selinux],
431+
[whether to enable SELinux support in PHP-FPM],
431432
[AS_HELP_STRING([--with-fpm-selinux],
432433
[Support SELinux policy library])],
433434
[no],
@@ -502,23 +503,23 @@ if test "$PHP_FPM" != "no"; then
502503
CFLAGS=$CFLAGS_save
503504
])
504505

505-
if test "x$PHP_FPM_SELINUX" != "xno" ; then
506-
PKG_CHECK_MODULES([SELINUX], [libselinux], [
507-
PHP_EVAL_LIBLINE([$SELINUX_LIBS])
508-
PHP_EVAL_INCLINE([$SELINUX_CFLAGS])
509-
],
506+
AS_VAR_IF([PHP_FPM_SELINUX], [no],, [
507+
PKG_CHECK_MODULES([SELINUX], [libselinux],
508+
[PHP_EVAL_INCLINE([$SELINUX_CFLAGS])],
510509
[AC_CHECK_LIB([selinux], [security_setenforce],
511-
[PHP_ADD_LIBRARY([selinux])],
510+
[SELINUX_LIBS=-lselinux],
512511
[AC_MSG_ERROR([Required SELinux library not found.])])])
512+
PHP_EVAL_LIBLINE([$SELINUX_LIBS], [FPM_EXTRA_LIBS], [yes])
513513
514514
dnl Sanity check.
515-
CFLAGS_save="$CFLAGS"
515+
CFLAGS_save=$CFLAGS
516516
CFLAGS="$INCLUDES $CFLAGS"
517517
AC_CHECK_HEADER([selinux/selinux.h],
518-
[AC_DEFINE([HAVE_SELINUX], [1], [Whether SELinux is available.])],
518+
[AC_DEFINE([HAVE_SELINUX], [1],
519+
[Define to 1 if SELinux is available in PHP-FPM.])],
519520
[AC_MSG_ERROR([Required selinux/selinux.h not found.])])
520-
CFLAGS="$CFLAGS_save"
521-
fi
521+
CFLAGS=$CFLAGS_save
522+
])
522523

523524
if test -z "$PHP_FPM_USER" || test "$PHP_FPM_USER" = "yes" || test "$PHP_FPM_USER" = "no"; then
524525
php_fpm_user="nobody"

0 commit comments

Comments
 (0)