Next: , Previous: Installation Requirements, Up: Building and Installing NetCDF on Unix Systems


2.2 Specifying the Environment for Building

The netCDF configure script will set some environment variables that are important for building from source code. It is only necessary to set them to override default behavior.

The netCDF configure script searches your path to find the compilers and tools it needed. To use compilers that can't be found in your path, set their environment variables.

When finding compilers, vendor compilers will be preferred to GNU compilers. 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.)

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).

Variable Description Notes

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, 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, if no Fortran 90 interface 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, 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.


CPPFLAGS C preprocessor options "-DNDEBUG" to omit assertion checks, for example.


FFLAGS Fortran compiler flags "-O" or "-g", for example.


F90FLAGS Fortran 90 compiler flags "-O" or "-g", for example. If you don't specify this, the value of FFLAGS will be used.


CXXFLAGS C++ compiler flags "-O" or "-g", for example.


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.