Skip to content

Commit 59a4c95

Browse files
committed
proper builds for server
1 parent f6db3ad commit 59a4c95

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

Diff for: config.m4

+42-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ PHP_ARG_ENABLE(memcached-json, whether to enable memcached json serializer suppo
2020
PHP_ARG_ENABLE(memcached-sasl, whether to disable memcached sasl support,
2121
[ --disable-memcached-sasl Disable memcached sasl support], yes, no)
2222

23+
PHP_ARG_ENABLE(memcached-protocol, whether to enable memcached protocol support,
24+
[ --enable-memcached-protocol Enable memcached protocoll support], no, no)
25+
2326
if test -z "$PHP_ZLIB_DIR"; then
2427
PHP_ARG_WITH(zlib-dir, for ZLIB,
2528
[ --with-zlib-dir[=DIR] Set the path to ZLIB install prefix.], no)
@@ -337,18 +340,50 @@ if test "$PHP_MEMCACHED" != "no"; then
337340
AC_DEFINE(HAVE_LIBMEMCACHED_TOUCH, [1], [Whether memcached_touch is defined])
338341
fi
339342

340-
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
341-
342-
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c php_memcached_server.c fastlz/fastlz.c g_fmt.c"
343+
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c fastlz/fastlz.c g_fmt.c"
343344

344345
if test "$PHP_MEMCACHED_SESSION" != "no"; then
345346
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c"
346347
fi
347-
348-
PHP_ADD_LIBRARY_WITH_PATH(memcachedprotocol, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
349-
PHP_ADD_LIBRARY_WITH_PATH(event, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
350348

351-
PHP_NEW_EXTENSION(memcached, $PHP_MEMCACHED_FILES, $ext_shared,,$SESSION_INCLUDES $IGBINARY_INCLUDES)
349+
LIBEVENT_INCLUDES=""
350+
if test "$PHP_MEMCACHED_PROTOCOL" != "no"; then
351+
352+
AC_MSG_CHECKING([for libmemcachedprotocol location])
353+
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
354+
if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcachedprotocol-0.0/handler.h"; then
355+
AC_MSG_ERROR([Can't find libmemcachedprotocol headers under "$PHP_LIBMEMCACHED_DIR"])
356+
fi
357+
fi
358+
AC_MSG_CHECKING([found])
359+
360+
PHP_ADD_LIBRARY_WITH_PATH(memcachedprotocol, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
361+
362+
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
363+
if test "x$PKG_CONFIG" = "xno"; then
364+
AC_MSG_RESULT([pkg-config not found])
365+
AC_MSG_ERROR([Please reinstall the pkg-config distribution])
366+
fi
367+
368+
if $PKG_CONFIG --exists libevent; then
369+
PHP_MEMCACHED_LIBEVENT_VERSION=`$PKG_CONFIG libevent --modversion`
370+
PHP_MEMCACHED_LIBEVENT_PREFIX=`$PKG_CONFIG libevent --variable=prefix`
371+
372+
AC_MSG_RESULT([found version $PHP_MEMCACHED_LIBEVENT_VERSION, under $PHP_MEMCACHED_LIBEVENT_PREFIX])
373+
LIBEVENT_LIBS=`$PKG_CONFIG libevent --libs`
374+
LIBEVENT_INCLUDES=`$PKG_CONFIG libevent --cflags`
375+
376+
PHP_EVAL_LIBLINE($LIBEVENT_LIBS, MEMCACHED_SHARED_LIBADD)
377+
PHP_EVAL_INCLINE($LIBEVENT_INCLUDES)
378+
else
379+
AC_MSG_ERROR(Unable to find libevent installation)
380+
fi
381+
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_server.c"
382+
fi
383+
384+
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
385+
386+
PHP_NEW_EXTENSION(memcached, $PHP_MEMCACHED_FILES, $ext_shared,,$SESSION_INCLUDES $IGBINARY_INCLUDES $LIBEVENT_INCLUDES)
352387
PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1)
353388

354389
ifdef([PHP_ADD_EXTENSION_DEP],

0 commit comments

Comments
 (0)