diff -BrauNwEbp avrdude-5.6cvs-orig/avrdude.h avrdude-5.6cvs/avrdude.h
--- avrdude-5.6cvs-orig/avrdude.h	2008-06-19 15:43:32.578125000 -0500
+++ avrdude-5.6cvs/avrdude.h	2008-06-19 15:56:07.218750000 -0500
@@ -39,6 +39,7 @@ extern int quell_progress;	/* quiteness 
 extern "C" {
 #endif
 
+#if !defined(__CYGWIN__)
 /* usleep replacements */
 /* sleep Windows in ms, Unix usleep in us
  #define usleep(us) Sleep((us)<20000?20:us/1000)
@@ -47,6 +48,7 @@ extern "C" {
  #define usleep(us) Sleep(us/1000*ANTIWARP)
 */
 void usleep(unsigned long us);
+#endif
 
 #if !defined(HAVE_GETTIMEOFDAY)
 struct timezone;
diff -BrauNwEbp avrdude-5.6cvs-orig/configure.ac avrdude-5.6cvs/configure.ac
--- avrdude-5.6cvs-orig/configure.ac	2008-06-19 15:43:32.625000000 -0500
+++ avrdude-5.6cvs/configure.ac	2008-06-19 16:06:14.656250000 -0500
@@ -163,13 +163,25 @@ AC_ARG_ENABLE(
 		esac],
 	[enabled_parport=yes])
 
+case $target in
+	*-*-msdos* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 DIST_SUBDIRS_AC='doc windows'
-
 if test "$enabled_doc" = "yes"; then
-	SUBDIRS_AC='doc @WINDOWS_DIRS@'
+	    SUBDIRS_AC='doc windows'
+    else
+	    SUBDIRS_AC='windows'
+    fi
+		;;
+	*)
+    DIST_SUBDIRS_AC='doc'
+    if test "$enabled_doc" = "yes"; then
+	    SUBDIRS_AC='doc'
 else
-	SUBDIRS_AC='@WINDOWS_DIRS@'
+	    SUBDIRS_AC=''
 fi
+		;;
+esac
+
 
 AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
 AC_SUBST(SUBDIRS_AC, $SUBDIRS_AC)
@@ -234,11 +246,16 @@ export confsubst
 
 # See if we need to drop into the windows subdir.
 case $target in
-        *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+        *-*-mingw32* | *-*-windows*)
 		WINDOWS_DIRS="windows"
 		CFLAGS="${CFLAGS} -mno-cygwin -DWIN32NATIVE"
 		LDFLAGS="${LDFLAGS} -static"
 		;;
+        *-*-cygwin**)
+		WINDOWS_DIRS="windows"
+		CFLAGS="${CFLAGS} -DWIN32NATIVE"
+		LDFLAGS="${LDFLAGS} -static"
+		;;
 esac
 AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
 
diff -BrauNwEbp avrdude-5.6cvs-orig/ppiwin.c avrdude-5.6cvs/ppiwin.c
--- avrdude-5.6cvs-orig/ppiwin.c	2008-06-19 15:43:33.062500000 -0500
+++ avrdude-5.6cvs/ppiwin.c	2008-06-19 15:56:07.218750000 -0500
@@ -39,7 +39,9 @@ reg = register as defined in an enum in 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#if !defined(__CYGWIN__)
 #include <unistd.h>
+#endif
 #include <windows.h>
 #include <sys/time.h>
 #include <windows.h>
diff -BrauNwEbp avrdude-5.6cvs-orig/ser_win32.c avrdude-5.6cvs/ser_win32.c
--- avrdude-5.6cvs-orig/ser_win32.c	2008-06-19 15:43:33.109375000 -0500
+++ avrdude-5.6cvs/ser_win32.c	2008-06-19 15:56:07.234375000 -0500
@@ -33,6 +33,18 @@
 #include "avrdude.h"
 #include "serial.h"
 
+#if defined(__CYGWIN__)
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <unistd.h>
+
+int is_network = 0;
+#endif
+
 long serial_recv_timeout = 5000; /* ms */
 
 #define W32SERBUFSIZE 1024
@@ -105,6 +118,80 @@ static int ser_setspeed(union filedescri
 }
 
 
+#if defined(__CYGWIN__)
+/*
+ * Given a port description of the form <host>:<port>, open a TCP
+ * connection to the specified destination, which is assumed to be a
+ * terminal/console server with serial parameters configured
+ * appropriately (e. g. 115200-8-N-1 for a STK500.)
+ */
+static void
+net_open(const char *port, union filedescriptor *fdp)
+{
+  char *hstr, *pstr, *end;
+  unsigned int pnum;
+  int fd;
+  struct sockaddr_in sockaddr;
+  struct hostent *hp;
+
+  if ((hstr = strdup(port)) == NULL) {
+    fprintf(stderr, "%s: net_open(): Out of memory!\n",
+	    progname);
+    exit(1);
+  }
+
+  if (((pstr = strchr(hstr, ':')) == NULL) || (pstr == hstr)) {
+    fprintf(stderr, "%s: net_open(): Mangled host:port string \"%s\"\n",
+	    progname, hstr);
+    free(hstr);
+    exit(1);
+  }
+
+  /*
+   * Terminate the host section of the description.
+   */
+  *pstr++ = '\0';
+
+  pnum = strtoul(pstr, &end, 10);
+
+  if ((*pstr == '\0') || (*end != '\0') || (pnum == 0) || (pnum > 65535)) {
+    fprintf(stderr, "%s: net_open(): Bad port number \"%s\"\n",
+	    progname, pstr);
+    free(hstr);
+    exit(1);
+  }
+
+  if ((hp = gethostbyname(hstr)) == NULL) {
+    fprintf(stderr, "%s: net_open(): unknown host \"%s\"\n",
+	    progname, hstr);
+    free(hstr);
+    exit(1);
+  }
+
+  free(hstr);
+
+  if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+    fprintf(stderr, "%s: net_open(): Cannot open socket: %s\n",
+	    progname, strerror(errno));
+    exit(1);
+  }
+
+  memset(&sockaddr, 0, sizeof(struct sockaddr_in));
+  sockaddr.sin_family = AF_INET;
+  sockaddr.sin_port = htons(pnum);
+  memcpy(&(sockaddr.sin_addr.s_addr), hp->h_addr, sizeof(struct in_addr));
+
+  if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
+    fprintf(stderr, "%s: net_open(): Connect failed: %s\n",
+	    progname, strerror(errno));
+    exit(1);
+  }
+
+  fdp->ifd = fd;
+  is_network = 1;
+}
+#endif
+
 static void ser_open(char * port, long baud, union filedescriptor *fdp)
 {
 	LPVOID lpMsgBuf;
@@ -113,7 +200,10 @@ static void ser_open(char * port, long b
 	/*
 	 * If the port is of the form "net:<host>:<port>", then
 	 * handle it as a TCP connection to a terminal server.
-	 *
+   */
+
+#if !defined(__CYGWIN__)
+	/*
 	 * This is curently not implemented for Win32.
 	 */
 	if (strncmp(port, "net:", strlen("net:")) == 0) {
@@ -124,6 +214,17 @@ static void ser_open(char * port, long b
 		exit(1);
 	}
 
+#else
+	/*
+	 * But it works under cygwin.
+	 */
+
+  if (strncmp(port, "net:", strlen("net:")) == 0) {
+    net_open(port + strlen("net:"), fdp);
+    return;
+  }
+#endif
+
 	/* if (hComPort!=INVALID_HANDLE_VALUE) 
 		fprintf(stderr, "%s: ser_open(): \"%s\" is already open\n",
 				progname, port);
@@ -183,9 +284,195 @@ static void ser_close(union filedescript
 		CloseHandle (hComPort);
 
 	hComPort = INVALID_HANDLE_VALUE;
+
+#if defined(__CYGWIN__)
+	if(is_network)
+	  close(fd->ifd);
+#endif
+}
+
+#if defined(__CYGWIN__)
+static int net_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
+{
+  struct timeval timeout, to2;
+  int rc;
+  unsigned char * p = buf;
+  size_t len = buflen;
+
+  if (!len)
+    return 0;
+
+  if (verbose > 3)
+  {
+      fprintf(stderr, "%s: Send: ", progname);
+
+      while (buflen) {
+        unsigned char c = *buf;
+        if (isprint(c)) {
+          fprintf(stderr, "%c ", c);
+        }
+        else {
+          fprintf(stderr, ". ");
+        }
+        fprintf(stderr, "[%02x] ", c);
+
+        buf++;
+        buflen--;
+      }
+
+      fprintf(stderr, "\n");
+  }
+
+  timeout.tv_sec = 0;
+  timeout.tv_usec = 500000;
+  to2 = timeout;
+
+  while (len) {
+    rc = write(fd->ifd, p, (len > 1024) ? 1024 : len);
+    if (rc < 0) {
+      fprintf(stderr, "%s: ser_send(): write error: %s\n",
+              progname, strerror(errno));
+      exit(1);
+    }
+    p += rc;
+    len -= rc;
+  }
+
+  return 0;
 }
 
 
+static int net_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen)
+{
+  struct timeval timeout, to2;
+  fd_set rfds;
+  int nfds;
+  int rc;
+  unsigned char * p = buf;
+  size_t len = 0;
+
+  timeout.tv_sec  = serial_recv_timeout / 1000L;
+  timeout.tv_usec = (serial_recv_timeout % 1000L) * 1000;
+  to2 = timeout;
+
+  while (len < buflen) {
+  reselect:
+    FD_ZERO(&rfds);
+    FD_SET(fd->ifd, &rfds);
+
+    nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &to2);
+    if (nfds == 0) {
+      if (verbose > 1)
+	fprintf(stderr,
+		"%s: ser_recv(): programmer is not responding\n",
+		progname);
+      return -1;
+    }
+    else if (nfds == -1) {
+      if (errno == EINTR || errno == EAGAIN) {
+	fprintf(stderr,
+		"%s: ser_recv(): programmer is not responding,reselecting\n",
+		progname);
+        goto reselect;
+      }
+      else {
+        fprintf(stderr, "%s: ser_recv(): select(): %s\n",
+                progname, strerror(errno));
+        exit(1);
+      }
+    }
+
+    rc = read(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len);
+    if (rc < 0) {
+      fprintf(stderr, "%s: ser_recv(): read error: %s\n",
+              progname, strerror(errno));
+      exit(1);
+    }
+    p += rc;
+    len += rc;
+  }
+
+  p = buf;
+
+  if (verbose > 3)
+  {
+      fprintf(stderr, "%s: Recv: ", progname);
+
+      while (len) {
+        unsigned char c = *p;
+        if (isprint(c)) {
+          fprintf(stderr, "%c ", c);
+        }
+        else {
+          fprintf(stderr, ". ");
+        }
+        fprintf(stderr, "[%02x] ", c);
+
+        p++;
+        len--;
+      }
+      fprintf(stderr, "\n");
+  }
+
+  return 0;
+}
+
+
+static int net_drain(union filedescriptor *fd, int display)
+{
+  struct timeval timeout;
+  fd_set rfds;
+  int nfds;
+  int rc;
+  unsigned char buf;
+
+  timeout.tv_sec = 0;
+  timeout.tv_usec = 250000;
+
+  if (display) {
+    fprintf(stderr, "drain>");
+  }
+
+  while (1) {
+    FD_ZERO(&rfds);
+    FD_SET(fd->ifd, &rfds);
+
+  reselect:
+    nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &timeout);
+    if (nfds == 0) {
+      if (display) {
+        fprintf(stderr, "<drain\n");
+      }
+
+      break;
+    }
+    else if (nfds == -1) {
+      if (errno == EINTR) {
+        goto reselect;
+      }
+      else {
+        fprintf(stderr, "%s: ser_drain(): select(): %s\n",
+                progname, strerror(errno));
+        exit(1);
+      }
+    }
+
+    rc = read(fd->ifd, &buf, 1);
+    if (rc < 0) {
+      fprintf(stderr, "%s: ser_drain(): read error: %s\n",
+              progname, strerror(errno));
+      exit(1);
+    }
+    if (display) {
+      fprintf(stderr, "%02x ", buf);
+    }
+  }
+
+  return 0;
+}
+#endif
+
+
 static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
 {
 	size_t len = buflen;
@@ -195,6 +482,11 @@ static int ser_send(union filedescriptor
 
 	HANDLE hComPort=(HANDLE)fd->pfd;
 
+#if defined(__CYGWIN__)
+	if(is_network)
+	  return net_send(fd, buf, buflen);
+#endif
+
 	if (hComPort == INVALID_HANDLE_VALUE) {
 		fprintf(stderr, "%s: ser_send(): port not open\n",
               progname); 
@@ -247,6 +539,12 @@ static int ser_recv(union filedescriptor
 	unsigned char * p = buf;
 	DWORD read;
 
+#if defined(__CYGWIN__)
+	if(is_network)
+	  return net_recv(fd, buf, buflen);
+#endif
+
+
 	HANDLE hComPort=(HANDLE)fd->pfd;
 	
 	if (hComPort == INVALID_HANDLE_VALUE) {
@@ -309,6 +607,12 @@ static int ser_drain(union filedescripto
 
 	HANDLE hComPort=(HANDLE)fd->pfd;
 
+#if defined(__CYGWIN__)
+	if(is_network)
+	  return net_drain(fd, display);
+#endif
+
+
   	if (hComPort == INVALID_HANDLE_VALUE) {
 		fprintf(stderr, "%s: ser_drain(): port not open\n",
               progname); 
