Skip to content

Commit b3a5189

Browse files
committed
Autotools: Use FPM_EXTRA_LIBS for apparmor library
Instead of appending -lapparmor 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 b3a5189

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
@@ -419,7 +419,8 @@ if test "$PHP_FPM" != "no"; then
419419
[no],
420420
[no])
421421

422-
PHP_ARG_WITH([fpm-apparmor],,
422+
PHP_ARG_WITH([fpm-apparmor],
423+
[whether to enable AppArmor confinement in PHP-FPM],
423424
[AS_HELP_STRING([--with-fpm-apparmor],
424425
[Support AppArmor confinement through libapparmor])],
425426
[no],
@@ -480,23 +481,23 @@ if test "$PHP_FPM" != "no"; then
480481
LIBS=$LIBS_save
481482
])
482483

483-
if test "x$PHP_FPM_APPARMOR" != "xno" ; then
484-
PKG_CHECK_MODULES([APPARMOR], [libapparmor], [
485-
PHP_EVAL_LIBLINE([$APPARMOR_LIBS])
486-
PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])
487-
],
484+
AS_VAR_IF([PHP_FPM_APPARMOR], [no],, [
485+
PKG_CHECK_MODULES([APPARMOR], [libapparmor],
486+
[PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])],
488487
[AC_CHECK_LIB([apparmor], [aa_change_profile],
489-
[PHP_ADD_LIBRARY([apparmor])],
488+
[APPARMOR_LIBS=-lapparmor],
490489
[AC_MSG_ERROR([libapparmor required but not found.])])])
490+
PHP_EVAL_LIBLINE([$APPARMOR_LIBS], [FPM_EXTRA_LIBS], [yes])
491491
492492
dnl Sanity check.
493-
CFLAGS_save="$CFLAGS"
493+
CFLAGS_save=$CFLAGS
494494
CFLAGS="$INCLUDES $CFLAGS"
495495
AC_CHECK_HEADER([sys/apparmor.h],
496-
[AC_DEFINE([HAVE_APPARMOR], [1], [AppArmor confinement available])],
496+
[AC_DEFINE([HAVE_APPARMOR], [1],
497+
[Define to 1 if AppArmor confinement is available for PHP-FPM.])],
497498
[AC_MSG_ERROR([Required sys/apparmor.h not found.])])
498-
CFLAGS="$CFLAGS_save"
499-
fi
499+
CFLAGS=$CFLAGS_save
500+
])
500501

501502
if test "x$PHP_FPM_SELINUX" != "xno" ; then
502503
PKG_CHECK_MODULES([SELINUX], [libselinux], [

0 commit comments

Comments
 (0)