3.4 Running the configure Script
To create the Makefiles needed to build netCDF, you must run the
provided configure script. Go to the top-level netCDF directory.
Decide where you want to install this package. Use this for the
"–prefix=" argument to the configure script below. The default
installation prefix is “/usr/local,” which will install the
package's files in usr/local/bin, usr/local/lib, and
usr/local/man. The default can be overridden with the –prefix
argument to configure.
(Note that this is a new default location for version 3.6.2 of
netCDF. Previous versions used the directory in which netCDF was built
as the default install directory).
Here's how to execute the configure script with a different
The above would cause the netCDF libraries to be installed in
/whatever/you/decided/lib, the header files in
/whatever/you/decided/include, the utilities (ncdump/ncgen) in
/whatever/you/decided/bin, and the man pages in
There are other options for the configure script. The most useful ones
are listed below. Use the –help option to get the full list.
- Specify the directory under which netCDF will be
installed. Subdirectories lib, bin, include, and man will be created
there, if they don't already exist.
- Build shared libraries (as well as static) on platforms which support
- If this option is used, the netCDF distribution will install all
documentation. NetCDF documents are provided in PDF, HTML,
postscript, info, and ASCII text.
You can change the directory that documents are installed to. Run
./configure –help for more information.
The this option does not affect the netCDF man
pages, which are always installed. This option applies only to the
texinfo documentation files in the man directory (netcdf.texi,
netcdf-c.texi, and so on).
The latest documentation is also available on-line at the the netCDF
Installing the documentation does not cause the documentation to be
built from source; it causes the documentation which was shipped with
the distribution to be installed.
Users who wish to contribute to the documentation development are
urged to make any suggested changes to the documentation source files,
which have the .texi filename extension (netcdf.text, netcdf-c.texi,
etc.). Building the netCDF documentation from source requires recent
versions of the open-source tools sed, m4, texinfo, and tex.
- By default the configure script may change some compiler flags to
allow netCDF to build on your platform. If you wish to specify
compiler flags which conflict with the ones added by the configure
script, then use this option to instruct configure not to attempt to
set any compiler flags. It is then the responsibility of the user to
correctly set CPPFLAGS, CFLAGS, etc. (Note that this flag does not
affect some setting of flags by configure for GNU platforms; it just
turns off any special netCDF flags).
- Compile for 64-bit platform on Sun, AIX, HPUX, or Irix. (Has no effect
on other platforms). Since this works by setting some compiler flags,
this option is incompatible with –disable-flag-setting.
- This omits OS support for large files (i.e. files larger than 2 GB).
- This turns off building of the F77 and F90 APIs. (The F90 API cannot
be built without the F77 API). This also disables some of the
configure tests that relate to fortran, including the test of the F90
compiler. Setting the environment variables FC or F77 to NULL will
have the same effect as –disable-f77.
- This turns off the building of the F90 API. Setting the environment
variable F90 to null for configure will have the same effect.
- This turns off the building of the C++ API. Setting the environment
variable CXX to null for configure will have the same effect.
- This turns of the V2 API. The V2 API is completely replaced with the
V3 API, but is usually built with netCDF for backwards compatibility,
and also because the C++ API depends on the V2 API. Setting this has
the effect of automatically turning of the CXX API, as if
–disable-cxx had also been specified.
- This turns off the building (and testing) of the netCDF utilities
ncgen and ncdump. This option is helpful when debugging library build
problems, but probably not of much use to the average user.
- This turns off the building (and testing) of everything except the
core netCDF-3 C library. This option is helpful when debugging library
build problems, but probably not of much use to the average user.
- Turn on tests for large files. These tests create files over 2 GB in
size, and need about 13 GB of free disk space to run. These files are
deleted after the test successfully completes. They will be created in
the netCDF nc_test directory, unless the –with-temp-large option is
used to specify another location (see below).
- Normally large files are not created during the netCDF build, but they
will be if –enable-large-file-tests is specified (see above). In that
case, this configure parameter can be used to specify a location to
create these large files, for example: –with-large-files=/tmp/ed.
- Normally the netCDF configure checks the F77 and F90 compilers with
small test programs to see if they work. This is very helpful in
supporting netCDF installations on different machines, but won't work
with cross-compilation. Use the –disable-fortran-compiler-check to
turn off the fortran compiler tests, and just assume that the
compilers will work.
- Normally configure checks the size of fortran types. This option turns
off those tests, and uses default values.
- Normally, if the netCDF configure finds a F90 compiler, and it fails
to build the test program described in –disable-f90-check, it will
print a warning, and then continue to build without the F90 API, as if
the user has specified –disable-f90. With the
–disable-compiler-recover option set, it will not continue, but will
just stop if the fortran 90 compiler doesn't work. This is useful for
automatic testing, where we want the tests to fail if something causes
the fortran compiler to break.
- Starting with version 3.6.2, netCDF comes with some examples in the
“examples” directory. By default, the examples are all built during
a “make check” unless the –disable-examples option is
provided. Note that the examples are not built for “make install”,
just for “make check”. As far as netCDF is concerned, the examples
are extra tests.
- This will cause the Fortran 77 and Fortran 90 APIs to be built into
their own separate library, instead of being included in the C
library. This is useful for supporting more than one fortran compiler
with the same netCDF C library. This is turned on by default for
shared library builds.
- In some netCDF test programs (nc_test.c and nf_test.F) there are tests
which use numbers at or just beyond the extreme number that can be
used for a type. (For example, using MAX_INT + 1 as an int type). This
causes problems on Solaris 386 systems. For that reason, the extreme
numbers are not used, by default, on Solaris 386 systems. This option
gives the user control to override the default. This affects only
netCDF test programs, not the netCDF library itself.
The configure script will examine your computer system – checking for
attributes that are relevant to building the netCDF package. It will
print to standard output the checks that it makes and the results that
The configure script will also create the file "config.log", which
will contain error messages from the utilities that the configure
script uses in examining the attributes of your system. Because such
an examination can result in errors, it is expected that "config.log"
will contain error messages. Therefore, such messages do not
necessarily indicate a problem (a better indicator would be failure of
the subsequent "make"). One exception, however, is an error message in
"config.log" that indicates that a compiler could not be started. This
indicates a severe problem in your compilation environment – one that
you must fix.