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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
From 3dfeb1ce45bb87da31cc11613c9dd088a67300df Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 4 Jul 2013 16:56:16 +0200
Subject: [PATCH 1/2] allow to build with APC or APCU
---
config.m4 | 13 +++++++++----
igbinary.c | 12 ++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/config.m4 b/config.m4
index d1e739f..158a222 100644
--- a/config.m4
+++ b/config.m4
@@ -20,10 +20,15 @@ if test "$PHP_IGBINARY" != "no"; then
AC_CHECK_HEADERS([stddef.h],, AC_MSG_ERROR([stddef.h not exists]))
AC_CHECK_HEADERS([stdint.h],, AC_MSG_ERROR([stdint.h not exists]))
- AC_MSG_CHECKING([for apc includes])
- if test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
- apc_inc_path="$phpincludedir"
- AC_MSG_RESULT([$apc_inc_path])
+ AC_MSG_CHECKING([for APC/APCU includes])
+ if test -f "$phpincludedir/ext/apcu/apc_api.h"; then
+ apc_inc_path="$phpincludedir"
+ AC_MSG_RESULT([APCU in $apc_inc_path])
+ AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
+ AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apc support via apcu])
+ elif test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
+ apc_inc_path="$phpincludedir"
+ AC_MSG_RESULT([APC in $apc_inc_path])
AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
elif test -f "${srcdir}/apc_serializer.h"; then
AC_MSG_RESULT([apc_serializer.h bundled])
diff --git a/igbinary.c b/igbinary.c
index 0c2eab1..157531b 100644
--- a/igbinary.c
+++ b/igbinary.c
@@ -28,6 +28,9 @@
#include "ext/standard/php_incomplete_class.h"
+#ifdef HAVE_APCU_SUPPORT
+# include "ext/apcu/apc_api.h"
+#else
#ifdef HAVE_APC_SUPPORT
# if USE_BUNDLED_APC
# include "apc_serializer.h"
@@ -35,6 +38,7 @@
# include "ext/apc/apc_serializer.h"
# endif
#endif /* HAVE_APC_SUPPORT */
+#endif /* HAVE_APCU_SUPPORT */
#include "php_igbinary.h"
#include "igbinary.h"
@@ -242,9 +246,13 @@ struct igbinary_unserialize_data {
#ifdef HAVE_PHP_SESSION
ZEND_MOD_REQUIRED("session")
#endif
+#ifdef HAVE_APCU_SUPPORT
+ ZEND_MOD_REQUIRED("apcu")
+#else
#ifdef HAVE_APC_SUPPORT
ZEND_MOD_OPTIONAL("apc")
#endif
+#endif
{NULL, NULL, NULL}
};
#endif
@@ -339,11 +347,15 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
php_info_print_table_start();
php_info_print_table_row(2, "igbinary support", "enabled");
php_info_print_table_row(2, "igbinary version", IGBINARY_VERSION);
+#ifdef HAVE_APCU_SUPPORT
+ php_info_print_table_row(2, "igbinary APCU serializer ABI", "yes");
+#else
#ifdef HAVE_APC_SUPPORT
php_info_print_table_row(2, "igbinary APC serializer ABI", APC_SERIALIZER_ABI);
#else
php_info_print_table_row(2, "igbinary APC serializer ABI", "no");
#endif
+#endif
#if HAVE_PHP_SESSION
php_info_print_table_row(2, "igbinary session support", "yes");
#else
--
1.8.1.6
From 2d95bc51e8b9f84f823d17d32a26e244afd4cda8 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Sat, 27 Jul 2013 14:45:56 +0200
Subject: [PATCH 2/2] improve APCU build (now that APCU have restored APC
serializers ABI)
---
config.m4 | 5 ++---
igbinary.c | 20 ++++++++++----------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/config.m4 b/config.m4
index 158a222..4a551f2 100644
--- a/config.m4
+++ b/config.m4
@@ -21,11 +21,10 @@ if test "$PHP_IGBINARY" != "no"; then
AC_CHECK_HEADERS([stdint.h],, AC_MSG_ERROR([stdint.h not exists]))
AC_MSG_CHECKING([for APC/APCU includes])
- if test -f "$phpincludedir/ext/apcu/apc_api.h"; then
+ if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
apc_inc_path="$phpincludedir"
AC_MSG_RESULT([APCU in $apc_inc_path])
- AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
- AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apc support via apcu])
+ AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apcu support])
elif test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
apc_inc_path="$phpincludedir"
AC_MSG_RESULT([APC in $apc_inc_path])
diff --git a/igbinary.c b/igbinary.c
index 157531b..bc7aa6d 100644
--- a/igbinary.c
+++ b/igbinary.c
@@ -29,8 +29,9 @@
#include "ext/standard/php_incomplete_class.h"
#ifdef HAVE_APCU_SUPPORT
-# include "ext/apcu/apc_api.h"
-#else
+# include "ext/apcu/apc_serializer.h"
+#endif /* HAVE_APCU_SUPPORT */
+
#ifdef HAVE_APC_SUPPORT
# if USE_BUNDLED_APC
# include "apc_serializer.h"
@@ -38,7 +39,7 @@
# include "ext/apc/apc_serializer.h"
# endif
#endif /* HAVE_APC_SUPPORT */
-#endif /* HAVE_APCU_SUPPORT */
+
#include "php_igbinary.h"
#include "igbinary.h"
@@ -60,7 +61,7 @@
PS_SERIALIZER_FUNCS(igbinary);
#endif /* HAVE_PHP_SESSION */
-#ifdef HAVE_APC_SUPPORT
+#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
/** Apc serializer function prototypes */
static int APC_SERIALIZER_NAME(igbinary) (APC_SERIALIZER_ARGS);
static int APC_UNSERIALIZER_NAME(igbinary) (APC_UNSERIALIZER_ARGS);
@@ -247,12 +248,11 @@ struct igbinary_unserialize_data {
ZEND_MOD_REQUIRED("session")
#endif
#ifdef HAVE_APCU_SUPPORT
- ZEND_MOD_REQUIRED("apcu")
-#else
+ ZEND_MOD_OPTIONAL("apcu")
+#endif
#ifdef HAVE_APC_SUPPORT
ZEND_MOD_OPTIONAL("apc")
#endif
-#endif
{NULL, NULL, NULL}
};
#endif
@@ -312,7 +312,7 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
PS_SERIALIZER_DECODE_NAME(igbinary));
#endif
-#ifdef HAVE_APC_SUPPORT
+#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
apc_register_serializer("igbinary",
APC_SERIALIZER_NAME(igbinary),
APC_UNSERIALIZER_NAME(igbinary),
@@ -348,7 +348,7 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
php_info_print_table_row(2, "igbinary support", "enabled");
php_info_print_table_row(2, "igbinary version", IGBINARY_VERSION);
#ifdef HAVE_APCU_SUPPORT
- php_info_print_table_row(2, "igbinary APCU serializer ABI", "yes");
+ php_info_print_table_row(2, "igbinary APCU serializer ABI", APC_SERIALIZER_ABI);
#else
#ifdef HAVE_APC_SUPPORT
php_info_print_table_row(2, "igbinary APC serializer ABI", APC_SERIALIZER_ABI);
@@ -604,7 +604,7 @@ IGBINARY_API int igbinary_unserialize(const uint8_t *buf, size_t buf_len, zval *
/* }}} */
#endif /* HAVE_PHP_SESSION */
-#ifdef HAVE_APC_SUPPORT
+#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
/* {{{ apc_serialize function */
static int APC_SERIALIZER_NAME(igbinary) ( APC_SERIALIZER_ARGS ) {
(void)config;
--
1.8.1.6
From 272e78821b96815fc40d364f9971add10a0bf66e Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Sat, 27 Jul 2013 15:03:06 +0200
Subject: [PATCH] fix test when APCU used
---
tests/igbinary_029.phpt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/igbinary_029.phpt b/tests/igbinary_029.phpt
index 9027638..f1941d2 100644
--- a/tests/igbinary_029.phpt
+++ b/tests/igbinary_029.phpt
@@ -19,6 +19,6 @@ echo implode("\n", $array);
igbinary
igbinary support => enabled
igbinary version => %s
-igbinary APC serializer ABI => %s
+igbinary AP%s serializer ABI => %s
igbinary session support => %s
igbinary.compact_strings => %s => %s
--
1.8.3.1
|