The build and installation process performed using autoconf, a package that produces shell scripts to automatically configure software source code packages. Autoconf checks the system for available compilers and sets the flags accordingly.
Compilers
The autoconf package checks the system for which compilers are available and sets the flags accordingly, unless you explicitly tell it the ones to use. When compiling MET and all the dependent libraries, we need to use the same family of compilers. Set the following variables to specify which compilers should be used:
- Set CC to the full path for your C compiler.
- Set CXX to the full path for your C++ compiler (recommend GNU g++, PGI pgc++, or Intel icc).
- Set FC77 to the full path for your Fortran 90 compiler (recommend GNU gfortran, PGI pgf90, or Intel ifort).
Run the following command to see the full set of compiler and linker options available:
Set Environment Variables
The MET build process uses environment variables to specify the locations of the needed external libraries. For each library, there is a set of three environment variables to describe the locations: $MET_<lib>, $MET_<inc>INC, and $MET_<lib>LIB.
The $MET_<lib> environment variable can be used if the external library is installed such that there is a main directory which has a subdirectory called "lib" containing the library files and another subdirectory called "include" containing the include files. For example, if the NetCDF library files are installed in /opt/netcdf/lib and the include files are in /opt/netcdf/include, you can just define the $MET_NETCDF environment variable to be "/opt/netcdf".
The $MET_<inc>INC and $MET_<lib>LIB environment variables are used if the library and include files for an external library are installed in separate locations. In this case, both environment variables must be specified and the associated $MET_<lib>variable will be ignored. For example, if the NetCDF include files are installed in /opt/include/netcdf and the library files are in /opt/lib/netcdf, then you would set $MET_NETCDFINC to "/opt/include/netcdf" and $MET_NETCDFLIB to "/opt/lib/netcdf".
The following environment variables should also be set:
For ease of use, you should define these in your .cshrc or equivalent file.
- Set $MET_NETCDF to point to the main NetCDF directory (e.g. /usr/local/netcdf-4.3.0), or set $MET_NETCDFINC to point to the directory with the NetCDF include files (e.g. /usr/local/netcdf-4.3.0/include) and set $MET_NETCDFLIB to point to the directory with the NetCDF library files (e.g. /usr/local/netcdf-4.3.0/lib).
- Set $MET_HDF5 to point to the main HDF5 directory.
- Set $MET_BUFR to point to the main BUFR directory, or set $MET_BUFRLIB to point to the directory with the BUFR library files. Because MET doesn't use any BUFR library include files, you don't need to specify $MET_BUFRINC.
- Set $MET_GSL to point to the main GSL directory, or set $MET_GSLINC to point to the directory with the GSL include files and set $MET_GSLLIB to point to the directory with the GSL library files.
- If compiling support for GRIB2, set $MET_GRIB2CINC and $MET_GRIB2CLIB to point to the main GRIB2C directory which contains both the include and library files. These are used instead of $MET_GRIB2C since the main GRIB2C directory does not contain include and lib subdirectories.
- If compiling MODIS-Regrid, set $MET_HDF to point to the main HDF directory, or set $MET_HDFINC to point to the directory with the HDF include files and set $MET_HDFLIB to point to the directory with the HDF library files. Also, set $MET_HDFEOSINC to point to the directory with the HDF EOS include files and set $MET_HDFEOSLIB to point to the directory with the HDF EOS library files.
- If compiling MODE-Graphics, set $MET_CAIRO to point to the main Cairo directory, or set $MET_CAIROINC to point to the directory with the Cairo include files and set $MET_CAIROLIB to point to the directory with the Cairo library files. Also, set $MET_FREETYPE to point to the main FreeType directory, or set $MET_FREETYPEINC to point to the directory with the FreeType include files and set $MET_FREETYPELIB to point to the directory with the FreeType library files. If ft2build.h and freetype.h are not in $MET_FREETYPE/include directory, please set $MET_FREETYPEINC and $MET_FREETYPELIB (In case of FreeType 2.6 and 2.7, the header files are at $MET_FREETYPE/include/freetype2 directory).
- When running MODE-Graphics, set $MET_FONT_DIR to the directory containing font data required at runtime. Download and unpack the tarball and set $MET_FONT_DIR to the full path of the fonts directory.
- If compiling support for Python embedding, set $MET_PYTHON_CC and $MET_PYTHON_LD to specify the compiler (-I) and the linker (-L) flags required for Python. Set $MET_PYTHON_CC to the directory containing the "Python.h" header file. Set $MET_PYTHON_LD to the directory containing the Python library file and indicate the name of that file. For example:
Configuration
Configure the installation for your system using the configure script. The configure script has command line options to specify where to install MET and which MET utilities to install. Include any of the following options that apply to your system:
The remainder of this tutorial assumes that you have installed MET in the top-level met-8.0 directory. To configure MET to install all of the available tools in the bin subdirectory of your current directory, use the following command:
- MET_PYTHON_CC= '-I/usr/include/python2.7'
- MET_PYTHON_LD='-L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7'
- These values can often be found by running "python-config --cflags" to get the value for MET_PYTHON_CC and by running "python-config --ldflags" to get the value for MET_PYTHON_LD.
- --prefix=PREFIX By default, MET will install all the executables in /usr/local/bin. You can specify an installation prefix other than /usr/local using --prefix. For example, --prefix=$HOME to install to your home directory or --prefix=`pwd` to install to the current directory.
- --enable-grib2 Enable compilation of utilities using GRIB2.
- --enable-lidar2nc Enable compilation of utilities using lidar2nc.
- --enable-modis Enable compilation of modis_regrid.
- --enable-mode_graphics Enable compilation of mode_graphics.
- --enable-python Enable Python embedding.
- --disable-ascii2nc Disable compilation of ascii2nc.
- --disable-ensemble_stat Disable compilation of ensemble_stat.
- --disable-gen_poly_mask Disable compilation of gen_poly_mask.
- --disable-gen_circle_mask Disable compilation of gen_circle_mask.
- --disable-grid_stat Disable compilation of grid_stat.
- --disable-madis2nc Disable compilation of madis2nc.
- --disable-mode Disable compilation of mode.
- --disable-mode_analysis Disable compilation of mode_analysis.
- --disable-pb2nc Disable compilation of pb2nc.
- --disable-pcp_combine Disable compilation of pcp_combine.
- --disable-plot_data_plane Disable compilation of plot_data_plane.
- --disable-plot_point_obs Disable compilation of plot_point_obs.
- --disable-point_stat Disable compilation of point_stat.
- --disable-stat_analysis Disable compilation of stat_analysis.
- --disable-wavelet_stat Disable compilation of wavelet_stat.
- --disable-series_analysis Disable compilation of series_analysis.
- --disable-wwmca Disable compilation of wwmca_plot and wwmca_regrid.
- --disable-tc_utils Disable compilation of the tropical cyclone tools: tc_dland, tc_pairs, and tc_stat.
- --disable-block4 Disable use of BLOCK4 in the compilation. Use this if you have trouble using PrepBufr files.