Skip to content

Commit a24e439

Browse files
committed
tidy configure stuff for json
1 parent 2f5a5b0 commit a24e439

File tree

3 files changed

+22
-41
lines changed

3 files changed

+22
-41
lines changed

.travis/travis.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ function build_php_memcached() {
129129
sasl_flag="--enable-memcached-sasl"
130130
fi
131131

132-
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-igbinary --enable-memcached-msgpack
133-
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json
132+
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
133+
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
134134
make
135135
make install
136136
popd

config.m4

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -106,49 +106,29 @@ if test "$PHP_MEMCACHED" != "no"; then
106106
AC_MSG_RESULT([$session_inc_path])
107107
fi
108108
fi
109-
109+
110110
if test "$PHP_MEMCACHED_JSON" != "no"; then
111111
AC_MSG_CHECKING([for json includes])
112112
json_inc_path=""
113-
114-
tmp_version=$PHP_VERSION
115-
if test -z "$tmp_version"; then
116-
if test -z "$PHP_CONFIG"; then
117-
AC_MSG_ERROR([php-config not found])
118-
fi
119-
PHP_MEMCACHED_VERSION_ORIG=`$PHP_CONFIG --version`;
120-
else
121-
PHP_MEMCACHED_VERSION_ORIG=$tmp_version
122-
fi
123113

124-
if test -z $PHP_MEMCACHED_VERSION_ORIG; then
125-
AC_MSG_ERROR([failed to detect PHP version, please report])
114+
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
115+
json_inc_path="$abs_srcdir/include/php"
116+
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
117+
json_inc_path="$abs_srcdir"
118+
elif test -f "$phpincludedir/ext/json/php_json.h"; then
119+
json_inc_path="$phpincludedir"
120+
else
121+
for i in php php4 php5 php6; do
122+
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
123+
json_inc_path="$prefix/include/$i"
124+
fi
125+
done
126126
fi
127-
128-
PHP_MEMCACHED_VERSION_MASK=`echo ${PHP_MEMCACHED_VERSION_ORIG} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
129-
130-
if test $PHP_MEMCACHED_VERSION_MASK -ge 7000000; then
131-
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
132-
json_inc_path="$abs_srcdir/include/php"
133-
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
134-
json_inc_path="$abs_srcdir"
135-
elif test -f "$phpincludedir/ext/json/php_json.h"; then
136-
json_inc_path="$phpincludedir"
137-
else
138-
for i in php php4 php5 php6; do
139-
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
140-
json_inc_path="$prefix/include/$i"
141-
fi
142-
done
143-
fi
144-
if test "$json_inc_path" = ""; then
145-
AC_MSG_ERROR([Cannot find php_json.h])
146-
else
147-
AC_DEFINE(HAVE_JSON_API,1,[Whether JSON API is available])
148-
AC_MSG_RESULT([$json_inc_path])
149-
fi
127+
if test "$json_inc_path" = ""; then
128+
AC_MSG_ERROR([Cannot find php_json.h])
150129
else
151-
AC_MSG_RESULT([this version of memcached is only suitable for PHP7+])
130+
AC_DEFINE(HAVE_JSON_API,1,[Whether JSON API is available])
131+
AC_MSG_RESULT([$json_inc_path])
152132
fi
153133
fi
154134

tests/types.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ function memc_types_test ($m, $options)
5454
if ($value == $actual && get_class($value) == get_class($actual))
5555
continue;
5656
}
57-
echo "=== $types[0] ===\n";
57+
echo "=== {$key} ===\n";
5858
echo "Expected: ";
59-
var_dump($types[1]);
59+
var_dump($value);
6060
echo "Actual: ";
6161
var_dump($actual);
62+
6263
}
6364
}
6465

0 commit comments

Comments
 (0)