From 6df29db3df348b2d53a36628305e0f2a723e7980 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sun, 29 Jan 2017 18:33:32 +0100 Subject: Fix vncev example compilation on Windows --- examples/vncev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/vncev.c b/examples/vncev.c index b185746..4051d2b 100644 --- a/examples/vncev.c +++ b/examples/vncev.c @@ -5,10 +5,11 @@ #ifdef __STRICT_ANSI__ #define _BSD_SOURCE #endif +#include #include #include #include -#ifndef __MINGW32__ +#if LIBVNCSERVER_HAVE_SYS_SOCKET_H #include #endif #include -- cgit v1.2.3 From fe943395873c6cbfdfa0eadb8a5d13f2c95e8614 Mon Sep 17 00:00:00 2001 From: Bert van Hall Date: Wed, 8 Feb 2017 17:53:58 +0100 Subject: drop autotools Since autotools officially is no longer supported (see various github issues), drop the related infrastructure to stop tempting people to use it for building. Signed-off-by: Bert van Hall --- LibVNCServer.spec.in | 97 ------ Makefile.am | 28 -- autogen.sh | 4 - client_examples/Makefile.am | 38 --- configure.ac | 599 --------------------------------- examples/Makefile.am | 27 -- examples/android/Makefile.am | 7 - libvncclient.pc.in | 14 - libvncclient/Makefile.am | 29 -- libvncserver-config.in | 78 ----- libvncserver.pc.in | 14 - libvncserver/Makefile.am | 80 ----- m4/.gitignore | 1 - m4/ax_prefix_config_h.m4 | 203 ----------- m4/ax_type_socklen_t.m4 | 61 ---- m4/libgcrypt.m4 | 123 ------- test/Makefile.am | 28 -- webclients/Makefile.am | 4 - webclients/java-applet/Makefile.am | 5 - webclients/java-applet/ssl/Makefile.am | 2 - 20 files changed, 1442 deletions(-) delete mode 100755 LibVNCServer.spec.in delete mode 100644 Makefile.am delete mode 100755 autogen.sh delete mode 100644 client_examples/Makefile.am delete mode 100644 configure.ac delete mode 100644 examples/Makefile.am delete mode 100644 examples/android/Makefile.am delete mode 100644 libvncclient.pc.in delete mode 100644 libvncclient/Makefile.am delete mode 100644 libvncserver-config.in delete mode 100644 libvncserver.pc.in delete mode 100644 libvncserver/Makefile.am delete mode 100644 m4/.gitignore delete mode 100644 m4/ax_prefix_config_h.m4 delete mode 100644 m4/ax_type_socklen_t.m4 delete mode 100644 m4/libgcrypt.m4 delete mode 100644 test/Makefile.am delete mode 100644 webclients/Makefile.am delete mode 100644 webclients/java-applet/Makefile.am delete mode 100644 webclients/java-applet/ssl/Makefile.am (limited to 'examples') diff --git a/LibVNCServer.spec.in b/LibVNCServer.spec.in deleted file mode 100755 index 13fe351..0000000 --- a/LibVNCServer.spec.in +++ /dev/null @@ -1,97 +0,0 @@ -# Note that this is NOT a relocatable package -Name: @PACKAGE@ -Version: @VERSION@ -Release: 2 -Summary: a library to make writing a vnc server easy -Copyright: GPL -Group: Libraries/Network -Packager: Johannes.Schindelin -Source: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot - -%description -LibVNCServer makes writing a VNC server (or more correctly, a program -exporting a framebuffer via the Remote Frame Buffer protocol) easy. - -It is based on OSXvnc, which in turn is based on the original Xvnc by -ORL, later AT&T research labs in UK. - -It hides the programmer from the tedious task of managing clients and -compression schemata. - -LibVNCServer was put together and is (actively ;-) maintained by -Johannes Schindelin - -%package devel -Requires: %{name} = %{version} -Summary: Static Libraries and Header Files for LibVNCServer -Group: Libraries/Network -Requires: %{name} = %{version} - -%description devel -Static Libraries and Header Files for LibVNCServer. - -%package x11vnc -Requires: %{name} = %{version} -Summary: VNC server for the current X11 session -Group: User Interface/X -Requires: %{name} = %{version} - -%description x11vnc -x11vnc is to X Window System what WinVNC is to Windows, i.e. a server -which serves the current X Window System desktop via RFB (VNC) -protocol to the user. - -Based on the ideas of x0rfbserver and on LibVNCServer, it has evolved -into a versatile and performant while still easy to use program. - -%prep -%setup -n %{name}-%{version} - -%build -# CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} -%configure -make - -%install -[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} -# make install prefix=%{buildroot}%{_prefix} -%makeinstall includedir="%{buildroot}%{_includedir}/rfb" - -%{__install} -d -m0755 %{buildroot}%{_datadir}/x11vnc/classes -%{__install} webclients/VncViewer.jar webclients/index.vnc \ - %{buildroot}%{_datadir}/x11vnc/classes - -%clean -[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} - -%pre -%post -%preun -%postun - -%files -%defattr(-,root,root) -%doc README INSTALL AUTHORS ChangeLog NEWS TODO -%{_bindir}/LinuxVNC -%{_bindir}/libvncserver-config -%{_libdir}/libvncclient.* -%{_libdir}/libvncserver.* - -%files devel -%defattr(-,root,root) -%{_includedir}/rfb/* - -%files x11vnc -%defattr(-,root,root) -%{_bindir}/x11vnc -%{_mandir}/man1/x11vnc.1* -%{_datadir}/x11vnc/classes - -%changelog -* Fri Aug 19 2005 Alberto Lusiani release 2 -- create separate package for x11vnc to prevent conflicts with x11vnc rpm -- create devel package, needed to compile but not needed for running -* Sun Feb 9 2003 Johannes Schindelin -- created libvncserver.spec.in - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index a7bc64d..0000000 --- a/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS=libvncserver examples libvncclient webclients client_examples test -DIST_SUBDIRS=libvncserver examples libvncclient webclients client_examples test -EXTRA_DIST = CMakeLists.txt rfb/rfbconfig.h.cmake - -bin_SCRIPTS = libvncserver-config - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libvncserver.pc libvncclient.pc - -includedir=$(prefix)/include/rfb - -include_HEADERS=rfb/rfb.h rfb/rfbconfig.h rfb/rfbproto.h \ - rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h - -$(PACKAGE)-$(VERSION).tar.gz: dist - -if HAVE_RPM -# Rule to build RPM distribution package -rpm: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).spec - cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@ - rpmbuild -ba $(PACKAGE).spec -endif - -t: - $(MAKE) -C test test - diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 2437158..0000000 --- a/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -autoreconf -fiv && -./configure "$@" diff --git a/client_examples/Makefile.am b/client_examples/Makefile.am deleted file mode 100644 index 9cb2c32..0000000 --- a/client_examples/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = ../libvncclient/libvncclient.la @WSOCKLIB@ - -if WITH_FFMPEG -FFMPEG_HOME=@with_ffmpeg@ - -if HAVE_MP3LAME -MP3LAME_LIB=-lmp3lame -endif - -vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec -I$(FFMPEG_HOME)/libavutil -vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm - -FFMPEG_CLIENT=vnc2mpg -endif - -if HAVE_LIBSDL -SDLVIEWER=SDLvncviewer - -SDLvncviewer_CFLAGS=$(SDL_CFLAGS) -SDLvncviewer_SOURCES=SDLvncviewer.c scrap.c scrap.h - -# thanks to autoconf, this looks ugly -SDLvncviewer_LDADD=$(LDADD) $(SDL_LIBS) -endif - -if HAVE_LIBGTK -GTKVIEWER=gtkvncviewer -gtkvncviewer_SOURCES=gtkvncviewer.c -gtkvncviewer_CFLAGS=$(GTK_CFLAGS) -gtkvncviewer_LDADD=$(LDADD) $(GTK_LIBS) -endif - - -noinst_PROGRAMS=ppmtest $(SDLVIEWER) $(GTKVIEWER) $(FFMPEG_CLIENT) backchannel - - - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index f13edb4..0000000 --- a/configure.ac +++ /dev/null @@ -1,599 +0,0 @@ -# Process this file with autoconf to produce a configure script. -AC_INIT(LibVNCServer, 0.9.11, https://github.com/LibVNC/libvncserver) -AM_INIT_AUTOMAKE([subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(rfbconfig.h) -AX_PREFIX_CONFIG_H([rfb/rfbconfig.h]) -AC_CONFIG_MACRO_DIR([m4]) - - -# set detailed version info -AC_DEFINE(VERSION_MAJOR, 0, LibVNCServer major version) -AC_DEFINE(VERSION_MINOR, 9, LibVNCServer minor version) -AC_DEFINE(VERSION_PATCHLEVEL, 11, LibVNCServer patchlevel) - -# Checks for programs. -AC_PROG_CC -AM_PROG_CC_C_O -if test -z "$CC"; then - CCLD="\$(CC)" -else - CCLD="$CC" -fi -test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall" -AC_PROG_MAKE_SET -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL -AC_CHECK_TOOL([AR], [ar], [/usr/bin/ar], - [$PATH:/usr/ccs/bin]) - -# Options -AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol]) -AC_ARG_WITH(tightvnc-filetransfer, - [ --without-tightvnc-filetransfer disable TightVNC file transfer protocol], - , [ with_tightvnc_filetransfer=yes ]) -# AC_DEFINE moved to after libpthread check. - -# WebSockets support -AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false") -if test "x$HAVE_B64_IN_LIBC" != "xtrue"; then - AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64_IN_LIBRESOLV="true", HAVE_B64_IN_LIBRESOLV="false") - if test "x$HAVE_B64_IN_LIBRESOLV" = "xtrue"; then - RESOLV_LIB="-lresolv" - HAVE_B64="true" - fi -else - HAVE_B64="true" -fi -AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support]) -AC_ARG_WITH(websockets, - [ --without-websockets disable WebSockets support], - , [ with_websockets=yes ]) -# AC_DEFINE moved to after libresolve check. - -AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer]) -AC_ARG_WITH(24bpp, - [ --without-24bpp disable 24 bpp framebuffers], - , [ with_24bpp=yes ]) -if test "x$with_24bpp" = "xyes"; then - AC_DEFINE(ALLOW24BPP) -fi -AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)]) -AC_ARG_WITH(ffmpeg, - [ --with-ffmpeg=dir set ffmpeg home directory],,) -AC_SUBST(with_ffmpeg) -AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg") -if test ! -z "$with_ffmpeg"; then - AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" ) -fi -AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true") - -PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd], [with_systemd=1], [with_systemd=0]) -AM_CONDITIONAL([WITH_SYSTEMD], [test $with_systemd -eq 1]) - -# Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc. -# before it seemed to be inside the with_jpeg conditional. -AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true") - -# set some ld -R nonsense -# -uname_s=`(uname -s) 2>/dev/null` -ld_minus_R="yes" -if test "x$uname_s" = "xHP-UX"; then - ld_minus_R="no" -elif test "x$uname_s" = "xOSF1"; then - ld_minus_R="no" -elif test "x$uname_s" = "xDarwin"; then - ld_minus_R="no" -fi - -# Check for OpenSSL -AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present]) -AC_ARG_WITH(crypt, -[ --without-crypt disable support for libcrypt],,) -if test "x$with_crypt" != "xno"; then - AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true") - if test -z "$HAVE_LIBC_CRYPT"; then - AC_CHECK_LIB(crypt, crypt, - CRYPT_LIBS="-lcrypt" - [AC_DEFINE(HAVE_LIBCRYPT)], ,) - fi -fi -AC_SUBST(CRYPT_LIBS) - -# some OS's need both -lssl and -lcrypto on link line: -AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present]) -AC_ARG_WITH(crypto, -[ --without-crypto disable support for openssl libcrypto],,) - -AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present]) -AC_ARG_WITH(ssl, -[ --without-ssl disable support for openssl libssl] -[ --with-ssl=DIR use openssl include/library files in DIR],,) - -if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then - if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_ssl/include" - LDFLAGS="$LDFLAGS -L$with_ssl/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - LDFLAGS="$LDFLAGS -Xlinker -R$with_ssl/lib" - else - LDFLAGS="$LDFLAGS -R$with_ssl/lib" - fi - fi - AC_CHECK_LIB(crypto, RAND_file_name, - [AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,) - if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then - if test "x$HAVE_LIBCRYPTO" != "xtrue"; then - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi -fi - -AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available]) -if test "x$with_ssl" != "xno"; then - if test "x$HAVE_LIBCRYPTO" = "xtrue"; then - AC_CHECK_LIB(ssl, SSL_library_init, - SSL_LIBS="-lssl -lcrypto" - [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], , - -lcrypto) - else - AC_CHECK_LIB(ssl, SSL_library_init, - SSL_LIBS="-lssl" - [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,) - fi -fi -AC_SUBST(SSL_LIBS) -AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS") - - - - -AC_ARG_WITH(jpeg, -[ --without-jpeg disable support for jpeg] -[ --with-jpeg=DIR use jpeg include/library files in DIR],,) - -# At this point: -# no jpeg on command line with_jpeg="" -# -with-jpeg with_jpeg="yes" -# -without-jpeg with_jpeg="no" -# -with-jpeg=/foo/dir with_jpeg="/foo/dir" - -HAVE_LIBJPEG_TURBO="false" - -if test "x$with_jpeg" != "xno"; then - AC_ARG_VAR(JPEG_LDFLAGS, - [Linker flags to use when linking with libjpeg, e.g. -L/foo/dir/lib -Wl,-static -ljpeg -Wl,-shared. This overrides the linker flags set by --with-jpeg.]) - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - saved_LIBS="$LIBS" - if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then - # add user supplied directory to flags: - CPPFLAGS="$CPPFLAGS -I$with_jpeg/include" - LDFLAGS="$LDFLAGS -L$with_jpeg/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - # this is not complete... in general a rat's nest. - LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib" - else - LDFLAGS="$LDFLAGS -R$with_jpeg/lib" - fi - fi - if test "x$JPEG_LDFLAGS" != "x"; then - LDFLAGS="$saved_LDFLAGS" - LIBS="$LIBS $JPEG_LDFLAGS" - else - LIBS="-ljpeg" - fi - AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true") - AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg) - if test "x$HAVE_JPEGLIB_H" = "xtrue"; then - AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])], - [AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)], - [AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""]) - fi - if test "x$HAVE_JPEGLIB_H" != "xtrue"; then - # restore old flags on failure: - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - LIBS="$saved_LIBS" - AC_MSG_WARN([ -========================================================================== -*** The libjpeg compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libjpeg is in a non-standard location use --with-jpeg=DIR to -indicate the header file is in DIR/include/jpeglib.h and the library -in DIR/lib/libjpeg.a. You can also set the JPEG_LDFLAGS variable to -specify more detailed linker flags. A copy of libjpeg-turbo may be -obtained from: https://sourceforge.net/projects/libjpeg-turbo/files/ -A copy of libjpeg may be obtained from: http://ijg.org/files/ -========================================================================== -]) - sleep 5 - fi - - if test "x$HAVE_JPEGLIB_H" = "xtrue"; then - AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo) - m4_define([LJT_TEST], - [AC_LANG_PROGRAM([#include - #include ], - [struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - cinfo.err=jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - cinfo.input_components = 3; - jpeg_set_defaults(&cinfo); - cinfo.in_color_space = JCS_EXT_RGB; - jpeg_default_colorspace(&cinfo); - return 0;])] - ) - if test "x$cross_compiling" != "xyes"; then - AC_RUN_IFELSE([LJT_TEST], - [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) - else - AC_LINK_IFELSE([LJT_TEST], - [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) - fi - fi - - if test "x$HAVE_JPEGLIB_H" = "xtrue" -a "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libjpeg library you are building against is not libjpeg-turbo. -Performance will be reduced. You can obtain libjpeg-turbo from: -https://sourceforge.net/projects/libjpeg-turbo/files/ *** -========================================================================== -]) - fi - -fi - -AC_ARG_WITH(png, -[ --without-png disable support for png] -[ --with-png=DIR use png include/library files in DIR],,) - -# At this point: -# no png on command line with_png="" -# -with-png with_png="yes" -# -without-png with_png="no" -# -with-png=/foo/dir with_png="/foo/dir" - -if test "x$with_png" != "xno"; then - if test ! -z "$with_png" -a "x$with_png" != "xyes"; then - # add user supplied directory to flags: - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_png/include" - LDFLAGS="$LDFLAGS -L$with_png/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - # this is not complete... in general a rat's nest. - LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib" - else - LDFLAGS="$LDFLAGS -R$with_png/lib" - fi - fi - AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true") - if test "x$HAVE_PNGLIB_H" = "xtrue"; then - AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="") - fi - if test ! -z "$with_png" -a "x$with_png" != "xyes"; then - if test "x$HAVE_PNGLIB_H" != "xtrue"; then - # restore old flags on failure: - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi - if test "x$HAVE_PNGLIB_H" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libpng compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libpng is in a non-standard location use --with-png=DIR to -indicate the header file is in DIR/include/png.h and the library -in DIR/lib/libpng.a. A copy of libpng may be obtained from: -http://www.libpng.org/pub/png/libpng.html -========================================================================== -]) - sleep 5 - fi -fi - -AC_ARG_WITH(libz, -[ --without-libz disable support for deflate],,) -AC_ARG_WITH(zlib, -[ --without-zlib disable support for deflate] -[ --with-zlib=DIR use zlib include/library files in DIR],,) - -if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then - if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_zlib/include" - LDFLAGS="$LDFLAGS -L$with_zlib/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib" - else - LDFLAGS="$LDFLAGS -R$with_zlib/lib" - fi - fi - AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true") - if test "x$HAVE_ZLIB_H" = "xtrue"; then - AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="") - fi - if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then - if test "x$HAVE_ZLIB_H" != "xtrue"; then - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi - if test "x$HAVE_ZLIB_H" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libz compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libz is in a non-standard location use --with-zlib=DIR to indicate the -header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a. -A copy of libz may be obtained from: http://www.gzip.org/zlib/ -========================================================================== -]) - sleep 5 - fi -fi - -AC_ARG_WITH(pthread, -[ --without-pthread disable support for libpthread],,) - -if test "x$with_pthread" != "xno"; then - AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true") - 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 -fi -AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD") - -AC_MSG_CHECKING([for __thread]) -AC_LINK_IFELSE([AC_LANG_PROGRAM(, [static __thread int p = 0])], - [AC_DEFINE(HAVE_TLS, 1, - Define to 1 if compiler supports __thread) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - -# tightvnc-filetransfer implemented using threads: -if test -z "$HAVE_LIBPTHREAD"; then - with_tightvnc_filetransfer="" -fi -if test "x$with_tightvnc_filetransfer" = "xyes"; then - AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER) -fi -AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes") - -# websockets implemented using base64 from resolve -if test "x$HAVE_B64" != "xtrue"; then - with_websockets="" -fi -if test "x$with_websockets" = "xyes"; then - LIBS="$LIBS $RESOLV_LIB $SSL_LIBS" - AC_DEFINE(WITH_WEBSOCKETS) -fi -AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes") - -AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H") -AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H") -AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H") - - -SDLCONFIG="sdl-config" -AC_ARG_WITH(sdl-config, -[[ --with-sdl-config=FILE - Use the given path to sdl-config when determining - SDL configuration; defaults to "sdl-config"]], -[ - if test "$withval" != "yes" -a "$withval" != ""; then - SDLCONFIG=$withval - fi -]) - -if test -z "$with_sdl"; then - if $SDLCONFIG --version >/dev/null 2>&1; then - with_sdl=yes - SDL_CFLAGS=`$SDLCONFIG --cflags` - SDL_LIBS=`$SDLCONFIG --libs` - else - with_sdl=no - fi -fi -AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes") -AC_SUBST(SDL_CFLAGS) -AC_SUBST(SDL_LIBS) - - -# Check for GTK+. if present, build the GTK+ vnc viewer example -PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:) -AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS") - -AC_CANONICAL_HOST -MINGW=`echo $host_os | grep mingw32 2>/dev/null` -AM_CONDITIONAL(MINGW, test ! -z "$MINGW" ) -if test ! -z "$MINGW"; then - WSOCKLIB="-lws2_32" -fi -AC_SUBST(WSOCKLIB) - -# Check for libgcrypt -AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient]) -AC_ARG_WITH(gcrypt, -[ --without-gcrypt disable support for gcrypt],,) -AC_ARG_WITH(client-gcrypt, -[ --without-client-gcrypt disable support for gcrypt in libvncclient],,) - -if test "x$with_gcrypt" != "xno"; then - AM_PATH_LIBGCRYPT(1.4.0, , with_client_gcrypt=no) - CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" - LIBS="$LIBS $LIBGCRYPT_LIBS" - if test "x$with_client_gcrypt" != "xno"; then - AC_DEFINE(WITH_CLIENT_GCRYPT) - fi -fi - -# Checks for GnuTLS -AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present]) -AC_ARG_WITH(gnutls, -[ --without-gnutls disable support for gnutls] -[ --with-gnutls=DIR use gnutls include/library files in DIR],,) - -if test "x$with_gnutls" != "xno"; then - PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.4.0,,:) - CFLAGS="$CFLAGS $GNUTLS_CFLAGS" - LIBS="$LIBS $GNUTLS_LIBS" -fi -AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS") -if test ! -z "$GNUTLS_LIBS" ; then - AC_DEFINE(HAVE_GNUTLS) -fi - - -# warn if neither GnuTLS nor OpenSSL are available -if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then - AC_MSG_WARN([ -========================================================================== -*** No encryption library could be found. *** -A libvncserver/libvncclient built this way will not support SSL encryption. -To enable SSL install the necessary development packages (perhaps it is named -something like libssl-dev or gnutls-dev) and run configure again. -========================================================================== -]) - sleep 5 -fi - - -# IPv6 -AH_TEMPLATE(IPv6, [Enable IPv6 support]) -AC_ARG_WITH(ipv6, -[ --without-ipv6 disable IPv6 support],,) -if test "x$with_ipv6" != "xno"; then - AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(IPv6,1), - AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(IPv6,1), [ - AC_MSG_CHECKING([for getaddrinfo in -lws2_32]) - LIBS="$LIBS -lws2_32" - AC_TRY_LINK([#include ], [getaddrinfo(0, 0, 0, 0);], [ - AC_DEFINE(IPv6,1) - AC_MSG_RESULT([yes]) - ], - AC_MSG_RESULT([no])) - ])) -fi - - - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h endian.h fcntl.h netdb.h netinet/in.h stdlib.h stdint.h string.h sys/endian.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h ws2tcpip.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_HEADER_SYS_WAIT -AX_TYPE_SOCKLEN_T -AC_CACHE_CHECK([for in_addr_t], - vnc_cv_inaddrt, [ - AC_TRY_COMPILE([#include -#include ], - [in_addr_t foo; return 0;], - [inaddrt=yes], - [inaddrt=no]), - ]) -AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t]) -if test $inaddrt = no ; then - AC_DEFINE(NEED_INADDR_T) -fi -# Checks for library functions. -AC_FUNC_MEMCMP -AC_FUNC_STAT -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -AC_FUNC_FORK -AC_CHECK_LIB(nsl,gethostbyname) -AC_CHECK_LIB(socket,socket) - -uname_s=`(uname -s) 2>/dev/null` -if test "x$uname_s" = "xHP-UX"; then - # need -lsec for getspnam() - LDFLAGS="$LDFLAGS -lsec" -fi - -AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr]) - -# check, if shmget is in cygipc.a -AC_CHECK_LIB(cygipc,shmget) -AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true") - -# Check if /usr/include/linux exists, if so, define LINUX -AM_CONDITIONAL(LINUX, test -d /usr/include/linux) - -# Check for OS X specific header -AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true") -AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true") - -# Check for Android specific header -AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true") -AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true") -if test "$HAVE_ANDROID" = "true"; then - AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected]) -fi - -# On Solaris 2.7, write() returns ENOENT when it really means EAGAIN -AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it]) -case `(uname -sr) 2>/dev/null` in - "SunOS 5.7") - AC_DEFINE(ENOENT_WORKAROUND) - ;; -esac - -# Check for rpm SOURCES path -printf "checking for rpm sources path... " -RPMSOURCEDIR="NOT-FOUND" -for directory in packages OpenLinux redhat RedHat rpm RPM "" ; do - if test -d /usr/src/${directory}/SOURCES; then - RPMSOURCEDIR="/usr/src/${directory}/SOURCES/" - fi -done -echo "$RPMSOURCEDIR" -AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND") -AC_SUBST(RPMSOURCEDIR) - -AC_CONFIG_FILES([Makefile - libvncserver.pc - libvncclient.pc - libvncserver/Makefile - examples/Makefile - examples/android/Makefile - webclients/Makefile - webclients/java-applet/Makefile - webclients/java-applet/ssl/Makefile - libvncclient/Makefile - client_examples/Makefile - test/Makefile - libvncserver-config - LibVNCServer.spec]) - - -AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config]) -AC_OUTPUT -chmod a+x ./libvncserver-config - diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index 829f735..0000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = ../libvncserver/libvncserver.la @WSOCKLIB@ - -if OSX -MAC=mac -mac_LDFLAGS=-framework ApplicationServices -framework Carbon -framework IOKit -endif - -if ANDROID -SUBDIRS=android -endif - -if WITH_TIGHTVNC_FILETRANSFER -FILETRANSFER=filetransfer -endif - -if HAVE_LIBPTHREAD -BLOOPTEST=blooptest -endif - -noinst_HEADERS=radon.h rotatetemplate.c - -noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \ - vncev storepasswd colourmaptest simple simple15 $(MAC) \ - $(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \ - zippy repeater - diff --git a/examples/android/Makefile.am b/examples/android/Makefile.am deleted file mode 100644 index 9cb5c02..0000000 --- a/examples/android/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = $(top_srcdir)/libvncserver/libvncserver.la @WSOCKLIB@ - -noinst_PROGRAMS=androidvncserver -androidvncserver_SOURCES=jni/fbvncserver.c - -EXTRA_DIST=jni/Android.mk diff --git a/libvncclient.pc.in b/libvncclient.pc.in deleted file mode 100644 index 37495e7..0000000 --- a/libvncclient.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: LibVNCClient -Description: A library for easy implementation of a VNC client. -Version: @VERSION@ -Requires: -Requires.private: zlib -Libs: -L${libdir} -lvncclient -Libs.private: @LIBS@ @WSOCKLIB@ -Cflags: -I${includedir} - diff --git a/libvncclient/Makefile.am b/libvncclient/Makefile.am deleted file mode 100644 index bc2420b..0000000 --- a/libvncclient/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common - -if HAVE_GNUTLS -TLSSRCS = tls_gnutls.c -TLSLIBS = @GNUTLS_LIBS@ -else -if HAVE_LIBSSL -TLSSRCS = tls_openssl.c -TLSLIBS = @SSL_LIBS@ @CRYPT_LIBS@ -else -TLSSRCS = tls_none.c -endif -endif - - -libvncclient_la_SOURCES=cursor.c listen.c rfbproto.c sockets.c vncviewer.c ../common/minilzo.c $(TLSSRCS) -libvncclient_la_LIBADD=$(TLSLIBS) - -noinst_HEADERS=../common/lzodefs.h ../common/lzoconf.h ../common/minilzo.h tls.h - -rfbproto.o: rfbproto.c corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c - -EXTRA_DIST=corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c tls_gnutls.c tls_openssl.c tls_none.c - -$(libvncclient_la_OBJECTS): ../rfb/rfbclient.h - -lib_LTLIBRARIES=libvncclient.la -libvncclient_la_LDFLAGS = -version-info 1:0:0 - diff --git a/libvncserver-config.in b/libvncserver-config.in deleted file mode 100644 index ea0bef8..0000000 --- a/libvncserver-config.in +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -exec_prefix_set=no -includedir=@includedir@ -libdir=@libdir@ - -# if this script is in the same directory as libvncserver-config.in, assume not installed -if [ -f "`dirname "$0"`/libvncserver-config.in" ]; then - dir="`dirname "$0"`" - prefix="`cd "$dir"; pwd`" - includedir="$prefix" - libdir="$prefix/libvncserver/.libs $prefix/libvncclient/.libs" -fi - -usage="\ -Usage: @PACKAGE@-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--link] [--libs] [--cflags]" - -if test $# -eq 0; then - echo "${usage}" 1>&2 - exit 1 -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - if test $exec_prefix_set = no ; then - exec_prefix=$optarg - fi - ;; - --prefix) - echo $prefix - ;; - --exec-prefix=*) - exec_prefix=$optarg - exec_prefix_set=yes - ;; - --exec-prefix) - echo $exec_prefix - ;; - --version) - echo @VERSION@ - ;; - --cflags) - if [ "$includedir" != /usr/include ]; then - includes=-I"$includedir" - fi - echo "$includes" - ;; - --libs) - libs="" - for dir in $libdir; do - libs="$libs -L$dir" - if [ "`uname`" = "SunOS" ]; then - # why only Solaris?? - libs="$libs -R$dir" - fi - done - echo "$libs" -lvncserver -lvncclient @LIBS@ @WSOCKLIB@ - ;; - --link) - echo @CC@ - ;; - *) - echo "${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - diff --git a/libvncserver.pc.in b/libvncserver.pc.in deleted file mode 100644 index d246052..0000000 --- a/libvncserver.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: LibVNCServer -Description: A library for easy implementation of a VNC server. -Version: @VERSION@ -Requires: -Requires.private: zlib -Libs: -L${libdir} -lvncserver -Libs.private: @LIBS@ @WSOCKLIB@ -Cflags: -I${includedir} - diff --git a/libvncserver/Makefile.am b/libvncserver/Makefile.am deleted file mode 100644 index e25784b..0000000 --- a/libvncserver/Makefile.am +++ /dev/null @@ -1,80 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common - -if WITH_TIGHTVNC_FILETRANSFER -TIGHTVNCFILETRANSFERHDRS=tightvnc-filetransfer/filelistinfo.h \ - tightvnc-filetransfer/filetransfermsg.h \ - tightvnc-filetransfer/handlefiletransferrequest.h \ - tightvnc-filetransfer/rfbtightproto.h - -TIGHTVNCFILETRANSFERSRCS = tightvnc-filetransfer/rfbtightserver.c \ - tightvnc-filetransfer/handlefiletransferrequest.c \ - tightvnc-filetransfer/filetransfermsg.c \ - tightvnc-filetransfer/filelistinfo.c -endif - -if WITH_WEBSOCKETS - -if HAVE_GNUTLS -WEBSOCKETSSSLSRCS = rfbssl_gnutls.c rfbcrypto_gnutls.c -WEBSOCKETSSSLLIBS = @GNUTLS_LIBS@ -else -if HAVE_LIBSSL -WEBSOCKETSSSLSRCS = rfbssl_openssl.c rfbcrypto_openssl.c -WEBSOCKETSSSLLIBS = @SSL_LIBS@ @CRYPT_LIBS@ -else -WEBSOCKETSSSLSRCS = rfbssl_none.c rfbcrypto_included.c ../common/md5.c ../common/sha1.c -endif -endif - -WEBSOCKETSSRCS = websockets.c $(WEBSOCKETSSSLSRCS) -endif - -includedir=$(prefix)/include/rfb - -include_HEADERS=../rfb/rfb.h ../rfb/rfbconfig.h \ - ../rfb/rfbproto.h ../rfb/keysym.h ../rfb/rfbregion.h ../rfb/rfbclient.h - -noinst_HEADERS=../common/d3des.h ../rfb/default8x16.h zrleoutstream.h \ - zrlepalettehelper.h zrletypes.h private.h scale.h rfbssl.h rfbcrypto.h \ - ../common/minilzo.h ../common/lzoconf.h ../common/lzodefs.h ../common/md5.h ../common/sha.h ../common/sha-private.h \ - $(TIGHTVNCFILETRANSFERHDRS) - -EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \ - tableinitcmtemplate.c tabletrans24template.c \ - zrleencodetemplate.c - -if HAVE_LIBZ -ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c -if HAVE_LIBJPEG -TIGHTSRCS = tight.c ../common/turbojpeg.c -endif -endif - -LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c $(WEBSOCKETSSRCS) \ - stats.c corre.c hextile.c rre.c translate.c cutpaste.c \ - httpd.c cursor.c font.c \ - draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \ - $(ZLIBSRCS) $(TIGHTSRCS) $(TIGHTVNCFILETRANSFERSRCS) - -libvncserver_la_SOURCES=$(LIB_SRCS) -libvncserver_la_LIBADD=$(WEBSOCKETSSSLLIBS) - -if WITH_SYSTEMD -AM_CPPFLAGS += -DLIBVNCSERVER_WITH_SYSTEMD -libvncserver_la_CFLAGS = $(LIBSYSTEMD_CFLAGS) -libvncserver_la_LIBADD += $(LIBSYSTEMD_LIBS) -endif - -lib_LTLIBRARIES=libvncserver.la -libvncserver_la_LDFLAGS = -version-info 1:0:0 - -if HAVE_RPM -$(PACKAGE)-$(VERSION).tar.gz: dist - -# Rule to build RPM distribution package -rpm: $(PACKAGE)-$(VERSION).tar.gz libvncserver.spec - cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@ - rpmbuild -ba libvncserver.spec -endif - - diff --git a/m4/.gitignore b/m4/.gitignore deleted file mode 100644 index 7c9f9ac..0000000 --- a/m4/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.m4 \ No newline at end of file diff --git a/m4/ax_prefix_config_h.m4 b/m4/ax_prefix_config_h.m4 deleted file mode 100644 index c17563f..0000000 --- a/m4/ax_prefix_config_h.m4 +++ /dev/null @@ -1,203 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])] -# -# DESCRIPTION -# -# Generate an installable config.h. -# -# A package should not normally install its config.h as a system header, -# but if it must, this macro can be used to avoid namespace pollution by -# making a copy of config.h with a prefix added to all the macro names. -# -# Each "#define SOMEDEF" line of the configuration header has the given -# prefix added, in the same case as the first character of the macro name. -# -# Defaults: -# -# OUTPUT-HEADER = $PACKAGE-config.h -# PREFIX = $PACKAGE -# ORIG-HEADER, from AM_CONFIG_HEADER(config.h) -# -# Your configure.ac script should contain both macros in this order. -# -# Example: -# -# AC_INIT(config.h.in) # config.h.in as created by "autoheader" -# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE -# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in -# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it.. -# AC_MEMORY_H # makes "#undef NEED_MEMORY_H" -# AC_C_CONST_H # makes "#undef const" -# AC_OUTPUT(Makefile) # creates the "config.h" now -# # and also mylib/_config.h -# -# If the argument to AX_PREFIX_CONFIG_H would have been omitted then the -# default output file would have been called simply "testpkg-config.h", -# but even under the name "mylib/_config.h" it contains prefix-defines -# like -# -# #ifndef TESTPKG_VERSION -# #define TESTPKG_VERSION "0.1.1" -# #endif -# #ifndef TESTPKG_NEED_MEMORY_H -# #define TESTPKG_NEED_MEMORY_H 1 -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const _const -# #endif -# -# and this "mylib/_config.h" can be installed along with other header -# files, which is most convenient when creating a shared library (that has -# some headers) whose functionality depends on features detected at -# compile-time. No need to invent some "mylib-confdefs.h.in" manually. -# -# Note that some AC_DEFINEs that end up in the config.h file are actually -# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T -# say that they "will define inline|const|off_t if the system does not do -# it by itself". You might want to clean up about these - consider an -# extra mylib/conf.h that reads something like: -# -# #include -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# and then start using _testpkg_const in the header files. That is also a -# good thing to differentiate whether some library-user has starting to -# take up with a different compiler, so perhaps it could read something -# like this: -# -# #ifdef _MSC_VER -# #include -# #else -# #include -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# LICENSE -# -# Copyright (c) 2014 Reuben Thomas -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2008 Marten Svantesson -# Copyright (c) 2008 Gerald Point -# -# This program 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 3 of the License, or (at your -# option) any later version. -# -# This program 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 program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 15 - -AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl -AC_PREREQ([2.62]) -AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl -AC_CONFIG_COMMANDS(m4_default([$1], [$PACKAGE-config.h]),[dnl -AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl -AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl -AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl -AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl -AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl -AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl -m4_pushdef([_script],[conftest.prefix])dnl -m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl -_OUT=`echo m4_default([$1], [$PACKAGE-config.h])` -_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"` -_PKG=`echo m4_default([$2], [$PACKAGE])` -_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"` -_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"` -_INP=`echo "$3" | sed -e 's/ *//'` -if test ".$_INP" = "."; then - for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue - case "$ac_file" in - *.h) _INP=$ac_file ;; - *) - esac - test ".$_INP" != "." && break - done -fi -if test ".$_INP" = "."; then - case "$_OUT" in - */*) _INP=`basename "$_OUT"` - ;; - *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"` - ;; - *) _INP=config.h - ;; - esac -fi -if test -z "$_PKG" ; then - AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H]) -else - if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then - _INP="$srcdir/$_INP" - fi fi - AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines) - if test -f $_INP ; then - AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/"]) > _script - AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/"]) >> _script - AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1\\"]) >> _script - AS_ECHO(["@%:@def[]ine $_UPP""_\\1\\2\\"]) >> _script - AS_ECHO(["@%:@endif/"]) >> _script - AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1\\"]) >> _script - AS_ECHO(["@%:@define $_LOW""_\\1\\2\\"]) >> _script - AS_ECHO(["@%:@endif/"]) >> _script - # now executing _script on _DEF input to create _OUT output file - echo "@%:@ifndef $_DEF" >$tmp/pconfig.h - echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h - - sed -f _script $_INP >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h - echo "@%:@endif" >>$tmp/pconfig.h - if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then - AC_MSG_NOTICE([$_OUT is unchanged]) - else - ac_dir=`AS_DIRNAME(["$_OUT"])` - AS_MKDIR_P(["$ac_dir"]) - rm -f "$_OUT" - mv $tmp/pconfig.h "$_OUT" - fi - else - AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT]) - fi - rm -f conftest.* -fi -m4_popdef([_symbol])dnl -m4_popdef([_script])dnl -AS_VAR_POPDEF([_INP])dnl -AS_VAR_POPDEF([_UPP])dnl -AS_VAR_POPDEF([_LOW])dnl -AS_VAR_POPDEF([_PKG])dnl -AS_VAR_POPDEF([_DEF])dnl -AS_VAR_POPDEF([_OUT])dnl -],[PACKAGE="$PACKAGE"])]) diff --git a/m4/ax_type_socklen_t.m4 b/m4/ax_type_socklen_t.m4 deleted file mode 100644 index 834c4cf..0000000 --- a/m4/ax_type_socklen_t.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_type_socklen_t.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_TYPE_SOCKLEN_T -# -# DESCRIPTION -# -# Check whether sys/socket.h defines type socklen_t. Please note that some -# systems require sys/types.h to be included before sys/socket.h can be -# compiled. -# -# LICENSE -# -# Copyright (c) 2008 Lars Brinkhoff -# -# This program 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 program 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 program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 5 - -AU_ALIAS([TYPE_SOCKLEN_T], [AX_TYPE_SOCKLEN_T]) -AC_DEFUN([AX_TYPE_SOCKLEN_T], -[AC_CACHE_CHECK([for socklen_t], ac_cv_ax_type_socklen_t, -[ - AC_TRY_COMPILE( - [#include - #include ], - [socklen_t len = 42; return 0;], - ac_cv_ax_type_socklen_t=yes, - ac_cv_ax_type_socklen_t=no) -]) - if test $ac_cv_ax_type_socklen_t != yes; then - AC_DEFINE(socklen_t, int, [Substitute for socklen_t]) - fi -]) diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 deleted file mode 100644 index 831dc0c..0000000 --- a/m4/libgcrypt.m4 +++ /dev/null @@ -1,123 +0,0 @@ -dnl Autoconf macros for libgcrypt -dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. -dnl -dnl This file is free software; as a special exception the author gives -dnl unlimited permission to copy and/or distribute it, with or without -dnl modifications, as long as this notice is preserved. -dnl -dnl This file is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - -dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, -dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) -dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. -dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed -dnl with the API version to also check the API compatibility. Example: -dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed -dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using -dnl this features allows to prevent build against newer versions of libgcrypt -dnl with a changed API. -dnl -AC_DEFUN([AM_PATH_LIBGCRYPT], -[ AC_ARG_WITH(libgcrypt-prefix, - AC_HELP_STRING([--with-libgcrypt-prefix=PFX], - [prefix where LIBGCRYPT is installed (optional)]), - libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") - if test x$libgcrypt_config_prefix != x ; then - if test x${LIBGCRYPT_CONFIG+set} != xset ; then - LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config - fi - fi - - AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) - tmp=ifelse([$1], ,1:1.2.0,$1) - if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then - req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` - min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` - else - req_libgcrypt_api=0 - min_libgcrypt_version="$tmp" - fi - - AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) - ok=no - if test "$LIBGCRYPT_CONFIG" != "no" ; then - req_major=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` - req_minor=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` - req_micro=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` - libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` - major=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - if test "$major" -gt "$req_major"; then - ok=yes - else - if test "$major" -eq "$req_major"; then - if test "$minor" -gt "$req_minor"; then - ok=yes - else - if test "$minor" -eq "$req_minor"; then - if test "$micro" -ge "$req_micro"; then - ok=yes - fi - fi - fi - fi - fi - fi - if test $ok = yes; then - AC_MSG_RESULT([yes ($libgcrypt_config_version)]) - else - AC_MSG_RESULT(no) - fi - if test $ok = yes; then - # If we have a recent libgcrypt, we should also check that the - # API is compatible - if test "$req_libgcrypt_api" -gt 0 ; then - tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` - if test "$tmp" -gt 0 ; then - AC_MSG_CHECKING([LIBGCRYPT API version]) - if test "$req_libgcrypt_api" -eq "$tmp" ; then - AC_MSG_RESULT([okay]) - else - ok=no - AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp]) - fi - fi - fi - fi - if test $ok = yes; then - LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` - LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` - ifelse([$2], , :, [$2]) - if test x"$host" != x ; then - libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` - if test x"$libgcrypt_config_host" != xnone ; then - if test x"$libgcrypt_config_host" != x"$host" ; then - AC_MSG_WARN([[ -*** -*** The config script $LIBGCRYPT_CONFIG was -*** built for $libgcrypt_config_host and thus may not match the -*** used host $host. -*** You may want to use the configure option --with-libgcrypt-prefix -*** to specify a matching config script. -***]]) - fi - fi - fi - else - LIBGCRYPT_CFLAGS="" - LIBGCRYPT_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(LIBGCRYPT_CFLAGS) - AC_SUBST(LIBGCRYPT_LIBS) -]) diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index f07fc82..0000000 --- a/test/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -check_PROGRAMS = - -if HAVE_LIBJPEG -# TurboJPEG wrapper tests -check_PROGRAMS += tjunittest tjbench -tjunittest_SOURCES=tjunittest.c ../common/turbojpeg.c ../common/turbojpeg.h \ - tjutil.c tjutil.h -tjbench_SOURCES=tjbench.c ../common/turbojpeg.c ../common/turbojpeg.h \ - tjutil.c tjutil.h bmp.c bmp.h -tjbench_LDADD=$(LDADD) -lm -endif - -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common -LDADD = ../libvncserver/libvncserver.la ../libvncclient/libvncclient.la @WSOCKLIB@ - -if HAVE_LIBPTHREAD -BACKGROUND_TEST=blooptest -ENCODINGS_TEST=encodingstest -endif - -copyrecttest_LDADD=$(LDADD) -lm - -check_PROGRAMS += $(ENCODINGS_TEST) cargstest copyrecttest $(BACKGROUND_TEST) \ - cursortest - -test: encodingstest$(EXEEXT) cargstest$(EXEEXT) copyrecttest$(EXEEXT) - ./encodingstest && ./cargstest - diff --git a/webclients/Makefile.am b/webclients/Makefile.am deleted file mode 100644 index 6c2db84..0000000 --- a/webclients/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = java-applet -DIST_SUBDIRS = java-applet -EXTRA_DIST=index.vnc novnc - diff --git a/webclients/java-applet/Makefile.am b/webclients/java-applet/Makefile.am deleted file mode 100644 index d6d10e4..0000000 --- a/webclients/java-applet/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -EXTRA_DIST=VncViewer.jar javaviewer.pseudo_proxy.patch - -SUBDIRS = ssl -DIST_SUBDIRS = ssl - diff --git a/webclients/java-applet/ssl/Makefile.am b/webclients/java-applet/ssl/Makefile.am deleted file mode 100644 index fd1c201..0000000 --- a/webclients/java-applet/ssl/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST=VncViewer.jar index.vnc SignedVncViewer.jar proxy.vnc README ss_vncviewer onetimekey UltraViewerSSL.jar SignedUltraViewerSSL.jar ultra.vnc ultrasigned.vnc ultraproxy.vnc - -- cgit v1.2.3 From ef971860233a9abfe66533381e82ed094815a83f Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sun, 26 Mar 2017 16:29:55 +0200 Subject: CMake: automatically build androidvncserver when crosscompiling for Android --- CMakeLists.txt | 7 + examples/android/README | 63 ----- examples/android/jni/Android.mk | 65 ----- examples/android/jni/fbvncserver.c | 522 ------------------------------------- examples/androidvncserver.c | 522 +++++++++++++++++++++++++++++++++++++ 5 files changed, 529 insertions(+), 650 deletions(-) delete mode 100644 examples/android/README delete mode 100644 examples/android/jni/Android.mk delete mode 100644 examples/android/jni/fbvncserver.c create mode 100644 examples/androidvncserver.c (limited to 'examples') diff --git a/CMakeLists.txt b/CMakeLists.txt index f20b4dc..d39672e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -431,6 +431,13 @@ if(MACOS) ) endif(MACOS) +if(ANDROID) + set(LIBVNCSERVER_EXAMPLES + ${LIBVNCSERVER_EXAMPLES} + androidvncserver + ) +endif(ANDROID) + set(LIBVNCCLIENT_EXAMPLES backchannel ppmtest diff --git a/examples/android/README b/examples/android/README deleted file mode 100644 index 57e14cf..0000000 --- a/examples/android/README +++ /dev/null @@ -1,63 +0,0 @@ - -This example VNC server for Android is adopted from -http://code.google.com/p/android-vnc-server/ with some additional -fixes applied. - -To build, you'll need the Android Native Development Kit from -http://developer.android.com/sdk/ndk/. - - -Building with autotools ------------------------ - -This has the advantage that the LibVNCServer sources are properly set up -using the configure script. - -1. Read /docs/STANDALONE-TOOLCHAIN.html. - -2. Setup your toolchain according to step 3 in the above file. - -3. Execute - - ./configure --host=arm-eabi CC=arm-linux-androideabi-gcc - - in the LibVNCServer root directory. - -4. Execute - - make - - in the LibVNCServer root directory. This will build the whole - LibVNCServer distribution for Android, including androidvncserver. - - - - -Building with the NDK build system ----------------------------------- - -This is probably easier than the autotools method, but you'll have to edit -some files manually. - -1. Edit rfb/rfbconfig.h to match your Android target. For instance, comment out - LIBVNCSERVER_HAVE_LIBJPEG if you don't have libjpeg for Android. - -2. Edit the HAVE_X variables in jni/Android.mk accordingly. - -3. Execute - - ndk-build -C . - - in the examples/android directory. The resulting binary will be in libs/. - - - -Installing && Running ---------------------- - -This can be done via - - adb push androidvncserver /data/local/ - adb shell /data/local/androidvncserver - - diff --git a/examples/android/jni/Android.mk b/examples/android/jni/Android.mk deleted file mode 100644 index 731a790..0000000 --- a/examples/android/jni/Android.mk +++ /dev/null @@ -1,65 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LIBVNCSERVER_ROOT:=../../.. - -HAVE_LIBZ=1 -#HAVE_LIBJPEG=1 - -ifdef HAVE_LIBZ -ZLIBSRCS := \ - $(LIBVNCSERVER_ROOT)/libvncserver/zlib.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/zrle.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/zrleoutstream.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/zrlepalettehelper.c \ - $(LIBVNCSERVER_ROOT)/common/zywrletemplate.c -ifdef HAVE_LIBJPEG -TIGHTSRCS := $(LIBVNCSERVER_ROOT)/libvncserver/tight.c -endif -endif - -LOCAL_SRC_FILES:= \ - fbvncserver.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/main.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/rfbserver.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/rfbregion.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/auth.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/sockets.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/stats.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/corre.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/hextile.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/rre.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/translate.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/cutpaste.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/httpd.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/cursor.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/font.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/draw.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/selbox.c \ - $(LIBVNCSERVER_ROOT)/common/d3des.c \ - $(LIBVNCSERVER_ROOT)/common/vncauth.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/cargs.c \ - $(LIBVNCSERVER_ROOT)/common/minilzo.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/ultra.c \ - $(LIBVNCSERVER_ROOT)/libvncserver/scale.c \ - $(ZLIBSRCS) \ - $(TIGHTSRCS) - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/libvncserver \ - $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/common \ - $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT) \ - external/jpeg - -ifdef HAVE_LIBZ -LOCAL_SHARED_LIBRARIES := libz -LOCAL_LDLIBS := -lz -endif -ifdef HAVE_LIBJPEG -LOCAL_STATIC_LIBRARIES := libjpeg -endif - -LOCAL_MODULE:= androidvncserver - -include $(BUILD_EXECUTABLE) diff --git a/examples/android/jni/fbvncserver.c b/examples/android/jni/fbvncserver.c deleted file mode 100644 index a8c4827..0000000 --- a/examples/android/jni/fbvncserver.c +++ /dev/null @@ -1,522 +0,0 @@ -/* - * $Id$ - * - * This program 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, or (at your option) any - * later version. - * - * This program 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. - * - * This project is an adaptation of the original fbvncserver for the iPAQ - * and Zaurus. - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include /* For makedev() */ - -#include -#include -#include - -#include -#include - -/* libvncserver */ -#include "rfb/rfb.h" -#include "rfb/keysym.h" - -/*****************************************************************************/ - -/* Android does not use /dev/fb0. */ -#define FB_DEVICE "/dev/graphics/fb0" -static char KBD_DEVICE[256] = "/dev/input/event3"; -static char TOUCH_DEVICE[256] = "/dev/input/event1"; -static struct fb_var_screeninfo scrinfo; -static int fbfd = -1; -static int kbdfd = -1; -static int touchfd = -1; -static unsigned short int *fbmmap = MAP_FAILED; -static unsigned short int *vncbuf; -static unsigned short int *fbbuf; - -/* Android already has 5900 bound natively. */ -#define VNC_PORT 5901 -static rfbScreenInfoPtr vncscr; - -static int xmin, xmax; -static int ymin, ymax; - -/* No idea, just copied from fbvncserver as part of the frame differerencing - * algorithm. I will probably be later rewriting all of this. */ -static struct varblock_t -{ - int min_i; - int min_j; - int max_i; - int max_j; - int r_offset; - int g_offset; - int b_offset; - int rfb_xres; - int rfb_maxy; -} varblock; - -/*****************************************************************************/ - -static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl); -static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl); - -/*****************************************************************************/ - -static void init_fb(void) -{ - size_t pixels; - size_t bytespp; - - if ((fbfd = open(FB_DEVICE, O_RDONLY)) == -1) - { - printf("cannot open fb device %s\n", FB_DEVICE); - exit(EXIT_FAILURE); - } - - if (ioctl(fbfd, FBIOGET_VSCREENINFO, &scrinfo) != 0) - { - printf("ioctl error\n"); - exit(EXIT_FAILURE); - } - - pixels = scrinfo.xres * scrinfo.yres; - bytespp = scrinfo.bits_per_pixel / 8; - - fprintf(stderr, "xres=%d, yres=%d, xresv=%d, yresv=%d, xoffs=%d, yoffs=%d, bpp=%d\n", - (int)scrinfo.xres, (int)scrinfo.yres, - (int)scrinfo.xres_virtual, (int)scrinfo.yres_virtual, - (int)scrinfo.xoffset, (int)scrinfo.yoffset, - (int)scrinfo.bits_per_pixel); - - fbmmap = mmap(NULL, pixels * bytespp, PROT_READ, MAP_SHARED, fbfd, 0); - - if (fbmmap == MAP_FAILED) - { - printf("mmap failed\n"); - exit(EXIT_FAILURE); - } -} - -static void cleanup_fb(void) -{ - if(fbfd != -1) - { - close(fbfd); - } -} - -static void init_kbd() -{ - if((kbdfd = open(KBD_DEVICE, O_RDWR)) == -1) - { - printf("cannot open kbd device %s\n", KBD_DEVICE); - exit(EXIT_FAILURE); - } -} - -static void cleanup_kbd() -{ - if(kbdfd != -1) - { - close(kbdfd); - } -} - -static void init_touch() -{ - struct input_absinfo info; - if((touchfd = open(TOUCH_DEVICE, O_RDWR)) == -1) - { - printf("cannot open touch device %s\n", TOUCH_DEVICE); - exit(EXIT_FAILURE); - } - // Get the Range of X and Y - if(ioctl(touchfd, EVIOCGABS(ABS_X), &info)) { - printf("cannot get ABS_X info, %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - xmin = info.minimum; - xmax = info.maximum; - if(ioctl(touchfd, EVIOCGABS(ABS_Y), &info)) { - printf("cannot get ABS_Y, %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - ymin = info.minimum; - ymax = info.maximum; - -} - -static void cleanup_touch() -{ - if(touchfd != -1) - { - close(touchfd); - } -} - -/*****************************************************************************/ - -static void init_fb_server(int argc, char **argv) -{ - printf("Initializing server...\n"); - - /* Allocate the VNC server buffer to be managed (not manipulated) by - * libvncserver. */ - vncbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8); - assert(vncbuf != NULL); - - /* Allocate the comparison buffer for detecting drawing updates from frame - * to frame. */ - fbbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8); - assert(fbbuf != NULL); - - /* TODO: This assumes scrinfo.bits_per_pixel is 16. */ - vncscr = rfbGetScreen(&argc, argv, scrinfo.xres, scrinfo.yres, 5, 2, (scrinfo.bits_per_pixel / 8)); - assert(vncscr != NULL); - - vncscr->desktopName = "Android"; - vncscr->frameBuffer = (char *)vncbuf; - vncscr->alwaysShared = TRUE; - vncscr->httpDir = NULL; - vncscr->port = VNC_PORT; - - vncscr->kbdAddEvent = keyevent; - vncscr->ptrAddEvent = ptrevent; - - rfbInitServer(vncscr); - - /* Mark as dirty since we haven't sent any updates at all yet. */ - rfbMarkRectAsModified(vncscr, 0, 0, scrinfo.xres, scrinfo.yres); - - /* No idea. */ - varblock.r_offset = scrinfo.red.offset + scrinfo.red.length - 5; - varblock.g_offset = scrinfo.green.offset + scrinfo.green.length - 5; - varblock.b_offset = scrinfo.blue.offset + scrinfo.blue.length - 5; - varblock.rfb_xres = scrinfo.yres; - varblock.rfb_maxy = scrinfo.xres - 1; -} - -/*****************************************************************************/ -void injectKeyEvent(uint16_t code, uint16_t value) -{ - struct input_event ev; - memset(&ev, 0, sizeof(ev)); - gettimeofday(&ev.time,0); - ev.type = EV_KEY; - ev.code = code; - ev.value = value; - if(write(kbdfd, &ev, sizeof(ev)) < 0) - { - printf("write event failed, %s\n", strerror(errno)); - } - - printf("injectKey (%d, %d)\n", code , value); -} - -static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl) -{ - int scancode = 0; - - int code = (int)key; - if (code>='0' && code<='9') { - scancode = (code & 0xF) - 1; - if (scancode<0) scancode += 10; - scancode += KEY_1; - } else if (code>=0xFF50 && code<=0xFF58) { - static const uint16_t map[] = - { KEY_HOME, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, - KEY_SOFT1, KEY_SOFT2, KEY_END, 0 }; - scancode = map[code & 0xF]; - } else if (code>=0xFFE1 && code<=0xFFEE) { - static const uint16_t map[] = - { KEY_LEFTSHIFT, KEY_LEFTSHIFT, - KEY_COMPOSE, KEY_COMPOSE, - KEY_LEFTSHIFT, KEY_LEFTSHIFT, - 0,0, - KEY_LEFTALT, KEY_RIGHTALT, - 0, 0, 0, 0 }; - scancode = map[code & 0xF]; - } else if ((code>='A' && code<='Z') || (code>='a' && code<='z')) { - static const uint16_t map[] = { - KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, - KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, - KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, - KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, - KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z }; - scancode = map[(code & 0x5F) - 'A']; - } else { - switch (code) { - case 0x0003: scancode = KEY_CENTER; break; - case 0x0020: scancode = KEY_SPACE; break; - case 0x0023: scancode = KEY_SHARP; break; - case 0x0033: scancode = KEY_SHARP; break; - case 0x002C: scancode = KEY_COMMA; break; - case 0x003C: scancode = KEY_COMMA; break; - case 0x002E: scancode = KEY_DOT; break; - case 0x003E: scancode = KEY_DOT; break; - case 0x002F: scancode = KEY_SLASH; break; - case 0x003F: scancode = KEY_SLASH; break; - case 0x0032: scancode = KEY_EMAIL; break; - case 0x0040: scancode = KEY_EMAIL; break; - case 0xFF08: scancode = KEY_BACKSPACE; break; - case 0xFF1B: scancode = KEY_BACK; break; - case 0xFF09: scancode = KEY_TAB; break; - case 0xFF0D: scancode = KEY_ENTER; break; - case 0x002A: scancode = KEY_STAR; break; - case 0xFFBE: scancode = KEY_F1; break; // F1 - case 0xFFBF: scancode = KEY_F2; break; // F2 - case 0xFFC0: scancode = KEY_F3; break; // F3 - case 0xFFC5: scancode = KEY_F4; break; // F8 - case 0xFFC8: rfbShutdownServer(cl->screen,TRUE); break; // F11 - } - } - - return scancode; -} - -static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl) -{ - int scancode; - - printf("Got keysym: %04x (down=%d)\n", (unsigned int)key, (int)down); - - if ((scancode = keysym2scancode(down, key, cl))) - { - injectKeyEvent(scancode, down); - } -} - -void injectTouchEvent(int down, int x, int y) -{ - struct input_event ev; - - // Calculate the final x and y - /* Fake touch screen always reports zero */ - if (xmin != 0 && xmax != 0 && ymin != 0 && ymax != 0) - { - x = xmin + (x * (xmax - xmin)) / (scrinfo.xres); - y = ymin + (y * (ymax - ymin)) / (scrinfo.yres); - } - - memset(&ev, 0, sizeof(ev)); - - // Then send a BTN_TOUCH - gettimeofday(&ev.time,0); - ev.type = EV_KEY; - ev.code = BTN_TOUCH; - ev.value = down; - if(write(touchfd, &ev, sizeof(ev)) < 0) - { - printf("write event failed, %s\n", strerror(errno)); - } - - // Then send the X - gettimeofday(&ev.time,0); - ev.type = EV_ABS; - ev.code = ABS_X; - ev.value = x; - if(write(touchfd, &ev, sizeof(ev)) < 0) - { - printf("write event failed, %s\n", strerror(errno)); - } - - // Then send the Y - gettimeofday(&ev.time,0); - ev.type = EV_ABS; - ev.code = ABS_Y; - ev.value = y; - if(write(touchfd, &ev, sizeof(ev)) < 0) - { - printf("write event failed, %s\n", strerror(errno)); - } - - // Finally send the SYN - gettimeofday(&ev.time,0); - ev.type = EV_SYN; - ev.code = 0; - ev.value = 0; - if(write(touchfd, &ev, sizeof(ev)) < 0) - { - printf("write event failed, %s\n", strerror(errno)); - } - - printf("injectTouchEvent (x=%d, y=%d, down=%d)\n", x , y, down); -} - -static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl) -{ - /* Indicates either pointer movement or a pointer button press or release. The pointer is -now at (x-position, y-position), and the current state of buttons 1 to 8 are represented -by bits 0 to 7 of button-mask respectively, 0 meaning up, 1 meaning down (pressed). -On a conventional mouse, buttons 1, 2 and 3 correspond to the left, middle and right -buttons on the mouse. On a wheel mouse, each step of the wheel upwards is represented -by a press and release of button 4, and each step downwards is represented by -a press and release of button 5. - From: http://www.vislab.usyd.edu.au/blogs/index.php/2009/05/22/an-headerless-indexed-protocol-for-input-1?blog=61 */ - - //printf("Got ptrevent: %04x (x=%d, y=%d)\n", buttonMask, x, y); - if(buttonMask & 1) { - // Simulate left mouse event as touch event - injectTouchEvent(1, x, y); - injectTouchEvent(0, x, y); - } -} - -#define PIXEL_FB_TO_RFB(p,r,g,b) ((p>>r)&0x1f001f)|(((p>>g)&0x1f001f)<<5)|(((p>>b)&0x1f001f)<<10) - -static void update_screen(void) -{ - unsigned int *f, *c, *r; - int x, y; - - varblock.min_i = varblock.min_j = 9999; - varblock.max_i = varblock.max_j = -1; - - f = (unsigned int *)fbmmap; /* -> framebuffer */ - c = (unsigned int *)fbbuf; /* -> compare framebuffer */ - r = (unsigned int *)vncbuf; /* -> remote framebuffer */ - - for (y = 0; y < scrinfo.yres; y++) - { - /* Compare every 2 pixels at a time, assuming that changes are likely - * in pairs. */ - for (x = 0; x < scrinfo.xres; x += 2) - { - unsigned int pixel = *f; - - if (pixel != *c) - { - *c = pixel; - - /* XXX: Undo the checkered pattern to test the efficiency - * gain using hextile encoding. */ - if (pixel == 0x18e320e4 || pixel == 0x20e418e3) - pixel = 0x18e318e3; - - *r = PIXEL_FB_TO_RFB(pixel, - varblock.r_offset, varblock.g_offset, varblock.b_offset); - - if (x < varblock.min_i) - varblock.min_i = x; - else - { - if (x > varblock.max_i) - varblock.max_i = x; - - if (y > varblock.max_j) - varblock.max_j = y; - else if (y < varblock.min_j) - varblock.min_j = y; - } - } - - f++, c++; - r++; - } - } - - if (varblock.min_i < 9999) - { - if (varblock.max_i < 0) - varblock.max_i = varblock.min_i; - - if (varblock.max_j < 0) - varblock.max_j = varblock.min_j; - - fprintf(stderr, "Dirty page: %dx%d+%d+%d...\n", - (varblock.max_i+2) - varblock.min_i, (varblock.max_j+1) - varblock.min_j, - varblock.min_i, varblock.min_j); - - rfbMarkRectAsModified(vncscr, varblock.min_i, varblock.min_j, - varblock.max_i + 2, varblock.max_j + 1); - - rfbProcessEvents(vncscr, 10000); - } -} - -/*****************************************************************************/ - -void print_usage(char **argv) -{ - printf("%s [-k device] [-t device] [-h]\n" - "-k device: keyboard device node, default is /dev/input/event3\n" - "-t device: touch device node, default is /dev/input/event1\n" - "-h : print this help\n"); -} - -int main(int argc, char **argv) -{ - if(argc > 1) - { - int i=1; - while(i < argc) - { - if(*argv[i] == '-') - { - switch(*(argv[i] + 1)) - { - case 'h': - print_usage(argv); - exit(0); - break; - case 'k': - i++; - strcpy(KBD_DEVICE, argv[i]); - break; - case 't': - i++; - strcpy(TOUCH_DEVICE, argv[i]); - break; - } - } - i++; - } - } - - printf("Initializing framebuffer device " FB_DEVICE "...\n"); - init_fb(); - printf("Initializing keyboard device %s ...\n", KBD_DEVICE); - init_kbd(); - printf("Initializing touch device %s ...\n", TOUCH_DEVICE); - init_touch(); - - printf("Initializing VNC server:\n"); - printf(" width: %d\n", (int)scrinfo.xres); - printf(" height: %d\n", (int)scrinfo.yres); - printf(" bpp: %d\n", (int)scrinfo.bits_per_pixel); - printf(" port: %d\n", (int)VNC_PORT); - init_fb_server(argc, argv); - - /* Implement our own event loop to detect changes in the framebuffer. */ - while (1) - { - while (vncscr->clientHead == NULL) - rfbProcessEvents(vncscr, 100000); - - rfbProcessEvents(vncscr, 100000); - update_screen(); - } - - printf("Cleaning up...\n"); - cleanup_fb(); - cleanup_kdb(); - cleanup_touch(); -} diff --git a/examples/androidvncserver.c b/examples/androidvncserver.c new file mode 100644 index 0000000..a8c4827 --- /dev/null +++ b/examples/androidvncserver.c @@ -0,0 +1,522 @@ +/* + * $Id$ + * + * This program 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, or (at your option) any + * later version. + * + * This program 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. + * + * This project is an adaptation of the original fbvncserver for the iPAQ + * and Zaurus. + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include /* For makedev() */ + +#include +#include +#include + +#include +#include + +/* libvncserver */ +#include "rfb/rfb.h" +#include "rfb/keysym.h" + +/*****************************************************************************/ + +/* Android does not use /dev/fb0. */ +#define FB_DEVICE "/dev/graphics/fb0" +static char KBD_DEVICE[256] = "/dev/input/event3"; +static char TOUCH_DEVICE[256] = "/dev/input/event1"; +static struct fb_var_screeninfo scrinfo; +static int fbfd = -1; +static int kbdfd = -1; +static int touchfd = -1; +static unsigned short int *fbmmap = MAP_FAILED; +static unsigned short int *vncbuf; +static unsigned short int *fbbuf; + +/* Android already has 5900 bound natively. */ +#define VNC_PORT 5901 +static rfbScreenInfoPtr vncscr; + +static int xmin, xmax; +static int ymin, ymax; + +/* No idea, just copied from fbvncserver as part of the frame differerencing + * algorithm. I will probably be later rewriting all of this. */ +static struct varblock_t +{ + int min_i; + int min_j; + int max_i; + int max_j; + int r_offset; + int g_offset; + int b_offset; + int rfb_xres; + int rfb_maxy; +} varblock; + +/*****************************************************************************/ + +static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl); +static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl); + +/*****************************************************************************/ + +static void init_fb(void) +{ + size_t pixels; + size_t bytespp; + + if ((fbfd = open(FB_DEVICE, O_RDONLY)) == -1) + { + printf("cannot open fb device %s\n", FB_DEVICE); + exit(EXIT_FAILURE); + } + + if (ioctl(fbfd, FBIOGET_VSCREENINFO, &scrinfo) != 0) + { + printf("ioctl error\n"); + exit(EXIT_FAILURE); + } + + pixels = scrinfo.xres * scrinfo.yres; + bytespp = scrinfo.bits_per_pixel / 8; + + fprintf(stderr, "xres=%d, yres=%d, xresv=%d, yresv=%d, xoffs=%d, yoffs=%d, bpp=%d\n", + (int)scrinfo.xres, (int)scrinfo.yres, + (int)scrinfo.xres_virtual, (int)scrinfo.yres_virtual, + (int)scrinfo.xoffset, (int)scrinfo.yoffset, + (int)scrinfo.bits_per_pixel); + + fbmmap = mmap(NULL, pixels * bytespp, PROT_READ, MAP_SHARED, fbfd, 0); + + if (fbmmap == MAP_FAILED) + { + printf("mmap failed\n"); + exit(EXIT_FAILURE); + } +} + +static void cleanup_fb(void) +{ + if(fbfd != -1) + { + close(fbfd); + } +} + +static void init_kbd() +{ + if((kbdfd = open(KBD_DEVICE, O_RDWR)) == -1) + { + printf("cannot open kbd device %s\n", KBD_DEVICE); + exit(EXIT_FAILURE); + } +} + +static void cleanup_kbd() +{ + if(kbdfd != -1) + { + close(kbdfd); + } +} + +static void init_touch() +{ + struct input_absinfo info; + if((touchfd = open(TOUCH_DEVICE, O_RDWR)) == -1) + { + printf("cannot open touch device %s\n", TOUCH_DEVICE); + exit(EXIT_FAILURE); + } + // Get the Range of X and Y + if(ioctl(touchfd, EVIOCGABS(ABS_X), &info)) { + printf("cannot get ABS_X info, %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + xmin = info.minimum; + xmax = info.maximum; + if(ioctl(touchfd, EVIOCGABS(ABS_Y), &info)) { + printf("cannot get ABS_Y, %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + ymin = info.minimum; + ymax = info.maximum; + +} + +static void cleanup_touch() +{ + if(touchfd != -1) + { + close(touchfd); + } +} + +/*****************************************************************************/ + +static void init_fb_server(int argc, char **argv) +{ + printf("Initializing server...\n"); + + /* Allocate the VNC server buffer to be managed (not manipulated) by + * libvncserver. */ + vncbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8); + assert(vncbuf != NULL); + + /* Allocate the comparison buffer for detecting drawing updates from frame + * to frame. */ + fbbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8); + assert(fbbuf != NULL); + + /* TODO: This assumes scrinfo.bits_per_pixel is 16. */ + vncscr = rfbGetScreen(&argc, argv, scrinfo.xres, scrinfo.yres, 5, 2, (scrinfo.bits_per_pixel / 8)); + assert(vncscr != NULL); + + vncscr->desktopName = "Android"; + vncscr->frameBuffer = (char *)vncbuf; + vncscr->alwaysShared = TRUE; + vncscr->httpDir = NULL; + vncscr->port = VNC_PORT; + + vncscr->kbdAddEvent = keyevent; + vncscr->ptrAddEvent = ptrevent; + + rfbInitServer(vncscr); + + /* Mark as dirty since we haven't sent any updates at all yet. */ + rfbMarkRectAsModified(vncscr, 0, 0, scrinfo.xres, scrinfo.yres); + + /* No idea. */ + varblock.r_offset = scrinfo.red.offset + scrinfo.red.length - 5; + varblock.g_offset = scrinfo.green.offset + scrinfo.green.length - 5; + varblock.b_offset = scrinfo.blue.offset + scrinfo.blue.length - 5; + varblock.rfb_xres = scrinfo.yres; + varblock.rfb_maxy = scrinfo.xres - 1; +} + +/*****************************************************************************/ +void injectKeyEvent(uint16_t code, uint16_t value) +{ + struct input_event ev; + memset(&ev, 0, sizeof(ev)); + gettimeofday(&ev.time,0); + ev.type = EV_KEY; + ev.code = code; + ev.value = value; + if(write(kbdfd, &ev, sizeof(ev)) < 0) + { + printf("write event failed, %s\n", strerror(errno)); + } + + printf("injectKey (%d, %d)\n", code , value); +} + +static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl) +{ + int scancode = 0; + + int code = (int)key; + if (code>='0' && code<='9') { + scancode = (code & 0xF) - 1; + if (scancode<0) scancode += 10; + scancode += KEY_1; + } else if (code>=0xFF50 && code<=0xFF58) { + static const uint16_t map[] = + { KEY_HOME, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, + KEY_SOFT1, KEY_SOFT2, KEY_END, 0 }; + scancode = map[code & 0xF]; + } else if (code>=0xFFE1 && code<=0xFFEE) { + static const uint16_t map[] = + { KEY_LEFTSHIFT, KEY_LEFTSHIFT, + KEY_COMPOSE, KEY_COMPOSE, + KEY_LEFTSHIFT, KEY_LEFTSHIFT, + 0,0, + KEY_LEFTALT, KEY_RIGHTALT, + 0, 0, 0, 0 }; + scancode = map[code & 0xF]; + } else if ((code>='A' && code<='Z') || (code>='a' && code<='z')) { + static const uint16_t map[] = { + KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, + KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, + KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, + KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, + KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z }; + scancode = map[(code & 0x5F) - 'A']; + } else { + switch (code) { + case 0x0003: scancode = KEY_CENTER; break; + case 0x0020: scancode = KEY_SPACE; break; + case 0x0023: scancode = KEY_SHARP; break; + case 0x0033: scancode = KEY_SHARP; break; + case 0x002C: scancode = KEY_COMMA; break; + case 0x003C: scancode = KEY_COMMA; break; + case 0x002E: scancode = KEY_DOT; break; + case 0x003E: scancode = KEY_DOT; break; + case 0x002F: scancode = KEY_SLASH; break; + case 0x003F: scancode = KEY_SLASH; break; + case 0x0032: scancode = KEY_EMAIL; break; + case 0x0040: scancode = KEY_EMAIL; break; + case 0xFF08: scancode = KEY_BACKSPACE; break; + case 0xFF1B: scancode = KEY_BACK; break; + case 0xFF09: scancode = KEY_TAB; break; + case 0xFF0D: scancode = KEY_ENTER; break; + case 0x002A: scancode = KEY_STAR; break; + case 0xFFBE: scancode = KEY_F1; break; // F1 + case 0xFFBF: scancode = KEY_F2; break; // F2 + case 0xFFC0: scancode = KEY_F3; break; // F3 + case 0xFFC5: scancode = KEY_F4; break; // F8 + case 0xFFC8: rfbShutdownServer(cl->screen,TRUE); break; // F11 + } + } + + return scancode; +} + +static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl) +{ + int scancode; + + printf("Got keysym: %04x (down=%d)\n", (unsigned int)key, (int)down); + + if ((scancode = keysym2scancode(down, key, cl))) + { + injectKeyEvent(scancode, down); + } +} + +void injectTouchEvent(int down, int x, int y) +{ + struct input_event ev; + + // Calculate the final x and y + /* Fake touch screen always reports zero */ + if (xmin != 0 && xmax != 0 && ymin != 0 && ymax != 0) + { + x = xmin + (x * (xmax - xmin)) / (scrinfo.xres); + y = ymin + (y * (ymax - ymin)) / (scrinfo.yres); + } + + memset(&ev, 0, sizeof(ev)); + + // Then send a BTN_TOUCH + gettimeofday(&ev.time,0); + ev.type = EV_KEY; + ev.code = BTN_TOUCH; + ev.value = down; + if(write(touchfd, &ev, sizeof(ev)) < 0) + { + printf("write event failed, %s\n", strerror(errno)); + } + + // Then send the X + gettimeofday(&ev.time,0); + ev.type = EV_ABS; + ev.code = ABS_X; + ev.value = x; + if(write(touchfd, &ev, sizeof(ev)) < 0) + { + printf("write event failed, %s\n", strerror(errno)); + } + + // Then send the Y + gettimeofday(&ev.time,0); + ev.type = EV_ABS; + ev.code = ABS_Y; + ev.value = y; + if(write(touchfd, &ev, sizeof(ev)) < 0) + { + printf("write event failed, %s\n", strerror(errno)); + } + + // Finally send the SYN + gettimeofday(&ev.time,0); + ev.type = EV_SYN; + ev.code = 0; + ev.value = 0; + if(write(touchfd, &ev, sizeof(ev)) < 0) + { + printf("write event failed, %s\n", strerror(errno)); + } + + printf("injectTouchEvent (x=%d, y=%d, down=%d)\n", x , y, down); +} + +static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl) +{ + /* Indicates either pointer movement or a pointer button press or release. The pointer is +now at (x-position, y-position), and the current state of buttons 1 to 8 are represented +by bits 0 to 7 of button-mask respectively, 0 meaning up, 1 meaning down (pressed). +On a conventional mouse, buttons 1, 2 and 3 correspond to the left, middle and right +buttons on the mouse. On a wheel mouse, each step of the wheel upwards is represented +by a press and release of button 4, and each step downwards is represented by +a press and release of button 5. + From: http://www.vislab.usyd.edu.au/blogs/index.php/2009/05/22/an-headerless-indexed-protocol-for-input-1?blog=61 */ + + //printf("Got ptrevent: %04x (x=%d, y=%d)\n", buttonMask, x, y); + if(buttonMask & 1) { + // Simulate left mouse event as touch event + injectTouchEvent(1, x, y); + injectTouchEvent(0, x, y); + } +} + +#define PIXEL_FB_TO_RFB(p,r,g,b) ((p>>r)&0x1f001f)|(((p>>g)&0x1f001f)<<5)|(((p>>b)&0x1f001f)<<10) + +static void update_screen(void) +{ + unsigned int *f, *c, *r; + int x, y; + + varblock.min_i = varblock.min_j = 9999; + varblock.max_i = varblock.max_j = -1; + + f = (unsigned int *)fbmmap; /* -> framebuffer */ + c = (unsigned int *)fbbuf; /* -> compare framebuffer */ + r = (unsigned int *)vncbuf; /* -> remote framebuffer */ + + for (y = 0; y < scrinfo.yres; y++) + { + /* Compare every 2 pixels at a time, assuming that changes are likely + * in pairs. */ + for (x = 0; x < scrinfo.xres; x += 2) + { + unsigned int pixel = *f; + + if (pixel != *c) + { + *c = pixel; + + /* XXX: Undo the checkered pattern to test the efficiency + * gain using hextile encoding. */ + if (pixel == 0x18e320e4 || pixel == 0x20e418e3) + pixel = 0x18e318e3; + + *r = PIXEL_FB_TO_RFB(pixel, + varblock.r_offset, varblock.g_offset, varblock.b_offset); + + if (x < varblock.min_i) + varblock.min_i = x; + else + { + if (x > varblock.max_i) + varblock.max_i = x; + + if (y > varblock.max_j) + varblock.max_j = y; + else if (y < varblock.min_j) + varblock.min_j = y; + } + } + + f++, c++; + r++; + } + } + + if (varblock.min_i < 9999) + { + if (varblock.max_i < 0) + varblock.max_i = varblock.min_i; + + if (varblock.max_j < 0) + varblock.max_j = varblock.min_j; + + fprintf(stderr, "Dirty page: %dx%d+%d+%d...\n", + (varblock.max_i+2) - varblock.min_i, (varblock.max_j+1) - varblock.min_j, + varblock.min_i, varblock.min_j); + + rfbMarkRectAsModified(vncscr, varblock.min_i, varblock.min_j, + varblock.max_i + 2, varblock.max_j + 1); + + rfbProcessEvents(vncscr, 10000); + } +} + +/*****************************************************************************/ + +void print_usage(char **argv) +{ + printf("%s [-k device] [-t device] [-h]\n" + "-k device: keyboard device node, default is /dev/input/event3\n" + "-t device: touch device node, default is /dev/input/event1\n" + "-h : print this help\n"); +} + +int main(int argc, char **argv) +{ + if(argc > 1) + { + int i=1; + while(i < argc) + { + if(*argv[i] == '-') + { + switch(*(argv[i] + 1)) + { + case 'h': + print_usage(argv); + exit(0); + break; + case 'k': + i++; + strcpy(KBD_DEVICE, argv[i]); + break; + case 't': + i++; + strcpy(TOUCH_DEVICE, argv[i]); + break; + } + } + i++; + } + } + + printf("Initializing framebuffer device " FB_DEVICE "...\n"); + init_fb(); + printf("Initializing keyboard device %s ...\n", KBD_DEVICE); + init_kbd(); + printf("Initializing touch device %s ...\n", TOUCH_DEVICE); + init_touch(); + + printf("Initializing VNC server:\n"); + printf(" width: %d\n", (int)scrinfo.xres); + printf(" height: %d\n", (int)scrinfo.yres); + printf(" bpp: %d\n", (int)scrinfo.bits_per_pixel); + printf(" port: %d\n", (int)VNC_PORT); + init_fb_server(argc, argv); + + /* Implement our own event loop to detect changes in the framebuffer. */ + while (1) + { + while (vncscr->clientHead == NULL) + rfbProcessEvents(vncscr, 100000); + + rfbProcessEvents(vncscr, 100000); + update_screen(); + } + + printf("Cleaning up...\n"); + cleanup_fb(); + cleanup_kdb(); + cleanup_touch(); +} -- cgit v1.2.3 From f84d90c9e80ce6c12150d1bfe0f8f5fc44c90396 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Mon, 26 Feb 2018 14:32:36 +0100 Subject: androidvncserver: remove keycodes not in NDK anymore This makes the android VNC server example build again. --- examples/androidvncserver.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/androidvncserver.c b/examples/androidvncserver.c index a8c4827..237c68d 100644 --- a/examples/androidvncserver.c +++ b/examples/androidvncserver.c @@ -243,7 +243,7 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl) } else if (code>=0xFF50 && code<=0xFF58) { static const uint16_t map[] = { KEY_HOME, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, - KEY_SOFT1, KEY_SOFT2, KEY_END, 0 }; + KEY_END, 0 }; scancode = map[code & 0xF]; } else if (code>=0xFFE1 && code<=0xFFEE) { static const uint16_t map[] = @@ -264,10 +264,7 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl) scancode = map[(code & 0x5F) - 'A']; } else { switch (code) { - case 0x0003: scancode = KEY_CENTER; break; case 0x0020: scancode = KEY_SPACE; break; - case 0x0023: scancode = KEY_SHARP; break; - case 0x0033: scancode = KEY_SHARP; break; case 0x002C: scancode = KEY_COMMA; break; case 0x003C: scancode = KEY_COMMA; break; case 0x002E: scancode = KEY_DOT; break; @@ -280,7 +277,6 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl) case 0xFF1B: scancode = KEY_BACK; break; case 0xFF09: scancode = KEY_TAB; break; case 0xFF0D: scancode = KEY_ENTER; break; - case 0x002A: scancode = KEY_STAR; break; case 0xFFBE: scancode = KEY_F1; break; // F1 case 0xFFBF: scancode = KEY_F2; break; // F2 case 0xFFC0: scancode = KEY_F3; break; // F3 -- cgit v1.2.3 From c7c18332c8bc8706e09c4b757af44e9ff56716cb Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Tue, 13 Mar 2018 10:30:02 +0100 Subject: androidvncserver: fix a quite serious typo Closes #225. --- examples/androidvncserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/androidvncserver.c b/examples/androidvncserver.c index 237c68d..bcd8b84 100644 --- a/examples/androidvncserver.c +++ b/examples/androidvncserver.c @@ -513,6 +513,6 @@ int main(int argc, char **argv) printf("Cleaning up...\n"); cleanup_fb(); - cleanup_kdb(); + cleanup_kbd(); cleanup_touch(); } -- cgit v1.2.3 From 8d4d0219666e8746dee55c678a25f92c29cfc441 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Tue, 13 Mar 2018 10:40:05 +0100 Subject: androidvncserver: add some boilerplate comment that should have been in the 1st code drop --- examples/androidvncserver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/androidvncserver.c b/examples/androidvncserver.c index bcd8b84..a7a9685 100644 --- a/examples/androidvncserver.c +++ b/examples/androidvncserver.c @@ -1,5 +1,10 @@ /* - * $Id$ + * This example VNC server for Android is adopted from + * http://code.google.com/p/android-vnc-server/ with some additional + * fixes applied. + * + * To build, you'll need the Android Native Development Kit from + * http://developer.android.com/sdk/ndk/. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the -- cgit v1.2.3 From c49204c815687da49f0f62c462041506bc23822b Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Tue, 13 Mar 2018 10:42:03 +0100 Subject: androidvncserver: fix print_usage and a compiler warning --- examples/androidvncserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/androidvncserver.c b/examples/androidvncserver.c index a7a9685..885a7ef 100644 --- a/examples/androidvncserver.c +++ b/examples/androidvncserver.c @@ -460,7 +460,7 @@ void print_usage(char **argv) printf("%s [-k device] [-t device] [-h]\n" "-k device: keyboard device node, default is /dev/input/event3\n" "-t device: touch device node, default is /dev/input/event1\n" - "-h : print this help\n"); + "-h : print this help\n", argv[0]); } int main(int argc, char **argv) -- cgit v1.2.3 From 8b06f835e259652b0ff026898014fc7297ade858 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 29 Sep 2018 20:55:24 +0200 Subject: When connecting to a repeater, only send initialised string Closes #253 --- examples/repeater.c | 10 ++++++++-- libvncclient/rfbproto.c | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/repeater.c b/examples/repeater.c index cf0350f..dbfa39e 100644 --- a/examples/repeater.c +++ b/examples/repeater.c @@ -12,6 +12,7 @@ int main(int argc,char** argv) char *repeaterHost; int repeaterPort, sock; char id[250]; + int idlen; rfbClientPtr cl; int i,j; @@ -23,7 +24,12 @@ int main(int argc,char** argv) "Usage: %s []\n", argv[0]); exit(1); } - snprintf(id, sizeof(id) - 1, "ID:%s", argv[1]); + idlen = snprintf(id, sizeof(id) - 1, "ID:%s", argv[1]); + if(idlen < 0 || idlen >= (int)sizeof(id)) { + fprintf(stderr, "Error, given ID is probably too long.\n"); + return 1; + } + repeaterHost = argv[2]; repeaterPort = argc < 4 ? 5500 : atoi(argv[3]); @@ -48,7 +54,7 @@ int main(int argc,char** argv) perror("connect to repeater"); return 1; } - if (write(sock, id, sizeof(id)) != sizeof(id)) { + if (write(sock, id, idlen+1) != idlen+1) { perror("writing id"); return 1; } diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index e5373bc..669e388 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -363,6 +363,7 @@ rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int rep rfbProtocolVersionMsg pv; int major,minor; char tmphost[250]; + int tmphostlen; #ifdef LIBVNCSERVER_IPv6 client->sock = ConnectClientToTcpAddr6(repeaterHost, repeaterPort); @@ -398,8 +399,11 @@ rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int rep rfbClientLog("Connected to VNC repeater, using protocol version %d.%d\n", major, minor); - snprintf(tmphost, sizeof(tmphost), "%s:%d", destHost, destPort); - if (!WriteToRFBServer(client, tmphost, sizeof(tmphost))) + tmphostlen = snprintf(tmphost, sizeof(tmphost), "%s:%d", destHost, destPort); + if(tmphostlen < 0 || tmphostlen >= (int)sizeof(tmphost)) + return FALSE; /* snprintf error or output truncated */ + + if (!WriteToRFBServer(client, tmphost, tmphostlen + 1)) return FALSE; return TRUE; -- cgit v1.2.3