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 like 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 on page 50.
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 some kind of preprocessing. It understands the following directives, which you should place on the first column of a line :
They work the same way as their {$...} counterparts in Pascal. 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 compatile 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.
#IFDEF name |
They are read until the keywords #ELSE or #ENDIF are encountered, after which normal processing is resumed.
Example :
#IFDEF VER0_99_5 -Fu/usr/lib/fpc/0.99.5/linuxunits #ENDIF |
#IFNDEF name |
They are read until the keywords #ELSE or #ENDIF are encountered, after which normal processing is resumed.
Example :
#IFNDEF VER0_99_5 -Fu/usr/lib/fpc/0.99.6/linuxunits #ENDIF |
#ELSE |
They are skipped until the keyword #ENDIF is encountered, after which normal processing is resumed.
Example :
#IFDEF VER0_99_5 -Fu/usr/lib/fpc/0.99.5/linuxunits #ELSE -Fu/usr/lib/fpc/0.99.6/linuxunits #ENDIF |
#ENDIF |
#DEFINE name |
#UNDEF name |
#WRITE Message Text |
Example:
#IFDEF DEBUG #WRITE Setting debugging ON... -g #ENDIF |
Setting debugging ON... |
#INCLUDE filename |
This can be useful if you want to have a particular configuration file for a project (or, under LINUX, in your home directory), but still want to have the global options that are set in a global configuration file.
Example:
#IFDEF LINUX #INCLUDE /etc/fpc.cfg #ELSE #IFDEF GO32V2 #INCLUDE c:\pp\bin\fpc.cfg #ENDIF #ENDIF |
#SECTION name |