[Lazarus] Lazarus IDE and fpc.cfg location
patspiper
patspiper at yahoo.com
Fri Oct 22 22:53:49 CEST 2010
On 10/22/2010 11:31 PM, Vincent Snijders wrote:
> 2010/10/22 patspiper<patspiper at yahoo.com>:
>
>> The FPC user manual states the compiler will look for a configuration file
>> fpc.cfg in the following places:
>> • Under UNIX (such as LINUX)
>> 1. The current directory.
>> 2. Your home directory, it looks for .fpc.cfg.
>> 3. The directory specified in the environment variable PPC_CONFIG_PATH, and
>> if it is
>> not set, it will look in the etc directory above the compiler directory.
>> (For instance, if the
>> compiler is in /usr/local/bin, it will look in /usr/local/etc)
>> 4. The directory /etc.
>> • Under all other OSes:
>> 1. The current directory.
>> 2. If it is set, the directory specified in the environment variable
>> PPC_CONFIG_PATH.
>> 3. The directory where the compiler is.
>>
>> whereas the IDE looks in the following places:
>> 1. $HOME/.fpc.cfg
>> 2. compiler path + fpc.cfg
>> 3. working directory + fpc.cfg
>> 4. /etc/fpc.cfg (on Unix only)
>>
>> 1. Shouldn't the IDE follow what the FPC user manual states? In particular,
>> compilerpath/../etc vs compilerpath
>>
> The IDE doesn't use the .fpc.cff, the called compiler does. So, it
> does follow the FPC user manual as much as it can.
>
>
>> 2. I tried to put fpc.cfg in the fpc binary directory, but the IDE did not
>> detect it. Is that a bug?
>>
> Maybe, but then not in Lazarus, but in the compiler. Do you actually
> use the fpc binary in the directory of fpc.cfg? Is that compiler set
> in the environment options? Does it work if you use that compiler from
> the command line yourself?
>
> Vincent
>
I was experimenting on how to install FPC 2.5.1 alongside of 2.4.0, the
config file of which is /etc/fpc.cfg. Putting fpc.cfg in the fpc binary
directory did not work whereas it worked when placed in the home folder
(.fpc.cfg).
I deduced the sequence above from the following excerpt from
CheckCompilerOpts.pas (part of the IDE):
--------------------------------------------
// check $HOME/.fpc.cfg
Dir:=GetEnvironmentVariableUTF8('HOME');
if Dir<>'' then begin
Filename:=CleanAndExpandDirectory(Dir)+'.fpc.cfg';
AddFile(Filename);
end;
// check compiler path + fpc.cfg
Dir:=ExtractFilePath(CompilerFilename);
Dir:=ReadAllLinks(Dir,false);
if Dir<>'' then begin
Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
AddFile(Filename);
end;
// check working directory + fpc.cfg
Dir:=ExtractFilePath(Options.BaseDirectory);
Dir:=ReadAllLinks(Dir,false);
if Dir<>'' then begin
Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
AddFile(Filename);
end;
// check /etc/fpc.cfg
{$IFDEF Unix}
Dir:=ExtractFilePath(CompilerFilename);
Dir:=GetEnvironmentVariableUTF8('HOME');
if Dir<>'' then begin
Filename:='/etc/fpc.cfg';
AddFile(Filename);
end;
{$ENDIF}
--------------------------------------------
More information about the Lazarus
mailing list