1. Peter Gradwell
  2. opensips-clone

Commits

os...@689a6050-402a-0410-94f2-e92a70836424  committed 9d28d2b Draft

cachedb_mongodb: proper cflags and lib detection for json

  • Participants
  • Parent commits 8a46016
  • Branches default

Comments (0)

Files changed (1)

File modules/cachedb_mongodb/Makefile

View file
  • Ignore whitespace
 auto_gen=
 NAME=cachedb_mongodb.so
 
-DEFS+=-I$(LOCALBASE)/include
-LIBS=-L$(LOCALBASE)/lib -lmongoc -ljson
+ifeq ($(CROSS_COMPILE),)
+JSON_BUILDER = $(shell \
+	if pkg-config --exists json; then \
+		echo 'pkg-config json'; \
+	fi)
+endif
+
+ifeq ($(JSON_BUILDER),)
+	DEFS += -I$(LOCALBASE)/include
+	LIBS += -L$(LOCALBASE)/lib -ljson
+else
+	DEFS += $(shell $(JSON_BUILDER) --cflags)
+	LIBS += $(shell $(JSON_BUILDER) --libs)
+endif
+
+DEFS += -I$(LOCALBASE)/include
+LIBS += -L$(LOCALBASE)/lib -lmongoclient
 
 include ../../Makefile.modules