Next: , Previous: Building a library, Up: General Ada Libraries


20.2.2 Installing a library

If you use project files, library installation is part of the library build process (see Installing a library with project files).

When project files are not an option, it is also possible, but not recommended, to install the library so that the sources needed to use the library are on the Ada source path and the ALI files & libraries be on the Ada Object path (see Search Paths and the Run-Time Library (RTL). Alternatively, the system administrator can place general-purpose libraries in the default compiler paths, by specifying the libraries' location in the configuration files ada_source_path and ada_object_path. These configuration files must be located in the GNAT installation tree at the same place as the gcc spec file. The location of the gcc spec file can be determined as follows:

     $ gcc -v

The configuration files mentioned above have a simple format: each line must contain one unique directory name. Those names are added to the corresponding path in their order of appearance in the file. The names can be either absolute or relative; in the latter case, they are relative to where theses files are located.

The files ada_source_path and ada_object_path might not be present in a GNAT installation, in which case, GNAT will look for its run-time library in the directories adainclude (for the sources) and adalib (for the objects and ALI files). When the files exist, the compiler does not look in adainclude and adalib, and thus the ada_source_path file must contain the location for the GNAT run-time sources (which can simply be adainclude). In the same way, the ada_object_path file must contain the location for the GNAT run-time objects (which can simply be adalib).

You can also specify a new default path to the run-time library at compilation time with the switch --RTS=rts-path. You can thus choose / change the run-time library you want your program to be compiled with. This switch is recognized by gcc, gnatmake, gnatbind, gnatls, gnatfind and gnatxref.

It is possible to install a library before or after the standard GNAT library, by reordering the lines in the configuration files. In general, a library must be installed before the GNAT library if it redefines any part of it.