Ok. It looks like the NetCDF installed on the system have been compiled without the -fno-second-underscore option. So, if you want to install your own NetCDF for usage with gfortran, here are detailed instructions. The following commands will install NetCDF 3.6.3 under your HOME directory. I choosed version 3.6.3 instead of the more recent NetCDF 4 to avoid further complications. Unless you need the advanced functionalities of NetCDF 4, you can safely follow my choice.
1) First download the NetCDF source code (using wget from command line, or any ftp client with anonymous login)
2) Unpack the archive in your HOME directory and go the the directory containing the sources
tar zxvf netcdf-3.6.3.tar.gz -C $HOME
3) Set the build environment
export FFLAGS='-fno-second-underscore -g -O2'
export FCFLAGS='-fno-second-underscore -g -O2'
export CPP='gcc -E'
export CXXCPP='g++ -E'
4) Configure step. I suggest to install your own version of NetCDF under the same directory used for building. The installation step will create the proper bin/ lib/ and include/ subdirectories. Moreover you can enable the build of shared object
./configure --prefix=$HOME/netcdf-3.6.3 --enable-shared
5) If the step above is successful (you can check full output in config.log) do
6) Test the libraries before installation. Since the output of this step is very long and scrolls fast through the terminal, I suggest to save it in a file for further checking. For example, you can use tee to see the output on the terminal and save it in a file simultaneously. Then you can grep the file for words like "error", "fail", "warning", "pass".
make check 2>&1 | tee check.log
grep -i error check.log
grep -i fail check.log
grep -i warning check.log
grep -i passed check-log
7) If everything looks right you can perform the last step
Now you will have your include files in $HOME/netcdf-3.6.3/include and the libraries in $HOME/netcdf-3.6.3/lib. Set the proper location in your Makefile and the trick is done (hopefully)!