Module: kamailio
Branch: 5.1
Commit: 2664b6ed8001f356ce2076433e858f807d237962
URL:
https://github.com/kamailio/kamailio/commit/2664b6ed8001f356ce2076433e858f8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Sergey Safarov <s.safarov(a)gmail.com>
Date: 2019-04-09T10:41:09+03:00
db_postgres: try to use pkg-config for lib paths
- GH #1915
(cherry picked from commit b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a)
---
Modified: src/modules/db_postgres/Makefile
---
Diff:
https://github.com/kamailio/kamailio/commit/2664b6ed8001f356ce2076433e858f8…
Patch:
https://github.com/kamailio/kamailio/commit/2664b6ed8001f356ce2076433e858f8…
---
diff --git a/src/modules/db_postgres/Makefile b/src/modules/db_postgres/Makefile
index d780467f27..ca99b66b7b 100644
--- a/src/modules/db_postgres/Makefile
+++ b/src/modules/db_postgres/Makefile
@@ -9,6 +9,19 @@ NAME=db_postgres.so
# the autodetection
# CROSS_COMPILE=true
+ifeq ($(CROSS_COMPILE),)
+LIBPQL_BUILDER = $(shell \
+ if pkg-config --exists libpq; then \
+ echo 'pkg-config libpq'; \
+ fi)
+ifneq ($(LIBPQ_BUILDER),)
+ DEFS += $(shell $(LIBPQL_BUILDER) --cflags)
+ LIBS += $(shell $(LIBPQL_BUILDER) --libs)
+endif
+endif
+
+ifeq ($(LIBPQ_BUILDER),)
+
ifeq ($(CROSS_COMPILE),)
PGCFG=$(shell which pg_config)
endif
@@ -27,6 +40,8 @@ else
-L$(LOCALBASE)/lib/pgsql -lpq
endif
+endif
+
#DEFS += -DPG_TEST
DEFS += -DSER_MOD_INTERFACE