From 15f3a61eb5b9256c42a400d47f96da4174fd5fc3 Mon Sep 17 00:00:00 2001
From: dscho <dscho>
Date: Fri, 16 Jan 2004 13:53:54 +0000
Subject: compile fix for cygwin

---
 ChangeLog           | 3 +++
 cargs.c             | 2 +-
 configure.ac        | 4 ++++
 contrib/Makefile.am | 6 +++++-
 rfbserver.c         | 8 +++++---
 vncauth.c           | 2 ++
 6 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 38cc012..36994e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2004-01-16  Johannes E. Schindelin  <Johannes.Schindelin@gmx.de>
+	* compile fix for cygwin
+
 2004-01-09  Karl Runge <runge@karlrunge.com>
 	* x11vnc options -allow, -localhost, -nodragging, -input_skip
 	* minimize memory usage under -nofb
diff --git a/cargs.c b/cargs.c
index c436f2c..f393698 100644
--- a/cargs.c
+++ b/cargs.c
@@ -53,7 +53,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
 {
     int i,i1;
 
-    if(!argc) return;
+    if(!argc) return TRUE;
     
     for (i = i1 = 1; i < *argc;) {
         if (strcmp(argv[i], "-help") == 0) {
diff --git a/configure.ac b/configure.ac
index 147be1f..5c4bfba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,10 @@ AC_CHECK_LIB(nsl,gethostbyname)
 AC_CHECK_LIB(socket,socket)
 AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mkfifo select socket strchr strcspn strdup strerror strstr setsid])
 
+# check, if shmget is in cygipc.a
+AC_CHECK_LIB(cygipc,shmget)
+AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true")
+
 # Check if /dev/vcsa1 exists, if so, define LINUX
 AM_CONDITIONAL(LINUX, test -c /dev/vcsa1)
 
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 8d00a9a..848b9a2 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -3,11 +3,15 @@ LDADD = ../libvncserver.a
 
 noinst_PROGRAMS=zippy
 
+if CYGIPC
+LD_CYGIPC=-lcygipc
+endif
+
 if HAVE_X
 bin_PROGRAMS=x11vnc
 x11vnc_SOURCES=x11vnc.c
 INCLUDES=@X_CFLAGS@
-x11vnc_LDADD=@X_LIBS@ $(LDADD)
+x11vnc_LDADD=@X_LIBS@ $(LD_CYGIPC) $(LDADD)
 endif
 
 zippy_SOURCES=zippy.c
diff --git a/rfbserver.c b/rfbserver.c
index 3c6aec8..914aa0b 100644
--- a/rfbserver.c
+++ b/rfbserver.c
@@ -228,7 +228,6 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
     rfbClientPtr cl,cl_;
     struct sockaddr_in addr;
     size_t addrlen = sizeof(struct sockaddr_in);
-    int i;
 
     cl = (rfbClientPtr)calloc(sizeof(rfbClientRec),1);
 
@@ -317,8 +316,11 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
 #ifdef LIBVNCSERVER_HAVE_LIBJPEG
       cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
       cl->tightQualityLevel = -1;
-      for (i = 0; i < 4; i++)
-        cl->zsActive[i] = FALSE;
+      {
+	int i;
+	for (i = 0; i < 4; i++)
+          cl->zsActive[i] = FALSE;
+      }
 #endif
 
       cl->enableCursorShapeUpdates = FALSE;
diff --git a/vncauth.c b/vncauth.c
index 1843434..2146e67 100644
--- a/vncauth.c
+++ b/vncauth.c
@@ -22,6 +22,8 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <rfb/rfbproto.h>
 #include "d3des.h"
 
-- 
cgit v1.2.3

