Module: kamailio
Branch: 5.5
Commit: 06921b71ee42a8c88229595a619d3390d0090b75
URL:
https://github.com/kamailio/kamailio/commit/06921b71ee42a8c88229595a619d339…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-05T10:13:23+02:00
ndb_cassandra: Makefile - use pkg-config if available
(cherry picked from commit 4b9fe7b72f8d9b53dbae24eb7bd269d527642f71)
---
Modified: src/modules/ndb_cassandra/Makefile
---
Diff:
https://github.com/kamailio/kamailio/commit/06921b71ee42a8c88229595a619d339…
Patch:
https://github.com/kamailio/kamailio/commit/06921b71ee42a8c88229595a619d339…
---
diff --git a/src/modules/ndb_cassandra/Makefile b/src/modules/ndb_cassandra/Makefile
index 6046eaf186..97e08542c4 100644
--- a/src/modules/ndb_cassandra/Makefile
+++ b/src/modules/ndb_cassandra/Makefile
@@ -9,11 +9,25 @@ LD=g++
auto_gen=
NAME=ndb_cassandra.so
-THRIFT_DIR = /usr/local/include/thrift
-LIB_DIR = /usr/local/lib
-
-DEFS += -I${THRIFT_DIR}
-LIBS += -L${LIB_DIR} thrift_wrapper.o cassandra_constants.o cassandra_types.o Cassandra.o
-lthrift
+ifeq ($(CROSS_COMPILE),)
+ BUILDER = $(shell which pkg-config)
+ifneq ($(BUILDER),)
+ PKGLIBTHRIFT = $(shell $(BUILDER) --exists thrift > /dev/null 2>&1 ; echo $$?
)
+ifneq ($(PKGLIBTHRIFT),0)
+ BUILDER =
+endif
+endif
+endif
+
+ifneq ($(BUILDER),)
+ THRIFT_INC = $(shell $(BUILDER) --cflags thrift)
+ DEFS += $(THRIFT_INC)
+ LIBS += $(shell $(BUILDER) --libs thrift)
+else
+ THRIFT_INC = -I/usr/local/include
+ DEFS += $(THRIFT_INC)
+ LIBS += -L/usr/local/lib thrift_wrapper.o cassandra_constants.o cassandra_types.o
Cassandra.o -lthrift
+endif
CXXFLAGS=$(CFLAGS:-Wno-deprecated option=)
CXXFLAGS+=-Wno-write-strings -Wno-deprecated -Wno-unused-function -Wno-sign-compare
-Wno-strict-aliasing
@@ -22,18 +36,18 @@ include ../../Makefile.modules
cassandra_constants.o: cassandra_constants.cpp cassandra_constants.h
@echo "Compiling $<"
- $(CXX) $(CXXFLAGS) -I/usr/local/include/thrift -c $< -o $@
+ $(CXX) $(CXXFLAGS) $(THRIFT_INC) -c $< -o $@
cassandra_types.o: cassandra_types.cpp cassandra_types.h
@echo "Compiling $<"
- $(CXX) $(CXXFLAGS) -I/usr/local/include/thrift -c $< -o $@
+ $(CXX) $(CXXFLAGS) $(THRIFT_INC) -c $< -o $@
Cassandra.o: Cassandra.cpp Cassandra.h
@echo "Compiling $<"
- $(CXX) $(CXXFLAGS) -I/usr/local/include/thrift -c $< -o $@
+ $(CXX) $(CXXFLAGS) $(THRIFT_INC) -c $< -o $@
thrift_wrapper.o: thrift_wrapper.cpp thrift_wrapper.h
@echo "Compiling $<"
$(CXX) $(CXXFLAGS) $(CFLAGS) $(C_DEFS) $(DEFS) -c $< -o $@
-ndb_cassandra.so: thrift_wrapper.o cassandra_constants.o cassandra_types.o Cassandra.o
+ndb_cassandra.so: thrift_wrapper.o cassandra_constants.o cassandra_types.o Cassandra.o