1fpc.cfg(5) FPC configuration file fpc.cfg(5)
2
3
4
6 fpc.cfg - Free Pascal Compiler (FPC) configuration file, name derived
7 from Free Pascal Compiler.
8
9
11 This is the main configuration file of the Free Pascal Compiler (FPC)
12
13 All commandline options of the compiler (described in fpc(1) ) can be
14 specified in fpc.cfg
15
16 When the configuration file is found, it is read, and the lines it con‐
17 tains are treated like you typed them on the command line see fpc(1)
18 with some extra condtional possibilities.
19
20
22 You can specify comments in the configuration file with the # sign.
23 Everything from the # on will be ignored, unless it is one of the key‐
24 words (see below).
25
26 The compiler looks for the fpc.cfg file in the following places :
27
28 - Under Linux and unix
29 - The current directory.
30 - Home directory, looks for .fpc.cfg
31 - The directory specified in the environment
32 variable PPC_CONFIG_PATH, and if it's not
33 set under compilerdir/../etc.
34 - If it is not yet found: in /etc.
35
36 - Under all other OSes:
37 - The current directory.
38 - The directory specified in the environment
39 variable PPC_CONFIG_PATH.
40 - The directory where the compiler binary is.
41
42
43 When the compiler has finished reading the configuration file, it con‐
44 tinues to treat the command line options.
45
46 One of the command-line options allows you to specify a second configu‐
47 ration file: Specifying @foo on the command line will use file foo
48 instead of fpc.cfg and read further options from there. When the com‐
49 piler has finished reading this file, it continues to process the com‐
50 mand line.
51
52 The configuration file allows some kind of preprocessing. It under‐
53 stands the following directives, which you should place on the first
54 column of a line :
55
56 #IFDEF
57 #IFNDEF
58 #ELSE
59 #ENDIF
60 #DEFINE
61 #UNDEF
62 #WRITE
63 #INCLUDE
64 #SECTION
65 They work the same way as their $... directive counterparts in Pascal:
66
67
68 #IFDEF
69
70 Syntax #IFDEF name
71
72 Lines following #IFDEF are skipped read if the keyword
73 "name" following it is not defined.
74
75 They are read until the keywords #ELSE or #ENDIF are
76 encountered, after which normal processing is resumed.
77
78
79 Example
80 #IFDEF VER0_99_12
81 -Fu/usr/lib/fpc/0.99.12/rtl
82 #ENDIF
83
84 In the above example, /usr/lib/fpc/0.99.12/rtl will be added to
85 the path if you're compiling with version 0.99.12 of the com‐
86 piler.
87
88
89 #IFNDEF
90
91 Syntax #IFNDEF name
92
93 Lines following #IFDEF are skipped read if the keyword
94 "name" following it is defined.
95
96 They are read until the keywords #ELSE or #ENDIF are
97 encountered, after which normal processing is resumed.
98
99
100 Example
101 #IFNDEF VER0_99_12
102 -Fu/usr/lib/fpc/0.99.13/rtl
103 #ENDIF
104
105 In the above example, /usr/lib/fpc/0.99.13/rtl will be added to
106 the path if you're NOT compiling with version 0.99.12 of the
107 compiler.
108
109 #ELSE
110
111 Syntax #ELSE
112
113 #ELSE can be specified after a #IFDEF or #IFNDEF direc‐
114 tive as an alternative. Lines following #ELSE are
115 skipped read if the preceding #IFDEF #IFNDEF was
116 accepted.
117
118 They are skipped until the keyword #ENDIF is encountered,
119 after which normal processing is resumed.
120
121
122 Example
123
124 #IFDEF VER0_99_12
125 -Fu/usr/lib/fpc/0.99.12/rtl
126 #ELSE
127 -Fu/usr/lib/fpc/0.99.13/rtl
128 #ENDIF
129
130 In the above example, /usr/lib/fpc/0.99.12/rtl will be added to
131 the path if you're compiling with version 0.99.12 of the com‐
132 piler, otherwise /usr/lib/fpc/0.99.13/rtl will be added to the
133 path.
134
135 #ENDIF
136
137 Syntax #ENDIF
138
139 #ENDIF marks the end of a block that started with #IF(N)DEF,
140 possibly with an #ELSE between it.
141
142
143 #DEFINE
144
145 Syntax #DEFINE name
146
147 #DEFINE defines a new keyword. This has the same effect as a
148 "-dname" command-line option.
149
150
151 #UNDEF
152
153 Syntax #UNDEF name
154
155 #UNDEF un-defines a keyword if it existed. This has the
156 same effect as a "-uname" command-line option.
157
158
159 #WRITE
160
161 Syntax #WRITE Message Text
162
163 #WRITE writes "Message Text" to the screen. This can be
164 useful to display warnings if certain options are set.
165
166
167 Example
168 #IFDEF DEBUG
169 #WRITE Setting debugging ON...
170 -g
171 #ENDIF
172
173
174 if "DEBUG is defined, this will produce a line
175
176 Setting debugging ON...
177
178 and will then switch on debugging information in the compiler.
179
180
181 #INCLUDE
182
183 Syntax #INCLUDE filename
184
185 #INCLUDE instructs the compiler to read the contents of
186 "filename" before continuing to process options in the
187 current file.
188
189 This can be useful if you want to have a particular con‐
190 figuration file for a project (or, under Unix like sys‐
191 tems (such as Linux), in your home directory), but still
192 want to have the global options that are set in a global
193 configuration file.
194
195
196 Example
197 #IFDEF LINUX
198 #INCLUDE /etc/fpc.cfg
199 #ELSE
200 #IFDEF GO32V2
201 #INCLUDE c:\pp\bin\fpc.cfg
202 #ENDIF
203 #ENDIF
204
205 This will include /etc/fpc.cfg if you're on a unix like machine
206 (like linux), and will include c:\pp\bin\fpc.cfg on a dos
207 machine.
208
209 #SECTION
210
211 Syntax #SECTION name
212
213 The #SECTION directive acts as a #IFDEF directive, only
214 it doesn't require an #ENDIF directive. the special name
215 COMMON always exists, i.e. lines following #SECTION COM‐
216 MON are always read.
217
218
220 A standard block often used in (the Linux version of) fpc.cfg is
221
222 -vwhin
223 #IFDEF VER0_99_12
224 #IFDEF FPC_LINK_STATIC
225 -Fu/usr/lib/fpc/0.99.12/rtl/static
226 -Fu/usr/lib/fpc/0.99.12/units/static
227 #ENDIF
228 #IFDEF FPC_LINK_DYNAMIC
229 -Fu/usr/lib/fpc/0.99.12/rtl/shared
230 -Fu/usr/lib/fpc/0.99.12/units/shared
231 #ENDIF
232 -Fu/usr/lib/fpc/0.99.12/rtl
233 -Fu/usr/lib/fpc/0.99.12/units
234 #ENDIF
235
236 The block is copied into the fpc.cfg file for each version you use
237 (normally the latest release and the lastest developpers snapshot.
238
239
241 fpc(1)
242
243
244
245FPC 22 february 2002 fpc.cfg(5)