A small number of UNIX commands are provided by AST to assist with the process of building software. A description of these can be found in Appendix E and their use is discussed here. Note that in order to access these commands, the appropriate directory (normally “/star/bin”) should be on your PATH.40
The include files provided for use with Fortran are:
References to AST include files should be in upper case. Most modern Fortran compilers allow the directory to be specified as a command line option:
If you are using such a compiler then your Fortran source code should, for instance, include:
(that is, there is no need to include the directory within the INCLUDE statement). If your compiler does not provide such an option then your source code must contain an absolute file name identifying the directory where the include files reside, for instance:
Fortran programs may be linked with AST by including execution of the command “ast_link” on the compiler command line. Thus, to compile and link a program called “prog”, the following might be used:
On Linux systems you should usually use g77 -fno-second-underscore in place of f77 - see “Software development on Linux” in SUN/212.
Note the use of backward quote characters, which cause the “ast_link” command to be executed and its result substituted into the compiler command. An alternative is to save the output from “ast_link” in (say) a shell variable and use this instead. You may find this a little faster if you are building software repeatedly during development.
Programs which use AST can also be linked in a number of other ways, depending on the facilities they require. In the example above, we have used the default method which assumes that the program will not be generating graphical output, so that no graphics libraries need be linked. If you need other facilities, then various switches can be applied to the “ast_link” command in order to control the linking process.
For example, if you were producing graphical output using the PGPLOT graphics package, you could link with the AST/PGPLOT interface by using the “−pgplot” switch with “ast_link”, as follows:41
again using g77 -fno-second-underscore in place of f77 on Linux systems.
See the “ast_link” command description in Appendix E for details of the options available.
Users of Starlink’s ADAM programming environment (SG/4) on UNIX should use the “alink” command (SUN/144) to compile and link applications and can access the AST library by including execution of the command “ast_link_adam” on the command line, as follows:
Note the use of backward quote characters.
By default, AST error messages produced by applications built in this way will be delivered via the Starlink EMS Error Message Service (SSN/4) so that error handling by AST is consistent with the inherited status error handling normally used in Starlink software.
Switches may be given to the “ast_link_adam” command (in a similar way to “ast_link”—§22.2) in order to link with additional AST-related facilities, such as a graphics interface. See the “ast_link_adam” command description in Appendix E for details of the options available.
40If you have not installed AST in the usual location, then substitute the appropriate directory in place of “/star” wherever it occurs.
41Use the “−pgp” option instead if you wish to use the Starlink version of PGPLOT which uses GKS to generate its output.