summaryrefslogtreecommitdiffstats
path: root/php-systemd.patch
blob: 4821d3ef2ebce9f4f6d4f33b9ee6ef9a26a90f7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
From 7b6031567251ad47132de23f47eb57951fd9b563 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Sat, 19 Jul 2014 18:40:20 +0200
Subject: [PATCH] Fixed bug #67635 php links to systemd libraries without using
 pkg-config

Patch from pacho at gentoo dot org

Rely on pkg-config for systemd >= 209
Failback on old check
---
 sapi/fpm/config.m4 | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index bd6d649..e1c740d 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -584,14 +584,26 @@ if test "$PHP_FPM" != "no"; then
   [  --with-fpm-systemd      Activate systemd integration], no, no)
 
   if test "$PHP_FPM_SYSTEMD" != "no" ; then
-    AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
-    AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
+    if test -z "$PKG_CONFIG"; then
+      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+    fi
+    unset SYSTEMD_LIBS
+    unset SYSTEMD_INCS
+    if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then
+      SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd`
+      SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd`
+      HAVE_SD_DAEMON_H="yes"
+    else
+      AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
+      AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
+    fi
     if test $HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; 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_ADD_LIBRARY(systemd-daemon)
+      PHP_EVAL_LIBLINE($SYSTEMD_LIBS)
+      PHP_EVAL_INCLINE($SYSTEMD_INCS)
       php_fpm_systemd=notify
     fi
   else
-- 
1.9.2

From 144a08395408506fa700c71e74c360160da3bd99 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Sat, 19 Jul 2014 18:42:40 +0200
Subject: [PATCH] improve previous, add message during configure

---
 sapi/fpm/config.m4 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index e1c740d..96b0edf 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -590,9 +590,12 @@ if test "$PHP_FPM" != "no"; then
     unset SYSTEMD_LIBS
     unset SYSTEMD_INCS
     if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then
+      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`
       HAVE_SD_DAEMON_H="yes"
+      AC_MSG_RESULT([version $SYSTEMD_VERS])
     else
       AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
       AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
-- 
1.9.2

From 658f7d77f9eb447ecc2f9812d46b4c07bb99b16d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Sun, 20 Jul 2014 11:14:43 +0200
Subject: [PATCH] See bug #67635

Improve previous fix:
- also rely on pkg-config for systemd < 209
- always check for header
- comments
---
 sapi/fpm/config.m4 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index 96b0edf..6db5e3b 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -589,17 +589,29 @@ if test "$PHP_FPM" != "no"; then
     fi
     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`
-      HAVE_SD_DAEMON_H="yes"
       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")
-      AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
     fi
+
+    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
       AC_MSG_ERROR([Your system does not support systemd.])
     else
-- 
1.9.2