Next: Building on 64 Bit Platforms, Previous: Requirements, Up: Building and Installing NetCDF on Unix Systems
The netCDF configure script searches your path to find the compilers, tools, and settings it needs to build netCDF. If you wish to change the default choices of the configure script, you may do so by setting environment variables.
Environment variables are a feature of Unix shells, and each shell may handle them in a slightly different manner. (To see which shell you are using, type: echo $SHELL).
For users of the C-shell (csh) and derived shells, use the setenv command to set environment variables. For the Bourne shell (sh), use the export command to set an environment variable.
For example, to use compilers that can't be found in your path, set the appropriate CC, CXX, F77, or F90 environment variables. In the Bourne shell:
export CC=/some/strange/place/cc export F77=/some/strange/place/f77 ./configure make check
To accomplish the same thing from the C-shell:
setenv CC /some/strange/place/cc setenv F77 /some/strange/place/f77 ./configure make check
When searching for compilers the configure script will prefer vendor compilers to GNU compilers. Its not because we don't like GNU, but because we assume if you purchased a compiler, you want to use it. Setting CC allows you to over-ride this preference. (Alternatively, you could temporarily remove the compiler's directories from your PATH.)
For example, on an AIX system, configure will first search for xlc, the AIX compiler. If not found, it will try gcc, the GNU compiler. To override this behavior, set CC to gcc (in sh: export CC=gcc). (But don't forget to also set CXX to g++, or else configure will try and use xlC, the AIX C++ compiler to build the netCDF C++ API.)
By default, the netCDF library is built with assertions turned on. If you wish to turn off assertions, set CPPFLAGS to -DNDEBUG (csh ex: setenv CPPFLAGS -DNDEBUG).
If GNU compilers are used, the configure script sets CPPFLAGS to “-g -O2”. If this is not desired, set CPPFLAGS to nothing, or to whatever other value you wish to use, before running configure.
CC | C compiler | If you don't specify this, the configure script will try to
find a suitable C compiler such as cc, c89, xlc, or gcc.
|
FC | Fortran compiler (if any) | If you don't specify this, the configure script will try to find a
suitable Fortran 90 or Fortran 77 compiler. Set FC to "" explicitly,
or provide the –disable-f77 option to configure, if no Fortran
interface is desired.
|
F90 | Fortran 90 compiler (if any) | If you don't specify this, the configure script will try to find a
suitable Fortran 90 compiler. Not needed if FC specifies a Fortran 90
compiler. Set F90 to "" explicitly, or use the –disable-f90 option to
configure, if no Fortran 90 interface is desired. For a vendor F90
compiler, make sure you're using the same vendor's F77 compiler. Using
Fortran compilers from different vendors, or mixing vendor compilers
with g77, the GNU F77 compiler, is not supported and may not work.
|
CXX | C++ compiler | If you don't specify this, the configure script will try to find a
suitable C++ compiler. Set CXX to "" explicitly, or use the
–disable-cxx configure option, if no C++ interface is desired. If
using a vendor C++ compiler, use that vendor's C compiler to compile
the C interface. Using different vendor compilers for C and C++ may
not work.
|
CFLAGS | C compiler flags | "-O" or "-g", for example. If you don't set this, configure may
set it based on your platform's needs (unless you have used the
–disable-flag-setting option is used with configure).
|
CPPFLAGS | C preprocessor options | "-DNDEBUG" to omit assertion checks, for example. If you don't
set this, configure may set it based on your platform's needs (unless
you have used the –disable-flag-setting option is used with
configure).
|
FFLAGS | Fortran compiler flags | "-O" or "-g", for example. If you don't set this, configure may
set it based on your platform's needs (unless you have used the
–disable-flag-setting option is used with configure).
|
F90FLAGS | Fortran 90 compiler flags | "-O" or "-g", for example. If you don't specify this, the value of
FFLAGS will be used. Configure may set it based on your platform's
needs (unless you have used the –disable-flag-setting option is used
with configure).
|
CXXFLAGS | C++ compiler flags | "-O" or "-g", for example. If you don't set this, configure may
set it based on your platform's needs (unless you have used the
–disable-flag-setting option is used with configure).
|
ARFLAGS, NMFLAGS, FPP, M4FLAGS, LIBS, FLIBS, FLDFLAGS | Miscellaneous | One or more of these were needed for some platforms, as specified
below. Unless specified, you should not set these environment
variables, because that may interfere with the configure script.
|
The section marked Tested Systems below contains a list of systems on which we have built this package, the environment variable settings we used, and additional commentary.