----------------------------------------------------------------
Using the nc-config Utility to Find Compiler and Linker Flags
----------------------------------------------------------------
To assist with the setting of compiler and linker flags, the nc-config utility is provided with netCDF. The nc-config utility is a very simple script which contains the settings of the C and Fortran flags used during the netCDF build.
For example, the nc-config command can be used to get the command line options needed to link a C program to netCDF:
nc-config --libs
-L/usr/local/lib -lnetcdf -L/shecky/local_post/lib -lhdf5_hl -lhdf5 -lz
The nc-config utility can also be used to learn about the features of the current netCDF installation. For example, it can show whether netCDF-4 is available:
./nc-config --has-nc4
yes
Use the –help option to nc-config for a full list of available information.
----------------------
1. Usage of nc-config
----------------------
[dxu@goesrgnrx bin]$ ./nc-config -h
unknown option: -h
Usage: nc-config [OPTION]
Available values for OPTION include:
--help display this help message and exit
--all display all options
--cc C compiler
--cxx C++ compiler
--fc Fortran compiler
--cflags pre-processor and compiler flags
--fflags flags needed to compile a Fortran program
--has-dap whether OPeNDAP is enabled in this build
--has-nc2 whether NetCDF-2 API is enabled
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
--has-hdf5 same as --has-nc4
--has-f77 whether Fortran 77 API is enabled in this build
--has-f90 whether Fortran 90 API is enabled in this build
--has-c++ whether C++ API is enabled in this build
--libs library linking information for netcdf
--flibs libraries needed to link a Fortran program
--prefix Install prefix
--version Library version
----------------------------------------------
2. Show library linking information for netcdf
----------------------------------------------
[dxu@goesrgnrx bin]$ nc-config --libs
-L/psd14/linux/arongone/rpmbuilds/netcdf/netcdf-4.0.1-1_aer.el5-root/opt/GOESR/local/lib -lnetcdf -L/usr/lib64 -lhdf5_hl -lhdf5 -L/usr/lib64 -lz
No comments:
Post a Comment