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:
----------
x11vnc: clipboard, cursor, updates interruptible by input (doesn't work yet)
x11vnc: clipboard, cursor
extra_bytes in rfbDrawCharWithClip.
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
......@@ -18,16 +18,15 @@ later:
authentification schemes (secure vnc)
IO function ptr exists; now explain how to tunnel and implement a
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.
CORBA
internal HTTP tunnelling feature (needs a special GET target and a few
changes to java applet).
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)
.DeferUpdateTime (timing problems!)
.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)
/* initialize the server */
rfbInitServer(rfbScreen);
#define USE_OWN_LOOP
#ifndef BACKGROUND_LOOP_TEST
#ifdef USE_OWN_LOOP
{
int i;
......@@ -307,12 +307,12 @@ int main(int argc,char** argv)
}
}
#else
#ifndef BACKGROUND_LOOP_TEST
/* this is the blocking event loop, i.e. it never returns */
/* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */
rfbRunEventLoop(rfbScreen,40000,FALSE);
#elif !defined(HAVE_PTHREADS)
#endif /* OWN LOOP */
#else
#if !defined(HAVE_LIBPTHREAD)
#error "I need pthreads for that."
#endif
......@@ -320,7 +320,7 @@ int main(int argc,char** argv)
rfbRunEventLoop(rfbScreen,-1,TRUE);
/* now we could do some cool things like rendering in idle time */
while(1) sleep(5); /* render(); */
#endif
#endif /* BACKGROUND_LOOP */
rfbFreeCursor(rfbScreen->cursor);
free(rfbScreen->frameBuffer);
......
......@@ -35,14 +35,14 @@ extern "C"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include "rfbconfig.h"
#include "keysym.h"
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
/* TODO: this stuff has to go into autoconf */
#define HAVE_PTHREADS
#define ALLOW24BPP
#define HAVE_ZRLE
#define BACKCHANNEL
typedef unsigned char CARD8;
typedef unsigned short CARD16;
typedef unsigned int CARD32;
......@@ -120,7 +120,7 @@ typedef int socklen_t;
#define INADDR_NONE ((in_addr_t) 0xffffffff)
#endif
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#if 0 /* debugging */
#define LOCK(mutex) fprintf(stderr,"%s:%d LOCK(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex))
......@@ -163,11 +163,11 @@ typedef int socklen_t;
/* 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
the library and your application (at least the parts including rfb.h)
with the same support for pthreads. */
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
#ifdef HAVE_ZRLE
#define rfbInitServer rfbInitServerWithPthreadsAndZRLE
#else
......@@ -345,7 +345,7 @@ typedef struct _rfbScreenInfo
/* displayHook is called just before a frame buffer update */
DisplayHookPtr displayHook;
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
MUTEX(cursorMutex);
Bool backgroundLoop;
#endif
......@@ -404,7 +404,7 @@ typedef struct _rfbClientRec {
SOCKET sock;
char *host;
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
pthread_t client_thread;
#endif
/* Possible client states: */
......@@ -501,19 +501,23 @@ typedef struct _rfbClientRec {
int rfbKeyEventsRcvd;
int rfbPointerEventsRcvd;
#ifdef HAVE_LIBZ
/* zlib encoding -- necessary compression state info per client */
struct z_stream_s compStream;
Bool compStreamInited;
CARD32 zlibCompressLevel;
#ifdef HAVE_LIBJPEG
/* tight encoding -- preserve zlib streams' state for each client */
//#ifdef HAVE_LIBJPEG
z_stream zsStruct[4];
Bool zsActive[4];
int zsLevel[4];
int tightCompressLevel;
int tightQualityLevel;
#endif
#endif
Bool enableLastRectEncoding; /* client supports LastRect encoding */
Bool enableCursorShapeUpdates; /* client supports cursor shape updates */
......@@ -532,7 +536,7 @@ typedef struct _rfbClientRec {
struct _rfbClientRec *prev;
struct _rfbClientRec *next;
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
/* whenever a client is referenced, the refCount has to be incremented
and afterwards decremented, so that the client is not cleaned up
while being referenced.
......@@ -683,6 +687,7 @@ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
int h);
#ifdef HAVE_LIBZ
/* zlib.c */
/* Minimum zlib rectangle size in bytes. Anything smaller will
......@@ -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,
int h);
#ifdef HAVE_LIBJPEG
/* tight.c */
#define TIGHT_DEFAULT_COMPRESSION 6
......@@ -709,6 +714,8 @@ extern Bool rfbTightDisableGradient;
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);
#endif
#endif
/* cursor.c */
......
......@@ -296,9 +296,11 @@ typedef struct {
#define rfbEncodingRRE 2
#define rfbEncodingCoRRE 4
#define rfbEncodingHextile 5
#ifdef HAVE_LIBZ
#define rfbEncodingZlib 6
#define rfbEncodingTight 7
#define rfbEncodingZlibHex 8
#endif
#ifdef BACKCHANNEL
#define rfbEncodingBackChannel 15
#endif
......@@ -488,7 +490,7 @@ typedef struct {
#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
#ifdef HAVE_LIBZ
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* zlib - zlib compressed Encoding. We have an rfbZlibHeader structure
* giving the number of bytes following. Finally the data follows is
......@@ -637,6 +639,8 @@ typedef struct {
#define rfbTightFilterPalette 0x01
#define rfbTightFilterGradient 0x02
#endif
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* XCursor encoding. This is a special encoding used to transmit X-style
* cursor shapes from server to clients. Note that for this encoding,
......
......@@ -32,7 +32,7 @@
#include "rfb.h"
#include "sraRegion.h"
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
MUTEX(logMutex);
#endif
......@@ -130,7 +130,7 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
#if 0
/* TODO: is this needed? Or does it mess up deferring? */
/* while(!sraRgnEmpty(cl->copyRegion)) */ {
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
if(!cl->screen->backgroundLoop)
#endif
{
......@@ -231,7 +231,7 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y
sraRgnDestroy(region);
}
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
static void *
clientOutput(void *data)
{
......@@ -796,7 +796,7 @@ rfbProcessEvents(rfbScreenInfoPtr rfbScreen,long usec)
void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, Bool runInBackground)
{
if(runInBackground) {
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
pthread_t listener_thread;
rfbScreen->backgroundLoop = TRUE;
......
......@@ -59,7 +59,7 @@ static void rfbProcessClientProtocolVersion(rfbClientPtr cl);
static void rfbProcessClientNormalMessage(rfbClientPtr cl);
static void rfbProcessClientInitMessage(rfbClientPtr cl);
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
void rfbIncrClientRef(rfbClientPtr cl)
{
LOCK(cl->refCountMutex);
......@@ -80,7 +80,7 @@ void rfbIncrClientRef(rfbClientPtr cl) {}
void rfbDecrClientRef(rfbClientPtr cl) {}
#endif
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
MUTEX(rfbClientListMutex);
#endif
......@@ -124,7 +124,7 @@ rfbClientIteratorNext(rfbClientIteratorPtr i)
IF_PTHREADS(rfbDecrClientRef(cl));
}
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
while(i->next && i->next->sock<0)
i->next = i->next->next;
if(i->next)
......@@ -289,10 +289,12 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
rfbScreen->rfbClientHead = cl;
UNLOCK(rfbClientListMutex);
#ifdef HAVE_LIBJPEG
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
cl->tightQualityLevel = -1;
for (i = 0; i < 4; i++)
cl->zsActive[i] = FALSE;
#endif
cl->enableCursorShapeUpdates = FALSE;
cl->enableCursorPosUpdates = FALSE;
......@@ -300,6 +302,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl->enableLastRectEncoding = FALSE;
cl->useNewFBSize = FALSE;
#ifdef HAVE_LIBZ
cl->compStreamInited = FALSE;
cl->compStream.total_in = 0;
cl->compStream.total_out = 0;
......@@ -308,6 +311,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl->compStream.opaque = Z_NULL;
cl->zlibCompressLevel = 5;
#endif
sprintf(pv,rfbProtocolVersionFormat,rfbProtocolMajorVersion,
rfbProtocolMinorVersion);
......@@ -381,7 +385,7 @@ rfbClientConnectionGone(cl)
FreeZrleData(cl);
#endif
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
LOCK(cl->refCountMutex);
if(cl->refCount) {
UNLOCK(cl->refCountMutex);
......@@ -399,15 +403,19 @@ rfbClientConnectionGone(cl)
rfbLog("Client %s gone\n",cl->host);
free(cl->host);
#ifdef HAVE_LIBZ
/* Release the compression state structures if any. */
if ( cl->compStreamInited ) {
deflateEnd( &(cl->compStream) );
}
#ifdef HAVE_LIBJPEG
for (i = 0; i < 4; i++) {
if (cl->zsActive[i])
deflateEnd(&cl->zsStruct[i]);
}
#endif
#endif
if (pointerClient == cl)
pointerClient = NULL;
......@@ -745,6 +753,7 @@ rfbProcessClientNormalMessage(cl)
cl->host);
}
break;
#ifdef HAVE_LIBZ
case rfbEncodingZlib:
if (cl->preferredEncoding == -1) {
cl->preferredEncoding = enc;
......@@ -752,6 +761,7 @@ rfbProcessClientNormalMessage(cl)
cl->host);
}
break;
#ifdef HAVE_LIBJPEG
case rfbEncodingTight:
if (cl->preferredEncoding == -1) {
cl->preferredEncoding = enc;
......@@ -759,6 +769,8 @@ rfbProcessClientNormalMessage(cl)
cl->host);
}
break;
#endif
#endif
case rfbEncodingXCursor:
if(!cl->screen->dontConvertRichCursorToXCursor) {
rfbLog("Enabling X-style cursor updates for client %s\n",
......@@ -815,9 +827,11 @@ rfbProcessClientNormalMessage(cl)
break;
#endif
default:
#ifdef HAVE_LIBZ
if ( enc >= (CARD32)rfbEncodingCompressLevel0 &&
enc <= (CARD32)rfbEncodingCompressLevel9 ) {
cl->zlibCompressLevel = enc & 0x0F;
#ifdef HAVE_LIBJPEG
cl->tightCompressLevel = enc & 0x0F;
rfbLog("Using compression level %d for client %s\n",
cl->tightCompressLevel, cl->host);
......@@ -826,7 +840,9 @@ rfbProcessClientNormalMessage(cl)
cl->tightQualityLevel = enc & 0x0F;
rfbLog("Using image quality level %d for client %s\n",
cl->tightQualityLevel, cl->host);
#endif
} else
#endif
rfbLog("rfbProcessClientNormalMessage: ignoring unknown "
"encoding type %d\n", (int)enc);
}
......@@ -1127,6 +1143,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
nUpdateRegionRects += (((w-1) / cl->correMaxWidth + 1)
* ((h-1) / cl->correMaxHeight + 1));
}
#ifdef HAVE_LIBZ
} else if (cl->preferredEncoding == rfbEncodingZlib) {
nUpdateRegionRects = 0;
......@@ -1137,6 +1154,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
int h = rect.y2 - y;
nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1);
}
#ifdef HAVE_LIBJPEG
} else if (cl->preferredEncoding == rfbEncodingTight) {
nUpdateRegionRects = 0;
......@@ -1152,6 +1170,8 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
}
nUpdateRegionRects += n;
}
#endif
#endif
} else {
nUpdateRegionRects = sraRgnCountRects(updateRegion);
}
......@@ -1226,18 +1246,22 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
return FALSE;
}
break;
#ifdef HAVE_LIBZ
case rfbEncodingZlib:
if (!rfbSendRectEncodingZlib(cl, x, y, w, h)) {
sraRgnDestroy(updateRegion);
return FALSE;
}
break;
#ifdef HAVE_LIBJPEG
case rfbEncodingTight:
if (!rfbSendRectEncodingTight(cl, x, y, w, h)) {
sraRgnDestroy(updateRegion);
return FALSE;
}
break;
#endif
#endif
#ifdef HAVE_ZRLE
case rfbEncodingZRLE:
if (!rfbSendRectEncodingZRLE(cl, x, y, w, h)) {
......
......@@ -309,7 +309,7 @@ rfbCloseClient(cl)
rfbClientPtr cl;
{
LOCK(cl->updateMutex);
#ifdef HAVE_PTHREADS
#ifdef HAVE_LIBPTHREAD
if (cl->sock != -1)
#endif
{
......
......@@ -27,6 +27,9 @@
/*#include <stdio.h>*/
#include "rfb.h"
#ifdef HAVE_LIBZ
#ifdef HAVE_LIBJPEG
#ifdef WIN32
#define XMD_H
#undef FAR
......@@ -1798,3 +1801,5 @@ JpegSetDstManager(j_compress_ptr cinfo)
cinfo->dest = &jpegDstManager;
}
#endif /* LIBJPEG */
#endif /* LIBZ */
......@@ -33,6 +33,8 @@
#include <stdio.h>
#include "rfb.h"
#ifdef HAVE_LIBZ
/*
* zlibBeforeBuf contains pixel data in the client's format.
* zlibAfterBuf contains the zlib (deflated) encoding version.
......@@ -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