--- synapse/ssfpc.pas	2010-06-03 12:30:37.000000000 +0200
+++ ../Components/synapse/ssfpc.pas	2010-06-03 12:04:09.000000000 +0200
@@ -250,7 +250,13 @@
 
   MSG_OOB       = sockets.MSG_OOB;      // Process out-of-band data.
   MSG_PEEK      = sockets.MSG_PEEK;     // Peek at incoming messages.
+  {$ifdef DARWIN}
+  MSG_NOSIGNAL  = $20000;  // Do not generate SIGPIPE.
+                           // Works under MAC OS X, but is undocumented,
+                           // So FPC doesn't include it
+  {$else}
   MSG_NOSIGNAL  = sockets.MSG_NOSIGNAL; // Do not generate SIGPIPE.
+  {$endif}
 
 const
   WSAEINTR = ESysEINTR;
@@ -889,4 +895,4 @@
 end;
 
 {$ENDIF}
-
+
\ No newline at end of file
--- synapse/ssl_openssl_lib.pas	2010-06-03 12:30:37.000000000 +0200
+++ ../Components/synapse/ssl_openssl_lib.pas	2010-06-03 12:07:58.000000000 +0200
@@ -85,7 +85,11 @@
   Classes,
   synafpc,
 {$IFNDEF MSWINDOWS}
+  {$ifdef FPC}
+  BaseUnix, SysUtils;
+  {$else}
   Libc, SysUtils;
+  {$endif}
 {$ELSE}
   Windows;
 {$ENDIF}
@@ -1727,7 +1731,7 @@
 {$ELSE}
       SSLLibHandle := LoadLib(DLLSSLName);
       SSLUtilHandle := LoadLib(DLLUtilName);
-  {$IFNDEF LINUX}
+  {$IFDEF MSWINDOWS}
       if (SSLLibHandle = 0) then
         SSLLibHandle := LoadLib(DLLSSLName2);
   {$ENDIF}
@@ -2040,4 +2044,4 @@
   SSLCS.Free;
 end;
 
-end.
+end.
\ No newline at end of file
--- synapse/synamisc.pas	2010-06-03 12:30:37.000000000 +0200
+++ ../Components/synapse/synamisc.pas	2010-06-03 12:15:39.000000000 +0200
@@ -69,7 +69,7 @@
 
 uses
   synautil, blcksock, SysUtils, Classes
-{$IFDEF LINUX}
+{$IFDEF UNIX}
   {$IFNDEF FPC}
   , Libc
   {$ENDIF}
@@ -148,7 +148,7 @@
 
 {==============================================================================}
 
-{$IFNDEF LINUX}
+{$IFNDEF UNIX}
 function GetDNSbyIpHlp: string;
 type
   PTIP_ADDRESS_STRING = ^TIP_ADDRESS_STRING;
@@ -240,7 +240,7 @@
 {$ENDIF}
 
 function GetDNS: string;
-{$IFDEF LINUX}
+{$IFDEF UNIX}
 var
   l: TStringList;
   n: integer;
@@ -287,7 +287,7 @@
 {==============================================================================}
 
 function GetIEProxy(protocol: string): TProxySetting;
-{$IFDEF LINUX}
+{$IFDEF UNIX}
 begin
   Result.Host := '';
   Result.Port := '';
@@ -394,4 +394,4 @@
 
 {==============================================================================}
 
-end.
+end.
\ No newline at end of file
--- synapse/synaser.pas	2010-06-03 12:30:37.000000000 +0200
+++ ../Components/synapse/synaser.pas	2010-06-03 12:26:32.000000000 +0200
@@ -189,8 +189,12 @@
   PDCB = ^TDCB;
 
 const
-{$IFDEF LINUX}
+{$IFDEF UNIX}
+  {$IFDEF DARWIN}
+  MaxRates = 18;
+  {$ELSE}
   MaxRates = 30;
+  {$ENDIF}
 {$ELSE}
   MaxRates = 19;  //FPC on some platforms not know high speeds?
 {$ENDIF}
@@ -214,8 +218,10 @@
     (38400, B38400),
     (57600, B57600),
     (115200, B115200),
-    (230400, B230400),
-    (460800, B460800)
+    (230400, B230400)
+{$IFNDEF DARWIN}
+    ,(460800, B460800)
+{$ENDIF}
 {$IFDEF LINUX}
     ,(500000, B500000),
     (576000, B576000),
@@ -232,6 +238,11 @@
     );
 {$ENDIF}
 
+{$IFDEF DARWIN}
+const // From fcntl.h
+  O_SYNC = $0080;  { synchronous writes }
+{$ENDIF}
+
 const
   sOK = 0;
   sErr = integer(-1);
@@ -310,11 +321,9 @@
     procedure GetComNr(Value: string); virtual;
     function PreTestFailing: boolean; virtual;{HGJ}
     function TestCtrlLine: Boolean; virtual;
-{$IFNDEF MSWINDOWS}
+{$IFDEF UNIX}
     procedure DcbToTermios(const dcb: TDCB; var term: termios); virtual;
     procedure TermiosToDcb(const term: termios; var dcb: TDCB); virtual;
-{$ENDIF}
-{$IFDEF LINUX}
     function ReadLockfile: integer; virtual;
     function LockfileName: String; virtual;
     procedure CreateLockfile(PidNr: integer); virtual;
@@ -325,7 +334,7 @@
     {: data Control Block with communication parameters. Usable only when you
      need to call API directly.}
     DCB: Tdcb;
-{$IFNDEF MSWINDOWS}
+{$IFDEF UNIX}
     TermiosStruc: termios;
 {$ENDIF}
     {:Object constructor.}
@@ -603,7 +612,7 @@
 
     {:Raise Synaser error with ErrNumber code. Usually used by internal routines.}
     procedure RaiseSynaError(ErrNumber: integer); virtual;
-{$IFDEF LINUX}
+{$IFDEF UNIX}
     function  cpomComportAccessible: boolean; virtual;{HGJ}
     procedure cpomReleaseComport; virtual; {HGJ}
 {$ENDIF}
@@ -778,7 +787,7 @@
   end;
   if InstanceActive then
   begin
-    {$IFDEF LINUX}
+    {$IFDEF UNIX}
     if FLinuxLock then
       cpomReleaseComport;
     {$ENDIF}
@@ -933,7 +942,7 @@
     SerialCheck(-1)
   else
     SerialCheck(0);
-  {$IFDEF LINUX}
+  {$IFDEF UNIX}
   if FLastError <> sOK then
     if FLinuxLock then
       cpomReleaseComport;
@@ -968,7 +977,7 @@
   begin
     SetSynaError(ErrNoDeviceAnswer);
     FileClose(FHandle);         {HGJ}
-    {$IFDEF LINUX}
+    {$IFDEF UNIX}
     if FLinuxLock then
       cpomReleaseComport;                {HGJ}
     {$ENDIF}                             {HGJ}
@@ -1918,7 +1927,11 @@
   {$IFNDEF FPC}
   SerialCheck(ioctl(FHandle, TCFLSH, TCIOFLUSH));
   {$ELSE}
-  SerialCheck(fpioctl(FHandle, TCFLSH, TCIOFLUSH));
+    {$IFDEF DARWIN}
+    SerialCheck(fpioctl(FHandle, TCIOflush, TCIOFLUSH));
+    {$ELSE}
+    SerialCheck(fpioctl(FHandle, TCFLSH, TCIOFLUSH));
+    {$ENDIF}
   {$ENDIF}
   FBuffer := '';
   ExceptCheck;
@@ -2154,7 +2167,7 @@
   Ownership Manager.
 }
 
-{$IFDEF LINUX}
+{$IFDEF UNIX}
 
 function TBlockSerial.LockfileName: String;
 var
@@ -2315,4 +2328,4 @@
 end;
 {$ENDIF}
 
-end.
+end.
\ No newline at end of file
