diff --git a/src/include/port.h b/src/include/port.h
index e60bc60f02d569911e3c5fff2a00f18d8570c01f..e6bde3de6e0b02687fc485c8c57fbb70e7e6cf07 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.63 2004/09/27 23:24:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.64 2004/10/11 22:50:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -167,8 +167,6 @@ extern int	pclose_check(FILE *stream);
  */
 extern int	pgrename(const char *from, const char *to);
 extern int	pgunlink(const char *path);
-extern int	pgsymlink(const char *oldpath, const char *newpath);
-
 /* Include this first so later includes don't see these defines */
 #ifdef WIN32_CLIENT_ONLY
 #include <io.h>
@@ -176,9 +174,19 @@ extern int	pgsymlink(const char *oldpath, const char *newpath);
 
 #define rename(from, to)		pgrename(from, to)
 #define unlink(path)			pgunlink(path)
+
+/*
+ *	Cygwin has its own symlinks which work on Win95/98/ME where
+ *	junction points don't, so use it instead.  We have no way of
+ *	knowing what type of system Cygwin binaries will be run on.
+ */
+#ifdef WIN32	
+extern int	pgsymlink(const char *oldpath, const char *newpath);
 #define symlink(oldpath, newpath)	pgsymlink(oldpath, newpath)
 #endif
 
+#endif
+
 extern bool rmtree(char *path, bool rmtopdir);
 
 #ifdef WIN32
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 1141138984d2a9b9b5b813d688258d0123357d9d..ca90f0263d1ef8493adf2e44a366004f593ddbf2 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -10,7 +10,7 @@
  *	Win32 (NT, Win2k, XP).	replace() doesn't work on Win95/98/Me.
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/port/dirmod.c,v 1.27 2004/09/27 19:16:02 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/port/dirmod.c,v 1.28 2004/10/11 22:50:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -142,6 +142,7 @@ pgunlink(const char *path)
 }
 
 
+#ifdef WIN32	/* Cygwin has its own symlinks */
 /*
  *	pgsymlink support:
  *
@@ -160,9 +161,7 @@ typedef struct
 	WORD		PrintNameOffset;
 	WORD		PrintNameLength;
 	WCHAR		PathBuffer[1];
-}
-
-			REPARSE_JUNCTION_DATA_BUFFER;
+}	REPARSE_JUNCTION_DATA_BUFFER;
 
 #define REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE   \
 		FIELD_OFFSET(REPARSE_JUNCTION_DATA_BUFFER, SubstituteNameOffset)
@@ -246,6 +245,7 @@ pgsymlink(const char *oldpath, const char *newpath)
 	return 0;
 }
 #endif
+#endif
 
 
 /* We undefined this above, so we redefine it */