Skip to content

Commit

Permalink
Use PKG_CHECK_MODULES to detect the systemd library
Browse files Browse the repository at this point in the history
  • Loading branch information
hughmcmaster authored and petk committed May 11, 2019
1 parent 4bf37e4 commit 755f6f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
6 changes: 5 additions & 1 deletion UPGRADING
Expand Up @@ -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.
Expand All @@ -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
Expand Down
28 changes: 3 additions & 25 deletions sapi/fpm/config.m4
Expand Up @@ -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
Expand Down

0 comments on commit 755f6f6

Please sign in to comment.