From 9dac52649db6e182e5cbddd979aebc4cc4983701 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 2 Feb 2004 22:20:33 +0000
Subject: [PATCH] Win32 adjustments for dirmod and configure/configure.in.

---
 configure          | 5 ++++-
 configure.in       | 7 +++++--
 src/include/port.h | 4 ++--
 src/port/dirmod.c  | 9 ++++++++-
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 9233bf02ba4..43d4fc4e8f5 100755
--- a/configure
+++ b/configure
@@ -12078,12 +12078,15 @@ esac
 # Win32 can't to rename or unlink on an open file
 case $host_os in mingw*)
 LIBOBJS="$LIBOBJS copydir.$ac_objext"
-LIBOBJS="$LIBOBJS dirmod.$ac_objext"
 LIBOBJS="$LIBOBJS gettimeofday.$ac_objext"
 LIBOBJS="$LIBOBJS pipe.$ac_objext"
 LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
 esac
 
+case $host_os in mingw*|cygwin*)
+LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;;
+esac
+
 if test "$with_readline" = yes; then
   echo "$as_me:$LINENO: checking for rl_completion_append_character" >&5
 echo $ECHO_N "checking for rl_completion_append_character... $ECHO_C" >&6
diff --git a/configure.in b/configure.in
index 8710907b536..6f90cbfa5ad 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.312 2004/02/02 16:00:49 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.313 2004/02/02 22:20:32 momjian Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -906,12 +906,15 @@ esac
 # Win32 can't to rename or unlink on an open file
 case $host_os in mingw*)
 AC_LIBOBJ(copydir)
-AC_LIBOBJ(dirmod)
 AC_LIBOBJ(gettimeofday)
 AC_LIBOBJ(pipe)
 AC_LIBOBJ(rand) ;;
 esac
 
+case $host_os in mingw*|cygwin*)
+AC_LIBOBJ(dirmod) ;;
+esac
+
 if test "$with_readline" = yes; then
   PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
   AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
diff --git a/src/include/port.h b/src/include/port.h
index 67e16e1aae4..a885e91424d 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.17 2004/02/02 00:17:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.18 2004/02/02 22:20:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,7 @@ extern int	fseeko(FILE *stream, off_t offset, int whence);
 extern off_t ftello(FILE *stream);
 #endif
 
-#if !defined(FRONTEND) && (defined(WIN32) || defined(CYGWIN))
+#if defined(WIN32) || defined(CYGWIN)
 /*
  * Win32 doesn't have reliable rename/unlink during concurrent access
  */
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 45a99216c35..c0c73832991 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -10,14 +10,20 @@
  *	Win32 (NT, Win2k, XP).	replace() doesn't work on Win95/98/Me.
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/port/dirmod.c,v 1.9 2004/02/02 00:17:23 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/port/dirmod.c,v 1.10 2004/02/02 22:20:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #ifndef TEST_VERSION
 
+#if defined(WIN32) || defined(CYGWIN)
+
+#ifndef FRONTEND
 #include "postgres.h"
+#else
+#include "postgres_fe.h"
+#endif
 
 #undef rename
 #undef unlink
@@ -95,6 +101,7 @@ pgunlink(const char *path)
 	return 0;
 }
 
+#endif
 
 #else
 
-- 
GitLab