Browse code

json, jsonrpc-c: use pkg-config to locate the libs

- if available, use pkg-config tool to locate json and event libs

Daniel-Constantin Mierla authored on 22/08/2011 22:27:33
Showing 2 changed files
... ...
@@ -9,10 +9,15 @@ auto_gen=
9 9
 NAME=json.so
10 10
 LIBS=
11 11
 
12
-DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
12
+BUILDER = $(shell which pkg-config)
13
+ifeq ($(BUILDER),)
14
+	DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
13 15
        -I$(LOCALBASE)/include
14
-LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
15
- 
16
+	LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
17
+else
18
+	DEFS+= $(shell pkg-config --cflags json)
19
+	LIBS+= $(shell pkg-config --libs json)
20
+endif
16 21
 DEFS+=-DOPENSER_MOD_INTERFACE
17 22
 
18 23
 SERLIBPATH=../../lib
... ...
@@ -7,11 +7,19 @@
7 7
 include ../../Makefile.defs
8 8
 auto_gen=
9 9
 NAME=jsonrpc-c.so
10
-LIBS=-lm -levent
10
+LIBS=-lm
11 11
 
12
-DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
12
+BUILDER = $(shell which pkg-config)
13
+ifeq ($(BUILDER),)
14
+	DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
13 15
        -I$(LOCALBASE)/include
14
-LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
16
+	LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -levent -ljson
17
+else
18
+	DEFS+= $(shell pkg-config --cflags json)
19
+	LIBS+= $(shell pkg-config --libs json)
20
+	DEFS+= $(shell pkg-config --cflags libevent)
21
+	LIBS+= $(shell pkg-config --libs libevent)
22
+endif
15 23
  
16 24
 DEFS+=-DOPENSER_MOD_INTERFACE
17 25