Re: Customising CPP flags to match Fortran flags

Ed Hartnett wrote:
If you set FFLAGS, FCFLAGS, and F90FLAGS to the flags you want, before
running the netCDF configure, that should work. Doesn't it?
No. Configure does the relevant test and gets the right answer...

  checking for C-equivalent to Fortran routine "SUB"... SUB

...but symbols in libnetcdf.a follow the f2cFortran convention, i.e. lower case with 2 underscores. (And if I set CPPFLAGS=-DpgiFortran the symbols follow that convention, lower case with 1 underscore.)

I'm unclear about how the result of the configure test is supposed to affect the build system. My experience suggests that it doesn't.

Make sure you do a make distclean first when changing the flags!
Yes. I usually delete all files and unpack from source again just to be sure.

I've found a successful workaround:

Unpack and configure:

CC=gcc FC=g95 CPPFLAGS=-DpgiFortran FFLAGS="-fno-underscoring -fcase-upper" ./configure --disable-f90 --disable-cxx

Edit cfortran.h, changing line 198 to

#define fcallsc(UN,LN)               UN

Run make, make check & make install as usual.

NB1: I didn't bother with FCFLAGS and F90FLAGS 'cause I don't need f90.
NB2: I don't need cxx either.
NB3: I explicitly specifed pgiFortran to disable the big block of special-case code for f2cFortran near the end of ncfortran.h.

I'm happy with this, but still interested in a more elegant method, of course.

--
Mark Hadfield          "Ka puwaha te tai nei, Hoea tahi tatou"
m.hadfield@xxxxxxxxxx
National Institute for Water and Atmospheric Research (NIWA)



==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================