Przeglądaj źródła

db_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 7 lat temu
rodzic
commit
616689bf8b

+ 5 - 1
src/modules/db_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/db_redis/redis_connection.h

@@ -23,7 +23,11 @@
 #ifndef _REDIS_CONNECTION_H_
 #define _REDIS_CONNECTION_H_
 
+#ifdef WITH_HIREDIS_PATH
+#include <hiredis/hiredis.h>
+#else
 #include <hiredis.h>
+#endif
 
 #include "db_redis_mod.h"