Module: sip-router
Branch: janakj/postgres
Commit: c53d4d36738cef4296d8cb4b9fcd7beb9712fedb
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c53d4d3…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Wed Feb 18 00:52:27 2009 +0100
Merged contents of km_Makefile (namely pg_config autodetection).
---
modules/db_postgres/Makefile | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/modules/db_postgres/Makefile b/modules/db_postgres/Makefile
index f32f99b..aa86b51 100644
--- a/modules/db_postgres/Makefile
+++ b/modules/db_postgres/Makefile
@@ -6,13 +6,30 @@ include ../../Makefile.defs
auto_gen=
NAME=postgres.so
-# libpq-fe.h locations
+# set CROSS_COMPILE to true if you want to skip
+# the autodetection
+# CROSS_COMPILE=true
+
+ifeq ($(CROSS_COMPILE),)
+PGCFG=$(shell which pg_config)
+endif
+
+ifneq ($(PGCFG),)
+ # use autodetection
+ DEFS += -I$(shell $(PGCFG) --includedir)
+ LIBS = -L$(shell $(PGCFG) --libdir) -lpq
+else
+ # use standard know paths
+ # libpq-fe.h locations
+ DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/pgsql/include \
+ -I$(SYSBASE)/include/pgsql -I$(SYSBASE)/include/postgresql \
+ -I$(SYSBASE)/include/postgresql/8.0
+ LIBS=-L$(LOCALBASE)/lib -L$(LOCALBASE)/pgsql/lib -L$(LOCALBASE)/lib/pgsql \
+ -L /usr/lib -lpq
+endif
+
#DEFS += -DPG_TEST
-DEFS +=-DSER_MOD_INTERFACE -I$(LOCALBASE)/include -I$(LOCALBASE)/pgsql/include \
- -I$(LOCALBASE)/include/postgresql \
- -I/usr/include/postgresql -I/usr/include/postgresql/8.0 \
- -I/usr/include/pgsql/
-LIBS=-L$(LOCALBASE)/lib -L$(LOCALBASE)/pgsql/lib -L$(LOCALBASE)/lib/pgsql -L /usr/lib
-lpq
+DEFS += -DSER_MOD_INTERFACE
SERLIBPATH=../../lib
SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1