Parcourir la source

ndb_redis: detect if pkg config for hiredis gives lib name in path

- try to cope with inconsistency of output for pkg-config --cflags in
older and newer debian/ubuntu distros
Daniel-Constantin Mierla il y a 7 ans
Parent
commit
08d001bb8e
2 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 5 1
      src/modules/ndb_redis/Makefile
  2. 4 0
      src/modules/ndb_redis/redis_client.h

+ 5 - 1
src/modules/ndb_redis/Makefile

@@ -16,9 +16,13 @@ ifeq ($(HIREDIS_BUILDER),)
 	HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis
 	HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis
 else
-	HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) -I/usr/include/hiredis
+	HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags)
 	HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs)
 
+ifeq (,$(findstring hiredis,$(HIREDISDEFS)))
+	DEFS+=-DWITH_HIREDIS_PATH
+endif
+
 ifeq ($(HIREDISLIBS),-L -lhiredis)
 		HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include
 		HIREDISLIBS = -L/opt/local/lib -lhiredis

+ 4 - 0
src/modules/ndb_redis/redis_client.h

@@ -28,7 +28,11 @@
 #ifndef _REDIS_CLIENT_H_
 #define _REDIS_CLIENT_H_
 
+#ifdef WITH_HIREDIS_PATH
+#include <hiredis/hiredis.h>
+#else
 #include <hiredis.h>
+#endif
 
 #include "../../core/str.h"
 #include "../../core/parser/parse_param.h"