[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CLG-683234]: Question about checking nc_open from other package.



Hi Lily,

> If I want to install a software, which uses netcdf. When running
> ./configure, configure will automatically check existence of netcdf.
> Typically it will use 'AC_CHECK_LIB(netcdf, nc_open,,
> AC_MSG_ERROR([invalid netcdf object in netcdf-4]))' to test.
> 
> My question is that this statement always fails. I install netcdf
> library based on documentation and it works as other programs using
> netcdf are compilable.
> 
> Could you please help me solve this issue?

Make sure that before running configure you have set either LDLIBS or
LD_LIBRARY_PATH to include information about the directory in which
netCDF was installed.

Also, I've seen the following used in configure scripts to check for netCDF:

#
# Check for netcdf library
#
AC_MSG_CHECKING([whether NetCDF exists and contains nc_open])
AC_COMPILE_IFELSE(
                  [AC_LANG_PROGRAM([[ #include <netcdf.h> ]],
                                   [[ int id; nc_open("", NC_NOWRITE, &id) 
]])],ac_ncsupport=yes, ac_ncsupport=no, netcdf.h )
AC_MSG_RESULT($ac_ncsupport)

if test x$ac_ncsupport = xyes; then
  AC_CHECK_LIB(netcdf, nc_open, ac_ncsupport=yes, ac_ncsupport=no )
fi

AM_CONDITIONAL(ENABLE_NETCDF, test x$ac_ncsupport = xyes)
if test x$ac_ncsupport = xyes; then
  AC_DEFINE([ENABLE_NETCDF],[1],[Define to compile with NetCDF support])
fi

I'm no expert on autoconf, but perhaps there's something in the above
excerpt that's needed.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: CLG-683234
Department: Support netCDF
Priority: Normal
Status: Closed