diff -urN ../vnc_unixsrc.orig/Xvnc/config/cf/vnclibs.def ./Xvnc/config/cf/vnclibs.def
--- ../vnc_unixsrc.orig/Xvnc/config/cf/vnclibs.def	Thu Jun 27 22:53:19 2002
+++ ./Xvnc/config/cf/vnclibs.def	Wed Mar  3 21:14:18 2004
@@ -11,7 +11,7 @@
 /* Avoid linking with different libjpeg in /usr/shlib under Tru64. */
 VNCSYSLIBS = /usr/local/lib/libjpeg.a /usr/local/lib/libz.a
 #else
-VNCSYSLIBS = -L/usr/local/lib -ljpeg -lz
+VNCSYSLIBS = -L@PREFIX@/lib -ljpeg -lz
 #endif
 
-VNCCPPFLAGS = -I$(TOP)/../include -I/usr/local/include
+VNCCPPFLAGS = -I$(TOP)/../include -I@PREFIX@/include
diff -urN ../vnc_unixsrc.orig/Xvnc/config/imake/imakemdep.h ./Xvnc/config/imake/imakemdep.h
--- ../vnc_unixsrc.orig/Xvnc/config/imake/imakemdep.h	Wed Feb 19 08:39:54 2003
+++ ./Xvnc/config/imake/imakemdep.h	Wed Mar  3 21:14:18 2004
@@ -272,6 +272,9 @@
 #ifdef __MACH__
 #define DEFAULT_CPP "/usr/bin/cpp"
 #endif
+#if defined(__APPLE__)
+#define DEFAULT_CPP "cpp"
+#endif
 
 /*
  * Step 5:  cpp_argv
@@ -555,6 +558,9 @@
 	"-traditional",
 	"-Demxos2",
 #endif
+#if defined(__APPLE__)
+    "-D__APPLE__",
+#endif
 
 };
 
@@ -614,6 +620,12 @@
 # define DEFAULT_OS_MINOR_REV	"r %*d.%[0-9]"
 # define DEFAULT_OS_TEENY_REV	"r %*d.%*d.%[0-9]"
 # define DEFAULT_OS_NAME	"srm %[^\n]"
+#elif defined(__APPLE__)	
+/* uname -v returns "x.yz" or "x.y.z", e.g. "2.02" or "2.1.2". */
+# define DEFAULT_OS_MAJOR_REV	"r %[0-9]"
+# define DEFAULT_OS_MINOR_REV	"r %*d.%[0-9]"
+# define DEFAULT_OS_TEENY_REV	"r %*d.%*d.%[0-9]" /* this will just get 0 */
+# define DEFAULT_OS_NAME	"s %[^\n]"
 #elif defined(ISC)
 /* ISC all Versions ? */
 /* uname -r returns "x.y", e.g. "3.2" ,uname -v returns "x" e.g. "2" */
@@ -922,6 +934,12 @@
 #endif
 #ifdef __EMX__
 	{"__EMX__", "1"},
+#endif
+#if defined(__ppc__)
+    {"__ppc__", "1"},
+#endif
+#if defined(__BIG_ENDIAN__) 
+    {"__BIG_ENDIAN__", "1"},
 #endif
 	/* add any additional symbols before this line */
 	{NULL, NULL}
diff -urN ../vnc_unixsrc.orig/Xvnc/programs/Xserver/include/os.h ./Xvnc/programs/Xserver/include/os.h
--- ../vnc_unixsrc.orig/Xvnc/programs/Xserver/include/os.h	Sun Jun 11 05:00:52 2000
+++ ./Xvnc/programs/Xserver/include/os.h	Wed Mar  3 21:14:18 2004
@@ -51,6 +51,9 @@
 
 #ifndef OS_H
 #define OS_H
+#ifdef __APPLE__
+#include <stdlib.h>
+#endif
 #include "misc.h"
 #define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
 #define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
diff -urN ../vnc_unixsrc.orig/Xvnc/programs/Xserver/include/servermd.h ./Xvnc/programs/Xserver/include/servermd.h
--- ../vnc_unixsrc.orig/Xvnc/programs/Xserver/include/servermd.h	Wed Feb 19 08:39:54 2003
+++ ./Xvnc/programs/Xserver/include/servermd.h	Wed Mar  3 21:14:18 2004
@@ -132,6 +132,22 @@
 
 #endif /* vax */
 
+#ifdef __DARWIN__
+
+#define IMAGE_BYTE_ORDER        MSBFirst
+#define BITMAP_BIT_ORDER        MSBFirst
+#define GLYPHPADBYTES           4
+#define GETLEFTBITS_ALIGNMENT   1
+
+#define LARGE_INSTRUCTION_CACHE
+#define FAST_CONSTANT_OFFSET_MODE
+#define PLENTIFUL_REGISTERS
+#define AVOID_MEMORY_READ
+
+#define FAST_MEMCPY
+
+#endif /* __DARWIN__ */
+
 #if (defined(Lynx) && defined(__powerpc__))
 
 /* For now this is for Xvfb only */
diff -urN ../vnc_unixsrc.orig/Xvnc/programs/Xserver/os/access.c ./Xvnc/programs/Xserver/os/access.c
--- ../vnc_unixsrc.orig/Xvnc/programs/Xserver/os/access.c	Sun Jun 11 05:00:52 2000
+++ ./Xvnc/programs/Xserver/os/access.c	Wed Mar  3 21:14:18 2004
@@ -103,7 +103,7 @@
 #endif
 
 #if !defined(AMOEBA)
-#ifdef hpux
+#if defined(hpux) || defined(__DARWIN__)
 # include <sys/utsname.h>
 # ifdef HAS_IFREQ
 #  include <net/if.h>
@@ -480,7 +480,7 @@
 
 #else /* WINTCP */
 
-#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ))
+#if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(__DARWIN__)
 void
 DefineSelf (fd)
     int fd;
