@@ -8,6 +8,9 @@ dnl Make sure that the comment is aligned:
88PHP_ARG_ENABLE(redis-session, whether to disable sessions,
99[   --disable-redis-session      Disable session support]  , yes, no)
1010
11+ PHP_ARG_ENABLE(redis-json, whether to disable json serializer support,
12+ [   --disable-redis-json         Disable json serializer support]  , yes, no)
13+ 
1114PHP_ARG_ENABLE(redis-igbinary, whether to enable igbinary serializer support,
1215[   --enable-redis-igbinary Enable igbinary serializer support]  , no, no)
1316
@@ -26,7 +29,46 @@ if test "$PHP_REDIS" != "no"; then
2629    AC_DEFINE ( PHP_SESSION ,1 ,[ redis sessions] ) 
2730  fi
2831
29- dnl  Check for igbinary
32+   if test "PHP_REDIS_JSON" != "no"; then
33+     AC_MSG_CHECKING ( [ for json includes] ) 
34+     json_inc_path=""
35+     if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
36+       json_inc_path="$abs_srcdir/include/php"
37+     elif test -f "$abs_srcdir/ext/json/php_json.h"; then
38+       json_inc_path="$abs_srcdir"
39+     elif test -f "$phpincludedir/ext/json/php_json.h"; then
40+       json_inc_path="$phpincludedir"
41+     else
42+       for i in php php7; do
43+         if test -f "$prefix/include/$i/ext/json/php_json.h"; then
44+           json_inc_path="$prefix/include/$i"
45+         fi
46+       done
47+     fi
48+ 
49+     if test "$json_inc_path" = ""; then
50+       AC_MSG_ERROR ( [ Cannot find php_json.h] ) 
51+     else
52+       AC_MSG_RESULT ( [ $json_inc_path] ) 
53+     fi
54+   fi
55+ 
56+   AC_MSG_CHECKING ( [ for redis json support] ) 
57+   if test "$PHP_REDIS_JSON" != "no"; then
58+     AC_MSG_RESULT ( [ enabled] ) 
59+     AC_DEFINE ( HAVE_REDIS_JSON ,1 ,[ Whether redis json serializer is enabled] ) 
60+     JSON_INCLUDES="-I$json_inc_path"
61+     JSON_EXT_DIR="$json_inc_path/ext"
62+     ifdef ( [ PHP_ADD_EXTENSION_DEP]  ,
63+     [ 
64+       PHP_ADD_EXTENSION_DEP(redis, json) 
65+     ]  ) 
66+     PHP_ADD_INCLUDE($JSON_EXT_DIR)
67+   else
68+     JSON_INCLUDES=""
69+     AC_MSG_RESULT ( [ disabled] ) 
70+   fi
71+ 
3072  if test "$PHP_REDIS_IGBINARY" != "no"; then
3173    AC_MSG_CHECKING ( [ for igbinary includes] ) 
3274    igbinary_inc_path=""
@@ -68,6 +110,47 @@ dnl Check for igbinary
68110    AC_MSG_RESULT ( [ disabled] ) 
69111  fi
70112
113+   if test "$PHP_REDIS_MSGPACK" != "no"; then
114+     AC_MSG_CHECKING ( [ for msgpack includes] ) 
115+     msgpack_inc_path=""
116+ 
117+     if test -f "$abs_srcdir/include/php/ext/msgpack/php_msgpack.h"; then
118+       msgpack_inc_path="$abs_srcdir/include/php"
119+     elif test -f "$abs_srcdir/ext/msgpack/php_msgpack.h"; then
120+       msgpack_inc_path="$abs_srcdir"
121+     elif test -f "$phpincludedir/ext/msgpack/php_msgpack.h"; then
122+       msgpack_inc_path="$phpincludedir"
123+     else
124+       for i in php php7; do
125+         if test -f "$prefix/include/$i/ext/msgpack/php_msgpack.h"; then
126+           msgpack_inc_path="$prefix/include/$i"
127+         fi
128+       done
129+     fi
130+ 
131+     if test "$msgpack_inc_path" = ""; then
132+       AC_MSG_ERROR ( [ Cannot find php_msgpack.h] ) 
133+     else
134+       AC_MSG_RESULT ( [ $msgpack_inc_path] ) 
135+     fi
136+   fi
137+ 
138+   AC_MSG_CHECKING ( [ for redis msgpack support] ) 
139+   if test "$PHP_REDIS_MSGPACK" != "no"; then
140+     AC_MSG_RESULT ( [ enabled] ) 
141+     AC_DEFINE ( HAVE_REDIS_MSGPACK ,1 ,[ Whether redis msgpack serializer is enabled] ) 
142+     MSGPACK_INCLUDES="-I$msgpack_inc_path"
143+     MSGPACK_EXT_DIR="$msgpack_inc_path/ext"
144+     ifdef ( [ PHP_ADD_EXTENSION_DEP]  ,
145+     [ 
146+       PHP_ADD_EXTENSION_DEP(redis, msgpack) 
147+     ]  ) 
148+     PHP_ADD_INCLUDE($MSGPACK_EXT_DIR)
149+   else
150+     MSGPACK_INCLUDES=""
151+     AC_MSG_RESULT ( [ disabled] ) 
152+   fi
153+ 
71154  if test "$PHP_REDIS_LZF" != "no"; then
72155    AC_DEFINE ( HAVE_REDIS_LZF , 1 , [  ] ) 
73156    if test "$PHP_LIBLZF" != "no"; then
@@ -105,53 +188,6 @@ dnl Check for igbinary
105188    AC_DEFINE_UNQUOTED ( GIT_REVISION , [ "$(git log -1 --format=%H)"]  , [  ] ) 
106189  fi
107190
108- dnl  Check for msgpack
109-   if test "$PHP_REDIS_MSGPACK" != "no"; then
110-     AC_MSG_CHECKING ( [ for msgpack includes] ) 
111-     msgpack_inc_path=""
112- 
113-     if test -f "$abs_srcdir/include/php/ext/msgpack/php_msgpack.h"; then
114-       msgpack_inc_path="$abs_srcdir/include/php"
115-     elif test -f "$abs_srcdir/ext/msgpack/php_msgpack.h"; then
116-       msgpack_inc_path="$abs_srcdir"
117-     elif test -f "$phpincludedir/ext/msgpack/php_msgpack.h"; then
118-       msgpack_inc_path="$phpincludedir"
119-     else
120-       for i in php php7; do
121-         if test -f "$prefix/include/$i/ext/msgpack/php_msgpack.h"; then
122-           msgpack_inc_path="$prefix/include/$i"
123-         fi
124-       done
125-     fi
126- 
127-     if test "$msgpack_inc_path" = ""; then
128-       AC_MSG_ERROR ( [ Cannot find php_msgpack.h] ) 
129-     else
130-       AC_MSG_RESULT ( [ $msgpack_inc_path] ) 
131-     fi
132-   fi
133- 
134-   AC_MSG_CHECKING ( [ for redis msgpack support] ) 
135-   if test "$PHP_REDIS_MSGPACK" != "no"; then
136-     msgpack_version=`grep -o 'PHP_MSGPACK_VERSION "[ 0-9\.]  \+"' $msgpack_inc_path/ext/msgpack/php_msgpack.h | awk '{print $2}' | tr -d '"'`
137-     if expr $msgpack_version "<" "2.0.3" > /dev/null; then
138-       AC_MSG_ERROR ( [ msgpack 2.0.3 or greater required] ) 
139-     else
140-       AC_MSG_RESULT ( [ enabled] ) 
141-       AC_DEFINE ( HAVE_REDIS_MSGPACK ,1 ,[ Whether redis msgpack serializer is enabled] ) 
142-       MSGPACK_INCLUDES="-I$msgpack_inc_path"
143-       MSGPACK_EXT_DIR="$msgpack_inc_path/ext"
144-       ifdef ( [ PHP_ADD_EXTENSION_DEP]  ,
145-       [ 
146-         PHP_ADD_EXTENSION_DEP(redis, msgpack) 
147-       ]  ) 
148-       PHP_ADD_INCLUDE($MSGPACK_EXT_DIR)
149-     fi
150-   else
151-     MSGPACK_INCLUDES=""
152-     AC_MSG_RESULT ( [ disabled] ) 
153-   fi
154- 
155191  dnl  # --with-redis -> check with-path
156192  dnl  SEARCH_PATH="/usr/local /usr"     # you might want to change this
157193  dnl  SEARCH_FOR="/include/redis.h"  # you most likely want to change this
0 commit comments