Skip to content

Commit 9827385

Browse files
committed
Autotools: Use FPM_EXTRA_LIBS for SELinux library
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 33928a0 commit 9827385

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
@@ -425,7 +425,8 @@ if test "$PHP_FPM" != "no"; then
425425
[no],
426426
[no])
427427

428-
PHP_ARG_WITH([fpm-selinux],,
428+
PHP_ARG_WITH([fpm-selinux],
429+
[whether to enable SELinux support in PHP-FPM],
429430
[AS_HELP_STRING([--with-fpm-selinux],
430431
[Support SELinux policy library])],
431432
[no],
@@ -498,23 +499,23 @@ if test "$PHP_FPM" != "no"; then
498499
CFLAGS="$CFLAGS_save"
499500
fi
500501

501-
if test "x$PHP_FPM_SELINUX" != "xno" ; then
502-
PKG_CHECK_MODULES([SELINUX], [libselinux], [
503-
PHP_EVAL_LIBLINE([$SELINUX_LIBS])
504-
PHP_EVAL_INCLINE([$SELINUX_CFLAGS])
505-
],
502+
AS_VAR_IF([PHP_FPM_SELINUX], [no],, [
503+
PKG_CHECK_MODULES([SELINUX], [libselinux],
504+
[PHP_EVAL_INCLINE([$SELINUX_CFLAGS])],
506505
[AC_CHECK_LIB([selinux], [security_setenforce],
507-
[PHP_ADD_LIBRARY([selinux])],
506+
[SELINUX_LIBS=-lselinux],
508507
[AC_MSG_ERROR([Required SELinux library not found.])])])
508+
PHP_EVAL_LIBLINE([$SELINUX_LIBS], [FPM_EXTRA_LIBS], [yes])
509509
510510
dnl Sanity check.
511-
CFLAGS_save="$CFLAGS"
511+
CFLAGS_save=$CFLAGS
512512
CFLAGS="$INCLUDES $CFLAGS"
513513
AC_CHECK_HEADER([selinux/selinux.h],
514-
[AC_DEFINE([HAVE_SELINUX], [1], [Whether SELinux is available.])],
514+
[AC_DEFINE([HAVE_SELINUX], [1],
515+
[Define to 1 if SELinux is available in PHP-FPM.])],
515516
[AC_MSG_ERROR([Required selinux/selinux.h not found.])])
516-
CFLAGS="$CFLAGS_save"
517-
fi
517+
CFLAGS=$CFLAGS_save
518+
])
518519

519520
AC_SUBST([php_fpm_systemd])
520521

0 commit comments

Comments
 (0)