next up previous contents
Next: Porting Turbo Pascal Code Up: Compiler configuration Previous: Using the command-line options

Using the configuration file

  Using the configuration file ppc386.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 compiler looks for the ppc386.cfg file in the following places :

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 :

#IFDEF
#IFNDEF
#ELSE
#ENDIF
#DEFINE
#UNDEF
#WRITE
#INCLUDE
#SECTION

They work the same way as their {$...} counterparts in Pascal.

What follows is a description of the different directives.

#IFDEF

Syntax:

#IFDEF name
Lines following #IFDEF are skipped read 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_5
-Up/usr/lib/fpc/0.99.5/linuxunits
#ENDIF
In the above example, /usr/lib/fpc/0.99.5/linuxunits will be added to the path if you're compiling with version 0.99.5 of the compiler.

#IFNDEF

Syntax:

#IFNDEF name
Lines following #IFDEF are skipped 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_5
-Up/usr/lib/fpc/0.99.6/linuxunits
#ENDIF
In the above example, /usr/lib/fpc/0.99.6/linuxunits will be added to the path if you're NOT compiling with version 0.99.5 of the compiler.

#ELSE

Syntax:

#ELSE
#ELSE can be specified after a #IFDEF or #IFNDEF directive as an alternative. Lines following #ELSE are skipped 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_5
-Up/usr/lib/fpc/0.99.6/linuxunits
#ELSE
-Up/usr/lib/fpc/0.99.5/linuxunits
#ENDIF
In the above example, /usr/lib/fpc/0.99.5/linuxunits will be added to the path if you're compiling with version 0.99.5 of the compiler, otherwise /usr/lib/fpc/0.99.6/linuxunits will be added to the path.

#ENDIF

Syntax:

#ENDIF
#ENDIF marks the end of a block that started with #IF(N)DEF, possibly with an #ELSE between it.

#DEFINE

Syntax:

#DEFINE name
#DEFINE defines a new keyword. This has the same effect as a -dname command-line option.

#UNDEF

Syntax:

#UNDEF name
#UNDEF un-defines a keyword if it existed. This has the same effect as a -uname command-line option.

#WRITE

Syntax:

#WRITE Message Text
#WRITE writes Message Text to the screen. This can be useful to display warnings if certain options are set.

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.

#INCLUDE

Syntax:

#INCLUDE filename
#INCLUDE instructs the compiler to read the contents of filename before continuing to process the current file.

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/ppc386.cfg
#IFDEF DOS
#INCLUDE c:\pp\bin\ppc386.cfg
#ENDIF
\end{erbatim}
This will include \file{/etc/ppc386.cfg} if you're on a linux machine,
and will include \file{c:\backslash pp\backslash bin\backslash ppc386.cfg}
on a dos machine.

\subsection{\#SECTION}
Syntax:
\begin{verbatim}
#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.


next up previous contents
Next: Porting Turbo Pascal Code Up: Compiler configuration Previous: Using the command-line options

Michael Van Canneyt
Thu Sep 10 13:56:17 CEST 1998