forked from php-zookeeper/php-zookeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
130 lines (108 loc) · 4.83 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
dnl vim:se ts=2 sw=2 et:
PHP_ARG_ENABLE(zookeeper, whether to enable zookeeper support,
[ --enable-zookeeper Enable zookeeper support])
PHP_ARG_ENABLE(zookeeper-session, whether to enable zookeeper session handler support,
[ --disable-zookeeper-session Disable zookeeper session handler support], yes, no)
PHP_ARG_WITH(libzookeeper-dir, for libzookeeper,
[ --with-libzookeeper-dir[=DIR] Set the path to libzookeeper install prefix.], yes)
if test -z "$PHP_DEBUG"; then
AC_ARG_ENABLE(debug,
[ --enable-debug compile with debugging symbols],[
PHP_DEBUG=$enableval
],[ PHP_DEBUG=no
])
fi
if test "$PHP_ZOOKEEPER" != "no"; then
if test "$PHP_LIBZOOKEEPER_DIR" != "no" && test "$PHP_LIBZOOKEEPER_DIR" != "yes"; then
if test -r "$PHP_LIBZOOKEEPER_DIR/include/c-client-src/zookeeper.h"; then
PHP_LIBZOOKEEPER_DIR="$PHP_LIBZOOKEEPER_DIR"
elif test -r "$PHP_LIBZOOKEEPER_DIR/include/zookeeper/zookeeper.h"; then
PHP_LIBZOOKEEPER_DIR="$PHP_LIBZOOKEEPER_DIR"
elif test -r "$PHP_LIBZOOKEEPER_DIR/include/zookeeper.h"; then
PHP_LIBZOOKEEPER_DIR="$PHP_LIBZOOKEEPER_DIR"
else
AC_MSG_ERROR([Can't find zookeeper headers under "$PHP_LIBZOOKEEPER_DIR"])
fi
else
PHP_LIBZOOKEEPER_DIR="no"
for i in /usr /usr/local; do
if test -r "$i/include/c-client-src/zookeeper.h"; then
PHP_LIBZOOKEEPER_DIR=$i
break
elif test -r "$i/include/zookeeper/zookeeper.h"; then
PHP_LIBZOOKEEPER_DIR=$i
break
fi
done
fi
AC_MSG_CHECKING([for libzookeeper location])
if test "$PHP_LIBZOOKEEPER_DIR" = "no"; then
AC_MSG_ERROR([zookeeper support requires libzookeeper. Use --with-libzookeeper-dir=<DIR> to specify the prefix where libzookeeper headers and library are located])
else
AC_MSG_RESULT([$PHP_LIBZOOKEEPER_DIR])
if test -r "$PHP_LIBZOOKEEPER_DIR/include/c-client-src/zookeeper.h"; then
PHP_LIBZOOKEEPER_INCDIR="$PHP_LIBZOOKEEPER_DIR/include/c-client-src"
elif test -r "$PHP_LIBZOOKEEPER_DIR/include/zookeeper/zookeeper.h"; then
PHP_LIBZOOKEEPER_INCDIR="$PHP_LIBZOOKEEPER_DIR/include/zookeeper"
elif test -r "$PHP_LIBZOOKEEPER_DIR/include/zookeeper.h"; then
PHP_LIBZOOKEEPER_INCDIR="$PHP_LIBZOOKEEPER_DIR/include"
fi
AC_MSG_CHECKING([whether zookeeper session handler is enabled])
if test "$PHP_ZOOKEEPER_SESSION" != "no"; then
AC_MSG_RESULT([enabled])
AC_MSG_CHECKING([for session includes])
session_inc_path=""
if test -f "$abs_srcdir/include/php/ext/session/php_session.h"; then
session_inc_path="$abs_srcdir/include/php"
elif test -f "$abs_srcdir/ext/session/php_session.h"; then
session_inc_path="$abs_srcdir"
elif test -f "$phpincludedir/ext/session/php_session.h"; then
session_inc_path="$phpincludedir"
else
for i in php php4 php5 php6; do
if test -f "$prefix/include/$i/ext/session/php_session.h"; then
session_inc_path="$prefix/include/$i"
fi
done
fi
if test "$session_inc_path" = ""; then
AC_MSG_ERROR([Cannot find php_session.h])
else
AC_MSG_RESULT([$session_inc_path])
fi
SESSION_INCLUDES="-I$session_inc_path"
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(zookeeper, session)
])
AC_DEFINE(HAVE_ZOOKEEPER_SESSION,1,[Whether zookeeper session handler is enabled])
SESSION_EXTRA_FILES="php_zookeeper_session.c"
else
SESSION_EXTRA_FILES=""
SESSION_INCLUDES=""
AC_MSG_RESULT([disabled])
fi
PHP_ADD_INCLUDE($PHP_LIBZOOKEEPER_INCDIR)
PHP_ADD_LIBRARY_WITH_PATH(zookeeper_mt, $PHP_LIBZOOKEEPER_DIR/$PHP_LIBDIR, ZOOKEEPER_SHARED_LIBADD)
PHP_CHECK_LIBRARY(pthread, pthread_create, [
PHP_ADD_LIBRARY(pthread)
AC_DEFINE(HAVE_PTHREAD,1,[ ])
])
AC_MSG_CHECKING([whether ZooKeeper Config is enabled])
ZOO_VERSION=$(cat ${PHP_LIBZOOKEEPER_INCDIR}/zookeeper_version.h |grep ZOO_VERSION|awk '{print $3}')
ZOO_MINOR_VERSION=$(cat ${PHP_LIBZOOKEEPER_INCDIR}/zookeeper_version.h |grep ZOO_MINOR_VERSION|awk '{print $3}')
PHP_ZOOKEEPER_CONFIG_FILES=""
if test $ZOO_VERSION; then
PHP_ZOOKEEPER_CONFIG_FILES="php_zookeeper_config_class.c"
AC_MSG_RESULT([enabled with ZOO_VERSION])
elif test ${ZOO_MINOR_VERSION} -eq 5; then
PHP_ZOOKEEPER_CONFIG_FILES="php_zookeeper_config_class.c"
AC_MSG_RESULT([enabled with ZOO_MINOR_VERSION])
else
AC_MSG_RESULT([disabled])
fi
AC_DEFINE(THREADED,1,[Must define this constant after zookeeper-3.5.0 to use multi-threaded library])
PHP_SUBST(ZOOKEEPER_SHARED_LIBADD)
PHP_NEW_EXTENSION(zookeeper, php_zookeeper.c zoo_lock.c $SESSION_EXTRA_FILES php_zookeeper_exceptions.c ${PHP_ZOOKEEPER_CONFIG_FILES} php_zookeeper_stat.c php_zookeeper_callback.c php_zookeeper_log.c, $ext_shared,,$SESSION_INCLUDES)
fi
fi