[php-src] master: Find SELinux library with pkgconf (#13645)

From: Date: Sun, 10 Mar 2024 20:45:45 +0000
Subject: [php-src] master: Find SELinux library with pkgconf (#13645)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-127695@lists.php.net to get a copy of this message
Author: Peter Kokot (petk) Committer: GitHub (web-flow) Pusher: petk Date: 2024-03-10T21:31:56+01:00 Commit: https://github.com/php/php-src/commit/586a0dd369d1e5e22737883718bee1a99d40ad38 Raw diff: https://github.com/php/php-src/commit/586a0dd369d1e5e22737883718bee1a99d40ad38.diff Find SELinux library with pkgconf (#13645) The SELinux library has had pkg-config/pkgconf integration since ~2009. To ease this change, the check without pkgconf is executed in case the libselinux.pc file is not found on the system. A sanity check also covers cases where the library path is overriden: /configure --enable-fpm --with-fpm-selinux \ SELINUX_CFLAGS=-I/path/to/libselinux \ SELINUX_LIBS="-L/path/to/libselinux -lselinux" This also removes the redundant symbol HAVE_SELINUX_SELINUX_H since the selinux/selinux.h header is considered a required part of the SELinux library package. Changed paths: M sapi/fpm/config.m4 Diff: diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index ecf2a26fd461..d80f1334aee9 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -533,11 +533,21 @@ if test "$PHP_FPM" != "no"; then fi if test "x$PHP_FPM_SELINUX" != "xno" ; then - AC_CHECK_HEADERS([selinux/selinux.h]) - AC_CHECK_LIB(selinux, security_setenforce, [ - PHP_ADD_LIBRARY(selinux) - AC_DEFINE(HAVE_SELINUX, 1, [ SElinux available ]) - ],[]) + PKG_CHECK_MODULES([SELINUX], [libselinux], [ + PHP_EVAL_LIBLINE([$SELINUX_LIBS]) + PHP_EVAL_INCLINE([$SELINUX_CFLAGS]) + ], + [AC_CHECK_LIB([selinux], [security_setenforce], + [PHP_ADD_LIBRARY([selinux])], + [AC_MSG_ERROR([Required SELinux library not found.])])]) + + dnl Sanity check. + CFLAGS_save="$CFLAGS" + CFLAGS="$INCLUDES $CFLAGS" + AC_CHECK_HEADER([selinux/selinux.h], + [AC_DEFINE([HAVE_SELINUX], [1], [Whether SELinux is available.])], + [AC_MSG_ERROR([Required selinux/selinux.h not found.])]) + CFLAGS="$CFLAGS_save" fi PHP_SUBST_OLD(php_fpm_systemd)

« previous php.cvs (#127695) next »