Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.189
diff -c -r1.189 configure.in
*** configure.in	15 Jul 2002 22:41:45 -0000	1.189
--- configure.in	16 Jul 2002 05:41:22 -0000
***************
*** 916,922 ****
  AC_SUBST(INET_ATON)
  AC_CHECK_FUNCS(strerror, [], STRERROR='$(top_builddir)/src/backend/port/strerror.o')
  AC_SUBST(STRERROR)
! AC_CHECK_FUNCS(strdup, [], STRDUP='$(top_builddir)/src/utils/strdup.o')
  AC_SUBST(STRDUP)
  AC_CHECK_FUNCS(strtol, [], STRTOL='$(top_builddir)/src/backend/port/strtol.o')
  AC_SUBST(STRTOL)
--- 916,922 ----
  AC_SUBST(INET_ATON)
  AC_CHECK_FUNCS(strerror, [], STRERROR='$(top_builddir)/src/backend/port/strerror.o')
  AC_SUBST(STRERROR)
! AC_CHECK_FUNCS(strdup, [], STRDUP='$(top_builddir)/src/backend/port/strdup.o')
  AC_SUBST(STRDUP)
  AC_CHECK_FUNCS(strtol, [], STRTOL='$(top_builddir)/src/backend/port/strtol.o')
  AC_SUBST(STRTOL)
***************
*** 924,929 ****
--- 924,936 ----
  AC_SUBST(STRTOUL)
  AC_CHECK_FUNCS(strcasecmp, [], STRCASECMP='$(top_builddir)/src/backend/port/strcasecmp.o')
  AC_SUBST(STRCASECMP)
+ 
+ # Set path of dllinit.c for cygwin
+ DLLINIT=""
+ case $host_os in 
+   cygwin*) DLLINIT='$(top_builddir)/src/backend/port/dllinit.o' ;;
+ esac
+ AC_SUBST(DLLINIT)
  
  # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
  # this hackery with HPUXMATHLIB allows us to cope.
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.148
diff -c -r1.148 Makefile.global.in
*** src/Makefile.global.in	28 May 2002 16:57:53 -0000	1.148
--- src/Makefile.global.in	16 Jul 2002 05:41:23 -0000
***************
*** 359,364 ****
--- 359,365 ----
  STRERROR    = @STRERROR@
  STRTOL      = @STRTOL@
  STRTOUL     = @STRTOUL@
+ DLLINIT     = @DLLINIT@
  
  TAS         = @TAS@
  
Index: src/Makefile.shlib
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.shlib,v
retrieving revision 1.58
diff -c -r1.58 Makefile.shlib
*** src/Makefile.shlib	24 May 2002 18:10:17 -0000	1.58
--- src/Makefile.shlib	16 Jul 2002 05:41:23 -0000
***************
*** 327,339 ****
  else # PORTNAME == win
  
  # WIN case
! $(shlib) lib$(NAME).a: $(OBJS) $(top_builddir)/src/utils/dllinit.o
  	$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
! 	$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(top_builddir)/src/utils/dllinit.o $(DLLINIT) $(DLLLIBS) $(SHLIB_LINK)
  	$(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
  
! $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
! 	$(MAKE) -C $(top_builddir)/src/utils dllinit.o
  
  endif # PORTNAME == win
  
--- 327,339 ----
  else # PORTNAME == win
  
  # WIN case
! $(shlib) lib$(NAME).a: $(OBJS) $(DLLINIT)
  	$(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
! 	$(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(DLLINIT) $(DLLLIBS) $(SHLIB_LINK)
  	$(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
  
! $(DLLINIT):
! 	$(MAKE) -C $(@D) $(@F)
  
  endif # PORTNAME == win
  
Index: src/backend/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/Makefile,v
retrieving revision 1.79
diff -c -r1.79 Makefile
*** src/backend/Makefile	22 May 2002 21:46:40 -0000	1.79
--- src/backend/Makefile	16 Jul 2002 05:41:24 -0000
***************
*** 43,49 ****
  
  # No points for style here. How about encapsulating some of these
  # commands into variables?
! postgres: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
  	dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
  	gcc $(LDFLAGS) -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
  	dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
--- 43,49 ----
  
  # No points for style here. How about encapsulating some of these
  # commands into variables?
! postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
  	dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
  	gcc $(LDFLAGS) -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(DLLLIBS)
  	dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
***************
*** 67,80 ****
  postgres.def: $(OBJS)
  	$(DLLTOOL) --export-all --output-def $@ $(OBJS)
  
! libpostgres.a: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
  	$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
  
  endif # MAKE_DLL
  
  
! $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
! 	$(MAKE) -C $(top_builddir)/src/utils dllinit.o
  
  # The postgres.o target is needed by the rule in Makefile.global that
  # creates the exports file when MAKE_EXPORTS = true.
--- 67,80 ----
  postgres.def: $(OBJS)
  	$(DLLTOOL) --export-all --output-def $@ $(OBJS)
  
! libpostgres.a: $(OBJS) $(DLLINIT) postgres.def
  	$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
  
  endif # MAKE_DLL
  
  
! $(DLLINIT):
! 	$(MAKE) -C $(@D) $(@F)
  
  # The postgres.o target is needed by the rule in Makefile.global that
  # creates the exports file when MAKE_EXPORTS = true.
Index: src/makefiles/Makefile.win
===================================================================
RCS file: /cvsroot/pgsql/src/makefiles/Makefile.win,v
retrieving revision 1.15
diff -c -r1.15 Makefile.win
*** src/makefiles/Makefile.win	6 Sep 2001 02:58:33 -0000	1.15
--- src/makefiles/Makefile.win	16 Jul 2002 05:41:25 -0000
***************
*** 17,23 ****
  
  %.dll: %.o
  	$(DLLTOOL) --export-all --output-def $*.def $<
! 	$(DLLWRAP) -o $@ --def $*.def $< $(top_builddir)/src/utils/dllinit.o $(DLLLIBS)
  	rm -f $*.def
  
  ifeq ($(findstring backend,$(subdir)), backend)
--- 17,23 ----
  
  %.dll: %.o
  	$(DLLTOOL) --export-all --output-def $*.def $<
! 	$(DLLWRAP) -o $@ --def $*.def $< $(DLLINIT) $(DLLLIBS)
  	rm -f $*.def
  
  ifeq ($(findstring backend,$(subdir)), backend)
