Sign in Join
Wiki copytemporary

Configuration file: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Description
22
3-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.
3+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.
44
55## Format
66
7-One *command line option* is written per line with the same format as when used on the command line.
7+One _command line option_ is written per line with the same format as when used on the command line.
88
99### Comments
1010
11-Comment lines are allowed. They follow the Unix shell/Python/Perl comment-style: a '#' signifies the start of a comment.
11+Comment lines are allowed. They follow the Unix shell/Python/Perl comment-style: a '#' signifies the start of a comment.
1212
1313### Conditional Processing
1414
15-Special comment directives are available to allow a configuration file to be conditionally processed. Available directives are:
15+Special comment directives are available to allow a configuration file to be conditionally processed. Available directives are:
1616
17-- \#CFGDIR - use the directory specified in this directive as the location to find files named in subsequent \#INCLUDE directives.
18-- \#SECTION
19-- \#WRITE - print a string
17+ * #CFGDIR - use the directory specified in this directive as the location to find files named in subsequent #INCLUDE directives.
18+ * #SECTION
19+ * #WRITE - print a string
2020
21-Directives that are equivalent to Free Pascal source code compiler directives. For example, \#DEFINE in a config file is equivalent to {\$DEFINE } in source code.
21+Directives that are equivalent to Free Pascal source code compiler directives. For example, #DEFINE in a config file is equivalent to {$DEFINE } in source code.
2222
23-- \#DEFINE
24-- \#ELSE
25-- \#ENDIF
26-- \#IFDEF -
27-- \#IFNDEF
28-- \#INCLUDE
29-- \#UNDEF
23+ * #DEFINE
24+ * #ELSE
25+ * #ENDIF
26+ * #IFDEF -
27+ * #IFNDEF
28+ * #INCLUDE
29+ * #UNDEF
3030
3131### Example
32-
33-``` pascal
32+```
3433# Perform range checking, IO checking, overflow checking, IEEE error checking
35--Crio3
36-# compiler halts after warnings
37--Sew
34+ -Crio3
35+ # compiler halts after warnings
36+ -Sew
3837```
3938
4039## Name
4140
42-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** ) .
41+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** ) .
4342
4443## Create
4544
46-Example for Windows: Open a command prompt and go to the directory where fpc.exe is. This command will create a fpc.cfg for your installation and it will be placed in the current directory.
45+Example for Windows: Open a command prompt and go to the directory where fpc.exe is. This command will create a fpc.cfg for your installation and it will be placed in the current directory.
46+```
47+$> fpcmkcfg -d basepath=C:\fpc\ -o .\fpc.cfg
48+```
4749
48-fpcmkcfg -d basepath=C:\fpc\\ -o .\fpc.cfg
50+Example for Linux : in this case, FPC has been installed in the user's home dir and path setting added to $PATH (so both fpc and fpcmkcfg can be found).
51+```
52+$> fpcmkcfg -d basepath="$HOME"/bin/FPC/fpc-3.2.4 > "$HOME"/.fpc.cfg
53+```
4954
50-See fpcmkcfg -? for meaning of commandline switches.
55+Or, because fpc defines $fpcversion, the following is fpc version independent :
56+```
57+$> fpcmkcfg -d basepath="$HOME/bin/FPC/fpc-""\$fpcversion" > "$HOME"/.fpc.cfg
58+```
5159
60+See fpcmkcfg -? for meaning of commandline switches.
61+
5262## Location
5363
54-- Under a Unix or Unix-like operating systems (e.g. FreeBSD, Linux)
64+ * Under a Unix or Unix-like operating systems (e.g. FreeBSD, Linux)
5565
56-1. The current directory.
57-2. Your home directory, it looks for .fpc.cfg.
58-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)
59-4. The directory /etc.
66+ 1. The current directory.
67+ 2. Your home directory, it looks for .fpc.cfg.
68+ 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)
69+ 4. The directory /etc.
6070
61-- Under all other operating systems:
71+ * Under all other operating systems:
6272
63-1. The current directory.
64-2. If it is set, the directory specified in the environment variable PPC_CONFIG_PATH.
65-3. The directory where the compiler is.
73+ 1. The current directory.
74+ 2. If it is set, the directory specified in the environment variable PPC_CONFIG_PATH.
75+ 3. The directory where the compiler is.
6676
6777## Not Combined
6878
69-Unlike Unix shell configuration files, FPC configuration files are not automatically combined (user-specific and system-wide). 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.
70-
71-``` pascal
79+Unlike Unix shell configuration files, FPC configuration files are not automatically combined (user-specific and system-wide). 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.
80+```
7281# To avoid having to duplicate options in the FPC-provided configuration file
73-# that file can be included in a custom configuration file.
74-# This is how the file would be included on a Unix-like system:
75-
76-#INCLUDE /etc/fpc.cfg
77-
78-# Then custom options can be added.
79-
80--Sew
82+ # that file can be included in a custom configuration file.
83+ # This is how the file would be included on a Unix-like system:
84+
85+ #INCLUDE /etc/fpc.cfg
86+
87+ # Then custom options can be added.
88+
89+ -Sew
8190```
8291
83-You also can specify additional configuration files by specifying them on the command line, preceded by the @ symbol:
84-
85-``` pascal
92+You also can specify additional configuration files by specifying them on the command line, preceded by the @ symbol:
93+```
8694fpc @/dir1/dir2/configfile2.cfg @subdir/configfile3.txt @configfile3.txt my_program.pp
8795```
8896
8997## Ignore
9098
9199You can tell the compiler to not use a configuration file by giving the **-n** command line option.
92100
93101---
94-*From the Free Pascal wiki, page "Configuration file", as it stood on 2020-02-08 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
95-Category: FPC
102+*From the Free Pascal wiki, page "Configuration file", as the Internet Archive kept it on 2025-02-19, last changed on 2024-12-17. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history