Next: GPRconfig external values, Previous: General file format, Up: The GPRconfig knowledge base [Contents][Index]
One of the XML tags that can be specified as a child of <gprconfig>
is
<compiler_description>
. This node and its children describe one of
the compilers known to GPRconfig. The tool uses them when it
initially looks for all compilers known on the user’s PATH
environment variable.
This is optional information, but simplifies the use of GPRconfig, since the user is then able to omit some parameters from the --config command line argument, and have them automatically computed.
The <compiler_description>
node doesn’t accept any XML
attribute. However, it accepts a number of child tags that explain
how to query the various attributes of the compiler. The child tags
are evaluated (if necessary) in the same order as they are documented below.
<name>
This tag contains a simple string, which is the name of the compiler.
This name must be unique across all the configuration files, and is used to
identify that compiler_description
node.
<compiler_description> <name>GNAT</name> </compiler_description>
<executable>
This tag contains a string, which is the name of an executable to search for on the PATH. Examples are ‘gnatls’, ‘gcc’,…
In some cases, the tools have a common suffix, but a prefix that might depend
on the target. For instance, GNAT uses ‘gnatmake’ for native platforms,
but ‘powerpc-wrs-vxworks-gnatmake’ for cross-compilers to VxWorks.
Most of the compiler description is the same, however.
For such cases, the value of the executable
node is considered as
beginning a regular expression. The tag also accepts an optional
attribute prefix
,
which is an integer indicating the parenthesis group that contains the prefix.
In the following example, you obtain the version of the GNAT compiler by running
either gnatls
or powerpc-wrs-vxworks-gnatls
, depending on
the name of the executable that was found.
The regular expression needs to match the whole name of the file, i.e. it contains an implicit “^” at the start, and an implicit “$” at the end. Therefore if you specify ‘.*gnatmake’ as the regexp, it will not match ‘gnatmake-debug’.
A special case is when this node is empty (but it must be specified!). In such a case, you must also specify the language (see <language> below) as a simple string. It is then assumed that the specified language does not require a compiler. In the configurations file (see Configurations), you can test whether that language was specified on the command line by using a filter such as
<compilers> <compiler language="name"/> </compilers>
<executable prefix="1">(powerpc-wrs-vxworks-)?gnatmake</executable> <version><external>${PREFIX}gnatls -v</external></version>
GPRconfig searches in all directories listed on the PATH for such
an executable. When one is found, the rest of the <compiler_description>
children are checked to know whether the compiler is valid. The directory
in which the executable was found becomes the “current directory” for
the remaining XML children.
<target>
This node indicates how to query the target architecture for the compiler. See GPRconfig external values for valid children.
If this isn’t specified, the compiler will always be considered as matching on the current target.
<version>
This tag contains any of the nodes defined in GPRconfig external values below. It shows how to query the version number of the compiler. If the version cannot be found, the executable will not be listed in the list of compilers.
<variable name="varname">
This node will define a user variable which may be later referenced. The variables are evaluated just after the version but before the languages and the runtimes nodes. See GPRconfig external values below for valid children of this node. If the evaluation of this variable is empty then the compiler is considered as invalid.
<languages>
This node indicates how to query the list of languages. See GPRconfig external values below for valid children of this node.
The value returned by the system will be split into words. As a result, if the returned value is “ada,c,c++”, there are three languages supported by the compiler (and three entries are added to the menu when using GPRconfig interactively).
If the value is a simple string, the words must be comma-separated, so that you can specify languages whose names include spaces. However, if the actual value is computed from the result of a command, the words can also be space-separated, to be compatible with more tools.
<runtimes>
This node indicates how to query the list of supported runtimes for the
compiler. See GPRconfig external values
below for valid children. The returned value
is split into words as for <languages>
.