Skip to content

Autotools: Use FPM_EXTRA_LIBS for apparmor library #14884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions sapi/fpm/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ if test "$PHP_FPM" != "no"; then
[no],
[no])

PHP_ARG_WITH([fpm-apparmor],,
PHP_ARG_WITH([fpm-apparmor],
[whether to enable AppArmor confinement in PHP-FPM],
[AS_HELP_STRING([--with-fpm-apparmor],
[Support AppArmor confinement through libapparmor])],
[no],
Expand Down Expand Up @@ -480,23 +481,23 @@ if test "$PHP_FPM" != "no"; then
LIBS=$LIBS_save
])

if test "x$PHP_FPM_APPARMOR" != "xno" ; then
PKG_CHECK_MODULES([APPARMOR], [libapparmor], [
PHP_EVAL_LIBLINE([$APPARMOR_LIBS])
PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])
],
AS_VAR_IF([PHP_FPM_APPARMOR], [no],, [
PKG_CHECK_MODULES([APPARMOR], [libapparmor],
[PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])],
[AC_CHECK_LIB([apparmor], [aa_change_profile],
[PHP_ADD_LIBRARY([apparmor])],
[APPARMOR_LIBS=-lapparmor],
[AC_MSG_ERROR([libapparmor required but not found.])])])
PHP_EVAL_LIBLINE([$APPARMOR_LIBS], [FPM_EXTRA_LIBS], [yes])

dnl Sanity check.
CFLAGS_save="$CFLAGS"
CFLAGS_save=$CFLAGS
CFLAGS="$INCLUDES $CFLAGS"
AC_CHECK_HEADER([sys/apparmor.h],
[AC_DEFINE([HAVE_APPARMOR], [1], [AppArmor confinement available])],
[AC_DEFINE([HAVE_APPARMOR], [1],
[Define to 1 if AppArmor confinement is available for PHP-FPM.])],
[AC_MSG_ERROR([Required sys/apparmor.h not found.])])
CFLAGS="$CFLAGS_save"
fi
CFLAGS=$CFLAGS_save
])

if test "x$PHP_FPM_SELINUX" != "xno" ; then
PKG_CHECK_MODULES([SELINUX], [libselinux], [
Expand Down
Loading