Skip to content

Commit 3e63475

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 64c7c4c commit 3e63475

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

sapi/fpm/config.m4

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ if test "$PHP_FPM" != "no"; then
442442
[no],
443443
[no])
444444

445-
PHP_ARG_WITH([fpm-selinux],,
445+
PHP_ARG_WITH([fpm-selinux],
446+
[whether to enable SELinux support in PHP-FPM],
446447
[AS_HELP_STRING([--with-fpm-selinux],
447448
[Support SELinux policy library])],
448449
[no],
@@ -511,23 +512,27 @@ if test "$PHP_FPM" != "no"; then
511512
CFLAGS="$CFLAGS_save"
512513
fi
513514

514-
if test "x$PHP_FPM_SELINUX" != "xno" ; then
515+
AS_VAR_IF([PHP_FPM_SELINUX], [no],, [
516+
ext_shared_save=$ext_shared
517+
ext_shared=yes
515518
PKG_CHECK_MODULES([SELINUX], [libselinux], [
516-
PHP_EVAL_LIBLINE([$SELINUX_LIBS])
519+
PHP_EVAL_LIBLINE([$SELINUX_LIBS], [FPM_EXTRA_LIBS])
517520
PHP_EVAL_INCLINE([$SELINUX_CFLAGS])
518521
],
519522
[AC_CHECK_LIB([selinux], [security_setenforce],
520523
[PHP_ADD_LIBRARY([selinux])],
521524
[AC_MSG_ERROR([Required SELinux library not found.])])])
525+
ext_shared=$ext_shared_save
522526
523527
dnl Sanity check.
524-
CFLAGS_save="$CFLAGS"
528+
CFLAGS_save=$CFLAGS
525529
CFLAGS="$INCLUDES $CFLAGS"
526530
AC_CHECK_HEADER([selinux/selinux.h],
527-
[AC_DEFINE([HAVE_SELINUX], [1], [Whether SELinux is available.])],
531+
[AC_DEFINE([HAVE_SELINUX], [1],
532+
[Define to 1 if SELinux is available in PHP-FPM.])],
528533
[AC_MSG_ERROR([Required selinux/selinux.h not found.])])
529-
CFLAGS="$CFLAGS_save"
530-
fi
534+
CFLAGS=$CFLAGS_save
535+
])
531536

532537
AC_SUBST([php_fpm_systemd])
533538

@@ -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)