Skip to content

Commit 0f8bbc5

Browse files
committed
Merge pull request php-memcached-dev#151 from remicollet/issue-fastlz
allow to use system FastLZ
2 parents 7ad95cc + ada08eb commit 0f8bbc5

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

config.m4

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ PHP_ARG_ENABLE(memcached-sasl, whether to enable memcached sasl support,
2626
PHP_ARG_ENABLE(memcached-protocol, whether to enable memcached protocol support,
2727
[ --enable-memcached-protocol Enable memcached protocoll support], no, no)
2828

29+
PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ bibrary,
30+
[ --with-system-fastlz Use system FastLZ bibrary], no, no)
31+
2932
if test -z "$PHP_ZLIB_DIR"; then
3033
PHP_ARG_WITH(zlib-dir, for ZLIB,
3134
[ --with-zlib-dir[=DIR] Set the path to ZLIB install prefix.], no)
@@ -336,7 +339,17 @@ if test "$PHP_MEMCACHED" != "no"; then
336339
AC_MSG_RESULT([no])
337340
fi
338341

339-
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c fastlz/fastlz.c g_fmt.c"
342+
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c g_fmt.c"
343+
344+
if test "$PHP_SYSTEM_FASTLZ" != "no"; then
345+
AC_CHECK_HEADERS([fastlz.h], [ac_cv_have_fastlz="yes"], [ac_cv_have_fastlz="no"])
346+
PHP_CHECK_LIBRARY(fastlz, fastlz_compress,
347+
[PHP_ADD_LIBRARY(fastlz, 1, MEMCACHED_SHARED_LIBADD)],
348+
[AC_MSG_ERROR(FastLZ library not found)])
349+
else
350+
ac_cv_have_fastlz="no"
351+
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} fastlz/fastlz.c"
352+
fi
340353

341354
if test "$PHP_MEMCACHED_SESSION" != "no"; then
342355
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c"
@@ -390,8 +403,10 @@ if test "$PHP_MEMCACHED" != "no"; then
390403
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
391404

392405
PHP_NEW_EXTENSION(memcached, $PHP_MEMCACHED_FILES, $ext_shared,,$SESSION_INCLUDES $IGBINARY_INCLUDES $LIBEVENT_INCLUDES $MSGPACK_INCLUDES)
393-
PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1)
394-
406+
if test "ac_cv_have_fastlz" != "yes"; then
407+
PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1)
408+
fi
409+
395410
ifdef([PHP_ADD_EXTENSION_DEP],
396411
[
397412
PHP_ADD_EXTENSION_DEP(memcached, spl, true)

php_memcached.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
#ifdef HAVE_MEMCACHED_SESSION
3131
# include "php_memcached_session.h"
3232
#endif
33-
33+
#ifdef HAVE_FASTLZ_H
34+
#include <fastlz.h>
35+
#else
3436
#include "fastlz/fastlz.h"
37+
#endif
3538
#include <zlib.h>
3639

3740
#ifdef HAVE_JSON_API

0 commit comments

Comments
 (0)