Browse code

pua_json: better detection of paths for json-c library

Daniel-Constantin Mierla authored on 08/02/2018 18:19:29
Showing 1 changed files
... ...
@@ -8,9 +8,28 @@ include ../../Makefile.defs
8 8
 
9 9
 auto_gen=
10 10
 NAME=pua_json.so
11
+LIBS=
12
+JLIB=json
11 13
 
12
-LIBS=-ljson-c
13
-DEFS+=-I$(LOCALBASE)/include -I/usr/local/include $(shell pkg-config --cflags json-c)
14
+BUILDER = $(shell which pkg-config)
15
+ifeq ($(BUILDER),)
16
+	JSONC=$(shell ls $(SYSBASE)/include/lib/libjson*.so $(LOCALBASE)/lib/libjson*.so 2>/dev/null | grep json-c)
17
+else
18
+	JSONC=$(shell pkg-config --libs json-c 2>/dev/null | grep json-c)
19
+endif
20
+
21
+ifneq ($(JSONC),)
22
+	JLIB=json-c
23
+endif
24
+
25
+ifeq ($(BUILDER),)
26
+	DEFS+=-I/usr/include/$(JLIB) -I$(LOCALBASE)/include/$(JLIB) \
27
+       -I$(LOCALBASE)/include
28
+	LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -l$(JLIB)
29
+else
30
+	DEFS+= $(shell pkg-config --cflags $(JLIB))
31
+	LIBS+= $(shell pkg-config --libs $(JLIB))
32
+endif
14 33
 
15 34
 DEFS+=-DKAMAILIO_MOD_INTERFACE
16 35