Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Systems: HP aC++/HP C Programmer's Guide > Chapter 1 Getting Started

Environment Variables

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

This section describes the following environment variables that you can use to control the HP aC++ or HP C compiler:

CXXOPTS Environment Variable

The CXXOPTS environment variable provides a convenient way to include frequently used command-line options automatically.

Options before the vertical bar (|) are placed before command-line options to aCC. The options after the vertical bar are placed after any command-line option. 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.

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/sh notation

setenv CXXOPTS "options | options" csh notation

Usage:

For quick or temporary changes to your build environment, use CXXOPTS instead of editing your makefiles.

Example:

export CXXOPTS="-v | -lm" ksh/sh 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

CCOPTS Environment Variable

You can pass arguments to the compiler using the CCOPTS environment variable or include them on the command line. The CCOPTS environment variable provides a convenient way for establishing default values for cc command line options. It also provides a way for overriding cc command line options.

The syntax for the CCOPTS environment variable in C shell notation is:

export CCOPTS="options | options" (ksh/sh notation)

setenv CCOPTS "options | options" (csh notation)

The compiler places the arguments that appear before the vertical bar in front of the command line arguments to cc. It then places the second group of arguments after any command line arguments to cc.

Options that appear after the vertical bar in the CCOPTS variable override and take precedence over options supplied on the cc command line.

If the vertical bar is omitted, the compiler gets the value of CCOPTS and places its contents before any arguments on the command line.

For example, the following in C shell notation

setenv CCOPTS -v
cc -g prog.c

is equivalent to

cc -v -g prog.c

For example, the following in C shell notation

setenv CCOPTS "-v | +O1"
cc +O2 prog.c

is equivalent to

cc -v +O2 prog.c +O1

In the above example, level 1 optimization is performed, since the +O1 argument appearing after the vertical bar in CCOPTS takes precedence over the cc command line arguments.

CCLIBDIR Environment Variable

The CCLIBDIR environment variable causes the aCC command to search for libraries in an alternate directory before searching in the default directories.

Syntax:

export CCLIBDIR=directory   ksh/sh 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 a in the above example, the following two commands are equivalent:

aCC -L/mnt/proj/lib file.o

aCC file.o

NOTE: You can 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/sh notation
setenv CCROOTDIR directory   csh notation

directory is an aCC root directory where you want the HP aC++ driver to search for subprocesses.

Example:

export CCROOTDIR=/mnt/CXX2.1

In this 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/sh 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.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.