4. tcc Environments

In addition to command-line options, there is a second method of specifying
tcc's behaviour, namely tcc environments.
An environment is just a file consisting of lines of the form:

*IDENTIFIER "text"

where * stands for one of the environment prefixes, +,
< and >
(in fact ? is also a valid environment prefix. It is
used to query the values represented by environmental identifiers.
If tcc
is invoked with the -Ystatus command-line option it
will print the values of all the environmental identifiers it recognises).
Any line in the environment not beginning with one of these characters
is ignored. IDENTIFIER will be one of the environmental
identifiers recognised by tcc, the environment prefix
will tell tcc how to modify the value given by this identifier,
and text what to modify it by.

The simplest environmental identifiers are those which are used to
pass flags to tcc and the various components of the compilation
system. The line:

+FLAG "text"

causes text to be interpreted by tcc as
if it was a command-line option. Similarly:

+FLAG_TDFC "text"

causes text to be passed as an option to tdfc.
There are similar environmental identifiers for each of the components
of the compilation system (see 7.6 for a complete list).

The second class of environmental identifiers are those corresponding
to simple string variables. Only the form:

+IDENTIFIER "text"

is allowed. This will set the corresponding variable to text.
The permitted environmental identifiers and the corresponding variables
are:ENVDIR the default environments directory (see section
4.1),

The final class of environmental identifiers are those corresponding
to lists of strings. Firstly text is transformed into
a list of strings, b say, by splitting at any spaces, then the list
corresponding to the identifier, a say, is modified by this value.
How this modification is done depends on the environment prefix:

if the prefix is + then a = b,

if the prefix is > then a = a + b,

if the prefix is < then a = b + a,

where + denotes concatenation of lists. The lists represented in this
way include those giving the pathnames of the executables of the various
compilation components (plus default flags). These are given by the
identifiers TDFC, TLD, etc. (see 7.6 for
a complete list). The other lists can be divided between those affecting
the producer, the TDF linker, and the system linker respectively (see
sections 5.1, 5.2 and 5.5 for more details):

). There is an important distinction
to be made between base APIs (for example, POSIX) and extension APIs
(for example, X11 Release 5). The command-line option -Yposix
sets the API to be precisely POSIX, whereas the option -Yx5_lib
sets it to the existing API plus the X11 Release 5 basic X library.
This is done by using +INCL etc. in the posix
environment to set the various variables corresponding to these environmental
identifiers to precisely the values for POSIX, but <INCL
etc. in the x5_lib environment to extend these variables
by the values for X11 Release 5. Thus, to specify the API POSIX plus
X11 Release 5, the command-line options -Yposix -Yx5_lib are
required (in that order).

All the standard API environments provided also contain lines which
set, or modify, the INFO environmental identifier. This
contains textual information on the API, including API names and version
numbers. This information can be printed by invoking tcc
with the -info command-line option. For example, the command-line
options:

> tcc -info -Yposix -Yx5_lib

cause the message:

tcc: API is X11 Release 5 Xlib plus POSIX (1003.1).

to be printed.

As was mentioned above, the default API is ANSI. Thus invoking tcc
without specifying an API environment is equivalent to giving the
-Yansi command-line option. On the basis that, when it comes
to portability, explicit decisions are better than implicit ones,
the use of -Yansi is recommended.