Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove bundled library, allow linking against globally installed hiredis

  • Loading branch information...
commit 55c0022c0cb49d96d60629ddfe86466bde4b7c70 1 parent 3fb10fc
@lstrojny lstrojny authored Sebastian Waisbrot committed
View
3  .gitmodules
@@ -1,3 +0,0 @@
-[submodule "lib/hiredis"]
- path = lib/hiredis
- url = https://github.com/antirez/hiredis.git
View
34 config.m4
@@ -1,10 +1,38 @@
PHP_ARG_ENABLE(phpiredis, whether to enable phpiredis support,
[ --enable-phpiredis Enable phpiredis support])
+PHP_ARG_WITH(hiredis-dir, for hiredis library,
+[ --with-hiredis-dir[=DIR] Set the path to hiredis install prefix.], yes)
+
if test "$PHP_PHPIREDIS" = "yes"; then
AC_DEFINE(HAVE_PHPIREDIS, 1, [Whether you have phpiredis])
- extra_sources="lib/hiredis/hiredis.c lib/hiredis/sds.c lib/hiredis/net.c"
- PHP_NEW_EXTENSION(phpiredis, phpiredis.c $extra_sources, $ext_shared)
- PHP_ADD_BUILD_DIR(lib/hiredis)
+ PKG_CONFIG=`which pkg-config`
+
+ if test "$PHP_HIREDIS_DIR" != "no" && test "$PHP_HIREDIS_DIR" != "yes"; then
+ for i in $PHP_HIREDIS_DIR /usr /usr/local; do
+ if test -r $i/include/$SEARCH_FOR; then
+ HIREDIS_DIR=$i
+ break
+ fi
+ done
+ if test -z $HIREDIS_DIR; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(Could not find hiredis in search paths)
+ fi
+ AC_MSG_RESULT(Found hiredis in $HIREDIS_DIR)
+ PHP_EVAL_LIBLINE(-lhiredis)
+ PHP_EVAL_INCLINE(-I$HIREDIS_DIR/include)
+ elif $PKG_CONFIG --exists hiredis; then
+ HIREDIS_VERSION=`$PKG_CONFIG --modversion hiredis`
+ AC_MSG_RESULT([Found hiredis $HIREDIS_VERSION])
+ PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags-only-I hiredis`)
+ PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs hiredis`, PHPIREDIS_SHARED_LIBADD)
+ else
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(Ooops ! hiredis not found)
+ fi
+
+ PHP_SUBST(PHPIREDIS_SHARED_LIBADD)
+ PHP_NEW_EXTENSION(phpiredis, phpiredis.c, $ext_shared)
fi
1  lib/hiredis
@@ -1 +0,0 @@
-Subproject commit f8debbfdbebb97f5d0ee2218edf1425ac219cff5
View
2  php_phpiredis_struct.h
@@ -1,4 +1,4 @@
-#include "lib/hiredis/hiredis.h"
+#include "hiredis/hiredis.h"
typedef struct _phpiredis_connection {
redisContext *c;
View
2  phpiredis.c
@@ -2,7 +2,7 @@
#include "config.h"
#endif
-#include "lib/hiredis/hiredis.h"
+#include "hiredis/hiredis.h"
#include "php.h"
#include "php_ini.h"
#include "php_phpiredis.h"

3 comments on commit 55c0022

@didlybom

works perfectly on Mac OS X 10.8, but doesn't work for me on CentOS 6.3 Linux 2.6.32-279.el6.x86_64
"PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/phpiredis.so' - /usr/lib64/php/modules/phpiredis.so: undefined symbol: redisReaderFree in Unknown on line 0"

although:
$ ls -al /usr/local/lib/libhiredis*
-rw-rw-r--. 1 olivier.lebra olivier.lebra 225634 Aug 19 11:46 /usr/local/lib/libhiredis.a
lrwxrwxrwx. 1 root root 15 Aug 19 11:46 /usr/local/lib/libhiredis.so -> libhiredis.so.0
lrwxrwxrwx. 1 root root 18 Aug 19 11:46 /usr/local/lib/libhiredis.so.0 -> libhiredis.so.0.10
-rwxrwxr-x. 1 olivier.lebra olivier.lebra 157452 Aug 19 11:46 /usr/local/lib/libhiredis.so.0.10

configure seems ok:
...
checking whether to enable phpiredis support... yes, shared
checking for hiredis library... yes, shared
Found hiredis in /usr/local
...

installing hiredis in /usr/lib64/ doesn't help

@lstrojny

What version of hiredis do you have?

@didlybom

I was using the latest hiredis from https://github.com/antirez/hiredis/

Please sign in to comment.
Something went wrong with that request. Please try again.