Преглед изворни кода

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

Victor Seva пре 11 година
родитељ
комит
679833f9f0
2 измењених фајлова са 30 додато и 8 уклоњено
  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