Next: The GPRconfig knowledge base, Previous: Configuration, Up: Configuring with GPRconfig [Contents][Index]
The GPRconfig tool helps you generate the configuration files for GPRbuild. It automatically detects the available compilers on your system and, after you have selected the one needed for your application, it generates the proper configuration file.
In general, you will not launch GPRconfig
explicitly. Instead, it is used implicitly by GPRbuild through the use
of --config
and --autoconf
switches.
GPRconfig supports the following command line switches:
Use --target to specify on which machine your application will run
This switch indicates the target computer on which your application will be run. It is mostly useful for cross configurations. Examples include ‘ppc-elf’, ‘ppc-vx6-windows’. It can also be used in native configurations and is useful when the same machine can run different kind of compilers such as mingw32 and cygwin on Windows or x86-32 and x86-64 on GNU Linux. Since different compilers will often return a different name for those targets, GPRconfig has an extensive knowledge of which targets are compatible, and will for example accept ‘x86-linux’ as an alias for ‘i686-pc-linux-gnu’. The default target is the machine on which GPRconfig is run.
If you enter the special target ‘all’, then all compilers found on the
PATH
will be displayed.
As mentioned above, GPRconfig knows which targets are compatible. You
can use this switch to find the list of targets that are compatible
with --target
.
Use --config to automatically select the first matching compiler
The intent of this switch is to preselect one or more compilers directly from the command line. This switch takes several optional arguments, which you can omit simply by passing the empty string. When omitted, the arguments will be computed automatically by GPRconfig.
In general, only language needs to be specified, and the first
compiler on the PATH
that can compile this language will be selected.
As an example, for a multi-language application programmed in C and Ada,
the command line would be:
--config=Ada --config=C
path is the directory that contains the compiler executable, for instance /usr/bin (and not the installation prefix /usr).
name should be one of the compiler names defined in the GPRconfig knowledge base. The list of supported names includes ‘GNAT’, ‘GCC’,…. This name is generally not needed, but can be used to distinguish among several compilers that could match the other arguments of --config.
Another possible more frequent use of name is to specify the base name of an executable. For instance, if you prefer to use a diab C compiler (executable is called dcc) instead of gcc, even if the latter appears first in the path, you could specify dcc as the name parameter.
gprconfig --config Ada,,,/usr/bin # automatic parameters gprconfig --config C,,,/usr/bin,GCC # automatic version gprconfig --config C,,,/usr/bin,gcc # same as above, with exec name
This switch is also the only possibility to include in your project some languages that are not associated with a compiler. This is sometimes useful especially when you are using environments like GPS that support project files. For instance, if you select "Project file" as a language, the files matching the .gpr extension will be shown in the editor, although they of course play no role for gprbuild itself.
Use --batch to generate the configuration file with no user interaction
--config
switches, and generates the
configuration file immediately. It will not display an interactive menu.
Use -o to specify the name of the configuration file to generate
Indicates another directory that should be parsed for GPRconfig’s knowledge base. Most of the time this is only useful if you are creating your own XML description files locally. The second version of the switch prevents GPRconfig from reading its default knowledge base.
Generates a brief help message listing all GPRconfig switches and the default value for their arguments. This includes the location of the knowledge base, the default target,…
When you launch GPRconfig, it first searches for all compilers it
can find on your PATH
, that match the target specified by
--target. It is recommended, although not
required, that you place the compilers that you expect to use for your
application in your PATH
before you launch gprconfig
,
since that simplifies the setup.
The list of compilers is sorted so that the most likely compilers appear first
GPRconfig then displays the list of all the compilers
it has found, along with the language they can compile, the run-time
they use (when applicable),…. It then waits for you to select
one of the compilers. This list is sorted by language, then by order
in the PATH
environment variable (so that compilers that you
are more likely to use appear first), then by run-time names and
finally by version of the compiler. Thus the first
compiler for any language is most likely the one you want to use.
You make a selection by entering the letter that appears on the line for each compiler (be aware that this letter is case sensitive). If the compiler was already selected, it is deselected.
The list of compilers is filtered, so that only compatible compilers can be selected
A filtered list of compilers is then displayed: only compilers that target the same platform as the selected compiler are now shown. GPRconfig then checks whether it is possible to link sources compiled with the selected compiler and each of the remaining compilers; when linking is not possible, the compiler is not displayed. Likewise, all compilers for the same language are hidden, so that you can only select one compiler per language.
As an example, if you need to compile your application with several C compilers, you should create another language, for instance called C2, for that purpose. That will give you the flexibility to indicate in the project files which compiler should be used for which sources.
The goal of this filtering is to make it more obvious whether you have a good chance of being able to link. There is however no guarantee that GPRconfig will know for certain how to link any combination of the remaining compilers.
You can select as many compilers as are needed by your application. Once you have finished selecting the compilers, select s, and GPRconfig will generate the configuration file.