Skip to content

Commit 10b4df5

Browse files
committed
Autotools: Use FPM_EXTRA_LIBS for systemd library
Instead of appending -lsystemd 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 phpGH-14881
1 parent 479707b commit 10b4df5

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

sapi/fpm/config.m4

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,8 @@ if test "$PHP_FPM" != "no"; then
424424
[nobody],
425425
[no])
426426

427-
PHP_ARG_WITH([fpm-systemd],,
427+
PHP_ARG_WITH([fpm-systemd],
428+
[whether to enable systemd integration in PHP-FPM],
428429
[AS_HELP_STRING([--with-fpm-systemd],
429430
[Activate systemd integration])],
430431
[no],
@@ -448,24 +449,28 @@ if test "$PHP_FPM" != "no"; then
448449
[no],
449450
[no])
450451

451-
if test "$PHP_FPM_SYSTEMD" != "no" ; then
452+
AS_VAR_IF([PHP_FPM_SYSTEMD], [no], [php_fpm_systemd=simple], [
452453
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209])
453454
454-
AC_DEFINE([HAVE_SYSTEMD], [1], [Whether FPM has systemd integration])
455+
AC_DEFINE([HAVE_SYSTEMD], [1],
456+
[Define to 1 if FPM has systemd integration.])
455457
PHP_FPM_SD_FILES="fpm/fpm_systemd.c"
456-
PHP_EVAL_LIBLINE([$SYSTEMD_LIBS])
458+
459+
save_ext_shared=$ext_shared
460+
ext_shared=yes
461+
PHP_EVAL_LIBLINE([$SYSTEMD_LIBS], [FPM_EXTRA_LIBS])
457462
PHP_EVAL_INCLINE([$SYSTEMD_CFLAGS])
463+
ext_shared=$save_ext_shared
464+
458465
php_fpm_systemd=notify
459466
460467
dnl Sanity check.
461-
CFLAGS_save="$CFLAGS"
468+
CFLAGS_save=$CFLAGS
462469
CFLAGS="$INCLUDES $CFLAGS"
463470
AC_CHECK_HEADER([systemd/sd-daemon.h],,
464471
[AC_MSG_ERROR([Required systemd/sd-daemon.h not found.])])
465-
CFLAGS="$CFLAGS_save"
466-
else
467-
php_fpm_systemd=simple
468-
fi
472+
CFLAGS=$CFLAGS_save
473+
])
469474

470475
if test "$PHP_FPM_ACL" != "no" ; then
471476
AC_CHECK_HEADERS([sys/acl.h])
@@ -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)