[sr-dev] git:master:08d001bb: ndb_redis: detect if pkg config for hiredis gives lib name in path

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 26 14:52:34 CEST 2018


Module: kamailio
Branch: master
Commit: 08d001bb8e0ac336dc84e0541a9cf0104f6d9ee3
URL: https://github.com/kamailio/kamailio/commit/08d001bb8e0ac336dc84e0541a9cf0104f6d9ee3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-09-26T14:41:14+02:00

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

---

Modified: src/modules/ndb_redis/Makefile
Modified: src/modules/ndb_redis/redis_client.h

---

Diff:  https://github.com/kamailio/kamailio/commit/08d001bb8e0ac336dc84e0541a9cf0104f6d9ee3.diff
Patch: https://github.com/kamailio/kamailio/commit/08d001bb8e0ac336dc84e0541a9cf0104f6d9ee3.patch

---

diff --git a/src/modules/ndb_redis/Makefile b/src/modules/ndb_redis/Makefile
index 58a476ecd5..f6c78dee7e 100644
--- a/src/modules/ndb_redis/Makefile
+++ b/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
diff --git a/src/modules/ndb_redis/redis_client.h b/src/modules/ndb_redis/redis_client.h
index c9e3d80424..0249b1eef4 100644
--- a/src/modules/ndb_redis/redis_client.h
+++ b/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"




More information about the sr-dev mailing list