<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff -Naupr motion-3.2.11.1/Makefile.in motion-3.2.11.1_patched/Makefile.in
--- motion-3.2.11.1/Makefile.in	2008-09-21 16:20:58.000000000 -0700
+++ motion-3.2.11.1_patched/Makefile.in	2009-08-26 19:49:59.195600000 -0700
@@ -70,7 +70,11 @@ pre-build-info: 
 ifneq (,$(findstring freebsd,$(VIDEO_OBJ)))
 	@echo "Platform: FreeBSD"
 else
-	@echo "Platform: Linux (if this is incorrect, please read README.FreeBSD)"
+    ifneq (,$(findstring DCYGWIN,$(CFLAGS)))
+        @echo "Platform: Cygwin"
+    else
+	    @echo "Platform: Linux (if this is incorrect, please read README.FreeBSD)"
+    endif
 endif
 	@echo
 
@@ -127,10 +131,15 @@ $(DEPEND_FILE): *.h $(SRC)
 ################################################################################
 dep depend fastdep: $(DEPEND_FILE)
 
+INSTALL_TARGETS-yes             += install-data install-progs install-complete-message
+
+#workaround for CYGWIN...thinks install is already "up to date", so rename the install target
+install: $(INSTALL_TARGETS-yes)
+
 ################################################################################
 # INSTALL installs all relevant files.                                         #
 ################################################################################
-install:
+install-data:
 	@echo "Installing files..."
 	@echo "--------------------------------------------------------------------------------"
 	mkdir -p $(DESTDIR)$(bindir)
@@ -142,10 +151,12 @@ install:
 	$(INSTALL) $(DOC) $(DESTDIR)$(docdir)
 	$(INSTALL) $(EXAMPLES) $(DESTDIR)$(examplesdir)
 	$(INSTALL) motion-dist.conf $(DESTDIR)$(sysconfdir)
+install-progs:    
 	for prog in $(PROGS); \
 	do \
 	($(INSTALL) $$prog $(DESTDIR)$(bindir) ); \
 	done
+install-complete-message:
 	@echo "--------------------------------------------------------------------------------"
 	@echo "Install complete! The default configuration file, motion-dist.conf, has been"
 	@echo "installed to $(sysconfdir). You need to rename/copy it to $(sysconfdir)/motion.conf"
diff -Naupr motion-3.2.11.1/configure.in motion-3.2.11.1_patched/configure.in
--- motion-3.2.11.1/configure.in	2009-08-11 08:14:13.000000000 -0700
+++ motion-3.2.11.1_patched/configure.in	2009-08-26 08:54:53.993415400 -0700
@@ -38,6 +38,18 @@ if test "${Darwin}" = ""; then
 	if test "${FreeBSD}" = ""; then
 		AC_MSG_RESULT(no)
 		VIDEO="video.o video2.o video_common.o"
+        AC_MSG_CHECKING(for Cygwin)
+        Cygwin=`uname -a|grep "CYGWIN"`
+        if test "${Cygwin}" != ""; then
+            AC_MSG_RESULT(yes)
+            TEMP_CFLAGS="${TEMP_CFLAGS} -DCYGWIN" #define CYGWIN environment
+            THREAD_CHECK="/usr/include/pthread.h"
+            TEMP_LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+            TEMP_LIBS="-L/usr/local/lib"
+        else
+            AC_MSG_RESULT(no)
+        fi
+		
 	else
 		AC_MSG_RESULT(yes)
 		if test "${LINUXTHREADS}" = "no"; then
@@ -125,6 +137,12 @@ V4L="$withval"
 
 fi
 
+#
+# No V4L in Cygwin, so skip it.
+#
+if test "${Cygwin}" != ""; then
+    V4L="no"
+fi
 
 if test "${V4L}" = "no"; then
 	TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L"
@@ -179,15 +197,20 @@ AC_MSG_CHECKING(for linuxthreads)
 
 elif test -f "${THREAD_CHECK}"; then
 
-
+saved_LIBS="$LIBS"
+if test "${FreeBSD}" != ""; then
+    LIBS="-pthread"
+else
+    LIBS="-lpthread"
+fi
 AC_MSG_CHECKING(threads)
-AC_TRY_LINK([#include &lt;pthread.h&gt;],
-[pthread_t th; pthread_join(th, 0);
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include &lt;pthread.h&gt;],
+               [pthread_t th; pthread_join(th, 0);
  pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [PTHREAD_LIB=yes])
-
-if test x$PTHREAD_LIB != xyes; then
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0);])],
+ [PTHREAD_LIB="yes"],
+ [PTHREAD_LIB="no"])
+if test $PTHREAD_LIB = "yes"; then
 
 	if test "${FreeBSD}" != ""; then
 		TEMP_LIBS="$TEMP_LIBS -pthread"
@@ -199,7 +222,7 @@ if test x$PTHREAD_LIB != xyes; then
 	PTHREAD_SUPPORT="yes"
 fi
 	AC_MSG_RESULT($PTHREAD_SUPPORT)                        
-
+    LIBS="$saved_LIBS"
 else
 	echo 
 	echo "You do not have threads support"
@@ -1115,6 +1138,8 @@ if test "${Darwin}" != ""; then
 	echo "OS             :     Darwin"
 elif test "${FreeBSD}" != ""; then
 	echo "OS             :     *BSD"		
+elif test "${Cygwin}" != ""; then
+    echo "OS             :     Cygwin"
 else 
 	echo "OS             :     Linux"
 fi
diff -Naupr motion-3.2.11.1/ffmpeg.c motion-3.2.11.1_patched/ffmpeg.c
--- motion-3.2.11.1/ffmpeg.c	2009-08-09 19:00:46.000000000 -0700
+++ motion-3.2.11.1_patched/ffmpeg.c	2009-08-25 23:43:20.651115400 -0700
@@ -176,7 +176,7 @@ static int file_close(URLContext *h)
     return close(fd);
 }
 
-URLProtocol file_protocol = {
+URLProtocol file_protocol_dupe = {
     "file",
     file_open,
     file_read,
@@ -217,10 +217,10 @@ void ffmpeg_init()
     /* Copy the functions to use for the append file protocol from the standard
      * file protocol.
      */
-    mpeg1_file_protocol.url_read  = file_protocol.url_read;
-    mpeg1_file_protocol.url_write = file_protocol.url_write;
-    mpeg1_file_protocol.url_seek  = file_protocol.url_seek;
-    mpeg1_file_protocol.url_close = file_protocol.url_close;
+    mpeg1_file_protocol.url_read  = file_protocol_dupe.url_read;
+    mpeg1_file_protocol.url_write = file_protocol_dupe.url_write;
+    mpeg1_file_protocol.url_seek  = file_protocol_dupe.url_seek;
+    mpeg1_file_protocol.url_close = file_protocol_dupe.url_close;
 
     /* Register the append file protocol. */
     register_protocol(&amp;mpeg1_file_protocol);
diff -Naupr motion-3.2.11.1/motion.c motion-3.2.11.1_patched/motion.c
--- motion-3.2.11.1/motion.c	2009-08-09 19:00:46.000000000 -0700
+++ motion-3.2.11.1_patched/motion.c	2009-08-26 21:53:25.907000000 -0700
@@ -1914,7 +1914,7 @@ err:
 
     pthread_exit(NULL);
 }
-
+#ifndef CYGWIN //skip this function definition if we are compiling for Cygwin
 /**
  * become_daemon
  *
@@ -1981,7 +1981,6 @@ static void become_daemon(void)
     setpgrp();
 #endif /* BSD */
 
-    
     if ((i = open("/dev/tty", O_RDWR)) &gt;= 0) {
         ioctl(i, TIOCNOTTY, NULL);
         close(i);
@@ -2012,6 +2011,7 @@ static void become_daemon(void)
     sigaction(SIGTTIN, &amp;sig_ign_action, NULL);
     sigaction(SIGTSTP, &amp;sig_ign_action, NULL);
 }
+#endif /* CYGWIN */
 
 /**
  * cntlist_create
@@ -2114,8 +2114,13 @@ static void motion_startup(int daemonize
          * become daemon.
          */
         if (cnt_list[0]-&gt;daemon &amp;&amp; cnt_list[0]-&gt;conf.setup_mode == 0) {
+#ifndef CYGWIN
             become_daemon();
             motion_log(LOG_INFO, 0, "Motion running as daemon process");
+#else
+            //Cygwin user would likely use cygrunsrv to run Motion as a service
+            motion_log(LOG_INFO, 0, "Motion NOT running as daemon process...Not supported in CYGWIN");
+#endif
         }
     }
 
@@ -2512,18 +2517,22 @@ int create_path(const char *path)
     while (start) {
         char *buffer = strdup(path);
         buffer[start-path] = 0x00;
-
         if (mkdir(buffer, mode) == -1 &amp;&amp; errno != EEXIST) {
+#ifdef CYGWIN
+            if(errno != EACCES){ //cygwin can return "Permission Denied" even if the dir exists
+#endif /* CYGWIN */
             motion_log(LOG_ERR, 1, "Problem creating directory %s", buffer);
             free(buffer);
             return -1;
+#ifdef CYGWIN
+            }
+#endif /* CYGWIN */
         }
 
         free(buffer);
 
         start = strchr(start + 1, '/');
     }
-
     return 0;
 }
 
diff -Naupr motion-3.2.11.1/video_common.c motion-3.2.11.1_patched/video_common.c
--- motion-3.2.11.1/video_common.c	2009-08-09 19:00:46.000000000 -0700
+++ motion-3.2.11.1_patched/video_common.c	2009-08-26 22:03:09.507000000 -0700
@@ -17,7 +17,9 @@
 
 typedef unsigned char uint8_t;
 typedef unsigned short int uint16_t;
+#ifndef CYGWIN /* already defined in CYGWIN */
 typedef unsigned int uint32_t;
+#endif
 
 #define CLAMP(x)  ((x) &lt; 0 ? 0 : ((x) &gt; 255) ? 255 : (x))
 
</pre></body></html>