Module: sip-router
Branch: master
Commit: 679833f9f098e1ebc5e2b66978a5535af557924c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=679833f…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: Fri Apr 18 22:07:47 2014 +0200
json|jsonrpc-c: use new naming json-c lib if available
---
modules/json/Makefile | 19 +++++++++++++++----
modules/jsonrpc-c/Makefile | 19 +++++++++++++++----
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/modules/json/Makefile b/modules/json/Makefile
index cf14a08..fad2e00 100644
--- a/modules/json/Makefile
+++ b/modules/json/Makefile
@@ -8,15 +8,26 @@ include ../../Makefile.defs
auto_gen=
NAME=json.so
LIBS=
+JLIB=json
BUILDER = $(shell which pkg-config)
ifeq ($(BUILDER),)
- DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
+ JSONC=$(shell ls $(SYSBASE)/include/lib/libjson*.so $(LOCALBASE)/lib/libjson*.so
2>/dev/null | grep json-c)
+else
+ JSONC=$(shell pkg-config --libs json-c 2>/dev/null | grep json-c.so)
+endif
+
+ifneq ($(JSONC),)
+ JLIB=json-c
+endif
+
+ifeq ($(BUILDER),)
+ DEFS+=-I/usr/include/$(JLIB) -I$(LOCALBASE)/include/$(JLIB) \
-I$(LOCALBASE)/include
- LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
+ LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -l$(JLIB)
else
- DEFS+= $(shell pkg-config --cflags json)
- LIBS+= $(shell pkg-config --libs json)
+ DEFS+= $(shell pkg-config --cflags $(JLIB))
+ LIBS+= $(shell pkg-config --libs $(JLIB))
endif
DEFS+=-DKAMAILIO_MOD_INTERFACE
diff --git a/modules/jsonrpc-c/Makefile b/modules/jsonrpc-c/Makefile
index fdb0024..e170597 100644
--- a/modules/jsonrpc-c/Makefile
+++ b/modules/jsonrpc-c/Makefile
@@ -8,15 +8,26 @@ include ../../Makefile.defs
auto_gen=
NAME=jsonrpc-c.so
LIBS=-lm
+JLIB=json
BUILDER = $(shell which pkg-config)
ifeq ($(BUILDER),)
- DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
+ JSONC=$(shell ls $(SYSBASE)/include/lib/libjson*.so $(LOCALBASE)/lib/libjson*.so
2>/dev/null | grep json-c)
+else
+ JSONC=$(shell pkg-config --libs json-c 2>/dev/null | grep json-c.so)
+endif
+
+ifneq ($(JSONC),)
+ JLIB=json-c
+endif
+
+ifeq ($(BUILDER),)
+ DEFS+=-I/usr/include/$(JLIB) -I$(LOCALBASE)/include/$(JLIB) \
-I$(LOCALBASE)/include
- LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -levent -ljson
+ LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -levent -l$(JLIB)
else
- DEFS+= $(shell pkg-config --cflags json)
- LIBS+= $(shell pkg-config --libs json)
+ DEFS+= $(shell pkg-config --cflags $(JLIB))
+ LIBS+= $(shell pkg-config --libs $(JLIB))
DEFS+= $(shell pkg-config --cflags libevent)
LIBS+= $(shell pkg-config --libs libevent)
endif