This is a patch to build X11R6.3 libraries and clients binaries with
gnu-win32 beta 19. Most of X libraries are built as DLLs.

What You have to do:
1. Take original X11R6.3 distribution from ftp.x.org (You need file
xc-1.tar.gz). Also, You can take contrib.tar.gz - it contains
a lot of useful programs (xman, for example) and documentation.
2. Unpack this file to some (current) directory with "tar xvfz xc-1.tar.gz".
You will have xc subdirectory. Apply fix-01 and fix-02 patches from ftp.x.org
if the distribution doesn't contains them already.
Note: this directory should be on binary-mounted volume!
3. Apply this patch with "patch -p0 -s <X11R6.3f2-b19.diff" command
4. Cd to CYWINROOT/H-i386-cygwin32/bin directory and run "ln -s gcc.exe cc".
5. Cd to xc directory and run "make -i World". Full build takes about 2 hrs
on P-166 machine.
6. Run "make install". All X11R6.3 libraries and clients binaries are now
installed in /usr/X11R6.3 directory.


diff -urN -X xexclude xc.orig/config/cf/Imake.cf xc/config/cf/Imake.cf
--- xc.orig/config/cf/Imake.cf	Sun Dec 21 22:33:32 1997
+++ xc/config/cf/Imake.cf	Wed Feb 25 08:05:19 1998
@@ -414,6 +414,13 @@
 # endif /* __alpha */
 #endif /* linux */
 
+#ifdef __CYGWIN32__
+# define MacroIncludeFile <cygwin32.cf>
+# define MacroFile cygwin32.cf
+# define LinuxArchitecture
+# define i386Architecture
+#endif /* __CYGWIN32__ */
+
 #ifdef __uxp__
 # define MacroIncludeFile <fujitsu.cf>
 # define MacroFile fujitsu.cf
diff -urN -X xexclude xc.orig/config/cf/Imakefile xc/config/cf/Imakefile
--- xc.orig/config/cf/Imakefile	Thu Nov 07 22:48:15 1996
+++ xc/config/cf/Imakefile	Wed Feb 25 08:05:20 1998
@@ -14,6 +14,7 @@
 
 RULEFILES = \
 Imake.rules \
+cygwin32.rules \
 Motif.rules \
 Win32.rules \
 X11.rules \
@@ -36,6 +37,7 @@
 
 TMPLFILES = \
 Imake.tmpl \
+cygwin32.tmpl \
 Library.tmpl \
 Motif.tmpl \
 Server.tmpl \
@@ -58,6 +60,7 @@
 
 CFFILES = \
 Imake.cf \
+cygwin32.cf \
 Amoeba.cf \
 DGUX.cf \
 FreeBSD.cf \
diff -urN -X xexclude xc.orig/config/cf/cygwin32.cf xc/config/cf/cygwin32.cf
--- xc.orig/config/cf/cygwin32.cf	Thu Jan 01 03:00:00 1970
+++ xc/config/cf/cygwin32.cf	Sat Feb 28 02:16:52 1998
@@ -0,0 +1,116 @@
+XCOMM platform:  $XConsortium: cygwin32.cf sos 1996/02/08 18:59:31 gildea $
+XCOMM
+XCOMM changes since b18 cygwin32 release
+XCOMM	- avoided tons of "not in XXX directory" messages;
+XCOMM	- dlls are built stripped;
+XCOMM	- search for cpp in a default location;
+XCOMM	- fixed problem with missed netinet/tcp.h;
+XCOMM	- xterm compiles and works;
+XCOMM	- more libs are built as a dlls;
+XCOMM	- all dlls have different base addresses;
+
+#ifndef OSName
+#define OSName                  Cygwin32
+#endif
+#ifndef OSVendor
+#define OSVendor                Cygnus Solutions
+#endif
+#ifndef OSMajorVersion
+#define OSMajorVersion          19
+#endif
+#ifndef OSMinorVersion
+#define OSMinorVersion          0
+#endif
+#ifndef OSTeenyVersion
+#define OSTeenyVersion
+#endif
+
+#define BuildFonts		NO
+#define BuildServer		NO
+
+#ifndef UnixCpp
+#define UnixCpp
+#endif
+
+#define HasGcc                  YES
+#define HasGcc2                 YES
+#define HasGcc2ForCplusplus     YES
+#define GccUsesGas              YES
+#define UseGas                  YES
+#define GnuCpp                  YES
+#define HasShadowPasswd         NO
+#define HasLibCrypt             NO
+#define HasPutenv               YES
+#define HasShm                  NO
+#define HasSockets              YES
+#define GzipFontCompression	YES
+
+#define AvoidNullMakeCommand    NO
+#define StripInstalledPrograms  YES
+#define CompressAllFonts        YES
+#define Malloc0ReturnsNull      NO
+#define NeedConstPrototypes     YES
+#define NeedFunctionPrototypes  YES
+#define NeedNestedPrototypes    YES
+#define NeedVarargsPrototypes   YES
+#define NeedWidePrototypes      NO
+#define SetTtyGroup             YES
+#define ExpandManNames          NO
+
+#define ThreadedX		NO
+#define HasThreadSafeAPI	NO
+#define LnCmd                   ln -s
+#define CcCmd                   gcc
+#define AsCmd                   as
+#define LdCmd                   ld
+#define MkdirHierCmd            mkdir -p
+#define CppCmd                  `CcCmd --print-prog-name=cpp | sed 's@\\\\@/@g'`
+#define YaccCmd                 byacc
+#define LexCmd                  flex -l
+#define LexLib                  -lfl
+#define PreProcessCmd           CcCmd -E
+#define StdIncDir               `CcCmd --print-libgcc-file-name | sed 's:libgcc.a:../../../../i386-cygwin32/include:'|sed 's@\\\\@/@g'`
+#define PostIncDir              `CcCmd --print-libgcc-file-name | sed 's:libgcc.a:/include:'|sed 's@\\\\@/@g'`
+#define LdCombineFlags          -r
+#define OptimizedCDebugFlags    -O2 -s -mpentium
+#define StandardDefines         -D__i386__ -DX_LOCALE -D_MT -DNO_TCP_H
+#define XawI18nDefines          -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
+#define HasWChar32              YES
+#define StandardCppDefines      -traditional StandardDefines
+#define ServerOSDefines         -DDDXTIME -DFD_SETSIZE=256
+#define ExtensionOSDefines      -DXTESTEXT1
+#define ServerExtraDefines      -DGCCUSESGAS
+#define ConnectionFlags         -DTCPCONN
+#define InstUidFlags            -s -m 4711
+#define UseRgbTxt		YES
+
+/* Some of these man page defaults are overriden in the above OS sections */
+#ifndef ManSuffix
+# define ManSuffix      1x
+#endif
+#ifndef ManDir
+# define ManDir         $(MANSOURCEPATH)1
+#endif
+#ifndef LibManSuffix
+# define LibManSuffix   3x
+#endif
+#ifndef LibmanDir
+# define LibmanDir      $(MANSOURCEPATH)3
+#endif
+#ifndef FileManSuffix
+# define FileManSuffix  5x
+#endif
+#ifndef FileManDir
+# define FileManDir     $(MANSOURCEPATH)5
+#endif
+
+#define TermcapLibrary -ltermcap
+
+/* --unix option of cygwin make fools the standard MakeFlagsToShellFlags macro */
+#define MakeFlagsToShellFlags(makeflags,shellcmd)\
+	for flag in ${MAKEFLAGS} ''; do \				@@\
+	  case "$$flag" in *=*) ;;--*) ;; *[makeflags]*) shellcmd;; esac; done
+
+#include <cygwin32.rules>
+/*#include <xfree86.cf>*/
+
diff -urN -X xexclude xc.orig/config/cf/cygwin32.rules xc/config/cf/cygwin32.rules
--- xc.orig/config/cf/cygwin32.rules	Thu Jan 01 03:00:00 1970
+++ xc/config/cf/cygwin32.rules	Sat Feb 28 02:03:23 1998
@@ -0,0 +1,181 @@
+XCOMM $XConsortium: cygwin32.rules /main/12 1996/01/03 14:51:18 kaleb $
+
+/*
+ * Cygwin32 shared library rules (DLL versions)
+ */
+#define HasSharedLibraries YES
+#define NeedLibInsideFlag YES
+#define ForceNormalLib NO
+#define SharedLibXaw NO
+#define SharedLibXmu NO
+#define SharedLibXt NO
+#define SharedLibSM YES
+#define SharedLibICE YES
+#define SharedLibXext YES
+#define SharedLibXie YES
+#define SharedLibXi YES
+#define SharedLibPex YES
+#define SharedLibXtst YES
+#define SharedOldX YES
+#define SharedLibXp YES
+
+
+#ifndef SharedDataSeparation
+#define SharedDataSeparation NO
+#endif
+#ifndef SharedCodeDef
+#define SharedCodeDef /**/
+#endif
+#ifndef SharedLibraryDef
+#define SharedLibraryDef /**/
+#endif
+#ifndef ShLibIncludeFile
+#define ShLibIncludeFile <cygwin32.tmpl>
+#endif
+#ifndef SharedLibraryLoadFlags
+#define SharedLibraryLoadFlags /**/
+#endif
+/*
+ * SharedLibraryDataTarget - generate rules to create shared data file
+ */
+#ifndef SharedLibraryDataTarget
+#define SharedLibraryDataTarget(libname,rev,salist)
+#endif
+/*
+ * InstallSharedLibraryData - generate rules to install the shared library data
+ */
+#ifndef InstallSharedLibraryData
+#define InstallSharedLibraryData(libname,rev,dest)
+#endif /* InstallSharedLibraryData */
+
+GCCLIB = $(shell echo							        \
+	-L`dirname \`gcc -print-file-name=libgcc.a|sed 's@\\\\\\\\@/@g'\``	\
+	-L`dirname \`gcc -print-file-name=libcygwin.a|sed 's@\\\\\\\\@/@g'\``   \
+	-L`dirname \`gcc -print-file-name=libkernel32.a|sed 's@\\\\\\\\@/@g'\`` \
+	-lgcc -lcygwin -lkernel32 -lgcc)
+DLLTOOL= dlltool
+BASE_COUNTER=/tmp/DLL_BASE_COUNTER
+
+#define MakeDLL(libname,solist)					@@\
+	if [ -f $(BASE_COUNTER) ]; then true; \			@@\
+	else echo 0x67000000 > $(BASE_COUNTER); fi		@@\
+	$(DLLTOOL) --dllname Concat3(lib,libname,.dll) --def libname.def --output-lib Concat3(lib,libname,.a) @@\
+	$(LD) --base-file=dll.base $(LD_STUFF)			@@\
+	$(DLLTOOL) $(DLL_STUFF)					@@\
+	$(LD) --base-file=dll.base win.exp $(LD_STUFF)		@@\
+	$(DLLTOOL) $(DLL_STUFF)					@@\
+	$(LD) win.exp $(LD_STUFF)				@@\
+	rm -f win.exp dll.base					@@\
+	IMAGE_LENGTH=`objdump -x Concat3(lib,libname,.dll) |awk '/SizeOfImage/ {print "0x"$$2}'`; \ @@\
+	export IMAGE_LENGTH=`expr '(' \`printf %d $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \ @@\
+	export IMAGE_BASE=`cat $(BASE_COUNTER)`; \			@@\
+	printf 0x%x `expr \`printf %d $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER)
+
+
+#define SharedLibraryTarget(libname,rev,solist,down,up)                 @@\
+AllTarget(Concat3(lib,libname,.dll))                                    @@\
+									@@\
+CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
+									@@\
+LD_STUFF=--dll -s -o Concat3(lib,libname,.dll) solist junk.o $(REQUIREDLIBS) -e __cygwin32_dll_entry@12 $(GCCLIB) --image-base `cat $(BASE_COUNTER)` @@\
+DLL_STUFF=--dllname Concat3(lib,libname,.dll) --def libname.def --base-file dll.base --output-exp win.exp @@\
+                                                                        @@\
+junk.c:                                                                                 @@\
+	echo "#include <cygwin32/cygwin_dll.h>"		>junk.c		@@\
+	echo "DECLARE_CYGWIN_DLL(dll_main);"		>>junk.c	@@\
+	echo "int WINAPI dll_main(HANDLE a, DWORD reason, void *q)" >>junk.c  @@\
+	echo "{ return 1; }"				>>junk.c	@@\
+Concat3(lib,libname,.dll): solist junk.o libname.def			@@\
+	RemoveFile(LibraryTargetName(libname))				@@\
+	RemoveFile(Concat3(lib,libname,.dll))				@@\
+	MakeDLL(libname,solist)						@@\
+	LinkBuildLibrary(Concat3(lib,libname,.a))			@@\
+clean::									@@\
+	RemoveFile(LibraryTargetName(libname))				@@\
+	RemoveFile(Concat3(lib,libname,.dll))				@@\
+	RemoveFile(junk.o)						@@\
+	RemoveFile(junk.c)						@@\
+	RemoveFile($(BASE_COUNTER))
+
+#define InstallSharedLibrary(libname,rev,dest)                          @@\
+InstallTarget(install,LibraryTargetName(libname),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\
+InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR))
+
+#define ProgramTargetName(target)target.exe
+
+#define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)  @@\
+AllTarget(ProgramTargetName(program))					@@\
+ProgramTargetName(program): objects deplibs				@@\
+	RemoveTargetProgram($@)						@@\
+	LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs)	@@\
+									@@\
+clean::									@@\
+	RemoveFile(ProgramTargetName(program))
+
+#define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib)	@@\
+ProgramTargetName(program): $(objs) $(deplib)				@@\
+	RemoveTargetProgram($@)						@@\
+	LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib)	@@\
+									@@\
+InstallProgram(program,$(BINDIR))					@@\
+InstallManPage(program,$(MANDIR))
+
+#define ComplexProgramTarget(program)					@@\
+AllTarget(ProgramTargetName(program))					@@\
+									@@\
+ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
+									@@\
+DependTarget()								@@\
+LintTarget()								@@\
+									@@\
+clean::									@@\
+	RemoveFile(ProgramTargetName(program))
+
+#define ComplexProgramTarget_1(program,locallib,syslib)			@@\
+        OBJS = $(OBJS1) $(OBJS2) $(OBJS3)				@@\
+        SRCS = $(SRCS1) $(SRCS2) $(SRCS3)				@@\
+        PROGRAM1 = ProgramTargetName(program)				@@\
+									@@\
+AllTarget($(PROGRAM1) $(PROGRAM2) $(PROGRAM3))				@@\
+									@@\
+ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)	@@\
+									@@\
+DependTarget()								@@\
+LintTarget()								@@\
+									@@\
+clean::									@@\
+	for i in $(PROGRAMS); do $(RM) ProgramTargetName($$i); done
+
+#define ComplexProgramTarget_2(program,locallib,syslib)			@@\
+        PROGRAM2 = ProgramTargetName(program)				@@\
+									@@\
+ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
+
+#define ComplexProgramTarget_3(program,locallib,syslib)			@@\
+        PROGRAM3 = ProgramTargetName(program)				@@\
+									@@\
+ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
+
+#define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
+AllTarget(ProgramTargetName(server))					@@\
+ProgramTargetName(server): subdirs objects libs				@@\
+	MoveToBakFile($@)						@@\
+	LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs)	@@\
+									@@\
+Concat(load,server):							@@\
+	MoveToBakFile(ProgramTargetName(server))			@@\
+	LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
+									@@\
+loadX:: Concat(load,server)						@@\
+									@@\
+SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
+SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
+PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
+PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
+ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
+ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
+									@@\
+InstallProgramWithFlags(server,$(BINDIR),flags)				@@\
+									@@\
+clean::									@@\
+	RemoveFile(ProgramTargetName(server))
diff -urN -X xexclude xc.orig/config/cf/cygwin32.tmpl xc/config/cf/cygwin32.tmpl
--- xc.orig/config/cf/cygwin32.tmpl	Thu Jan 01 03:00:00 1970
+++ xc/config/cf/cygwin32.tmpl	Wed Feb 25 08:05:20 1998
@@ -0,0 +1,23 @@
+XCOMM $XConsortium: WinLib.tmpl,v 1.1 94/01/08 18:32:51 rws Exp $
+
+#define SharedOldXReqs $(LDPRELIB) $(XLIBONLY)
+#define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XLIBONLY)
+#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
+#define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB)
+#define SharedXextReqs $(LDPRELIB) $(XLIBONLY)
+#define SharedXiReqs $(LDPRELIB) $(XLIB)
+#define SharedPexReqs $(LDPRELIB) $(XLIBONLY) MathLibrary
+#define SharedXtstReqs $(LDPRELIB) $(XLIB)
+#define SharedXieReqs $(LDPRELIB) $(XLIBONLY)
+#define SharedSMReqs $(LDPRELIB) $(ICELIB)
+#define SharedXpReqs $(LDPRELIBS) $(XAUTHLIB) $(EXTENSIONLIB) $(XLIBONLY)
+#ifndef FixupLibReferences
+#define FixupLibReferences()						@@\
+XMULIBONLY = -lXmu							@@\
+XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
+#endif
+
+#ifndef XawClientLibs
+#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
+#endif
+
diff -urN -X xexclude xc.orig/config/imake/imake.c xc/config/imake/imake.c
--- xc.orig/config/imake/imake.c	Sun Dec 21 22:33:36 1997
+++ xc/config/imake/imake.c	Wed Feb 25 08:05:20 1998
@@ -366,7 +366,11 @@
 	sprintf(makefileMacro, "MAKEFILE=%s", Imakefile);
 	AddMakeArg( makefileMacro );
 
+#ifdef __CYGWIN32__
+	if ((tmpfd = fopen(tmpMakefile, "wb+")) == NULL)
+#else
 	if ((tmpfd = fopen(tmpMakefile, "w+")) == NULL)
+#endif
 		LogFatal("Cannot create temporary file %s.", tmpMakefile);
 
 	cleanedImakefile = CleanCppInput(Imakefile);
diff -urN -X xexclude xc.orig/config/imake/imakemdep.h xc/config/imake/imakemdep.h
--- xc.orig/config/imake/imakemdep.h	Sun Dec 21 22:33:36 1997
+++ xc/config/imake/imakemdep.h	Wed Feb 25 08:05:20 1998
@@ -258,6 +258,10 @@
 /* expects cpp in PATH */
 #define DEFAULT_CPP "cpp"
 #endif
+#ifdef __CYGWIN32__
+#define USE_CC_E
+#define DEFAULT_CC "gcc"
+#endif
 
 /*
  * Step 5:  cpp_argv
@@ -482,6 +486,9 @@
 #ifdef linux
         "-traditional",
         "-Dlinux",
+#endif
+#ifdef __CYGWIN32__
+        "-traditional",
 #endif
 #ifdef __uxp__
 	"-D__uxp__",
diff -urN -X xexclude xc.orig/config/makedepend/main.c xc/config/makedepend/main.c
--- xc.orig/config/makedepend/main.c	Wed Dec 04 18:11:25 1996
+++ xc/config/makedepend/main.c	Wed Feb 25 08:05:20 1998
@@ -615,12 +615,12 @@
 		fatalerr("cannot open \"%s\"\n", makefile);
 	sprintf(backup, "%s.bak", makefile);
 	unlink(backup);
-#ifdef WIN32
+#if defined (WIN32) || defined (__CYGWIN32__)
 	fclose(fdin);
 #endif
 	if (rename(makefile, backup) < 0)
 		fatalerr("cannot rename %s to %s\n", makefile, backup);
-#ifdef WIN32
+#if defined (WIN32) || defined (__CYGWIN32__)
 	if ((fdin = fopen(backup, "r")) == NULL)
 		fatalerr("cannot open \"%s\"\n", backup);
 #endif
@@ -643,7 +643,7 @@
 	    }
 	}
 	fflush(fdout);
-#if defined(USGISH) || defined(_SEQUENT_)
+#if defined(USGISH) || defined(_SEQUENT_) || defined (__CYGWIN32__)
 	chmod(makefile, st.st_mode);
 #else
         fchmod(fileno(fdout), st.st_mode);
diff -urN -X xexclude xc.orig/lib/ICE/ICE-def.cpp xc/lib/ICE/ICE-def.cpp
--- xc.orig/lib/ICE/ICE-def.cpp	Tue May 07 21:17:35 1996
+++ xc/lib/ICE/ICE-def.cpp	Wed Feb 25 08:05:20 1998
@@ -27,6 +27,7 @@
  IceLastReceivedSequenceNumber
  IceLastSentSequenceNumber
  IceListenForConnections
+ IceListenForWellKnownConnections
  IceLockAuthFile
  IceOpenConnection
  IcePing
@@ -49,6 +50,7 @@
  IceUnlockAuthFile
  IceVendor
  IceWriteAuthFileEntry
+ _IceTransGetHostname
  _IceTransGetPeerAddr
  _IceTransGetPeerNetworkId
  _IceErrorBadMinor
diff -urN -X xexclude xc.orig/lib/X11/X11-def.cpp xc/lib/X11/X11-def.cpp
--- xc.orig/lib/X11/X11-def.cpp	Thu Dec 19 00:56:11 1996
+++ xc/lib/X11/X11-def.cpp	Wed Feb 25 08:05:21 1998
@@ -1,12 +1,18 @@
+#ifndef __CYGWIN32__
 LIBRARY X11
+#else
+LIBRARY libX11
+#endif
 VERSION LIBRARY_VERSION
 EXPORTS
+#ifndef __CYGWIN32__
  _Xdebug_p=_Xdebug CONSTANT
  _XCreateMutex_fn_p=_XCreateMutex_fn CONSTANT
  _XFreeMutex_fn_p=_XFreeMutex_fn CONSTANT
  _XLockMutex_fn_p=_XLockMutex_fn CONSTANT
  _XUnlockMutex_fn_p=_XUnlockMutex_fn CONSTANT
  _Xglobal_lock_p=_Xglobal_lock CONSTANT
+#endif
  XActivateScreenSaver
  XAddConnectionWatch
  XAddExtension
@@ -599,14 +605,18 @@
  _XDeqAsyncHandler
  _XEatData
  _XError
+#ifndef __CYGWIN32__
  _XFlushIt
+#endif
  _XFlushGCCache
  _XFreeTemp
  _XGetAsyncData
  _XGetAsyncReply
  _XIOError
  _XInitImageFuncPtrs
+#ifndef __CYGWIN32__
  _XLockDisplay
+#endif
  _XRead
  _XReadEvents
  _XReadPad
@@ -620,8 +630,10 @@
  _XUnregisterFilter
  _XUnregisterInternalConnection
  _XVIDtoVisual
+#ifndef __CYGWIN32__
  _Xthread_init
  _Xthread_waiter
+#endif
  XkbIgnoreExtension
  XkbOpenDisplay
  XkbQueryExtension
@@ -730,4 +742,23 @@
  XkbSetDeviceButtonActions
  XkbToControl
  XkbSetDebuggingFlags
+#ifdef __CYGWIN32__
+ _Xsetlocale
+ _XFlush
+ _Xlcmbtowc
+ _Xlcwctomb
+ _Xlcmbstowcs
+ _Xlcwcstombs
+ _Xmbtowc
+ _Xmblen
+ _Xwctomb
+ _Xmbstowcs
+ _Xwcstombs
+ _Xwcscpy
+ _Xwcsncpy
+ _Xwcslen
+ _Xwcscmp
+ _Xwcsncmp
+#endif
+
 /* $XConsortium: X11-def.cpp /main/14 1996/12/18 16:53:53 lehors $ */
diff -urN -X xexclude xc.orig/lib/Xaw/Xaw-def.cpp xc/lib/Xaw/Xaw-def.cpp
--- xc.orig/lib/Xaw/Xaw-def.cpp	Thu Jan 01 03:00:00 1970
+++ xc/lib/Xaw/Xaw-def.cpp	Wed Feb 25 08:05:21 1998
@@ -0,0 +1,111 @@
+LIBRARY libXaw
+VERSION LIBRARY_VERSION
+EXPORTS
+XawAsciiSave
+XawAsciiSaveAsFile
+XawAsciiSourceChanged
+XawAsciiSourceFreeString
+XawDialogAddButton
+XawDialogGetValueString
+XawFormDoLayout
+XawListChange
+XawListHighlight
+XawListShowCurrent
+XawListUnhighlight
+_XawMultiSave
+_XawMultiSaveAsFile
+_XawMultiSourceFreeString
+_XawMultiSinkPosToXY
+XawPanedAllowResize
+XawPanedGetMinMax
+XawPanedGetNumSub
+XawPanedSetMinMax
+XawPanedSetRefigureMode
+XawScrollbarSetThumb
+XawSimpleMenuAddGlobalActions
+XawSimpleMenuClearActiveEntry
+XawSimpleMenuGetActiveEntry
+XawTextDisableRedisplay
+XawTextDisplay
+XawTextDisplayCaret
+XawTextEnableRedisplay
+XawTextGetInsertionPoint
+XawTextGetSelectionPos
+XawTextGetSource
+XawTextInvalidate
+XawTextReplace
+XawTextSearch
+XawTextSetInsertionPoint
+XawTextSetSelection
+XawTextSetSelectionArray
+XawTextSetSource
+XawTextTopPosition
+XawTextUnsetSelection
+_XawTextAlterSelection
+_XawTextBuildLineTable
+_XawTextCheckResize
+_XawTextClearAndCenterDisplay
+_XawTextExecuteUpdate
+_XawTextGetSTRING
+_XawTextGetText
+_XawTextNeedsUpdating
+_XawTextPosToXY
+_XawTextPrepareToUpdate
+_XawTextReplace
+_XawTextSaltAwaySelection
+_XawTextSelectionList
+_XawTextSetScrollBars
+_XawTextSetSelection
+_XawTextShowPosition
+_XawTextVScroll
+XawTextSinkClearToBackground
+XawTextSinkDisplayText
+XawTextSinkFindDistance
+XawTextSinkFindPosition
+XawTextSinkGetCursorBounds
+XawTextSinkInsertCursor
+XawTextSinkMaxHeight
+XawTextSinkMaxLines
+XawTextSinkResolve
+XawTextSinkSetTabs
+XawTextSourceConvertSelection
+XawTextSourceRead
+XawTextSourceReplace
+XawTextSourceScan
+XawTextSourceSearch
+XawTextSourceSetSelection
+_XawTextFormat
+_XawTextMBToWC
+_XawTextWCToMB
+_XawTextZapSelection
+_XawTextDoReplaceAction
+_XawTextDoSearchAction
+_XawTextInsertFile
+_XawTextInsertFileAction
+_XawTextPopdownSearchAction
+_XawTextSearch
+_XawTextSetField
+XawToggleChangeRadioGroup
+XawToggleGetCurrent
+XawToggleSetCurrent
+XawToggleUnsetCurrent
+XawTreeForceLayout
+XawVendorShellExtResize
+XawViewportSetCoordinates
+XawViewportSetLocation
+_XawImCallVendorShellExtResize
+_XawImDestroy
+_XawImGetImAreaHeight
+_XawImGetShellHeight
+_XawImInitialize
+_XawImRealize
+_XawImReconnect
+_XawImRegister
+_XawImResizeVendorShell
+_XawImSetFocusValues
+_XawImSetValues
+_XawImUnregister
+_XawImUnsetFocus
+_XawImWcLookupString
+_Xaw_atowc
+XawInitializeWidgetSet
diff -urN -X xexclude xc.orig/lib/Xext/Xext-def.cpp xc/lib/Xext/Xext-def.cpp
--- xc.orig/lib/Xext/Xext-def.cpp	Sun Dec 21 22:33:45 1997
+++ xc/lib/Xext/Xext-def.cpp	Wed Feb 25 08:05:21 1998
@@ -89,6 +89,8 @@
  XSecurityFreeXauth
  XSecurityGenerateAuthorization
  XSecurityRevokeAuthorization
+ XLbxQueryExtension
+ XLbxQueryVersion
  XagQueryVersion
  XagCreateAssociation
  XagCreateEmbeddedApplicationGroup
diff -urN -X xexclude xc.orig/lib/Xmu/Xmu-def.cpp xc/lib/Xmu/Xmu-def.cpp
--- xc.orig/lib/Xmu/Xmu-def.cpp	Thu Jan 01 03:00:00 1970
+++ xc/lib/Xmu/Xmu-def.cpp	Wed Feb 25 08:05:21 1998
@@ -0,0 +1,98 @@
+LIBRARY libXmu
+VERSION LIBRARY_VERSION
+EXPORTS
+XmuAllStandardColormaps
+XmuGetAtomName
+XmuInternAtom
+XmuInternStrings
+XmuMakeAtom
+XmuNameOfAtom
+XmuClientWindow
+XmuAddCloseDisplayHook
+XmuLookupCloseDisplayHook
+XmuRemoveCloseDisplayHook
+XmuGetColormapAllocation
+XmuCreateColormap
+XmuCreatePixmapFromBitmap
+XmuCursorNameToIndex
+_XmuCCLookupDisplay
+XmuConvertStandardSelection
+XmuPrintDefaultErrorMessage
+XmuSimpleErrorHandler
+XmuDeleteStandardColormap
+XmuDQAddDisplay
+XmuDQCreate
+XmuDQDestroy
+XmuDQLookupDisplay
+XmuDQRemoveDisplay
+XmuDistinguishableColors
+XmuDistinguishablePixels
+XmuDrawLogo
+XmuDrawRoundedRectangle
+XmuFillRoundedRectangle
+_XEditResCheckMessages
+_XEditResGet16
+_XEditResGet32
+_XEditResGet8
+_XEditResGetSigned16
+_XEditResGetString8
+_XEditResGetWidgetInfo
+_XEditResPut16
+_XEditResPut32
+_XEditResPut8
+_XEditResPutString8
+_XEditResPutWidgetInfo
+_XEditResResetStream
+XmuRegisterExternalAgent
+XmuCvtFunctionToCallback
+XmuGetHostname
+XmuCreateStippledPixmap
+XmuReleaseStippledPixmap
+XmuAddInitializer
+XmuCallInitializers
+XmuLocateBitmapFile
+XmuLocatePixmapFile
+_XmuStringToBitmapFreeCache
+_XmuStringToBitmapInitCache
+XmuLookupAPL
+XmuLookupArabic
+XmuLookupCyrillic
+XmuLookupGreek
+XmuLookupHebrew
+XmuLookupJISX0201
+XmuLookupKana
+XmuLookupLatin1
+XmuLookupLatin2
+XmuLookupLatin3
+XmuLookupLatin4
+XmuLookupString
+XmuLookupStandardColormap
+XmuCompareISOLatin1
+XmuCopyISOLatin1Lowered
+XmuCopyISOLatin1Uppered
+XmuReadBitmapData
+XmuReadBitmapDataFromFile
+XmuScreenOfWindow
+XmuReshapeWidget
+XmuStandardColormap
+XmuCvtStringToBackingStore
+XmuCvtStringToBitmap
+XmuCvtStringToColorCursor
+XmuCvtStringToCursor
+XmuCvtStringToGravity
+XmuCvtStringToJustify
+XmuCvtStringToLong
+XmuCvtStringToOrientation
+XmuCvtStringToShapeStyle
+XmuCvtStringToWidget
+XmuNewCvtStringToWidget
+XmuUpdateMapHints
+XmuVisualStandardColormaps
+XmuWnCountOwnedResources
+XmuWnFetchResources
+XmuWnInitializeNodes
+XmuWnNameToNode
+XctCreate
+XctFree
+XctNextItem
+XctReset
diff -urN -X xexclude xc.orig/lib/Xt/Xt-def.cpp xc/lib/Xt/Xt-def.cpp
--- xc.orig/lib/Xt/Xt-def.cpp	Thu Jan 01 03:00:00 1970
+++ xc/lib/Xt/Xt-def.cpp	Wed Feb 25 08:05:21 1998
@@ -0,0 +1,470 @@
+LIBRARY libXt
+VERSION LIBRARY_VERSION
+EXPORTS
+XtAppAddActionHook
+XtRemoveActionHook
+XtCalloc
+XtFree
+XtMalloc
+XtRealloc
+_XtAllocError
+_XtHeapAlloc
+_XtHeapFree
+_XtHeapInit
+XtMergeArgLists
+XtAddCallback
+XtAddCallbacks
+XtCallCallbackList
+XtCallCallbacks
+XtHasCallbacks
+XtRemoveAllCallbacks
+XtRemoveCallback
+XtRemoveCallbacks
+_XtAddCallback
+_XtAddCallbackOnce
+_XtCallConditionalCallbackList
+_XtCompileCallbackList
+_XtGetCallbackList
+_XtPeekCallback
+_XtRemoveAllCallbacks
+_XtRemoveCallback
+XtGetMultiClickTime
+XtSetMultiClickTime
+compositeClassRec
+compositeWidgetClass
+constraintClassRec
+constraintWidgetClass
+XtAddConverter
+XtAppAddConverter
+XtAppReleaseCacheRefs
+XtAppSetTypeConverter
+XtCallConverter
+XtCallbackReleaseCacheRef
+XtCallbackReleaseCacheRefList
+XtConvert
+XtConvertAndStore
+XtDirectConvert
+XtSetTypeConverter
+_XtCacheFlushTag
+_XtConvert
+_XtFreeConverterTable
+_XtSetDefaultConverterTable
+_XtTableAddConverter
+XtCvtColorToPixel
+XtCvtIntToBool
+XtCvtIntToBoolean
+XtCvtIntToColor
+XtCvtIntToFloat
+XtCvtIntToFont
+XtCvtIntToPixel
+XtCvtIntToPixmap
+XtCvtIntToShort
+XtCvtIntToUnsignedChar
+XtCvtStringToAtom
+XtCvtStringToBool
+XtCvtStringToBoolean
+XtCvtStringToCommandArgArray
+XtCvtStringToCursor
+XtCvtStringToDimension
+XtCvtStringToDirectoryString
+XtCvtStringToDisplay
+XtCvtStringToFile
+XtCvtStringToFloat
+XtCvtStringToFont
+XtCvtStringToFontSet
+XtCvtStringToFontStruct
+XtCvtStringToGravity
+XtCvtStringToInitialState
+XtCvtStringToInt
+XtCvtStringToPixel
+XtCvtStringToRestartStyle
+XtCvtStringToShort
+XtCvtStringToUnsignedChar
+XtCvtStringToVisual
+XtDisplayStringConversionWarning
+XtStringConversionWarning
+_XtAddDefaultConverters
+_XtConvertInitialize
+colorConvertArgs
+screenConvertArg
+_XtInheritTranslations
+coreWidgetClass
+widgetClass
+widgetClassRec
+XtAppCreateShell
+XtCreateApplicationShell
+XtCreateManagedWidget
+XtCreatePopupShell
+XtCreateWidget
+XtInitializeWidgetClass
+_XtAppCreateShell
+_XtCreateHookObj
+_XtCreatePopupShell
+_XtCreateWidget
+XtDestroyWidget
+_XtDoPhase2Destroy
+XtAppGetExitFlag
+XtAppSetExitFlag
+XtCloseDisplay
+XtCreateApplicationContext
+XtDatabase
+XtDestroyApplicationContext
+XtDisplayInitialize
+XtDisplayToApplicationContext
+XtGetApplicationNameAndClass
+XtGetDisplays
+XtOpenDisplay
+XtWidgetToApplicationContext
+_XtAppDestroyCount
+_XtAppInit
+_XtCloseDisplays
+_XtDefaultAppContext
+_XtDestroyAppContexts
+_XtGetPerDisplay
+_XtGetPerDisplayInput
+_XtGetProcessContext
+_XtSortPerDisplayList
+_XtperDisplayList
+XtAppError
+XtAppErrorMsg
+XtAppGetErrorDatabase
+XtAppGetErrorDatabaseText
+XtAppSetErrorHandler
+XtAppSetErrorMsgHandler
+XtAppSetWarningHandler
+XtAppSetWarningMsgHandler
+XtAppWarning
+XtAppWarningMsg
+XtError
+XtErrorMsg
+XtGetErrorDatabase
+XtGetErrorDatabaseText
+XtSetErrorHandler
+XtSetErrorMsgHandler
+XtSetWarningHandler
+XtSetWarningMsgHandler
+XtWarning
+XtWarningMsg
+_XtDefaultError
+_XtDefaultErrorMsg
+_XtDefaultWarning
+_XtDefaultWarningMsg
+_XtSetDefaultErrorHandlers
+XtAddEventHandler
+XtAddExposureToRegion
+XtAddGrab
+XtAddRawEventHandler
+XtAppMainLoop
+XtBuildEventMask
+XtDispatchEvent
+XtDispatchEventToWidget
+XtInsertEventHandler
+XtInsertEventTypeHandler
+XtInsertRawEventHandler
+XtLastEventProcessed
+XtLastTimestampProcessed
+XtMainLoop
+XtRegisterDrawable
+XtRegisterExtensionSelector
+XtRemoveEventHandler
+XtRemoveEventTypeHandler
+XtRemoveGrab
+XtRemoveRawEventHandler
+XtSetEventDispatcher
+XtUnregisterDrawable
+XtWindowToWidget
+_XtAllocWWTable
+_XtConvertTypeToMask
+_XtEventInitialize
+_XtExtensionSelect
+_XtFreeEventTable
+_XtFreeWWTable
+_XtOnGrabList
+_XtSendFocusEvent
+_XtFillAncestorList
+_XtFindRemapWidget
+_XtFreePerWidgetInput
+_XtGetPerWidgetInput
+_XtUngrabBadGrabs
+XtIsApplicationShell
+XtIsComposite
+XtIsConstraint
+XtIsOverrideShell
+XtIsRectObj
+XtIsSessionShell
+XtIsShell
+XtIsTopLevelShell
+XtIsTransientShell
+XtIsVendorShell
+XtIsWMShell
+XtIsWidget
+XtMapWidget
+XtNewString
+XtUnmapWidget
+XtAllocateGC
+XtDestroyGC
+XtGetGC
+XtReleaseGC
+_XtGClistFree
+XtConfigureWidget
+XtMakeGeometryRequest
+XtMakeResizeRequest
+XtMoveWidget
+XtQueryGeometry
+XtResizeWidget
+XtResizeWindow
+XtTranslateCoords
+_XtMakeGeometryRequest
+XtGetActionKeysym
+XtGetConstraintResourceList
+XtGetResourceList
+XtGetSubvalues
+XtGetValues
+hookObjClassRec
+hookObjectClass
+XtAppAddBlockHook
+XtHooksOfDisplay
+XtRemoveBlockHook
+_XtAddShellToHookObj
+_XtIsHookObject
+XtAppInitialize
+XtAppSetFallbackResources
+XtInitialize
+XtOpenApplication
+XtScreenDatabase
+XtSetLanguageProc
+XtToolkitInitialize
+_XtDisplayInitialize
+_XtGetUserName
+_XtInherit
+_XtPreparseCommandLine
+XtCXtToolkitError
+XtCallAcceptFocus
+XtClass
+XtCreateWindow
+XtDisplay
+XtDisplayOfObject
+XtFindFile
+XtGetClassExtension
+XtIsManaged
+XtIsObject
+XtIsRealized
+XtIsSensitive
+XtIsSubclass
+XtName
+XtNameToWidget
+XtParent
+XtRealizeWidget
+XtResolvePathname
+XtScreen
+XtScreenOfObject
+XtSuperclass
+XtUnrealizeWidget
+XtWindow
+XtWindowOfObject
+_XtCheckSubclassFlag
+_XtIsSubclassOf
+_XtWindowedAncestor
+XtGetKeyboardFocusWidget
+XtSetKeyboardFocus
+_XtClearAncestorCache
+_XtHandleFocus
+_XtProcessKeyboardEvent
+XtChangeManagedSet
+XtManageChild
+XtManageChildren
+XtSetMappedWhenManaged
+XtUnmanageChild
+XtUnmanageChildren
+XtAddInput
+XtAddSignal
+XtAddTimeOut
+XtAddWorkProc
+XtAppAddInput
+XtAppAddSignal
+XtAppAddTimeOut
+XtAppAddWorkProc
+XtAppNextEvent
+XtAppPeekEvent
+XtAppPending
+XtAppProcessEvent
+XtNextEvent
+XtNoticeSignal
+XtPeekEvent
+XtPending
+XtProcessEvent
+XtRemoveInput
+XtRemoveSignal
+XtRemoveTimeOut
+XtRemoveWorkProc
+_XtRefreshMapping
+_XtRemoveAllInputs
+_XtWaitForSomething
+objectClass
+objectClassRec
+XtGrabButton
+XtGrabKey
+XtGrabKeyboard
+XtGrabPointer
+XtUngrabButton
+XtUngrabKey
+XtUngrabKeyboard
+XtUngrabPointer
+_XtCheckServerGrabsOnWidget
+_XtDestroyServerGrabs
+_XtProcessPointerEvent
+XtCallbackPopdown
+XtPopdown
+XtPopup
+XtPopupSpringLoaded
+_XtPopup
+XtCallbackExclusive
+XtCallbackNone
+XtCallbackNonexclusive
+rectObjClass
+rectObjClassRec
+XtGetApplicationResources
+XtGetSubresources
+_XtCompileResourceList
+_XtConstraintResDependencies
+_XtCopyFromArg
+_XtCopyFromParent
+_XtCopyToArg
+_XtCreateIndirectionTable
+_XtDependencies
+_XtGetResources
+_XtResourceDependencies
+_XtResourceListInitialize
+XtAppGetSelectionTimeout
+XtAppSetSelectionTimeout
+XtCancelSelectionRequest
+XtCreateSelectionRequest
+XtDisownSelection
+XtGetSelectionParameters
+XtGetSelectionRequest
+XtGetSelectionTimeout
+XtGetSelectionValue
+XtGetSelectionValueIncremental
+XtGetSelectionValues
+XtGetSelectionValuesIncremental
+XtOwnSelection
+XtOwnSelectionIncremental
+XtReleasePropertyAtom
+XtReservePropertyAtom
+XtSendSelectionRequest
+XtSetSelectionParameters
+XtSetSelectionTimeout
+_XtSetDefaultSelectionTimeout
+XtSetSensitive
+XtSetSubvalues
+XtSetValues
+XtSetWMColormapWindows
+XtSessionGetToken
+XtSessionReturnToken
+_XtShellGetCoordinates
+applicationShellClassRec
+applicationShellWidgetClass
+overrideShellClassRec
+overrideShellWidgetClass
+sessionShellClassRec
+sessionShellWidgetClass
+shellClassRec
+shellWidgetClass
+topLevelShellClassRec
+topLevelShellWidgetClass
+transientShellClassRec
+transientShellWidgetClass
+wmShellClassRec
+wmShellWidgetClass
+XtShellStrings
+XtStrings
+XtAddActions
+XtAppAddActions
+XtCallActionProc
+XtGetActionList
+XtMenuPopupAction
+_XtBindActions
+_XtDoFreeBindings
+_XtFreeActions
+_XtInitializeActionData
+_XtPopupInitialize
+_XtUnbindActions
+XtRegisterGrabAction
+_XtGrabInitialize
+_XtRegisterGrabs
+XtConvertCase
+XtGetKeysymTable
+XtKeysymToKeycodeList
+XtRegisterCaseConverter
+XtSetKeyTranslator
+XtTranslateKey
+XtTranslateKeycode
+_XtAllocTMContext
+_XtBuildKeysymTables
+_XtComputeLateBindings
+_XtMatchUsingDontCareMods
+_XtMatchUsingStandardMods
+XtCvtStringToAcceleratorTable
+XtCvtStringToTranslationTable
+XtParseAcceleratorTable
+XtParseTranslationTable
+_XtAddTMConverters
+_XtTranslateInitialize
+_XtDisplayAccelerators
+_XtDisplayInstalledAccelerators
+_XtDisplayTranslations
+_XtPrintActions
+_XtPrintEventSeq
+_XtPrintState
+_XtPrintXlations
+XtAugmentTranslations
+XtInstallAccelerators
+XtInstallAllAccelerators
+XtOverrideTranslations
+XtUninstallTranslations
+_XtAddEventSeqToStateTree
+_XtCreateXlations
+_XtCvtMergeTranslations
+_XtDestroyTMData
+_XtFreeTranslations
+_XtGetModifierIndex
+_XtGetQuarkIndex
+_XtGetTranslationValue
+_XtGetTypeIndex
+_XtInstallTranslations
+_XtMatchAtom
+_XtMergeTranslations
+_XtParseTreeToStateTree
+_XtRegularMatch
+_XtRemoveStateTreeByIndex
+_XtRemoveTranslations
+_XtTranslateEvent
+_XtTraverseStateTree
+_XtUnmergeTranslations
+XtAppLock
+XtAppUnlock
+XtProcessLock
+XtProcessUnlock
+XtToolkitThreadInitialize
+XtVaAppCreateShell
+XtVaAppInitialize
+XtVaCreateManagedWidget
+XtVaCreatePopupShell
+XtVaCreateWidget
+XtVaOpenApplication
+XtVaSetSubvalues
+XtVaSetValues
+_XtVaAppInitialize
+_XtVaOpenApplication
+XtVaGetApplicationResources
+XtVaGetSubresources
+XtVaGetSubvalues
+XtVaGetValues
+XtVaCreateArgsList
+_XtCountVaList
+_XtFreeArgList
+_XtVaCreateTypedArgList
+_XtVaToArgList
+_XtVaToTypedArgList
+vendorShellClassRec
+vendorShellWidgetClass
diff -urN -X xexclude xc.orig/lib/font/fontfile/filewr.c xc/lib/font/fontfile/filewr.c
--- xc.orig/lib/font/fontfile/filewr.c	Mon Apr 18 04:17:05 1994
+++ xc/lib/font/fontfile/filewr.c	Wed Feb 25 08:05:21 1998
@@ -40,7 +40,7 @@
 {
     int	fd;
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN32__)
     fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY, 0666);
 #else
     fd = creat (name, 0666);
diff -urN -X xexclude xc.orig/lib/zlib/zconf.h xc/lib/zlib/zconf.h
--- xc.orig/lib/zlib/zconf.h	Sun Dec 21 22:34:02 1997
+++ xc/lib/zlib/zconf.h	Wed Feb 25 08:05:22 1998
@@ -48,7 +48,7 @@
 #  define voidp		z_voidp
 #endif
 
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__CYGWIN32__)
 #  define WIN32
 #endif
 #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
diff -urN -X xexclude xc.orig/programs/Xserver/Xprint/attributes.c xc/programs/Xserver/Xprint/attributes.c
--- xc.orig/programs/Xserver/Xprint/attributes.c	Sun Dec 21 22:33:11 1997
+++ xc/programs/Xserver/Xprint/attributes.c	Wed Feb 25 08:05:22 1998
@@ -1233,7 +1233,7 @@
     return command;
 }
 
-#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL))
+#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL)) || defined(__CYGWIN32__)
 #define iswspace(c) (isascii(c) && isspace(toascii(c)))
 #endif
 
diff -urN -X xexclude xc.orig/programs/Xserver/include/servermd.h xc/programs/Xserver/include/servermd.h
--- xc.orig/programs/Xserver/include/servermd.h	Mon Dec 02 18:25:11 1996
+++ xc/programs/Xserver/include/servermd.h	Wed Feb 25 08:05:22 1998
@@ -317,7 +317,7 @@
      defined(linux) || \
      (defined(AMOEBA) && defined(i80386)) || \
      defined(MINIX) || \
-     defined(WIN32))
+     defined(WIN32)) || defined(__CYGWIN32__)
 
 #ifndef IMAGE_BYTE_ORDER
 #define IMAGE_BYTE_ORDER	LSBFirst
diff -urN -X xexclude xc.orig/programs/Xserver/os/connection.c xc/programs/Xserver/os/connection.c
--- xc.orig/programs/Xserver/os/connection.c	Sun Dec 21 22:34:07 1997
+++ xc/programs/Xserver/os/connection.c	Wed Feb 25 08:05:22 1998
@@ -91,7 +91,7 @@
 
 #if defined(TCPCONN) || defined(STREAMSCONN)
 # include <netinet/in.h>
-# ifndef hpux
+# if !defined(hpux) && !defined(__CYGWIN32__)
 #  ifdef apollo
 #   ifndef NO_TCP_H
 #    include <netinet/tcp.h>
diff -urN -X xexclude xc.orig/programs/Xserver/os/osinit.c xc/programs/Xserver/os/osinit.c
--- xc.orig/programs/Xserver/os/osinit.c	Mon Dec 02 18:26:15 1996
+++ xc/programs/Xserver/os/osinit.c	Wed Feb 25 08:05:22 1998
@@ -113,7 +113,7 @@
 		dup2 (fileno (err), 2);
 		fclose (err);
 	    }
-#if defined(SYSV) || defined(SVR4) || defined(WIN32)
+#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN32__)
 	    {
 	    static char buf[BUFSIZ];
 	    setvbuf (stderr, buf, _IOLBF, BUFSIZ);
diff -urN -X xexclude xc.orig/programs/lbxproxy/os/connection.c xc/programs/lbxproxy/os/connection.c
--- xc.orig/programs/lbxproxy/os/connection.c	Sun Dec 21 22:33:21 1997
+++ xc/programs/lbxproxy/os/connection.c	Wed Feb 25 08:05:22 1998
@@ -113,7 +113,7 @@
 
 #ifdef TCPCONN
 # include <netinet/in.h>
-# ifndef hpux
+# if !defined(hpux) && !defined(__CYGWIN32__)
 #  ifdef apollo
 #   ifndef NO_TCP_H
 #    include <netinet/tcp.h>
diff -urN -X xexclude xc.orig/programs/xdm/choose.c xc/programs/xdm/choose.c
--- xc.orig/programs/xdm/choose.c	Sat Jun 04 00:34:38 1994
+++ xc/programs/xdm/choose.c	Wed Feb 25 08:05:22 1998
@@ -41,7 +41,9 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifndef __CYGWIN32__
 #include <sys/un.h>
+#endif
 #include <ctype.h>
 #if defined(STREAMSCONN)
 # include       <tiuser.h>
diff -urN -X xexclude xc.orig/programs/xdm/daemon.c xc/programs/xdm/daemon.c
--- xc.orig/programs/xdm/daemon.c	Fri Dec 02 01:10:49 1994
+++ xc/programs/xdm/daemon.c	Wed Feb 25 08:05:22 1998
@@ -122,7 +122,7 @@
     close (1);
     close (2);
 
-#if !((defined(SYSV) || defined(SVR4)) && defined(i386))
+#if !((defined(SYSV) || defined(SVR4)) && defined(i386)) && !defined(__CYGWIN32__)
     if ((i = open ("/dev/tty", O_RDWR)) >= 0) {	/* did open succeed? */
 #if defined(USG) && defined(TCCLRCTTY)
 	int zero = 0;
diff -urN -X xexclude xc.orig/programs/xdm/socket.c xc/programs/xdm/socket.c
--- xc.orig/programs/xdm/socket.c	Mon Apr 18 04:03:47 1994
+++ xc/programs/xdm/socket.c	Wed Feb 25 08:05:22 1998
@@ -44,7 +44,9 @@
 #include <errno.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifndef __CYGWIN32__
 #include <sys/un.h>
+#endif
 #include <netdb.h>
 
 #ifdef X_NOT_STDC_ENV
diff -urN -X xexclude xc.orig/programs/xdm/util.c xc/programs/xdm/util.c
--- xc.orig/programs/xdm/util.c	Tue Nov 22 02:33:11 1994
+++ xc/programs/xdm/util.c	Wed Feb 25 08:05:23 1998
@@ -218,7 +218,7 @@
 
 CleanUpChild ()
 {
-#if defined(SYSV) || defined(SVR4)
+#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN32__)
 	setpgrp ();
 #else
 	setpgrp (0, getpid ());
diff -urN -X xexclude xc.orig/programs/xdm/xdmcp.c xc/programs/xdm/xdmcp.c
--- xc.orig/programs/xdm/xdmcp.c	Sun Dec 21 22:34:10 1997
+++ xc/programs/xdm/xdmcp.c	Wed Feb 25 08:05:23 1998
@@ -47,7 +47,9 @@
 
 #include	<sys/socket.h>
 #include	<netinet/in.h>
+#ifndef __CYGWIN32__
 #include	<sys/un.h>
+#endif
 #include	<netdb.h>
 
 #ifdef X_NOT_STDC_ENV
@@ -535,7 +537,7 @@
 		}
 		break;
 #endif
-#ifdef AF_UNIX
+#if defined(AF_UNIX) && !defined(__CYGWIN32__)
 	    case AF_UNIX:
 		{
 		    struct sockaddr_un	un_addr;
diff -urN -X xexclude xc.orig/programs/xhost/xhost.c xc/programs/xhost/xhost.c
--- xc.orig/programs/xhost/xhost.c	Tue Apr 04 04:56:49 1995
+++ xc/programs/xhost/xhost.c	Wed Feb 25 08:05:23 1998
@@ -657,3 +657,12 @@
     XmuPrintDefaultErrorMessage (dpy, rep, stderr);
     return 0;
 }
+
+#ifdef __CYGWIN32__
+void sethostent(int x)
+{}
+
+void endhostent()
+{}
+#endif
+
diff -urN -X xexclude xc.orig/programs/xterm/Imakefile xc/programs/xterm/Imakefile
--- xc.orig/programs/xterm/Imakefile	Fri Feb 02 22:29:18 1996
+++ xc/programs/xterm/Imakefile	Wed Feb 25 08:05:23 1998
@@ -39,10 +39,9 @@
           OBJS2 = resize.o
            SRCS = $(SRCS1) $(SRCS2)
            OBJS = $(OBJS1) $(OBJS2)
-       PROGRAMS = resize xterm
        DEPLIBS1 = XkbClientDepLibs XawClientDepLibs
        DEPLIBS2 = 
-       PROGRAMS = xterm resize
+       PROGRAMS = ProgramTargetName(xterm) ProgramTargetName(resize)
 
 #ifndef TermcapLibrary
 #if SystemV && !defined(MacIIArchitecture)
@@ -83,7 +82,7 @@
 #endif
 #endif
 #endif
-install:: xterm
+install:: ProgramTargetName(xterm)
 	MakeDir($(DESTDIR)$(BINDIR))
 	RemoveFile(xterm.inst)
 	LinkRule(xterm.inst,$(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS),$(OBJS1),$(LDOVERRIDE) XawClientLibs $(LDRESUME) $(LDLIBS) $(TERMCAPLIB) $(PTYLIB))
diff -urN -X xexclude xc.orig/programs/xterm/main.c xc/programs/xterm/main.c
--- xc.orig/programs/xterm/main.c	Fri Nov 29 18:33:41 1996
+++ xc/programs/xterm/main.c	Wed Feb 25 08:05:23 1998
@@ -134,6 +134,14 @@
 #define WTMP
 #endif
 
+#ifdef __CYGWIN32__
+#define SYSV
+#define SVR4
+#define LASTLOG
+#define WTMP
+#define ATT
+#endif
+
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 
@@ -256,7 +264,7 @@
 #define ttyslot() 1
 #endif /* apollo */
 
-#ifdef SVR4
+#if defined(SVR4) && !defined(__CYGWIN32__)
 #include <utmpx.h>
 #define setutent setutxent
 #define getutent getutxent
@@ -979,7 +987,9 @@
     	d_tio.c_cc[VEOF] = CEOF;
 	d_tio.c_cc[VEOL] = CNUL;
 	d_tio.c_cc[VEOL2] = CNUL;
+#ifdef VSWTCH
 	d_tio.c_cc[VSWTCH] = CNUL;
+#endif
 
 #ifdef USE_TERMIOS /* { */
 	d_tio.c_cc[VSUSP] = CSUSP;
@@ -1833,7 +1843,7 @@
 #endif	/* sun */
 	struct passwd *pw = NULL;
 #ifdef UTMP
-#ifdef SVR4
+#if defined(SVR4) && !defined(__CYGWIN32__)
 	struct utmpx utmp;
 #else
 	struct utmp utmp;
@@ -2999,7 +3009,7 @@
 	/* hung sh problem? */
 	signal (SIGHUP, SIG_DFL);
 #else
-	signal (SIGHUP,SIG_IGN);
+	signal (SIGHUP, SIG_IGN);
 #endif
 
 /*
@@ -3359,6 +3369,16 @@
     static long arg;
     ioctl (fd, FIONREAD, (char *) &arg);
     return (int) arg;
+#elif defined(__CYGWIN32__)
+    fd_set set;
+    struct timeval timeout = {0, 0};
+
+    FD_ZERO (&set);
+    FD_SET (fd, &set);
+    if (select (fd+1, &set, NULL, NULL, &timeout) > 0)
+      return 1;
+    else
+      return 0;
 #else
     struct pollfd pollfds[1];
 
diff -urN -X xexclude xc.orig/programs/xterm/resize.c xc/programs/xterm/resize.c
--- xc.orig/programs/xterm/resize.c	Thu May 25 06:12:04 1995
+++ xc/programs/xterm/resize.c	Wed Feb 25 08:05:23 1998
@@ -59,7 +59,7 @@
 #undef SYSV				/* pretend to be bsd */
 #endif /* macII */
 
-#if defined(SYSV) || defined(linux)
+#if defined(SYSV) || defined(linux) || defined(__CYGWIN32__)
 #define USE_SYSV_TERMIO
 #define USE_SYSV_UTMP
 #else /* else not SYSV */
