forked from brett19/php-couchbase
-
Notifications
You must be signed in to change notification settings - Fork 39
/
config.m4
179 lines (161 loc) · 6.6 KB
/
config.m4
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
PHP_ARG_WITH(couchbase, whether to enable Couchbase support,
[ --with-couchbase Include Couchbase support])
PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ library,
[ --with-system-fastlz Use system FastLZ library], no, no)
if test "$PHP_COUCHBASE" != "no"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libcouchbase)
dnl try given directory
if test -r $PHP_COUCHBASE/include/libcouchbase/couchbase.h; then
LIBCOUCHBASE_DIR=$PHP_COUCHBASE
AC_MSG_RESULT(found in $PHP_COUCHBASE)
dnl try pkg-config
elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libcouchbase; then
LIBCOUCHBASE_VERSION=`$PKG_CONFIG libcouchbase --modversion`
if $PKG_CONFIG libcouchbase --atleast-version 3.2.4; then
LIBCOUCHBASE_CFLAGS=`$PKG_CONFIG libcouchbase --cflags`
LIBCOUCHBASE_LIBS=`$PKG_CONFIG libcouchbase --libs`
AC_MSG_RESULT(from pkgconfig: version $LIBCOUCHBASE_VERSION found)
else
AC_MSG_ERROR([libcouchbase version $LIBCOUCHBASE_VERSION found, must be upgraded to version >= 3.2.4])
fi
dnl fallback on standard directory
else
for i in /usr/local /usr; do
if test -r $i/include/libcouchbase/couchbase.h; then
LIBCOUCHBASE_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
dnl from pkg-config
if test -n "$LIBCOUCHBASE_LIBS"; then
PHP_EVAL_LIBLINE($LIBCOUCHBASE_LIBS, COUCHBASE_SHARED_LIBADD)
PHP_EVAL_INCLINE($LIBCOUCHBASE_CFLAGS)
dnl not found in directories
elif test -z "$LIBCOUCHBASE_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the libcouchbase distribution -
libcouchbase.h should be <libcouchbase-dir>/include and
libcouchbase.a should be in <libcouchbase-dir>/lib)
dnl found in directory
else
AC_MSG_CHECKING([for libcouchbase version >= 3.2.4])
LCB_VERSION=$($EGREP "define LCB_VERSION " $LIBCOUCHBASE_DIR/include/libcouchbase/configuration.h | $SED -e 's/[[^0-9x]]//g')
AC_MSG_RESULT([$LCB_VERSION])
if test "x$LCB_VERSION" = "x0x000000"; then
AC_MSG_ERROR([seems like libcouchbase is not installed from official tarball or git clone. Do not use github tags to download releases.])
fi
if test $(printf %d $LCB_VERSION) -lt $(printf %d 0x030204); then
AC_MSG_ERROR([libcouchbase greater or equal to 3.2.4 required])
fi
PHP_ADD_INCLUDE($LIBCOUCHBASE_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(couchbase, $LIBCOUCHBASE_DIR/$PHP_LIBDIR, COUCHBASE_SHARED_LIBADD)
fi
PHP_SUBST(COUCHBASE_SHARED_LIBADD)
AC_DEFINE(HAVE_COUCHBASE, 1, [Whether you have Couchbase])
ifdef([PHP_ADD_EXTENDION_DEP], [
PHP_ADD_EXTENSION_DEP(couchbase, json)
])
PHP_SUBST(COUCHBASE_SHARED_LIBADD)
COUCHBASE_FILES=" \
couchbase.c \
exception.c \
log.c \
opcookie.c \
src/couchbase/authenticator.c \
src/couchbase/bucket.c \
src/couchbase/bucket/cbas.c \
src/couchbase/bucket/cbft.c \
src/couchbase/bucket/counter.c \
src/couchbase/bucket/exists.c \
src/couchbase/bucket/expiry_util.c \
src/couchbase/bucket/get.c \
src/couchbase/bucket/get_multi.c \
src/couchbase/bucket/get_replica.c \
src/couchbase/bucket/health.c \
src/couchbase/bucket/http.c \
src/couchbase/bucket/n1ql.c \
src/couchbase/bucket/remove.c \
src/couchbase/bucket/remove_multi.c \
src/couchbase/bucket/store.c \
src/couchbase/bucket/subdoc.c \
src/couchbase/bucket/touch.c \
src/couchbase/bucket/unlock.c \
src/couchbase/bucket/upsert_multi.c \
src/couchbase/bucket/view.c \
src/couchbase/cert_authenticator.c \
src/couchbase/cluster.c \
src/couchbase/cluster_options.c \
src/couchbase/collection.c \
src/couchbase/log_formatter.c \
src/couchbase/lookup_spec.c \
src/couchbase/managers/bucket_manager.c \
src/couchbase/managers/collection_manager.c \
src/couchbase/managers/analytics_index_manager.c \
src/couchbase/managers/query_index_manager.c \
src/couchbase/managers/search_index_manager.c \
src/couchbase/managers/user_manager.c \
src/couchbase/managers/view_index_manager.c \
src/couchbase/metrics.c \
src/couchbase/mutate_spec.c \
src/couchbase/mutation_state.c \
src/couchbase/password_authenticator.c \
src/couchbase/pool.c \
src/couchbase/result.c \
src/couchbase/search/boolean_field_query.c \
src/couchbase/search/boolean_query.c \
src/couchbase/search/conjunction_query.c \
src/couchbase/search/date_range_facet.c \
src/couchbase/search/date_range_query.c \
src/couchbase/search/disjunction_query.c \
src/couchbase/search/doc_id_query.c \
src/couchbase/search/facet.c \
src/couchbase/search/geo_bounding_box_query.c \
src/couchbase/search/geo_distance_query.c \
src/couchbase/search/geo_polygon_query.c \
src/couchbase/search/match_all_query.c \
src/couchbase/search/match_none_query.c \
src/couchbase/search/match_phrase_query.c \
src/couchbase/search/match_query.c \
src/couchbase/search/numeric_range_facet.c \
src/couchbase/search/numeric_range_query.c \
src/couchbase/search/phrase_query.c \
src/couchbase/search/prefix_query.c \
src/couchbase/search/query_string_query.c \
src/couchbase/search/regexp_query.c \
src/couchbase/search/search_query.c \
src/couchbase/search/sort.c \
src/couchbase/search/sort_field.c \
src/couchbase/search/sort_geo.c \
src/couchbase/search/sort_id.c \
src/couchbase/search/sort_score.c \
src/couchbase/search/term_facet.c \
src/couchbase/search/term_query.c \
src/couchbase/search/term_range_query.c \
src/couchbase/search/wildcard_query.c \
src/couchbase/search_options.c \
src/couchbase/tracing.c \
transcoding.c \
"
AC_CHECK_HEADERS([zlib.h])
PHP_CHECK_LIBRARY(z, compress, [
AC_DEFINE(HAVE_COUCHBASE_ZLIB,1,[Whether zlib compressor is enabled])
PHP_ADD_LIBRARY(z, 1, COUCHBASE_SHARED_LIBADD)],
[AC_MSG_WARN(zlib library not found)])
if test "$PHP_SYSTEM_FASTLZ" != "no"; then
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
COUCHBASE_FILES="${COUCHBASE_FILES} fastlz/fastlz.c"
fi
PHP_NEW_EXTENSION(couchbase, ${COUCHBASE_FILES}, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1)
PHP_ADD_BUILD_DIR($ext_builddir/src/couchbase, 1)
PHP_ADD_BUILD_DIR($ext_builddir/src/couchbase/search, 1)
PHP_ADD_BUILD_DIR($ext_builddir/src/couchbase/bucket, 1)
PHP_ADD_BUILD_DIR($ext_builddir/src/couchbase/managers, 1)
PHP_ADD_EXTENSION_DEP(couchbase, json)
fi