summaryrefslogtreecommitdiffstats
path: root/couchbase-fastlz.patch
blob: 1cb86a628251c564e3278e0098ad7464d86440f3 (plain)
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
From 693266afdbef09db2fb09437a47d1662ab92d8c9 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 5 Nov 2015 07:58:17 +0100
Subject: [PATCH] add --with-system-fastlz configure option

---
 config.m4   | 23 +++++++++++++++++++++--
 couchbase.c |  2 +-
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/config.m4 b/config.m4
index c07db46..35db4c1 100644
--- a/config.m4
+++ b/config.m4
@@ -1,5 +1,9 @@
 PHP_ARG_ENABLE(couchbase, whether to enable Couchbase support,
-[ --with-couchbase   Include Couchbase support])
+[  --with-couchbase        Include Couchbase support])
+
+PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ bibrary,
+[  --with-system-fastlz    Use system FastLZ bibrary], no, no)
+
 if test "$PHP_COUCHBASE" = "yes"; then
   AC_DEFINE(HAVE_COUCHBASE, 1, [Whether you have Couchbase])
 
@@ -9,6 +13,16 @@ if test "$PHP_COUCHBASE" = "yes"; then
 
   PHP_ADD_LIBRARY(couchbase, 1, COUCHBASE_SHARED_LIBADD)
   
+  if test "$PHP_SYSTEM_FASTLZ" != "no"; then
+    FASTLZ=""
+    AC_CHECK_HEADERS([fastlz.h])
+    PHP_CHECK_LIBRARY(fastlz, fastlz_compress,
+      [PHP_ADD_LIBRARY(fastlz, 1, COUCHBASE_SHARED_LIBADD)],
+      [AC_MSG_ERROR(FastLZ library not found)])
+  else
+    FASTLZ="fastlz/fastlz.c"
+  fi
+
   ifdef([PHP_ADD_EXTENDION_DEP], [
 	PHP_ADD_EXTENSION_DEP(couchbase, json)
   ]) 
@@ -22,6 +36,11 @@ if test "$PHP_COUCHBASE" = "yes"; then
 	exception.c \
 	metadoc.c \
 	transcoding.c \
-	fastlz/fastlz.c \
+	$FASTLZ \
   , $ext_shared)
+
+  if test -n "$FASTLZ" ; then
+    PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1)
+    PHP_ADD_INCLUDE([$ext_srcdir/fastlz])
+  fi
 fi
\ No newline at end of file
diff --git a/couchbase.c b/couchbase.c
index 53da789..25baaee 100644
--- a/couchbase.c
+++ b/couchbase.c
@@ -2,7 +2,7 @@
 #include "cas.h"
 #include "metadoc.h"
 #include "phpstubstr.h"
-#include "fastlz/fastlz.h"
+#include <fastlz.h>
 
 #if HAVE_ZLIB
 #include <zlib.h>