GPRconfig Reference
GPRconfig probes the host for available compilers and generates a
configuration project (.cgpr) that describes the selected toolchains to
all GPR tools. It can be used interactively or in batch mode from a script.
GPRconfig is independent of any GPR project tree. It does not accept the common project and configuration switches described in Common Command-Line Options; its option set is documented entirely in this chapter.
Command Line
Syntax
gprconfig [switches]
Compiler selection
GPRconfig scans PATH (and any directories added by --config) for
compiler executables, cross-references them against the knowledge base, and
builds a list of available compilers. In interactive mode the user selects
which compilers to include; in batch mode (--batch) the selection is
driven entirely by --config options on the command line.
At most one compiler per language may be selected. The output configuration
project contains one package Compiler section per selected language.
Switches
Target and output
--target=nameSelect compilers for the given target. Use
allto list compilers for every available target. Defaults to the native target. In batch mode,--target=allis silently ignored.-ofileWrite the generated configuration project to file. Defaults to
default.cgprwhen no target is specified, or<target>.cgprwhen a target is given.--show-targetsPrint the list of targets for which at least one compiler is available in the knowledge base, then exit. The native target is marked
(native target).--mi-show-compilersPrint a machine-readable list of all available compilers and exit. Each compiler is described as a set of
key=valuepairs; compilers already selected for output are prefixed with*. Intended for IDE integration.--show-known-compilersPrint the names of all compiler blocks defined in the knowledge base, then exit.
Compiler selection (batch mode)
--batchRun in batch (non-interactive) mode. No prompts are displayed. The compilers to include must be specified entirely via
--configoptions.--config=selectorPre-select a compiler. May be repeated, at most once per language.
The selector has two equivalent forms:
Positional:
language[,version[,runtime[,path[,name]]]]ada ada,12.1 ada,,zfp ada,,zfp,/opt/gnat/bin,gnat
Named:
key:value[,key:value...]language:ada language:ada,version:12.1 language:ada,runtime:zfp language:ada,runtime:zfp,path:/opt/gnat/bin,name:gnat
Available keys/fields:
languageRequired. Language identifier (
ada,c,c++, …).versionOptional. Compiler version string (e.g.
12.1).runtimeOptional. Runtime variant (e.g.
sjlj,zfp,ravenscar).pathOptional. Directory containing the compiler executable.
nameOptional. Compiler name as defined in the knowledge base (e.g.
GCC,GNAT) or the base name of the compiler executable (e.g.gcc,arm-elf-gnatmake).
Omitted optional fields match any value. An empty string also matches any value, so
ada,,zfpis equivalent tolanguage:ada,runtime:zfp.--fallback-targetsWhen no compiler is found for the requested target, also search for toolchains recorded as fallbacks, such as a compatible native target of a different architecture.
Knowledge base
--dbdirParse dir as an additional knowledge base directory (may be repeated).
--db-Do not load the standard knowledge base. Use together with
--dbto load a completely custom knowledge base.--validateValidate the knowledge base before use and report any schema errors, then proceed normally.
Diagnostics
-vVerbose output. Repeat (
-v -v) for even more detail, including internal knowledge base traces.-qQuiet: suppress all output except errors.
Interactive mode
When run without --batch, GPRconfig displays the list of compilers found
for the selected target (one per line, with an index), prompts the user to
select or deselect entries by typing their index number, and writes the
configuration when the user types s. Selecting a compiler for a language
automatically deselects any previously selected compiler for the same
language.
After saving, GPRconfig prints the equivalent --batch command line so
that the same selection can be reproduced in scripts.
Configuration file format
The generated file is a valid GPR configuration project (configuration
qualifier, .cgpr extension). It defines:
package Compiler- compiler driver, default switches, dependency file format, and naming conventions for each selected language.package Linker- linker driver and default flags.package Binder- binder driver (for Ada).package Archive_Builder- archiver command.Top-level attributes -
Target,Canonical_Target,Runtime_Library_Dir,Object_Generated,Library_Support,Shared_Library_Prefix,Shared_Library_Suffix, and related platform attributes.
The file is consumed by GPRbuild and the other project-based tools via
--config or --autoconf. It is not a user project file and is not
referenced by with clauses.
Exit Codes
0Success; configuration file written (or information displayed).
1No compiler found for the requested target or language, knowledge base error, or configuration generation failure.
7Invalid command-line option.