Skip to content

Commit 4a7f5ae

Browse files
committed
Added check for H5Literate symbol (hdf5 1.8.x, 1.10.x) or macro (1.12.x)) in support of #1965
1 parent 094e2a4 commit 4a7f5ae

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@ IF(USE_HDF5)
775775
# Starting with libhdf5 1.12.0, we need to specify the option
776776
# `--with-default-api-version=v18` when configuring libhdf5. Otherwise,
777777
# the symbol H5Literate is not found. Check for this and return an error if it's not found.
778+
#
779+
# We first check for the symbol in the library, for versions 1.8.x and 1.10.x. If this fails,
780+
# we must then check for its usage as a macro (version 1.12.x).
778781
##
779782

780783
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Literate "" HAVE_H5Literate)
@@ -793,6 +796,10 @@ IF(USE_HDF5)
793796
MESSAGE(FATAL_ERROR "${HDF5_C_LIBRARY_hdf5} does not contain symbol '_H5Literate'. Please recompile your libhdf5 install using '--with-default-api-version=v18'.")
794797
ENDIF(NOT HAVE_H5Literate_Macro)
795798

799+
##
800+
# End H5Literate checks
801+
##
802+
796803
IF(HDF5_PARALLEL)
797804
SET(HDF5_CC h5pcc)
798805
ELSE()

configure.ac

+12-1
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,18 @@ if test "x$enable_hdf5" = xyes; then
12161216

12171217
# H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12.
12181218
# Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead.
1219-
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5resize_memory H5allocate_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops])
1219+
AC_CHECK_FUNCS([H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5resize_memory H5allocate_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops H5Literate])
1220+
1221+
# Check to see if HDF5 library has H5Literate (HDF5 1.8.x, 1.10.x)
1222+
if test "x$ac_cv_func_H5Literate" = xno; then
1223+
AC_MSG_CHECKING([for H5Literate macro])
1224+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "H5public.h"],
1225+
[[#if !(H5Literate_vers == 1)
1226+
# error
1227+
#endif]
1228+
])], [], [AC_MSG_RESULT(no); AC_MSG_ERROR([HDF5 was not built with API compatibility version v18. Please recompile your libhdf5 install using '--with-default-api-version=v18'.])])
1229+
AC_MSG_RESULT(yes)
1230+
fi
12201231

12211232
# Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
12221233
if test "x$ac_cv_func_H5Pset_all_coll_metadata_ops" = xyes; then

0 commit comments

Comments
 (0)