Unidata/netcdf-fortran — pull request #22 by quantheory (2014-09-04 23:56:30+00:00)
Title: Changes to fix compilation with the NAG Fortran compiler.

I compiled netcdf-fortran with nagfor 6.0 today, and ran into a few minor hitches, which are partially addressed by these patches.

The NAG compiler does not accept passing scalars to (non-elemental) functions that take arrays, and by default its "kind" numbers have nothing to do with the byte count, so one always has to use the output of functions like "selected_int_kind" to get kind numbers. These were the two things that had to be fixed to get "make check" to pass.

Note that there were a few other changes necessary, which are not addressed by this patch, because they don't represent a problem with netcdf-fortran itself:

1. I built with the autotools system, and I had to patch the generated libtool script to build shared libraries and to get linking to work with -openmp. This is really a limitation of autotools, but it's probably easier to deal with using the CMake system; I haven't tried that yet.
2. I needed two additional flags:
* **-I${SOURCEDIR}/fortran/**
* This is necessary for out-of-source builds because nagfor by default only includes the current working directory, not the directory containing the source file with the "include" statement. Again, the fact that this isn't handled for nagfor is probably an autotools limitation, which may be easier to work around (or work by default) with CMake.
* **-wmismatch=nf_def_var,nf_def_var_fill,nf_inq_var_fill,ncagt,ncapt,ncvgt,ncvpt,ncvgt1,ncvpt1**
* This is necessary because these functions are intended to work for inputs of different TKR, but Fortran doesn't allow this (well, until the 2012 TS for C interoperability, but that's not widely implemented).