
--- postgis-1.3.1/extras/template_gis/Makefile	2007-03-01 03:31:44.000000000 -0500
+++ postgis-1.3.1-new/extras/template_gis/Makefile	2007-09-18 10:46:24.000000000 -0400
@@ -19,8 +19,7 @@
 SCRIPT_INSTALL=$(INSTALL_BIN) $(SCRIPT) $(SCRIPT_TARGET)
 SCRIPT_LINKDIR=$(DESTDIR)$(prefix)/bin
 SCRIPT_LINK=$(SCRIPT_LINKDIR)/$(SCRIPT)
-SCRIPT_DOLINK=rm -f $(SCRIPT_LINK); \
-              $(LN_S) $(SCRIPT_TARGET) $(SCRIPT_LINKDIR)
+SCRIPT_DOLINK= install -c -m 755 $(SCRIPT_LINK) $(SCRIPT_TARGETDIR)
 SCRIPT_UNINSTALL=rm -f $(SCRIPT_TARGET)
 SCRIPT_UNLINK=rm -f $(SCRIPT_LINK)
 
@@ -42,7 +41,6 @@
 	@mkdir -p $(SCRIPT_TARGETDIR)
 	@mkdir -p $(SCRIPT_LINKDIR)
 	$(foreach SCRIPT, $(SCRIPTS), $(SCRIPT_INSTALL);)
-	$(foreach SCRIPT, $(PUBLIC_SCRIPTS), $(SCRIPT_DOLINK);)
 	@mkdir -p $(DEFAULTS_DIR)
 	cp profile $(SCRIPT_DEFAULTS)
 	rm -f $(SCRIPT_TARGETDIR)/profile
--- postgis-1.3.1/extras/template_gis/createdb.postgis.1	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/createdb.postgis.1	2007-09-18 10:46:24.000000000 -0400
@@ -43,7 +43,7 @@
 .LP
 The environment variables for template_gis creation, removal and usage may be stored in files, as follows:
 .TP
-.B /etc/default/postgis
+.B @FINKPREFIX@/etc/postgis
 will designate default values for the whole system.
 .TP
 .B $HOME/.postgis/profile
--- postgis-1.3.1/extras/template_gis/createdb.postgis.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/createdb.postgis.in	2007-09-18 10:46:24.000000000 -0400
@@ -5,7 +5,7 @@
 # but the specified owner will not have 
 # extra privileges on objects in the template. see createdb.postgis(1)
 
-source @bindir@/postgis_env.sh
+source @bindir@/postgis_env.sh-@FINKPGRAWVERSION@
 
 for ARGVN in $1 $2 ; do
     if [ `expr substr $ARGVN 1 11` = "--template=" ]; then
--- postgis-1.3.1/extras/template_gis/mktemplate_gis.1	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/mktemplate_gis.1	2007-09-18 10:46:24.000000000 -0400
@@ -89,7 +89,7 @@
 .LP
 The environment variables for template_gis creation, removal and usage may be stored in files, as follows:
 .TP
-.B /etc/default/postgis
+.B @FINKPREFIX@/etc/postgis
 will designate default values for the whole system.
 .TP
 .B $HOME/.postgis/profile
--- postgis-1.3.1/extras/template_gis/mktemplate_gis.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/mktemplate_gis.in	2007-09-18 10:46:24.000000000 -0400
@@ -3,7 +3,7 @@
 #create a template database, named template_gis by default,
 #and grant ownership or full privileges to the postgis tables to a user, postgres by default
 
-source @bindir@/postgis_env.sh
+source @bindir@/postgis_env.sh-@FINKPGRAWVERSION@
 
 for ARGVN in $1 $2 $3 $4 $5 $6 ; do
     if [ `expr substr $ARGVN 1 7` = "--user=" ]; then
@@ -59,9 +59,9 @@
     SCRIPTS="${SCRIPTS} ${TMPTOPO}"
 fi
 
-source @bindir@/postgres_lib.sh
+source @bindir@/postgres_lib.sh-@FINKPGRAWVERSION@
 
 sudo_dba DBAUSER
 
 export SCRIPTS GRTABLES GRSCHEMAS GRUSER DBAUSER TDB
-$SUDO -c "@bindir@/mktemplate_gis.sh"
+$SUDO -c "@bindir@/mktemplate_gis.sh-@FINKPGRAWVERSION@"
--- postgis-1.3.1/extras/template_gis/mktemplate_gis.sh.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/mktemplate_gis.sh.in	2007-09-18 10:46:24.000000000 -0400
@@ -6,7 +6,7 @@
 
 cd /tmp
 
-source @bindir@/postgres_lib.sh
+source @bindir@/postgres_lib.sh-@FINKPGRAWVERSION@
 
 check_dba $DBAUSER
 template_rm $TDB
--- postgis-1.3.1/extras/template_gis/postgis_env.sh.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/postgis_env.sh.in	2007-09-18 10:46:24.000000000 -0400
@@ -3,7 +3,7 @@
 # environment variables for postgis
 
 #read optional configuration files. last prevails
-for file in "/etc/default/postgis" "$HOME/.postgis/profile" ; do
+for file in "@FINKPREFIX@/etc/postgis@FINKPGVERSION@" "@FINKPREFIX@/etc/postgis" "$HOME/.postgis/profile" ; do
 	if [ -f "$file" ]; then
 		tmpval=`grep "^TEMPLATEDB=" $file | cut -d= -f2`
 		if [ -n "$tmpval" ]; then
@@ -25,12 +25,12 @@
 done
 
 #cluster information should be set separately
-if [ -x @prefix@/bin/pg_lsclusters ]; then
+if [ -x @prefix@/bin/pg_lsclusters-@FINKPGRAWVERSION@ ]; then
 #	PGCLUSTER=`pg_lsclusters | awk '{if ($3 == ENVIRON["PGPORT"]) {print $1"/"$2;}}'`
 #	export PGCLUSTER
 #
 	if [ -z $DBAUSER ]; then
-		DBAUSER=`pg_lsclusters | awk '{if ($3 == ENVIRON["PGPORT"]) {print $5;}}'`
+		DBAUSER=`pg_lsclusters-@FINKPGRAWVERSION@ | awk '{if ($3 == ENVIRON["PGPORT"]) {print $5;}}'`
 	fi
 fi
 
--- postgis-1.3.1/extras/template_gis/postgres_lib.sh.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/postgres_lib.sh.in	2007-09-18 10:46:24.000000000 -0400
@@ -39,9 +39,9 @@
 		echo "you may be not allowed to do so (maybe wrong password)."
 		exit 1
 	fi
-	ISDBAPGUSER=`psql -At -d template1 -c "select usename from pg_user where usesuper = true and usename = '$DBAUSER';" 2>&1`
+	ISDBAPGUSER=`psql-@FINKPGRAWVERSION@ -At -d template1 -c "select usename from pg_user where usesuper = true and usename = '$DBAUSER';" 2>&1`
 	if [ ! "$ISDBAPGUSER" = "$DBAUSER" ]; then
-		MAYPOSTGRES=`psql -l`
+		MAYPOSTGRES=`psql-@FINKPGRAWVERSION@ -l`
 		if [ -z "$MAYPOSTGRES" ]; then
 			echo "either postgresql $PGCLUSTER is not running,"
 			echo "or $DBAUSER doesn't have privileges on cluster $PGCLUSTER."
@@ -59,9 +59,9 @@
 function template_rm()
 {
 	TDB=$1
-	db_update=`psql -d template1 -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = '$TDB';" 2>&1`
+	db_update=`psql-@FINKPGRAWVERSION@ -d template1 -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = '$TDB';" 2>&1`
 	if [ "$db_update" = "UPDATE 1" ]; then
-		dropdb $TDB 2>&1 | cat > /dev/null
+		dropdb-@FINKPGRAWVERSION@ $TDB 2>&1 | cat > /dev/null
 	else
 		echo "$TDB could not be accessed. it may not exist"
 	fi
@@ -75,50 +75,50 @@
 	TDB=$1
 	GRUSER=$2
 	#of course it could be better to create as the $GRUSER where system user
-	db_create=`createdb $TDB 2>&1`
+	db_create=`createdb-@FINKPGRAWVERSION@ $TDB 2>&1`
 	if [ "$db_create" = "CREATE DATABASE" ]; then
-		GRID=`psql -d template1 -At -c "select usesysid from pg_user where usename='$GRUSER';"`
+		GRID=`psql-@FINKPGRAWVERSION@ -d template1 -At -c "select usesysid from pg_user where usename='$GRUSER';"`
 	    if [ -n "$GRID" ]; then
-			psql -d $TDB -c "UPDATE pg_database SET datdba = $GRID WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
+			psql-@FINKPGRAWVERSION@ -d $TDB -c "UPDATE pg_database SET datdba = $GRID WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
 	    fi
-		if [ -x @bindir@/createlang ]; then
-			@bindir@/createlang plpgsql $TDB 2>&1 | cat > /dev/null
+		if [ -x @bindir@/createlang-@FINKPGRAWVERSION@ ]; then
+			@bindir@/createlang-@FINKPGRAWVERSION@ plpgsql $TDB 2>&1 | cat > /dev/null
 		fi
 		for script in $SCRIPTS ; do
-			psql -d $TDB -f $script 2>&1 | cat > /dev/null
+			psql-@FINKPGRAWVERSION@ -d $TDB -f $script 2>&1 | cat > /dev/null
 		done
 		#pseudo tables for postgresql 7.2 and 7.4. feel free to add more, for other postgresql versions
 		PSEUDO_TABLES="'pg_xactlock', 'sql_features', 'sql_implementation_info', 'sql_languages', 
 					   'sql_packages', 'sql_sizing', 'sql_sizing_profiles'"
-		TABLES=`psql -d $TDB -At -c "select tablename from pg_tables where tablename not in ($PSEUDO_TABLES);"`
+		TABLES=`psql-@FINKPGRAWVERSION@ -d $TDB -At -c "select tablename from pg_tables where tablename not in ($PSEUDO_TABLES);"`
 	    if [ -n "$GRID" ]; then
 			for table in $TABLES ; do
-		        psql -d $TDB -c "alter table $table owner to $GRUSER;" 2>&1 | cat > /dev/null
+		        psql-@FINKPGRAWVERSION@ -d $TDB -c "alter table $table owner to $GRUSER;" 2>&1 | cat > /dev/null
 			done
-			psql -d $TDB -c "update pg_class set relowner=$GRID where relkind = 'S';" 2>&1 | cat > /dev/null
+			psql-@FINKPGRAWVERSION@ -d $TDB -c "update pg_class set relowner=$GRID where relkind = 'S';" 2>&1 | cat > /dev/null
 	    else #maybe public, or group
 			for grtable in $GRTABLES ; do
-		        psql -d $TDB -c "grant all privileges on table $grtable to $GRUSER;" 2>&1 | cat > /dev/null
+		        psql-@FINKPGRAWVERSION@ -d $TDB -c "grant all privileges on table $grtable to $GRUSER;" 2>&1 | cat > /dev/null
 			done
 	    fi
 		for grschema in $GRSCHEMAS ; do
-	        psql -d $TDB -c "alter schema $grschema owner to $GRUSER;" 2>&1 | cat > /dev/null
-	        psql -d $TDB -c "grant all privileges on schema $grschema to $GRUSER;" 2>&1 | cat > /dev/null
-			STABLES=`psql -d $TDB -At -c "select tablename from pg_tables where schemaname = '$grschema';"`
+	        psql-@FINKPGRAWVERSION@ -d $TDB -c "alter schema $grschema owner to $GRUSER;" 2>&1 | cat > /dev/null
+	        psql-@FINKPGRAWVERSION@ -d $TDB -c "grant all privileges on schema $grschema to $GRUSER;" 2>&1 | cat > /dev/null
+			STABLES=`psql-@FINKPGRAWVERSION@ -d $TDB -At -c "select tablename from pg_tables where schemaname = '$grschema';"`
 		    if [ -n "$GRID" ]; then
 				for table in $STABLES ; do
-			        psql -d $TDB -c "alter table $grschema.$table owner to $GRUSER;" 2>&1 | cat > /dev/null
+			        psql-@FINKPGRAWVERSION@ -d $TDB -c "alter table $grschema.$table owner to $GRUSER;" 2>&1 | cat > /dev/null
 				done
 	  		else #maybe public, or group
 				for grtable in $GRTABLES ; do #contain specific schema
-		      		psql -d $TDB -c "grant all privileges on table $grtable to $GRUSER;" 2>&1 | cat > /dev/null
+		      		psql-@FINKPGRAWVERSION@ -d $TDB -c "grant all privileges on table $grtable to $GRUSER;" 2>&1 | cat > /dev/null
 				done
 	  		fi
 		done
-		psql -d $TDB -c "VACUUM FULL;" 2>&1 | cat > /dev/null
-		psql -d $TDB -c "VACUUM FREEZE;" 2>&1 | cat > /dev/null
-		psql -d $TDB -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
-		psql -d $TDB -c "UPDATE pg_database SET datallowconn = FALSE WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
+		psql-@FINKPGRAWVERSION@ -d $TDB -c "VACUUM FULL;" 2>&1 | cat > /dev/null
+		psql-@FINKPGRAWVERSION@ -d $TDB -c "VACUUM FREEZE;" 2>&1 | cat > /dev/null
+		psql-@FINKPGRAWVERSION@ -d $TDB -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
+		psql-@FINKPGRAWVERSION@ -d $TDB -c "UPDATE pg_database SET datallowconn = FALSE WHERE datname = '$TDB';" 2>&1 | cat > /dev/null
 	else
 		echo "$db_create"
 	fi
--- postgis-1.3.1/extras/template_gis/profile	2006-06-09 02:03:59.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/profile	2007-09-18 10:46:24.000000000 -0400
@@ -1,6 +1,6 @@
 
 #those are the default variables for postgresql-postgis.
-#this file will be scanned from /etc/default/postgis,
+#this file will be scanned from @FINKPREFIX@/etc/postgis,
 #and then from $HOME/postgis/profile
 
 #values should NOT be in quotes
--- postgis-1.3.1/extras/template_gis/rmtemplate_gis.1	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/rmtemplate_gis.1	2007-09-18 10:46:24.000000000 -0400
@@ -45,7 +45,7 @@
 .LP
 The environment variables for template_gis creation, removal and usage may be stored in files, as follows:
 .TP
-.B /etc/default/postgis
+.B @FINKPREFIX@/etc/postgis
 will designate default values for the whole system.
 .TP
 .B $HOME/.postgis/profile
--- postgis-1.3.1/extras/template_gis/rmtemplate_gis.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/rmtemplate_gis.in	2007-09-18 10:46:24.000000000 -0400
@@ -3,7 +3,7 @@
 #drop template_gis
 #it may be used to drop any postgresql template, by supplying argument
 
-source @bindir@/postgis_env.sh
+source @bindir@/postgis_env.sh-@FINKPGRAWVERSION@
 
 for ARGVN in $1 $2 $3 $4 ; do
     if [ `expr substr $ARGVN 1 11` = "--template=" ]; then
@@ -21,9 +21,9 @@
     fi
 done
 
-source @bindir@/postgres_lib.sh
+source @bindir@/postgres_lib.sh-@FINKPGRAWVERSION@
 
 sudo_dba $DBAUSER
 
 export DBAUSER TDB
-$SUDO -c "@bindir@/rmtemplate_gis.sh"
+$SUDO -c "@bindir@/rmtemplate_gis.sh-@FINKPGRAWVERSION@"
--- postgis-1.3.1/extras/template_gis/rmtemplate_gis.sh.in	2006-05-31 02:43:12.000000000 -0400
+++ postgis-1.3.1-new/extras/template_gis/rmtemplate_gis.sh.in	2007-09-18 10:46:24.000000000 -0400
@@ -6,7 +6,7 @@
 
 cd /tmp
 
-source @bindir@/postgres_lib.sh
+source @bindir@/postgres_lib.sh-@FINKPGRAWVERSION@
 
 check_dba $DBAUSER
 template_rm $TDB
--- postgis-1.3.1/java/jdbc/Makefile	2007-01-18 13:51:15.000000000 -0500
+++ postgis-1.3.1-new/java/jdbc/Makefile	2007-09-18 10:46:24.000000000 -0400
@@ -27,7 +27,7 @@
 
 # Configure the helper executables used during build.
 
-JAVAC?=javac -target 1.2 -source 1.2
+JAVAC?=javac -target 1.4 -source 1.2
 JAVA?=java
 JAR?=jar
 MKDIR?=mkdir -p
--- postgis-1.3.1/lwgeom/lwgeom_gml.c	2007-06-08 06:28:52.000000000 -0400
+++ postgis-1.3.1-new/lwgeom/lwgeom_gml.c	2007-09-18 10:46:24.000000000 -0400
@@ -38,10 +38,10 @@
 
 #define DEF_PRECISION 15
 /* Add dot, sign, exponent sign, 'e', exponent digits */
-#define SHOW_DIGS (precision + 8)
+#define SHOW_DIGS (gml_precision + 8)
 
 /* Globals */
-int precision;
+int gml_precision;
 
 
 /**
@@ -58,7 +58,7 @@
 	char *srs;
 	int SRID;
 
-	precision = DEF_PRECISION;
+	gml_precision = DEF_PRECISION;
 
 	if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
 
@@ -66,9 +66,9 @@
 
 	/* Get precision (if provided)  */
 	if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
-			precision = PG_GETARG_INT32(1);
+			gml_precision = PG_GETARG_INT32(1);
 	
-	if ( precision < 1 || precision > 15 )
+	if ( gml_precision < 1 || gml_precision > 15 )
 	{
 		elog(ERROR, "Precision out of range 1..15");
 		PG_RETURN_NULL();
@@ -424,8 +424,8 @@
 			getPoint2d_p(pa, i, &pt);
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%.*g,%.*g",
-				precision, pt.x,
-				precision, pt.y);
+				gml_precision, pt.x,
+				gml_precision, pt.y);
 		}
 	}
 	else 
@@ -436,9 +436,9 @@
 			getPoint4d_p(pa, i, &pt);
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%.*g,%.*g,%.*g",
-				precision, pt.x,
-				precision, pt.y,
-				precision, pt.z);
+				gml_precision, pt.x,
+				gml_precision, pt.y,
+				gml_precision, pt.z);
 		}
 	}
 
--- postgis-1.3.1/lwgeom/lwgeom_kml.c	2007-06-08 06:28:52.000000000 -0400
+++ postgis-1.3.1-new/lwgeom/lwgeom_kml.c	2007-09-18 10:46:24.000000000 -0400
@@ -38,10 +38,10 @@
 
 #define DEF_PRECISION 15
 /* Add dot, sign, exponent sign, 'e', exponent digits */
-#define SHOW_DIGS (precision + 8)
+#define SHOW_DIGS (kml_precision + 8)
 
 /* Globals */
-int precision;
+int kml_precision;
 
 
 /**
@@ -58,7 +58,7 @@
 	char *srs;
 	int SRID;
 
-	precision = DEF_PRECISION;
+	kml_precision = DEF_PRECISION;
 
 	if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
 
@@ -66,9 +66,9 @@
 
 	/* Get precision (if provided)  */
 	if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
-			precision = PG_GETARG_INT32(1);
+			kml_precision = PG_GETARG_INT32(1);
 	
-	if ( precision < 1 || precision > 15 )
+	if ( kml_precision < 1 || kml_precision > 15 )
 	{
 		elog(ERROR, "Precision out of range 1..15");
 		PG_RETURN_NULL();
@@ -409,8 +409,8 @@
 			getPoint2d_p(pa, i, &pt);
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%.*g,%.*g,0",
-				precision, pt.x,
-				precision, pt.y);
+				kml_precision, pt.x,
+				kml_precision, pt.y);
 		}
 	}
 	else 
@@ -421,9 +421,9 @@
 			getPoint4d_p(pa, i, &pt);
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%.*g,%.*g,%.*g",
-				precision, pt.x,
-				precision, pt.y,
-				precision, pt.z);
+				kml_precision, pt.x,
+				kml_precision, pt.y,
+				kml_precision, pt.z);
 		}
 	}
 
--- postgis-1.3.1/utils/postgis_restore.pl	2006-11-20 07:59:55.000000000 -0500
+++ postgis-1.3.1-new/utils/postgis_restore.pl	2007-09-18 10:49:49.000000000 -0400
@@ -690,7 +690,7 @@
 #
 # Open a pipe to the SQL monitor
 #
-open( PSQL, "| psql -a $dbname") || die "Can't run psql\n";
+open( PSQL, "| psql-@FINKPGRAWVERSION@ -a $dbname") || die "Can't run psql\n";
 
 #
 # Source new postgis.sql
@@ -717,4 +717,4 @@
 open(INPUT, "<$dumpascii") || die "Can't read $postgissql\n";
 while(<INPUT>) { print PSQL; }
 close(INPUT);
-close(PSQL) || die "psql run failed\n"
+close(PSQL) || die "psql-@FINKPGRAWVERSION@ run failed\n"
