fpc.cfg(5)
πΈ NAME πΈ
fpc.cfg β the Free Pascal Compiler (FPC) configuration file, and bestie the name is literally just derived from Free Pascal Compiler. Self-titled era. We love a file that knows exactly who it is π
β¨ DESCRIPTION β¨
okay so here's the tea: this is the main configuration file of the Free Pascal Compiler (FPC). Like, the main character config file. The one. π
Every single commandline option of the compiler (all described over in fpc(1)) can be specified in fpc.cfg. All of them. No cap.
When the configuration file is found, it gets read, and the lines inside it are treated exactly like you typed them on the command line β see fpc(1) β with some extra conditional possibilities on top. So it's giving "command line, but make it a file, but also it can think for itself" π§
π SYNTAX π
You can drop comments in the configuration file with the # sign. Everything from the # onward gets ignored... unless it's one of the keywords (peep below, bestie) π
The compiler goes looking for the fpc.cfg file in these places:
- Under Linux and unix
- The current directory.
- Home directory, looks for
.fpc.cfg - The directory specified in the environment variable
PPC_CONFIG_PATH, and if it's not set undercompilerdir/../etc. - If it is not yet found: in
/etc.
- Under all other OSes:
- The current directory.
- The directory specified in the environment variable
PPC_CONFIG_PATH. - The directory where the compiler binary is.
Once the compiler is done reading the configuration file, it continues to treat the command line options. Like, it's not replacing them, it's just doing its reading first π
One of the command-line options lets you specify a second configuration file: specifying @foo on the command line will use file foo instead of fpc.cfg and read further options from there. When the compiler has finished reading this file, it continues to process the command line. Slay, two config files, one compiler π«Ά
The configuration file allows some kind of preprocessing. It understands the following directives, which you should place on the first column of a line:
#IFDEF
#IFNDEF
#ELSE
#ENDIF
#DEFINE
#UNDEF
#WRITE
#INCLUDE
#SECTION
They work the same way as their $... directive counterparts in Pascal. iykyk π
π₯ #IFDEF π₯
Syntax β #IFDEF name
Lines following #IFDEF are skipped (not read, girl, they get ghosted π») if the keyword name following it is not defined.
They are read until the keywords #ELSE or #ENDIF are encountered, after which normal processing is resumed.
Example
#IFDEF VER0_99_12
-Fu/usr/lib/fpc/0.99.12/rtl
#ENDIF
In the above example, /usr/lib/fpc/0.99.12/rtl will be added to the path if you're compiling with version 0.99.12 of the compiler. Conditional queen β¨
π₯ #IFNDEF π₯
Syntax β #IFNDEF name
Lines following #IFDEF are skipped (not read) if the keyword name following it is defined.
They are read until the keywords #ELSE or #ENDIF are encountered, after which normal processing is resumed.
Example
#IFNDEF VER0_99_12
-Fu/usr/lib/fpc/0.99.13/rtl
#ENDIF
In the above example, /usr/lib/fpc/0.99.13/rtl will be added to the path if you're NOT compiling with version 0.99.12 of the compiler. The literal opposite vibe, and we respect it π
π₯ #ELSE π₯
Syntax β #ELSE
#ELSE can be specified after a #IFDEF or #IFNDEF directive as an alternative. Lines following #ELSE are skipped (not read) if the preceding #IFDEF / #IFNDEF was accepted.
They are skipped until the keyword #ENDIF is encountered, after which normal processing is resumed.
Example
#IFDEF VER0_99_12
-Fu/usr/lib/fpc/0.99.12/rtl
#ELSE
-Fu/usr/lib/fpc/0.99.13/rtl
#ENDIF
In the above example, /usr/lib/fpc/0.99.12/rtl will be added to the path if you're compiling with version 0.99.12 of the compiler, otherwise /usr/lib/fpc/0.99.13/rtl will be added to the path. Either way somebody's eating, and that somebody is your build π
π₯ #ENDIF π₯
Syntax β #ENDIF
#ENDIF marks the end of a block that started with #IF(N)DEF, possibly with an #ELSE between it. It's the closing bracket of the whole situationship, bestie. π
π₯ #DEFINE π₯
Syntax β #DEFINE name
#DEFINE defines a new keyword. This has the same effect as a -dname command-line option. Boom, defined, iconic. β
π₯ #UNDEF π₯
Syntax β #UNDEF name
#UNDEF un-defines a keyword if it existed. This has the same effect as a -uname command-line option. We're un-defining it, we're healing, we're moving on π¦
π₯ #WRITE π₯
Syntax β #WRITE Message Text
#WRITE writes Message Text to the screen. This can be useful to display warnings if certain options are set. Like a little note to your future self, obsessed π
Example
#IFDEF DEBUG
#WRITE Setting debugging ON...
-g
#ENDIF
if DEBUG is defined, this will produce a line
Setting debugging ON...
and will then switch on debugging information in the compiler. Not me getting emotional over a debug flag being announced π
π₯ #INCLUDE π₯
Syntax β #INCLUDE filename
#INCLUDE instructs the compiler to read the contents of filename before continuing to process options in the current file.
This can be useful if you want to have a particular configuration file for a project (or, under Unix like systems (such as Linux), in your home directory), but still want to have the global options that are set in a global configuration file. Have your cake and eat it too, periodt π
Example
#IFDEF LINUX
#INCLUDE /etc/fpc.cfg
#ELSE
#IFDEF GO32V2
#INCLUDE c:\pp\bin\fpc.cfg
#ENDIF
#ENDIF
This will include /etc/fpc.cfg if you're on a unix like machine (like linux), and will include c:\pp\bin\fpc.cfg on a dos machine. Cross-platform inclusivity, we love to see it π«Ά
π₯ #SECTION π₯
Syntax β #SECTION name
The #SECTION directive acts as a #IFDEF directive, only it doesn't require an #ENDIF directive. the special name COMMON always exists, i.e. lines following #SECTION COMMON are always read. Always. No conditional, no gatekeeping, just vibes β¨
π¦ Example π¦
A standard block often used in (the Linux version of) fpc.cfg is
-vwhin
#IFDEF VER0_99_12
#IFDEF FPC_LINK_STATIC
-Fu/usr/lib/fpc/0.99.12/rtl/static
-Fu/usr/lib/fpc/0.99.12/units/static
#ENDIF
#IFDEF FPC_LINK_DYNAMIC
-Fu/usr/lib/fpc/0.99.12/rtl/shared
-Fu/usr/lib/fpc/0.99.12/units/shared
#ENDIF
-Fu/usr/lib/fpc/0.99.12/rtl
-Fu/usr/lib/fpc/0.99.12/units
#ENDIF
The block is copied into the fpc.cfg file for each version you use (normally the latest release and the lastest developers snapshot. Copy-paste core, but make it compiler config π
π SEE ALSO π
and that's the whole page bestie, you ate it, go compile something legendary π
this was brought to you by FPC, dated 22 february 2002, and yes this is the fpc.cfg(5) page β mwah, good luck out there πβ¨
π¦ where this page comes from
- fedora 44: fpc 3.2.4~rc1-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- fedora 44: fpc 3.2.4~rc1-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms