all: lcoretest\r
 \r
+nomessages:\r
+       fpc -Sd -gl -dipv6 -dnomessages lcoretest.dpr\r
+\r
 lcoretest: *.pas *.inc lcoretest.dpr\r
        fpc -Sd -gl -dipv6 lcoretest.dpr\r
        \r
 
 \r
 \r
 \r
-    {$ifdef ipv6}\r
+  {$ifdef ipv6}\r
     {$ifdef ver1_0}\r
       cuint16=word;\r
       cuint32=dword;\r
       sa_family_t=word;\r
-\r
+\r      TInetSockAddr6 = packed record\r
+        sin6_family: word;\r
+        sin6_port: word;\r
+        sin6_flowinfo: uint32;\r
+        sin6_addr: tin6_addr;\r
+        sin6_scope_id: uint32;\r
+      end;\r
     {$endif}\r
   {$endif}\r
   TinetSockAddrv = packed record\r
 \r
 const\r
   biniplist_prefix='bipl'#0;\r
-  biniplist_prefixlen=length(biniplist_prefix);\r
-\r
+  //fpc 1.0.x doesn't seem to like use of length function in a constant \r
+  //definition\r
+  //biniplist_prefixlen=length(biniplist_prefix);\r
+\r  biniplist_prefixlen=5;\r
+  \r
 function biniplist_new:tbiniplist;\r
 begin\r
   result := biniplist_prefix;\r
 
 {$ifndef nolcorernd}\r
 uses\r
   {$ifdef win32}windows,activex,{$endif}\r
-  {$ifdef unix}baseunix,unix,unixutil,{$endif}\r
+  {$ifdef unix}\r
+    {$ifdef ver1_0}\r
+      linux,\r
+    {$else}\r
+      baseunix,unix,unixutil,\r
+    {$endif}\r
+  {$endif}\r
   fastmd5,sysutils;\r
 \r
 {$ifdef unix}{$include unixstuff.inc}{$endif}\r
 
   //include it to check if it compiles ok ;)\r
   {$ifndef win32}\r
     ,\r
-    lmessages,\r
+    {$ifndef nomessages}\r
+      lmessages,\r
+    {$endif}\r
     unitfork\r
   {$endif}\r
   ;\r
 
 \r
 uses pgtypes,sysutils,bsearchtree,strings,syncobjs;\r
 \r
+\r
+{$if (fpc_version < 2) or ((fpc_version=2) and ((fpc_release < 2) or ((fpc_release = 2) and (fpc_patch < 2)) ))}\r
+  {$error this code is only supported under fpc 2.2.2 and above due to bugs in the eventobject code in older versions}\r
+{$endif}\r
+\r
 type\r
   lparam=taddrint;\r
   wparam=taddrint;\r
 
       linux.dup(original,result);\r
     end;\r
     {$define gettimeofdaysec := gettimeofday}\r
+    const\r
+      IPPROTO_UDP=17;\r
+      IPPROTO_ICMP=1;\r
+    function ntohs(invalue:word):word;inline;\r
+    var\r
+      invaluebytes : array[0..1] of byte absolute invalue;\r
+      resultbytes : array[0..1] of byte absolute result;\r
+    begin\r
+      {$ifdef endian_little}\r
+       resultbytes[0] := invaluebytes[1];\r
+       resultbytes[1] := invaluebytes[0];\r
+      {$else}\r
+       result := invalue;\r
+      {$endif}\r
+    end;  \r
   {$else}\r
     \r
     {$define sigprocmask := fpsigprocmask}\r
        end;\r
       {$endif}\r
     {$endif}\r
+    {$ifdef ver2_0}\r
+      const\r
+        IPPROTO_UDP=17;\r
+        IPPROTO_ICMP=1;\r
+    {$endif}\r
+    {$ifdef ver1_9}\r
+      const\r
+        IPPROTO_UDP=17;\r
+        IPPROTO_ICMP=1;\r
+      function ntohs(invalue:word):word;inline;\r
+      var\r
+        invaluebytes : array[0..1] of byte absolute invalue;\r
+       resultbytes : array[0..1] of byte absolute result;\r
+      begin\r
+        {$ifdef endian_little}\r
+         resultbytes[0] := invaluebytes[1];\r
+         resultbytes[1] := invaluebytes[0];\r
+       {$else}\r
+         result := invalue;\r
+       {$endif}\r
+      end;\r
+    {$endif}\r
     procedure gettimeofday(var tv:ttimeval);inline;\r
     begin\r
       fpgettimeofday(@tv,nil);    \r