From: plugwash Date: Thu, 5 Feb 2009 18:38:37 +0000 (+0000) Subject: * make lmessages scream and die on fpc older than 2.2.0 due to fpc bug X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/987e8123d8ba3201ed2690004cfefd7983ff7487?ds=inline;hp=170e475daffeb198914a020e26afaf803a6f9608 * make lmessages scream and die on fpc older than 2.2.0 due to fpc bug * add makefile option to build test app without lmessages * fixup lcore building on various older versions of freepascal git-svn-id: file:///svnroot/lcore/trunk@35 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/Makefile b/Makefile index 4bf4bdd..2d70069 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ all: lcoretest +nomessages: + fpc -Sd -gl -dipv6 -dnomessages lcoretest.dpr + lcoretest: *.pas *.inc lcoretest.dpr fpc -Sd -gl -dipv6 lcoretest.dpr diff --git a/binipstuff.pas b/binipstuff.pas index 70ac401..8411cd3 100755 --- a/binipstuff.pas +++ b/binipstuff.pas @@ -86,12 +86,18 @@ type - {$ifdef ipv6} + {$ifdef ipv6} {$ifdef ver1_0} cuint16=word; cuint32=dword; sa_family_t=word; - + TInetSockAddr6 = packed record + sin6_family: word; + sin6_port: word; + sin6_flowinfo: uint32; + sin6_addr: tin6_addr; + sin6_scope_id: uint32; + end; {$endif} {$endif} TinetSockAddrv = packed record @@ -532,8 +538,11 @@ end; const biniplist_prefix='bipl'#0; - biniplist_prefixlen=length(biniplist_prefix); - + //fpc 1.0.x doesn't seem to like use of length function in a constant + //definition + //biniplist_prefixlen=length(biniplist_prefix); + biniplist_prefixlen=5; + function biniplist_new:tbiniplist; begin result := biniplist_prefix; diff --git a/lcorernd.pas b/lcorernd.pas index 643de3a..64759e8 100644 --- a/lcorernd.pas +++ b/lcorernd.pas @@ -133,7 +133,13 @@ implementation {$ifndef nolcorernd} uses {$ifdef win32}windows,activex,{$endif} - {$ifdef unix}baseunix,unix,unixutil,{$endif} + {$ifdef unix} + {$ifdef ver1_0} + linux, + {$else} + baseunix,unix,unixutil, + {$endif} + {$endif} fastmd5,sysutils; {$ifdef unix}{$include unixstuff.inc}{$endif} diff --git a/lcoretest.dpr b/lcoretest.dpr index 3c4277d..150b488 100755 --- a/lcoretest.dpr +++ b/lcoretest.dpr @@ -16,7 +16,9 @@ uses //include it to check if it compiles ok ;) {$ifndef win32} , - lmessages, + {$ifndef nomessages} + lmessages, + {$endif} unitfork {$endif} ; diff --git a/lmessages.pas b/lmessages.pas index 1302e29..1b7db62 100755 --- a/lmessages.pas +++ b/lmessages.pas @@ -14,6 +14,11 @@ interface uses pgtypes,sysutils,bsearchtree,strings,syncobjs; + +{$if (fpc_version < 2) or ((fpc_version=2) and ((fpc_release < 2) or ((fpc_release = 2) and (fpc_patch < 2)) ))} + {$error this code is only supported under fpc 2.2.2 and above due to bugs in the eventobject code in older versions} +{$endif} + type lparam=taddrint; wparam=taddrint; diff --git a/unixstuff.inc b/unixstuff.inc index f8c7396..89c96f2 100755 --- a/unixstuff.inc +++ b/unixstuff.inc @@ -8,6 +8,21 @@ linux.dup(original,result); end; {$define gettimeofdaysec := gettimeofday} + const + IPPROTO_UDP=17; + IPPROTO_ICMP=1; + function ntohs(invalue:word):word;inline; + var + invaluebytes : array[0..1] of byte absolute invalue; + resultbytes : array[0..1] of byte absolute result; + begin + {$ifdef endian_little} + resultbytes[0] := invaluebytes[1]; + resultbytes[1] := invaluebytes[0]; + {$else} + result := invalue; + {$endif} + end; {$else} {$define sigprocmask := fpsigprocmask} @@ -37,6 +52,28 @@ end; {$endif} {$endif} + {$ifdef ver2_0} + const + IPPROTO_UDP=17; + IPPROTO_ICMP=1; + {$endif} + {$ifdef ver1_9} + const + IPPROTO_UDP=17; + IPPROTO_ICMP=1; + function ntohs(invalue:word):word;inline; + var + invaluebytes : array[0..1] of byte absolute invalue; + resultbytes : array[0..1] of byte absolute result; + begin + {$ifdef endian_little} + resultbytes[0] := invaluebytes[1]; + resultbytes[1] := invaluebytes[0]; + {$else} + result := invalue; + {$endif} + end; + {$endif} procedure gettimeofday(var tv:ttimeval);inline; begin fpgettimeofday(@tv,nil);