1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Find AppArmor library with pkgconf (#13644)

The AppArmor library has had pkg-config/pkgconf integration since its
early versions (2012), when it was integrated from the libaalogparse
into the AppArmor project. To ease this change, the check without
pkgconf is executed in case the libapparmor.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-apparmor \
    APPARMOR_CFLAGS=-I/path/to/libapparmor \
    APPARMOR_LIBS="-L/path/to/libapparmor -lapparmor"

This also removes the redundant symbol HAVE_SYS_APPARMOR_H since the
sys/apparmor.h header is considered a required part of the AppArmor
library package.
This commit is contained in:
Peter Kokot
2024-03-10 11:12:54 +01:00
committed by GitHub
parent 539d8d9259
commit 816f6a53d0

View File

@@ -515,13 +515,21 @@ if test "$PHP_FPM" != "no"; then
fi
if test "x$PHP_FPM_APPARMOR" != "xno" ; then
AC_CHECK_HEADERS([sys/apparmor.h])
AC_CHECK_LIB(apparmor, aa_change_profile, [
PHP_ADD_LIBRARY(apparmor)
AC_DEFINE(HAVE_APPARMOR, 1, [ AppArmor confinement available ])
],[
AC_MSG_ERROR(libapparmor required but not found)
])
PKG_CHECK_MODULES([APPARMOR], [libapparmor], [
PHP_EVAL_LIBLINE([$APPARMOR_LIBS])
PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])
],
[AC_CHECK_LIB([apparmor], [aa_change_profile],
[PHP_ADD_LIBRARY([apparmor])],
[AC_MSG_ERROR([libapparmor required but not found.])])])
dnl Sanity check.
CFLAGS_save="$CFLAGS"
CFLAGS="$INCLUDES $CFLAGS"
AC_CHECK_HEADER([sys/apparmor.h],
[AC_DEFINE([HAVE_APPARMOR], [1], [AppArmor confinement available])],
[AC_MSG_ERROR([Required sys/apparmor.h not found.])])
CFLAGS="$CFLAGS_save"
fi
if test "x$PHP_FPM_SELINUX" != "xno" ; then