5.2 Using the configuration file

Using the configuration file fpc.cfg is an alternative to command line options. When a configuration file is found, it is read, and the lines in it are treated as if you typed them on the command line. They are treated before the options that you type on the command line.

You can specify comments in the configuration file with the # sign. Everything from the # on will be ignored.

The algorithm to determine which file is used as a configuration file is decribed in 3.1.5 on page 73.

When the compiler has finished reading the configuration file, it continues to treat the command line options.

One of the command line options allows you to specify a second configuration file: Specifying @foo on the command line will open file foo, and read further options from there. When the compiler has finished reading this file, it continues to process the command line.

The configuration file allows a type of preprocessing. It understands the following directives, which you should place starting on the first column of a line:

#IFDEF
#IFNDEF
#ELSE
#ENDIF
#DEFINE
#UNDEF
#WRITE
#INCLUDE
#SECTION

They work the same way as their {$...} counterparts in Pascal source code. All the default defines used to compile source code are also defined while processing the configuration file. For example, if the target compiler is an intel 80x86 compatible linux platform, both cpu86 and linux will be defined while interpreting the configuration file. For the possible default defines when compiling, consult Appendix G of the Programmers guide.

What follows is a description of the different directives.

  5.2.1 #IFDEF
  5.2.2 #IFNDEF
  5.2.3 #ELSE
  5.2.4 #ENDIF
  5.2.5 #DEFINE
  5.2.6 #UNDEF
  5.2.7 #WRITE
  5.2.8 #INCLUDE
  5.2.9 #SECTION