Skip to content

Commit 9e00163

Browse files
authored
Refactor systemd library check for FPM (#13595)
This removes the unused HAVE_SYSTEMD_SD_DAEMON_H symbol defined by the Autoconf AC_CHECK_HEADERS macro. The systemd/sd-daemon.h sanity check now also works when systemd library is overriden by pkgconf variables for custom or development places: ./configure --enable-fpm --with-fpm-systemd \ SYSTEMD_CFLAGS=-I/path/to/systemd/src \ SYSTEMD_LIBS="-L/path/to/systemd/build -lsystemd"
1 parent ffa3f4f commit 9e00163

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

sapi/fpm/config.m4

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,18 @@ if test "$PHP_FPM" != "no"; then
472472
if test "$PHP_FPM_SYSTEMD" != "no" ; then
473473
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209])
474474

475-
AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
476-
if test $HAVE_SD_DAEMON_H = "no"; then
477-
AC_MSG_ERROR([Your system does not support systemd.])
478-
else
479-
AC_DEFINE(HAVE_SYSTEMD, 1, [FPM use systemd integration])
480-
PHP_FPM_SD_FILES="fpm/fpm_systemd.c"
481-
PHP_EVAL_LIBLINE($SYSTEMD_LIBS)
482-
PHP_EVAL_INCLINE($SYSTEMD_CFLAGS)
483-
php_fpm_systemd=notify
484-
fi
475+
AC_DEFINE([HAVE_SYSTEMD], [1], [Whether FPM has systemd integration])
476+
PHP_FPM_SD_FILES="fpm/fpm_systemd.c"
477+
PHP_EVAL_LIBLINE([$SYSTEMD_LIBS])
478+
PHP_EVAL_INCLINE([$SYSTEMD_CFLAGS])
479+
php_fpm_systemd=notify
480+
481+
dnl Sanity check.
482+
CFLAGS_save="$CFLAGS"
483+
CFLAGS="$INCLUDES $CFLAGS"
484+
AC_CHECK_HEADER([systemd/sd-daemon.h],,
485+
[AC_MSG_ERROR([Required systemd/sd-daemon.h not found.])])
486+
CFLAGS="$CFLAGS_save"
485487
else
486488
php_fpm_systemd=simple
487489
fi

0 commit comments

Comments
 (0)