mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 02:32:51 +02:00
* Do not fail configfile generation when gcc is not found
* Give a nice warning when gcc is not executed properly git-svn-id: trunk@17606 -
This commit is contained in:
parent
898a4debca
commit
b057c320da
@ -83,6 +83,7 @@ Resourcestring
|
||||
SWarnIgnoringFile = 'Warning: Ignoring non-existent file: ';
|
||||
SWarnIgnoringPair = 'Warning: Ignoring wrong name/value pair: ';
|
||||
SWarngccNotFound = 'Warning: Could not find gcc. Unable to determine the gcclib path.';
|
||||
SWarnCouldNotExecute= 'Warning: Could not execute command ''%s''';
|
||||
|
||||
SBackupCreated = 'Saved old "%s" to "%s"';
|
||||
|
||||
@ -194,16 +195,21 @@ var GccExecutable: string;
|
||||
count: integer;
|
||||
|
||||
begin
|
||||
result := '';
|
||||
S:=TProcess.Create(Nil);
|
||||
try
|
||||
S.Commandline:=CommandLine;
|
||||
S.Options:=[poUsePipes,poWaitOnExit];
|
||||
S.execute;
|
||||
Count:=s.output.read(buf,BufSize);
|
||||
if (count=0) and ReadStdErr then
|
||||
Count:=s.Stderr.read(buf,BufSize);
|
||||
setlength(result,count);
|
||||
move(buf[0],result[1],count);
|
||||
try
|
||||
S.execute;
|
||||
Count:=s.output.read(buf,BufSize);
|
||||
if (count=0) and ReadStdErr then
|
||||
Count:=s.Stderr.read(buf,BufSize);
|
||||
setlength(result,count);
|
||||
move(buf[0],result[1],count);
|
||||
except
|
||||
Writeln(StdErr,Format(SWarnCouldNotExecute,[CommandLine]));
|
||||
end;
|
||||
finally
|
||||
S.Free;
|
||||
end;
|
||||
@ -243,11 +249,17 @@ var GccExecutable: string;
|
||||
libgccFilename: string;
|
||||
gccDir: string;
|
||||
begin
|
||||
ExecResult:=ExecuteProc(GetGccExecutable+' -v '+GCCParams, True);
|
||||
libgccFilename:=Get4thWord(ExecResult);
|
||||
if libgccFilename='' then
|
||||
libgccFilename:=ExecuteProc(GetGccExecutable+' --print-libgcc-file-name '+GCCParams, False);
|
||||
gccDir := ExtractFileDir(libgccFilename);
|
||||
if FileExists(GetGccExecutable) then
|
||||
begin
|
||||
ExecResult:=ExecuteProc(GetGccExecutable+' -v '+GCCParams, True);
|
||||
libgccFilename:=Get4thWord(ExecResult);
|
||||
if libgccFilename='' then
|
||||
libgccFilename:=ExecuteProc(GetGccExecutable+' --print-libgcc-file-name '+GCCParams, False);
|
||||
gccDir := ExtractFileDir(libgccFilename);
|
||||
end
|
||||
else
|
||||
gccDir := '';
|
||||
|
||||
if gccDir='' then
|
||||
result := ''
|
||||
else if ACpuType = '' then
|
||||
|
Loading…
Reference in New Issue
Block a user