Skip to content

Commit 748566f

Browse files
committed
Build fixes
1 parent b5ce538 commit 748566f

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

config.m4

+4-2
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,13 @@ if test "$PHP_MEMCACHED" != "no"; then
349349
LIBEVENT_INCLUDES=""
350350
if test "$PHP_MEMCACHED_PROTOCOL" != "no"; then
351351

352-
AC_MSG_CHECKING([for libmemcachedprotocol location])
352+
AC_MSG_CHECKING([for libmemcachedprotocol])
353353
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
354354
if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcachedprotocol-0.0/handler.h"; then
355355
AC_MSG_ERROR([Can't find libmemcachedprotocol headers under "$PHP_LIBMEMCACHED_DIR"])
356356
fi
357357
fi
358-
AC_MSG_CHECKING([found])
358+
AC_MSG_RESULT([found])
359359

360360
PHP_ADD_LIBRARY_WITH_PATH(memcachedprotocol, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
361361

@@ -365,6 +365,7 @@ if test "$PHP_MEMCACHED" != "no"; then
365365
AC_MSG_ERROR([Please reinstall the pkg-config distribution])
366366
fi
367367

368+
AC_MSG_CHECKING([for libevent])
368369
if $PKG_CONFIG --exists libevent; then
369370
PHP_MEMCACHED_LIBEVENT_VERSION=`$PKG_CONFIG libevent --modversion`
370371
PHP_MEMCACHED_LIBEVENT_PREFIX=`$PKG_CONFIG libevent --variable=prefix`
@@ -379,6 +380,7 @@ if test "$PHP_MEMCACHED" != "no"; then
379380
AC_MSG_ERROR(Unable to find libevent installation)
380381
fi
381382
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_server.c"
383+
AC_DEFINE(HAVE_MEMCACHED_PROTOCOL,1,[Whether memcached protocol is enabled])
382384
fi
383385

384386
PHP_SUBST(MEMCACHED_SHARED_LIBADD)

php_memcached.c

+23-6
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,15 @@ typedef struct {
214214
int memc_errno;
215215
} php_memc_t;
216216

217+
#ifdef HAVE_MEMCACHED_PROTOCOL
218+
217219
typedef struct {
218220
zend_object zo;
219221
php_memc_proto_handler_t *handler;
220222
} php_memc_server_t;
221223

224+
#endif
225+
222226
enum {
223227
MEMC_OP_SET,
224228
MEMC_OP_TOUCH,
@@ -229,11 +233,15 @@ enum {
229233
};
230234

231235
static zend_class_entry *memcached_ce = NULL;
232-
static zend_class_entry *memcached_server_ce = NULL;
236+
233237
static zend_class_entry *memcached_exception_ce = NULL;
234238

235239
static zend_object_handlers memcached_object_handlers;
240+
241+
#ifdef HAVE_MEMCACHED_PROTOCOL
236242
static zend_object_handlers memcached_server_object_handlers;
243+
static zend_class_entry *memcached_server_ce = NULL;
244+
#endif
237245

238246
struct callbackContext
239247
{
@@ -2653,6 +2661,7 @@ zend_object_value php_memc_new(zend_class_entry *ce TSRMLS_DC)
26532661
return retval;
26542662
}
26552663

2664+
#ifdef HAVE_MEMCACHED_PROTOCOL
26562665
static
26572666
void php_memc_server_free_storage(php_memc_server_t *intern TSRMLS_DC)
26582667
{
@@ -2681,6 +2690,7 @@ zend_object_value php_memc_server_new(zend_class_entry *ce TSRMLS_DC)
26812690

26822691
return retval;
26832692
}
2693+
#endif
26842694

26852695
ZEND_RSRC_DTOR_FUNC(php_memc_dtor)
26862696
{
@@ -3415,6 +3425,8 @@ static int php_memc_do_result_callback(zval *zmemc_obj, zend_fcall_info *fci,
34153425
}
34163426
/* }}} */
34173427

3428+
#ifdef HAVE_MEMCACHED_PROTOCOL
3429+
34183430
static
34193431
void s_destroy_cb (zend_fcall_info *fci)
34203432
{
@@ -3484,6 +3496,7 @@ PHP_METHOD(MemcachedServer, on)
34843496
RETURN_BOOL(rc);
34853497
}
34863498

3499+
#endif
34873500

34883501
/* {{{ methods arginfo */
34893502
ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0)
@@ -3853,6 +3866,7 @@ static zend_function_entry memcached_class_methods[] = {
38533866
#undef MEMC_ME
38543867
/* }}} */
38553868

3869+
#ifdef HAVE_MEMCACHED_PROTOCOL
38563870
/* {{{ */
38573871
#define MEMC_SE_ME(name, args) PHP_ME(MemcachedServer, name, args, ZEND_ACC_PUBLIC)
38583872
static
@@ -3863,7 +3877,7 @@ zend_function_entry memcached_server_class_methods[] = {
38633877
};
38643878
#undef MEMC_SE_ME
38653879
/* }}} */
3866-
3880+
#endif
38673881

38683882
/* {{{ memcached_module_entry
38693883
*/
@@ -4066,6 +4080,7 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
40664080
*/
40674081
REGISTER_MEMC_CLASS_CONST_LONG(GET_PRESERVE_ORDER, MEMC_GET_PRESERVE_ORDER);
40684082

4083+
#ifdef HAVE_MEMCACHED_PROTOCOL
40694084
/*
40704085
* Server callbacks
40714086
*/
@@ -4101,7 +4116,7 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
41014116
REGISTER_MEMC_CLASS_CONST_LONG(RESPONSE_EINTERNAL, PROTOCOL_BINARY_RESPONSE_EINTERNAL);
41024117
REGISTER_MEMC_CLASS_CONST_LONG(RESPONSE_EBUSY, PROTOCOL_BINARY_RESPONSE_EBUSY);
41034118
REGISTER_MEMC_CLASS_CONST_LONG(RESPONSE_ETMPFAIL, PROTOCOL_BINARY_RESPONSE_ETMPFAIL);
4104-
4119+
#endif
41054120

41064121
#undef REGISTER_MEMC_CLASS_CONST_LONG
41074122

@@ -4125,19 +4140,21 @@ PHP_MINIT_FUNCTION(memcached)
41254140
memcpy(&memcached_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
41264141
memcached_object_handlers.clone_obj = NULL;
41274142

4128-
memcpy(&memcached_server_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
4129-
memcached_server_object_handlers.clone_obj = NULL;
4130-
41314143
le_memc = zend_register_list_destructors_ex(NULL, php_memc_dtor, "Memcached persistent connection", module_number);
41324144
le_memc_sess = zend_register_list_destructors_ex(NULL, php_memc_sess_dtor, "Memcached Sessions persistent connection", module_number);
41334145

41344146
INIT_CLASS_ENTRY(ce, "Memcached", memcached_class_methods);
41354147
memcached_ce = zend_register_internal_class(&ce TSRMLS_CC);
41364148
memcached_ce->create_object = php_memc_new;
41374149

4150+
#ifdef HAVE_MEMCACHED_PROTOCOL
4151+
memcpy(&memcached_server_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
4152+
memcached_server_object_handlers.clone_obj = NULL;
4153+
41384154
INIT_CLASS_ENTRY(ce, "MemcachedServer", memcached_server_class_methods);
41394155
memcached_server_ce = zend_register_internal_class(&ce TSRMLS_CC);
41404156
memcached_server_ce->create_object = php_memc_server_new;
4157+
#endif
41414158

41424159
INIT_CLASS_ENTRY(ce, "MemcachedException", NULL);
41434160
memcached_exception_ce = zend_register_internal_class_ex(&ce, php_memc_get_exception_base(0 TSRMLS_CC), NULL TSRMLS_CC);

php_memcached.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ enum memcached_serializer {
5858
# endif
5959
#endif
6060

61+
#ifdef HAVE_MEMCACHED_PROTOCOL
6162
typedef enum {
6263
MEMC_SERVER_ON_MIN = -1,
6364
MEMC_SERVER_ON_CONNECT = 0,
@@ -83,6 +84,7 @@ typedef struct {
8384
zend_fcall_info fci;
8485
zend_fcall_info_cache fci_cache;
8586
} php_memc_server_cb_t;
87+
#endif
8688

8789
ZEND_BEGIN_MODULE_GLOBALS(php_memcached)
8890
#ifdef HAVE_MEMCACHED_SESSION
@@ -119,10 +121,11 @@ ZEND_BEGIN_MODULE_GLOBALS(php_memcached)
119121
#if HAVE_MEMCACHED_SASL
120122
bool use_sasl;
121123
#endif
122-
124+
#ifdef HAVE_MEMCACHED_PROTOCOL
123125
struct {
124126
php_memc_server_cb_t callbacks [14];
125127
} server;
128+
#endif
126129
ZEND_END_MODULE_GLOBALS(php_memcached)
127130

128131
PHP_MEMCACHED_API zend_class_entry *php_memc_get_ce(void);

php_memcached_server.h

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef _PHP_MEMCACHED_SERVER_H_
1818
# define _PHP_MEMCACHED_SERVER_H_
1919

20+
#ifdef HAVE_MEMCACHED_PROTOCOL
21+
2022
#include <libmemcachedprotocol-0.0/handler.h>
2123

2224
/*
@@ -33,5 +35,6 @@ void php_memc_proto_handler_destroy (php_memc_proto_handler_t **ptr);
3335

3436
zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *h, const char *address);
3537

38+
#endif
3639

3740
#endif

0 commit comments

Comments
 (0)