[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_LANG_PROGRAM([[ #include <netcdf.h> ]],
                                   [[ int id; nc_open("", NC_NOWRITE, &id) 
]])],ac_ncsupport=yes, ac_ncsupport=no, netcdf.h )

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

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])

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


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

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.