next up previous contents
Next: Naming Conventions for Source Up: Configuring your Thorn Previous: Storage Outside of Schedule   Contents


The configuration.ccl

[NOTE: the configuration.ccl is a new feature, and not all the features described in this section have been fully implemented yet. PROVIDES, REQUIRES and SCRIPT should work, but OPTIONAL is still being developed.]

The configuration.ccl file is optional. It can be used for two purposes: to detect certain features of the host system, such as the presence or absence of libraries, variable types, etc, or the location of libraries; or to provide access to certain functions too complex or otherwise not suitable for function aliasing.

The basic concept here is that a thorn can either provide or use a capability. A thorn providing a capability can specify a script which is run by the CST to detect features and write any configuration files; the script may output lines to its standard output to inform the CST of features to: add to the header files included by thorns using this capability; add to the make files used to build thorns using this capability; or add to the main Cactus link line. The script may also indicate that this capability is not present by returning a non-zero exit code--e.g. if the thorn is providing access to an external library, it should return an error if the library is not installed on the system.

A thorn may either require a capability to be present, in which case it is an error if there is no thorn providing that capability in the configuration's ThornList, or it may optionally use a capability, in which case a macro is defined in the thorn's header file if a thorn providing the capability is present.

A configuration.ccl file has the form:

PROVIDES <My_Capability>
{
  SCRIPT <My_ConfigScript>
  LANG <My_Language>
}

REQUIRES  <Another_Capability>

OPTIONAL <Yet_Another_Capability>
{
  DEFINE <macro>
}

which states that this thorn provides the capability My_Capability, and a script MyConfigScript should be run to detect features of this capability; the script is in language My_Language--the CST will use the appropriate environment or interpreter to invoke the script.

The example requires a thorn providing Another_Capability to be in the ThornList, and, if a thorn providing Yet_Another_Capability is in the ThornList, the preprocessor macro macro will be defined, and set to 1.

As an example, a thorn A may be able to use PVM for parallelism if it is present, but can still work in the absence of it. There could be a thorn providing PVM, and thorn A would then have

OPTIONAL PVM
{
  DEFINE HAVE_PVM
}

The code in thorn A could then have


#ifdef HAVE_PVM
  do something
#else
  do something else
#endif

to pick the appropriate mode.

The syntax of the output of the configure script is described in Appendix E2.5.1.


next up previous contents
Next: Naming Conventions for Source Up: Configuring your Thorn Previous: Storage Outside of Schedule   Contents