Description: Add configure support for postgres includes as used by GRASS 7
Origin: https://trac.osgeo.org/gdal/attachment/ticket/5852/grass-configure-postgres.patch
Bug: https://trac.osgeo.org/gdal/ticket/5852
Author: Marin Landa <landa.martin@gmail.com>
Applied-Upstream: r28598, https://trac.osgeo.org/gdal/changeset/28598

--- a/Makefile.in
+++ b/Makefile.in
@@ -4,7 +4,7 @@ CXX	=	@CXX@
 LD	=	@CXX@
 
 CPPFLAGS = -DUSE_CPL -DGRASS_GISBASE=\"@GRASS_GISBASE@\" \
-	  @GDAL_INC@ @GRASS_INCLUDE@ @CPPFLAGS@
+	  @GDAL_INC@ @GRASS_INCLUDE@ @PQ_INCLUDE@ @CPPFLAGS@
 CXXFLAGS = @CXX_WFLAGS@ @CXX_PIC@ 
 CFLAGS   = @CFLAGS@
 LDFLAGS  = @LDFLAGS@
--- a/configure.in
+++ b/configure.in
@@ -91,7 +91,7 @@ AC_SUBST(GDAL_INC,    $GDAL_INC)
 dnl ---------------------------------------------------------------------------
 dnl Where to put driver?
 dnl ---------------------------------------------------------------------------
-AC_ARG_WITH(autoload,[  --with-autoload[=DIR]      Directory for autoload drivers],,)
+AC_ARG_WITH(autoload,[  --with-autoload[=DIR]     Directory for autoload drivers],,)
 
 if test "$with_autoload" != "" ; then
   AUTOLOAD_DIR=$with_autoload
@@ -151,6 +151,23 @@ AC_SUBST(GRASS_GISBASE,$GRASS_GISBASE)
 
 dnl ---------------------------------------------------------------------------
 
+dnl ---------------------------------------------------------------------------
+dnl Find PostgreSQL (GRASS optional dependency)
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_WITH(postgres_includes,[  --with-postgres-includes=DIR     use PostgreSQL icnludes in DIR], postgres_includes="$withval", postgres_includes=no)
+
+PQ_INCLUDE=
+if test "x$postgres_includes" != "xno"; then
+# With PostgreSQL includes directory
+PQ_INCLUDE="-I$postgres_includes"
+fi
+
+AC_SUBST(PQ_INCLUDE)
+
+dnl ---------------------------------------------------------------------------
+
+
 rm -f conftest*
 
 AC_OUTPUT(Makefile)
