From 162ccdaeeb6bff185f49b3dc2e2b9b43687ec0fc Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Sat, 26 Mar 2016 10:23:02 +0100 Subject: [PATCH] cnxcc: use pkg-config for hiredis lib compile flags --- modules/cnxcc/Makefile | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/cnxcc/Makefile b/modules/cnxcc/Makefile index e5c69df15c9..af6979e8201 100644 --- a/modules/cnxcc/Makefile +++ b/modules/cnxcc/Makefile @@ -1,14 +1,33 @@ # # cnxcc module makefile # -# +# # WARNING: do not run this directly, it should be run by the master Makefile include ../../Makefile.defs auto_gen= NAME=cnxcc.so -LIBS=-lhiredis -levent +ifeq ($(CROSS_COMPILE),) +HIREDIS_BUILDER = $(shell \ + if pkg-config --exists libcre; then \ + echo 'pkg-config hiredis'; \ + else \ + which pcre-config; \ + fi) +endif + +ifeq ($(HIREDIS_BUILDER),) + HIREDISDEFS=-I$(LOCALBASE)/include + HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis +else + HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) + HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) +endif + +DEFS+=$(HIREDISDEFS) +LIBS=$(HIREDISLIBS) -levent + DEFS+=-DOPENSER_MOD_INTERFACE SERLIBPATH=../../lib SER_LIBS+=$(SERLIBPATH)/kmi/kmi