diff -ru gcl-2.6.10.orig/configure gcl-2.6.10/configure
--- gcl-2.6.10.orig/configure	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/configure	2013-11-23 15:47:39.000000000 +0900
@@ -6348,6 +6348,9 @@
 
 	    #include <stdio.h>
             #include <unistd.h>
+#ifdef __CYGWIN__
+#define getpagesize() 4096
+#endif
 
 int
 main ()
diff -ru gcl-2.6.10.orig/h/gnuwin95.defs gcl-2.6.10/h/gnuwin95.defs
--- gcl-2.6.10.orig/h/gnuwin95.defs	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/h/gnuwin95.defs	2013-11-30 16:16:49.862350000 +0900
@@ -8,24 +8,27 @@
 
 LBINDIR=/usr/local/bin
 
-OFLAG	=  -O 
+#OFLAG	=  -O 
 #LIBS	= -lm 
-LIBC 	=
+#LIBC 	=
 
-ODIR_DEBUG= -O4
-ODIR_DEBUG= 
+#ODIR_DEBUG= -O4
+#ODIR_DEBUG= 
 
 # This CC string will be used for compilation of the system,
 # and also in the compiler::*cc* variable for later compilation of
 # lisp files.
-CC = gcc  -fwritable-strings  -DVOL=volatile  -I$(GCLDIR)/o -fsigned-char
-AS= as	
-AR= ar q
-RANLIB= ranlib
+#CC = gcc  -fwritable-strings  -DVOL=volatile  -I$(GCLDIR)/o -fsigned-char
+#AS= as	
+#AR= ar q
+#RANLIB= ranlib
 
 
 LDCC=${CC}
 
+# Unexec dependency
+UNIX_SAVE_DEP = unexnt.c
+
 # Enable the fastloading mechanism which does not use ld -A
 # requires c/rel_.. machine dependent code.
 
@@ -34,8 +37,8 @@
 
 
 
-MPFILES= $(MPDIR)/mpi-386-winnt.o   $(MPDIR)/libmport.a
-MPFILES= $(MPDIR)/mpi.o   $(MPDIR)/libmport.a
+#MPFILES= $(MPDIR)/mpi-386-winnt.o   $(MPDIR)/libmport.a
+#MPFILES= $(MPDIR)/mpi.o   $(MPDIR)/libmport.a
 FIRST_FILE=$(ODIR)/firstfile.o
 LAST_FILE=$(ODIR)/lastfile.o
 
@@ -55,4 +58,4 @@
 KCP=kcp-bsd
 
 # using gcc so dont need
-GNULIB1=
+#GNULIB1=
diff -ru gcl-2.6.10.orig/h/gnuwin95.h gcl-2.6.10/h/gnuwin95.h
--- gcl-2.6.10.orig/h/gnuwin95.h	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/h/gnuwin95.h	2013-11-30 11:30:09.000000000 +0900
@@ -3,9 +3,9 @@
 /* #include "386.h" */
 /* #include "fcntl.h" */
 
-#undef DBEGIN
-/* we want finer than config.h */
-#define DBEGIN 0x1a000000
+#define DBEGIN _dbegin
+#define DBEGIN_TY unsigned long
+extern DBEGIN_TY _dbegin;
 
 
 
@@ -20,7 +20,7 @@
 /* #define BABY_MALLOC_SIZE 0x5000 */
 
 /* #define RECREATE_HEAP if (initflag) recreate_heap(argv[0]); */
-#define RECREATE_HEAP if (initflag) recreate_heap1();
+/* #define RECREATE_HEAP if (initflag) recreate_heap1(); */
 
 #ifdef IN_UNIXTIME
 #undef ATT
@@ -35,12 +35,6 @@
 #define BSD
 #endif
 
-#define NEED_TO_REINSTALL_SIGNALS 
-
-#ifndef SIGIO
-#define SIGIO 23
-#endif
-
 /* on most machines this will test in one instruction
    if the pointe/r is on the C stack or the 0 pointer
    in winnt our heap starts at DBEGIN
@@ -48,7 +42,7 @@
 /*  #define NULL_OR_ON_C_STACK(y)\ */
 /*      (((unsigned int)(y)) == 0 ||  \ */
 /*       (((unsigned int)(y)) < DBEGIN && ((unsigned int)(y)) &0xf000000)) */
-#define NULL_OR_ON_C_STACK(y) (((void *)(y)) < ((void *)0x400000))
+/* #define NULL_OR_ON_C_STACK(y) (((void *)(y)) < ((void *)0x400000)) */
      
       
 
@@ -58,16 +52,15 @@
 #define HAVE_SIGACTION
 /* a noop */
 #define SETUP_SIG_STACK
-#define SV_ONSTACK 0
-#if 0  /* Different definition in <sys/signal.h> - 2001-12-18 */
-#define SA_RESTART 0
-#endif
+#define SA_ONSTACK 0
 
 #define brk(x) printf("not doing break\n");
 #include <stdarg.h>     
 #include <stdio.h>
 #define UNIXSAVE "unexnt.c"
 
+#define MAXPATHLEN 260
+#define SEPARATE_SFASL_FILE "sfaslcoff.c"
 #define SPECIAL_RSYM "rsym_nt.c"
 
 #define HAVE_AOUT "wincoff.h"
@@ -92,6 +85,7 @@
 		
 #define FCLOSE_SETBUF_OK 
 
+#define RUN_PROCESS
 
 #define	IEEEFLOAT
   
@@ -99,10 +93,6 @@
 
 #define ADDITIONAL_FEATURES \
 		     ADD_FEATURE("I386"); ADD_FEATURE("WINNT")
-  
-#undef SET_REAL_MAXPAGE  
-#define SET_REAL_MAXPAGE \
-	real_maxpage=MAXPAGE;
 
 
 /* include some low level routines for maxima */
@@ -110,8 +100,12 @@
 
 #define RELOC_FILE "rel_coff.c"
 
-/*  FIONREAD not supported */
 #undef  LISTEN_FOR_INPUT
+#define LISTEN_FOR_INPUT(fp) do { \
+  int c = 0; \
+  if (((fp)->_r <= 0) && (ioctl((fp)->_file, FIONREAD, &c), c<=0)) \
+    return 0; \
+} while (0)
 
 /* adjust the start to the offset */
 #define ADJUST_RELOC_START(j) \
@@ -133,11 +127,22 @@
         error("Someone allocated my memory!");} \
 	if (core_end != (sbrk(PAGESIZE*(n - m))))
 
-  /* allow things like //c at beginning of pathnames, and c:/ */
-#define ALLOW_DRIVE_PATH
-
-
-#define USE_INTERNAL_REAL_TIME_FOR_RUNTIME     
+#include <limits.h>
+#include <sys/stat.h>
+#define GET_FULL_PATH_SELF(a_) do {\
+  char b[20];\
+  static char q[PATH_MAX];\
+  struct stat ss;\
+  if (snprintf(b,sizeof(b),"/proc/%d/exe",getpid())<=0)\
+    error("Cannot write proc exe pathname");\
+  if (stat(b,&ss)) \
+    (a_)=argv[0];\
+  else {\
+    if (!realpath(b,q)) \
+      error("realpath error");\
+    (a_)=q;\
+  }\
+} while(0)
 
 /* Begin for cmpinclude */
 
diff -ru gcl-2.6.10.orig/o/alloc.c gcl-2.6.10/o/alloc.c
--- gcl-2.6.10.orig/o/alloc.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/alloc.c	2013-11-30 11:33:27.000000000 +0900
@@ -74,6 +74,10 @@
 #endif
 #endif
 
+#ifdef __CYGWIN__
+void recreate_heap1(void);
+#endif
+
 inline void
 add_page_to_contblock_list(void *p,fixnum m) {
  
@@ -1588,6 +1592,9 @@
     return baby_malloc(size);
 #else	
 
+#ifdef __CYGWIN__
+    recreate_heap1();
+#endif
     if (!initflag)
       gcl_init_alloc();
 #ifdef RECREATE_HEAP
diff -ru gcl-2.6.10.orig/o/file.d gcl-2.6.10/o/file.d
--- gcl-2.6.10.orig/o/file.d	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/file.d	2013-11-23 15:26:29.000000000 +0900
@@ -1251,7 +1251,7 @@
 
 #ifdef HAVE_READLINE
 	  if (readline_on && strm->sm.sm_fp==rl_instream)
-	    return *rl_line_buffer ? TRUE : FALSE;
+	    if (rl_line_buffer && !(*rl_line_buffer)) return FALSE;
 #endif
 		if (strm->sm.sm_fp == NULL)
 			closed_stream(strm);
diff -ru gcl-2.6.10.orig/o/firstfile.c gcl-2.6.10/o/firstfile.c
--- gcl-2.6.10.orig/o/firstfile.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/firstfile.c	2013-11-23 15:27:13.000000000 +0900
@@ -21,7 +21,6 @@
 
 #include "config.h"
 
-#ifdef _WIN32
 /* See comments in lastfile.c.  */
 char my_begdata[] = "Beginning of Emacs initialized data";
 char my_begbss[1];  /* Do not initialize this variable.  */
@@ -33,4 +32,3 @@
 extern int initialized;
 static int * dummy = &initialized;
 #endif
-#endif
diff -ru gcl-2.6.10.orig/o/gbc.c gcl-2.6.10/o/gbc.c
--- gcl-2.6.10.orig/o/gbc.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/gbc.c	2013-11-30 12:17:54.000000000 +0900
@@ -1231,7 +1231,11 @@
     (*GBC_enter_hook)();
   
   if (!GBC_enable)
+#ifdef __CYGWIN__
+    return;
+#else
     error("GBC is not enabled");
+#endif
   interrupt_enable = FALSE;
   
   if (saving_system)
diff -ru gcl-2.6.10.orig/o/lastfile.c gcl-2.6.10/o/lastfile.c
--- gcl-2.6.10.orig/o/lastfile.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/lastfile.c	2013-11-23 15:30:14.000000000 +0900
@@ -40,7 +40,6 @@
 
 char my_edata[] = "End of Emacs initialized data";
 
-#ifdef _WIN32
 /* Help unexec locate the end of the .bss area used by Emacs (which
    isn't always a separate section in NT executables).  */
 char my_endbss[1];
@@ -49,4 +48,3 @@
    of the bss area used by Emacs.  */
 static char _my_endbss[1];
 char * my_endbss_static = _my_endbss;
-#endif
diff -ru gcl-2.6.10.orig/o/main.c gcl-2.6.10/o/main.c
--- gcl-2.6.10.orig/o/main.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/main.c	2013-11-24 20:50:13.000000000 +0900
@@ -96,6 +96,9 @@
 #ifdef _WIN32
 unsigned int _dbegin = 0x10100000;
 #endif
+#ifdef __CYGWIN__
+unsigned long _dbegin = 0;
+#endif
 
 int cssize;
 
@@ -605,6 +608,8 @@
 initlisp(void) {
 
         void *v=&v;
+	
+	gcl_init_alloc();
 
 	if (NULL_OR_ON_C_STACK(v) == 0
 #if defined(IM_FIX_BASE)
@@ -630,8 +635,6 @@
 	  error("NULL_OR_ON_C_STACK macro invalid");
 	}
 	
-	gcl_init_alloc();
-	
 	Cnil->fw=0;
 	set_type_of(Cnil,t_symbol);
  	Cnil->c.c_cdr=Cnil;
diff -ru gcl-2.6.10.orig/o/ntheap.h gcl-2.6.10/o/ntheap.h
--- gcl-2.6.10.orig/o/ntheap.h	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/ntheap.h	2013-11-23 15:32:12.000000000 +0900
@@ -60,7 +60,7 @@
 extern int os_subtype;
 
 /* Emulation of Unix sbrk().  */
-extern void *sbrk (unsigned long size);
+extern void *sbrk (ptrdiff_t size);
 
 /* Recreate the heap created during dumping.  */
 extern void recreate_heap (char *executable_path);
diff -ru gcl-2.6.10.orig/o/pathname.d gcl-2.6.10/o/pathname.d
--- gcl-2.6.10.orig/o/pathname.d	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/pathname.d	2013-11-23 15:34:09.000000000 +0900
@@ -25,6 +25,7 @@
 	This file contains those functions that interpret namestrings.
 */
 
+#include <string.h>
 #include "include.h"
 
 
@@ -400,7 +401,7 @@
 #ifdef FIX_FILENAME
         {char buf[MAXPATHLEN];
          if (i > MAXPATHLEN-1) i =MAXPATHLEN-1;
-         bcopy(token->st.st_self,buf,i);
+         memcpy(buf,token->st.st_self,i);
          buf[i]=0;
          FIX_FILENAME(x,buf);
          return (make_simple_string(buf));
diff -ru gcl-2.6.10.orig/o/run_process.c gcl-2.6.10/o/run_process.c
--- gcl-2.6.10.orig/o/run_process.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/run_process.c	2013-11-23 15:35:36.000000000 +0900
@@ -386,7 +386,11 @@
 		FEerror("Connection Failed.",0);
 	}
 	pid = getpid();
+#ifdef __CYGWIN__
+	if(fcntl(sock, F_SETOWN, pid) < 0)
+#else
 	if(ioctl(sock, SIOCSPGRP, (char *)&pid) < 0 )
+#endif
 	{
 		FEerror("Could not set process group of socket.",0);
 	}
diff -ru gcl-2.6.10.orig/o/unexnt.c gcl-2.6.10/o/unexnt.c
--- gcl-2.6.10.orig/o/unexnt.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/unexnt.c	2013-11-30 16:33:32.547700300 +0900
@@ -970,11 +970,16 @@
      the region below the 256MB line for our malloc arena - 229MB is
      still a pretty decent arena to play in!  */
 
+#ifdef __CYGWIN__
+  void *base = 0, *ptr;
+  reserved_heap_size = 512*1024*1024;
+#else
   void *base = (void *)0x20000000,*ptr;/*FIXME, someday figure out how to let the heap start address default *//*(void *)0x10100000*/
 
   reserved_heap_size=probe_heap_size(base,PAGESIZE,(1UL<<31),-1);
+#endif
   ptr = VirtualAlloc ((void *) base,get_reserved_heap_size (),MEM_RESERVE,PAGE_NOACCESS);
-  printf("probe results: %lu at %p\n",reserved_heap_size,ptr);
+  /* printf("probe results: %lu at %p\n",reserved_heap_size,ptr); */
 
   DBEGIN = (DBEGIN_TY) ptr;
 
@@ -983,7 +988,7 @@
 
 /* Emulate Unix sbrk.  */
 void *
-sbrk (unsigned long increment)
+sbrk (ptrdiff_t increment)
 {
   void *result;
   long size = (long) increment;
@@ -1061,6 +1066,11 @@
   return result;
 }
 
+#ifdef __CYGWIN__
+/* Emulate Unix getpagesize.  */
+int getpagesize (void) { return 4096; }
+#endif
+
 /* Recreate the heap from the data that was dumped to the executable.
    EXECUTABLE_PATH tells us where to find the executable.  */
 void
@@ -1083,6 +1093,9 @@
      any funny interactions between file I/O and file mapping.  */
 
   read_in_bss (executable_path);
+#ifdef __CYGWIN__
+  cs_org = 0;
+#endif
 
   map_in_heap (executable_path);
 
diff -ru gcl-2.6.10.orig/o/unixtime.c gcl-2.6.10/o/unixtime.c
--- gcl-2.6.10.orig/o/unixtime.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/unixtime.c	2013-11-23 15:44:26.000000000 +0900
@@ -275,6 +275,12 @@
   
 #elif defined NO_SYSTEM_TIME_ZONE
   return 0;
+#elif defined __CYGWIN__
+  struct tm gt,lt;
+  fixnum _t=0;
+  gmtime_r(&_t, &gt);
+  localtime_r(&_t, &lt);
+  return (lt.tm_mday == gt.tm_mday) ? -(lt.tm_hour) : (24 - lt.tm_hour);
 #else
   fixnum _t=time(0);
   return -localtime(&_t)->tm_gmtoff/3600;
diff -ru gcl-2.6.10.orig/o/xdrfuns.c gcl-2.6.10/o/xdrfuns.c
--- gcl-2.6.10.orig/o/xdrfuns.c	2013-11-11 23:55:48.000000000 +0900
+++ gcl-2.6.10/o/xdrfuns.c	2013-11-23 15:46:10.000000000 +0900
@@ -24,7 +24,11 @@
 #ifdef AIX3
 #include <sys/select.h>
 #endif
+#ifdef __CYGWIN__
+#include <rpc/xdr.h>
+#else  /* __CYGWIN__ */
 #include <rpc/rpc.h>
+#endif /* __CYGWIN__ */
 
 extern short aet_sizes[];
 static object
