Previous
Home
Contents
Next
Chapter 28: The unicl driver
The unicl program, which is supplied in the distribution and
can be found in $ALDORROOT/bin, is a configurable driver for
the C compiler and linker. It is used whenever the aldor options -Fo or
-Fx are specified.
The aldor option -v can be used to show how unicl
is invoked and how it calls the underlying C compiler. Invoking unicl
on its own will display some useful information about the options it understands.
These include some options commonly found in C compilers such as
- -O : Optimize.
- -c : Compile only, do not link.
- -g : Include debug information in generated objects.
- -o name : Name the executable.
- -p : Include profiling code.
- -D def : Define a macro.
- -U undef : Undefine a macro.
- -I dir : Specify directory for included files.
- -L dir : Specify directory for linked libraries.
- -l lib : Specify libraries to link.
Additionally, unicl understands the following options
- -Wh : Show help information.
- -Wv : Be verbose.
- -Wv=n : Set verbosity level (currently 0-4).
- -Wn : Do not execute generated commands.
An extra set of options act as flags for certain non-default unicl behaviour. These are
- -Wstdc : Use an ANSI C compiler.
This is passed from aldor
unless aldor -Cold is specified.
- -Wshared : Produce a shared object.
- -Wfortran : Link in FORTRAN code.
This is passed from aldor
when aldor option -Cfortran is specified.
- -Wfnonstd : Enable non-standard (non-IEEE) floating point.
This is passed
from aldor when aldor -Q4 or -Qcc-fnonstd is specified.
The unicl program will also look for options in the UNICL environment variable
and will prepend them to the command line options if the variable exists.
The unicl program itself does not have any knowledge about the underlying
C compiler for each platform. All the necessary information is read by unicl from
an ASCII configuration file. By default, this file is searched for in
$ALDORROOT/include/aldor.conf but the
- -Wconfig=file : Specify location of configuration file.
option can be used to select an alternative. The configuration file consists of named sections
introduced by an identifier enclosed in square brackets. Each section consists of assignments of the
form key=value. The options
- -Wsys=name : Specify which section of the configuration file to use.
- -Wv=2 : Show which section is being used.
set and show the section selected. When aldor calls unicl it automatically
(currently, it does this via the UNICL environment variable so you need to give the
aldor option -Cargs=-Wv=3 to see that. The unicl option
-Wstdc is also passed that way unless you specify aldor option
-Cold) specifies the appropriate section of the configuration file.
The advantage of this method is that
all the details for every implementation of Aldor can be kept in one place.
It also means that the compiler user has complete control over the back end C compiler
and linker. It is a simple matter, for instance to introduce a new section with a modified name,
populate it with some variations on the original values and give the aldor option
-Csys=newname.
These are the meaningful keys in the configuration file.
- The name of the program to call for compiling and linking
- cc-name : compiling only, non-ANSI C
- link-name : linking, non-ANSI C
- std-cc-name : compiling only, ANSI C
- std-link-name : linking, ANSI C
- The flag to use when -g (debugging) is given
- cc-debug : compiling only, non-ANSI C
- link-debug : linking, non-ANSI C
- std-cc-debug : compiling only, ANSI C
- std-link-debug : linking, ANSI C
- The flag to use when -p (profiling) is given
- cc-profile : compiling only, non-ANSI C
- link-profile : linking, non-ANSI C
- std-cc-profile : compiling only, ANSI C
- std-link-profile : linking, ANSI C
- The flags to use when -O (optimising) is given (without the -Wfnonstd option)
- cc-optimize : compiling only, non-ANSI C
- link-optimize : linking, non-ANSI C
- std-cc-optimize : compiling only, ANSI C
- std-link-optimize : linking, ANSI C
- The flags to use when -O and -Wfnonstd (non-IEEE optimising) are given
- cc-non-std-float : compiling only, non-ANSI C
- link-non-std-float : linking, non-ANSI C
- std-cc-non-std-float : compiling only, ANSI C
- std-link-non-std-float : linking, ANSI C
- The flags to use in any case. These will appear before any specified files.
- cc-opts : compiling only, non-ANSI C
- link-opts : linking, non-ANSI C
- std-cc-opts : compiling only, ANSI C
- std-link-opts : linking, ANSI C
- The flags to use in any case. These will appear at the end of the command.
- cc-post : compiling only, non-ANSI C
- link-post : linking, non-ANSI C
- std-cc-post : compiling only, ANSI C
- std-link-post : linking, ANSI C
- The flags to use in any case. These will appear after filenames but before
any library specification only at the link step.
- link-twixt : linking, non-ANSI C
- std-link-twixt : linking, ANSI C
- The flags to use when linking libraries.
- library : The flag for linking libraries (commonly -l).
- library-sep : Do we need a space between the flag and the name of the library (true/false).
- lib-extra : A space delimited list of libraries to be linked.
Example: nsl socket.
- libpath : The flag for specifying library directories (commonly -L).
- libpath-sep : Do we need a space between the flag and the name of the library directory (true/false).
- expand-libs : Do we turn -llib options into complete file arguments (true/false).
- lib-ext : The file extension for libraries (commonly a).
- lib-default-path : A space delimited list of directories to be searched for libraries.
Example: /usr/local/lib /usr/openwin/lib.
- The flags to use when specifying include file directories.
- include : The flag for specifying include file directories (commonly -I).
- include-sep : Do we need a space between the flag and the name of the include file directories (true/false).
- include-default-path : A space delimited list of directories to be searched for include files.
Examples: /usr/local/include /usr/openwin/include.
- The flags to use when defining or undefining macros.
- define : The flag for defining a macro (commonly -D).
- define-sep : Do we need a space between the flag and the name of the macro (true/false).
- undefine : The flag for undefining a macro (commonly -U).
- undefine-sep : Do we need a space between the flag and the name of the macro (true/false).
- The flag to use when specifying name of linked executable.
- output-name : The flag for specifying the name of the executable (commonly -o).
- output-name-sep : Do we need a space between the flag and the name (true/false).
- Miscellaneous keys
- compile-only : The flag that specifies compilation only (commonly -c).
- debug-profile-ok : Can we specify debugging and profiling at the same time (true/false).
- debug-optimize-ok : Can we specify debugging and optimizing at the same time (true/false).
- fortran-libraries : A verbatim string that will be appended when -Wfortran is specified. See \secref{asugFortPlatform}.
Example: -lfort -lf77
- Keys that aldor looks for
- generate-stdc : Do we generate ANSI C (true/false).
- fortran-cmplx-fns : Which scheme to use when dealing with
FORTRAN functions returning complex numbers.
The possible values are string return-void
return-struct disallowed.
See \secref{asugFortPlatform}.
- fortran-naming-scheme : Which scheme to use when resolving external FORTRAN names.
The possible values are underscore no-underscore underscore-bug.
See \secref{asugFortPlatform}.
The special key inherit takes as value a section name and directs unicl
to look in the named section if a key is not found in the current one. The special character
$ prepended to a key name stands for the value of that key. You can introduce your own
keys for convenience and refer to them using $. The following conditions are provided
- compile the program is compiling C code (one of `link' and `compile' will be true)
- link the program is linking its arguments to an executable
- stdc -Wstdc was specified
- shared -Wshared was specified
- optimize -O was specified
- nonstdfloat -Wnonstdfloat was specified
- stdfloat -Wnonstdfloat was not specified
- profile -p was specified.
You can use the conditions when specifying values with this form
$?condition w1 w2 w3 : w4 ;
meaning 'If condition is true then w1 w2 w3 else w4'. Conditional
forms can be ested.
Previous
Home
Contents
Next