[sr-dev] [PATCH] dialplan, lcr, regex: use pkg-config to get libpcre flags

Arnout Vandecappelle (Essensium/Mind) arnout at mind.be
Tue Dec 11 12:13:32 CET 2012


From: "Arnout Vandecappelle (Essensium/Mind)" <arnout at mind.be>

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
 modules/dialplan/Makefile |   11 ++++++++---
 modules/lcr/Makefile      |   11 ++++++++---
 modules_k/regex/Makefile  |   11 ++++++++---
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/modules/dialplan/Makefile b/modules/dialplan/Makefile
index 1a3899e..4bb150a 100644
--- a/modules/dialplan/Makefile
+++ b/modules/dialplan/Makefile
@@ -7,15 +7,20 @@ auto_gen=
 NAME=dialplan.so
 
 ifeq ($(CROSS_COMPILE),)
-BUILDER = $(shell which pcre-config)
+BUILDER = $(shell \
+	if pkg-config --exists libpcre; then \
+		echo 'pkg-config libpcre';   \
+	else                                 \
+		which pcre-config;           \
+	fi)
 endif
 
 ifeq ($(BUILDER),)
 	PCREDEFS=-I$(LOCALBASE)/include
 	PCRELIBS=-L$(LOCALBASE)/lib -lpcre
 else
-	PCREDEFS = $(shell pcre-config --cflags)
-	PCRELIBS = $(shell pcre-config --libs)
+	PCREDEFS = $(shell $(BUILDER) --cflags)
+	PCRELIBS = $(shell $(BUILDER) --libs)
 endif
 
 DEFS+=$(PCREDEFS)
diff --git a/modules/lcr/Makefile b/modules/lcr/Makefile
index 70d6400..228a27f 100644
--- a/modules/lcr/Makefile
+++ b/modules/lcr/Makefile
@@ -9,15 +9,20 @@ auto_gen=
 NAME=lcr.so
 
 ifeq ($(CROSS_COMPILE),)
-BUILDER = $(shell which pcre-config)
+BUILDER = $(shell \
+	if pkg-config --exists libpcre; then \
+		echo 'pkg-config libpcre';   \
+	else                                 \
+		which pcre-config;           \
+	fi)
 endif
 
 ifeq ($(BUILDER),)
 	PCREDEFS=-I$(LOCALBASE)/include
 	PCRELIBS=-L$(LOCALBASE)/lib -lpcre
 else
-	PCREDEFS = $(shell pcre-config --cflags)
-	PCRELIBS = $(shell pcre-config --libs)
+	PCREDEFS = $(shell $(BUILDER) --cflags)
+	PCRELIBS = $(shell $(BUILDER) --libs)
 endif
 
 DEFS+=$(PCREDEFS)
diff --git a/modules_k/regex/Makefile b/modules_k/regex/Makefile
index 947c14c..ae435e9 100644
--- a/modules_k/regex/Makefile
+++ b/modules_k/regex/Makefile
@@ -5,15 +5,20 @@ auto_gen=
 NAME=regex.so
 
 ifeq ($(CROSS_COMPILE),)
-BUILDER = $(shell which pcre-config)
+BUILDER = $(shell \
+	if pkg-config --exists libpcre; then \
+		echo 'pkg-config libpcre';   \
+	else                                 \
+		which pcre-config;           \
+	fi)
 endif
 
 ifeq ($(BUILDER),)
 	PCREDEFS=-I$(LOCALBASE)/include
 	PCRELIBS=-L$(LOCALBASE)/lib -lpcre
 else
-	PCREDEFS = $(shell pcre-config --cflags)
-	PCRELIBS = $(shell pcre-config --libs)
+	PCREDEFS = $(shell $(BUILDER) --cflags)
+	PCRELIBS = $(shell $(BUILDER) --libs)
 endif
 
 DEFS+=$(PCREDEFS)
-- 
1.7.10.4




More information about the sr-dev mailing list