Added '--enable-dynamic-loading' to autotools-based builds, and

-DENABLE_DYNAMIC_LOADING to cmake-based builds.

This will allow for compatibility with hdf5 1.8.11 builds that
have enabled dynamic building (depends on libdl).

See Jira ticket NCF-258
This commit is contained in:
Ward Fisher 2013-06-10 21:48:11 +00:00
parent 3c7895add1
commit b4e198d163
6 changed files with 66 additions and 1 deletions

View File

@ -389,6 +389,11 @@ ENDIF()
# Option to Enable HDF5
OPTION (USE_SZIP "Use SZip" OFF)
OPTION (USE_HDF5 "Use HDF5." ${ENABLE_NETCDF_4})
OPTION (ENABLE_DYNAMIC_LOADING "Enable Dynamic Loading" OFF)
IF(ENABLE_DYNAMIC_LOADING)
SET(USE_LIBDL ON CACHE BOOL "")
ENDIF()
IF (USE_HDF5 OR ENABLE_NETCDF_4)
SET(USE_HDF5 ON)
SET(USE_NETCDF4 ON)
@ -410,6 +415,24 @@ IF (USE_HDF5 OR ENABLE_NETCDF_4)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
# Starting with hdf5 1.8.11, dynamic loading is an option.
# In case hdf5 has a dependency on libdl, the user must specify
# -DENABLE_DYNAMIC_LOADING=ON when configuring netcdf.
IF(USE_LIBDL)
FIND_LIBRARY(LIBDL NAMES dl dld)
FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)
IF(NOT LIBDL)
MESSAGE(ERROR "Cannot find libdl, but dynamic loading was specified.")
ENDIF()
IF(NOT LIBDL_INCLUDE_DIR)
MESSAGE(ERROR "Cannot find dlfcn.h, but dynamic loading was specified.")
ENDIF()
MESSAGE(STATUS "Found libdl: ${LIBDL}")
SET(HAVE_LIBDL ON)
INCLUDE_DIRECTORIES(${LIBDL_INCLUDE_DIR})
ENDIF()
#Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
IF(USE_SZIP)
FIND_PACKAGE(SZIP NO_MODULE)

View File

@ -6,6 +6,15 @@ https://www.unidata.ucar.edu/jira/browse/NCF-XXX .
VERSION COMMENTS
------- --------
4.3.1 Released TBD
Added support for dynamic loading, to compliment
the dynamic loading support introduced in hdf 1.8.11.
Dynamic loading support depends on libdl, and
is enabled as follows: [NCF-258]
o autotools-based builds: --enable-dynamic-loading
o cmake-based builds: -DENABLE_DYNAMIC_LOADING=ON
4.3 Released 2013-05-03
fsync: Changed default in autotools config

View File

@ -5,6 +5,14 @@ Releases are in reverse chronological order (most recent first). Recent
releases include references to Jira issue identifiers for more
information, where '[NCF-XXX]' refers to https://www.unidata.ucar.edu/jira/browse/NCF-XXX .
### 4.3.1 Released TBD
* Added support for dynamic loading, to compliment the dynamic loading support introduced in hdf 1.8.11. Dynamic loading support depends on libdl, and is enabled as follows: [NCF-258]
* autotools-based builds: --enable-dynamic-loading
* cmake-based builds: -DENABLE\_DYNAMIC\_LOADING=ON
[NCF-258]: https://www.unidata.ucar.edu/jira/browse/NCF-258
### 4.3.0 Released 2013-04-29
* fsync: Changed default in autotools config file; fsync must now be

View File

@ -73,6 +73,7 @@
#cmakedefine ENABLE_DAP_REMOTE_TESTS 1
#cmakedefine EXTRA_TESTS
#cmakedefine USE_NETCDF4 1
#cmakedefine USE_LIBDL 1
#cmakedefine USE_HDF4 1
#cmakedefine USE_HDF5 1
#cmakedefine USE_FFIO 1
@ -95,7 +96,8 @@
#cmakedefine HAVE_DOPRNT
#cmakedefine HAVE_ALLOCA
#cmakedefine HAVE_SSIZE_T 1
#cmakedefine HAVE_LIBPNETCDF
#cmakedefine HAVE_LIBPNETCDF 1
#cmakedefine HAVE_LIBDL 1
/* Define to 1 if you have the <alloca.h> header file. */
#cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@

View File

@ -113,6 +113,14 @@ if test "x$enable_netcdf_4" = "x" ; then
enable_netcdf_4="$enable_netcdf4"
fi
# Does the user require dynamic loading?
# This is only for those hdf5 installs that support it.
AC_MSG_CHECKING([do we require hdf5 dynamic-loading support])
AC_ARG_ENABLE([dynamic-loading], [AS_HELP_STRING([--enable-dynamic-loading],
[enable dynamic loading for use with supported hdf5 installs (libdl, HDF5 required)])])
test "x$enable_dynamic_loading" = xyes || enable_dynamic_loading=xno
AC_MSG_RESULT([$enable_dynamic_loading])
# Does the user want to turn on HDF4 read ability?
AC_MSG_CHECKING([whether reading of HDF4 SD files is to be enabled])
AC_ARG_ENABLE([hdf4], [AS_HELP_STRING([--enable-hdf4],
@ -705,6 +713,17 @@ if test "x$enable_netcdf_4" = xyes; then
AC_DEFINE([USE_SZIP], [1], [if true, compile in szip compression in netCDF-4 variables])
fi
# The user may have built HDF5 with libdl (dynamic loading support).
if test "x$enable_dynamic_loading" = xyes; then
AC_CHECK_HEADERS([dlfcn.h], [], [nc_dlfcn_h_missing=yes])
if test "x$nc_dlfcn_h_missing" = xyes; then
AC_MSG_ERROR([Cannot find dlfcn.h, yet --enable-dynamic-loading was used.])
fi
AC_CHECK_LIB([dl],[dlopen], [], [AC_MSG_ERROR([Can't find or link against libdf. See config.log for errors.])])
AC_DEFINE([USE_LIBDL],[1], [if true, enable dynamic loading support])
fi
# If the user wants hdf4 built in, check it out.
if test "x$enable_hdf4" = xyes; then
AC_CHECK_HEADERS([mfhdf.h], [], [nc_mfhdf_h_missing=yes])

View File

@ -44,6 +44,10 @@ SET(TLL_LIBS "")
SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
IF(HAVE_LIBDL)
SET(TLL_LIBS ${LIBDL} ${TLL_LIBS})
ENDIF()
IF(USE_HDF5 OR USE_NETCDF4)
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
ENDIF()