You can use the following environment variables with HP aC++:
- aCC_FULL_PATHNAMES
- CXXOPTS - Specify command line options automatically.
- CCLIBDIR - Specify additional directories for the linker to search for libraries.
- CCROOTDIR - Use this when compiler subprocesses are in alternate directories.
- TMPDIR - Change the location of temporary files that the compiler creates.
- LC_CTYPE - Sets C as the value for any internationlization variable not set.
- aCC_MAXERR -Sets the maximum number of errors that the compiler can report.
- SDKROOT - Sets an alternative path for the development tool kit.
- TARGETROOT- Sets an alternate path for the target set components.
- CXX_MAP_FILE - Sets the path of the option-mapping file.
- CXX_CONFIG - Sets the path of the configuration file.
aCC_FULL_PATHNAMES
Environment Variable
Exporting the aCC_FULL_PATHNAMES variable causes the compiler to include
full path names for files in compiler messages. This feature is useful in debugging.
CXXOPTS Environment Variable
CXXOPTS provides a convenient way to include frequently used
command line options automatically.
Set the environment variable and the options you want are automatically
included each time you execute the aCC command.
Syntax:
export CXXOPTS="options | options" ksh notation
setenv CXXOPTS "options | options" csh notation
Options before the vertical bar (|) are placed before command line options
to aCC. Options after the vertical bar are placed after any command
line options. Note that the vertical bar must be delimited by white space.
If you do not use the vertical bar, all options are placed before the
command line parameters.
Usage:
For quick or temporary changes to your build environment, you might use CXXOPTS instead of editing your makefiles.
Example:
export CXXOPTS="-v | -lm" ksh notation
setenv CXXOPTS "-v | -lm" csh notation
The above command causes the -v and -l options to be passed to
the aCC command each time you execute it.
When CXXOPTS is set as above, the following two commands are equivalent:
aCC -g prog.C
aCC -v -g prog.C -lm
CCLIBDIR Environment Variable
CCLIBDIR causes the aCC command to search for libraries in an
alternate directory before searching in the default directory, /opt/aCC/lib.
Syntax:
export CCLIBDIR=directory ksh notation
setenv CCLIBDIR directory csh notation
directory is an HP-UX directory where you want HP aC++ to look for libraries.
Example:
export CCLIBDIR=/mnt/proj/lib
In this example, HP aC++ searches the directory /mnt/proj/lib for libraries,
before searching the directory /opt/aCC/lib.
When CCLIBDIR is set as above, the following two commands are equivalent:
aCC -L/mnt/proj/lib file.o
aCC file.o
Note: Use the -Ldirectory option to specify additional directories
for the linker to search for libraries.
CCROOTDIR Environment Variable
The CCROOTDIR environment variable causes aCC to invoke all
subprocesses from an alternate aCC directory, rather than
from their default directory. The default aCC root directory
is /opt/aCC.
Syntax:
export CCROOTDIR=directory ksh notation
setenv CCROOTDIR directory csh notation
directory is an aCC root directory where you want the HP aC++
driver to look for subprocesses.
Example:
export CCROOTDIR=/mnt/CXX2.1
In the above example, HP aC++ searches the directories under
/mnt/CXX2.1 (/mnt/CXX2.1/bin and /mnt/CXX2.1/lbin)
for subprocesses rather than their respective default directories.
TMPDIR Environment Variable
The TMPDIR environment variable allows you to change the location
of temporary files created by the compiler. The default directory is
/var/tmp.
Syntax:
export TMPDIR=directory ksh notation
setenv TMPDIR directory csh notation
directory is the name of an HP-UX directory where you want
HP aC++ to put temporary files during compilation.
Example:
export TMPDIR=/mnt/temp ksh notation
setenv TMPDIR /mnt/temp csh notation
The above example specifies that HP aC++ should put all temporary files in /mnt/temp.
LC_CTYPE Environment Variable
The LC_CTYPE environment variable determines the interpretation
of string literals and comments as single and/or multi-byte
characters.
If LC_CTYPE is not specified in the environment or is set to the empty
string, the value of LANG is used as a default for each unspecified or
empty variable. If LANG is not specified or is set to the empty
string, a default of "C" (see lang(5)) is used instead of LANG. If
any internationalization variable contains an invalid setting, aCC
behaves as if all internationalization variables are set to "C". See
environ(5).
aCC_MAXERR Environment Variable
aCC_MAXERR allows you to set the maximum number of errors you want the
compiler to report before it terminates compilation.
SDKROOT Environment Variable
SDKROOT is used as a prefix for all references to tool set components
and must be set when you use a non-native development kit or a toolset
installed at an alternative location. Some of the toolset components
are compiler drivers, Compiler Applications, Preprocessor, Linker, and
object file tools.
For more information, refer to the
HP-UX Software Development Kit User's Guide.
TARGETROOT Environment Variable
TARGETROOT is used as a prefix for all references to target set
components and must also be set when using a non-native development
kit. Some of the target set components are header files, archive
libraries, and shared libraries.
For more information, refer to the
HP-UX Software Development Kit User's Guide.
CXX_MAP_FILE Environment Variable
The option mapping support facilitates easy migration of build environment
from a different compiler to HP aC++. You can use the option mapping files to map
the options in the third party compilers to HP aC++ equivalents.
Mapping File
The mapping file is a text file that defines the mapping rules. The compiler
reads the mapping file and applies the specified replacements to the options on
the command line. This minimizes the need to make Makefile or script changes.
By default, the path for the mapping file is set to the following location:
/opt/aCC/lib/option.map
You may either define the mapping rules in this file or set the mapping file
path to an alternate location. To specify an alternate location,
set the CXX_MAP_FILE environment variable, like the following example:
export CXX_MAP_FILE=/home/src/my_option.map sh/ksh notation
setenv CXX_MAP_FILE /home/src/my_option.map csh notation
where:
my_option.map is the name of the new mapping file.
To disable the use of the mapping file (inspite of having one in the default
location), set the above environment variable to NULL, like the following example:
export CXX_MAP_FILE= sh/ksh notation
export CXX_MAP_FILE="" sh/ksh notation
setenv CXX_MAP_FILE "" csh notation
Defining the Mapping Rules
Following is the syntax for defining the rules in the mapping file:
LHS => RHS (Note the space before and after '=>')
Where:
LHS is the third party compiler option
RHS is the HP aC++ compiler option
To define rules for options that have arguments, use the $number wildcard. For example, $1 for the first argument, and $2 for the second. If the third party compiler option (LHS) does not match with any HP aC++ option, leave the RHS blank.
Example Rules
The following example rules map gcc compiler options to corresponding HP aC++ compiler options. The same rules can be used for mapping options from any third party compiler. The syntax for the rule becomes as follows:
gcc_option => hp_option
- -Wtraditional =>
Ignores (removes) -Wtraditional, a gcc option from the command line.
- -shared => -b
Replaces -shared with -b at the command line.
- -rpath-link $1 =>
Deletes -rpath-link and the arguments from the command line.
- --gccopt $1=$2 => -hpopt $2
Replaces --gccopt name at the command line with -hpopt name.
- -gccopt $1 => +xyz
Replaces -gccopt optionarg at the command-line with +xyz.
- -Bstatic => -a archive -noshared
Replaces -Bstatic with
-a archive noshared.
CXX_CONFIG Environment Variable
You can specify default sitewide options for HP aC++ in a configuration file.
On startup, HP aC++ reads, and applies the default options from the file if the file
is found and readable. No default options are set if the file is not found or readable.
The default path of the configuration file is set to the following locations:
/var/aCC/share/aCC.conf in C++ mode
/var/ansic/share/cc.conf in C mode
To change the path of the configuration file, use the following environment variables:
export CXX_CONFIG=newfilepath.conf sh/ksh notation in C++ mode
setenv CXX_CONFIG newfilepath.conf csh notation
export CC_CONFIG=newfilepath.conf sh/ksh notation in C mode
setenv CC_CONFIG newfilepath.conf csh notation
The options in the configuration file can be specified in the following format:
[options-list-1][|[options-list-2]]
Where:
options-list-1 is applied before the options in the command line
options-list-2 is applied after the options in the command line
The final option ordering is as follows:
file-options-1 envvar-options-1 commandline-options envvar-options-2 file-options-2
Note: No default configuration files are shipped with HP aC++.
The system administrator can create them, if required.
International Code Set Support
Supports Single- and multi-byte character code sets.
|
|
More than one version of the HP aC++ compiler can be installed on one system
at the same time. The floating installation feature allows you to install the
compiler in any location. You can install as many compiler versions as required,
depending on your system's resources.
By default, HP aC++ is installed under the /opt/aCC directory. In earlier
releases, the compiler driver (aCC) looked for related files in
subdirectories of /opt/aCC. This prevented installation of more than
one version of HP aC++ on the same system at the same time.
Note that only the files in /opt/aCC are affected by
floating installation.
No matter which HP aC++ driver you are using, the compiler still uses the libraries,
linker, and other files located in /usr/lib and /usr/ccs.
Floating installation is designed to help facilitate in-house development. Be aware
that you must not ship libraries in non-standard places, since explicit run-time
library specifications and linker options are required.
Note: You can use the __HP_aCC predefined macro to determine which
version is being run.
Floating installation is not intended for use with the following:
Setting Up Floating Installation
You may want to install the most recent compiler version and keep the prior
version on one system. If there are problems with the most recent version,
it is easy to switch to the prior one. Following is an example of how to set
up the floating installation feature for this purpose.
Assume that your system will have two versions of the compiler, both
floating install enabled. In this case, A.03.10 is the prior version,
and A.03.13 is the more recent version.
- Copy the prior version to another directory.
cp -rp /opt/aCC /opt/aCC.03.10
- Use swinstall to install the new version (in this case, A.03.13).
- Invoke the A.03.10 compiler with its absolute path using the following command:
/opt/aCC.03.10/bin/aCC app.C
Alternatively, you can change your PATH environment variable or set up
an alias for the absolute path.
- To invoke the A.03.13 compiler, use the following command:
aCC app.C
The HP aC++ driver accesses subprocesses for the version you invoke.
If you want to floating install a newer compiler, use swinstall to install
the compiler to an alternate root:
- swinstall .... @ /opt/aCC.03.13
- Invoke the A.03.13 compiler with its absolute path:
/opt/aCC.03.13/opt/aCC/bin/aCC app.c
Alternatively, you can change your PATH environment variable or set up an alias for the absolute path.
|