Browse Source

json|jsonrpc-c: use new naming json-c lib if available

(cherry picked from commit 679833f9f098e1ebc5e2b66978a5535af557924c)
(cherry picked from commit 2375b7a8d4bc4a97ad6e749a51425f8be0ab446f)
Victor Seva 11 năm trước cách đây
mục cha
commit
fe2841e6e4
2 tập tin đã thay đổi với 30 bổ sung8 xóa
  1. 15 4
      modules/json/Makefile
  2. 15 4
      modules/jsonrpc-c/Makefile

+ 15 - 4
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
 

+ 15 - 4
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