Difference between revisions of "Configuration file"
(→Not Combined: additional ino) |
(→Format: conditional processing) |
||
Line 4: | Line 4: | ||
==Format== | ==Format== | ||
One ''command line option'' is written per line with the same format as when used on the command line. | One ''command line option'' is written per line with the same format as when used on the command line. | ||
+ | |||
+ | ===Conditional Processing=== | ||
+ | Special comment directives are available to allow a configuration file to be conditionally processed. Available directives are: | ||
+ | * #CFGDIR | ||
+ | * #IFDEF | ||
+ | * #IFNDEF | ||
+ | * #ELSE | ||
+ | * #ENDIF | ||
+ | * #DEFINE | ||
+ | * #UNDEF | ||
+ | * #WRITE | ||
+ | * #INCLUDE | ||
+ | * #SECTION | ||
===Comments=== | ===Comments=== |
Revision as of 13:24, 14 July 2016
Description
To avoid having to include compiler options in build files or repeat them on the command line, Free Pascal allows them to be placed in a configuration file. The compiler options in the file will be read along with options given on the command line, with the configuration file being processed first.
Format
One command line option is written per line with the same format as when used on the command line.
Conditional Processing
Special comment directives are available to allow a configuration file to be conditionally processed. Available directives are:
- #CFGDIR
- #IFDEF
- #IFNDEF
- #ELSE
- #ENDIF
- #DEFINE
- #UNDEF
- #WRITE
- #INCLUDE
- #SECTION
Comments
Comment lines are allowed. They follow the Unix shell/Python/Perl comment-style: a '#' signifies the start of a comment.
Example
# Perform range checking, IO checking, overflow checking, IEEE error checking
-Crio3
# compiler halts after warnings
-Sew
Name
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 Unix configuration file convention and start with a '.' ( .fpc.cfg ) .
Location
- Under a Unix or Unix-like operating systems (e.g. Linux, FreeBSD)
- The current directory.
- Your home directory, it looks for .fpc.cfg.
- 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.
- Under all other operating systems:
- The current directory.
- If it is set, the directory specified in the environment variable PPC_CONFIG_PATH.
- The directory where the compiler is.
Not Combined
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. However, you can use the #INCLUDE directive (identical to {$INCLUDE } in Free Pascal source code) to include another configuration file. For example, your personal fpc.cfg in the current directory file could include the /etc/fpc.cfg file that came with Free Pascal. You also can specify additional configuration files by specifying them on the command line, preceded by the @ symbol.
Ignore
You can tell the compiler to not use a configuration file by giving the -n command line option.