detecting and using hdf compiled with -DHAVE_NETCDF
Patrice Dumas
pertusus at FREE.FR
Fri Feb 17 10:43:32 EST 2006
> linked with the Unidata library, one got Unidata NetCDF output, which either
> library set could read. If one linked with NCSA's HDF libraries, one
> got HDF-SDS output, which only NCSA's HDF libraries could read. This
> is the distinction that justified gradsnc and gradshdf as separate
> executables.
I didn't said that there should be only one executable. The issue is with
gradshdf only. When I try to link with hdf, when the hdf libs were
compiled with -DHAVE_NETCDF, I get undefined symbols for all the netcdf
2 symbols (ncopen, ncclose and so on). That's because when hdf is compiled
with -DHAVE_NETCDF, it defines symbols with sd_ prepended. I think that it
would be nice if gradshdf was able to use both variants of the hdf
library. It is just a request, maybe this is not something wanted.
To illustrate the kind of changes I have in mind, I can describe the solution
I implement in the fedora rpm. On the next fedora release, fedora
core 5, hdf will be compiled with -DHAVE_NETCDF. This is a simple solution.
I have modified configure.in around the hdf detection:
========================================================================
AH_BOTTOM([
#ifdef HDF_SD_NETCDF
#include "gawrapsd.h"
#endif
])
use_hdf=no
if test "$with_hdf" != "no" ; then
GA_CHECK_HDF([use_hdf=yes])
fi
if test $use_hdf = "yes" ; then
GA_SET_LIB_VAR(hdf_libs, [mfhdf df jpeg udunits z])
if test "${ga_dyn_supplibs}" = "yes"; then
ac_save_LIBS="$LIBS"
LIBS="$LIBS $hdf_libs"
AC_CHECK_FUNC([sd_ncopen],
[AC_DEFINE([HDF_SD_NETCDF],[],[prepend sd_ to netcdf symbols])])
LIBS="$ac_save_LIBS"
fi
AC_SUBST(hdf_libs)
extra_bins="$extra_bins gradshdf"
echo "+ gradshdf (HDF-SDS/netCDF) build enabled"
else
echo "- gradshdf (HDF-SDS/netCDF) build disabled"
fi
echo
===================================================================
And I have added, in src a file that I called gawrapsd.h:
#if USEHDF == 1
#define ncopen sd_ncopen
#define ncvarinq sd_ncvarinq
#define ncopts sd_ncopts
#define ncvarid sd_ncvarid
#define ncattinq sd_ncattinq
#define ncvarget sd_ncvarget
#define ncattget sd_ncattget
#define ncclose sd_ncclose
#define ncinquire sd_ncinquire
#define ncattname sd_ncattname
#define nctypelen sd_nctypelen
#define ncdiminq sd_ncdiminq
#endif
But I am not sure that it is the right solution, as those define propagate
to all the include files. So I propposed 2 other solutions in my previous
mail, such that I can make a patch. I ask because I would like to avoid
implementing a solution that will be rejected later.
It is also possible to disregard completely that issue in the grads sources,
and I have no problem with that, in that case I'll only change things in the
rpm. Indeed using hdf compiled with -DHAVE_NETCDF could be considered to be
unsupported.
I am just proposing my help to solve that issue, I know that in the end
COLA people are the maintainers.
--
Pat
More information about the gradsusr
mailing list