Configuration file

From Free Pascal wiki
Revision as of 12:03, 14 July 2016 by FPC user (talk | contribs) (comments)
Jump to navigationJump to search

Command line options for the Free Pascal compiler can be stored in a configuration file and will be used as if they had been typed on the command line. They can be combined with command line options, with configuration file being processed first, before the options given on the command line.

The file is named fpc.cfg, unless it is located in the HOME directory on a Unix-like system, in which case it will follow convention and start with a '.' : .fpc.cfg. The compiler looks for a configuration file in certain directories, and in a specific order:

  • Under a Unix or Unix-like operating systems (e.g. Linux, FreeBSD)
  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 operating systems:
  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.

NOTE: Unlike Unix shell configuration files, FPC configuration files are not combined. It will only use the first one that it finds and ignore any others that may also be on the system, including the configuration file that comes with Free Pascal.

You can tell the compiler to not use a configuration file by giving the -n command line option.

In addition to command line options (one per line), the configuration file can have comment lines. They use the Unix shell/Python/Perl comment-style of a '#' signifying the start of a comment.