Pragma License

Syntax:

pragma License (Unrestricted | GPL | Modified_GPL | Restricted);

This pragma is provided to allow automated checking for appropriate license
conditions with respect to the standard and modified GPL. A pragma
License, which is a configuration pragma that typically appears at
the start of a source file or in a separate gnat.adc file, specifies
the licensing conditions of a unit as follows:

Unrestricted
This is used for a unit that can be freely used with no license restrictions.
Examples of such units are public domain units, and units from the Ada
Reference Manual.

GPL
This is used for a unit that is licensed under the unmodified GPL, and which
therefore cannot be with'ed by a restricted unit.

Modified_GPL
This is used for a unit licensed under the GNAT modified GPL that includes
a special exception paragraph that specifically permits the inclusion of
the unit in programs without requiring the entire program to be released
under the GPL.

Restricted
This is used for a unit that is restricted in that it is not permitted to
depend on units that are licensed under the GPL. Typical examples are
proprietary code that is to be released under more restrictive license
conditions. Note that restricted units are permitted to with units
which are licensed under the modified GPL (this is the whole point of the
modified GPL).

Normally a unit with no License pragma is considered to have an
unknown license, and no checking is done. However, standard GNAT headers
are recognized, and license information is derived from them as follows.

A GNAT license header starts with a line containing 78 hyphens. The following
comment text is searched for the appearance of any of the following strings.

If the string “GNU General Public License” is found, then the unit is assumed
to have GPL license, unless the string “As a special exception” follows, in
which case the license is assumed to be modified GPL.

If one of the strings
“This specification is adapted from the Ada Semantic Interface” or
“This specification is derived from the Ada Reference Manual” is found
then the unit is assumed to be unrestricted.

These default actions means that a program with a restricted license pragma
will automatically get warnings if a GPL unit is inappropriately
with'ed. For example, the program:

with Sem_Ch3;
with GNAT.Sockets;
procedure Secret_Stuff is
...
end Secret_Stuff

if compiled with pragma License (Restricted) in a
gnat.adc file will generate the warning:

Here we get a warning on Sem_Ch3 since it is part of the GNAT
compiler and is licensed under the
GPL, but no warning for GNAT.Sockets which is part of the GNAT
run time, and is therefore licensed under the modified GPL.