3.5 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
installation directory:
./configure --prefix=/whatever/you/decided --enable-netcdf-4 --with-hdf5=/home/ed/local
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
/whatever/you/decided/man.
The –enable-netcdf-4 option tells configure that you wish to build
the netCDF-4/HDF5 features. The –with-hdf4= argument tells configure
where HDF5 is installed. It must be version 1.8.0-beta2, and it must be
built with zlib, version 1.2.3.
There are other options for the configure script. The most useful ones
are listed below. Use the –help option to get the full list.
--prefix- 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.
--enable-netcdf-4- Turn on netCDF-4 features.
--with-hdf5=/location- Specify the location of the HDF5 library.
--with-zlib=/location- Specify the location of the zlib library. NetCDF-4 requires that HDF5
be built with zlib, for variable compression.
--with-szlib=/location- Specify the location of the szlib (a.k.a. szip) library. This is
optional, and netCDF-4 does not make use of the szlib, due to
licence issues. However, if HDF5 is build with szlib, then you must
provide the location of szlib when building netCDF-4.
--enable-shared- Build shared libraries (as well as static) on platforms which support
them.
--enable-docs-install- By default, the netCDF distribution will install man pages, but not
any other documentation.
The latest documentation is available on-line at the the netCDF
website. http://www.unidata.ucar.edu/software/netcdf. However, for users who cannot
always reach the web, all netCDF documentation is included in the
distribution in the “man” subdirectory, in PDF, HTML, postscript,
info, ASCII text, and other formats.
Using the –enable-docs-install causes “make install” to install the
netCDF documentation under $(prefix)/doc/netcdf-4.0.
–enable-docs-install 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.
--disable-flag-setting- 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).
--disable-largefile- This omits OS support for large files (i.e. files larger than 2 GB).
--disable-f77- 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.
--disable-f90- This turns off the building of the F90 API. Setting the environment
variable F90 to null for configure will have the same effect.
--disable-cxx- This turns off the building of the C++ API. Setting the environment
variable CXX to null for configure will have the same effect.
--disable-v2- 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.
--enable-large-file-tests- 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).
--enable-benchmarks- Turn on tests of the speed of various netCDF operations. Some of these
operations take a long time to run (minutes, on a reasonable
workstation).
--with-temp-large- 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.
--disable-fortran-compiler-check- 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.
--disable-compiler-recover- 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.
--disable-examples- 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.
--enable-separate-fortran- 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.
--enable-extra-tests- During the beta release phase, this option may turn on tests which are
known to fail (i.e. bugs that we are currently working to fix).
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
it finds.
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.