Ver Fonte

db_postgres: try to use pkg-config for lib paths

- GH #1915
Daniel-Constantin Mierla há 6 anos atrás
pai
commit
b23e8e4747
1 ficheiros alterados com 15 adições e 0 exclusões
  1. 15 0
      src/modules/db_postgres/Makefile

+ 15 - 0
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