diff -ur linc-0.5.3.orig/configure.in linc-0.5.3/configure.in
--- linc-0.5.3.orig/configure.in	2002-08-24 01:44:58.000000000 +0900
+++ linc-0.5.3/configure.in	2002-09-07 13:00:10.000000000 +0900
@@ -51,6 +51,18 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 
+AC_MSG_CHECKING([for cygwin])
+case "$host" in
+  *-*-cygwin*)
+    linc_with_cygwin=yes
+    ;;
+  *)
+    linc_with_cygwin=no
+    ;;
+esac
+AC_MSG_RESULT([$linc_with_cygwin])
+AM_CONDITIONAL(WITH_CYGWIN, test "$linc_with_cygwin" = "yes")
+
 GLIB_REQUIRED=1.3.11
 AC_SUBST(GLIB_REQUIRED)
 
@@ -101,6 +113,7 @@
 AC_CHECK_HEADERS(fcntl.h unistd.h sys/endian.h endian.h machine/endian.h sys/machine.h sys/isa_defs.h sys/poll.h)
 AC_CHECK_HEADERS(stddef.h wchar.h wcstr.h wctype.h machine/types.h)
 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h sys/un.h linux/irda.h)
+AC_CHECK_HEADERS(arpa/nameser.h resolv.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff -ur linc-0.5.3.orig/src/Makefile.am linc-0.5.3/src/Makefile.am
--- linc-0.5.3.orig/src/Makefile.am	2002-05-22 01:19:26.000000000 +0900
+++ linc-0.5.3/src/Makefile.am	2002-09-07 12:59:40.000000000 +0900
@@ -26,6 +26,10 @@
 	$(SSL_LIBS)                  \
 	-version-info $(LT_VERSION)
 
+if WITH_CYGWIN
+liblinc_la_LIBADD = -lextras
+endif
+
 linc_cleanup_sockets_SOURCES = \
 	cleanup.c
 
diff -ur linc-0.5.3.orig/src/linc-compat.h linc-0.5.3/src/linc-compat.h
--- linc-0.5.3.orig/src/linc-compat.h	2002-07-31 19:41:06.000000000 +0900
+++ linc-0.5.3/src/linc-compat.h	2002-09-07 12:59:40.000000000 +0900
@@ -36,8 +36,12 @@
 #endif
 
 #include <arpa/inet.h>
+#ifdef HAVE_ARPA_NAMESER_H
 #include <arpa/nameser.h>
+#endif
+#ifdef HAVE_RESOLV_H
 #include <resolv.h>
+#endif
 
 #if !defined (NI_MAXSERV) || !defined (NI_MAXHOST)
 #  include <netdb.h>
diff -ur linc-0.5.3.orig/src/linc-protocols.c linc-0.5.3/src/linc-protocols.c
--- linc-0.5.3.orig/src/linc-protocols.c	2002-07-31 19:45:22.000000000 +0900
+++ linc-0.5.3/src/linc-protocols.c	2002-09-07 12:59:40.000000000 +0900
@@ -14,6 +14,9 @@
 #include <dirent.h>
 #include <linc/linc-protocol.h>
 #include <linc/linc-connection.h>
+#ifdef __CYGWIN__
+#include <cygextras.h>
+#endif
 
 #include "linc-private.h"
 #include "linc-debug.h"
@@ -46,6 +49,9 @@
 		case EEXIST:
 			if (stat (dirname, &statbuf) != 0)
 				g_error ("Can not stat %s\n", dirname);
+#ifdef __CYGWIN__
+			if (check_ntsec (dirname)) {
+#endif
 
 			if (statbuf.st_uid != getuid ())
 				g_error ("Owner of %s is not the current user\n", dirname);
@@ -54,6 +60,9 @@
 			    !S_ISDIR (statbuf.st_mode))
 				g_error ("Wrong permissions for %s\n", dirname);
 
+#ifdef __CYGWIN__
+			}
+#endif
 			break;
 				
 		default:
@@ -111,7 +120,7 @@
 #define LINC_SET_SOCKADDR_LEN(saddr, len)
 #endif
 
-#if defined(AF_INET6) && defined(RES_USE_INET6)
+#if defined(HAVE_RESOLV_H) && defined(AF_INET6) && defined(RES_USE_INET6)
 #define LINC_RESOLV_SET_IPV6     _res.options |= RES_USE_INET6
 #else
 #define LINC_RESOLV_SET_IPV6
@@ -286,8 +295,10 @@
 	if ((saddr->sin_addr.s_addr = inet_addr (hostname)) == INADDR_NONE) {
 
 		LINC_RESOLV_SET_IPV6;
+#ifdef HAVE_RESOLV_H
 		if (!(_res.options & RES_INIT))
 			res_init();
+#endif
 		
 		host = gethostbyname (hostname);
 		if (!host ||
@@ -347,8 +358,10 @@
 		return (struct sockaddr *)saddr;
 #endif
 
+#ifdef HAVE_RESOLV_H
 	if (!(_res.options & RES_INIT))
 		res_init();
+#endif
 
 	LINC_RESOLV_SET_IPV6;
 	host = gethostbyname (hostname);
