diff -Naur /d/fromoutsideworld/postgis/loader/Makefile /d/projects/compile/pgsql/contrib/postgis/loader/Makefile
--- /d/fromoutsideworld/postgis/loader/Makefile	Thu Feb  5 16:07:32 2004
+++ /d/projects/compile/pgsql/contrib/postgis/loader/Makefile	Thu May 13 17:46:35 2004
@@ -50,9 +50,9 @@
 	$(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@ 
 
 install: all
-	$(INSTALL_PROGRAM) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
-	$(INSTALL_PROGRAM) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
+	$(INSTALL_PROGRAM) pgsql2shp$(X) $(DESTDIR)$(bindir)/pgsql2shp$(X)
+	$(INSTALL_PROGRAM) shp2pgsql$(X) $(DESTDIR)$(bindir)/shp2pgsql$(X)
 
 clean:
-	@rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(EXE) pgsql2shp$(EXE)
+	@rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(X) pgsql2shp$(X)
 
diff -Naur /d/fromoutsideworld/postgis/postgis.h /d/projects/compile/pgsql/contrib/postgis/postgis.h
--- /d/fromoutsideworld/postgis/postgis.h	Sun Mar 28 19:42:25 2004
+++ /d/projects/compile/pgsql/contrib/postgis/postgis.h	Thu May 13 17:50:37 2004
@@ -94,7 +94,7 @@
  * it defines BYTE_ORDER and LITTLE_ENDIAN
  */
 
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MINGW32__) 
 #include <sys/param.h>       // FOR ENDIAN DEFINES
 #endif
 
@@ -669,8 +669,10 @@
 
 // from contrib/cube/cube.c
 
+#if !defined(__MINGW32__) 
 #define max(a,b)		((a) >	(b) ? (a) : (b))
 #define min(a,b)		((a) <= (b) ? (a) : (b))
+#endif 
 #define abs(a)			((a) <	(0) ? (-a) : (a))
 
 
diff -Naur /d/fromoutsideworld/postgis/postgis_inout.c /d/projects/compile/pgsql/contrib/postgis/postgis_inout.c
--- /d/fromoutsideworld/postgis/postgis_inout.c	Thu Apr 29 08:49:37 2004
+++ /d/projects/compile/pgsql/contrib/postgis/postgis_inout.c	Thu May 13 17:50:10 2004
@@ -1617,8 +1617,14 @@
 				char *last_paren;
 				char *current_paren;
 
+        //from mappostgis.c
+		#if defined(__MINGW32__) 
+				first_paren= strchr (str,'(');
+				last_paren = strrchr(str,')');
+		#else
 				first_paren= index (str,'(');
 				last_paren = rindex(str,')');
+		#endif
 
 				if  ( (first_paren == NULL) || (last_paren == NULL) || (first_paren >last_paren) )
 				{
