[sr-dev] git:master:b23e8e47: db_postgres: try to use pkg-config for lib paths

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 1 09:53:31 CEST 2019


Module: kamailio
Branch: master
Commit: b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a
URL: https://github.com/kamailio/kamailio/commit/b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-04-01T09:52:16+02:00

db_postgres: try to use pkg-config for lib paths

- GH #1915

---

Modified: src/modules/db_postgres/Makefile

---

Diff:  https://github.com/kamailio/kamailio/commit/b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a.diff
Patch: https://github.com/kamailio/kamailio/commit/b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a.patch

---

diff --git a/src/modules/db_postgres/Makefile b/src/modules/db_postgres/Makefile
index f3a0f6eba9..2663ee7515 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
+
 SERLIBPATH=../../lib
 SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1
 




More information about the sr-dev mailing list