Merged HP-UX patches from VNC 4.1.2.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@608 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/README.hpux b/unix/README.hpux_aCC
similarity index 89%
rename from unix/README.hpux
rename to unix/README.hpux_aCC
index be0c56a..f2c5004 100644
--- a/unix/README.hpux
+++ b/unix/README.hpux_aCC
@@ -1,3 +1,5 @@
+Building on HP-UX 11.00 using aCC (tjr)
+--
 I have managed to build Xvnc on HPUX but only with some ugly hacking of
 the X tree.  The X tree I used as the basis for the build is the XFree86 4.2.0
 tree.  The XFree86 4.3.0 tree is unsuitable as it seems to have had some HPUX
@@ -21,9 +23,9 @@
   % gunzip -c X420src-1.tgz | tar xf -
   % patch -Np0 <xc.patch
 
-Then additionally apply the patches in hpux.patch:
+Then additionally apply the patches in hpux_aCC.patch:
 
-  % patch -Np0 <hpux.patch
+  % patch -Np0 <hpux_aCC.patch
 
 Finally try building the X tree:
 
diff --git a/unix/README.hpux_gcc b/unix/README.hpux_gcc
new file mode 100644
index 0000000..134e9fa
--- /dev/null
+++ b/unix/README.hpux_gcc
@@ -0,0 +1,63 @@
+Building on HP-UX 11.00, using GCC 3.3.2 (jnw)
+--
+I have managed to build Xvnc on HP-UX using GCC 3.3.2, by updating the
+earlier "ugly hacking" of the X tree to cope with using GCC instead of aCC.
+(aCC is the commercial HP-UX C++ compiler, whereas GCC is free, if you can find a build for your system).
+
+These build settings are known to work on HP-UX 11.00, with the following requirements:
+
+. From http://www.xfree86.org/ - XFree86 Project Web Site
+  - XFree86 4.2.0 source code (tarballs 1 & 2 are sufficient)
+
+. From http://devrsrc1.external.hp.com/LPK/ - HP's Linux Porting Kit 1.0
+  - GCC 3.3.2 - GCC C & C++ compilers
+  - patch 2.5.4 - GNU patch command
+  - make 3.80 - GNU make
+  - [optional, see below] X11R6incs 4.3.0 - X11 headers
+
+. From http://www.software.hp.com/ - HP's Software Depot home
+  - B3394BA.X11MotifDevKit.X11R6-PRG B.11.00.03 - X11 R6 Programming Environment
+
+. From http://www1.itrc.hp.com/ - HP's IT Resource Center
+  - PHSS_30967 - ld(1) and linker tools cumulative patch for HP-UX 11.00
+
+Ensure that gcc and the GCC version of c++ are on your path, so that configure can find them.
+
+Build the main part of the VNC distribution as normal:
+
+  % ./configure
+  % make
+
+Set the CC environment variable:
+
+  % CC=gcc
+  % export CC
+
+Unpack the X tree and apply the patches in xc.patch:
+
+  % gunzip -c X420src-1.tgz | tar xf -
+  % patch -Np0 <xc.patch
+
+Then additionally apply the patches in hpux_gcc.patch:
+
+  % patch -Np0 <hpux_gcc.patch
+
+Finally try building the X tree:
+
+  % cd xc
+  % make World
+
+If it all goes to plan you will be left with Xvnc in xc/programs/Xserver.  You
+will probably have to modify the vncserver script to set up a sensible font
+path, since many of the font directories on HPUX are different from the
+defaults compiled into Xvnc.  Note that the vncserver script also requires perl,
+which is not on the path by default on HPUX 11.00.
+
+If you don't care about x0vncserver, and you don't have the X11 development files
+(B3394BA), then you can instead compile everything else (including Xvnc) with
+only the Linux Porting Kit's X11R6incs package installed.  You'll need to remove
+x0vncserver explicitly from the top level Makefile.in before running configure
+in order to do this.
+
+If anyone can find a neater way of building a VNC-compatible X tree on HPUX
+please let us know (see http://www.tightvnc.com for contact details).
diff --git a/unix/hpux.patch b/unix/hpux_aCC.patch
similarity index 100%
rename from unix/hpux.patch
rename to unix/hpux_aCC.patch
diff --git a/unix/hpux_gcc.patch b/unix/hpux_gcc.patch
new file mode 100644
index 0000000..08e9ab2
--- /dev/null
+++ b/unix/hpux_gcc.patch
@@ -0,0 +1,255 @@
+*** xc.orig/config/cf/X11.tmpl	Tue Jan 15 22:55:26 2002
+--- xc/config/cf/X11.tmpl	Sun Sep  7 19:52:01 2003
+***************
+*** 3120,3126 ****
+  	$(RM) index.raw file.nPS file.PS file.txt
+  #endif
+  
+! #ifndef MakeSimpleDoc(file,srcs)
+  #define MakeSimpleDoc(file,srcs) MakeDepSimpleDoc(file,srcs,srcs)
+  #endif
+  
+--- 3120,3126 ----
+  	$(RM) index.raw file.nPS file.PS file.txt
+  #endif
+  
+! #ifndef MakeSimpleDoc
+  #define MakeSimpleDoc(file,srcs) MakeDepSimpleDoc(file,srcs,srcs)
+  #endif
+  
+*** xc.orig/config/cf/hp.cf	Wed Jan 17 16:22:31 2001
+--- xc/config/cf/hp.cf	Mon Sep  8 19:54:52 2003
+***************
+*** 131,137 ****
+  #endif
+  #define HPFastScrolling		YES
+  #ifndef BuildServer
+! # define BuildServer		__hp9000s700
+  #endif
+  #if OSMajorVersion < 10
+  #define NeedBerklib		(BuildServer|BuildFontServer)
+--- 131,137 ----
+  #endif
+  #define HPFastScrolling		YES
+  #ifndef BuildServer
+! # define BuildServer		YES
+  #endif
+  #if OSMajorVersion < 10
+  #define NeedBerklib		(BuildServer|BuildFontServer)
+***************
+*** 139,145 ****
+  #define XawI18nDefines		-DHAS_WCHAR_H -DHAS_ISW_FUNCS
+  
+  #if OSMajorVersion < 6 || (OSMajorVersion == 6 && OSMinorVersion < 2)
+! # define ConnectionFlags	-DTCPCONN	/* no unix sockets */
+  #endif
+  
+  #if OSMajorVersion > 8
+--- 139,145 ----
+  #define XawI18nDefines		-DHAS_WCHAR_H -DHAS_ISW_FUNCS
+  
+  #if OSMajorVersion < 6 || (OSMajorVersion == 6 && OSMinorVersion < 2)
+! /*# define ConnectionFlags	-DTCPCONN*/	/* no unix sockets */
+  #endif
+  
+  #if OSMajorVersion > 8
+*** xc/config/cf/site.def.orig  Tue Sep  9 17:42:56 2003
+--- xc/config/cf/site.def       Tue Sep  9 17:43:07 2003
+***************
+*** 84,90 ****
+  #ifdef AfterVendorCF
+  
+  #ifndef ProjectRoot
+! #define ProjectRoot /usr/X11R6
+  #endif
+  
+  /*
+--- 84,90 ----
+  #ifdef AfterVendorCF
+  
+  #ifndef ProjectRoot
+! /*#define ProjectRoot /usr/X11R6*/
+  #endif
+  
+  /*
+*** xc.orig/config/imake/imake.c	Fri Dec 14 19:53:18 2001
+--- xc/config/imake/imake.c	Mon Sep  8 19:35:33 2003
+***************
+*** 288,293 ****
+--- 288,294 ----
+  #define	TRUE		1
+  #define	FALSE		0
+  
++ #define FIXUP_CPP_WHITESPACE
+  #ifdef FIXUP_CPP_WHITESPACE
+  int	InRule = FALSE;
+  # ifdef INLINE_SYNTAX
+***************
+*** 389,394 ****
+--- 390,401 ----
+  	FILE	*tmpfd = NULL;
+  	char	makeMacro[ BUFSIZ ];
+  	char	makefileMacro[ BUFSIZ ];
++ 
++ #ifdef FIXUP_CPP_WHITESPACE
++ 	fprintf(stderr,"\nFIXUP_CPP_WHITESPACE is defined!!\n\n");
++ #else
++ #error "FIXUP_CPP_WHITESPACE is not defined"
++ #endif
+  
+  	program = argv[0];
+  	init();
+*** xc.orig/config/imake/imakemdep.h	Fri Dec 14 19:53:19 2001
+--- xc/config/imake/imakemdep.h	Tue Sep  9 16:38:18 2003
+***************
+*** 48,54 ****
+  #ifdef hp9000s800
+  #define imake_ccflags "-DSYSV"
+  #else
+! #define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV"
+  #endif
+  #endif
+  
+--- 48,54 ----
+  #ifdef hp9000s800
+  #define imake_ccflags "-DSYSV"
+  #else
+! #define imake_ccflags "-DSYSV"
+  #endif
+  #endif
+  
+***************
+*** 211,217 ****
+   *     all colons).  One way to tell if you need this is to see whether or not
+   *     your Makefiles have no tabs in them and lots of @@ strings.
+   */
+! #if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || defined(sco) || (defined(AMOEBA) && defined(CROSS_COMPILE)) || defined(__QNX__) || defined(__sgi)
+  #define FIXUP_CPP_WHITESPACE
+  #endif
+  #ifdef WIN32
+--- 211,217 ----
+   *     all colons).  One way to tell if you need this is to see whether or not
+   *     your Makefiles have no tabs in them and lots of @@ strings.
+   */
+! #if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || defined(sco) || (defined(AMOEBA) && defined(CROSS_COMPILE)) || defined(__QNX__) || defined(__sgi) || defined(hpux)
+  #define FIXUP_CPP_WHITESPACE
+  #endif
+  #ifdef WIN32
+*** xc.orig/include/Xfuncs.h	Fri Dec 14 19:53:25 2001
+--- xc/include/Xfuncs.h	Sun Sep  7 20:10:35 2003
+***************
+*** 42,48 ****
+  #else
+  #if defined(SYSV)
+  #include <memory.h>
+! void bcopy();
+  #define bzero(b,len) memset(b, 0, len)
+  #define bcmp(b1,b2,len) memcmp(b1, b2, len)
+  #elif defined(__EMX__)
+--- 42,48 ----
+  #else
+  #if defined(SYSV)
+  #include <memory.h>
+! /*void bcopy();*/
+  #define bzero(b,len) memset(b, 0, len)
+  #define bcmp(b1,b2,len) memcmp(b1, b2, len)
+  #elif defined(__EMX__)
+*** xc.orig/include/extensions/security.h	Fri Dec 14 19:53:29 2001
+--- xc/include/extensions/security.h	Fri Aug  1 17:43:44 2003
+***************
+*** 110,115 ****
+--- 110,116 ----
+  
+  #include "input.h"    /* for DeviceIntPtr */
+  #include "property.h" /* for PropertyPtr */
++ #include "resource.h"
+  
+  /* resource type to pass in LookupIDByType for authorizations */
+  extern RESTYPE SecurityAuthorizationResType;
+*** xc.orig/lib/font/Type1/fontfcn.c	Fri Nov 23 19:21:31 2001
+--- xc/lib/font/Type1/fontfcn.c	Sun Sep  7 19:29:27 2003
+***************
+*** 47,52 ****
+--- 47,53 ----
+   */
+  /* $XFree86: xc/lib/font/Type1/fontfcn.c,v 1.11 2001/11/23 19:21:31 dawes Exp $ */
+   
++ #include <stdlib.h>
+  #ifndef FONTMODULE
+  #include <stdio.h>
+  #include <string.h>
+*** xc.orig/lib/font/Type1/objects.h	Mon Aug 27 20:49:52 2001
+--- xc/lib/font/Type1/objects.h	Sun Sep  7 19:29:37 2003
+***************
+*** 50,56 ****
+  #include <Xdefs.h>
+  #include <Xfuncproto.h>
+  #ifndef FONTMODULE
+! #include <stdlib.h>
+  #endif
+  /*SHARED*/
+  
+--- 50,56 ----
+  #include <Xdefs.h>
+  #include <Xfuncproto.h>
+  #ifndef FONTMODULE
+! /*#include <stdlib.h>*/
+  #endif
+  /*SHARED*/
+  
+*** xc.orig/lib/xtrans/Xtransutil.c     Tue Sep  9 17:40:14 2003
+--- xc/lib/xtrans/Xtransutil.c  Tue Sep  9 17:40:20 2003
+***************
+*** 503,514 ****
+  	    if (updateOwner && !updatedOwner) {
+  	  	PRMSG(1, "mkdir: Owner of %s should be set to root\n",
+  		      path, 0, 0);
+- 		sleep(5);
+  	    }
+  	    if (updateMode && !updatedMode) {
+  	  	PRMSG(1, "mkdir: Mode of %s should be set to %04o\n",
+  		      path, mode, 0);
+- 		sleep(5);
+  	    }
+  	    return 0;
+  	}
+--- 503,512 ----
+*** xc.orig/programs/Xserver/vnc/Xvnc/xvnc.cc     12 Aug 2003 11:00:14 -0000
+--- xc/programs/Xserver/vnc/Xvnc/xvnc.cc     9 Sep 2003 16:15:53 -0000
+***************
+*** 1221,1223 ****
+--- 1221,1229 ----
+    miRegisterPointerDevice(screenInfo.screens[0], p);
+    (void)mieqInit ((DevicePtr)k, (DevicePtr)p);
+  }
++ 
++ extern "C" {
++   void XTestGenerateEvent() {}
++   void XTestGetPointerPos() {}
++   void XTestJumpPointer() {}
++ }
+*** xc.orig/config/cf/vnc.def        7 Jul 2003 09:51:22
+--- xc/config/cf/vnc.def        9 Sep 2003 15:54:23
+***************
+*** 9,14 ****
+--- 9,28 ----
+  #define XnestServer NO
+  #define XprtServer NO
+  
++ #define BuildXKB NO
++ #define HasCplusplus YES
++ #define CplusplusCmd g++
++ #define CplusplusOptions
++ #define ProjectRoot /usr
++ #define DefaultFontPath /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/iso_8859.1/100dpi/,/usr/lib/X11/fonts/iso_8859.1/75dpi/
++
++ #define CcCmd gcc
++ #define IncRoot /bunchOfArse
++ #define OptimizedCDebugFlags
++ #define DefaultCCOptions
++ #define SharedLibraryCCOptions -shared
++ #define PositionIndependentCFlags -fPIC
++ 
+  #ifdef SunArchitecture
+  #define ProjectRoot /usr/openwin
+  #define HasGcc2 YES