Name

tccenv — TCC Environments

Description

tcc environments are used to configure the behaviour of tcc, a special case of which is specifying the APIs used. The standard environments supplied with the release are used to represent a number of commonly used APIs, implement certain tcc command-line options, and provide a means of implementing system-specific options. User-defined environments can easily be written to correspond to a user-defined API, or to group together a number of tcc command-line options into a single file.

An environment is just a file which is interpreted by tcc when it is specified with the command-line option -Ystr, where str is the name of the file. Each environment file consists of lines of the form

*IDENTIFIER "text"

where IDENTIFIER is one of the environmental identifiers, text tells tcc how to modify the value given by this identifier, and * stands for one of the environment prefixes + < and >.

User-Defined Environments

The simplest example of a user-defined environment contains lines of the form

+FLAG "text"

which tells tcc to interpret text as if it were passed on the command-line. So, for example, an environment consisting of the lines

+FLAG "-Yposix"
+FLAG "-Xs"
+FLAG "-I/home/user/include"

will modify tcc to use the POSIX 1003.1 API with strict checks, and add the directory /home/user/include to the search path for #included files.

By default, tcc looks for environments in the current working directory and in the default environments directory. In addition, if the system variable TCCENV is defined, this specifies a colon-separated list of directories along which tcc searches for any environment which is not a full pathname.

Supported APIs

The following standard APIs are supported in the form of TenDRA headers:

API NameTypeDescription
ansibase (default)ANSI X3.159
isobaseISO MSE 9899:1990 (Ammendment 1:1993 (E))
posixbasePOSIX 1003.1
posix2basePOSIX 1003.2
xpg3baseX/Open Portability Guide 3
xpg4baseX/Open Portability Guide 4
cose [a]baseCOSE 1170
svid3baseSystem V Interface Definition 3rd Edition
aesbaseAES Revision A
bsd_extn [b]extensionBSD-like extension for use with POSIX etc.
x5_libextensionX11 (Release 5) X Library
x5_t [c]extensionX11 (Release 5) Intrinsics Toolkit
x5_muextensionX11 (Release 5) Miscellaneous Utilities
x5_awextensionX11 (Release 5) Athena Widgets
x5_mit [d]extensionX11 (Release 5) MIT implementation
x5_protoextensionX11 (Release 5) Protocol Extension
x5_extextensionX11 (Release 5) Extensions
motifextensionMotif 1.1
systemSystem headers as main API
system+System headers as last resort extension API
Table 1. Supported APIs
  1. [a]

    This API description is based on an early version of the COSE 1170 specification and may be subject to revision.

  2. [b]

    The BSD extension API consists of a pragmatic collection of BSD types and functions which are commonly found on non-BSD machines. It roughly corresponds to the BSD component of COSE (it contains sockets, select, etc.).

  3. [c]

    The X11 private headers are further protected. If the private headers are required the option -Yx5_private should also be given.

  4. [d]

    This API is designed to cover some of the commonly used features from MIT-based X11 implementations which are not actually part of the X11 specification.

Each API is specified to tcc by means of an environment with the same name as the API. Thus, for example, -Yposix specifies POSIX 1003.1. APIs are divided into two types, base APIs, such as POSIX 1003.1, and extension APIs, such as the X11 (Release 5) Toolkit. A program API consists of a base API plus an number of extension APIs, for example, POSIX plus the X11 Toolkit. This example would be specified by means of the options -Yposix -Yx5_t, in that order (base APIs override the previous API, extension APIs add to it).

Information on the current API may be printed by passing the -info option to tcc.

Full Environment List

The majority of the standard environments can be divided into two classes: those which correspond to APIs and those which implement tcc command-line options. (In addition to these, a small number are used to enable extra tools and to specify minimum integer sizes.)

The API environments are subdivided into base APIs (such as ANSI, POSIX) and extension APIs (such as the X11 environments):

API NameTypeDescription
ansibase (default)ANSI X3.159
isobaseISO/IEC 9899:1990 (Amendment 1:L1995 (E))
posixbasethe POSIX (IEEE 1003.1:1988)
posix1basethe POSIX.1 (ISO/IEC 9945-1:1990)
posix2basethe POSIX.2 (ISO/IEC 9945-2:1993)
xpg3basethe X/Open Portability Guide 3
xpg4basethe X/Open Portability Guide 4
unix95basethe X/Open Single UNIX Specification (Spec 1170)
svid3basethe System V Interface Definition (3rd Edition)
aesbaseApplication Environment Specification (Revision A)
bsd_extnextensionBSD-like extension for use with POSIX, etc.
x5_libextensionX11 (Release 5) X Library
x5_textensionX11 (Release 5) Intrinsics Toolkit
x5_muextensionX11 (Release 5) Miscellaneous Utilities
x5_awextensionX11 (Release 5) Athena Widgets
x5_mitextensionX11 (Release 5) MIT Implementation
x5_protoextensionX11 (Release 5) Protocol Extension
x5_extextensionX11 (Release 5) Extensions
motif_1_1extensionMotif (Release 1.1)
motif_1_2extensionMotif (Release 1.2)
systemextensionSystem headers as main API
system+extensionSystem headers as last resort extension API
tdf_extextensioncompilation using TDF Version 4.0 extensions
Table 2. Supported APIs

Some environments are available which modify access to previously specified APIs:

EnvironmentDescription
x5_privatepermit access to X11 Release 5 private headers (*P.h)
motif_privatepermit access to Motif private headers (*P.h)

Note that TDF token libraries for all these APIs will not be available on all platforms, so it may not be possible run installers for programs compiled with all API environments. It will always be possible to check code with any API environment using tcc -ch.

The following environments are used to specify the use of particular tools (where available) which are not enabled by default:

EnvironmentDescription
c++enables the C++ producer/checker tcpplus.
pl_tdfenables the PL_TDF compiler tpl.
tncenables the TDF notation compiler tnc.

The default behaviour of tcc is to assume the minimal sizes of integer types allowed by ANSI. This behaviour can be modified with the following environments:

EnvironmentDescription
16bitspecifies minimal integer sizes allowed by ANSI (default)
32bitspecifies integer sizes found on most 32-bit machines

In addition to these, the following implement target-specific options:

EnvironmentDescription
aoutUse a.out instead of ELF format (386 Linux ELF only).
staticUse static instead of dynamic linking (Alpha only).

Environmental Identifiers

In the following list, the environmental prefix * must be replaced by one of + (which replaces the existing value), < (which adds a value to the beginning of the existing list), or > (which adds a value to the end of the existing list).

IdentifierDescription
*API_NAMEmodifies the list of API analysis environment names
*ASmodifies the system assembler executable
*AS1modifies the auxiliary assembler executable (MIPS and Alpha only)
*CCmodifies the system compiler executable
*CPP_SPEC_LINKmodifies the C++ spec linker executable
*CRT0modifies the first list of initial default .o files
*CRT1modifies the second list of initial default .o files
*CRTP_Nmodifies the list of additional default .o files (-Yprom only)
*CRTNmodifies the list of final default .o files
*DISPmodifies the TDF pretty printer executable
*DUMP_ANALmodifies the dump-file analyser executable
*DUMP_LINKmodifies the dump linker executable
*DYN_LINKmodifies the dynamic-initialisation linker executable (RS6000 and Sparc only)
+ENVDIRsets the default environment directory
+FLAGpasses a flag to tcc
+FLAG_ASpasses a flag to the assembler
+FLAG_AS1passes a flag to the auxiliary assembler (MIPS and Alpha only)
+FLAG_CCpasses a flag to the system compiler
+FLAG_CPP_SPEC_LINKpasses a flag to the C++ spec linker
+FLAG_DISPpasses a flag to the TDF pretty printer
+FLAG_DUMP_ANALpasses a flag to the dump-file analyser
+FLAG_DUMP_LINKpasses a flag to the dump linker
+FLAG_DYN_LINKpasses a flag to the dynamic-initialisation linker ((RS6000 and Sparc only)
+FLAG_INSTALLpasses a flag to the TDF archive builder
+FLAG_LDpasses a flag to the system linker
+FLAG_PL_TDFpasses a flag to the PL_TDF compiler
+FLAG_SPEC_LINKERpasses a flag to the C spec linker
+FLAG_TCPPLUSpasses a flag to the C++ producer
+FLAG_TCPPLUSPPpasses a flag to the C++ preprocessor
+FLAG_TDFCpasses a flag to the C producer
+FLAG_TDFCPPpasses a flag to the C preprocessor
+FLAG_TLDpasses a flag to the TDF linker
+FLAG_TNCpasses a flag to the TDF notation compiler
+FLAG_TRANSpasses a flag to the TDF translator
*INCLmodifies the list of default include file directories
*INFOmodifies the list of API information
*LDmodifies the system linker executable
*LIBmodifies the list of default TDF libraries
+LINE_STARTinserts a line in the tcc built-in start-up file
+LINE_ENDinserts a line in the tcc built-in end-up file
*LINKmodifies the list of default TDF library directories
*LINK_ENTRYmodifies the linker options specifying the entry point
+PORTABILITYsets the producer portability table
*PL_TDFmodifies the PL_TDF compiler executable
*SPEC_LINKmodifies the C spec linker executable
*STARTUPmodifies the list of default C producer start-up files
*STARTUP_DIRmodifies the list of default C producer start-up directories
*STARTUP_CPPmodifies the list of default C++ producer start-up files
*STARTUP_CPP_DIRmodifies the list of default C++ producer start-up directories
*SUFFIX_CPPsets the filename suffix override for C++ source files
*SYS_LIBmodifies the list of default system libraries
*SYS_LIBCmodifies the list of standard system libraries
*SYS_LINKmodifies the list of default system library directories
*TCPPLUSmodifies the C++ producer executable
*TCPPLUSPPmodifies the C++ preprocessor executable
*TDFCmodifies the C producer executable
*TDFCPPmodifies the C preprocessor executable
+TEMPsets the temporary directory
*TLDmodifies the TDF linker executable
*TNCmodifies the TDF notation compiler executable
*TRANSmodifies the TDF translator executable

Environment Identifiers

The following tcc environment identifiers are recognised:

IdentifierDescription
*ASModifies the system assembler executable
*AS1Modifies the auxilliary system assembler executable (Mips only)
*CCModifies the system compiler executable
*CRT0Modifies the first list of initial default .o files
*CRT1Modifies the second list of initial default .o files
*CRTNModifies the list of final default .o files
*DISPModifies the TDF pretty printer executable
+ENVDIRSets the main environment directory
+FLAGPasses a flag to tcc
+FLAG_ASPasses a flag to the assembler
+FLAG_CCPasses a flag to the system compiler
+FLAG_DISPPasses a flag to the TDF pretty printer
+FLAG_INSTALLPasses a flag to the TDF archive builder
+FLAG_LDPasses a flag to the system linker
+FLAG_SPEC_LINKPasses a flag to the C spec linker
+FLAG_TDFCPasses a flag to the producer
+FLAG_TDFCPPPasses a flag to the preprocessor
+FLAG_TLDPasses a flag to the TDF linker
+FLAG_TNCPasses a flag to the TDF notation compiler
+FLAG_TRANSPasses a flag to the TDF translator
*INCLModifies the list of default include file directories
*INFOModifies the list of API information
*LDModifies the system linker executable
*LIBModifies the list of default TDF libraries
+LINE_STARTInserts a line in the tcc built-in start-up file
+LINE_ENDInserts a line in the tcc built-in end-up file
*LINKModifies the list of default TDF library directories
+PORTABILITYSets the producer portability table
*SPEC_LINKModifies the C spec linker executable
*STARTUPModifies the list of default producer start-up files
*STARTUP_DIRModifies the list of default start-up directories
*SYS_LIBModifies the list of default system libraries
*SYS_LIBCModifies the list of standard system libraries
*SYS_LINKModifies the list of default system library directories
*TDFCModifies the producer executable
*TDFCPPModifies the preprocessor executable
+TEMPSets the temporary directory [e]
*TLDModifies the TDF linker executable
*TNCModifies the TDF notation compiler executable
*TRANSModifies the TDF translator executable
  1. [e]

    The temporary directory can also be set using the TMPDIR system variable on those machines which implement the XPG3 tempnam system routine.

* stands for any of the allowed environment modifiers +, < or >.

Standard Environments

In addition to the environments implementing the supported APIs (see section 7.5. on page 31), the following environments are standard; those which alter the compilation phases:

EnvironmentDescription
defaultDefault settings (built into tcc)
16bitSpecifies the minimal integer sizes allowed by ANSI
32bitSpecifies the integer sizes found on most 32-bit machines
commonEquivalent to 32bit
makelibUsed to construct TDF libraries
pl_tdfUsed to specify the use of the PL_TDF compiler
statusCauses the environment status to be reported
tdpUsed in TDF library building
tncUsed to specify the use of the TDF notation compiler

and those which form part of the implementation for command-line options:

EnvironmentOption Implemented
tcc_diag-g
tcc_pp-E and -P
tcc_prof-p
tcc_time-time
wsl-wsl
Goption-G
K-item-K item
Versions-V
Xmode-X mode
Z-str-Z str

See Also

tcc, tcpplus, tpl, tnc.