Previous: Compiler Flags, Up: Using


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