Commit 9f6a4708 authored by dscho's avatar dscho

autoconf'ed everything

parent 6c780732
This diff is collapsed.
SUBDIRS=. examples contrib
DIST_SUBDIRS=examples contrib
include_HEADERS=include/rfb.h include/rfbconfig.h include/rfbproto.h \
include/keysym.h
ZRLE_SRCS=zrle.cxx rdr/FdInStream.cxx rdr/FdOutStream.cxx rdr/InStream.cxx \
rdr/NullOutStream.cxx rdr/ZlibInStream.cxx rdr/ZlibOutStream.cxx
LIB_SOURCES = main.c rfbserver.c sraRegion.c auth.c sockets.c \
stats.c corre.c hextile.c rre.c translate.c cutpaste.c \
zlib.c tight.c httpd.c cursor.c font.c \
draw.c selbox.c d3des.c vncauth.c cargs.c
if HAVE_CXX
libvncserver_a_SOURCES=$(LIB_SOURCES) $(ZRLE_SRCS)
else
libvncserver_a_SOURCES=$(LIB_SOURCES)
endif
lib_LIBRARIES=libvncserver.a
immediate: immediate:
---------- ----------
x11vnc: clipboard, cursor, updates interruptible by input (doesn't work yet) x11vnc: clipboard, cursor
extra_bytes in rfbDrawCharWithClip. extra_bytes in rfbDrawCharWithClip.
tested mouse buttons make copy rect, but text is not marked as mod. tested mouse buttons make copy rect, but text is not marked as mod.
cursor drawing: set optional grain to mark bigger rectangles as drawn (else cursor drawing: set optional grain to mark bigger rectangles as drawn (else
...@@ -18,16 +18,15 @@ later: ...@@ -18,16 +18,15 @@ later:
authentification schemes (secure vnc) authentification schemes (secure vnc)
IO function ptr exists; now explain how to tunnel and implement a IO function ptr exists; now explain how to tunnel and implement a
client address restriction scheme. client address restriction scheme.
autoconf? at least Sun Solaris and Windows compilation
(maybe Michael makes a small autconf)
using Hermes library for fast colour translations. using Hermes library for fast colour translations.
CORBA CORBA
internal HTTP tunnelling feature (needs a special GET target and a few
changes to java applet).
done: done:
----- -----
.autoconf
.internal HTTP tunnelling feature (needs a special GET target and a few
. changes to java applet).
.x11vnc: sometimes XTest fails (but doesn't with x0rfbserver) .x11vnc: sometimes XTest fails (but doesn't with x0rfbserver)
.DeferUpdateTime (timing problems!) .DeferUpdateTime (timing problems!)
.empty cursor sending doesn't work. .empty cursor sending doesn't work.
......
#!/bin/sh
aclocal && automake && autoconf && ./configure && make
# Process this file with autoconf to produce a configure script.
AC_INIT(LibVNCServer, 0.5, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([include/rfbconfig.h])
# Checks for programs.
AC_PROG_CC
CCLD=$CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
# Options
AH_TEMPLATE(BACKCHANNEL, [Enable BackChannel communication])
AC_ARG_WITH(backchannel,
[ --without-backchannel disable backchannel method],
,AC_DEFINE(BACKCHANNEL))
AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
AC_ARG_WITH(24bpp,
[ --without-24bpp disable 24 bpp framebuffers],
,AC_DEFINE(ALLOW24BPP))
# Checks for X libraries
HAVE_X="false"
AC_PATH_XTRA
if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, HAVE_XTEST="true",
HAVE_XTEST="false",
$X_LIBS $X_PRELIBS -lX11 -lXext $X_EXTRA_LIBS)
if test $HAVE_XTEST = "true"; then
X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS -lXext -lXtst"
HAVE_X="true"
fi
fi
AC_SUBST(X_LIBS)
AM_CONDITIONAL(HAVE_X, test $HAVE_X != "false")
# Checks for libraries.
AC_CHECK_HEADERS(jpeglib.h pthread.h zlib.h)
if test ! -z "$HAVE_JPEGLIB.H"; then
AC_CHECK_LIB(jpeg, jpeg_CreateCompress)
fi
AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_PTHREAD.H")
if test ! -z "$HAVE_PTHREAD.H"; then
AC_CHECK_LIB(pthread, pthread_mutex_lock)
fi
if test ! -z "$HAVE_ZLIB.H"; then
AC_CHECK_LIB(z, deflate)
# check for c++, but don't fail if not found
AC_CHECK_PROGS(CXX,[g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC],none)
AH_TEMPLATE(HAVE_ZRLE, [Use zrle compression; needs a c++ compiler])
if test x$CXX != xnone; then
AC_DEFINE(HAVE_ZRLE)
AC_PROG_CXX
CCLD=$CXX
fi
else
CXX=none
fi
AM_CONDITIONAL(HAVE_CXX, test x$CXX != xnone)
AC_SUBST(CCLD)
VNCLIBS="-L.. -lvncserver"
LIBS="$VNCLIBS $LIBS"
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mkfifo select socket strchr strcspn strdup strerror strstr])
AC_CONFIG_FILES([Makefile
contrib/Makefile
examples/Makefile
libvncserver.spec])
AC_OUTPUT
This diff is collapsed.
noinst_PROGRAMS=zippy
if HAVE_X
bin_PROGRAMS=x11vnc
x11vnc_SOURCES=x11vnc.c
x11vnc_CFLAGSADD=@X_CFLAGS@
x11vnc_LDADD=@X_LIBS@
endif
zippy_SOURCES=zippy.c
This diff is collapsed.
if HAVE_LIBPTHREAD
BACKGROUND_TEST=blooptest
endif
noinst_PROGRAMS=example pnmshow sratest pnmshow24 fontsel \
vncev storepasswd $(BACKGROUND_TEST)
...@@ -297,7 +297,7 @@ int main(int argc,char** argv) ...@@ -297,7 +297,7 @@ int main(int argc,char** argv)
/* initialize the server */ /* initialize the server */
rfbInitServer(rfbScreen); rfbInitServer(rfbScreen);
#define USE_OWN_LOOP #ifndef BACKGROUND_LOOP_TEST
#ifdef USE_OWN_LOOP #ifdef USE_OWN_LOOP
{ {
int i; int i;
...@@ -307,12 +307,12 @@ int main(int argc,char** argv) ...@@ -307,12 +307,12 @@ int main(int argc,char** argv)
} }
} }
#else #else
#ifndef BACKGROUND_LOOP_TEST
/* this is the blocking event loop, i.e. it never returns */ /* this is the blocking event loop, i.e. it never returns */
/* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */ /* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */
rfbRunEventLoop(rfbScreen,40000,FALSE); rfbRunEventLoop(rfbScreen,40000,FALSE);
#elif !defined(HAVE_PTHREADS) #endif /* OWN LOOP */
#else
#if !defined(HAVE_LIBPTHREAD)
#error "I need pthreads for that." #error "I need pthreads for that."
#endif #endif
...@@ -320,7 +320,7 @@ int main(int argc,char** argv) ...@@ -320,7 +320,7 @@ int main(int argc,char** argv)
rfbRunEventLoop(rfbScreen,-1,TRUE); rfbRunEventLoop(rfbScreen,-1,TRUE);
/* now we could do some cool things like rendering in idle time */ /* now we could do some cool things like rendering in idle time */
while(1) sleep(5); /* render(); */ while(1) sleep(5); /* render(); */
#endif #endif /* BACKGROUND_LOOP */
rfbFreeCursor(rfbScreen->cursor); rfbFreeCursor(rfbScreen->cursor);
free(rfbScreen->frameBuffer); free(rfbScreen->frameBuffer);
......
...@@ -35,14 +35,14 @@ extern "C" ...@@ -35,14 +35,14 @@ extern "C"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <zlib.h> #include "rfbconfig.h"
#include "keysym.h" #include "keysym.h"
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
/* TODO: this stuff has to go into autoconf */ /* TODO: this stuff has to go into autoconf */
#define HAVE_PTHREADS
#define ALLOW24BPP
#define HAVE_ZRLE
#define BACKCHANNEL
typedef unsigned char CARD8; typedef unsigned char CARD8;
typedef unsigned short CARD16; typedef unsigned short CARD16;
typedef unsigned int CARD32; typedef unsigned int CARD32;
...@@ -120,7 +120,7 @@ typedef int socklen_t; ...@@ -120,7 +120,7 @@ typedef int socklen_t;
#define INADDR_NONE ((in_addr_t) 0xffffffff) #define INADDR_NONE ((in_addr_t) 0xffffffff)
#endif #endif
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
#include <pthread.h> #include <pthread.h>
#if 0 /* debugging */ #if 0 /* debugging */
#define LOCK(mutex) fprintf(stderr,"%s:%d LOCK(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex)) #define LOCK(mutex) fprintf(stderr,"%s:%d LOCK(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex))
...@@ -163,11 +163,11 @@ typedef int socklen_t; ...@@ -163,11 +163,11 @@ typedef int socklen_t;
/* end of stuff for autoconf */ /* end of stuff for autoconf */
/* if you use pthreads, but don't define HAVE_PTHREADS, the structs /* if you use pthreads, but don't define HAVE_LIBPTHREAD, the structs
get all mixed up. So this gives a linker error reminding you to compile get all mixed up. So this gives a linker error reminding you to compile
the library and your application (at least the parts including rfb.h) the library and your application (at least the parts including rfb.h)
with the same support for pthreads. */ with the same support for pthreads. */
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
#ifdef HAVE_ZRLE #ifdef HAVE_ZRLE
#define rfbInitServer rfbInitServerWithPthreadsAndZRLE #define rfbInitServer rfbInitServerWithPthreadsAndZRLE
#else #else
...@@ -345,7 +345,7 @@ typedef struct _rfbScreenInfo ...@@ -345,7 +345,7 @@ typedef struct _rfbScreenInfo
/* displayHook is called just before a frame buffer update */ /* displayHook is called just before a frame buffer update */
DisplayHookPtr displayHook; DisplayHookPtr displayHook;
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
MUTEX(cursorMutex); MUTEX(cursorMutex);
Bool backgroundLoop; Bool backgroundLoop;
#endif #endif
...@@ -404,7 +404,7 @@ typedef struct _rfbClientRec { ...@@ -404,7 +404,7 @@ typedef struct _rfbClientRec {
SOCKET sock; SOCKET sock;
char *host; char *host;
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
pthread_t client_thread; pthread_t client_thread;
#endif #endif
/* Possible client states: */ /* Possible client states: */
...@@ -501,19 +501,23 @@ typedef struct _rfbClientRec { ...@@ -501,19 +501,23 @@ typedef struct _rfbClientRec {
int rfbKeyEventsRcvd; int rfbKeyEventsRcvd;
int rfbPointerEventsRcvd; int rfbPointerEventsRcvd;
#ifdef HAVE_LIBZ
/* zlib encoding -- necessary compression state info per client */ /* zlib encoding -- necessary compression state info per client */
struct z_stream_s compStream; struct z_stream_s compStream;
Bool compStreamInited; Bool compStreamInited;
CARD32 zlibCompressLevel; CARD32 zlibCompressLevel;
#ifdef HAVE_LIBJPEG
/* tight encoding -- preserve zlib streams' state for each client */ /* tight encoding -- preserve zlib streams' state for each client */
//#ifdef HAVE_LIBJPEG
z_stream zsStruct[4]; z_stream zsStruct[4];
Bool zsActive[4]; Bool zsActive[4];
int zsLevel[4]; int zsLevel[4];
int tightCompressLevel; int tightCompressLevel;
int tightQualityLevel; int tightQualityLevel;
#endif
#endif
Bool enableLastRectEncoding; /* client supports LastRect encoding */ Bool enableLastRectEncoding; /* client supports LastRect encoding */
Bool enableCursorShapeUpdates; /* client supports cursor shape updates */ Bool enableCursorShapeUpdates; /* client supports cursor shape updates */
...@@ -532,7 +536,7 @@ typedef struct _rfbClientRec { ...@@ -532,7 +536,7 @@ typedef struct _rfbClientRec {
struct _rfbClientRec *prev; struct _rfbClientRec *prev;
struct _rfbClientRec *next; struct _rfbClientRec *next;
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
/* whenever a client is referenced, the refCount has to be incremented /* whenever a client is referenced, the refCount has to be incremented
and afterwards decremented, so that the client is not cleaned up and afterwards decremented, so that the client is not cleaned up
while being referenced. while being referenced.
...@@ -683,6 +687,7 @@ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, ...@@ -683,6 +687,7 @@ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
int h); int h);
#ifdef HAVE_LIBZ
/* zlib.c */ /* zlib.c */
/* Minimum zlib rectangle size in bytes. Anything smaller will /* Minimum zlib rectangle size in bytes. Anything smaller will
...@@ -700,7 +705,7 @@ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, ...@@ -700,7 +705,7 @@ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
extern Bool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, extern Bool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
int h); int h);
#ifdef HAVE_LIBJPEG
/* tight.c */ /* tight.c */
#define TIGHT_DEFAULT_COMPRESSION 6 #define TIGHT_DEFAULT_COMPRESSION 6
...@@ -709,6 +714,8 @@ extern Bool rfbTightDisableGradient; ...@@ -709,6 +714,8 @@ extern Bool rfbTightDisableGradient;
extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
extern Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h); extern Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
#endif
#endif
/* cursor.c */ /* cursor.c */
......
...@@ -296,9 +296,11 @@ typedef struct { ...@@ -296,9 +296,11 @@ typedef struct {
#define rfbEncodingRRE 2 #define rfbEncodingRRE 2
#define rfbEncodingCoRRE 4 #define rfbEncodingCoRRE 4
#define rfbEncodingHextile 5 #define rfbEncodingHextile 5
#ifdef HAVE_LIBZ
#define rfbEncodingZlib 6 #define rfbEncodingZlib 6
#define rfbEncodingTight 7 #define rfbEncodingTight 7
#define rfbEncodingZlibHex 8 #define rfbEncodingZlibHex 8
#endif
#ifdef BACKCHANNEL #ifdef BACKCHANNEL
#define rfbEncodingBackChannel 15 #define rfbEncodingBackChannel 15
#endif #endif
...@@ -488,7 +490,7 @@ typedef struct { ...@@ -488,7 +490,7 @@ typedef struct {
#define rfbHextileExtractW(byte) (((byte) >> 4) + 1) #define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1) #define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
#ifdef HAVE_LIBZ
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* zlib - zlib compressed Encoding. We have an rfbZlibHeader structure * zlib - zlib compressed Encoding. We have an rfbZlibHeader structure
* giving the number of bytes following. Finally the data follows is * giving the number of bytes following. Finally the data follows is
...@@ -637,6 +639,8 @@ typedef struct { ...@@ -637,6 +639,8 @@ typedef struct {
#define rfbTightFilterPalette 0x01 #define rfbTightFilterPalette 0x01
#define rfbTightFilterGradient 0x02 #define rfbTightFilterGradient 0x02
#endif
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* XCursor encoding. This is a special encoding used to transmit X-style * XCursor encoding. This is a special encoding used to transmit X-style
* cursor shapes from server to clients. Note that for this encoding, * cursor shapes from server to clients. Note that for this encoding,
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "rfb.h" #include "rfb.h"
#include "sraRegion.h" #include "sraRegion.h"
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
MUTEX(logMutex); MUTEX(logMutex);
#endif #endif
...@@ -130,7 +130,7 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in ...@@ -130,7 +130,7 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
#if 0 #if 0
/* TODO: is this needed? Or does it mess up deferring? */ /* TODO: is this needed? Or does it mess up deferring? */
/* while(!sraRgnEmpty(cl->copyRegion)) */ { /* while(!sraRgnEmpty(cl->copyRegion)) */ {
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
if(!cl->screen->backgroundLoop) if(!cl->screen->backgroundLoop)
#endif #endif
{ {
...@@ -231,7 +231,7 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y ...@@ -231,7 +231,7 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y
sraRgnDestroy(region); sraRgnDestroy(region);
} }
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
static void * static void *
clientOutput(void *data) clientOutput(void *data)
{ {
...@@ -796,7 +796,7 @@ rfbProcessEvents(rfbScreenInfoPtr rfbScreen,long usec) ...@@ -796,7 +796,7 @@ rfbProcessEvents(rfbScreenInfoPtr rfbScreen,long usec)
void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, Bool runInBackground) void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, Bool runInBackground)
{ {
if(runInBackground) { if(runInBackground) {
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
pthread_t listener_thread; pthread_t listener_thread;
rfbScreen->backgroundLoop = TRUE; rfbScreen->backgroundLoop = TRUE;
......
...@@ -59,7 +59,7 @@ static void rfbProcessClientProtocolVersion(rfbClientPtr cl); ...@@ -59,7 +59,7 @@ static void rfbProcessClientProtocolVersion(rfbClientPtr cl);
static void rfbProcessClientNormalMessage(rfbClientPtr cl); static void rfbProcessClientNormalMessage(rfbClientPtr cl);
static void rfbProcessClientInitMessage(rfbClientPtr cl); static void rfbProcessClientInitMessage(rfbClientPtr cl);
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
void rfbIncrClientRef(rfbClientPtr cl) void rfbIncrClientRef(rfbClientPtr cl)
{ {
LOCK(cl->refCountMutex); LOCK(cl->refCountMutex);
...@@ -80,7 +80,7 @@ void rfbIncrClientRef(rfbClientPtr cl) {} ...@@ -80,7 +80,7 @@ void rfbIncrClientRef(rfbClientPtr cl) {}
void rfbDecrClientRef(rfbClientPtr cl) {} void rfbDecrClientRef(rfbClientPtr cl) {}
#endif #endif
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
MUTEX(rfbClientListMutex); MUTEX(rfbClientListMutex);
#endif #endif
...@@ -124,7 +124,7 @@ rfbClientIteratorNext(rfbClientIteratorPtr i) ...@@ -124,7 +124,7 @@ rfbClientIteratorNext(rfbClientIteratorPtr i)
IF_PTHREADS(rfbDecrClientRef(cl)); IF_PTHREADS(rfbDecrClientRef(cl));
} }
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
while(i->next && i->next->sock<0) while(i->next && i->next->sock<0)
i->next = i->next->next; i->next = i->next->next;
if(i->next) if(i->next)
...@@ -289,10 +289,12 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -289,10 +289,12 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
rfbScreen->rfbClientHead = cl; rfbScreen->rfbClientHead = cl;
UNLOCK(rfbClientListMutex); UNLOCK(rfbClientListMutex);
#ifdef HAVE_LIBJPEG
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
cl->tightQualityLevel = -1; cl->tightQualityLevel = -1;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
cl->zsActive[i] = FALSE; cl->zsActive[i] = FALSE;
#endif
cl->enableCursorShapeUpdates = FALSE; cl->enableCursorShapeUpdates = FALSE;
cl->enableCursorPosUpdates = FALSE; cl->enableCursorPosUpdates = FALSE;
...@@ -300,6 +302,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -300,6 +302,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl->enableLastRectEncoding = FALSE; cl->enableLastRectEncoding = FALSE;
cl->useNewFBSize = FALSE; cl->useNewFBSize = FALSE;
#ifdef HAVE_LIBZ
cl->compStreamInited = FALSE; cl->compStreamInited = FALSE;
cl->compStream.total_in = 0; cl->compStream.total_in = 0;
cl->compStream.total_out = 0; cl->compStream.total_out = 0;
...@@ -308,6 +311,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -308,6 +311,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl->compStream.opaque = Z_NULL; cl->compStream.opaque = Z_NULL;
cl->zlibCompressLevel = 5; cl->zlibCompressLevel = 5;
#endif
sprintf(pv,rfbProtocolVersionFormat,rfbProtocolMajorVersion, sprintf(pv,rfbProtocolVersionFormat,rfbProtocolMajorVersion,
rfbProtocolMinorVersion); rfbProtocolMinorVersion);
...@@ -381,7 +385,7 @@ rfbClientConnectionGone(cl) ...@@ -381,7 +385,7 @@ rfbClientConnectionGone(cl)
FreeZrleData(cl); FreeZrleData(cl);
#endif #endif
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
LOCK(cl->refCountMutex); LOCK(cl->refCountMutex);
if(cl->refCount) { if(cl->refCount) {
UNLOCK(cl->refCountMutex); UNLOCK(cl->refCountMutex);
...@@ -399,15 +403,19 @@ rfbClientConnectionGone(cl) ...@@ -399,15 +403,19 @@ rfbClientConnectionGone(cl)
rfbLog("Client %s gone\n",cl->host); rfbLog("Client %s gone\n",cl->host);
free(cl->host); free(cl->host);
#ifdef HAVE_LIBZ
/* Release the compression state structures if any. */ /* Release the compression state structures if any. */
if ( cl->compStreamInited ) { if ( cl->compStreamInited ) {
deflateEnd( &(cl->compStream) ); deflateEnd( &(cl->compStream) );
} }
#ifdef HAVE_LIBJPEG
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (cl->zsActive[i]) if (cl->zsActive[i])
deflateEnd(&cl->zsStruct[i]); deflateEnd(&cl->zsStruct[i]);
} }
#endif
#endif
if (pointerClient == cl) if (pointerClient == cl)
pointerClient = NULL; pointerClient = NULL;
...@@ -745,6 +753,7 @@ rfbProcessClientNormalMessage(cl) ...@@ -745,6 +753,7 @@ rfbProcessClientNormalMessage(cl)
cl->host); cl->host);
} }
break; break;
#ifdef HAVE_LIBZ
case rfbEncodingZlib: case rfbEncodingZlib:
if (cl->preferredEncoding == -1) { if (cl->preferredEncoding == -1) {
cl->preferredEncoding = enc; cl->preferredEncoding = enc;
...@@ -752,6 +761,7 @@ rfbProcessClientNormalMessage(cl) ...@@ -752,6 +761,7 @@ rfbProcessClientNormalMessage(cl)
cl->host); cl->host);
} }
break; break;
#ifdef HAVE_LIBJPEG
case rfbEncodingTight: case rfbEncodingTight:
if (cl->preferredEncoding == -1) { if (cl->preferredEncoding == -1) {
cl->preferredEncoding = enc; cl->preferredEncoding = enc;
...@@ -759,6 +769,8 @@ rfbProcessClientNormalMessage(cl) ...@@ -759,6 +769,8 @@ rfbProcessClientNormalMessage(cl)
cl->host); cl->host);
} }
break; break;
#endif
#endif
case rfbEncodingXCursor: case rfbEncodingXCursor:
if(!cl->screen->dontConvertRichCursorToXCursor) { if(!cl->screen->dontConvertRichCursorToXCursor) {
rfbLog("Enabling X-style cursor updates for client %s\n", rfbLog("Enabling X-style cursor updates for client %s\n",
...@@ -815,9 +827,11 @@ rfbProcessClientNormalMessage(cl) ...@@ -815,9 +827,11 @@ rfbProcessClientNormalMessage(cl)
break; break;
#endif #endif
default: default:
#ifdef HAVE_LIBZ
if ( enc >= (CARD32)rfbEncodingCompressLevel0 && if ( enc >= (CARD32)rfbEncodingCompressLevel0 &&
enc <= (CARD32)rfbEncodingCompressLevel9 ) { enc <= (CARD32)rfbEncodingCompressLevel9 ) {
cl->zlibCompressLevel = enc & 0x0F; cl->zlibCompressLevel = enc & 0x0F;
#ifdef HAVE_LIBJPEG
cl->tightCompressLevel = enc & 0x0F; cl->tightCompressLevel = enc & 0x0F;
rfbLog("Using compression level %d for client %s\n", rfbLog("Using compression level %d for client %s\n",
cl->tightCompressLevel, cl->host); cl->tightCompressLevel, cl->host);
...@@ -826,7 +840,9 @@ rfbProcessClientNormalMessage(cl) ...@@ -826,7 +840,9 @@ rfbProcessClientNormalMessage(cl)
cl->tightQualityLevel = enc & 0x0F; cl->tightQualityLevel = enc & 0x0F;
rfbLog("Using image quality level %d for client %s\n", rfbLog("Using image quality level %d for client %s\n",
cl->tightQualityLevel, cl->host); cl->tightQualityLevel, cl->host);
#endif
} else } else
#endif
rfbLog("rfbProcessClientNormalMessage: ignoring unknown " rfbLog("rfbProcessClientNormalMessage: ignoring unknown "
"encoding type %d\n", (int)enc); "encoding type %d\n", (int)enc);
} }
...@@ -1127,6 +1143,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion) ...@@ -1127,6 +1143,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
nUpdateRegionRects += (((w-1) / cl->correMaxWidth + 1) nUpdateRegionRects += (((w-1) / cl->correMaxWidth + 1)
* ((h-1) / cl->correMaxHeight + 1)); * ((h-1) / cl->correMaxHeight + 1));
} }
#ifdef HAVE_LIBZ
} else if (cl->preferredEncoding == rfbEncodingZlib) { } else if (cl->preferredEncoding == rfbEncodingZlib) {
nUpdateRegionRects = 0; nUpdateRegionRects = 0;
...@@ -1137,6 +1154,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion) ...@@ -1137,6 +1154,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
int h = rect.y2 - y; int h = rect.y2 - y;
nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1); nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1);
} }
#ifdef HAVE_LIBJPEG
} else if (cl->preferredEncoding == rfbEncodingTight) { } else if (cl->preferredEncoding == rfbEncodingTight) {
nUpdateRegionRects = 0; nUpdateRegionRects = 0;
...@@ -1152,6 +1170,8 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion) ...@@ -1152,6 +1170,8 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
} }
nUpdateRegionRects += n; nUpdateRegionRects += n;
} }
#endif
#endif
} else { } else {
nUpdateRegionRects = sraRgnCountRects(updateRegion); nUpdateRegionRects = sraRgnCountRects(updateRegion);
} }
...@@ -1226,18 +1246,22 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion) ...@@ -1226,18 +1246,22 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
return FALSE; return FALSE;
} }
break; break;
#ifdef HAVE_LIBZ
case rfbEncodingZlib: case rfbEncodingZlib:
if (!rfbSendRectEncodingZlib(cl, x, y, w, h)) { if (!rfbSendRectEncodingZlib(cl, x, y, w, h)) {
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
return FALSE; return FALSE;
} }
break; break;
#ifdef HAVE_LIBJPEG
case rfbEncodingTight: case rfbEncodingTight:
if (!rfbSendRectEncodingTight(cl, x, y, w, h)) { if (!rfbSendRectEncodingTight(cl, x, y, w, h)) {
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
return FALSE; return FALSE;
} }
break; break;
#endif
#endif
#ifdef HAVE_ZRLE #ifdef HAVE_ZRLE
case rfbEncodingZRLE: case rfbEncodingZRLE:
if (!rfbSendRectEncodingZRLE(cl, x, y, w, h)) { if (!rfbSendRectEncodingZRLE(cl, x, y, w, h)) {
......
...@@ -309,7 +309,7 @@ rfbCloseClient(cl) ...@@ -309,7 +309,7 @@ rfbCloseClient(cl)
rfbClientPtr cl; rfbClientPtr cl;
{ {
LOCK(cl->updateMutex); LOCK(cl->updateMutex);
#ifdef HAVE_PTHREADS #ifdef HAVE_LIBPTHREAD
if (cl->sock != -1) if (cl->sock != -1)
#endif #endif
{ {
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
/*#include <stdio.h>*/ /*#include <stdio.h>*/
#include "rfb.h" #include "rfb.h"
#ifdef HAVE_LIBZ
#ifdef HAVE_LIBJPEG
#ifdef WIN32 #ifdef WIN32
#define XMD_H #define XMD_H
#undef FAR #undef FAR
...@@ -1798,3 +1801,5 @@ JpegSetDstManager(j_compress_ptr cinfo) ...@@ -1798,3 +1801,5 @@ JpegSetDstManager(j_compress_ptr cinfo)
cinfo->dest = &jpegDstManager; cinfo->dest = &jpegDstManager;
} }
#endif /* LIBJPEG */
#endif /* LIBZ */
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <stdio.h> #include <stdio.h>
#include "rfb.h" #include "rfb.h"
#ifdef HAVE_LIBZ
/* /*
* zlibBeforeBuf contains pixel data in the client's format. * zlibBeforeBuf contains pixel data in the client's format.
* zlibAfterBuf contains the zlib (deflated) encoding version. * zlibAfterBuf contains the zlib (deflated) encoding version.
...@@ -301,4 +303,4 @@ rfbSendRectEncodingZlib(cl, x, y, w, h) ...@@ -301,4 +303,4 @@ rfbSendRectEncodingZlib(cl, x, y, w, h)
} }
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment