@@ -18,7 +18,7 @@ PHP_ARG_ENABLE(memcached-json, whether to enable memcached json serializer suppo
18
18
[ --enable-memcached-json Enable memcached json serializer support] , no, no)
19
19
20
20
PHP_ARG_ENABLE(memcached-sasl, whether to disable memcached sasl support,
21
- [ --disable-memcached-sasl Disable memcached sasl support] , no , no)
21
+ [ --disable-memcached-sasl Disable memcached sasl support] , yes , no)
22
22
23
23
if test -z "$PHP_ZLIB_DIR"; then
24
24
PHP_ARG_WITH(zlib-dir, for ZLIB,
@@ -224,8 +224,8 @@ if test "$PHP_MEMCACHED" != "no"; then
224
224
225
225
AC_MSG_CHECKING ( [ for libmemcached location] )
226
226
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
227
- if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached-1.0 /memcached.h"; then
228
- AC_MSG_ERROR ( [ Can't find libmemcached 1.0.x headers under "$PHP_LIBMEMCACHED_DIR"] )
227
+ if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached/memcached.h"; then
228
+ AC_MSG_ERROR ( [ Can't find libmemcached headers under "$PHP_LIBMEMCACHED_DIR"] )
229
229
fi
230
230
else
231
231
PHP_LIBMEMCACHED_DIR="no"
@@ -238,17 +238,108 @@ if test "$PHP_MEMCACHED" != "no"; then
238
238
fi
239
239
240
240
if test "$PHP_LIBMEMCACHED_DIR" = "no"; then
241
- AC_MSG_ERROR ( [ memcached support requires libmemcached 1.0.x . Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located] )
241
+ AC_MSG_ERROR ( [ memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located] )
242
242
else
243
243
AC_MSG_RESULT ( [ $PHP_LIBMEMCACHED_DIR] )
244
244
245
245
PHP_LIBMEMCACHED_INCDIR="$PHP_LIBMEMCACHED_DIR/include"
246
246
PHP_ADD_INCLUDE($PHP_LIBMEMCACHED_INCDIR)
247
247
PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
248
248
249
+ ORIG_CFLAGS="$CFLAGS"
250
+ ORIG_LIBS="$LIBS"
251
+
252
+ CFLAGS="$CFLAGS -I$PHP_LIBMEMCACHED_INCDIR"
253
+
254
+ #
255
+ # Added -lpthread here because AC_TRY_LINK tests on CentOS 6 seem to fail with undefined reference to pthread_once
256
+ #
257
+ LIBS="$LIBS -lpthread -lmemcached -L$PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR"
258
+
259
+ AC_CACHE_CHECK ( [ whether memcached_instance_st is defined] , ac_cv_have_memcached_instance_st , [
260
+ AC_TRY_COMPILE (
261
+ [ #include <libmemcached/memcached.h> ] ,
262
+ [ const memcached_instance_st *instance = NULL; ] ,
263
+ [ ac_cv_have_memcached_instance_st="yes" ] ,
264
+ [ ac_cv_have_memcached_instance_st="no" ]
265
+ )
266
+ ] )
267
+
268
+ AC_CACHE_CHECK ( [ whether MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS is defined] , ac_cv_have_libmemcached_remove_failed_servers , [
269
+ AC_TRY_COMPILE (
270
+ [ #include <libmemcached/memcached.h> ] ,
271
+ [ MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS; ] ,
272
+ [ ac_cv_have_libmemcached_remove_failed_servers="yes" ] ,
273
+ [ ac_cv_have_libmemcached_remove_failed_servers="no" ]
274
+ )
275
+ ] )
276
+
277
+ AC_CACHE_CHECK ( [ whether MEMCACHED_SERVER_TEMPORARILY_DISABLED is defined] , ac_cv_have_libmemcached_server_temporarily_disabled , [
278
+ AC_TRY_COMPILE (
279
+ [ #include <libmemcached/memcached.h> ] ,
280
+ [ MEMCACHED_SERVER_TEMPORARILY_DISABLED; ] ,
281
+ [ ac_cv_have_libmemcached_server_temporarily_disabled="yes" ] ,
282
+ [ ac_cv_have_libmemcached_server_temporarily_disabled="no" ]
283
+ )
284
+ ] )
285
+
286
+ AC_CACHE_CHECK ( [ whether memcached function exists] , ac_cv_have_libmemcached_memcached , [
287
+ AC_TRY_LINK (
288
+ [ #include <libmemcached/memcached.h> ] ,
289
+ [ memcached("t", sizeof ("t")); ] ,
290
+ [ ac_cv_have_libmemcached_memcached="yes" ] ,
291
+ [ ac_cv_have_libmemcached_memcached="no" ]
292
+ )
293
+ ] )
294
+
295
+ AC_CACHE_CHECK ( [ whether libmemcached_check_configuration function exists] , ac_cv_have_libmemcached_check_configuration , [
296
+ AC_TRY_LINK (
297
+ [ #include <libmemcached/memcached.h> ] ,
298
+ [ libmemcached_check_configuration("", 1, "", 1); ] ,
299
+ [ ac_cv_have_libmemcached_check_configuration="yes" ] ,
300
+ [ ac_cv_have_libmemcached_check_configuration="no" ]
301
+ )
302
+ ] )
303
+
304
+ AC_CACHE_CHECK ( [ whether memcached_touch function exists] , ac_cv_have_libmemcached_touch , [
305
+ AC_TRY_LINK (
306
+ [ #include <libmemcached/memcached.h> ] ,
307
+ [ memcached_touch (NULL, NULL, 0, 0); ] ,
308
+ [ ac_cv_have_libmemcached_touch="yes" ] ,
309
+ [ ac_cv_have_libmemcached_touch="no" ]
310
+ )
311
+ ] )
312
+
313
+ CFLAGS="$ORIG_CFLAGS"
314
+ LIBS="$ORIG_LIBS"
315
+
316
+ if test "$ac_cv_have_memcached_instance_st" = "yes"; then
317
+ AC_DEFINE ( HAVE_MEMCACHED_INSTANCE_ST , [ 1] , [ Whether memcached_instance_st is defined] )
318
+ fi
319
+
320
+ if test "$ac_cv_have_libmemcached_remove_failed_servers" = "yes"; then
321
+ AC_DEFINE ( HAVE_LIBMEMCACHED_REMOVE_FAILED_SERVERS , [ 1] , [ Whether MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS is defined] )
322
+ fi
323
+
324
+ if test "$ac_cv_have_libmemcached_server_temporarily_disabled" = "yes"; then
325
+ AC_DEFINE ( HAVE_LIBMEMCACHED_SERVER_TEMPORARILY_MARKER_DISABLED , [ 1] , [ Whether MEMCACHED_SERVER_TEMPORARILY_DISABLED is defined] )
326
+ fi
327
+
328
+ if test "$ac_cv_have_libmemcached_memcached" = "yes"; then
329
+ AC_DEFINE ( HAVE_LIBMEMCACHED_MEMCACHED , [ 1] , [ Whether memcached is defined] )
330
+ fi
331
+
332
+ if test "$ac_cv_have_libmemcached_check_configuration" = "yes"; then
333
+ AC_DEFINE ( HAVE_LIBMEMCACHED_CHECK_CONFIGURATION , [ 1] , [ Whether libmemcached_check_configuration is defined] )
334
+ fi
335
+
336
+ if test "$ac_cv_have_libmemcached_touch" = "yes"; then
337
+ AC_DEFINE ( HAVE_LIBMEMCACHED_TOUCH , [ 1] , [ Whether memcached_touch is defined] )
338
+ fi
339
+
249
340
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
250
341
251
- PHP_MEMCACHED_FILES="php_memcached.c fastlz/fastlz.c g_fmt.c"
342
+ PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c fastlz/fastlz.c g_fmt.c"
252
343
253
344
if test "$PHP_MEMCACHED_SESSION" != "no"; then
254
345
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c"
0 commit comments