* now first searches ppcross<target> if -P<target> is specified.

After that it still searches for ppc<target>

git-svn-id: trunk@2759 -
This commit is contained in:
marco 2006-03-05 13:36:31 +00:00
parent e5ebc40446
commit 63e8d1062c

View File

@ -71,28 +71,35 @@ program fpc;
findclose(Info); findclose(Info);
end; end;
procedure findexe(var ppcbin:string); function findexe(var ppcbin:string): boolean;
var var
path : string; path : string;
begin begin
{ add .exe extension } { add .exe extension }
findexe:=false;
ppcbin:=ppcbin+exeext; ppcbin:=ppcbin+exeext;
{ get path of fpc.exe } { get path of fpc.exe }
path:=splitpath(paramstr(0)); path:=splitpath(paramstr(0));
if FileExists(path+ppcbin) then if FileExists(path+ppcbin) then
ppcbin:=path+ppcbin begin
ppcbin:=path+ppcbin;
findexe:=true;
end
else else
begin begin
path:=FileSearch(ppcbin,getenvironmentvariable('PATH')); path:=FileSearch(ppcbin,getenvironmentvariable('PATH'));
if path<>'' then if path<>'' then
begin
ppcbin:=path; ppcbin:=path;
findexe:=true;
end
end; end;
end; end;
var var
s : ansistring; s : ansistring;
cpusuffix,
processorname, processorname,
ppcbin, ppcbin,
versionStr, versionStr,
@ -102,6 +109,8 @@ program fpc;
errorvalue : Longint; errorvalue : Longint;
begin begin
ppccommandline:=''; ppccommandline:='';
cpusuffix :=''; // if not empty, signals attempt at cross
// compiler.
{$ifdef i386} {$ifdef i386}
ppcbin:='ppc386'; ppcbin:='ppc386';
processorname:='i386'; processorname:='i386';
@ -169,24 +178,27 @@ program fpc;
halt(0); halt(0);
end end
else if processorstr='i386' then else if processorstr='i386' then
ppcbin:='ppc386' cpusuffix:='386'
else if processorstr='m68k' then else if processorstr='m68k' then
ppcbin:='ppc68k' cpusuffix:='68k'
else if processorstr='alpha' then else if processorstr='alpha' then
ppcbin:='ppcapx' cpusuffix:='apx'
else if processorstr='powerpc' then else if processorstr='powerpc' then
ppcbin:='ppcppc' cpusuffix:='ppc'
else if processorstr='powerpc64' then else if processorstr='powerpc64' then
ppcbin:='ppcppc64' cpusuffix:='ppc64'
else if processorstr='arm' then else if processorstr='arm' then
ppcbin:='ppcarm' cpusuffix:='arm'
else if processorstr='sparc' then else if processorstr='sparc' then
ppcbin:='ppcsparc' cpusuffix:='sparc'
else if processorstr='ia64' then else if processorstr='ia64' then
ppcbin:='ppcia64' cpusuffix:='ia64'
else if processorstr='x86_64' then else if processorstr='x86_64' then
ppcbin:='ppcx64' cpusuffix:='x64'
else error('Illegal processor type "'+processorstr+'"'); else
error('Illegal processor type "'+processorstr+'"');
ppcbin:='ppcross'+cpusuffix;
end end
else else
ppccommandline:=ppccommandline+s+' '; ppccommandline:=ppccommandline+s+' ';
@ -196,7 +208,16 @@ program fpc;
if versionstr<>'' then if versionstr<>'' then
ppcbin:=ppcbin+'-'+versionstr; ppcbin:=ppcbin+'-'+versionstr;
{ find the full path to the specified exe } { find the full path to the specified exe }
if not findexe(ppcbin) then
begin
if cpusuffix<>'' Then
begin
ppcbin:='ppc'+cpusuffix;
if versionstr<>'' then
ppcbin:=ppcbin+'-'+versionstr;
findexe(ppcbin); findexe(ppcbin);
end;
end;
{ call ppcXXX } { call ppcXXX }
try try