From 755f6f6ede96d123ff660d4fe560a39b4f82a292 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Fri, 10 May 2019 22:00:39 +1000 Subject: [PATCH] Use PKG_CHECK_MODULES to detect the systemd library --- UPGRADING | 6 +++++- sapi/fpm/config.m4 | 28 +++------------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/UPGRADING b/UPGRADING index 27cd528f8681b..4ccbc38c0dabb 100644 --- a/UPGRADING +++ b/UPGRADING @@ -476,7 +476,7 @@ paths can be specified either by adding additional directories to PKG_CONFIG_PATH or by explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS. -The following extensions are affected: +The following extensions and SAPIs are affected: - Curl: . --with-curl no longer accepts a directory. @@ -503,6 +503,10 @@ The following extensions are affected: - Readline: . --with-libedit no longer accepts a directory. +- FPM: + . --with-fpm-systemd now uses only pkg-config for libsystem checks. The + libsystemd minimum required version is 209. + - GD: . --with-gd becomes --enable-gd (whether to enable the extension at all) and --with-external-gd (to opt into using an external libgd, rather than the diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 3c0a7f3d5dd81..5a1b4fa829cea 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -591,38 +591,16 @@ if test "$PHP_FPM" != "no"; then [no]) if test "$PHP_FPM_SYSTEMD" != "no" ; then - unset SYSTEMD_LIBS - unset SYSTEMD_INCS - - if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then - dnl systemd version >= 209 provides libsystemd - AC_MSG_CHECKING([for libsystemd]) - SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd` - SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd` - SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd` - AC_MSG_RESULT([version $SYSTEMD_VERS]) - - elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then - dnl systemd version < 209 provides libsystemd-daemon - AC_MSG_CHECKING([for libsystemd-daemon]) - SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd-daemon` - SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd-daemon` - SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd-daemon` - AC_MSG_RESULT([version $SYSTEMD_VERS]) - - else - dnl failback when no pkg-config - AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") - fi + PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209]) AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"]) - if test $HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then + if test $HAVE_SD_DAEMON_H = "no"; then AC_MSG_ERROR([Your system does not support systemd.]) else AC_DEFINE(HAVE_SYSTEMD, 1, [FPM use systemd integration]) PHP_FPM_SD_FILES="fpm/fpm_systemd.c" PHP_EVAL_LIBLINE($SYSTEMD_LIBS) - PHP_EVAL_INCLINE($SYSTEMD_INCS) + PHP_EVAL_INCLINE($SYSTEMD_CFLAGS) php_fpm_systemd=notify fi else