This website proved extremely helpful in setting upNetCDF on my RHEL6 
system.
http://www.unidata.ucar.edu/software/netcdf/docs/build_default.html
I saw those HDF errors as well, make sure you have all the correct flags 
defined.  Here's what worked for me in my .bashrc:
# ENV VAR for intel and netcdf install
source /usr/local/intel/bin/compilervars.sh intel64
export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=ifort
export FC=ifort
export F90=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export FCFLAGS=-64
export CPP='icc -E'
export CXXCPP='icpc -E'
export CPPFLAGS='-I/usr/include -I/usr/include/hdf'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'/usr/lib64 
/usr/local/intel/composer_xe_2013_sp1.1.106/compiler/lib/intel64 
/usr/lib64/hdf /usr/local/netcdf-4.3.1/lib'
Hope that helps
Steve
On 03/04/2014 01:06 PM, Doll, Margaret Ann wrote:
I have a ROCKS cluster running Centos 5.
I am building my applications with the prefix of /share/apps.  My 
ultimate goal is to build GMT which requires netcdf with hdf5.
I have installed hdf5-1.8.12 and zlig-1.2.8
I am trying to install netcdf-4.3.1.1
I used the following to try to configure netcdf
CFLAGS=-I/share/apps/include CPPFLAGS=-I/share/apps/include 
LDFLAGS=-L/share/apps/lib ./configure --prefix=/share/apps
*The compilation fails with*
checking for library containing deflate... none required
checking for floor in -lm... yes
checking for library containing H5Fflush... -lhdf5
checking for library containing H5DSis_scale... -lhdf5_hl
checking /share/apps/include/hdf5.h usability... no
checking /share/apps/include/hdf5.h presence... no
checking for /share/apps/include/hdf5.h... no
configure: error: Compiling a test with HDF5 failed.  Either hdf5.h 
cannot be found, or config.log should be checked for other reason.
*hdf5.h is in /share/apps/include*
ls /share/apps/include
curl                   h5ds.mod H5FDsec2.h             
h5lt.mod             H5Spublic.h
deal.II                H5DSpublic.h H5FDstdio.h            
H5LTpublic.h         h5tb.mod
fftw3.f                h5e.mod h5f.mod                
H5MMpublic.h         H5TBpublic.h
fftw3.f03              h5e_provisional.mod h5fortran_types.mod    
h5o.mod              h5t.mod
fftw3.h                H5Epubgen.h h5f_provisional.mod    
h5o_provisional.mod h5t_provisional.mod
fftw3l.f03             H5Epublic.h H5Fpublic.h            
H5Opublic.h          H5Tpublic.h
fftw3q.f03             H5f90i_gen.h h5global.mod           
H5overflow.h         H5version.h
H5ACpublic.h           H5f90i.h h5g.mod                
H5PLextern.h         h5z.mod
h5a.mod                H5FDcore.h H5Gpublic.h            
h5p.mod              H5Zpublic.h
H5api_adpt.h           H5FDdirect.h h5im.mod               
h5p_provisional.mod  hdf5dll.dll
h5a_provisional.mod    H5FDfamily.h h5i.mod                
H5Ppublic.h          hdf5.h
H5Apublic.h            H5FDlog.h H5IMpublic.h           
H5PTpublic.h         hdf5_hl.h
H5Cpublic.h            H5FDmpi.h H5Ipublic.h            
H5pubconf.h          hdf5.mod
h5_dble_interface.mod  H5FDmpio.h h5lib.mod              
H5public.h           netcdf.h
h5d.mod                h5fdmpio.mod h5lib_provisional.mod  
h5r.mod              zconf.h
H5DOpublic.h           H5FDmpiposix.h h5l.mod                
h5r_provisional.mod  zlib.h
h5d_provisional.mod    H5FDmulti.h h5l_provisional.mod    H5Rpublic.h
H5Dpublic.h            H5FDpublic.h H5Lpublic.h            h5s.mod
*From the config.log:*
#define USE_NETCDF4 1
| #define H5_USE_16_API 1
| /* end confdefs.h.  */
#include </share/apps/include/hdf5.h>
configure:16470: result: no
configure:16470: checking for /share/apps/include/hdf5.h
configure:16470: result: no
configure:16477: error: Compiling a test with HDF5 failed. Either 
hdf5.h cannot be found, or config.log should be checked for other reason.
*
*
*The lines in configure which are indicated as the problem:*
   for ac_header in hdf5.h
do :
  ac_fn_c_check_header_mongrel "$LINENO" "/share/apps/include/hdf5.h" 
"ac_cv_header_hdf5_h" "$ac_includes_default"
if test "x$ac_cv_header_hdf5_h" = xyes; then :
  cat >>confdefs.h <<_ACEOF
#define HAVE_HDF5_H 1
_ACEOF
else
  as_fn_error $? "Compiling a test with HDF5 failed.  Either hdf5.h 
cannot be found, or config.log should be checked for other reason." 
"$LINENO" 5
fi
_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit:http://www.unidata.ucar.edu/mailing_lists/  
--
Steve Hart
Systems Administrator
Colorado Center for Astrodynamics Research
University of Colorado Boulder
Steven.Hart@xxxxxxxxxxxx
(303)492-8109