Module: sip-router
Branch: master
Commit: d8a3d9d91921b836e0cf98647ba1aabf29d9c3c5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d8a3d9d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Aug 23 00:27:33 2011 +0200
json, jsonrpc-c: use pkg-config to locate the libs
- if available, use pkg-config tool to locate json and event libs
---
modules/json/Makefile | 11 ++++++++---
modules/jsonrpc-c/Makefile | 14 +++++++++++---
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/modules/json/Makefile b/modules/json/Makefile
index eb9b615..a21bc04 100644
--- a/modules/json/Makefile
+++ b/modules/json/Makefile
@@ -9,10 +9,15 @@ auto_gen=
NAME=json.so
LIBS=
-DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
+BUILDER = $(shell which pkg-config)
+ifeq ($(BUILDER),)
+ DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
-I$(LOCALBASE)/include
-LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
-
+ LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
+else
+ DEFS+= $(shell pkg-config --cflags json)
+ LIBS+= $(shell pkg-config --libs json)
+endif
DEFS+=-DOPENSER_MOD_INTERFACE
SERLIBPATH=../../lib
diff --git a/modules/jsonrpc-c/Makefile b/modules/jsonrpc-c/Makefile
index 328a49a..c449b3e 100644
--- a/modules/jsonrpc-c/Makefile
+++ b/modules/jsonrpc-c/Makefile
@@ -7,11 +7,19 @@
include ../../Makefile.defs
auto_gen=
NAME=jsonrpc-c.so
-LIBS=-lm -levent
+LIBS=-lm
-DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
+BUILDER = $(shell which pkg-config)
+ifeq ($(BUILDER),)
+ DEFS+=-I/usr/include/json -I$(LOCALBASE)/include/json \
-I$(LOCALBASE)/include
-LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljson
+ LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -levent -ljson
+else
+ DEFS+= $(shell pkg-config --cflags json)
+ LIBS+= $(shell pkg-config --libs json)
+ DEFS+= $(shell pkg-config --cflags libevent)
+ LIBS+= $(shell pkg-config --libs libevent)
+endif
DEFS+=-DOPENSER_MOD_INTERFACE