[fpc-pascal] Search path order for fpc.cfg

Michael Van Canneyt michael at freepascal.org
Sat Apr 11 08:24:33 CEST 2020



On Fri, 10 Apr 2020, fredvs via fpc-pascal wrote:

> Hello.
>
> According:
> https://wiki.freepascal.org/Configuration_file
>
> Under a Unix or Unix-like operating systems (e.g. FreeBSD, 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)
>    The directory /etc.
>
> Would it be possible to have a 4th: the directory of the binary compiler and
> maybe change his order?

No. That is not backward compatible. 
In the worst case we can add the compiler dir, but as the last.

But even so:
it is not done on unices to search in the binary directory for config
files. That's a windows thing.

Don't introduce this on unices:
You should accept & follow the rules of the platform you're working on.

If you really want that, create a wrapper which sets PPC_CONFIG_PATH to the
compiler bin dir. But I strongly advance against this.

> Does fpc accept relative path for -Fu in the fpc.cfg config file, something
> like:
>
> -Fu../units/$fpctarget
> -Fu../units/$fpctarget/*
> -Fu../units/$fpctarget/rtl

Yes.

Michael.


More information about the fpc-pascal mailing list