Skip to content

Commit

Permalink
now check for netcdf-c disptach version in autoconf and cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 7, 2020
1 parent f66d558 commit 8a298dc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,16 @@ if (HAVE_472)
message (FATAL_ERROR "PIO cannot build with netcdf-c-4.7.2, please upgrade your netCDF library")
endif ()

###
# Check to see if dispatch table version 2 is supported for netcdf integration.
###
CHECK_C_SOURCE_COMPILES("
#include <netcdf_meta.h>
#if NC_DISPATCH_VERSION != 2
choke me
#endif
int main() {return 0;}" HAVE_DISPATCH2)

#####
# Configure and print the libpio.settings file.
#####
Expand Down
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,19 @@ if test "x$have_472" = xyes; then
AC_MSG_ERROR([PIO cannot build with netcdf-c-4.7.2, please upgrade your netCDF version.])
fi

# Do we have the correct dispatch table version in netcdf-c for netcdf
# integration?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
[[#if NC_DISPATCH_VERSION != 2
# error
#endif]
])], [have_dispatch2=yes], [have_dispatch2=no])
AC_MSG_CHECKING([whether netcdf-c supports version 2 of dispatch table for netcdf integration])
AC_MSG_RESULT([${have_dispatch2}])
if test "x$enable_netcdf_integration" = xyes -a "x$have_dispatch2" = xno; then
AC_MSG_ERROR([NetCDF integration cannot be used with this version of netcdf-c, please upgrade your netCDF version.])
fi

# Set some build settings for when netcdf-4 is supported.
if test x$have_netcdf_par = xyes; then
AC_DEFINE([_NETCDF4],[1],[Does netCDF library provide netCDF-4 with parallel access])
Expand Down

0 comments on commit 8a298dc

Please sign in to comment.