summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS3
-rw-r--r--ChangeLog1
-rw-r--r--Makefile.am22
-rw-r--r--Makefile.in174
-rw-r--r--autogen.sh55
-rw-r--r--classes/Makefile.in2
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure623
-rw-r--r--configure.ac37
-rw-r--r--contrib/Makefile.in3
-rw-r--r--examples/Makefile.in3
-rw-r--r--libvncclient/Makefile.in3
-rw-r--r--rfb/rfb.h8
-rw-r--r--rfb/rfbproto.h2
-rw-r--r--rfbserver.c8
-rw-r--r--test/Makefile.in3
-rw-r--r--vncterm/Makefile.in11
-rw-r--r--zrle.c183
-rw-r--r--zrleencodetemplate.c272
-rw-r--r--zrleoutstream.c276
-rw-r--r--zrleoutstream.h62
-rw-r--r--zrlepalettehelper.c62
-rw-r--r--zrlepalettehelper.h46
-rw-r--r--zrletypes.h30
24 files changed, 1114 insertions, 778 deletions
diff --git a/AUTHORS b/AUTHORS
index cf86495..5f2c13b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,7 +22,8 @@ Occasional important patches were sent by (in order I found the names in my
archives and please don't beat me, if I forgot you, but just send me an
email!): Akira Hatakeyama, Karl J. Runge, Justin "Zippy" Dearing,
Oliver Mihatsch, Greg Sternberg, Werner Hofer, Giampiero Giancipoli,
-Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger.
+Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz,
+Mark McLoughlin.
Probably I forgot quite a few people sending a patch here and there, which
really made a difference. Without those, some obscure bugs still would
diff --git a/ChangeLog b/ChangeLog
index b11c15a..58f9285 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+ Mark sent me patches to no longer need C++ for ZRLE encoding!
added --disable-cxx Option for configure
x11vnc changes from Karl Runge:
- Changed all those whimpy printf(...)'s into manly fprintf(stdxxx,...)'s.
diff --git a/Makefile.am b/Makefile.am
index 48f738d..dda93ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-CFLAGS=-g
+CFLAGS=-g -Wall
SUBDIRS=. examples contrib vncterm classes libvncclient test
DIST_SUBDIRS=examples contrib vncterm classes libvncclient test
@@ -11,28 +11,20 @@ includedir=$(prefix)/include/rfb
include_HEADERS=rfb/rfb.h rfb/rfbconfig.h rfb/rfbint.h rfb/rfbproto.h \
rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h
-noinst_HEADERS=d3des.h zrleDecode.h zrleEncode.h rfb/default8x16.h \
- rdr/Exception.h rdr/FdInStream.h rdr/FdOutStream.h \
- rdr/FixedMemOutStream.h rdr/InStream.h rdr/MemInStream.h \
- rdr/MemOutStream.h rdr/NullOutStream.h rdr/OutStream.h \
- rdr/ZlibInStream.h rdr/ZlibOutStream.h rdr/types.h
-
-ZRLE_SRCS=zrle.cxx rdr/FdInStream.cxx rdr/FdOutStream.cxx rdr/InStream.cxx \
- rdr/NullOutStream.cxx rdr/ZlibInStream.cxx rdr/ZlibOutStream.cxx
+noinst_HEADERS=d3des.h rfb/default8x16.h zrleoutstream.h \
+ zrlepalettehelper.h zrletypes.h
EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \
- tableinitcmtemplate.c tabletrans24template.c $(ZRLE_SRCS)
+ tableinitcmtemplate.c tabletrans24template.c \
+ zrleencodetemplate.c
LIB_SRCS = main.c rfbserver.c rfbregion.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
+ draw.c selbox.c d3des.c vncauth.c cargs.c \
+ zrle.c zrleoutstream.c zrlepalettehelper.c
-if HAVE_CXX
-libvncserver_a_SOURCES=$(LIB_SRCS) $(ZRLE_SRCS)
-else
libvncserver_a_SOURCES=$(LIB_SRCS)
-endif
lib_LIBRARIES=libvncserver.a
diff --git a/Makefile.in b/Makefile.in
index 71acbae..a23f92a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66,8 +66,6 @@ includedir = $(prefix)/include/rfb
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -82,7 +80,7 @@ X_PRE_LIBS = @X_PRE_LIBS@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
-CFLAGS = -g
+CFLAGS = -g -Wall
SUBDIRS = . examples contrib vncterm classes libvncclient test
DIST_SUBDIRS = examples contrib vncterm classes libvncclient test
@@ -94,29 +92,23 @@ include_HEADERS = rfb/rfb.h rfb/rfbconfig.h rfb/rfbint.h rfb/rfbproto.h \
rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h
-noinst_HEADERS = d3des.h zrleDecode.h zrleEncode.h rfb/default8x16.h \
- rdr/Exception.h rdr/FdInStream.h rdr/FdOutStream.h \
- rdr/FixedMemOutStream.h rdr/InStream.h rdr/MemInStream.h \
- rdr/MemOutStream.h rdr/NullOutStream.h rdr/OutStream.h \
- rdr/ZlibInStream.h rdr/ZlibOutStream.h rdr/types.h
-
-
-ZRLE_SRCS = zrle.cxx rdr/FdInStream.cxx rdr/FdOutStream.cxx rdr/InStream.cxx \
- rdr/NullOutStream.cxx rdr/ZlibInStream.cxx rdr/ZlibOutStream.cxx
+noinst_HEADERS = d3des.h rfb/default8x16.h zrleoutstream.h \
+ zrlepalettehelper.h zrletypes.h
EXTRA_DIST = tableinit24.c tableinittctemplate.c tabletranstemplate.c \
- tableinitcmtemplate.c tabletrans24template.c $(ZRLE_SRCS)
+ tableinitcmtemplate.c tabletrans24template.c \
+ zrleencodetemplate.c
LIB_SRCS = main.c rfbserver.c rfbregion.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
+ draw.c selbox.c d3des.c vncauth.c cargs.c \
+ zrle.c zrleoutstream.c zrlepalettehelper.c
-@HAVE_CXX_TRUE@libvncserver_a_SOURCES = $(LIB_SRCS) $(ZRLE_SRCS)
-@HAVE_CXX_FALSE@libvncserver_a_SOURCES = $(LIB_SRCS)
+libvncserver_a_SOURCES = $(LIB_SRCS)
lib_LIBRARIES = libvncserver.a
subdir = .
@@ -134,14 +126,9 @@ am__objects_1 = main.$(OBJEXT) rfbserver.$(OBJEXT) rfbregion.$(OBJEXT) \
translate.$(OBJEXT) cutpaste.$(OBJEXT) zlib.$(OBJEXT) \
tight.$(OBJEXT) httpd.$(OBJEXT) cursor.$(OBJEXT) font.$(OBJEXT) \
draw.$(OBJEXT) selbox.$(OBJEXT) d3des.$(OBJEXT) \
- vncauth.$(OBJEXT) cargs.$(OBJEXT)
-am__objects_2 = zrle.$(OBJEXT) FdInStream.$(OBJEXT) \
- FdOutStream.$(OBJEXT) InStream.$(OBJEXT) \
- NullOutStream.$(OBJEXT) ZlibInStream.$(OBJEXT) \
- ZlibOutStream.$(OBJEXT)
-@HAVE_CXX_TRUE@am_libvncserver_a_OBJECTS = $(am__objects_1) \
-@HAVE_CXX_TRUE@ $(am__objects_2)
-@HAVE_CXX_FALSE@am_libvncserver_a_OBJECTS = $(am__objects_1)
+ vncauth.$(OBJEXT) cargs.$(OBJEXT) zrle.$(OBJEXT) \
+ zrleoutstream.$(OBJEXT) zrlepalettehelper.$(OBJEXT)
+am_libvncserver_a_OBJECTS = $(am__objects_1)
libvncserver_a_OBJECTS = $(am_libvncserver_a_OBJECTS)
SCRIPTS = $(bin_SCRIPTS)
@@ -153,31 +140,23 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/FdInStream.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/FdOutStream.Po ./$(DEPDIR)/InStream.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/NullOutStream.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ZlibInStream.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ZlibOutStream.Po ./$(DEPDIR)/auth.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/cargs.Po ./$(DEPDIR)/corre.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/cursor.Po ./$(DEPDIR)/cutpaste.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/d3des.Po ./$(DEPDIR)/draw.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/font.Po ./$(DEPDIR)/hextile.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/httpd.Po ./$(DEPDIR)/main.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/rfbregion.Po ./$(DEPDIR)/rfbserver.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/rre.Po ./$(DEPDIR)/selbox.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/sockets.Po ./$(DEPDIR)/stats.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tight.Po ./$(DEPDIR)/translate.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/vncauth.Po ./$(DEPDIR)/zlib.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/zrle.Po
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/auth.Po ./$(DEPDIR)/cargs.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/corre.Po ./$(DEPDIR)/cursor.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/cutpaste.Po ./$(DEPDIR)/d3des.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/draw.Po ./$(DEPDIR)/font.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/hextile.Po ./$(DEPDIR)/httpd.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/rfbregion.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/rfbserver.Po ./$(DEPDIR)/rre.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/selbox.Po ./$(DEPDIR)/sockets.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/stats.Po ./$(DEPDIR)/tight.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/translate.Po ./$(DEPDIR)/vncauth.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/zlib.Po ./$(DEPDIR)/zrle.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/zrleoutstream.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/zrlepalettehelper.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
- -o $@
-CXXFLAGS = @CXXFLAGS@
DIST_SOURCES = $(libvncserver_a_SOURCES)
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
@@ -197,7 +176,7 @@ all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
-.SUFFIXES: .c .cxx .o .obj
+.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
@@ -264,12 +243,6 @@ uninstall-libLIBRARIES:
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
-FdInStream.$(OBJEXT): rdr/FdInStream.cxx
-FdOutStream.$(OBJEXT): rdr/FdOutStream.cxx
-InStream.$(OBJEXT): rdr/InStream.cxx
-NullOutStream.$(OBJEXT): rdr/NullOutStream.cxx
-ZlibInStream.$(OBJEXT): rdr/ZlibInStream.cxx
-ZlibOutStream.$(OBJEXT): rdr/ZlibOutStream.cxx
libvncserver.a: $(libvncserver_a_OBJECTS) $(libvncserver_a_DEPENDENCIES)
-rm -f libvncserver.a
$(libvncserver_a_AR) libvncserver.a $(libvncserver_a_OBJECTS) $(libvncserver_a_LIBADD)
@@ -302,12 +275,6 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FdInStream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FdOutStream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InStream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NullOutStream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ZlibInStream.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ZlibOutStream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cargs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corre.Po@am__quote@
@@ -330,6 +297,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncauth.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zlib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrleoutstream.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrlepalettehelper.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
@@ -346,91 +315,6 @@ distclean-depend:
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
CCDEPMODE = @CCDEPMODE@
-
-.cxx.o:
-@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
-
-.cxx.obj:
-@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
-
-FdInStream.o: rdr/FdInStream.cxx
-@AMDEP_TRUE@ source='rdr/FdInStream.cxx' object='FdInStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/FdInStream.Po' tmpdepfile='$(DEPDIR)/FdInStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FdInStream.o `test -f rdr/FdInStream.cxx || echo '$(srcdir)/'`rdr/FdInStream.cxx
-
-FdInStream.obj: rdr/FdInStream.cxx
-@AMDEP_TRUE@ source='rdr/FdInStream.cxx' object='FdInStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/FdInStream.Po' tmpdepfile='$(DEPDIR)/FdInStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FdInStream.obj `cygpath -w rdr/FdInStream.cxx`
-
-FdOutStream.o: rdr/FdOutStream.cxx
-@AMDEP_TRUE@ source='rdr/FdOutStream.cxx' object='FdOutStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/FdOutStream.Po' tmpdepfile='$(DEPDIR)/FdOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FdOutStream.o `test -f rdr/FdOutStream.cxx || echo '$(srcdir)/'`rdr/FdOutStream.cxx
-
-FdOutStream.obj: rdr/FdOutStream.cxx
-@AMDEP_TRUE@ source='rdr/FdOutStream.cxx' object='FdOutStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/FdOutStream.Po' tmpdepfile='$(DEPDIR)/FdOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FdOutStream.obj `cygpath -w rdr/FdOutStream.cxx`
-
-InStream.o: rdr/InStream.cxx
-@AMDEP_TRUE@ source='rdr/InStream.cxx' object='InStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/InStream.Po' tmpdepfile='$(DEPDIR)/InStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InStream.o `test -f rdr/InStream.cxx || echo '$(srcdir)/'`rdr/InStream.cxx
-
-InStream.obj: rdr/InStream.cxx
-@AMDEP_TRUE@ source='rdr/InStream.cxx' object='InStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/InStream.Po' tmpdepfile='$(DEPDIR)/InStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InStream.obj `cygpath -w rdr/InStream.cxx`
-
-NullOutStream.o: rdr/NullOutStream.cxx
-@AMDEP_TRUE@ source='rdr/NullOutStream.cxx' object='NullOutStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/NullOutStream.Po' tmpdepfile='$(DEPDIR)/NullOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o NullOutStream.o `test -f rdr/NullOutStream.cxx || echo '$(srcdir)/'`rdr/NullOutStream.cxx
-
-NullOutStream.obj: rdr/NullOutStream.cxx
-@AMDEP_TRUE@ source='rdr/NullOutStream.cxx' object='NullOutStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/NullOutStream.Po' tmpdepfile='$(DEPDIR)/NullOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o NullOutStream.obj `cygpath -w rdr/NullOutStream.cxx`
-
-ZlibInStream.o: rdr/ZlibInStream.cxx
-@AMDEP_TRUE@ source='rdr/ZlibInStream.cxx' object='ZlibInStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/ZlibInStream.Po' tmpdepfile='$(DEPDIR)/ZlibInStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ZlibInStream.o `test -f rdr/ZlibInStream.cxx || echo '$(srcdir)/'`rdr/ZlibInStream.cxx
-
-ZlibInStream.obj: rdr/ZlibInStream.cxx
-@AMDEP_TRUE@ source='rdr/ZlibInStream.cxx' object='ZlibInStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/ZlibInStream.Po' tmpdepfile='$(DEPDIR)/ZlibInStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ZlibInStream.obj `cygpath -w rdr/ZlibInStream.cxx`
-
-ZlibOutStream.o: rdr/ZlibOutStream.cxx
-@AMDEP_TRUE@ source='rdr/ZlibOutStream.cxx' object='ZlibOutStream.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/ZlibOutStream.Po' tmpdepfile='$(DEPDIR)/ZlibOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ZlibOutStream.o `test -f rdr/ZlibOutStream.cxx || echo '$(srcdir)/'`rdr/ZlibOutStream.cxx
-
-ZlibOutStream.obj: rdr/ZlibOutStream.cxx
-@AMDEP_TRUE@ source='rdr/ZlibOutStream.cxx' object='ZlibOutStream.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/ZlibOutStream.Po' tmpdepfile='$(DEPDIR)/ZlibOutStream.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ZlibOutStream.obj `cygpath -w rdr/ZlibOutStream.cxx`
-CXXDEPMODE = @CXXDEPMODE@
uninstall-info-am:
includeHEADERS_INSTALL = $(INSTALL_HEADER)
install-includeHEADERS: $(include_HEADERS)
@@ -562,7 +446,7 @@ distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkinstalldirs) $(distdir)/. $(distdir)/rdr $(distdir)/rfb
+ $(mkinstalldirs) $(distdir)/. $(distdir)/rfb
@for file in $(DISTFILES); do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
diff --git a/autogen.sh b/autogen.sh
new file mode 100644
index 0000000..fff8323
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+AUTOMAKE=automake-1.4
+ACLOCAL=aclocal-1.4
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+ AUTOMAKE=automake
+ ACLOCAL=aclocal
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile libvncserver."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have automake installed to compile libvncserver."
+ echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+(test -f $srcdir/rfb/rfb.h) || {
+ echo "You must run this script in the top-level libvncserver directory"
+ exit 1
+}
+
+if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+$ACLOCAL $ACLOCAL_FLAGS
+autoheader
+$AUTOMAKE --add-missing --copy
+autoconf
+
+echo "Running ./configure --enable-maintainer-mode" "$@"
+$srcdir/configure --enable-maintainer-mode "$@"
+
+echo "Now type 'make' to compile libvncserver."
diff --git a/classes/Makefile.in b/classes/Makefile.in
index 7a71e9f..94cfedf 100644
--- a/classes/Makefile.in
+++ b/classes/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
diff --git a/config.h.in b/config.h.in
index e846eb7..0d02167 100644
--- a/config.h.in
+++ b/config.h.in
@@ -155,9 +155,6 @@
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
-/* Use zrle compression; needs a c++ compiler */
-#undef HAVE_ZRLE
-
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
diff --git a/configure b/configure
index e86fd6e..a63a261 100755
--- a/configure
+++ b/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE RANLIB ac_ct_RANLIB CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS HAVE_X_TRUE HAVE_X_FALSE EGREP HAVE_LIBPTHREAD_TRUE HAVE_LIBPTHREAD_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE HAVE_CXX_TRUE HAVE_CXX_FALSE CCLD LIBOBJS LINUX_TRUE LINUX_FALSE OSX_TRUE OSX_FALSE HAVE_RPM_TRUE HAVE_RPM_FALSE RPMSOURCEDIR LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE RANLIB ac_ct_RANLIB CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS HAVE_X_TRUE HAVE_X_FALSE EGREP HAVE_LIBPTHREAD_TRUE HAVE_LIBPTHREAD_FALSE LIBOBJS LINUX_TRUE LINUX_FALSE OSX_TRUE OSX_FALSE HAVE_RPM_TRUE HAVE_RPM_FALSE RPMSOURCEDIR LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -770,14 +770,6 @@ ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
-ac_env_CXX_set=${CXX+set}
-ac_env_CXX_value=$CXX
-ac_cv_env_CXX_set=${CXX+set}
-ac_cv_env_CXX_value=$CXX
-ac_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_env_CXXFLAGS_value=$CXXFLAGS
-ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_cv_env_CXXFLAGS_value=$CXXFLAGS
#
# Report the --help message.
@@ -861,7 +853,6 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking Speeds up one-time builds
--enable-dependency-tracking Do not reject slow dependency extractors
- --disable-cxx disable use of c++
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -881,8 +872,6 @@ Some influential environment variables:
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
- CXX C++ compiler command
- CXXFLAGS C++ compiler flags
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -4998,15 +4987,15 @@ fi
fi
-if test ! -z "$HAVE_PTHREAD_H"; then
+if test ! -z "$HAVE_ZLIB_H"; then
-echo "$as_me:$LINENO: checking for pthread_mutex_lock in -lpthread" >&5
-echo $ECHO_N "checking for pthread_mutex_lock in -lpthread... $ECHO_C" >&6
-if test "${ac_cv_lib_pthread_pthread_mutex_lock+set}" = set; then
+echo "$as_me:$LINENO: checking for deflate in -lz" >&5
+echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_deflate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+LIBS="-lz $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5021,11 +5010,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char pthread_mutex_lock ();
+char deflate ();
int
main ()
{
-pthread_mutex_lock ();
+deflate ();
;
return 0;
}
@@ -5042,34 +5031,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_pthread_pthread_mutex_lock=yes
+ ac_cv_lib_z_deflate=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_pthread_pthread_mutex_lock=no
+ac_cv_lib_z_deflate=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_lock" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_lock" >&6
-if test $ac_cv_lib_pthread_pthread_mutex_lock = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5
+echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6
+if test $ac_cv_lib_z_deflate = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
+#define HAVE_LIBZ 1
_ACEOF
- LIBS="-lpthread $LIBS"
+ LIBS="-lz $LIBS"
+else
+ HAVE_ZLIB_H=""
fi
- echo "$as_me:$LINENO: checking for pthread_mutex_lock in -lpthread" >&5
-echo $ECHO_N "checking for pthread_mutex_lock in -lpthread... $ECHO_C" >&6
-if test "${ac_cv_lib_pthread_pthread_mutex_lock+set}" = set; then
+ if test ! -z "$HAVE_JPEGLIB_H" -a ! -z "$HAVE_ZLIB_H"; then
+
+echo "$as_me:$LINENO: checking for jpeg_CreateCompress in -ljpeg" >&5
+echo $ECHO_N "checking for jpeg_CreateCompress in -ljpeg... $ECHO_C" >&6
+if test "${ac_cv_lib_jpeg_jpeg_CreateCompress+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+LIBS="-ljpeg $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5084,11 +5077,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char pthread_mutex_lock ();
+char jpeg_CreateCompress ();
int
main ()
{
-pthread_mutex_lock ();
+jpeg_CreateCompress ();
;
return 0;
}
@@ -5105,481 +5098,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_pthread_pthread_mutex_lock=yes
+ ac_cv_lib_jpeg_jpeg_CreateCompress=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_pthread_pthread_mutex_lock=no
+ac_cv_lib_jpeg_jpeg_CreateCompress=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_lock" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_lock" >&6
-if test $ac_cv_lib_pthread_pthread_mutex_lock = yes; then
- HAVE_LIBPTHREAD="true"
-fi
-
-fi
-
-
-if test ! -z "$HAVE_LIBPTHREAD"; then
- HAVE_LIBPTHREAD_TRUE=
- HAVE_LIBPTHREAD_FALSE='#'
-else
- HAVE_LIBPTHREAD_TRUE='#'
- HAVE_LIBPTHREAD_FALSE=
-fi
-
-# Check whether --enable-cxx or --disable-cxx was given.
-if test "${enable_cxx+set}" = set; then
- enableval="$enable_cxx"
- disable_cxx=yes
-fi;
-if test -z "$disable_cxx"; then
- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CXX+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CXX="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CXX" && break
-done
-test -n "$CXX" || CXX="none"
-
- ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CXX+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CXX" && break
- done
-fi
-if test -z "$CXX"; then
- ac_ct_CXX=$CXX
- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CXX"; then
- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CXX="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
- echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CXX" && break
-done
-test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
-
- CXX=$ac_ct_CXX
-fi
-
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C++ compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
-GXX=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cxx_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cxx_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cxx_g=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
- else
- CXXFLAGS=
- fi
-fi
-for ac_declaration in \
- ''\
- '#include <stdlib.h>' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_CreateCompress" >&5
+echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_CreateCompress" >&6
+if test $ac_cv_lib_jpeg_jpeg_CreateCompress = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBJPEG 1
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-depcc="$CXX" am_compiler_list=
-
-echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
-if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
- # We make a subdir and do the tests there. Otherwise we can end up
- # making bogus files that we don't know about and never remove. For
- # instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
- mkdir conftest.dir
- # Copy depcomp to subdir because otherwise we won't find it if we're
- # using a relative directory.
- cp "$am_depcomp" conftest.dir
- cd conftest.dir
-
- am_cv_CXX_dependencies_compiler_type=none
- if test "$am_compiler_list" = ""; then
- am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
- fi
- for depmode in $am_compiler_list; do
- # We need to recreate these files for each test, as the compiler may
- # overwrite some of them when testing with obscure command lines.
- # This happens at least with the AIX C compiler.
- echo '#include "conftest.h"' > conftest.c
- echo 'int i;' > conftest.h
- echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
-
- case $depmode in
- nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
- if test "x$enable_dependency_tracking" = xyes; then
- continue
- else
- break
- fi
- ;;
- none) break ;;
- esac
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
- # mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this.
- if depmode=$depmode \
- source=conftest.c object=conftest.o \
- depfile=conftest.Po tmpdepfile=conftest.TPo \
- $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
- grep conftest.h conftest.Po > /dev/null 2>&1 &&
- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
- am_cv_CXX_dependencies_compiler_type=$depmode
- break
- fi
- done
-
- cd ..
- rm -rf conftest.dir
-else
- am_cv_CXX_dependencies_compiler_type=none
-fi
+ LIBS="-ljpeg $LIBS"
fi
-echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
-CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
-
-else
- CXX=none
+ fi
fi
-if test ! -z "$HAVE_ZLIB_H"; then
+if test ! -z "$HAVE_PTHREAD_H"; then
-echo "$as_me:$LINENO: checking for deflate in -lz" >&5
-echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6
-if test "${ac_cv_lib_z_deflate+set}" = set; then
+echo "$as_me:$LINENO: checking for pthread_mutex_lock in -lpthread" >&5
+echo $ECHO_N "checking for pthread_mutex_lock in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_mutex_lock+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz $LIBS"
+LIBS="-lpthread $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5594,11 +5144,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char deflate ();
+char pthread_mutex_lock ();
int
main ()
{
-deflate ();
+pthread_mutex_lock ();
;
return 0;
}
@@ -5615,38 +5165,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_z_deflate=yes
+ ac_cv_lib_pthread_pthread_mutex_lock=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_z_deflate=no
+ac_cv_lib_pthread_pthread_mutex_lock=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5
-echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6
-if test $ac_cv_lib_z_deflate = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_lock" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_lock" >&6
+if test $ac_cv_lib_pthread_pthread_mutex_lock = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBZ 1
+#define HAVE_LIBPTHREAD 1
_ACEOF
- LIBS="-lz $LIBS"
+ LIBS="-lpthread $LIBS"
-else
- HAVE_ZLIB_H=""
fi
- if test ! -z "$HAVE_JPEGLIB_H" -a ! -z "$HAVE_ZLIB_H"; then
-
-echo "$as_me:$LINENO: checking for jpeg_CreateCompress in -ljpeg" >&5
-echo $ECHO_N "checking for jpeg_CreateCompress in -ljpeg... $ECHO_C" >&6
-if test "${ac_cv_lib_jpeg_jpeg_CreateCompress+set}" = set; then
+ echo "$as_me:$LINENO: checking for pthread_mutex_lock in -lpthread" >&5
+echo $ECHO_N "checking for pthread_mutex_lock in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_mutex_lock+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-ljpeg $LIBS"
+LIBS="-lpthread $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5661,11 +5207,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char jpeg_CreateCompress ();
+char pthread_mutex_lock ();
int
main ()
{
-jpeg_CreateCompress ();
+pthread_mutex_lock ();
;
return 0;
}
@@ -5682,59 +5228,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_jpeg_jpeg_CreateCompress=yes
+ ac_cv_lib_pthread_pthread_mutex_lock=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_jpeg_jpeg_CreateCompress=no
+ac_cv_lib_pthread_pthread_mutex_lock=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_CreateCompress" >&5
-echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_CreateCompress" >&6
-if test $ac_cv_lib_jpeg_jpeg_CreateCompress = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBJPEG 1
-_ACEOF
-
- LIBS="-ljpeg $LIBS"
-
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_lock" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_lock" >&6
+if test $ac_cv_lib_pthread_pthread_mutex_lock = yes; then
+ HAVE_LIBPTHREAD="true"
fi
- fi
- if test ! -z "$HAVE_ZLIB_H"; then
- # check for c++, but don't fail if not found
-
-
- if test x$CXX != xnone; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_ZRLE 1
-_ACEOF
-
- if test -z "$CXX"; then
- CCLD="\$(CXX)"
- else
- CCLD="$CXX"
- fi
- fi
- fi
-else
- CXX=none
fi
-if test x$CXX != xnone -a ! -z "$HAVE_ZLIB_H"; then
- HAVE_CXX_TRUE=
- HAVE_CXX_FALSE='#'
+if test ! -z "$HAVE_LIBPTHREAD"; then
+ HAVE_LIBPTHREAD_TRUE=
+ HAVE_LIBPTHREAD_FALSE='#'
else
- HAVE_CXX_TRUE='#'
- HAVE_CXX_FALSE=
+ HAVE_LIBPTHREAD_TRUE='#'
+ HAVE_LIBPTHREAD_FALSE=
fi
-
# Checks for header files.
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
@@ -9590,13 +9111,6 @@ echo "$as_me: error: conditional \"HAVE_LIBPTHREAD\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${HAVE_CXX_TRUE}" && test -z "${HAVE_CXX_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"HAVE_CXX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"HAVE_CXX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${LINUX_TRUE}" && test -z "${LINUX_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"LINUX\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -10202,13 +9716,6 @@ s,@HAVE_X_FALSE@,$HAVE_X_FALSE,;t t
s,@EGREP@,$EGREP,;t t
s,@HAVE_LIBPTHREAD_TRUE@,$HAVE_LIBPTHREAD_TRUE,;t t
s,@HAVE_LIBPTHREAD_FALSE@,$HAVE_LIBPTHREAD_FALSE,;t t
-s,@CXX@,$CXX,;t t
-s,@CXXFLAGS@,$CXXFLAGS,;t t
-s,@ac_ct_CXX@,$ac_ct_CXX,;t t
-s,@CXXDEPMODE@,$CXXDEPMODE,;t t
-s,@HAVE_CXX_TRUE@,$HAVE_CXX_TRUE,;t t
-s,@HAVE_CXX_FALSE@,$HAVE_CXX_FALSE,;t t
-s,@CCLD@,$CCLD,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LINUX_TRUE@,$LINUX_TRUE,;t t
s,@LINUX_FALSE@,$LINUX_FALSE,;t t
diff --git a/configure.ac b/configure.ac
index adbf2b3..1e9e5b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(LibVNCServer, 0.6pre, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.6pre)
-AM_CONFIG_HEADER([config.h])
+AM_CONFIG_HEADER(config.h)
AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
# Checks for programs.
@@ -62,42 +62,17 @@ AC_ARG_WITH(libz,
if test "x$with_zlib" = "xyes" -a "x$with_libz" = "xyes"; then
AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true")
fi
-if test ! -z "$HAVE_PTHREAD_H"; then
- AC_CHECK_LIB(pthread, pthread_mutex_lock)
- AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
-fi
-AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
-AC_ARG_ENABLE(cxx,
- [ --disable-cxx disable use of c++],
- [ disable_cxx=yes],)
-if test -z "$disable_cxx"; then
- AC_CHECK_PROGS(CXX,[g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC],none)
- AC_PROG_CXX
-else
- CXX=none
-fi
if test ! -z "$HAVE_ZLIB_H"; then
AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="")
if test ! -z "$HAVE_JPEGLIB_H" -a ! -z "$HAVE_ZLIB_H"; then
AC_CHECK_LIB(jpeg, jpeg_CreateCompress)
fi
- if test ! -z "$HAVE_ZLIB_H"; then
- # check for c++, but don't fail if not found
- AH_TEMPLATE(HAVE_ZRLE, [Use zrle compression; needs a c++ compiler])
- if test x$CXX != xnone; then
- AC_DEFINE(HAVE_ZRLE)
- if test -z "$CXX"; then
- CCLD="\$(CXX)"
- else
- CCLD="$CXX"
- fi
- fi
- fi
-else
- CXX=none
fi
-AM_CONDITIONAL(HAVE_CXX, test x$CXX != xnone -a ! -z "$HAVE_ZLIB_H")
-AC_SUBST(CCLD)
+if test ! -z "$HAVE_PTHREAD_H"; then
+ AC_CHECK_LIB(pthread, pthread_mutex_lock)
+ AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
+fi
+AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
# Checks for header files.
AC_HEADER_STDC
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
index 0342000..3cc54cf 100644
--- a/contrib/Makefile.in
+++ b/contrib/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -122,6 +120,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/x11vnc.Po ./$(DEPDIR)/zippy.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(x11vnc_SOURCES) $(zippy_SOURCES)
DIST_COMMON = ChangeLog Makefile.am Makefile.in
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 6145225..af8cb28 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -218,6 +216,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/vncev.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = blooptest.c colourmaptest.c example.c fontsel.c mac.c \
pnmshow.c pnmshow24.c regiontest.c simple.c simple15.c \
diff --git a/libvncclient/Makefile.in b/libvncclient/Makefile.in
index 103be2a..a0494ff 100644
--- a/libvncclient/Makefile.in
+++ b/libvncclient/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -126,6 +124,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/sockets.Po ./$(DEPDIR)/vncviewer.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libvncclient_a_SOURCES) $(client_test_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
diff --git a/rfb/rfb.h b/rfb/rfb.h
index 85d23f3..f56e692 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -89,13 +89,13 @@ extern "C"
the library and your application (at least the parts including rfb.h)
with the same support for pthreads. */
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbInitServer rfbInitServerWithPthreadsAndZRLE
#else
#define rfbInitServer rfbInitServerWithPthreadsButWithoutZRLE
#endif
#else
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbInitServer rfbInitServerWithoutPthreadsButWithZRLE
#else
#define rfbInitServer rfbInitServerWithoutPthreadsAndZRLE
@@ -464,7 +464,7 @@ typedef struct _rfbClientRec {
COND(updateCond);
#endif
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
void* zrleData;
#endif
@@ -661,7 +661,7 @@ extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c,rfbBool freeO
extern void defaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
/* zrle.c */
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h);
extern void FreeZrleData(rfbClientPtr cl);
#endif
diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h
index 4dee59e..da34b95 100644
--- a/rfb/rfbproto.h
+++ b/rfb/rfbproto.h
@@ -347,7 +347,7 @@ typedef struct {
#ifdef LIBVNCSERVER_BACKCHANNEL
#define rfbEncodingBackChannel 15
#endif
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingZRLE 16
#endif
diff --git a/rfbserver.c b/rfbserver.c
index 7ce086d..3c6aec8 100644
--- a/rfbserver.c
+++ b/rfbserver.c
@@ -283,7 +283,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl->preferredEncoding = rfbEncodingRaw;
cl->correMaxWidth = 48;
cl->correMaxHeight = 48;
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
cl->zrleData = 0;
#endif
@@ -406,7 +406,7 @@ rfbClientConnectionGone(cl)
if (cl->next)
cl->next->prev = cl->prev;
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
FreeZrleData(cl);
#endif
@@ -843,7 +843,7 @@ rfbProcessClientNormalMessage(cl)
}
break;
#endif
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
case rfbEncodingZRLE:
if (cl->preferredEncoding == -1) {
cl->preferredEncoding = enc;
@@ -1309,7 +1309,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
break;
#endif
#endif
-#ifdef LIBVNCSERVER_HAVE_ZRLE
+#ifdef LIBVNCSERVER_HAVE_LIBZ
case rfbEncodingZRLE:
if (!rfbSendRectEncodingZRLE(cl, x, y, w, h)) {
sraRgnDestroy(updateRegion);
diff --git a/test/Makefile.in b/test/Makefile.in
index b25b33c..bf3e2a8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -109,6 +107,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/tight-1.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = tight-1.c
DIST_COMMON = Makefile.am Makefile.in
diff --git a/vncterm/Makefile.in b/vncterm/Makefile.in
index 7587900..36baf9e 100644
--- a/vncterm/Makefile.in
+++ b/vncterm/Makefile.in
@@ -65,8 +65,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AWK = @AWK@
CC = @CC@
-CCLD = @CCLD@
-CXX = @CXX@
DEPDIR = @DEPDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
PACKAGE = @PACKAGE@
@@ -105,18 +103,18 @@ CONFIG_CLEAN_FILES =
noinst_PROGRAMS = VNCommand$(EXEEXT) example$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
-am__objects_1 = VNConsole.$(OBJEXT)
-@LINUX_TRUE@am_LinuxVNC_OBJECTS = LinuxVNC.$(OBJEXT) $(am__objects_1)
+am__objects_2 = VNConsole.$(OBJEXT)
+@LINUX_TRUE@am_LinuxVNC_OBJECTS = LinuxVNC.$(OBJEXT) $(am__objects_2)
LinuxVNC_OBJECTS = $(am_LinuxVNC_OBJECTS)
LinuxVNC_LDADD = $(LDADD)
LinuxVNC_DEPENDENCIES = ../libvncserver.a
LinuxVNC_LDFLAGS =
-am_VNCommand_OBJECTS = VNCommand.$(OBJEXT) $(am__objects_1)
+am_VNCommand_OBJECTS = VNCommand.$(OBJEXT) $(am__objects_2)
VNCommand_OBJECTS = $(am_VNCommand_OBJECTS)
VNCommand_LDADD = $(LDADD)
VNCommand_DEPENDENCIES = ../libvncserver.a
VNCommand_LDFLAGS =
-am_example_OBJECTS = example.$(OBJEXT) $(am__objects_1)
+am_example_OBJECTS = example.$(OBJEXT) $(am__objects_2)
example_OBJECTS = $(am_example_OBJECTS)
example_LDADD = $(LDADD)
example_DEPENDENCIES = ../libvncserver.a
@@ -133,6 +131,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/VNConsole.Po ./$(DEPDIR)/example.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(LinuxVNC_SOURCES) $(VNCommand_SOURCES) \
$(example_SOURCES)
diff --git a/zrle.c b/zrle.c
new file mode 100644
index 0000000..bd3c9ce
--- /dev/null
+++ b/zrle.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+/*
+ * zrle.c
+ *
+ * Routines to implement Zlib Run-length Encoding (ZRLE).
+ */
+
+#include <rfb/rfb.h>
+#include <zrleoutstream.h>
+
+
+#define GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf) \
+ char *fbptr = (cl->screen->frameBuffer \
+ + (cl->screen->paddedWidthInBytes * ty) \
+ + (tx * (cl->screen->bitsPerPixel / 8))); \
+ \
+ (*cl->translateFn)(cl->translateLookupTable, &cl->screen->rfbServerFormat,\
+ &cl->format, fbptr, (char*)buf, \
+ cl->screen->paddedWidthInBytes, tw, th);
+
+#define EXTRA_ARGS , rfbClientPtr cl
+
+#define BPP 8
+#include <zrleencodetemplate.c>
+#undef BPP
+#define BPP 16
+#include <zrleencodetemplate.c>
+#undef BPP
+#define BPP 32
+#include <zrleencodetemplate.c>
+#define CPIXEL 24A
+#include <zrleencodetemplate.c>
+#undef CPIXEL
+#define CPIXEL 24B
+#include <zrleencodetemplate.c>
+#undef CPIXEL
+#undef BPP
+
+
+/*
+ * zrleBeforeBuf contains pixel data in the client's format. It must be at
+ * least one pixel bigger than the largest tile of pixel data, since the
+ * ZRLE encoding algorithm writes to the position one past the end of the pixel
+ * data.
+ */
+
+static char zrleBeforeBuf[rfbZRLETileWidth * rfbZRLETileHeight * 4 + 4];
+
+
+
+/*
+ * rfbSendRectEncodingZRLE - send a given rectangle using ZRLE encoding.
+ */
+
+
+rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h)
+{
+ zrleOutStream* zos;
+ rfbFramebufferUpdateRectHeader rect;
+ rfbZRLEHeader hdr;
+ int i;
+
+ if (!cl->zrleData)
+ cl->zrleData = zrleOutStreamNew();
+ zos = cl->zrleData;
+ zos->in.ptr = zos->in.start;
+ zos->out.ptr = zos->out.start;
+
+ switch (cl->format.bitsPerPixel) {
+
+ case 8:
+ zrleEncode8( x, y, w, h, zos, zrleBeforeBuf, cl);
+ break;
+
+ case 16:
+ zrleEncode16(x, y, w, h, zos, zrleBeforeBuf, cl);
+ break;
+
+ case 32: {
+ rfbBool fitsInLS3Bytes
+ = ((cl->format.redMax << cl->format.redShift) < (1<<24) &&
+ (cl->format.greenMax << cl->format.greenShift) < (1<<24) &&
+ (cl->format.blueMax << cl->format.blueShift) < (1<<24));
+
+ rfbBool fitsInMS3Bytes = (cl->format.redShift > 7 &&
+ cl->format.greenShift > 7 &&
+ cl->format.blueShift > 7);
+
+ if ((fitsInLS3Bytes && !cl->format.bigEndian) ||
+ (fitsInMS3Bytes && cl->format.bigEndian))
+ {
+ zrleEncode24A(x, y, w, h, zos, zrleBeforeBuf, cl);
+ }
+ else if ((fitsInLS3Bytes && cl->format.bigEndian) ||
+ (fitsInMS3Bytes && !cl->format.bigEndian))
+ {
+ zrleEncode24B(x, y, w, h, zos, zrleBeforeBuf, cl);
+ }
+ else
+ {
+ zrleEncode32(x, y, w, h, zos, zrleBeforeBuf, cl);
+ }
+ }
+ break;
+ }
+
+ cl->rfbRectanglesSent[rfbEncodingZRLE]++;
+ cl->rfbBytesSent[rfbEncodingZRLE] += (sz_rfbFramebufferUpdateRectHeader
+ + sz_rfbZRLEHeader + ZRLE_BUFFER_LENGTH(&zos->out));
+
+ if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader
+ > UPDATE_BUF_SIZE)
+ {
+ if (!rfbSendUpdateBuf(cl))
+ return FALSE;
+ }
+
+ rect.r.x = Swap16IfLE(x);
+ rect.r.y = Swap16IfLE(y);
+ rect.r.w = Swap16IfLE(w);
+ rect.r.h = Swap16IfLE(h);
+ rect.encoding = Swap32IfLE(rfbEncodingZRLE);
+
+ memcpy(cl->updateBuf+cl->ublen, (char *)&rect,
+ sz_rfbFramebufferUpdateRectHeader);
+ cl->ublen += sz_rfbFramebufferUpdateRectHeader;
+
+ hdr.length = Swap32IfLE(ZRLE_BUFFER_LENGTH(&zos->out));
+
+ memcpy(cl->updateBuf+cl->ublen, (char *)&hdr, sz_rfbZRLEHeader);
+ cl->ublen += sz_rfbZRLEHeader;
+
+ /* copy into updateBuf and send from there. Maybe should send directly? */
+
+ for (i = 0; i < ZRLE_BUFFER_LENGTH(&zos->out);) {
+
+ int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen;
+
+ if (i + bytesToCopy > ZRLE_BUFFER_LENGTH(&zos->out)) {
+ bytesToCopy = ZRLE_BUFFER_LENGTH(&zos->out) - i;
+ }
+
+ memcpy(cl->updateBuf+cl->ublen, (uint8_t*)zos->out.start + i, bytesToCopy);
+
+ cl->ublen += bytesToCopy;
+ i += bytesToCopy;
+
+ if (cl->ublen == UPDATE_BUF_SIZE) {
+ if (!rfbSendUpdateBuf(cl))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+void FreeZrleData(rfbClientPtr cl)
+{
+ if (cl->zrleData)
+ zrleOutStreamFree(cl->zrleData);
+ cl->zrleData = NULL;
+}
+
diff --git a/zrleencodetemplate.c b/zrleencodetemplate.c
new file mode 100644
index 0000000..f3147c1
--- /dev/null
+++ b/zrleencodetemplate.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+/*
+ * Before including this file, you must define a number of CPP macros.
+ *
+ * BPP should be 8, 16 or 32 depending on the bits per pixel.
+ * GET_IMAGE_INTO_BUF should be some code which gets a rectangle of pixel data
+ * into the given buffer. EXTRA_ARGS can be defined to pass any other
+ * arguments needed by GET_IMAGE_INTO_BUF.
+ *
+ * Note that the buf argument to ZRLE_ENCODE needs to be at least one pixel
+ * bigger than the largest tile of pixel data, since the ZRLE encoding
+ * algorithm writes to the position one past the end of the pixel data.
+ */
+
+#include <zrleoutstream.h>
+#include <zrlepalettehelper.h>
+#include <assert.h>
+
+/* __RFB_CONCAT2 concatenates its two arguments. __RFB_CONCAT2E does the same
+ but also expands its arguments if they are macros */
+
+#ifndef __RFB_CONCAT2E
+#define __RFB_CONCAT2(a,b) a##b
+#define __RFB_CONCAT2E(a,b) __RFB_CONCAT2(a,b)
+#endif
+
+#ifdef CPIXEL
+#define PIXEL_T __RFB_CONCAT2E(zrle_U,BPP)
+#define zrleOutStreamWRITE_PIXEL __RFB_CONCAT2E(zrleOutStreamWriteOpaque,CPIXEL)
+#define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,CPIXEL)
+#define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,CPIXEL)
+#define BPPOUT 24
+#else
+#define PIXEL_T __RFB_CONCAT2E(zrle_U,BPP)
+#define zrleOutStreamWRITE_PIXEL __RFB_CONCAT2E(zrleOutStreamWriteOpaque,BPP)
+#define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,BPP)
+#define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,BPP)
+#define BPPOUT BPP
+#endif
+
+#ifndef ZRLE_ONCE
+#define ZRLE_ONCE
+
+static const int bitsPerPackedPixel[] = {
+ 0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+static zrlePaletteHelper paletteHelper;
+
+#endif /* ZRLE_ONCE */
+
+void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, zrleOutStream* os);
+
+void ZRLE_ENCODE (int x, int y, int w, int h,
+ zrleOutStream* os, void* buf
+ EXTRA_ARGS
+ )
+{
+ int ty;
+ for (ty = y; ty < y+h; ty += rfbZRLETileHeight) {
+ int tx, th = rfbZRLETileHeight;
+ if (th > y+h-ty) th = y+h-ty;
+ for (tx = x; tx < x+w; tx += rfbZRLETileWidth) {
+ int tw = rfbZRLETileWidth;
+ if (tw > x+w-tx) tw = x+w-tx;
+
+ GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf);
+
+ ZRLE_ENCODE_TILE((PIXEL_T*)buf, tw, th, os);
+ }
+ }
+ zrleOutStreamFlush(os);
+}
+
+
+void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, zrleOutStream* os)
+{
+ /* First find the palette and the number of runs */
+
+ zrlePaletteHelper *ph;
+
+ int runs = 0;
+ int singlePixels = 0;
+
+ rfbBool useRle;
+ rfbBool usePalette;
+
+ int estimatedBytes;
+ int plainRleBytes;
+ int i;
+
+ PIXEL_T* ptr = data;
+ PIXEL_T* end = ptr + h * w;
+ *end = ~*(end-1); /* one past the end is different so the while loop ends */
+
+ ph = &paletteHelper;
+ zrlePaletteHelperInit(ph);
+
+ while (ptr < end) {
+ PIXEL_T pix = *ptr;
+ if (*++ptr != pix) {
+ singlePixels++;
+ } else {
+ while (*++ptr == pix) ;
+ runs++;
+ }
+ zrlePaletteHelperInsert(ph, pix);
+ }
+
+ /* Solid tile is a special case */
+
+ if (ph->size == 1) {
+ zrleOutStreamWriteU8(os, 1);
+ zrleOutStreamWRITE_PIXEL(os, ph->palette[0]);
+ return;
+ }
+
+ // Try to work out whether to use RLE and/or a palette. We do this by
+ // estimating the number of bytes which will be generated and picking the
+ // method which results in the fewest bytes. Of course this may not result
+ // in the fewest bytes after compression...
+
+ useRle = FALSE;
+ usePalette = FALSE;
+
+ estimatedBytes = w * h * (BPPOUT/8); // start assuming raw
+
+ plainRleBytes = ((BPPOUT/8)+1) * (runs + singlePixels);
+
+ if (plainRleBytes < estimatedBytes) {
+ useRle = TRUE;
+ estimatedBytes = plainRleBytes;
+ }
+
+ if (ph->size < 128) {
+ int paletteRleBytes = (BPPOUT/8) * ph->size + 2 * runs + singlePixels;
+
+ if (paletteRleBytes < estimatedBytes) {
+ useRle = TRUE;
+ usePalette = TRUE;
+ estimatedBytes = paletteRleBytes;
+ }
+
+ if (ph->size < 17) {
+ int packedBytes = ((BPPOUT/8) * ph->size +
+ w * h * bitsPerPackedPixel[ph->size-1] / 8);
+
+ if (packedBytes < estimatedBytes) {
+ useRle = FALSE;
+ usePalette = TRUE;
+ estimatedBytes = packedBytes;
+ }
+ }
+ }
+
+ if (!usePalette) ph->size = 0;
+
+ zrleOutStreamWriteU8(os, (useRle ? 128 : 0) | ph->size);
+
+ for (i = 0; i < ph->size; i++) {
+ zrleOutStreamWRITE_PIXEL(os, ph->palette[i]);
+ }
+
+ if (useRle) {
+
+ PIXEL_T* ptr = data;
+ PIXEL_T* end = ptr + w * h;
+ PIXEL_T* runStart;
+ PIXEL_T pix;
+ while (ptr < end) {
+ int len;
+ runStart = ptr;
+ pix = *ptr++;
+ while (*ptr == pix && ptr < end)
+ ptr++;
+ len = ptr - runStart;
+ if (len <= 2 && usePalette) {
+ int index = zrlePaletteHelperLookup(ph, pix);
+ if (len == 2)
+ zrleOutStreamWriteU8(os, index);
+ zrleOutStreamWriteU8(os, index);
+ continue;
+ }
+ if (usePalette) {
+ int index = zrlePaletteHelperLookup(ph, pix);
+ zrleOutStreamWriteU8(os, index | 128);
+ } else {
+ zrleOutStreamWRITE_PIXEL(os, pix);
+ }
+ len -= 1;
+ while (len >= 255) {
+ zrleOutStreamWriteU8(os, 255);
+ len -= 255;
+ }
+ zrleOutStreamWriteU8(os, len);
+ }
+
+ } else {
+
+ // no RLE
+
+ if (usePalette) {
+ int bppp;
+ PIXEL_T* ptr = data;
+
+ // packed pixels
+
+ assert (ph->size < 17);
+
+ bppp = bitsPerPackedPixel[ph->size-1];
+
+ for (i = 0; i < h; i++) {
+ zrle_U8 nbits = 0;
+ zrle_U8 byte = 0;
+
+ PIXEL_T* eol = ptr + w;
+
+ while (ptr < eol) {
+ PIXEL_T pix = *ptr++;
+ zrle_U8 index = zrlePaletteHelperLookup(ph, pix);
+ byte = (byte << bppp) | index;
+ nbits += bppp;
+ if (nbits >= 8) {
+ zrleOutStreamWriteU8(os, byte);
+ nbits = 0;
+ }
+ }
+ if (nbits > 0) {
+ byte <<= 8 - nbits;
+ zrleOutStreamWriteU8(os, byte);
+ }
+ }
+ } else {
+
+ // raw
+
+#ifdef CPIXEL
+ PIXEL_T *ptr;
+ for (ptr = data; ptr < data+w*h; ptr++) {
+ zrleOutStreamWRITE_PIXEL(os, *ptr);
+ }
+#else
+ zrleOutStreamWriteBytes(os, (zrle_U8 *)data, w*h*(BPP/8));
+#endif
+ }
+ }
+}
+
+#undef PIXEL_T
+#undef zrleOutStreamWRITE_PIXEL
+#undef ZRLE_ENCODE
+#undef ZRLE_ENCODE_TILE
+#undef BPPOUT
diff --git a/zrleoutstream.c b/zrleoutstream.c
new file mode 100644
index 0000000..47cc164
--- /dev/null
+++ b/zrleoutstream.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+#include <zrleoutstream.h>
+#include <stdlib.h>
+
+#define ZRLE_IN_BUFFER_SIZE 16384
+#define ZRLE_OUT_BUFFER_SIZE 1024
+#undef ZRLE_DEBUG
+
+static rfbBool zrleBufferAlloc(zrleBuffer *buffer, int size)
+{
+ buffer->ptr = buffer->start = malloc(size);
+ if (buffer->start == NULL) {
+ buffer->end = NULL;
+ return FALSE;
+ }
+
+ buffer->end = buffer->start + size;
+
+ return TRUE;
+}
+
+static void zrleBufferFree(zrleBuffer *buffer)
+{
+ if (buffer->start)
+ free(buffer->start);
+ buffer->start = buffer->ptr = buffer->end = NULL;
+}
+
+static rfbBool zrleBufferGrow(zrleBuffer *buffer, int size)
+{
+ int offset;
+
+ size += buffer->end - buffer->start;
+ offset = ZRLE_BUFFER_LENGTH (buffer);
+
+ buffer->start = realloc(buffer->start, size);
+ if (!buffer->start) {
+ return FALSE;
+ }
+
+ buffer->end = buffer->start + size;
+ buffer->ptr = buffer->start + offset;
+
+ return TRUE;
+}
+
+zrleOutStream *zrleOutStreamNew(void)
+{
+ zrleOutStream *os;
+
+ os = malloc(sizeof(zrleOutStream));
+ if (os == NULL)
+ return NULL;
+
+ if (!zrleBufferAlloc(&os->in, ZRLE_IN_BUFFER_SIZE)) {
+ free(os);
+ return NULL;
+ }
+
+ if (!zrleBufferAlloc(&os->out, ZRLE_OUT_BUFFER_SIZE)) {
+ zrleBufferFree(&os->in);
+ free(os);
+ return NULL;
+ }
+
+ os->zs.zalloc = Z_NULL;
+ os->zs.zfree = Z_NULL;
+ os->zs.opaque = Z_NULL;
+ if (deflateInit(&os->zs, Z_DEFAULT_COMPRESSION) != Z_OK) {
+ zrleBufferFree(&os->in);
+ free(os);
+ return NULL;
+ }
+
+ return os;
+}
+
+void zrleOutStreamFree (zrleOutStream *os)
+{
+ deflateEnd(&os->zs);
+ zrleBufferFree(&os->in);
+ zrleBufferFree(&os->out);
+ free(os);
+}
+
+rfbBool zrleOutStreamFlush(zrleOutStream *os)
+{
+ os->zs.next_in = os->in.start;
+ os->zs.avail_in = ZRLE_BUFFER_LENGTH (&os->in);
+
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamFlush: avail_in %d\n", os->zs.avail_in);
+#endif
+
+ while (os->zs.avail_in != 0) {
+ do {
+ int ret;
+
+ if (os->out.ptr >= os->out.end &&
+ !zrleBufferGrow(&os->out, os->out.end - os->out.start)) {
+ rfbLog("zrleOutStreamFlush: failed to grow output buffer\n");
+ return FALSE;
+ }
+
+ os->zs.next_out = os->out.ptr;
+ os->zs.avail_out = os->out.end - os->out.ptr;
+
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamFlush: calling deflate, avail_in %d, avail_out %d\n",
+ os->zs.avail_in, os->zs.avail_out);
+#endif
+
+ if ((ret = deflate(&os->zs, Z_SYNC_FLUSH)) != Z_OK) {
+ rfbLog("zrleOutStreamFlush: deflate failed with error code %d\n", ret);
+ return FALSE;
+ }
+
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamFlush: after deflate: %d bytes\n",
+ os->zs.next_out - os->out.ptr);
+#endif
+
+ os->out.ptr = os->zs.next_out;
+ } while (os->zs.avail_out == 0);
+ }
+
+ os->in.ptr = os->in.start;
+
+ return TRUE;
+}
+
+static int zrleOutStreamOverrun(zrleOutStream *os,
+ int size)
+{
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamOverrun\n");
+#endif
+
+ while (os->in.end - os->in.ptr < size && os->in.ptr > os->in.start) {
+ os->zs.next_in = os->in.start;
+ os->zs.avail_in = ZRLE_BUFFER_LENGTH (&os->in);
+
+ do {
+ int ret;
+
+ if (os->out.ptr >= os->out.end &&
+ !zrleBufferGrow(&os->out, os->out.end - os->out.start)) {
+ rfbLog("zrleOutStreamOverrun: failed to grow output buffer\n");
+ return FALSE;
+ }
+
+ os->zs.next_out = os->out.ptr;
+ os->zs.avail_out = os->out.end - os->out.ptr;
+
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamOverrun: calling deflate, avail_in %d, avail_out %d\n",
+ os->zs.avail_in, os->zs.avail_out);
+#endif
+
+ if ((ret = deflate(&os->zs, 0)) != Z_OK) {
+ rfbLog("zrleOutStreamOverrun: deflate failed with error code %d\n", ret);
+ return 0;
+ }
+
+#ifdef ZRLE_DEBUG
+ rfbLog("zrleOutStreamOverrun: after deflate: %d bytes\n",
+ os->zs.next_out - os->out.ptr);
+#endif
+
+ os->out.ptr = os->zs.next_out;
+ } while (os->zs.avail_out == 0);
+
+ /* output buffer not full */
+
+ if (os->zs.avail_in == 0) {
+ os->in.ptr = os->in.start;
+ } else {
+ /* but didn't consume all the data? try shifting what's left to the
+ * start of the buffer.
+ */
+ rfbLog("zrleOutStreamOverrun: out buf not full, but in data not consumed\n");
+ memmove(os->in.start, os->zs.next_in, os->in.ptr - os->zs.next_in);
+ os->in.ptr -= os->zs.next_in - os->in.start;
+ }
+ }
+
+ if (size > os->in.end - os->in.ptr)
+ size = os->in.end - os->in.ptr;
+
+ return size;
+}
+
+static inline int zrleOutStreamCheck(zrleOutStream *os,
+ int size)
+{
+ if (os->in.ptr + size > os->in.end) {
+ return zrleOutStreamOverrun(os, size);
+ }
+ return size;
+}
+
+void zrleOutStreamWriteBytes(zrleOutStream *os,
+ const zrle_U8 *data,
+ int length)
+{
+ const zrle_U8* dataEnd = data + length;
+ while (data < dataEnd) {
+ int n = zrleOutStreamCheck(os, dataEnd - data);
+ memcpy(os->in.ptr, data, n);
+ os->in.ptr += n;
+ data += n;
+ }
+}
+
+void zrleOutStreamWriteU8(zrleOutStream *os, zrle_U8 u)
+{
+ zrleOutStreamCheck(os, 1);
+ *os->in.ptr++ = u;
+}
+
+void zrleOutStreamWriteOpaque8(zrleOutStream *os, zrle_U8 u)
+{
+ zrleOutStreamCheck(os, 1);
+ *os->in.ptr++ = u;
+}
+
+void zrleOutStreamWriteOpaque16 (zrleOutStream *os, zrle_U16 u)
+{
+ zrleOutStreamCheck(os, 2);
+ *os->in.ptr++ = ((zrle_U8*)&u)[0];
+ *os->in.ptr++ = ((zrle_U8*)&u)[1];
+}
+
+void zrleOutStreamWriteOpaque32 (zrleOutStream *os, zrle_U32 u)
+{
+ zrleOutStreamCheck(os, 4);
+ *os->in.ptr++ = ((zrle_U8*)&u)[0];
+ *os->in.ptr++ = ((zrle_U8*)&u)[1];
+ *os->in.ptr++ = ((zrle_U8*)&u)[2];
+ *os->in.ptr++ = ((zrle_U8*)&u)[3];
+}
+
+void zrleOutStreamWriteOpaque24A(zrleOutStream *os, zrle_U32 u)
+{
+ zrleOutStreamCheck(os, 3);
+ *os->in.ptr++ = ((zrle_U8*)&u)[0];
+ *os->in.ptr++ = ((zrle_U8*)&u)[1];
+ *os->in.ptr++ = ((zrle_U8*)&u)[2];
+}
+
+void zrleOutStreamWriteOpaque24B(zrleOutStream *os, zrle_U32 u)
+{
+ zrleOutStreamCheck(os, 3);
+ *os->in.ptr++ = ((zrle_U8*)&u)[1];
+ *os->in.ptr++ = ((zrle_U8*)&u)[2];
+ *os->in.ptr++ = ((zrle_U8*)&u)[3];
+}
diff --git a/zrleoutstream.h b/zrleoutstream.h
new file mode 100644
index 0000000..cc8f770
--- /dev/null
+++ b/zrleoutstream.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+#ifndef __ZRLE_OUT_STREAM_H__
+#define __ZRLE_OUT_STREAM_H__
+
+#include <zlib.h>
+#include <zrletypes.h>
+#include <rfb/rfb.h>
+
+typedef struct {
+ zrle_U8 *start;
+ zrle_U8 *ptr;
+ zrle_U8 *end;
+} zrleBuffer;
+
+typedef struct {
+ zrleBuffer in;
+ zrleBuffer out;
+
+ z_stream zs;
+} zrleOutStream;
+
+#define ZRLE_BUFFER_LENGTH(b) ((b)->ptr - (b)->start)
+
+zrleOutStream *zrleOutStreamNew (void);
+void zrleOutStreamFree (zrleOutStream *os);
+rfbBool zrleOutStreamFlush (zrleOutStream *os);
+void zrleOutStreamWriteBytes (zrleOutStream *os,
+ const zrle_U8 *data,
+ int length);
+void zrleOutStreamWriteU8 (zrleOutStream *os,
+ zrle_U8 u);
+void zrleOutStreamWriteOpaque8 (zrleOutStream *os,
+ zrle_U8 u);
+void zrleOutStreamWriteOpaque16 (zrleOutStream *os,
+ zrle_U16 u);
+void zrleOutStreamWriteOpaque32 (zrleOutStream *os,
+ zrle_U32 u);
+void zrleOutStreamWriteOpaque24A(zrleOutStream *os,
+ zrle_U32 u);
+void zrleOutStreamWriteOpaque24B(zrleOutStream *os,
+ zrle_U32 u);
+
+#endif /* __ZRLE_OUT_STREAM_H__ */
diff --git a/zrlepalettehelper.c b/zrlepalettehelper.c
new file mode 100644
index 0000000..70cafb4
--- /dev/null
+++ b/zrlepalettehelper.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+#include <zrlepalettehelper.h>
+#include <assert.h>
+#include <string.h>
+
+#define ZRLE_HASH(pix) (((pix) ^ ((pix) >> 17)) & 4095)
+
+void zrlePaletteHelperInit(zrlePaletteHelper *helper)
+{
+ memset(helper->palette, 0, sizeof(helper->palette));
+ memset(helper->index, 255, sizeof(helper->index));
+ memset(helper->key, 0, sizeof(helper->key));
+ helper->size = 0;
+}
+
+void zrlePaletteHelperInsert(zrlePaletteHelper *helper, zrle_U32 pix)
+{
+ if (helper->size < ZRLE_PALETTE_MAX_SIZE) {
+ int i = ZRLE_HASH(pix);
+
+ while (helper->index[i] != 255 && helper->key[i] != pix)
+ i++;
+ if (helper->index[i] != 255) return;
+
+ helper->index[i] = helper->size;
+ helper->key[i] = pix;
+ helper->palette[helper->size] = pix;
+ }
+ helper->size++;
+}
+
+int zrlePaletteHelperLookup(zrlePaletteHelper *helper, zrle_U32 pix)
+{
+ int i = ZRLE_HASH(pix);
+
+ assert(helper->size <= ZRLE_PALETTE_MAX_SIZE);
+
+ while (helper->index[i] != 255 && helper->key[i] != pix)
+ i++;
+ if (helper->index[i] != 255) return helper->index[i];
+
+ return -1;
+}
diff --git a/zrlepalettehelper.h b/zrlepalettehelper.h
new file mode 100644
index 0000000..c6723c9
--- /dev/null
+++ b/zrlepalettehelper.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+/*
+ * The PaletteHelper class helps us build up the palette from pixel data by
+ * storing a reverse index using a simple hash-table
+ */
+
+#ifndef __ZRLE_PALETTE_HELPER_H__
+#define __ZRLE_PALETTE_HELPER_H__
+
+#include <zrletypes.h>
+
+#define ZRLE_PALETTE_MAX_SIZE 127
+
+typedef struct {
+ zrle_U32 palette[ZRLE_PALETTE_MAX_SIZE];
+ zrle_U8 index[ZRLE_PALETTE_MAX_SIZE + 4096];
+ zrle_U32 key[ZRLE_PALETTE_MAX_SIZE + 4096];
+ int size;
+} zrlePaletteHelper;
+
+void zrlePaletteHelperInit (zrlePaletteHelper *helper);
+void zrlePaletteHelperInsert(zrlePaletteHelper *helper,
+ zrle_U32 pix);
+int zrlePaletteHelperLookup(zrlePaletteHelper *helper,
+ zrle_U32 pix);
+
+#endif /* __ZRLE_PALETTE_HELPER_H__ */
diff --git a/zrletypes.h b/zrletypes.h
new file mode 100644
index 0000000..0df42c9
--- /dev/null
+++ b/zrletypes.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+#ifndef __ZRLE_TYPES_H__
+#define __ZRLE_TYPES_H__
+
+typedef unsigned char zrle_U8;
+typedef unsigned short zrle_U16;
+typedef unsigned int zrle_U32;
+typedef signed char zrle_S8;
+typedef signed short zrle_S16;
+typedef signed int zrle_S32;
+
+#endif /* __ZRLE_TYPES_H__ */