Browse code

db_postgres: try to use pkg-config for lib paths

- GH #1915

(cherry picked from commit b23e8e47474d9c25c6de0f6c3da07ae43b85ad8a)

Daniel-Constantin Mierla authored on 01/04/2019 07:52:16 • Sergey Safarov committed on 09/04/2019 07:41:09
Showing 1 changed files
... ...
@@ -9,6 +9,19 @@ NAME=db_postgres.so
9 9
 # the autodetection
10 10
 # CROSS_COMPILE=true
11 11
 
12
+ifeq ($(CROSS_COMPILE),)
13
+LIBPQL_BUILDER = $(shell \
14
+	if pkg-config --exists libpq; then \
15
+		echo 'pkg-config libpq'; \
16
+	fi)
17
+ifneq ($(LIBPQ_BUILDER),)
18
+	DEFS += $(shell $(LIBPQL_BUILDER) --cflags)
19
+	LIBS += $(shell $(LIBPQL_BUILDER) --libs)
20
+endif
21
+endif
22
+
23
+ifeq ($(LIBPQ_BUILDER),)
24
+
12 25
 ifeq ($(CROSS_COMPILE),)
13 26
 PGCFG=$(shell which pg_config)
14 27
 endif
... ...
@@ -27,6 +40,8 @@ else
27 40
 		-L$(LOCALBASE)/lib/pgsql -lpq
28 41
 endif
29 42
 
43
+endif
44
+
30 45
 #DEFS += -DPG_TEST
31 46
 DEFS += -DSER_MOD_INTERFACE
32 47