diff -Naur ../pwlib/include/ptlib/unix/ptlib/pmachdep.h ./include/ptlib/unix/ptlib/pmachdep.h
--- ../pwlib/include/ptlib/unix/ptlib/pmachdep.h	2003-05-06 08:59:12.000000000 +0200
+++ ./include/ptlib/unix/ptlib/pmachdep.h	2008-02-27 16:27:25.000000000 +0100
@@ -445,7 +445,7 @@
 #include <netinet/tcp.h>
 #include <sys/ioctl.h>
  
-typedef int socklen_t;
+//typedef int socklen_t;
  
 #define HAS_IFREQ
  
diff -Naur ../pwlib/make/unix.mak ./make/unix.mak
--- ../pwlib/make/unix.mak	2003-07-25 00:01:42.000000000 +0200
+++ ./make/unix.mak	2008-02-27 16:53:37.000000000 +0100
@@ -634,7 +634,7 @@
 
 CFLAGS		+= -fno-common -dynamic
 LDFLAGS		+= -multiply_defined suppress
-ENDLDLIBS	+= -framework AudioToolbox -framework CoreAudio
+ENDLDLIBS	+= -framework AudioToolbox -framework CoreAudio -lresolv
 
 #HAS_QUICKTIMEX := 1
 #STDCCFLAGS     += -DHAS_QUICKTIMEX
@@ -668,7 +668,7 @@
 # stupid Projct Builder compiler
 STDCCFLAGS	+= -DNO_LONG_DOUBLE
 # 
-LDLIBS		+= -prebind -framework CoreServices -framework QuickTime -framework Carbon
+LDLIBS		+= -prebind -framework CoreServices -framework QuickTime -framework Carbon -lresolv
   
 P_SHAREDLIB	:= 0 
 P_USE_RANLIB	:= 1
@@ -966,7 +966,7 @@
 #STDCCFLAGS     += -fno-implement-inlines
 
 # add OS directory to include path
-STDCCFLAGS	+= -I$(UNIX_INC_DIR) -I/usr/include/pwlib
+STDCCFLAGS	+= -I$(UNIX_INC_DIR) -I/usr/include/pwlib -I@@PREFIX@@/include
 
 
 # add library directory to library path and include the library
diff -Naur ../pwlib/src/ptclib/pdns.cxx ./src/ptclib/pdns.cxx
--- ../pwlib/src/ptclib/pdns.cxx	2003-04-29 01:57:40.000000000 +0200
+++ ./src/ptclib/pdns.cxx	2008-02-27 16:37:47.000000000 +0100
@@ -72,6 +72,7 @@
 #if P_HAS_RESOLVER
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include <nameser8_compat.h>
 #endif
 
 #endif
diff -Naur ../pwlib/src/ptclib/pssl.cxx ./src/ptclib/pssl.cxx
--- ../pwlib/src/ptclib/pssl.cxx	2003-04-16 10:00:19.000000000 +0200
+++ ./src/ptclib/pssl.cxx	2008-02-27 16:40:44.000000000 +0100
@@ -285,14 +285,14 @@
 
 PSSLPrivateKey::PSSLPrivateKey(const BYTE * keyData, PINDEX keySize)
 {
-  key = d2i_AutoPrivateKey(NULL, (BYTE **)&keyData, keySize);
+  key = d2i_AutoPrivateKey(NULL, (const unsigned char** )&keyData, keySize);
 }
 
 
 PSSLPrivateKey::PSSLPrivateKey(const PBYTEArray & keyData)
 {
   const BYTE * keyPtr = keyData;
-  key = d2i_AutoPrivateKey(NULL, (BYTE **)&keyPtr, keyData.GetSize());
+  key = d2i_AutoPrivateKey(NULL, (const unsigned char** )&keyPtr, keyData.GetSize());
 }
 
 
@@ -460,14 +460,14 @@
 
 PSSLCertificate::PSSLCertificate(const BYTE * certData, PINDEX certSize)
 {
-  certificate = d2i_X509(NULL, (unsigned char **)&certData, certSize);
+  certificate = d2i_X509(NULL, (const unsigned char **)&certData, certSize);
 }
 
 
 PSSLCertificate::PSSLCertificate(const PBYTEArray & certData)
 {
   const BYTE * certPtr = certData;
-  certificate = d2i_X509(NULL, (unsigned char **)&certPtr, certData.GetSize());
+  certificate = d2i_X509(NULL, (const unsigned char **)&certPtr, certData.GetSize());
 }
 
 
@@ -477,7 +477,7 @@
   PBase64::Decode(certStr, certData);
   if (certData.GetSize() > 0) {
     const BYTE * certPtr = certData;
-    certificate = d2i_X509(NULL, (unsigned char **)&certPtr, certData.GetSize());
+    certificate = d2i_X509(NULL, (const unsigned char **)&certPtr, certData.GetSize());
   }
   else
     certificate = NULL;
diff -Naur ../pwlib/src/ptclib/udp.cxx ./src/ptclib/udp.cxx
--- ../pwlib/src/ptclib/udp.cxx	2003-06-23 18:23:57.000000000 +0200
+++ ./src/ptclib/udp.cxx	2008-02-27 16:34:10.000000000 +0100
@@ -226,7 +226,7 @@
                    *len,
                    0,
                    (struct sockaddr *)&from,
-                   &fromLen);
+                   (socklen_t *)&fromLen);
 
    if ( *len == SOCKET_ERROR )
    {
diff -Naur ../pwlib/src/ptlib/unix/Makefile ./src/ptlib/unix/Makefile
--- ../pwlib/src/ptlib/unix/Makefile	2003-07-28 20:44:01.000000000 +0200
+++ ./src/ptlib/unix/Makefile	2008-02-27 16:22:12.000000000 +0100
@@ -394,7 +394,7 @@
 VPATH_CXX		:= $(COMMON_SRC_DIR) $(COMPONENT_SRC_DIR)
 
 
-CFLAGS += -DPTRACING=1
+CFLAGS += -DPTRACING=1 -I@@PREFIX@@/include
 
 
 # try and keep the order of modules in reverse order of usage so any
diff -Naur ../pwlib/src/ptlib/unix/udll.cxx ./src/ptlib/unix/udll.cxx
--- ../pwlib/src/ptlib/unix/udll.cxx	2003-07-09 13:37:13.000000000 +0200
+++ ./src/ptlib/unix/udll.cxx	2008-02-27 16:49:26.000000000 +0100
@@ -196,9 +196,9 @@
 			  if (!make_private_module_public)
 			  {
 			    _dyld_func_lookup("__dyld_NSMakePrivateModulePublic", 
-				(unsigned long *)&make_private_module_public);
+				(void **)&make_private_module_public);
 			  }
-			  make_private_module_public(module);
+			  make_private_module_public((__NSModule*)module);
 			}
 			break;
 		case NSObjectFileImageInappropriateFile:
@@ -233,7 +233,7 @@
 		/* Global context, use NSLookupAndBindSymbol */
 		if (NSIsSymbolNameDefined(symbol))
 		{
-			nssym = NSLookupAndBindSymbol(symbol);
+			nssym = (__NSSymbol**)NSLookupAndBindSymbol(symbol);
 		}
 
 	}
@@ -247,7 +247,7 @@
 		{
 			if (NSIsSymbolNameDefinedInImage((struct mach_header *)handle, symbol))
 			{
-				nssym = NSLookupSymbolInImage((struct mach_header *)handle,
+				nssym = (__NSSymbol**)NSLookupSymbolInImage((struct mach_header *)handle,
 											  symbol,
 											  NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
 											  | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
@@ -256,7 +256,7 @@
 		}
 		else
 		{
-			nssym = NSLookupSymbolInModule(handle, symbol);
+			nssym = (__NSSymbol**)NSLookupSymbolInModule((__NSModule*)handle, symbol);
 		}
 	}
 	if (!nssym)
@@ -264,7 +264,7 @@
 		error(0, "Symbol \"%s\" Not found", symbol);
 		return NULL;
 	}
-	return NSAddressOfSymbol(nssym);
+	return NSAddressOfSymbol((__NSSymbol*)nssym);
 }
 
 static const char *dlerror(void)
@@ -280,9 +280,9 @@
 		error(0, "Can't remove dynamic libraries on darwin");
 		return 0;
 	}
-	if (!NSUnLinkModule(handle, 0))
+	if (!NSUnLinkModule((__NSModule*)handle, 0))
 	{
-		error(0, "unable to unlink module %s", NSNameOfModule(handle));
+		error(0, "unable to unlink module %s", NSNameOfModule((__NSModule*)handle));
 		return 1;
 	}
 	return 0;
@@ -304,7 +304,7 @@
 	}
 	else
 	{
-		malloc_sym = malloc(sym_len + 2);
+		malloc_sym = (char*)malloc(sym_len + 2);
 		if (malloc_sym)
 		{
 			sprintf(malloc_sym, "_%s", symbol);