diff options
284 files changed, 23382 insertions, 7465 deletions
diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS index 5705727..f1b5b45 100644 --- a/ACKNOWLEDGMENTS +++ b/ACKNOWLEDGMENTS @@ -1,9 +1,12 @@ -Acknowledgments - June 2010 ---------------------------- +Acknowledgments - November 2010 +------------------------------- We would like to thank the following people who have contributed directly or indirectly to HDF5: +Werner Benger, for contributing code used to add support for the Windows +Threading library included in the 1.8.6 release. + John A. Biddiscombe, Mike Jackson, and Sean McBride for contributing and testing CMake code included in the HDF5 1.8.5 distribution. diff --git a/CMakeLists.txt b/CMakeLists.txt index 553826c..cda2dad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,8 @@ PROJECT (HDF5 C CXX) # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. # -# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR : -# Customize the 'bin', 'lib', and 'include' installation directories. +# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR, HDF5_INSTALL_DATA_DIR : +# Customize the 'bin', 'lib', 'include', and 'share' installation directories. # # HDF5_INSTALL_NO_DEVELOPMENT : # Set to true to skip installation of headers and CMake package files. @@ -69,6 +69,11 @@ PROJECT (HDF5 C CXX) # # Add the sub project # ADD_SUBDIRECTORY(Utilities/hdf5-1.8) #----------------------------------------------------------------------------- +IF (BUILD_SHARED_LIBS) + SET (BUILD_NAME_EXT "SHARED") +ELSE (BUILD_SHARED_LIBS) + SET (BUILD_NAME_EXT "STATIC") +ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Set the core names of all the libraries @@ -132,9 +137,6 @@ SET (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools) SET (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/perform) SET (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran) -# set default prefix location -SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories") - IF (NOT HDF5_INSTALL_BIN_DIR) SET (HDF5_INSTALL_BIN_DIR bin) ENDIF (NOT HDF5_INSTALL_BIN_DIR) @@ -144,6 +146,9 @@ ENDIF (NOT HDF5_INSTALL_LIB_DIR) IF (NOT HDF5_INSTALL_INCLUDE_DIR) SET (HDF5_INSTALL_INCLUDE_DIR include) ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR) +IF (NOT HDF5_INSTALL_DATA_DIR) + SET (HDF5_INSTALL_DATA_DIR share) +ENDIF (NOT HDF5_INSTALL_DATA_DIR) #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO @@ -165,7 +170,8 @@ SET (HDF5_PACKAGE_NAME "HDF5") SET (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}") SET (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") SET (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") -SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") SET (HDF5_PACKAGE_TARNAME "hdf5") SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org") SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") @@ -234,35 +240,12 @@ SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) SET (H5_BUILT_AS_DYNAMIC_LIB 1) - IF (MSVC) - SET (CMAKE_MFC_FLAG 0) - FOREACH (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - IF (${flag_var} MATCHES "/MT") - STRING (REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") - ENDIF (${flag_var} MATCHES "/MT") - ENDFOREACH (flag_var) - ENDIF (MSVC) ELSE (BUILD_SHARED_LIBS) + SET (H5_BUILT_AS_STATIC_LIB 1) IF (NOT WIN32) # should this be a user setting : Everyone uses it anyway ? ADD_DEFINITIONS (-DPIC) ENDIF (NOT WIN32) - IF (MSVC) - SET (CMAKE_MFC_FLAG 0) - FOREACH (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - IF (${flag_var} MATCHES "/MD") - STRING (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - ENDIF (${flag_var} MATCHES "/MD") - ENDFOREACH (flag_var) - ENDIF (MSVC) ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- @@ -270,12 +253,30 @@ ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- OPTION (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF) IF (HDF5_ENABLE_COVERAGE) - SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") - SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") + SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") ENDIF (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- +# Option to indicate using a memory checker +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) +IF (HDF5_ENABLE_USING_MEMCHECKER) + SET (H5_USING_MEMCHECKER 1) +ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + +#----------------------------------------------------------------------------- +# Option to use deprecated public API symbols +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) +IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + SET (H5_NO_DEPRECATED_SYMBOLS 0) +ELSE (HDF5_ENABLE_DEPRECATED_SYMBOLS) + SET (H5_NO_DEPRECATED_SYMBOLS 1) +ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + +#----------------------------------------------------------------------------- # When building utility executables that generate other (source) files : # we make use of the following variables defined in the root CMakeLists. # Certain systems may add /Debug or /Release to output paths @@ -290,6 +291,10 @@ IF (WIN32) ENDIF (NOT CYGWIN) ENDIF (WIN32) +IF (MSVC) + SET (CMAKE_MFC_FLAG 0) +ENDIF (MSVC) + SET (MAKE_SYSTEM) IF (CMAKE_BUILD_TOOL MATCHES "make") SET (MAKE_SYSTEM 1) @@ -390,8 +395,7 @@ IF (HDF5_ENABLE_PARALLEL) SET (H5_HAVE_PARALLEL 1) # MPI checks, only do these if MPI_FOUND is true, otherwise they always fail # and once set, they are cached as false and not regenerated - SET (CMAKE_REQUIRED_INCLUDES "${MPI_INCLUDE_PATH}/mpi.h" ) - SET (CMAKE_REQUIRED_LIBRARIES "${MPI_LIBRARY}" ) + SET (CMAKE_REQUIRED_LIBRARIES "${MPI_LIBRARY};${MPI_EXTRA_LIBRARY}" ) CHECK_FUNCTION_EXISTS (MPI_File_get_size H5_HAVE_MPI_GET_SIZE) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) @@ -437,6 +441,19 @@ HDF5_SETUP_FILTERS (SCALEOFFSET) INCLUDE (ExternalProject) OPTION (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO") +OPTION (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0) +OPTION (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0) +IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + SET (ZLIB_USE_EXTERNAL 1) + SET (SZIP_USE_EXTERNAL 1) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (NOT TGZ_PATH) + SET (TGZ_PATH ${HDF5_SOURCE_DIR}) + ENDIF (NOT TGZ_PATH) + SET (ZLIB_TGZ_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME}) + SET (SZIP_TGZ_URL ${TGZ_PATH}/${SZIP_TGZ_NAME}) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") +ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") #----------------------------------------------------------------------------- # Option for ZLib support @@ -444,31 +461,60 @@ OPTION (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO") OPTION (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF) IF (HDF5_ENABLE_Z_LIB_SUPPORT) IF (NOT H5_ZLIB_HEADER) - FIND_PACKAGE (ZLIB) + IF (NOT ZLIB_USE_EXTERNAL) + FIND_PACKAGE (ZLIB) + ENDIF (NOT ZLIB_USE_EXTERNAL) IF (ZLIB_FOUND) SET (H5_HAVE_FILTER_DEFLATE 1) SET (H5_HAVE_ZLIB_H 1) SET (H5_HAVE_LIBZ 1) SET (H5_ZLIB_HEADER "zlib.h") + SET (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) ELSE (ZLIB_FOUND) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - EXTERNALPROJECT_ADD (ZLIB - SVN_REPOSITORY http://svn.hdfgroup.uiuc.edu/zlib/trunk - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + EXTERNALPROJECT_ADD (ZLIB + SVN_REPOSITORY ${ZLIB_SVN_URL} + # [SVN_REVISION rev] + INSTALL_COMMAND "" + CMAKE_ARGS + -DBLDTYPE:STRING=Release + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + EXTERNALPROJECT_ADD (ZLIB + #LOG_DOWNLOAD 1 + URL ${ZLIB_TGZ_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBLDTYPE:STRING=Release + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR) IF (BUILD_SHARED_LIBS) - SET (ZLIB_LIBRARY - "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib1${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) + IF (WIN32 AND NOT MINGW) + SET (ZLIB_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib1${CMAKE_IMPORT_LIBRARY_SUFFIX}" + ) + ELSE (WIN32 AND NOT MINGW) + SET (ZLIB_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + ENDIF (WIN32 AND NOT MINGW) ELSE (BUILD_SHARED_LIBS) - SET (ZLIB_LIBRARY - "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libzlib${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + IF (WIN32 AND NOT MINGW) + SET (ZLIB_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/zlib${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + ELSE (WIN32 AND NOT MINGW) + SET (ZLIB_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libz${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + ENDIF (WIN32 AND NOT MINGW) ENDIF (BUILD_SHARED_LIBS) SET (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}" @@ -483,9 +529,10 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT) SET (H5_HAVE_FILTER_DEFLATE 1) SET (H5_HAVE_ZLIB_H 1) SET (H5_HAVE_LIBZ 1) - ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + MESSAGE (STATUS "Filter ZLIB is built") + ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") MESSAGE (FATAL " ZLib is Required for ZLib support in HDF5") - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ENDIF (ZLIB_FOUND) ELSE (NOT H5_ZLIB_HEADER) # This project is being called from within another and ZLib is already configured @@ -505,32 +552,56 @@ SET (CMAKE_MODULE_PATH ${HDF5_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) OPTION (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) IF (HDF5_ENABLE_SZIP_SUPPORT) OPTION (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) - FIND_PACKAGE (SZIP) + IF (NOT SZIP_USE_EXTERNAL) + FIND_PACKAGE (SZIP) + ENDIF (NOT SZIP_USE_EXTERNAL) IF (SZIP_FOUND) SET (H5_HAVE_FILTER_SZIP 1) SET (H5_HAVE_SZLIB_H 1) SET (H5_HAVE_LIBSZ 1) + SET (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) ELSE (SZIP_FOUND) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - EXTERNALPROJECT_ADD (SZIP - SVN_REPOSITORY http://svn.hdfgroup.uiuc.edu/szip/trunk - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} - ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + EXTERNALPROJECT_ADD (SZIP + SVN_REPOSITORY ${SZIP_SVN_URL} + # [SVN_REVISION rev] + INSTALL_COMMAND "" + CMAKE_ARGS + -DBLDTYPE:STRING=Release + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + EXTERNALPROJECT_ADD (SZIP + #LOG_DOWNLOAD 1 + URL ${SZIP_TGZ_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBLDTYPE:STRING=Release + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR) IF (BUILD_SHARED_LIBS) - SET (SZIP_LIBRARY - "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) + IF (WIN32 AND NOT MINGW) + SET (SZIP_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${CMAKE_IMPORT_LIBRARY_SUFFIX}" + ) + ELSE (WIN32 AND NOT MINGW) + SET (SZIP_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}szip${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + ENDIF (WIN32 AND NOT MINGW) ELSE (BUILD_SHARED_LIBS) - SET (SZIP_LIBRARY - "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libszip${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + SET (SZIP_LIBRARY + "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libszip${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) ENDIF (BUILD_SHARED_LIBS) SET (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}" @@ -545,9 +616,10 @@ IF (HDF5_ENABLE_SZIP_SUPPORT) SET (H5_HAVE_FILTER_SZIP 1) SET (H5_HAVE_SZLIB_H 1) SET (H5_HAVE_LIBSZ 1) - ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + MESSAGE (STATUS "Filter SZIP is built") + ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") MESSAGE (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ENDIF (SZIP_FOUND) SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) @@ -560,11 +632,53 @@ ENDIF (HDF5_ENABLE_SZIP_SUPPORT) #----------------------------------------------------------------------------- # Option for external libraries on windows #----------------------------------------------------------------------------- +OPTION (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) +IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_HEADER_LIST "") + SET (EXTERNAL_LIBRARY_LIST "") + SET (EXTERNAL_LIBRARYDLL_LIST "") + FILE (MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BLDTYPE}) + + IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + ADD_CUSTOM_TARGET (ZLIB-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) + ADD_CUSTOM_TARGET (ZLIB-Library-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_LIBRARY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_LIBRARY} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + GET_FILENAME_COMPONENT(ZLIB_LIB_NAME ${ZLIB_LIBRARY} NAME) + SET (EXTERNAL_LIBRARY_LIST ${EXTERNAL_LIBRARY_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (ZLIB-GenHeader-Copy ZLIB) + ADD_DEPENDENCIES (ZLIB-Library-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + + IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + ADD_CUSTOM_TARGET (SZIP-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) + ADD_CUSTOM_TARGET (SZIP-Library-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_LIBRARY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_LIBRARY} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + GET_FILENAME_COMPONENT(SZIP_LIB_NAME ${SZIP_LIBRARY} NAME) + SET (EXTERNAL_LIBRARY_LIST ${EXTERNAL_LIBRARY_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (SZIP-GenHeader-Copy SZIP) + ADD_DEPENDENCIES (SZIP-Library-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) +ENDIF (HDF5_PACKAGE_EXTLIBS) + IF (WIN32 AND NOT CYGWIN) - OPTION (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) IF (BUILD_SHARED_LIBS) FILE (MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BLDTYPE}) - IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) GET_FILENAME_COMPONENT(ZLIB_DLL_NAME ${ZLIB_LIBRARY} NAME_WE) # MESSAGE (STATUS "ZLIB_DLL_NAME: ${ZLIB_DLL_NAME}") @@ -574,6 +688,19 @@ IF (WIN32 AND NOT CYGWIN) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ COMMENT "Copying ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/" ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (ZLIB-Release-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + ADD_CUSTOM_TARGET (ZLIB-Dll-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (ZLIB-Dll-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) @@ -585,6 +712,19 @@ IF (WIN32 AND NOT CYGWIN) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ COMMENT "Copying ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/" ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (SZIP-Release-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + ADD_CUSTOM_TARGET (SZIP-Dll-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (SZIP-Dll-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) ENDIF (BUILD_SHARED_LIBS) @@ -597,6 +737,10 @@ ENDIF (WIN32 AND NOT CYGWIN) IF (WIN32 AND NOT CYGWIN) OPTION (HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF) IF (HDF5_ENABLE_THREADSAFE) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and Threadsafe options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) SET (H5_HAVE_WIN_THREADS 1) SET (H5_HAVE_THREADSAFE 1) ENDIF (HDF5_ENABLE_THREADSAFE) @@ -616,14 +760,14 @@ ENDIF (HDF5_USE_H5DUMP_PACKED_BITS) #----------------------------------------------------------------------------- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src) -IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - IF (ZLIB_FOUND) +IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB) - ENDIF (ZLIB_FOUND) - IF (SZIP_FOUND) + ENDIF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) + IF (SZIP_FOUND AND SZIP_USE_EXTERNAL) ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP) - ENDIF (SZIP_FOUND) -ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (SZIP_FOUND AND SZIP_USE_EXTERNAL) +ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") #----------------------------------------------------------------------------- # Build utility to copy and strip X lines of file @@ -658,7 +802,16 @@ IF (BUILD_TESTING) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") ENDIF (H5_HAVE_PARALLEL) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + + OPTION (HDF5_TEST_VFD "Execute tests with different VFDs" OFF) + MARK_AS_ADVANCED (HDF5_TEST_VFD) + IF (HDF5_TEST_VFD) + OPTION (HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON) + MARK_AS_ADVANCED (HDF5_TEST_FHEAP_VFD) + ENDIF (HDF5_TEST_VFD) + INCLUDE (${HDF5_SOURCE_DIR}/CTestConfig.cmake) + CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) ENDIF (BUILD_TESTING) #----------------------------------------------------------------------------- @@ -698,6 +851,10 @@ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR} IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) IF (HDF5_BUILD_CPP_LIB) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and C++ options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") @@ -740,56 +897,41 @@ IF (NOT HDF5_INSTALL_NO_DEVELOPMENT) ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- -# Option for external libraries on windows +# Option for external libraries #----------------------------------------------------------------------------- IF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (HDF5_PACKAGE_EXTLIBS) IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) INSTALL ( - FILES ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${ZLIB_INCLUDE_DIR}/zlib.h + FILES ${ZLIB_INCLUDE_DIR}/zlib.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) - INSTALL( - FILES ${ZLIB_LIBRARY} - DESTINATION ${HDF5_INSTALL_LIB_DIR} - COMPONENT libraries - ) - IF (BUILD_SHARED_LIBS) - GET_FILENAME_COMPONENT(ZLIB_DLL_NAME ${ZLIB_LIBRARY} NAME_WE) - # message(STATUS "ZLIB_DLL_NAME: ${ZLIB_DLL_NAME}") - GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH) - # message(STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}") - INSTALL( - FILES ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${HDF5_INSTALL_BIN_DIR} - COMPONENT libraries - ) - ENDIF (BUILD_SHARED_LIBS) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) INSTALL ( - FILES ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h + FILES ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + INSTALL ( + FILES ${EXTERNAL_HEADER_LIST} + DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT headers + ) + INSTALL( + FILES ${EXTERNAL_LIBRARY_LIST} + DESTINATION ${HDF5_INSTALL_LIB_DIR} + COMPONENT libraries + ) + IF (WIN32 AND BUILD_SHARED_LIBS) INSTALL( - FILES ${SZIP_LIBRARY} - DESTINATION ${HDF5_INSTALL_LIB_DIR} + FILES ${EXTERNAL_LIBRARYDLL_LIST} + DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries ) - IF (BUILD_SHARED_LIBS) - GET_FILENAME_COMPONENT(SZIP_DLL_NAME ${SZIP_LIBRARY} NAME_WE) - # message(STATUS "SZIP_DLL_NAME: ${SZIP_DLL_NAME}") - GET_FILENAME_COMPONENT(SZIP_BIN_PATH ${SZIP_LIBRARY} PATH) - # message(STATUS "SZIP_BIN_PATH: ${ZLIB_BIN_PATH}") - INSTALL( - FILES ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${HDF5_INSTALL_BIN_DIR} - COMPONENT libraries - ) - ENDIF (BUILD_SHARED_LIBS) - ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + ENDIF (WIN32 AND BUILD_SHARED_LIBS) ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -799,7 +941,7 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT HDF5_EXTERNALLY_CONFIGURED) INSTALL ( EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} FILE hdf5-targets.cmake ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -840,7 +982,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ) INSTALL ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -854,27 +996,85 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ) INSTALL ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#----------------------------------------------------------------------------- +# Add Document File(s) to CMake Install +#----------------------------------------------------------------------------- +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + INSTALL ( + FILES + ${HDF5_SOURCE_DIR}/ACKNOWLEDGMENTS + ${HDF5_SOURCE_DIR}/COPYING + ${HDF5_SOURCE_DIR}/README.txt + DESTINATION ${HDF5_INSTALL_DATA_DIR} + COMPONENT hdfdocuments ) + IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") + SET (release_files + ${HDF5_SOURCE_DIR}/release_docs/CMake.txt + ${HDF5_SOURCE_DIR}/release_docs/COPYING + ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_9.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL + ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt + ) + IF (WIN32 AND NOT CYGWIN) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt + ) + ELSE (WIN32 AND NOT CYGWIN) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_cygwin.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_MinGW.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_VMS.txt + ) + ENDIF (WIN32 AND NOT CYGWIN) + IF (HDF5_ENABLE_PARALLEL) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_parallel.txt + ) + ENDIF (HDF5_ENABLE_PARALLEL) + INSTALL ( + FILES ${release_files} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/release_docs + COMPONENT hdfdocuments + ) + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Set the cpack variables #----------------------------------------------------------------------------- -IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") +IF (NOT HDF5_EXTERNALLY_CONFIGURED) SET (CPACK_PACKAGE_VENDOR "The HDF Group") SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") + SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDF5_PACKAGE_NAME}") SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") SET (CPACK_PACKAGE_VERSION_PATCH "") - SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") + IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") + SET (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") + SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") + SET (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") + SET (CPACK_PACKAGE_RELOCATABLE TRUE) IF (WIN32) + SET (CPACK_NSIS_CONTACT "help@hdfgroup.org") + SET (CPACK_NSIS_MODIFY_PATH ON) SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}") + ELSE (WIN32) + SET (CPACK_RPM_COMPONENT_INSTALL ON) ENDIF (WIN32) INCLUDE (CPack) + INCLUDE(InstallRequiredSystemLibraries) #--------------------------------------------------------------------------- # Now list the cpack commands @@ -893,6 +1093,10 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") DEPENDS libraries GROUP Development ) + CPACK_ADD_COMPONENT (hdfdocuments + DISPLAY_NAME "HDF5 Documents" + GROUP Documents + ) IF (HDF5_BUILD_FORTRAN) CPACK_ADD_COMPONENT (fortlibraries @@ -971,4 +1175,4 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") ) ENDIF (HDF5_BUILD_HL_LIB) -ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index eb7dbee..f698b1e 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -4,12 +4,19 @@ ## # The following are required to uses Dart and the Cdash dashboard ## ENABLE_TESTING() ## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "HDF5 Trunk") -set(CTEST_NIGHTLY_START_TIME "20:00:00 CST") +SET (CTEST_PROJECT_NAME "HDF5 Trunk") +SET (CTEST_NIGHTLY_START_TIME "20:00:00 CST") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu") -set(CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5+Trunk") -set(CTEST_DROP_SITE_CDASH TRUE) +SET (CTEST_DROP_METHOD "http") +SET (CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu") +SET (CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5+Trunk") +SET (CTEST_DROP_SITE_CDASH TRUE) -set(UPDATE_TYPE svn) +SET (UPDATE_TYPE svn) +SET (VALGRIND_COMMAND "/usr/bin/valgrind") +SET (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe") +SET (MEMORYCHECK_COMMAND "/usr/bin/valgrind") +SET (CTEST_MEMORYCHECK_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe") + +SET (CTEST_TESTING_TIMEOUT 3600) +SET (DART_TESTING_TIMEOUT 3600) @@ -96,6 +96,7 @@ ./config/i686-pc-cygwin ./config/ia64-linux-gnu ./config/ibm-aix +./config/ibm-aix6.x ./config/ibm-flags ./config/intel-fflags ./config/intel-flags @@ -409,6 +410,7 @@ ./release_docs/INSTALL_Cygwin.txt ./release_docs/INSTALL_VMS.txt ./release_docs/INSTALL_Windows.txt +./release_docs/USING_Windows.txt ./release_docs/CMake.txt ./release_docs/INSTALL_Windows_From_Command_Line.txt ./release_docs/INSTALL_Windows_Short_NET.TXT @@ -805,6 +807,7 @@ ./test/H5srcdir_str.h.in ./test/Makefile.am ./test/Makefile.in +./test/accum.c ./test/app_ref.c ./test/be_data.h5 ./test/be_extlink1.h5 @@ -832,6 +835,7 @@ ./test/external.c ./test/error_test.c ./test/err_compat.c +./test/links_env.c ./test/family_v16_00000.h5 ./test/family_v16_00001.h5 ./test/family_v16_00002.h5 @@ -903,6 +907,7 @@ ./test/tcoords.c ./test/testcheck_version.sh.in ./test/testerror.sh.in +./test/testlinks_env.sh.in ./test/testframe.c ./test/testhdf5.c ./test/testhdf5.h @@ -950,6 +955,7 @@ ./test/testfiles/err_compat_2 ./test/testfiles/error_test_1 ./test/testfiles/error_test_2 +./test/testfiles/links_env.out ./testpar/COPYING ./testpar/Makefile.am @@ -965,9 +971,9 @@ ./testpar/t_chunk_alloc.c ./testpar/t_coll_chunk.c ./testpar/t_filter_read.c -./testpar/t_span_tree.c ./testpar/t_posix_compliant.c -./testpar/t_rank_projection.c +./testpar/t_shapesame.c +./testpar/t_span_tree.c ./testpar/testpar.h ./testpar/testphdf5.c ./testpar/testphdf5.h @@ -1111,6 +1117,8 @@ ./tools/misc/testh5mkgrp.sh ./tools/misc/testh5repart.sh.in ./tools/misc/talign.c +./tools/misc/testfiles/h5mkgrp_help.txt +./tools/misc/testfiles/h5mkgrp_version.txt.in # h5stat sources ./tools/h5stat/Makefile.am @@ -1157,6 +1165,8 @@ ./tools/testfiles/family_file00015.h5 ./tools/testfiles/family_file00016.h5 ./tools/testfiles/family_file00017.h5 +./tools/testfiles/packedbits.h5 +./tools/testfiles/packedbits.ddl ./tools/testfiles/file_space.h5 ./tools/testfiles/file_space.ddl ./tools/testfiles/tall-1.ddl @@ -1217,6 +1227,7 @@ ./tools/testfiles/texceedsubstride.ddl ./tools/testfiles/textlink.h5 ./tools/testfiles/textlink.h5.xml +./tools/testfiles/textlink.ddl ./tools/testfiles/textlinkfar.ddl ./tools/testfiles/textlinkfar.h5 ./tools/testfiles/textlinksrc.ddl @@ -1238,6 +1249,7 @@ ./tools/testfiles/tgroup-1.ddl ./tools/testfiles/tgroup-2.ddl ./tools/testfiles/tgroup.h5 +./tools/testfiles/tgrp_comments.ls ./tools/testfiles/tgrp_comments.ddl ./tools/testfiles/tgrp_comments.h5 ./tools/testfiles/thlink-1.ddl @@ -1378,6 +1390,9 @@ ./tools/testfiles/tgroup.ls ./tools/testfiles/tloop-1.ls ./tools/testfiles/tnestcomp-1.ls +./tools/testfiles/tnestcomp-2.ls +./tools/testfiles/tnestcomp-3.ls +./tools/testfiles/tnestcomp-4.ls ./tools/testfiles/tsaf.ls ./tools/testfiles/tstr-1.ls ./tools/testfiles/tattr2.ls @@ -1632,6 +1647,7 @@ ./tools/h5diff/testfiles/h5diff_516.txt ./tools/h5diff/testfiles/h5diff_517.txt ./tools/h5diff/testfiles/h5diff_518.txt +./tools/h5diff/testfiles/h5diff_530.txt ./tools/h5diff/testfiles/h5diff_attr1.h5 ./tools/h5diff/testfiles/h5diff_attr2.h5 @@ -1663,6 +1679,7 @@ ./tools/h5diff/testfiles/h5diff_exclude1-2.h5 ./tools/h5diff/testfiles/h5diff_exclude2-1.h5 ./tools/h5diff/testfiles/h5diff_exclude2-2.h5 +./tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 #test files for h5repack @@ -1716,6 +1733,7 @@ ./tools/h5copy/testfiles/h5copy_extlinks_src.h5 ./tools/h5copy/testfiles/h5copy_extlinks_trg.h5 ./tools/h5copy/testfiles/h5copy_extlinks_src.out.ls +./tools/h5copy/testfiles/h5copy_misc1.out # test files for h5mkgrp ./tools/testfiles/h5mkgrp_help.ls @@ -1941,11 +1959,13 @@ ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDF5Macros.cmake ./config/cmake/libhdf5.settings.cmake.in +./config/cmake/mccacheinit.cmake ./config/cmake/cacheinit.cmake +./config/cmake/CTest.cmake ./config/cmake/grepTest.cmake ./config/cmake/runTest.cmake ./config/cmake/vfdTest.cmake -./config/cmake/CTestCustom.ctest +./config/cmake/CTestCustom.cmake ./config/cmake/ConfigureChecks.cmake ./CMakeLists.txt ./CTestConfig.cmake diff --git a/Makefile.in b/Makefile.in index 74fa836..c1c714c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -180,6 +180,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -241,6 +242,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -297,6 +299,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -1,4 +1,4 @@ -HDF5 version 1.9.76 currently under development +HDF5 version 1.9.80 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, -[m4_warning([this file was generated for autoconf 2.67. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -1171,10 +1171,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -1745,15 +1748,12 @@ _LT_EOF # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) - _LT_PROG_XSI_SHELLFNS + _LT_PROG_REPLACE_SHELLFNS - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -2070,30 +2070,41 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], fi ]) -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi ])# _LT_SYS_MODULE_PATH_AIX @@ -2118,7 +2129,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. -if test "X`print -r -- -n 2>/dev/null`" = X-n && \ +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -2162,6 +2173,39 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], @@ -2308,14 +2352,47 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -2655,10 +2732,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); +int fnord () __attribute__((visibility("default"))); #endif -void fnord () { int i=42; } +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -3198,8 +3275,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -3232,13 +3310,71 @@ m4_if([$1], [],[ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -3942,6 +4078,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -4160,6 +4301,21 @@ tpf*) ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -4167,7 +4323,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -4270,6 +4430,67 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + # LT_LIB_M # -------- @@ -4396,8 +4617,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -4433,6 +4654,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -4466,6 +4688,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -4477,7 +4711,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT@&t@_DLSYM_CONST struct { const char *name; void *address; } @@ -4503,15 +4737,15 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -4544,6 +4778,13 @@ else AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -4554,6 +4795,8 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -4565,7 +4808,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= -AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -4670,6 +4912,12 @@ m4_if([$1], [CXX], [ ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; dgux*) case $cc_basename in ec++*) @@ -5044,6 +5292,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -5163,9 +5417,11 @@ case $host_os in _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. @@ -5184,6 +5440,8 @@ fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -5204,6 +5462,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -5212,6 +5471,7 @@ m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. @@ -5226,15 +5486,20 @@ m4_if([$1], [CXX], [ ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -5402,7 +5667,8 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -5450,7 +5716,7 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler @@ -5520,8 +5786,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -5539,8 +5805,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -5586,8 +5852,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -5717,7 +5983,7 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else @@ -5728,7 +5994,7 @@ _LT_EOF else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. @@ -5772,20 +6038,63 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -5823,7 +6132,7 @@ _LT_EOF # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -5831,7 +6140,7 @@ _LT_EOF hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -5847,7 +6156,7 @@ _LT_EOF hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -5871,10 +6180,10 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -5921,16 +6230,31 @@ _LT_EOF irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' @@ -6015,7 +6339,7 @@ _LT_EOF osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' @@ -6034,9 +6358,9 @@ _LT_EOF _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -6308,8 +6632,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -6320,6 +6642,8 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -6417,6 +6741,7 @@ CC="$lt_save_CC" m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then @@ -6478,6 +6803,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -6495,6 +6821,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6516,8 +6843,8 @@ if test "$_lt_caught_CXX_error" != yes; then # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -6658,7 +6985,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" @@ -6670,7 +6997,7 @@ if test "$_lt_caught_CXX_error" != yes; then else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. @@ -6712,29 +7039,75 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -6809,7 +7182,7 @@ if test "$_lt_caught_CXX_error" != yes; then ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -6880,10 +7253,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -6924,9 +7297,9 @@ if test "$_lt_caught_CXX_error" != yes; then *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -7204,7 +7577,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -7291,9 +7664,9 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -7422,6 +7795,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -7436,6 +7810,29 @@ AC_LANG_POP ])# _LT_LANG_CXX_CONFIG +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -7444,6 +7841,7 @@ AC_LANG_POP # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -7494,6 +7892,13 @@ public class foo { }; _LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -7505,7 +7910,7 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -7514,13 +7919,22 @@ if AC_TRY_EVAL(ac_compile); then test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -7540,8 +7954,10 @@ if AC_TRY_EVAL(ac_compile); then _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -7577,6 +7993,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -7726,7 +8143,9 @@ if test "$_lt_disable_F77" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} + CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -7780,6 +8199,7 @@ if test "$_lt_disable_F77" != yes; then GCC=$lt_save_GCC CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP @@ -7856,7 +8276,9 @@ if test "$_lt_disable_FC" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -7912,7 +8334,8 @@ if test "$_lt_disable_FC" != yes; then fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -7949,10 +8372,12 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -7979,7 +8404,8 @@ fi AC_LANG_RESTORE GCC=$lt_save_GCC -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG @@ -8014,9 +8440,11 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} +CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -8029,7 +8457,8 @@ fi GCC=$lt_save_GCC AC_LANG_RESTORE -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG @@ -8088,6 +8517,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) # _LT_DECL_SED # ------------ @@ -8179,8 +8617,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -8219,209 +8657,165 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` -} + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'` -} + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) -_LT_EOF -esac + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac ;; - esac + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac ]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # @@ -8920,17 +9314,17 @@ m4_define([lt_dict_filter], # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# Generated from ltversion.in. +# @configure_input@ -# serial 3175 ltversion.m4 +# serial 3293 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.10]) -m4_define([LT_PACKAGE_REVISION], [1.3175]) +m4_define([LT_PACKAGE_VERSION], [2.4]) +m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.10' -macro_revision='1.3175' +[macro_version='2.4' +macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/bin/chkconfigure b/bin/chkconfigure index 62ca1ca..03035cd 100755 --- a/bin/chkconfigure +++ b/bin/chkconfigure @@ -18,12 +18,12 @@ # Created Date: 2004/12/07 # -# Configure: should be generated by autoconf version 2.67. -# autoconf: should be of version 2.67. +# Configure: should be generated by autoconf version 2.68. +# autoconf: should be of version 2.68. # variable initialization nerrors=0 -AUTOCONFVERSION=2.67 +AUTOCONFVERSION=2.68 AUTOCONFVERSIONLEAD='Generated by GNU Autoconf' CONFIGUREFILES="configure" diff --git a/bin/config.sub b/bin/config.sub index 2851647..6759825 100755 --- a/bin/config.sub +++ b/bin/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2005-12-11' +timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -71,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -240,15 +241,16 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -268,26 +270,25 @@ case $basic_machine in | mn10200 | mn10300 \ | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; - m32c) - basic_machine=$basic_machine-unknown - ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -317,18 +318,18 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ + | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -350,28 +351,31 @@ case $basic_machine in | mmix-* \ | mt-* \ | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; - m32c-*) + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -443,6 +447,14 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; c90) basic_machine=c90-cray os=-unicos @@ -475,8 +487,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -668,6 +680,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -683,6 +703,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -809,6 +833,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -818,6 +850,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -904,6 +942,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -915,6 +957,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -1004,6 +1049,10 @@ case $basic_machine in basic_machine=tic6x-unknown os=-coff ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -1120,7 +1169,7 @@ case $basic_machine in sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1193,7 +1242,8 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ @@ -1208,7 +1258,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1360,6 +1410,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1369,9 +1425,9 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1397,6 +1453,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; diff --git a/bin/ltmain.sh b/bin/ltmain.sh index 04eaea4..3061e3c 100644 --- a/bin/ltmain.sh +++ b/bin/ltmain.sh @@ -1,6 +1,5 @@ -# Generated from ltmain.m4sh. -# libtool (GNU libtool) 2.2.10 +# libtool (GNU libtool) 2.4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, @@ -70,17 +69,19 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.10 +# $progname: (GNU libtool) 2.4 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to <bug-libtool@gnu.org>. +# GNU libtool home page: <http://www.gnu.org/software/libtool/>. +# General help using GNU software: <http://www.gnu.org/gethelp/>. PROGRAM=libtool PACKAGE=libtool -VERSION=2.2.10 +VERSION=2.4 TIMESTAMP="" -package_revision=1.3175 +package_revision=1.3293 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -163,6 +164,27 @@ IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: @@ -177,17 +199,31 @@ basename="s,^.*/,," # those functions but instead duplicate the functionality here. func_dirname_and_basename () { - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation -# Generated shell functions inserted here. # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' @@ -370,6 +406,15 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -398,7 +443,7 @@ opt_warning=: # name if it has been set yet. func_echo () { - $ECHO "$progname${mode+: }$mode: $*" + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... @@ -424,14 +469,14 @@ func_echo_all () # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : @@ -650,11 +695,30 @@ func_show_eval_locale () fi } +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + # func_version # Echo version message to standard output and exit. func_version () { + $opt_debug + $SED -n '/(C)/!b go :more /\./!{ @@ -676,6 +740,8 @@ func_version () # Echo short help message to standard output and exit. func_usage () { + $opt_debug + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// @@ -692,7 +758,10 @@ func_usage () # unless 'noexit' is passed as argument. func_help () { + $opt_debug + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print s/^# // s/^# *$// s*\$progname*'$progname'* @@ -705,7 +774,11 @@ func_help () s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p - }' < "$progpath" + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" ret=$? if test -z "$1"; then exit $ret @@ -717,12 +790,39 @@ func_help () # exit_cmd. func_missing_arg () { + $opt_debug + func_error "missing argument for $1." exit_cmd=exit } -exit_cmd=: +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: @@ -732,25 +832,64 @@ magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. -# $mode is unset nonopt= -execute_dlfiles= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 -opt_dry_run=false -opt_duplicate_deps=false -opt_silent=false -opt_debug=: - # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. @@ -840,129 +979,204 @@ func_enable_tag () esac } -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () { + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - # Parse non-mode specific arguments: - while test "$#" -gt 0; do + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do opt="$1" shift - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" + --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" - opt_debug='set -x' $opt_debug ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift + --dry-run|--dryrun|-n) + opt_dry_run=: ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" shift ;; - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - opt_verbose=false + opt_preserve_dup_deps=: ;; - - --no-quiet|--no-silent) - preserve_args="$preserve_args $opt" - opt_silent=false + --features) + opt_features=: +func_features ;; - - --verbose| -v) preserve_args="$preserve_args $opt" + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) opt_silent=false - opt_verbose=: +func_append preserve_args " $opt" ;; - - --no-verbose) preserve_args="$preserve_args $opt" + --no-verbose) opt_verbose=false +func_append preserve_args " $opt" ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" shift ;; + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --help-all) opt_help=': help-all' ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) @@ -970,82 +1184,44 @@ func_enable_tag () opt_duplicate_compiler_generated_deps=: ;; *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} + $opt_help || { + # Sanity checks first: + func_check_version_match -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" fi - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi - test -z "$mode" && func_fatal_error "error: you must specify a MODE." + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} +## ----------- ## +## Main. ## +## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. @@ -1110,12 +1286,9 @@ func_ltwrapper_executable_p () # temporary ltwrapper_script. func_ltwrapper_scriptname () { - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file @@ -1161,6 +1334,37 @@ func_source () } +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. @@ -1173,8 +1377,7 @@ func_infer_tag () if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` @@ -1193,8 +1396,7 @@ func_infer_tag () CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` @@ -1263,6 +1465,486 @@ EOF } } + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () +{ + $opt_debug + func_convert_core_file_wine_to_w32_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + # func_mode_compile arg... func_mode_compile () { @@ -1303,12 +1985,12 @@ func_mode_compile () ;; -pie | -fpie | -fPIE) - pie_flag="$pie_flag $arg" + func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" + func_append later " $arg" continue ;; @@ -1329,15 +2011,14 @@ func_mode_compile () save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" - func_quote_for_eval "$arg" - lastarg="$lastarg $func_quote_for_eval_result" + func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" + func_append base_compile " $lastarg" continue ;; @@ -1353,8 +2034,7 @@ func_mode_compile () esac # case $arg_mode # Aesthetically quote the previous argument. - func_quote_for_eval "$lastarg" - base_compile="$base_compile $func_quote_for_eval_result" + func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in @@ -1485,17 +2165,16 @@ compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - removelist="$removelist $output_obj" + func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" + func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result @@ -1515,7 +2194,7 @@ compiler." if test -z "$output_obj"; then # Place PIC objects in $objdir - command="$command -o $lobj" + func_append command " -o $lobj" fi func_show_eval_locale "$command" \ @@ -1562,11 +2241,11 @@ compiler." command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - command="$command -o $obj" + func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" + func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' @@ -1611,13 +2290,13 @@ compiler." } $opt_help || { - test "$mode" = compile && func_mode_compile ${1+"$@"} + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. - case $mode in + case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. @@ -1793,7 +2472,7 @@ Otherwise, only FILE itself is deleted using RM." ;; *) - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac @@ -1808,13 +2487,13 @@ if $opt_help; then else { func_help noexit - for mode in compile link execute install finish uninstall clean; do + for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit - for mode in compile link execute install finish uninstall clean; do + for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done @@ -1843,13 +2522,16 @@ func_mode_execute () func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do + for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" @@ -1871,7 +2553,7 @@ func_mode_execute () dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" + func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" @@ -1928,8 +2610,7 @@ func_mode_execute () ;; esac # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" + func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then @@ -1961,22 +2642,59 @@ func_mode_execute () fi } -test "$mode" = execute && func_mode_execute ${1+"$@"} +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug - libdirs="$nonopt" + libs= + libdirs= admincmds= - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. @@ -1986,7 +2704,7 @@ func_mode_finish () if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done @@ -1995,53 +2713,55 @@ func_mode_finish () # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi exit $EXIT_SUCCESS } -test "$mode" = finish && func_mode_finish ${1+"$@"} +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... @@ -2066,7 +2786,7 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" + func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; @@ -2086,7 +2806,7 @@ func_mode_install () do arg2= if test -n "$dest"; then - files="$files $dest" + func_append files " $dest" dest=$arg continue fi @@ -2124,11 +2844,11 @@ func_mode_install () # Aesthetically quote the argument. func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" + func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi - install_shared_prog="$install_shared_prog $func_quote_for_eval_result" + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -2140,7 +2860,7 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" - install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" + func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi @@ -2198,10 +2918,13 @@ func_mode_install () case $file in *.$libext) # Do the static libraries later. - staticlibs="$staticlibs $file" + func_append staticlibs " $file" ;; *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" @@ -2215,19 +2938,19 @@ func_mode_install () if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; + *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; + *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" - dir="$dir$objdir" + func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. @@ -2304,7 +3027,7 @@ func_mode_install () func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) @@ -2501,7 +3224,7 @@ func_mode_install () fi } -test "$mode" = install && func_mode_install ${1+"$@"} +test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -2548,6 +3271,18 @@ extern \"C\" { #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + /* External symbol declarations for the compiler. */\ " @@ -2559,8 +3294,9 @@ extern \"C\" { # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then @@ -2609,10 +3345,52 @@ extern \"C\" { func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen <import library>. + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac done $opt_dry_run || { @@ -2650,26 +3428,9 @@ typedef struct { const char *name; void *address; } lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - echo >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - echo >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist +extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist +LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," @@ -2725,7 +3486,7 @@ static const void *lt_preloaded_setup() { for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; + *) func_append symtab_cflags " $arg" ;; esac done @@ -2788,7 +3549,8 @@ func_win32_libid () # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - win32_nmres=`eval $NM -f posix -A $1 | + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ @@ -2817,6 +3579,131 @@ func_win32_libid () $ECHO "$win32_libid_type" } +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} # func_extract_an_archive dir oldlib @@ -3195,6 +4082,18 @@ func_exec_program () if test -f \"\$progdir/\$program\"; then" + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ @@ -3209,14 +4108,6 @@ func_exec_program () " fi - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. @@ -3234,166 +4125,6 @@ fi\ } -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_result=`cygpath -w "$1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result= - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_pathlist_tmp1=$func_stripname_result - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - func_to_host_pathlist_result=` - ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_append func_to_host_pathlist_result ";$func_to_host_path_result" - fi - fi - fi - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result"; then - func_error "Could not determine the host path(s) corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_append func_to_host_pathlist_result ";" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist - # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because @@ -3563,14 +4294,14 @@ void lt_dump_script (FILE *f); EOF cat <<EOF -const char * MAGIC_EXE = "$magic_exe"; +volatile const char * MAGIC_EXE = "$magic_exe"; const char * LIB_PATH_VARNAME = "$shlibpath_var"; EOF if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - func_to_host_pathlist "$temp_rpath" + func_to_host_path "$temp_rpath" cat <<EOF -const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; +const char * LIB_PATH_VALUE = "$func_to_host_path_result"; EOF else cat <<"EOF" @@ -3579,10 +4310,10 @@ EOF fi if test -n "$dllsearchpath"; then - func_to_host_pathlist "$dllsearchpath:" + func_to_host_path "$dllsearchpath:" cat <<EOF const char * EXE_PATH_VARNAME = "PATH"; -const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; +const char * EXE_PATH_VALUE = "$func_to_host_path_result"; EOF else cat <<"EOF" @@ -3765,8 +4496,12 @@ EOF lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ lt_setenv ("DUALCASE", "1"); /* for MSK sh */ - lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); + /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must + be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) + because on Windows, both *_VARNAMEs are PATH but uninstalled + libraries must come first. */ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", nonnull (lt_argv_zero)); @@ -4515,9 +5250,9 @@ func_mode_link () ;; *) if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" + func_append dlfiles " $arg" else - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $arg" fi prev= continue @@ -4541,7 +5276,7 @@ func_mode_link () *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; @@ -4560,7 +5295,7 @@ func_mode_link () moreargs= for fil in `cat "$save_arg"` do -# moreargs="$moreargs $fil" +# func_append moreargs " $fil" arg=$fil # A libtool-controlled object. @@ -4589,7 +5324,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4601,7 +5336,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4671,12 +5406,12 @@ func_mode_link () if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) rpath="$rpath $arg" ;; + *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; + *) func_append xrpath " $arg" ;; esac fi prev= @@ -4688,28 +5423,28 @@ func_mode_link () continue ;; weak) - weak_libs="$weak_libs $arg" + func_append weak_libs " $arg" prev= continue ;; xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) - compiler_flags="$compiler_flags $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" @@ -4800,15 +5535,16 @@ func_mode_link () ;; -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -4820,10 +5556,16 @@ func_mode_link () ;; esac case "$deplibs " in - *" -L$dir "*) ;; + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" ;; esac case $host in @@ -4832,12 +5574,12 @@ func_mode_link () case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; + *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -4861,7 +5603,7 @@ func_mode_link () ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -4881,7 +5623,7 @@ func_mode_link () ;; esac fi - deplibs="$deplibs $arg" + func_append deplibs " $arg" continue ;; @@ -4893,8 +5635,8 @@ func_mode_link () # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler @@ -4902,12 +5644,12 @@ func_mode_link () ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; @@ -4974,13 +5716,17 @@ func_mode_link () # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac continue ;; @@ -5033,8 +5779,8 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -5049,9 +5795,9 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -5090,13 +5836,16 @@ func_mode_link () # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" continue ;; @@ -5108,7 +5857,7 @@ func_mode_link () *.$objext) # A standard object. - objs="$objs $arg" + func_append objs " $arg" ;; *.lo) @@ -5139,7 +5888,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -5151,7 +5900,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -5196,24 +5945,25 @@ func_mode_link () *.$libext) # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" + func_append deplibs " $arg" + func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. + func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" + func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $func_resolve_sysroot_result" prev= else - deplibs="$deplibs $arg" + func_append deplibs " $func_resolve_sysroot_result" fi continue ;; @@ -5260,6 +6010,8 @@ func_mode_link () func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" @@ -5280,12 +6032,12 @@ func_mode_link () # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - libs="$libs $deplib" + func_append libs " $deplib" done if test "$linkmode" = lib; then @@ -5298,9 +6050,9 @@ func_mode_link () if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac - pre_post_deps="$pre_post_deps $pre_post_dep" + func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= @@ -5367,8 +6119,9 @@ func_mode_link () for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= + func_resolve_sysroot "$lib" case $lib in - *.la) func_source "$lib" ;; + *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library @@ -5378,7 +6131,7 @@ func_mode_link () deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; + *) func_append deplibs " $deplib" ;; esac done done @@ -5399,11 +6152,11 @@ func_mode_link () compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - compiler_flags="$compiler_flags $deplib" + func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5488,7 +6241,7 @@ func_mode_link () if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5501,7 +6254,8 @@ func_mode_link () test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then @@ -5515,7 +6269,8 @@ func_mode_link () finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" @@ -5526,17 +6281,21 @@ func_mode_link () -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" - dir=$func_stripname_result + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) lib="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -5599,11 +6358,11 @@ func_mode_link () if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. - newdlprefiles="$newdlprefiles $deplib" + func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - newdlfiles="$newdlfiles $deplib" + func_append newdlfiles " $deplib" fi fi continue @@ -5649,7 +6408,7 @@ func_mode_link () for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi @@ -5657,8 +6416,8 @@ func_mode_link () if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then @@ -5669,20 +6428,20 @@ func_mode_link () func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done continue fi # $pass = conv @@ -5690,9 +6449,15 @@ func_mode_link () # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi @@ -5709,9 +6474,9 @@ func_mode_link () # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + func_append dlprefiles " $lib $dependency_libs" else - newdlfiles="$newdlfiles $lib" + func_append newdlfiles " $lib" fi continue fi # $pass = dlopen @@ -5733,14 +6498,14 @@ func_mode_link () # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$libdir" - absdir="$libdir" + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -5748,12 +6513,12 @@ func_mode_link () dir="$ladir" absdir="$abs_ladir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" @@ -5764,20 +6529,46 @@ func_mode_link () if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac fi # $pass = dlpreopen if test -z "$libdir"; then @@ -5795,7 +6586,7 @@ func_mode_link () if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" + func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -5808,7 +6599,8 @@ func_mode_link () for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? @@ -5819,12 +6611,12 @@ func_mode_link () # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... @@ -5839,7 +6631,7 @@ func_mode_link () # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; + *) func_append temp_rpath "$absdir:" ;; esac fi @@ -5851,7 +6643,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5860,7 +6652,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5885,12 +6677,12 @@ func_mode_link () case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=yes fi ;; @@ -5925,7 +6717,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5934,7 +6726,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5988,7 +6780,7 @@ func_mode_link () linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= @@ -6044,7 +6836,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -6066,7 +6858,7 @@ func_mode_link () if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -6080,13 +6872,13 @@ func_mode_link () test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= @@ -6100,7 +6892,7 @@ func_mode_link () elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then @@ -6117,7 +6909,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -6194,27 +6986,33 @@ func_mode_link () temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; + *) func_append xrpath " $temp_xrpath";; esac;; - *) temp_deplibs="$temp_deplibs $libdir";; + *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi - newlib_search_path="$newlib_search_path $absdir" + func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then @@ -6224,8 +7022,10 @@ func_mode_link () case $deplib in -L*) path="$deplib" ;; *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; @@ -6252,8 +7052,8 @@ func_mode_link () if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi @@ -6303,7 +7103,7 @@ func_mode_link () for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; + *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= @@ -6361,10 +7161,10 @@ func_mode_link () -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -6380,7 +7180,7 @@ func_mode_link () ;; esac if test -n "$i" ; then - tmp_libs="$tmp_libs $i" + func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs @@ -6421,7 +7221,7 @@ func_mode_link () # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - objs="$objs$old_deplibs" + func_append objs "$old_deplibs" ;; lib) @@ -6457,7 +7257,7 @@ func_mode_link () echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" + func_append libobjs " $objs" fi fi @@ -6655,7 +7455,7 @@ func_mode_link () done # Make executables depend on our current version. - verstring="$verstring:${current}.0" + func_append verstring ":${current}.0" ;; qnx) @@ -6723,10 +7523,10 @@ func_mode_link () fi func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" + func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= - if test "$mode" != relink; then + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -6742,7 +7542,7 @@ func_mode_link () continue fi fi - removelist="$removelist $p" + func_append removelist " $p" ;; *) ;; esac @@ -6753,7 +7553,7 @@ func_mode_link () # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" + func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` @@ -6770,10 +7570,11 @@ func_mode_link () # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -6787,7 +7588,7 @@ func_mode_link () for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; + *) func_append dlfiles " $lib" ;; esac done @@ -6797,7 +7598,7 @@ func_mode_link () for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; + *) func_append dlprefiles " $lib" ;; esac done @@ -6809,7 +7610,7 @@ func_mode_link () ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -6826,7 +7627,7 @@ func_mode_link () *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" + func_append deplibs " -lc" fi ;; esac @@ -6875,7 +7676,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6886,7 +7687,7 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes echo @@ -6900,7 +7701,7 @@ EOF fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6918,7 +7719,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6929,7 +7730,7 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes echo @@ -6951,7 +7752,7 @@ EOF fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6968,15 +7769,27 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -6999,7 +7812,7 @@ EOF if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -7024,7 +7837,7 @@ EOF ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. @@ -7040,7 +7853,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac @@ -7053,7 +7866,7 @@ EOF potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -7078,7 +7891,7 @@ EOF ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. @@ -7182,7 +7995,7 @@ EOF *) case " $deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -7192,10 +8005,10 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" @@ -7212,10 +8025,12 @@ EOF hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -7224,18 +8039,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" + func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_apped perm_rpath " $libdir" ;; esac fi done @@ -7253,7 +8068,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -7261,7 +8076,7 @@ EOF fi shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -7287,7 +8102,7 @@ EOF linknames= for link do - linknames="$linknames $link" + func_append linknames " $link" done # Use standard objects if they are pic @@ -7298,7 +8113,7 @@ EOF if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" + func_append delfiles " $export_symbols" fi orig_export_symbols= @@ -7329,14 +8144,46 @@ EOF $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then func_show_eval "$cmd" 'exit $?' skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." @@ -7369,7 +8216,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7379,7 +8226,7 @@ EOF case " $convenience " in *" $test_deplib "*) ;; *) - tmp_deplibs="$tmp_deplibs $test_deplib" + func_append tmp_deplibs " $test_deplib" ;; esac done @@ -7399,21 +8246,21 @@ EOF test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" + func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi @@ -7475,10 +8322,13 @@ EOF echo 'INPUT (' > $output for obj in $save_libobjs do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output - delfiles="$delfiles $output" + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -7492,10 +8342,12 @@ EOF fi for obj do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -7546,7 +8398,7 @@ EOF if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi - delfiles="$delfiles $output" + func_append delfiles " $output" else output= @@ -7580,7 +8432,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7613,7 +8465,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7654,10 +8506,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi @@ -7673,7 +8525,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7685,7 +8537,7 @@ EOF IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -7769,13 +8621,16 @@ EOF reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test @@ -7849,8 +8704,8 @@ EOF if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" ;; esac fi @@ -7870,7 +8725,7 @@ EOF *) case " $compile_deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -7880,17 +8735,17 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. @@ -7898,7 +8753,7 @@ EOF # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done fi @@ -7917,18 +8772,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi case $host in @@ -7937,12 +8792,12 @@ EOF case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; + *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -7968,18 +8823,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + *) func_append finalize_perm_rpath " $libdir" ;; esac fi done @@ -8030,6 +8885,12 @@ EOF exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -8052,7 +8913,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -8060,7 +8921,7 @@ EOF # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -8075,6 +8936,13 @@ EOF $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -8108,6 +8976,12 @@ EOF func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" @@ -8205,7 +9079,7 @@ EOF else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" + func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" @@ -8213,10 +9087,10 @@ EOF if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. @@ -8227,10 +9101,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have @@ -8248,7 +9122,7 @@ EOF else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= @@ -8272,9 +9146,9 @@ EOF esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" ;; - *) oldobjs="$oldobjs $obj" ;; + *) func_append oldobjs " $obj" ;; esac done fi @@ -8284,6 +9158,16 @@ EOF len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -8380,9 +9264,19 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" @@ -8396,9 +9290,9 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdlfiles="$newdlfiles $lib" ;; + *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" @@ -8415,7 +9309,7 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done @@ -8427,7 +9321,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlfiles="$newdlfiles $abs" + func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -8436,7 +9330,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlprefiles="$newdlprefiles $abs" + func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi @@ -8521,7 +9415,7 @@ relink_command=\"$relink_command\"" exit $EXIT_SUCCESS } -{ test "$mode" = link || test "$mode" = relink; } && +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} @@ -8541,9 +9435,9 @@ func_mode_uninstall () for arg do case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; esac done @@ -8552,24 +9446,23 @@ func_mode_uninstall () rmdirs= - origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then - objdir="$origobjdir" + odir="$objdir" else - objdir="$dir/$origobjdir" + odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" + test "$opt_mode" = uninstall && odir="$dir" - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; esac fi @@ -8595,18 +9488,17 @@ func_mode_uninstall () # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" + func_append rmfiles " $odir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test -n "$old_library" && func_append rmfiles " $odir/$old_library" - case "$mode" in + case "$opt_mode" in clean) - case " $library_names " in - # " " in the beginning catches empty $dlname + case " $library_names " in *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then @@ -8634,19 +9526,19 @@ func_mode_uninstall () # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" + func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" + func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$mode" = clean ; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) @@ -8656,7 +9548,7 @@ func_mode_uninstall () noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - rmfiles="$rmfiles $file" + func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. @@ -8665,7 +9557,7 @@ func_mode_uninstall () func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename @@ -8673,12 +9565,12 @@ func_mode_uninstall () # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi @@ -8686,7 +9578,6 @@ func_mode_uninstall () esac func_show_eval "$RM $rmfiles" 'exit_status=1' done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -8698,16 +9589,16 @@ func_mode_uninstall () exit $exit_status } -{ test "$mode" = uninstall || test "$mode" = clean; } && +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} -test -z "$mode" && { +test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" diff --git a/bin/reconfigure b/bin/reconfigure index 8c4bb15..9c5b414 100755 --- a/bin/reconfigure +++ b/bin/reconfigure @@ -28,11 +28,11 @@ # of versions that can get confused (not even counting the m4 utility)! # HDF5 currently uses the following versions of the autotools: -AUTOCONF_VERSION="autoconf (GNU Autoconf) 2.67" +AUTOCONF_VERSION="autoconf (GNU Autoconf) 2.68" AUTOMAKE_VERSION="automake (GNU automake) 1.11.1" -AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.67" +AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.68" ACLOCAL_VERSION="aclocal (GNU automake) 1.11.1" -LIBTOOL_VERSION="(GNU libtool) 2.2.10" +LIBTOOL_VERSION="(GNU libtool) 2.4" # # When upgrading automake's version, don't forget to also update its # helper utilities, especially depcomp. @@ -41,19 +41,19 @@ LIBTOOL_VERSION="(GNU libtool) 2.2.10" # If paths to autotools are not specified by the user, assume tools are # running on jam in /mnt/hdf/packages and set paths accordingly. if test -z ${AUTOCONF}; then - AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.67/bin/autoconf + AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.68/bin/autoconf fi if test -z ${AUTOMAKE}; then AUTOMAKE=/mnt/hdf/packages/automake/automake-1.11.1/bin/automake-1.11 fi if test -z ${AUTOHEADER}; then - AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.67/bin/autoheader + AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.68/bin/autoheader fi if test -z ${ACLOCAL}; then ACLOCAL=/mnt/hdf/packages/automake/automake-1.11.1/bin/aclocal-1.11 fi if test -z ${LIBTOOL}; then - LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.2.10/bin/libtool + LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.4/bin/libtool fi # Check version numbers of all autotools against the "correct" versions @@ -84,7 +84,7 @@ if test -z "${LT_VERS}"; then fi # Use the latest version of M4 -PATH=/mnt/hdf/packages/m4/m4-1.4.14/bin:/mnt/hdf/packages/m4/m4-1.4.14/share:$PATH +PATH=/mnt/hdf/packages/m4/m4-1.4.15/bin:/mnt/hdf/packages/m4/m4-1.4.15/share:$PATH # Make sure that the tools are in the path. AUTOCONF_DIR=`dirname ${AUTOCONF}` diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 7571e54..26c9521 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -6,6 +6,8 @@ PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- IF (BUILD_SHARED_LIBS) SET (CPP_BUILT_AS_DYNAMIC_LIB 1) +ELSE (BUILD_SHARED_LIBS) + SET (CPP_BUILT_AS_STATIC_LIB 1) ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- diff --git a/c++/Makefile.in b/c++/Makefile.in index 728a487..23b5ef0 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -153,6 +153,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -214,6 +215,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -270,6 +272,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index a650db5..7bb6bb5 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -22,10 +22,11 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - H5_NAMING (cpp_ex_${example}) - TARGET_WIN_PROPERTIES (cpp_ex_${example}) + H5_NAMING (cpp_ex_${example} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) - ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + IF (BUILD_TESTING) + ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 30326d2..4efc6ef 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -120,6 +120,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -181,6 +182,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -237,6 +239,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -628,7 +631,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 556bf21..8513372 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -22,7 +22,7 @@ namespace H5 { #endif -const H5std_string Exception::DEFAULT_MSG("No detailed information provided"); +const char Exception::DEFAULT_MSG[] = "No detailed information provided"; //-------------------------------------------------------------------------- // Function: Exception default constructor @@ -252,7 +252,7 @@ void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, voi // Function: Exception::getDetailMsg ///\brief Returns the detailed message set at the time the exception /// is thrown. -///\return Text message - \c std::string +///\return Text message - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getDetailMsg() const @@ -275,7 +275,7 @@ const char* Exception::getCDetailMsg() const //-------------------------------------------------------------------------- // Function: Exception::getFuncName ///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c std::string +///\return Text message - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getFuncName() const diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index c17ff5b..b4af2ba 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -84,7 +84,7 @@ class H5_DLLCPP Exception { protected: // Default value for detail_message - static const H5std_string DEFAULT_MSG; + static const char DEFAULT_MSG[]; }; class H5_DLLCPP FileIException : public Exception { diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 27505d5..4e4f669 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -175,6 +175,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -236,6 +237,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -292,6 +294,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -402,7 +405,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index e29963e..197ed84 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -36,8 +36,7 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR} ) ADD_EXECUTABLE (cpp_testhdf5 ${CPP_TEST_SRCS} ) -H5_NAMING (cpp_testhdf5) -TARGET_WIN_PROPERTIES (cpp_testhdf5) +H5_NAMING (cpp_testhdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cpp_testhdf5 ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -45,3 +44,39 @@ TARGET_LINK_LIBRARIES (cpp_testhdf5 ) ADD_TEST (NAME cpp_testhdf5 COMMAND $<TARGET_FILE:cpp_testhdf5>) + +IF (HDF5_TEST_VFD) + + SET (VFD_LIST + sec2 + stdio + core + split + multi + family + ) + + IF (DIRECT_VFD) + SET (VFD_LIST ${VFD_LIST} direct) + ENDIF (DIRECT_VFD) + + MACRO (ADD_VFD_TEST vfdname resultcode) + ADD_TEST ( + NAME VFD-${vfdname}-cpp_testhdf5 + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=cpp_testhdf5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + ) + ENDMACRO (ADD_VFD_TEST) + + # Run test with different Virtual File Driver + FOREACH (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) + ENDFOREACH (vfd ${VFD_LIST}) + +ENDIF (HDF5_TEST_VFD) diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 5a3f52c..68418d9 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -142,6 +142,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -203,6 +204,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -259,6 +261,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index fb8bd17..fbb1219 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -115,7 +115,8 @@ static void test_compound_2() const int nelmts = NTESTELEM; const hsize_t four = 4; int i; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType *array_dt = NULL; // Output message about test being performed SUBTEST("Compound Element Reordering"); @@ -138,7 +139,7 @@ static void test_compound_2() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); // Build hdf5 datatypes - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -148,6 +149,7 @@ static void test_compound_2() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -202,6 +204,9 @@ static void test_compound_2() cerr << "test_compound_2 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_2() @@ -235,7 +240,8 @@ static void test_compound_3() int i; const int nelmts = NTESTELEM; const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Compound Datatype Subset Conversions"); @@ -258,7 +264,7 @@ static void test_compound_3() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); /* Build hdf5 datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -268,6 +274,7 @@ static void test_compound_3() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -319,6 +326,9 @@ static void test_compound_3() cerr << "test_compound_3 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_3() @@ -357,7 +367,8 @@ static void test_compound_4() int i; const int nelmts = NTESTELEM; const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Compound Element Shrinking & Reordering"); @@ -380,7 +391,7 @@ static void test_compound_4() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); /* Build hdf5 datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -390,6 +401,7 @@ static void test_compound_4() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -446,6 +458,9 @@ static void test_compound_4() cerr << "test_compound_4 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_4() @@ -486,16 +501,18 @@ static void test_compound_5() dst_typ_t *dst; void *buf = calloc(2, sizeof(dst_typ_t)); void *bkg = calloc(2, sizeof(dst_typ_t)); + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Optimized Struct Converter"); try { /* Build datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); + array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); CompType short_array(4*sizeof(short)); short_array.insertMember("_", 0, *array_dt); array_dt->close(); + delete array_dt; CompType int_array(4*sizeof(int)); array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims); @@ -545,6 +562,9 @@ static void test_compound_5() cerr << "test_compound_5 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_5() diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index e59707a..0dbdf00 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -174,58 +174,61 @@ void test_szip_filter(H5File& file1) SUBTEST("szip filter (with encoder)"); if ( h5_szip_can_encode() == 1) { - char* tconv_buf = new char [1000]; - try { - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - - // Create the data space - DataSpace space1(2, size, NULL); + char* tconv_buf = new char [1000]; - // Create a small conversion buffer to test strip mining (?) - DSetMemXferPropList xfer; - xfer.setBuffer (1000, tconv_buf, NULL); + try { + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - // Prepare dataset create property list - DSetCreatPropList dsplist; - dsplist.setChunk(2, chunk_size); + // Create the data space + DataSpace space1(2, size, NULL); - // Set up for szip compression - dsplist.setSzip(szip_options_mask, szip_pixels_per_block); + // Create a small conversion buffer to test strip mining (?) + DSetMemXferPropList xfer; + xfer.setBuffer (1000, tconv_buf, NULL); - // Create a dataset with szip compression - DataSpace space2 (2, size, NULL); - DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); + // Prepare dataset create property list + DSetCreatPropList dsplist; + dsplist.setChunk(2, chunk_size); - hsize_t i, j, n; - for (i=n=0; i<size[0]; i++) - { - for (j=0; j<size[1]; j++) - { - points[i][j] = (int)n++; - } - } + // Set up for szip compression + dsplist.setSzip(szip_options_mask, szip_pixels_per_block); - // Write to the dataset then read back the values - dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + // Create a dataset with szip compression + DataSpace space2 (2, size, NULL); + DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) + hsize_t i, j, n; + for (i=n=0; i<size[0]; i++) { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_szip_filter", "Failed in testing szip method"); + for (j=0; j<size[1]; j++) + { + points[i][j] = (int)n++; + } } - dsplist.close(); - PASSED(); - } // end of try - // catch all other exceptions - catch (Exception E) - { - issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); - } + // Write to the dataset then read back the values + dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_szip_filter", "Failed in testing szip method"); + } + dsplist.close(); + PASSED(); + } // end of try + + // catch all other exceptions + catch (Exception E) + { + issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + delete tconv_buf; } // if szip presents else { SKIPPED(); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 53a1c8c..e4e691a 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -403,7 +403,6 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) { hsize_t size[1] = {1}; char filename[NAME_BUF_SIZE]; - char* tconv_buf = new char [1000]; // Use the file access template id to create a file access prop. list. FileAccPropList fapl(fapl_id); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index aeb202a..7f63d33 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -326,6 +326,9 @@ static void test_reference_obj(void) catch (Exception E) { issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(file1) + delete file1; } // test_reference_obj() /**************************************************************** diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index ef00c08..b1baa29 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -387,6 +387,7 @@ static void test_named () static hsize_t ds_size[2] = {10, 20}; hsize_t i; unsigned attr_data[10][20]; + DataType *ds_type = NULL; SUBTEST("Named datatypes"); try { @@ -462,12 +463,13 @@ now. // Create a dataset that uses the named type, then get the dataset's // datatype and make sure it's a named type. DataSet dset = file.createDataSet("dset1", another_type, space); - DataType *ds_type = new DataType(dset.getDataType()); + ds_type = new DataType(dset.getDataType()); iscommitted = ds_type->committed(); if (!iscommitted) throw InvalidActionException("IntType::committed()", "1 Dataset type should be named type!"); dset.close(); ds_type->close(); + delete ds_type; // Reopen the dataset and its type, then make sure the type is // a named type. @@ -483,6 +485,7 @@ now. dset = file.createDataSet("dset2", *ds_type, space); ds_type->close(); dset.close(); + delete ds_type; // Reopen the second dataset and make sure the type is shared dset = file.openDataSet("dset2"); @@ -509,6 +512,9 @@ now. catch (Exception E) { issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(ds_type) + delete ds_type; } // test_named diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 91036f9..73e54e0 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -129,7 +129,6 @@ void test_vlstr_free_custom(void *_mem, void *info) *------------------------------------------------------------------------- */ // String for testing datasets -static char *dynstring_ds_write=NULL; static char stastring_ds_write[1]={'A'}; // Info for a string dataset @@ -138,6 +137,9 @@ const H5std_string DSET1_DATA("String Dataset"); static void test_vlstring_dataset() { + char *dynstring_ds_write = NULL; + char *string_ds_check = NULL; + // Output message about test being performed SUBTEST("VL String on Datasets"); @@ -161,12 +163,12 @@ static void test_vlstring_dataset() dset1.write(DSET1_DATA, vlst); // Read and verify the dataset string as a string of chars. - char *string_ds_check; dset1.read(&string_ds_check, vlst); if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0) TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check); HDfree(string_ds_check); // note: no need for std::string test + string_ds_check = NULL; // Read and verify the dataset string as an std::string. H5std_string read_str; @@ -191,6 +193,7 @@ static void test_vlstring_dataset() if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0) TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check); HDfree(string_ds_check); + string_ds_check = NULL; dset1.close(); // Open dataset DSET1_NAME again. @@ -207,6 +210,11 @@ static void test_vlstring_dataset() catch (Exception E) { issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(dynstring_ds_write) + HDfree(dynstring_ds_write); + if(string_ds_check) + HDfree(string_ds_check); } // test_vlstring_dataset() /*------------------------------------------------------------------------- @@ -231,10 +239,10 @@ static void test_vlstring_array_dataset() // Output message about test being performed SUBTEST("VL String Array on Datasets"); - H5File* file1; + H5File* file1 = NULL; try { // Create file. - file1 = new H5File (FILENAME, H5F_ACC_RDWR); + file1 = new H5File(FILENAME, H5F_ACC_RDWR); // Create dataspace for datasets. hsize_t dims1[] = {SPACE1_DIM1}; @@ -278,8 +286,7 @@ static void test_vlstring_array_dataset() HDmemset(wdata2, 'A', 65533); dataset2.write(&wdata2, vlst); - char *rdata2 = (char*)HDcalloc(65534, sizeof(char)); - HDmemset(rdata2, 0, 65533); + char *rdata2; dataset2.read(&rdata2, vlst); if (HDstrcmp(wdata2, rdata2)!=0) TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2); @@ -302,8 +309,10 @@ static void test_vlstring_array_dataset() catch (Exception E) { issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); - delete file1; } + + if(file1) + delete file1; } // end test_vlstring_array_dataset() /*------------------------------------------------------------------------- @@ -482,6 +491,7 @@ static void test_vlstring_type() // Close datatype and file. vlst.close(); file1->close(); + delete file1; // Open file. file1 = new H5File(FILENAME, H5F_ACC_RDWR); @@ -506,8 +516,10 @@ static void test_vlstring_type() catch (Exception E) { issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg()); - delete file1; } + + if(file1) + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- diff --git a/config/apple b/config/apple index 10674fb..babcdad 100644 --- a/config/apple +++ b/config/apple @@ -62,6 +62,11 @@ case $CC in grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` ;; + *icc*) + cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + *) echo "No match to get cc_version_info for $CC" ;; @@ -72,6 +77,16 @@ case $FC in fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` ;; + + *ifc*|*ifort*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + + *) + echo "No match to get fc_version_info for $FC" + ;; + esac # get c++ version info @@ -80,6 +95,12 @@ case $CXX in cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` ;; + + *icpc*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + *) echo "No match to get cxx_version_info for $CXX" ;; diff --git a/config/cmake/CTest.cmake b/config/cmake/CTest.cmake new file mode 100644 index 0000000..518f61e --- /dev/null +++ b/config/cmake/CTest.cmake @@ -0,0 +1,289 @@ +# - Configure a project for testing with CTest/CDash +# Include this module in the top CMakeLists.txt file of a project to +# enable testing with CTest and dashboard submissions to CDash: +# project(MyProject) +# ... +# include(CTest) +# The module automatically creates a BUILD_TESTING option that selects +# whether to enable testing support (ON by default). After including +# the module, use code like +# if(BUILD_TESTING) +# # ... CMake code to create tests ... +# endif() +# to creating tests when testing is enabled. +# +# To enable submissions to a CDash server, create a CTestConfig.cmake +# file at the top of the project with content such as +# set(CTEST_PROJECT_NAME "MyProject") +# set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +# set(CTEST_DROP_METHOD "http") +# set(CTEST_DROP_SITE "my.cdash.org") +# set(CTEST_DROP_LOCATION "/submit.php?project=MyProject") +# set(CTEST_DROP_SITE_CDASH TRUE) +# (the CDash server can provide the file to a project administrator +# who configures 'MyProject'). +# Settings in the config file are shared by both this CTest module and +# the CTest command-line tool's dashboard script mode (ctest -S). +# +# While building a project for submission to CDash, CTest scans the +# build output for errors and warnings and reports them with +# surrounding context from the build log. This generic approach works +# for all build tools, but does not give details about the command +# invocation that produced a given problem. One may get more detailed +# reports by adding +# set(CTEST_USE_LAUNCHERS 1) +# to the CTestConfig.cmake file. When this option is enabled, the +# CTest module tells CMake's Makefile generators to invoke every +# command in the generated build system through a CTest launcher +# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on +# non-Makefile generators.) During a manual build each launcher +# transparently runs the command it wraps. During a CTest-driven +# build for submission to CDash each launcher reports detailed +# information when its command fails or warns. +# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but +# also adds the launcher overhead even for manual builds. One may +# instead set it in a CTest dashboard script and add it to the CMake +# cache for the build tree.) + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +OPTION(BUILD_TESTING "Build the testing tree." ON) + +# function to turn generator name into a version string +# like vs7 vs71 vs8 vs9 +FUNCTION(GET_VS_VERSION_STRING generator var) + STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" NUMBER "${generator}") + IF("${generator}" MATCHES "Visual Studio 7 .NET 2003") + SET(ver_string "vs71") + ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003") + SET(ver_string "vs${NUMBER}") + ENDIF("${generator}" MATCHES "Visual Studio 7 .NET 2003") + SET(${var} ${ver_string} PARENT_SCOPE) +ENDFUNCTION(GET_VS_VERSION_STRING) + +IF(BUILD_TESTING) + # Setup some auxilary macros + MACRO(SET_IF_NOT_SET var val) + IF(NOT DEFINED "${var}") + SET("${var}" "${val}") + ENDIF(NOT DEFINED "${var}") + ENDMACRO(SET_IF_NOT_SET) + + MACRO(SET_IF_SET var val) + IF(NOT "${val}" MATCHES "^$") + SET("${var}" "${val}") + ENDIF(NOT "${val}" MATCHES "^$") + ENDMACRO(SET_IF_SET) + + MACRO(SET_IF_SET_AND_NOT_SET var val) + IF(NOT "${val}" MATCHES "^$") + SET_IF_NOT_SET("${var}" "${val}") + ENDIF(NOT "${val}" MATCHES "^$") + ENDMACRO(SET_IF_SET_AND_NOT_SET) + + # Make sure testing is enabled + ENABLE_TESTING() + + IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") + SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}") + SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}") + SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") + SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}") + SET_IF_SET_AND_NOT_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}") + SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}") + SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") + SET_IF_SET_AND_NOT_SET(UPDATE_TYPE "${CTEST_UPDATE_TYPE}") + ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + + # the project can have a DartConfig.cmake file + IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake") + ELSE(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + # Dashboard is opened for submissions for a 24 hour period starting at + # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format. + SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") + SET_IF_NOT_SET(DROP_METHOD "http") + SET_IF_NOT_SET (COMPRESS_SUBMISSION ON) + ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") + + FIND_PROGRAM(CVSCOMMAND cvs ) + SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING + "Options passed to the cvs update command.") + FIND_PROGRAM(SVNCOMMAND svn) + FIND_PROGRAM(BZRCOMMAND bzr) + FIND_PROGRAM(HGCOMMAND hg) + FIND_PROGRAM(GITCOMMAND git) + + IF(NOT UPDATE_TYPE) + IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") + SET(UPDATE_TYPE cvs) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + SET(UPDATE_TYPE svn) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + SET(UPDATE_TYPE bzr) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + SET(UPDATE_TYPE hg) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + SET(UPDATE_TYPE git) + ENDIF() + ENDIF(NOT UPDATE_TYPE) + + STRING(TOLOWER "${UPDATE_TYPE}" _update_type) + IF("${_update_type}" STREQUAL "cvs") + SET(UPDATE_COMMAND "${CVSCOMMAND}") + SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "svn") + SET(UPDATE_COMMAND "${SVNCOMMAND}") + SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "bzr") + SET(UPDATE_COMMAND "${BZRCOMMAND}") + SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "hg") + SET(UPDATE_COMMAND "${HGCOMMAND}") + SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "git") + SET(UPDATE_COMMAND "${GITCOMMAND}") + SET(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + ENDIF() + + SET(DART_TESTING_TIMEOUT 1500 CACHE STRING + "Maximum time allowed before CTest will kill the test.") + + SET(CTEST_SUBMIT_RETRY_DELAY 5 CACHE STRING + "How long to wait between timed-out CTest submissions.") + SET(CTEST_SUBMIT_RETRY_COUNT 3 CACHE STRING + "How many times to retry timed-out CTest submissions.") + + FIND_PROGRAM(MEMORYCHECK_COMMAND + NAMES purify valgrind boundscheck + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" + DOC "Path to the memory checking command, used for memory error detection." + ) + FIND_PROGRAM(SLURM_SBATCH_COMMAND sbatch DOC + "Path to the SLURM sbatch executable" + ) + FIND_PROGRAM(SLURM_SRUN_COMMAND srun DOC + "Path to the SLURM srun executable" + ) + SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH + "File that contains suppressions for the memory checker") + FIND_PROGRAM(SCPCOMMAND scp DOC + "Path to scp command, used by CTest for submitting results to a Dart server" + ) + FIND_PROGRAM(COVERAGE_COMMAND gcov DOC + "Path to the coverage program that CTest uses for performing coverage inspection" + ) + + # set the site name + SITE_NAME(SITE) + # set the build name + IF(NOT BUILDNAME) + SET(DART_COMPILER "${CMAKE_CXX_COMPILER}") + IF(NOT DART_COMPILER) + SET(DART_COMPILER "${CMAKE_C_COMPILER}") + ENDIF(NOT DART_COMPILER) + IF(NOT DART_COMPILER) + SET(DART_COMPILER "unknown") + ENDIF(NOT DART_COMPILER) + IF(WIN32) + SET(DART_NAME_COMPONENT "NAME_WE") + ELSE(WIN32) + SET(DART_NAME_COMPONENT "NAME") + ENDIF(WIN32) + IF(NOT BUILD_NAME_SYSTEM_NAME) + SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + ENDIF(NOT BUILD_NAME_SYSTEM_NAME) + IF(WIN32) + SET(BUILD_NAME_SYSTEM_NAME "Win32") + ENDIF(WIN32) + IF(UNIX OR BORLAND) + GET_FILENAME_COMPONENT(DART_CXX_NAME + "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT}) + ELSE(UNIX OR BORLAND) + GET_FILENAME_COMPONENT(DART_CXX_NAME + "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT}) + ENDIF(UNIX OR BORLAND) + IF(DART_CXX_NAME MATCHES "msdev") + SET(DART_CXX_NAME "vs60") + ENDIF(DART_CXX_NAME MATCHES "msdev") + IF(DART_CXX_NAME MATCHES "devenv") + GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME) + ENDIF(DART_CXX_NAME MATCHES "devenv") + IF (SYSTEM_NAME_EXT) + SET (BUILD_NAME_SYSTEM_NAME "${BUILD_NAME_SYSTEM_NAME}_${SYSTEM_NAME_EXT}") + ENDIF (SYSTEM_NAME_EXT) + IF(BUILD_NAME_EXT) + SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}-${BUILD_NAME_EXT}") + ELSE(BUILD_NAME_EXT) + SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") + ENDIF( BUILD_NAME_EXT) + ENDIF(NOT BUILDNAME) + + # the build command + BUILD_COMMAND(MAKECOMMAND_DEFAULT_VALUE + CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") + SET(MAKECOMMAND ${MAKECOMMAND_DEFAULT_VALUE} + CACHE STRING "Command to build the project") + + # the default build configuration the ctest build handler will use + # if there is no -C arg given to ctest: + SET(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") + IF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + SET(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") + ENDIF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + + IF(NOT "${CMAKE_GENERATOR}" MATCHES "Make") + SET(CTEST_USE_LAUNCHERS 0) + ENDIF(NOT "${CMAKE_GENERATOR}" MATCHES "Make") + IF(CTEST_USE_LAUNCHERS) + SET(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OBJECT> --source <SOURCE> --language <LANGUAGE> --") + SET(CTEST_LAUNCH_LINK "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE> --") + SET(CTEST_LAUNCH_CUSTOM "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OUTPUT> --") + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}") + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}") + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}") + ENDIF(CTEST_USE_LAUNCHERS) + + MARK_AS_ADVANCED( + COVERAGE_COMMAND + CVSCOMMAND + SVNCOMMAND + BZRCOMMAND + HGCOMMAND + GITCOMMAND + CVS_UPDATE_OPTIONS + SVN_UPDATE_OPTIONS + BZR_UPDATE_OPTIONS + MAKECOMMAND + MEMORYCHECK_COMMAND + MEMORYCHECK_SUPPRESSIONS_FILE + PURIFYCOMMAND + SCPCOMMAND + SLURM_SBATCH_COMMAND + SLURM_SRUN_COMMAND + SITE + CTEST_SUBMIT_RETRY_DELAY + CTEST_SUBMIT_RETRY_COUNT + ) + # BUILDNAME + IF(NOT RUN_FROM_DART) + SET(RUN_FROM_CTEST_OR_DART 1) + INCLUDE(CTestTargets) + SET(RUN_FROM_CTEST_OR_DART) + ENDIF(NOT RUN_FROM_DART) +ENDIF(BUILD_TESTING) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake new file mode 100755 index 0000000..e949350 --- /dev/null +++ b/config/cmake/CTestCustom.cmake @@ -0,0 +1,516 @@ +SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500) + +SET (CTEST_CUSTOM_WARNING_EXCEPTION + ${CTEST_CUSTOM_WARNING_EXCEPTION} + "H5detect.c.[0-9]+.[ \t]*:[ \t]*warning C4090" + "H5detect.c.[0-9]+.[ \t]*:[ \t]*warning:[ \t]*passing argument" + "H5detect.c[0-9 \t:]*warning:[ \t]*passing argument" + "H5Tconv.c[0-9 \t:]*warning:[ \t]*comparison is always false due to limited range of data type" + "testhdf5.h.[0-9]+.[ \t]*:[ \t]*warning C4005" + "H5Ztrans.c.[0-9]+.[ \t]*:[ \t]*warning C4244" + "SZIP.src.*:[ \t]*warning" + "POSIX name for this item is deprecated" + "disabling jobserver mode" +) + +SET (CTEST_CUSTOM_MEMCHECK_IGNORE + ${CTEST_CUSTOM_MEMCHECK_IGNORE} + flush1 #designed to fail + flush2 #designed to need flush1 + error_test #uses runTest.cmake + err_compat #uses runTest.cmake + links_env #uses runTest.cmake + h5test-clear-objects + h5perform-clear-objects + hl_test-clear-objects + hl_fortran_test-clear-objects + ######### tools/h5copy ######### + H5COPY-clearall-objects + H5COPY-H5LS_h5copytst-basic #uses runTest.cmake + H5COPY-clear-refs + H5COPY-region_ref #needs clear-refs + H5COPY-H5LS_h5copy_ref-refs #uses runTest.cmake + H5COPY-clear-ext-links + H5COPY-ext_link #needs clear-ext-links + H5COPY-ext_link_f #needs clear-ext-links + H5COPY-ext_dangle_noobj #needs clear-ext-links + H5COPY-ext_dangle_noobj_f #needs clear-ext-links + H5COPY-ext_dangle_nofile #needs clear-ext-links + H5COPY-ext_dangle_nofile_f #needs clear-ext-links + H5COPY-ext_link_group #needs clear-ext-links + H5COPY-ext_link_group_f #needs clear-ext-links + H5COPY-H5LS_h5copy_extlinks_src-links #uses runTest.cmake + H5COPY-clear-misc + H5COPY-CMP-h5copy_misc1 #uses runTest.cmake + ######### tools/h5diff ######### + H5DIFF-clearall-objects + H5DIFF-h5diff_10 #uses runTest.cmake + H5DIFF-h5diff_11 #uses runTest.cmake + H5DIFF-h5diff_12 #uses runTest.cmake + H5DIFF-h5diff_13 #uses runTest.cmake + H5DIFF-h5diff_14 #uses runTest.cmake + H5DIFF-h5diff_15 #uses runTest.cmake + H5DIFF-h5diff_16_1 #uses runTest.cmake + H5DIFF-h5diff_16_2 #uses runTest.cmake + H5DIFF-h5diff_16_3 #uses runTest.cmake + H5DIFF-h5diff_17 #uses runTest.cmake + H5DIFF-h5diff_171 #uses runTest.cmake + H5DIFF-h5diff_172 #uses runTest.cmake + H5DIFF-h5diff_18 #uses runTest.cmake + H5DIFF-h5diff_18_1 #uses runTest.cmake + H5DIFF-h5diff_20 #uses runTest.cmake + H5DIFF-h5diff_21 #uses runTest.cmake + H5DIFF-h5diff_22 #uses runTest.cmake + H5DIFF-h5diff_23 #uses runTest.cmake + H5DIFF-h5diff_24 #uses runTest.cmake + H5DIFF-h5diff_25 #uses runTest.cmake + H5DIFF-h5diff_26 #uses runTest.cmake + H5DIFF-h5diff_27 #uses runTest.cmake + H5DIFF-h5diff_28 #uses runTest.cmake + H5DIFF-h5diff_50 #uses runTest.cmake + H5DIFF-h5diff_51 #uses runTest.cmake + H5DIFF-h5diff_52 #uses runTest.cmake + H5DIFF-h5diff_53 #uses runTest.cmake + H5DIFF-h5diff_54 #uses runTest.cmake + H5DIFF-h5diff_55 #uses runTest.cmake + H5DIFF-h5diff_56 #uses runTest.cmake + H5DIFF-h5diff_57 #uses runTest.cmake + H5DIFF-h5diff_58 #uses runTest.cmake + H5DIFF-h5diff_600 #uses runTest.cmake + H5DIFF-h5diff_601 #uses runTest.cmake + H5DIFF-h5diff_603 #uses runTest.cmake + H5DIFF-h5diff_604 #uses runTest.cmake + H5DIFF-h5diff_605 #uses runTest.cmake + H5DIFF-h5diff_606 #uses runTest.cmake + H5DIFF-h5diff_607 #uses runTest.cmake + H5DIFF-h5diff_608 #uses runTest.cmake + H5DIFF-h5diff_609 #uses runTest.cmake + H5DIFF-h5diff_610 #uses runTest.cmake + H5DIFF-h5diff_612 #uses runTest.cmake + H5DIFF-h5diff_613 #uses runTest.cmake + H5DIFF-h5diff_614 #uses runTest.cmake + H5DIFF-h5diff_615 #uses runTest.cmake + H5DIFF-h5diff_616 #uses runTest.cmake + H5DIFF-h5diff_617 #uses runTest.cmake + H5DIFF-h5diff_618 #uses runTest.cmake + H5DIFF-h5diff_619 #uses runTest.cmake + H5DIFF-h5diff_621 #uses runTest.cmake + H5DIFF-h5diff_622 #uses runTest.cmake + H5DIFF-h5diff_623 #uses runTest.cmake + H5DIFF-h5diff_624 #uses runTest.cmake + H5DIFF-h5diff_625 #uses runTest.cmake + H5DIFF-h5diff_626 #uses runTest.cmake + H5DIFF-h5diff_627 #uses runTest.cmake + H5DIFF-h5diff_628 #uses runTest.cmake + H5DIFF-h5diff_70 #uses runTest.cmake + H5DIFF-h5diff_80 #uses runTest.cmake + H5DIFF-h5diff_90 #uses runTest.cmake + H5DIFF-h5diff_101 #uses runTest.cmake + H5DIFF-h5diff_102 #uses runTest.cmake + H5DIFF-h5diff_200 #uses runTest.cmake + H5DIFF-h5diff_201 #uses runTest.cmake + H5DIFF-h5diff_202 #uses runTest.cmake + H5DIFF-h5diff_203 #uses runTest.cmake + H5DIFF-h5diff_204 #uses runTest.cmake + H5DIFF-h5diff_205 #uses runTest.cmake + H5DIFF-h5diff_206 #uses runTest.cmake + H5DIFF-h5diff_207 #uses runTest.cmake + H5DIFF-h5diff_300 #uses runTest.cmake + H5DIFF-h5diff_400 #uses runTest.cmake + H5DIFF-h5diff_401 #uses runTest.cmake + H5DIFF-h5diff_402 #uses runTest.cmake + H5DIFF-h5diff_403 #uses runTest.cmake + H5DIFF-h5diff_404 #uses runTest.cmake + H5DIFF-h5diff_405 #uses runTest.cmake + H5DIFF-h5diff_406 #uses runTest.cmake + H5DIFF-h5diff_407 #uses runTest.cmake + H5DIFF-h5diff_408 #uses runTest.cmake + H5DIFF-h5diff_409 #uses runTest.cmake + H5DIFF-h5diff_410 #uses runTest.cmake + H5DIFF-h5diff_411 #uses runTest.cmake + H5DIFF-h5diff_412 #uses runTest.cmake + H5DIFF-h5diff_413 #uses runTest.cmake + H5DIFF-h5diff_414 #uses runTest.cmake + H5DIFF-h5diff_415 #uses runTest.cmake + H5DIFF-h5diff_416 #uses runTest.cmake + H5DIFF-h5diff_417 #uses runTest.cmake + H5DIFF-h5diff_418 #uses runTest.cmake + H5DIFF-h5diff_419 #uses runTest.cmake + H5DIFF-h5diff_420 #uses runTest.cmake + H5DIFF-h5diff_421 #uses runTest.cmake + H5DIFF-h5diff_422 #uses runTest.cmake + H5DIFF-h5diff_423 #uses runTest.cmake + H5DIFF-h5diff_424 #uses runTest.cmake + H5DIFF-h5diff_425 #uses runTest.cmake + H5DIFF-h5diff_450 #uses runTest.cmake + H5DIFF-h5diff_451 #uses runTest.cmake + H5DIFF-h5diff_452 #uses runTest.cmake + H5DIFF-h5diff_453 #uses runTest.cmake + H5DIFF-h5diff_454 #uses runTest.cmake + H5DIFF-h5diff_455 #uses runTest.cmake + H5DIFF-h5diff_456 #uses runTest.cmake + H5DIFF-h5diff_457 #uses runTest.cmake + H5DIFF-h5diff_458 #uses runTest.cmake + H5DIFF-h5diff_459 #uses runTest.cmake + H5DIFF-h5diff_500 #uses runTest.cmake + H5DIFF-h5diff_501 #uses runTest.cmake + H5DIFF-h5diff_502 #uses runTest.cmake + H5DIFF-h5diff_503 #uses runTest.cmake + H5DIFF-h5diff_504 #uses runTest.cmake + H5DIFF-h5diff_505 #uses runTest.cmake + H5DIFF-h5diff_506 #uses runTest.cmake + H5DIFF-h5diff_507 #uses runTest.cmake + H5DIFF-h5diff_508 #uses runTest.cmake + H5DIFF-h5diff_509 #uses runTest.cmake + H5DIFF-h5diff_510 #uses runTest.cmake + H5DIFF-h5diff_511 #uses runTest.cmake + H5DIFF-h5diff_512 #uses runTest.cmake + H5DIFF-h5diff_513 #uses runTest.cmake + H5DIFF-h5diff_514 #uses runTest.cmake + H5DIFF-h5diff_515 #uses runTest.cmake + H5DIFF-h5diff_516 #uses runTest.cmake + H5DIFF-h5diff_517 #uses runTest.cmake + H5DIFF-h5diff_518 #uses runTest.cmake + H5DIFF-h5diff_480 #uses runTest.cmake + H5DIFF-h5diff_481 #uses runTest.cmake + H5DIFF-h5diff_482 #uses runTest.cmake + H5DIFF-h5diff_483 #uses runTest.cmake + H5DIFF-h5diff_484 #uses runTest.cmake + H5DIFF-h5diff_530 #uses runTest.cmake + ######### tools/h5dump ######### + H5DUMP-clearall-objects + H5DUMP-packedbits #uses runTest.cmake + H5DUMP-tgroup-1 #uses runTest.cmake + H5DUMP-tgroup-2 #uses runTest.cmake + H5DUMP-tdset-1 #uses runTest.cmake + H5DUMP-tdset-2 #uses runTest.cmake + H5DUMP-tattr-1 #uses runTest.cmake + H5DUMP-tattr-2 #uses runTest.cmake + H5DUMP-tattr-3 #uses runTest.cmake + H5DUMP-tnamed_dtype_attr #uses runTest.cmake + H5DUMP-tslink-1 #uses runTest.cmake + H5DUMP-tudlink-1 #uses runTest.cmake + H5DUMP-tslink-2 #uses runTest.cmake + H5DUMP-tudlink-2 #uses runTest.cmake + H5DUMP-thlink-1 #uses runTest.cmake + H5DUMP-thlink-2 #uses runTest.cmake + H5DUMP-thlink-3 #uses runTest.cmake + H5DUMP-thlink-4 #uses runTest.cmake + H5DUMP-thlink-5 #uses runTest.cmake + H5DUMP-tcomp-1 #uses runTest.cmake + H5DUMP-tcomp-2 #uses runTest.cmake + H5DUMP-tcomp-4 #uses runTest.cmake + H5DUMP-tnestcomp-1 #uses runTest.cmake + H5DUMP-tall-1 #uses runTest.cmake + H5DUMP-tall-2 #uses runTest.cmake + H5DUMP-tall-3 #uses runTest.cmake + H5DUMP-tloop-1 #uses runTest.cmake + H5DUMP-tstr-1 #uses runTest.cmake + H5DUMP-tstr-2 #uses runTest.cmake + H5DUMP-tsaf #uses runTest.cmake + H5DUMP-tvldtypes1 #uses runTest.cmake + H5DUMP-tvldtypes2 #uses runTest.cmake + H5DUMP-tvldtypes3 #uses runTest.cmake + H5DUMP-tvldtypes4 #uses runTest.cmake + H5DUMP-tvldtypes5 #uses runTest.cmake + H5DUMP-tvlstr #uses runTest.cmake + H5DUMP-tarray1 #uses runTest.cmake + H5DUMP-tarray2 #uses runTest.cmake + H5DUMP-tarray3 #uses runTest.cmake + H5DUMP-tarray4 #uses runTest.cmake + H5DUMP-tarray5 #uses runTest.cmake + H5DUMP-tarray6 #uses runTest.cmake + H5DUMP-tarray7 #uses runTest.cmake + H5DUMP-tarray8 #uses runTest.cmake + H5DUMP-tempty #uses runTest.cmake + H5DUMP-tgrp_comments #uses runTest.cmake + H5DUMP-tsplit_file #uses runTest.cmake + H5DUMP-tfamily #uses runTest.cmake + H5DUMP-tmulti #uses runTest.cmake + H5DUMP-tlarge_objname #uses runTest.cmake + H5DUMP-tall-2A #uses runTest.cmake + H5DUMP-tall-2B #uses runTest.cmake + H5DUMP-tall-4s #uses runTest.cmake + H5DUMP-tall-5s #uses runTest.cmake + H5DUMP-tdset-3s #uses runTest.cmake + H5DUMP-tchar1 #uses runTest.cmake + H5DUMP-tchar1 #uses runTest.cmake + H5DUMP-tnofilename #uses runTest.cmake + H5DUMP-tboot1 #uses runTest.cmake + H5DUMP-tboot2 #uses runTest.cmake + H5DUMP-tperror #uses runTest.cmake + H5DUMP-tcontents #uses runTest.cmake + H5DUMP-tcompact #uses runTest.cmake + H5DUMP-tcontiguos #uses runTest.cmake + H5DUMP-tchunked #uses runTest.cmake + H5DUMP-texternal #uses runTest.cmake + H5DUMP-tfill #uses runTest.cmake + H5DUMP-treference #uses runTest.cmake + H5DUMP-tstringe #uses runTest.cmake + H5DUMP-tstring #uses runTest.cmake + H5DUMP-tstring2 #uses runTest.cmake + H5DUMP-tindicesyes #uses runTest.cmake + H5DUMP-tindicesno #uses runTest.cmake + H5DUMP-tindicessub1 #uses runTest.cmake + H5DUMP-tindicessub2 #uses runTest.cmake + H5DUMP-tindicessub3 #uses runTest.cmake + H5DUMP-tindicessub4 #uses runTest.cmake + H5DUMP-tszip #uses runTest.cmake + H5DUMP-tdeflate #uses runTest.cmake + H5DUMP-tshuffle #uses runTest.cmake + H5DUMP-tfletcher32 #uses runTest.cmake + H5DUMP-tnbit #uses runTest.cmake + H5DUMP-tscaleoffset #uses runTest.cmake + H5DUMP-tallfilters #uses runTest.cmake + H5DUMP-tuserfilter #uses runTest.cmake + H5DUMP-tlonglinks #uses runTest.cmake + H5DUMP-tbigdims #uses runTest.cmake + H5DUMP-thyperslab #uses runTest.cmake + H5DUMP-tnullspace #uses runTest.cmake + H5DUMP-tvms #uses runTest.cmake + H5DUMP-tbin1LE #uses runTest.cmake + H5DUMP-tbin1 #uses runTest.cmake + H5DUMP-clear-out1 + H5DUMP-h5import-out1 + H5DUMP-h5diff-out1 + H5DUMP-tbin2 #uses runTest.cmake + H5DUMP-tbin3 #uses runTest.cmake + H5DUMP-clear-out3 + H5DUMP-h5import-out3 + H5DUMP-h5diff-out3 + H5DUMP-clear-objects + H5DUMP-tbin4 #uses runTest.cmake + H5DUMP-tdatareg #uses runTest.cmake + H5DUMP-tdataregR #uses runTest.cmake + H5DUMP-tattrreg #uses runTest.cmake + H5DUMP-tattrregR #uses runTest.cmake + H5DUMP-output-tbinregR #uses runTest.cmake + H5DUMP-output-cmp-tbinregR #uses runTest.cmake + H5DUMP-tordergr1 #uses runTest.cmake + H5DUMP-tordergr2 #uses runTest.cmake + H5DUMP-tordergr3 #uses runTest.cmake + H5DUMP-tordergr4 #uses runTest.cmake + H5DUMP-tordergr5 #uses runTest.cmake + H5DUMP-torderattr1 #uses runTest.cmake + H5DUMP-torderattr2 #uses runTest.cmake + H5DUMP-torderattr3 #uses runTest.cmake + H5DUMP-torderattr4 #uses runTest.cmake + H5DUMP-tfpformat #uses runTest.cmake + H5DUMP-textlinksrc #uses runTest.cmake + H5DUMP-textlinkfar #uses runTest.cmake + H5DUMP-textlink #uses runTest.cmake + H5DUMP_PACKED_BITS-clearall-objects + H5DUMP-tpackedbits #uses runTest.cmake + H5DUMP-tpackedbits2 #uses runTest.cmake + H5DUMP-tnofilename-with-packed-bits #uses runTest.cmake + H5DUMP-tpbitsSigned #uses runTest.cmake + H5DUMP-tpbitsUnsigned #uses runTest.cmake + H5DUMP-tpbitsOverlapped #uses runTest.cmake + H5DUMP-tpbitsMax #uses runTest.cmake + H5DUMP-tpbitsCompound #uses runTest.cmake + H5DUMP-tpbitsArray #uses runTest.cmake + H5DUMP-tpbitsMaxExceeded #uses runTest.cmake + H5DUMP-tpbitsOffsetExceeded #uses runTest.cmake + H5DUMP-tpbitsOffsetNegative #uses runTest.cmake + H5DUMP-tpbitsLengthPositive #uses runTest.cmake + H5DUMP-tpbitsLengthExceeded #uses runTest.cmake + H5DUMP-tpbitsIncomplete #uses runTest.cmake + H5DUMP-XML-clearall-objects + H5DUMP-XML-tall.h5 #uses runTest.cmake + H5DUMP-XML-tattr.h5 #uses runTest.cmake + H5DUMP-XML-tbitfields.h5 #uses runTest.cmake + H5DUMP-XML-tcompound.h5 #uses runTest.cmake + H5DUMP-XML-tcompound2.h5 #uses runTest.cmake + H5DUMP-XML-tdatareg.h5 #uses runTest.cmake + H5DUMP-XML-tdset.h5 #uses runTest.cmake + H5DUMP-XML-tdset2.h5 #uses runTest.cmake + H5DUMP-XML-tenum.h5 #uses runTest.cmake + H5DUMP-XML-tgroup.h5 #uses runTest.cmake + H5DUMP-XML-thlink.h5 #uses runTest.cmake + H5DUMP-XML-tloop.h5 #uses runTest.cmake + H5DUMP-XML-tloop2.h5 #uses runTest.cmake + H5DUMP-XML-tmany.h5 #uses runTest.cmake + H5DUMP-XML-tnestedcomp.h5 #uses runTest.cmake + H5DUMP-XML-tcompound_complex.h5 #uses runTest.cmake + H5DUMP-XML-tobjref.h5 #uses runTest.cmake + H5DUMP-XML-topaque.h5 #uses runTest.cmake + H5DUMP-XML-tslink.h5 #uses runTest.cmake + H5DUMP-XML-tudlink.h5 #uses runTest.cmake + H5DUMP-XML-textlink.h5 #uses runTest.cmake + H5DUMP-XML-tstr.h5 #uses runTest.cmake + H5DUMP-XML-tstr2.h5 #uses runTest.cmake + H5DUMP-XML-tref.h5 #uses runTest.cmake + H5DUMP-XML-tname-amp.h5 #uses runTest.cmake + H5DUMP-XML-tname-apos.h5 #uses runTest.cmake + H5DUMP-XML-tname-gt.h5 #uses runTest.cmake + H5DUMP-XML-tname-lt.h5 #uses runTest.cmake + H5DUMP-XML-tname-quot.h5 #uses runTest.cmake + H5DUMP-XML-tname-sp.h5 #uses runTest.cmake + H5DUMP-XML-tstring.h5 #uses runTest.cmake + H5DUMP-XML-tstring-at.h5 #uses runTest.cmake + H5DUMP-XML-tref-escapes.h5 #uses runTest.cmake + H5DUMP-XML-tref-escapes-at.h5 #uses runTest.cmake + H5DUMP-XML-tnodata.h5 #uses runTest.cmake + H5DUMP-XML-tarray1.h5 #uses runTest.cmake + H5DUMP-XML-tarray2.h5 #uses runTest.cmake + H5DUMP-XML-tarray3.h5 #uses runTest.cmake + H5DUMP-XML-tarray6.h5 #uses runTest.cmake + H5DUMP-XML-tarray7.h5 #uses runTest.cmake + H5DUMP-XML-tvldtypes1.h5 #uses runTest.cmake + H5DUMP-XML-tvldtypes2.h5 #uses runTest.cmake + H5DUMP-XML-tvldtypes3.h5 #uses runTest.cmake + H5DUMP-XML-tvldtypes4.h5 #uses runTest.cmake + H5DUMP-XML-tvldtypes5.h5 #uses runTest.cmake + H5DUMP-XML-tvlstr.h5 #uses runTest.cmake + H5DUMP-XML-tsaf.h5 #uses runTest.cmake + H5DUMP-XML-tempty.h5 #uses runTest.cmake + H5DUMP-XML-tnamed_dtype_attr.h5 #uses runTest.cmake + H5DUMP-XML-tempty-dtd.h5 #uses runTest.cmake + H5DUMP-XML-tempty-dtd-2.h5 #uses runTest.cmake + H5DUMP-XML-tempty-nons.h5 #uses runTest.cmake + H5DUMP-XML-tempty-nons-2.h5 #uses runTest.cmake + H5DUMP-XML-tempty-ns.h5 #uses runTest.cmake + H5DUMP-XML-tempty-ns-2.h5 #uses runTest.cmake + H5DUMP-XML-tempty-nons-uri.h5 #uses runTest.cmake + H5DUMP-XML-tempty-dtd-uri.h5 #uses runTest.cmake + H5DUMP-XML-tall-2A.h5 #uses runTest.cmake + H5DUMP-XML-torderattr1.h5 #uses runTest.cmake + H5DUMP-XML-torderattr2.h5 #uses runTest.cmake + H5DUMP-XML-torderattr3.h5 #uses runTest.cmake + H5DUMP-XML-torderattr4.h5 #uses runTest.cmake + H5DUMP-XML-tfpformat.h5 #uses runTest.cmake + ######### tools/h5import ######### + H5IMPORT-clear-objects + ######### tools/h5ls ######### + H5LS-clearall-objects + H5LS-help-1 #uses runTest.cmake + H5LS-help-2 #uses runTest.cmake + H5LS-help-3 #uses runTest.cmake + H5LS-tall-1 #uses runTest.cmake + H5LS-tall-2 #uses runTest.cmake + H5LS-tgroup #uses runTest.cmake + H5LS-tgroup-3 #uses runTest.cmake + H5LS-tgroup-1 #uses runTest.cmake + H5LS-tgroup-2 #uses runTest.cmake + H5LS-tdset-1 #uses runTest.cmake + H5LS-tslink-1 #uses runTest.cmake + H5LS-tsoftlinks-1 #uses runTest.cmake + H5LS-tsoftlinks-2 #uses runTest.cmake + H5LS-tsoftlinks-3 #uses runTest.cmake + H5LS-tsoftlinks-4 #uses runTest.cmake + H5LS-tsoftlinks-5 #uses runTest.cmake + H5LS-textlink-1 #uses runTest.cmake + H5LS-textlinksrc-1 #uses runTest.cmake + H5LS-textlinksrc-2 #uses runTest.cmake + H5LS-textlinksrc-3 #uses runTest.cmake + H5LS-textlinksrc-4 #uses runTest.cmake + H5LS-textlinksrc-5 #uses runTest.cmake + H5LS-textlinksrc-6 #uses runTest.cmake + H5LS-textlinksrc-7 #uses runTest.cmake + H5LS-tudlink-1 #uses runTest.cmake + H5LS-textlinksrc-1-old #uses runTest.cmake + H5LS-textlinksrc-2-old #uses runTest.cmake + H5LS-textlinksrc-3-old #uses runTest.cmake + H5LS-textlinksrc-6-old #uses runTest.cmake + H5LS-textlinksrc-7-old #uses runTest.cmake + H5LS-textlinksrc-nodangle-1 #uses runTest.cmake + H5LS-textlinksrc-nodangle-2 #uses runTest.cmake + H5LS-tsoftlinks-nodangle-1 #uses runTest.cmake + H5LS-thlinks-nodangle-1 #uses runTest.cmake + H5LS-thlink-1 #uses runTest.cmake + H5LS-tcomp-1 #uses runTest.cmake + H5LS-tnestcomp-1 #uses runTest.cmake + H5LS-tnestcomp-2 #uses runTest.cmake + H5LS-tnestcomp-3 #uses runTest.cmake + H5LS-tnestcomp-4 #uses runTest.cmake + H5LS-tloop-1 #uses runTest.cmake + H5LS-tstr-1 #uses runTest.cmake + H5LS-tsaf #uses runTest.cmake + H5LS-tvldtypes1 #uses runTest.cmake + H5LS-tarray1 #uses runTest.cmake + H5LS-tempty #uses runTest.cmake + H5LS-tattr2 #uses runTest.cmake + H5LS-nosuchfile #uses runTest.cmake + H5LS-tvldtypes2le #uses runTest.cmake + H5LS-tdataregle #uses runTest.cmake + ######### tools/h5repack ######### + H5REPACK-clearall-objects + H5REPACK-gzip_verbose_filters #uses runTest.cmake + H5REPACK_VERIFY_LAYOUT-dset2_chunk_20x10 #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT_ALL-chunk_20x10 #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset2_conti #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT_ALL-conti #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset2_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT_ALL-compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_compa_conti #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_compa_chunk #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_compa_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_conti_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_conti_chunk #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-dset_conti_conti #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-chunk_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-chunk_conti #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-chunk_18x13 #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-contig_small_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT-contig_small_fixed_compa #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT_ALL-layout_long_switches #uses grepTest.cmake + H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake + ######### tools/h5stat ######### + H5STAT-clearall-objects + H5STAT-h5stat_help1 #uses runTest.cmake + H5STAT-h5stat_help2 #uses runTest.cmake + H5STAT-h5stat_filters #uses runTest.cmake + H5STAT-h5stat_filters-file #uses runTest.cmake + H5STAT-h5stat_filters-F #uses runTest.cmake + H5STAT-h5stat_filters-d #uses runTest.cmake + H5STAT-h5stat_filters-g #uses runTest.cmake + H5STAT-h5stat_filters-dT #uses runTest.cmake + H5STAT-h5stat_filters-UD #uses runTest.cmake + H5STAT-h5stat_filters-UT #uses runTest.cmake + H5STAT-h5stat_tsohm #uses runTest.cmake + H5STAT-h5stat_newgrat #uses runTest.cmake + H5STAT-h5stat_newgrat-UG #uses runTest.cmake + H5STAT-h5stat_newgrat-UA #uses runTest.cmake + ######### tools/misc ######### + h5repart_20K-clear-objects + h5repart_5K-clear-objects + h5repart_sec2-clear-objects + H5MKGRP-h5mkgrp_help #uses runTest.cmake + H5MKGRP-h5mkgrp_version #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_single + H5MKGRP-h5mkgrp_single #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_single #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_single-v + H5MKGRP-h5mkgrp_single-v #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_single-v #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_single-p + H5MKGRP-h5mkgrp_single-p #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_single-p #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_single_latest-l + H5MKGRP-h5mkgrp_single_latest-l #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_single_latest-l #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_several + H5MKGRP-h5mkgrp_several #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_several #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_several-v + H5MKGRP-h5mkgrp_several-v #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_several-v #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_several-p + H5MKGRP-h5mkgrp_several-p #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_several-p #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_several_latest-l + H5MKGRP-h5mkgrp_several_latest-l #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_several_latest-l #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_nested-p + H5MKGRP-h5mkgrp_nested-p #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_nested-p #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_nested_latest-lp + H5MKGRP-h5mkgrp_nested_latest-lp #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_nested_latest-lp #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_nested_mult-p + H5MKGRP-h5mkgrp_nested_mult-p #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_nested_mult-p #uses runTest.cmake + H5MKGRP-clear-h5mkgrp_nested_mult_latest-lp + H5MKGRP-h5mkgrp_nested_mult_latest-lp #uses runTest.cmake + H5MKGRP-H5LS-h5mkgrp_nested_mult_latest-lp #uses runTest.cmake +) diff --git a/config/cmake/CTestCustom.ctest b/config/cmake/CTestCustom.ctest deleted file mode 100755 index acb1918..0000000 --- a/config/cmake/CTestCustom.ctest +++ /dev/null @@ -1,19 +0,0 @@ -SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500) - -SET (CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} - "H5detect.c.[0-9]+.[ ]*: warning C4090:" - "testhdf5.h.[0-9]+.[ ]*: warning C4005:" - "POSIX name for this item is deprecated" - "disabling jobserver mode" -) - -SET (CTEST_CUSTOM_MEMCHECK_IGNORE - ${CTEST_CUSTOM_MEMCHECK_IGNORE} - H5DUMP - H5DIFF - H5REPACK - H5STAT - H5COPY - H5LS -) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index b78d2c0..cea7bf9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -161,8 +161,6 @@ ELSE (WINDOWS) SET (H5_DEFAULT_VFD H5FD_SEC2) ENDIF (WINDOWS) -#----------------------------------------------------------------------------- -# Check for some functions that are used IF (WINDOWS) SET (H5_HAVE_IO_H 1) SET (H5_HAVE_SETJMP_H 1) @@ -204,17 +202,16 @@ ENDIF (CYGWIN) # Check for the math library "m" #----------------------------------------------------------------------------- IF (NOT WINDOWS) - CHECK_LIBRARY_EXISTS_CONCAT ("m" printf H5_HAVE_LIBM) + CHECK_LIBRARY_EXISTS_CONCAT ("m" random H5_HAVE_LIBM) ENDIF (NOT WINDOWS) -CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" printf H5_HAVE_LIBWS2_32) -CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" printf H5_HAVE_LIBWSOCK32) +CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32) +CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32) #CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen H5_HAVE_LIBDL) CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname H5_HAVE_LIBUCB) CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect H5_HAVE_LIBSOCKET) CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL) - IF (NOT NOT_NEED_LIBNSL) CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname H5_HAVE_LIBNSL) ENDIF (NOT NOT_NEED_LIBNSL) @@ -285,22 +282,21 @@ ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) # Check for large file support #----------------------------------------------------------------------------- +# The linux-lfs option is deprecated. SET (LINUX_LFS 0) + SET (HDF5_EXTRA_FLAGS) IF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.") # Linux Specific flags - ADD_DEFINITIONS (-D_POSIX_SOURCE -D_BSD_SOURCE) + SET (HDF5_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE) OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) IF (HDF5_ENABLE_LARGE_FILE) SET (LARGEFILE 1) - SET (HDF5_EXTRA_FLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - SET (CMAKE_REQUIRED_DEFINITIONS ${HDF5_EXTRA_FLAGS}) + SET (HDF5_EXTRA_FLAGS ${HDF5_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) ENDIF (HDF5_ENABLE_LARGE_FILE) + SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF5_EXTRA_FLAGS}) ENDIF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.") -IF (LINUX_LFS) - SET (HDF5_EXTRA_FLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - SET (CMAKE_REQUIRED_DEFINITIONS ${HDF5_EXTRA_FLAGS}) -ENDIF (LINUX_LFS) + ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS}) #----------------------------------------------------------------------------- @@ -422,6 +418,15 @@ CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64) CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64) #----------------------------------------------------------------------------- +# sigsetjmp is special; may actually be a macro +IF (NOT H5_HAVE_SIGSETJMP) + IF (H5_HAVE_SETJMP_H) + CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" H5_HAVE_MACRO_SIGSETJMP) + IF (H5_HAVE_MACRO_SIGSETJMP) + SET (H5_HAVE_SIGSETJMP 1) + ENDIF (H5_HAVE_MACRO_SIGSETJMP) + ENDIF (H5_HAVE_SETJMP_H) +ENDIF (NOT H5_HAVE_SIGSETJMP) #----------------------------------------------------------------------------- # Since gettimeofday is not defined any where standard, lets look in all the @@ -437,6 +442,7 @@ IF (NOT MSVC) ) IF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") SET (H5_HAVE_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_TIME_GETTIMEOFDAY") + SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") ENDIF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") ENDIF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") @@ -449,19 +455,19 @@ IF (NOT MSVC) ) IF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") SET (H5_HAVE_SYS_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_SYS_TIME_GETTIMEOFDAY") + SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") ENDIF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") ENDIF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") -ENDIF (NOT MSVC) - -IF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY AND NOT MSVC) - MESSAGE (STATUS "---------------------------------------------------------------") - MESSAGE (STATUS "Function 'gettimeofday()' was not found. HDF5 will use its") - MESSAGE (STATUS " own implementation.. This can happen on older versions of") - MESSAGE (STATUS " MinGW on Windows. Consider upgrading your MinGW installation") - MESSAGE (STATUS " to a newer version such as MinGW 3.12") - MESSAGE (STATUS "---------------------------------------------------------------") -ENDIF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY AND NOT MSVC) + IF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) + MESSAGE (STATUS "---------------------------------------------------------------") + MESSAGE (STATUS "Function 'gettimeofday()' was not found. HDF5 will use its") + MESSAGE (STATUS " own implementation.. This can happen on older versions of") + MESSAGE (STATUS " MinGW on Windows. Consider upgrading your MinGW installation") + MESSAGE (STATUS " to a newer version such as MinGW 3.12") + MESSAGE (STATUS "---------------------------------------------------------------") + ENDIF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) +ENDIF (NOT MSVC) # Check for Symbols CHECK_SYMBOL_EXISTS (tzname "time.h" H5_HAVE_DECL_TZNAME) @@ -509,11 +515,11 @@ MACRO (HDF5_FUNCTION_TEST OTHER_TEST) ENDIF ("${def}") ENDFOREACH (def) - IF (LINUX_LFS) + IF (LARGEFILE) SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - ENDIF (LINUX_LFS) + ENDIF (LARGEFILE) # (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} @@ -617,41 +623,41 @@ ENDIF (INLINE_TEST___inline__) # Check how to print a Long Long integer #----------------------------------------------------------------------------- IF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") - SET (PRINT_LL_FOUND 0) - MESSAGE (STATUS "Checking for appropriate format for 64 bit long:") - FOREACH (HDF5_PRINTF_LL l64 l L q I64 ll) - SET (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}") - IF (H5_SIZEOF_LONG_LONG) - SET (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - ENDIF (H5_SIZEOF_LONG_LONG) - TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE - ${HDF5_BINARY_DIR}/CMake - ${HDF5_RESOURCES_DIR}/HDF5Tests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT - ) - IF (HDF5_PRINTF_LL_TEST_COMPILE) - IF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - SET (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - SET (PRINT_LL_FOUND 1) - ELSE (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - MESSAGE ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}") - ENDIF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - ELSE (HDF5_PRINTF_LL_TEST_COMPILE) - FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test H5_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n" - ) - ENDIF (HDF5_PRINTF_LL_TEST_COMPILE) - ENDFOREACH (HDF5_PRINTF_LL) - - IF (PRINT_LL_FOUND) - MESSAGE (STATUS "Checking for apropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}") - ELSE (PRINT_LL_FOUND) - MESSAGE (STATUS "Checking for apropriate format for 64 bit long: not found") - SET (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" + SET (PRINT_LL_FOUND 0) + MESSAGE (STATUS "Checking for appropriate format for 64 bit long:") + FOREACH (HDF5_PRINTF_LL l64 l L q I64 ll) + SET (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}") + IF (H5_SIZEOF_LONG_LONG) + SET (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") + ENDIF (H5_SIZEOF_LONG_LONG) + TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE + ${HDF5_BINARY_DIR}/CMake + ${HDF5_RESOURCES_DIR}/HDF5Tests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} + OUTPUT_VARIABLE OUTPUT + ) + IF (HDF5_PRINTF_LL_TEST_COMPILE) + IF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) + SET (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") + SET (PRINT_LL_FOUND 1) + ELSE (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) + MESSAGE ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}") + ENDIF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) + ELSE (HDF5_PRINTF_LL_TEST_COMPILE) + FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test H5_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n" ) - ENDIF (PRINT_LL_FOUND) + ENDIF (HDF5_PRINTF_LL_TEST_COMPILE) + ENDFOREACH (HDF5_PRINTF_LL) + + IF (PRINT_LL_FOUND) + MESSAGE (STATUS "Checking for apropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}") + ELSE (PRINT_LL_FOUND) + MESSAGE (STATUS "Checking for apropriate format for 64 bit long: not found") + SET (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL + "Width for printf for type `long long' or `__int64', us. `ll" + ) + ENDIF (PRINT_LL_FOUND) ENDIF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") # ---------------------------------------------------------------------- @@ -684,7 +690,7 @@ MACRO (H5ConversionTests TEST msg) IF (${TEST}_COMPILE) IF (${TEST}_RUN MATCHES 0) SET (${TEST} 1 CACHE INTERNAL ${msg}) - MESSAGE(STATUS "${msg}... yes") + MESSAGE (STATUS "${msg}... yes") ELSE (${TEST}_RUN MATCHES 0) SET (${TEST} "" CACHE INTERNAL ${msg}) MESSAGE (STATUS "${msg}... no") diff --git a/config/cmake/FindHDF5.cmake b/config/cmake/FindHDF5.cmake index 4e448ca..a705d5b 100644 --- a/config/cmake/FindHDF5.cmake +++ b/config/cmake/FindHDF5.cmake @@ -15,11 +15,12 @@ # HDF5_VERSION_MINOR - minor part (e.g. 5)
#
# The following boolean vars will be defined
-# HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported
-# HDF5_BUILD_FORTRAN - 1 if HDF5 was compiled with fortran on
-# HDF5_BUILD_CPP_LIB - 1 if HDF5 was compiled with cpp on
-# HDF5_BUILD_TOOLS - 1 if HDF5 was compiled with tools on
-# HDF5_BUILD_HL_LIB - 1 if HDF5 was compiled with parallel on
+# HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported
+# HDF5_BUILD_FORTRAN - 1 if HDF5 was compiled with fortran on
+# HDF5_BUILD_CPP_LIB - 1 if HDF5 was compiled with cpp on
+# HDF5_BUILD_TOOLS - 1 if HDF5 was compiled with tools on
+# HDF5_BUILD_HL_LIB - 1 if HDF5 was compiled with high level on
+# HDF5_BUILD_HL_CPP_LIB - 1 if HDF5 was compiled with high level and cpp on
#
# Target names that are valid (depending on enabled options)
# will be the following
@@ -35,22 +36,50 @@ # hdf5_hl_cpp : High Level cpp interface library
#
# To aid in finding HDF5 as part of a subproject set
-# HDF5_ROOT_DIR_HINT to the location where HDF5-config.cmake lies
+# HDF5_ROOT_DIR_HINT to the location where hdf5-config.cmake lies
-FIND_PATH (HDF5_ROOT_DIR "HDF5-config.cmake"
- ${HDF5_ROOT_DIR_HINT}
- /usr/local/lib
- /usr/local/lib64
- /usr/lib
- /usr/lib64
- "C:/Program Files/HDF5/lib"
+INCLUDE (SelectLibraryConfigurations)
+INCLUDE (FindPackageHandleStandardArgs)
+
+# The HINTS option should only be used for values computed from the system.
+SET (_HDF5_HINTS
+ $ENV{HOME}/.local
+ $ENV{HDF5_ROOT}
+ $ENV{HDF5_ROOT_DIR_HINT}
+)
+# Hard-coded guesses should still go in PATHS. This ensures that the user
+# environment can always override hard guesses.
+SET (_HDF5_PATHS
+ $ENV{HOME}/.local
+ $ENV{HDF5_ROOT}
+ $ENV{HDF5_ROOT_DIR_HINT}
+ /usr/lib/hdf5
+ /usr/share/hdf5
+ /usr/local/hdf5
+ /usr/local/hdf5/share
)
-FIND_PATH (HDF5_INCLUDE_DIR "H5public.h"
- ${HDF5_ROOT_DIR}/../include
+FIND_PATH (HDF5_ROOT_DIR "hdf5-config.cmake"
+ HINTS ${_HDF5_HINTS}
+ PATHS ${_HDF5_PATHS}
+ PATH_SUFFIXES
+ lib/cmake/hdf5-1.9
+ share/cmake/hdf5-1.9
)
+FIND_PATH (HDF5_INCLUDE_DIRS "H5public.h"
+ HINTS ${_HDF5_HINTS}
+ PATHS ${_HDF5_PATHS}
+ PATH_SUFFIXES
+ include
+ Include
+)
+
+# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
+# HDF5_INCLUDE_DIRS
+SET ( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
+
IF (HDF5_INCLUDE_DIR)
SET (HDF5_FOUND "YES")
- INCLUDE (${HDF5_ROOT_DIR}/HDF5-config.cmake)
+ INCLUDE (${HDF5_ROOT_DIR}/hdf5-config.cmake)
ENDIF (HDF5_INCLUDE_DIR)
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 0c2b084..0dbd1ec 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -16,12 +16,21 @@ /* Defined if HDF5 was built with CMake AND build as a shared library */ #cmakedefine H5_BUILT_AS_DYNAMIC_LIB @H5_BUILT_AS_DYNAMIC_LIB@ +/* Defined if HDF5 was built with CMake AND build as a static library */ +#cmakedefine H5_BUILT_AS_STATIC_LIB @H5_BUILT_AS_STATIC_LIB@ + /* Defined if HDF5 CPP was built with CMake AND build as a shared library */ #cmakedefine H5_CPP_BUILT_AS_DYNAMIC_LIB @H5_CPP_BUILT_AS_DYNAMIC_LIB@ +/* Defined if HDF5 CPP was built with CMake AND build as a static library */ +#cmakedefine H5_CPP_BUILT_AS_STATIC_LIB @H5_CPP_BUILT_AS_STATIC_LIB@ + /* Defined if HDF5 HL was built with CMake AND build as a shared library */ #cmakedefine H5_HL_BUILT_AS_DYNAMIC_LIB @H5_HL_BUILT_AS_DYNAMIC_LIB@ +/* Defined if HDF5 HL was built with CMake AND build as a static library */ +#cmakedefine H5_HL_BUILT_AS_STATIC_LIB @H5_HL_BUILT_AS_STATIC_LIB@ + /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ @@ -188,7 +197,7 @@ /* Define to 1 if you have the `gettimeofday' function declared in time.h . */ #cmakedefine H5_HAVE_TIME_GETTIMEOFDAY @H5_HAVE_TIME_GETTIMEOFDAY@ -/* Define to 1 if you have the `gettimeofday' function declared in time.h . */ +/* Define to 1 if you have the `gettimeofday' function declared in sys/time.h . */ #cmakedefine H5_HAVE_SYS_TIME_GETTIMEOFDAY @H5_HAVE_SYS_TIME_GETTIMEOFDAY@ /* Define to 1 if you have the `get_fpc_csr' function. */ @@ -291,6 +300,9 @@ /* Define to 1 if you have the `rand_r' function. */ #cmakedefine H5_HAVE_RAND_R @H5_HAVE_RAND_R@ +/* Define to 1 if you have the `sigsetjmp' function. */ +#cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@ + /* Define to 1 if you have the <setjmp.h> header file. */ #cmakedefine H5_HAVE_SETJMP_H @H5_HAVE_SETJMP_H@ @@ -306,6 +318,12 @@ /* Define to 1 if you have the `signal' function. */ #cmakedefine H5_HAVE_SIGNAL @H5_HAVE_SIGNAL@ +/* Define to 1 if you have the `sigprocmask' function. */ +#cmakedefine H5_HAVE_SIGPROCMASK @H5_HAVE_SIGPROCMASK@ + +/* Define to 1 if you have the `sigsetjmp' function. */ +#cmakedefine H5_HAVE_SIGSETJMP @H5_HAVE_SIGSETJMP@ + /* Define to 1 if you have the `snprintf' function. */ #cmakedefine H5_HAVE_SNPRINTF @H5_HAVE_SNPRINTF@ @@ -345,7 +363,7 @@ /* Define if `struct timezone' is defined */ #cmakedefine H5_HAVE_STRUCT_TIMEZONE @H5_HAVE_STRUCT_TIMEZONE@ -/* Define to 1 if `struct tm' is a member of `tm_zone'. */ +/* Define to 1 if `tm_zone' is a member of `struct tm'. */ #cmakedefine H5_HAVE_STRUCT_TM_TM_ZONE @H5_HAVE_STRUCT_TM_TM_ZONE@ /* Define if `struct videoconfig' is defined */ @@ -470,6 +488,10 @@ values correctly. */ #cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@ +/* Define if your system converts long double to (unsigned) long values with + special algorithm. */ +#cmakedefine H5_LDOUBLE_TO_LONG_SPECIAL @H5_LDOUBLE_TO_LONG_SPECIAL@ + /* Define if your system can convert long double to unsigned int values correctly. */ #cmakedefine H5_LDOUBLE_TO_UINT_ACCURATE @H5_LDOUBLE_TO_UINT_ACCURATE@ @@ -481,6 +503,10 @@ values correctly. */ #cmakedefine H5_LLONG_TO_LDOUBLE_CORRECT @H5_LLONG_TO_LDOUBLE_CORRECT@ +/* Define if your system can convert (unsigned) long to long double values + with special algorithm. */ +#cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@ @@ -620,6 +646,9 @@ /* The size of `off_t', as computed by sizeof. */ #define H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@ +/* The size of `ptrdiff_t', as computed by sizeof. */ +/* #define H5_SIZEOF_PTRDIFF_T @H5_SIZEOF_PTRDIFF_T@ */ + /* The size of `short', as computed by sizeof. */ #define H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ @@ -730,6 +759,12 @@ # endif #endif +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES + /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine H5_const @@ -742,6 +777,9 @@ /* Define to `long int' if <sys/types.h> does not define. */ #cmakedefine H5_off_t +/* Define to `long' if <sys/types.h> does not define. */ +#cmakedefine H5_ptrdiff_t + /* Define to `unsigned long' if <sys/types.h> does not define. */ #cmakedefine H5_size_t diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 99fbea1..3edb3a2 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -34,16 +34,16 @@ MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) ENDMACRO (IDE_SOURCE_PROPERTIES) #------------------------------------------------------------------------------- -MACRO (H5_NAMING target) +MACRO (H5_NAMING target libtype) IF (WIN32 AND NOT MINGW) - IF (BUILD_SHARED_LIBS) + IF (${libtype} MATCHES "SHARED") IF (H5_LEGACY_NAMING) SET_TARGET_PROPERTIES (${target} PROPERTIES OUTPUT_NAME "dll") SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "${target}") ELSE (H5_LEGACY_NAMING) SET_TARGET_PROPERTIES (${target} PROPERTIES OUTPUT_NAME "${target}dll") ENDIF (H5_LEGACY_NAMING) - ENDIF (BUILD_SHARED_LIBS) + ENDIF (${libtype} MATCHES "SHARED") ENDIF (WIN32 AND NOT MINGW) ENDMACRO (H5_NAMING) @@ -73,8 +73,14 @@ MACRO (H5_SET_LIB_OPTIONS libtarget libname libtype) SET (LIB_DEBUG_NAME "lib${libname}_D") ENDIF (H5_LEGACY_NAMING) ELSE (WIN32 AND NOT MINGW) - SET (LIB_RELEASE_NAME "lib${libname}") - SET (LIB_DEBUG_NAME "lib${libname}_debug") + # if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET (LIB_RELEASE_NAME "${libname}") + SET (LIB_DEBUG_NAME "${libname}_debug") + ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET (LIB_RELEASE_NAME "lib${libname}") + SET (LIB_DEBUG_NAME "lib${libname}_debug") + ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) ENDIF (WIN32 AND NOT MINGW) ENDIF (${libtype} MATCHES "SHARED") @@ -87,16 +93,16 @@ MACRO (H5_SET_LIB_OPTIONS libtarget libname libtype) ) #----- Use MSVC Naming conventions for Shared Libraries - IF (MINGW AND BUILD_SHARED_LIBS) + IF (MINGW AND ${libtype} MATCHES "SHARED") SET_TARGET_PROPERTIES (${libtarget} PROPERTIES IMPORT_SUFFIX ".lib" IMPORT_PREFIX "" PREFIX "" ) - ENDIF (MINGW AND BUILD_SHARED_LIBS) + ENDIF (MINGW AND ${libtype} MATCHES "SHARED") - IF (BUILD_SHARED_LIBS) + IF (${libtype} MATCHES "SHARED") IF (WIN32) SET (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) ELSE (WIN32) @@ -104,7 +110,7 @@ MACRO (H5_SET_LIB_OPTIONS libtarget libname libtype) ENDIF (WIN32) SET_TARGET_PROPERTIES (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${LIBHDF_VERSION}) - ENDIF (BUILD_SHARED_LIBS) + ENDIF (${libtype} MATCHES "SHARED") #-- Apple Specific install_name for libraries IF (APPLE) @@ -121,38 +127,15 @@ MACRO (H5_SET_LIB_OPTIONS libtarget libname libtype) ENDMACRO (H5_SET_LIB_OPTIONS) #------------------------------------------------------------------------------- -MACRO (TARGET_WIN_PROPERTIES target) +MACRO (TARGET_FORTRAN_WIN_PROPERTIES target addlinkflags) IF (WIN32) IF (MSVC) - IF (NOT BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (${target} - PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:MSVCRT" - ) - ENDIF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (${target} + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" + ) ENDIF (MSVC) ENDIF (WIN32) -ENDMACRO (TARGET_WIN_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (TARGET_FORTRAN_WIN_PROPERTIES target) - IF (WIN32) - IF (BUILD_SHARED_LIBS) - IF (MSVC) - SET_TARGET_PROPERTIES (${target} - PROPERTIES - COMPILE_FLAGS "/dll" - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) - ENDIF (MSVC) - ELSE (BUILD_SHARED_LIBS) - IF (MSVC) - SET_TARGET_PROPERTIES (${target} - PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:MSVCRT" - ) - ENDIF (MSVC) - ENDIF (BUILD_SHARED_LIBS) - ENDIF (WIN32) ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 7ca38e1..3375c2b 100755 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -18,18 +18,38 @@ SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE)
-SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+
+SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+
+SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+
+SET (HDF5_USE_H5DUMP_PACKED_BITS OFF CACHE BOOL "Use the PACKED BITS feature in h5dump" FORCE)
SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
+SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+
SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
-SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
-SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+SET (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE)
-SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
-SET (HDF5_USE_H5DUMP_PACKED_BITS OFF CACHE BOOL "Use the PACKED BITS feature in h5dump" FORCE)
+SET (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE)
-SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
+SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE)
+
+SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+
+SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+
+SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+
+SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+
+SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+
+SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index cc3a9b4..9b5148c 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -1,4 +1,4 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared +# grepTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. # arguments checking diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in index 32bab7c..47a119a 100644 --- a/config/cmake/hdf5-config.cmake.build.in +++ b/config/cmake/hdf5-config.cmake.build.in @@ -11,6 +11,10 @@ SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
+SET (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@)
+SET (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@)
+SET (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@)
+SET (BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
#-----------------------------------------------------------------------------
# Directories
@@ -29,6 +33,10 @@ IF (HDF5_BUILD_HL_LIB) SET (HDF5_INCLUDE_DIR_HL ${HDF5_INCLUDE_DIR} )
ENDIF (HDF5_BUILD_HL_LIB)
+IF (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB)
+ SET (HDF5_INCLUDE_DIR_HL_CPP ${HDF5_INCLUDE_DIR} )
+ENDIF (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB)
+
IF (HDF5_BUILD_TOOLS)
SET (HDF5_INCLUDE_DIR_TOOLS ${HDF5_INCLUDE_DIR} )
ENDIF (HDF5_BUILD_TOOLS)
diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in index ba5ba9a..dadbeb6 100644 --- a/config/cmake/hdf5-config.cmake.install.in +++ b/config/cmake/hdf5-config.cmake.install.in @@ -11,6 +11,10 @@ SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
+SET (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@)
+SET (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@)
+SET (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@)
+SET (BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
#-----------------------------------------------------------------------------
# Directories
@@ -29,6 +33,10 @@ IF (HDF5_BUILD_HL_LIB) SET (HDF5_INCLUDE_DIR_HL "@CMAKE_INSTALL_PREFIX@/include/hl" )
ENDIF (HDF5_BUILD_HL_LIB)
+IF (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB)
+ SET (HDF5_INCLUDE_DIR_HL_CPP "@CMAKE_INSTALL_PREFIX@/include/hl/cpp" )
+ENDIF (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB)
+
IF (HDF5_BUILD_TOOLS)
SET (HDF5_INCLUDE_DIR_TOOLS "@CMAKE_INSTALL_PREFIX@/include/tools" )
ENDIF (HDF5_BUILD_TOOLS)
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index a3032e5..ba233e8 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -65,4 +65,4 @@ Clear file buffers before write: @CLEARFILEBUF@ GPFS: @GPFS@ Strict File Format Checks: @STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @INSTRUMENT@ - Linux Large File Support (LFS): @LINUX_LFS@ + Large File Support (LFS): @LARGEFILE@ diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake new file mode 100755 index 0000000..2086991 --- /dev/null +++ b/config/cmake/mccacheinit.cmake @@ -0,0 +1,58 @@ +# This is the CMakeCache file.
+
+########################
+# EXTERNAL cache entries
+########################
+
+SET (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
+
+SET (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE)
+
+SET (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE)
+
+SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE)
+
+SET (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+
+SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE)
+
+SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE)
+
+SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+
+SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+
+SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+
+SET (HDF5_USE_H5DUMP_PACKED_BITS OFF CACHE BOOL "Use the PACKED BITS feature in h5dump" FORCE)
+
+SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE)
+
+SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+
+SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+
+SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
+
+SET (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE)
+
+SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+
+SET (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE)
+
+SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE)
+
+SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+
+SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+
+SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+
+SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+
+SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+
+SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
+
+SET (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE)
+
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index ed415f7..26acc39 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -28,6 +28,10 @@ SET (ERROR_APPEND 1) MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +IF (TEST_ENV_VAR) + SET (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") +ENDIF (TEST_ENV_VAR) + # run the test program, capture the stdout/stderr and the result var EXECUTE_PROCESS ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} @@ -59,11 +63,28 @@ MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}") IF (TEST_MASK) FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - #STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") ENDIF (TEST_MASK) +IF (TEST_MASK_MOD) + FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") + FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +ENDIF (TEST_MASK_MOD) + +IF (TEST_MASK_ERROR) + FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "line [0-9]*" "line (number)" TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +ENDIF (TEST_MASK_ERROR) + IF (TEST_FILTER) FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") @@ -77,14 +98,16 @@ ENDIF (WIN32 AND NOT MINGW) # now compare the output with the reference EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT} ${TEST_REFERENCE} + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} RESULT_VARIABLE TEST_RESULT ) +MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") + # again, if return value is !=0 scream and shout -IF (TEST_RESULT) +IF (NOT ${TEST_RESULT} STREQUAL 0) MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}") -ENDIF (TEST_RESULT) +ENDIF (NOT ${TEST_RESULT} STREQUAL 0) # everything went fine... MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index eaa019a..2e854fb 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -1,5 +1,5 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. +# vfdTest.cmake executes a command and captures the output in a file. Command uses specified VFD. +# Exit status of command can also be compared. # arguments checking IF (NOT TEST_PROGRAM) @@ -18,6 +18,8 @@ IF (NOT TEST_VFD) MESSAGE (FATAL_ERROR "Require TEST_VFD to be defined") ENDIF (NOT TEST_VFD) +SET (ERROR_APPEND 1) + MESSAGE (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") SET (ENV{HDF5_DRIVER} "${TEST_VFD}") @@ -25,12 +27,19 @@ SET (ENV{HDF5_DRIVER} "${TEST_VFD}") EXECUTE_PROCESS ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} + OUTPUT_FILE ${TEST_OUTPUT}_${TEST_VFD}.out + ERROR_FILE ${TEST_OUTPUT}_${TEST_VFD}.err OUTPUT_VARIABLE TEST_ERROR ERROR_VARIABLE TEST_ERROR ) MESSAGE (STATUS "COMMAND Result: ${TEST_RESULT}") +IF (ERROR_APPEND) + FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) + FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") +ENDIF (ERROR_APPEND) + # if the return value is !=${TEST_EXPECT} bail out IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") diff --git a/config/examples.am b/config/examples.am index 30ea717..244e695 100644 --- a/config/examples.am +++ b/config/examples.am @@ -67,7 +67,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/config/ia64-linux-gnu b/config/ia64-linux-gnu index 1961119..519d0fc 100644 --- a/config/ia64-linux-gnu +++ b/config/ia64-linux-gnu @@ -32,7 +32,7 @@ fi # Define RUNPARALLEL if parallel mode is enabled or a parallel compiler used. if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpicc; then - RUNPARALLEL=${RUNPARALLEL="mpirun -np \$\${NPROCS:=3}"} + RUNPARALLEL=${RUNPARALLEL="mpirun -np \$\${NPROCS:=6}"} fi #---------------------------------------------------------------------------- diff --git a/config/ibm-aix b/config/ibm-aix index 134ad8e..ab934a7 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -31,14 +31,16 @@ if test "X-" = "X-$CC"; then fi # Define RUNPARALLEL if parallel mode is enabled or a parallel compiler used. -if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then - RUNPARALLEL=${RUNPARALLEL="env MP_PROCS=\$\${NPROCS:=3} MP_TASKS_PER_NODE=\$\${NPROCS:=3} poe"} -fi - -# Temporary patch for Bug 1678. -q32 binary default to run with smaller memory. +# Define RUNSERIAL: Temporary patch for Bug 1678. -q32 binary default to run +# with smaller memory. # Ask for more memory so that "make check" will pass. Not necessary for -q64 # mode but it does no harm. -RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA"} +if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then + RUNPARALLEL=${RUNPARALLEL="env LDR_CNTRL=MAXDATA=0x20000000@DSA MP_PROCS=\$\${NPROCS:=6} MP_TASKS_PER_NODE=\$\${NPROCS:=6} poe"} + RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA MP_PROCS=1 MP_TASKS_PER_NODE=1 poe"} +else + RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA"} +fi #---------------------------------------------------------------------------- diff --git a/config/ibm-aix6.x b/config/ibm-aix6.x new file mode 100644 index 0000000..104008a --- /dev/null +++ b/config/ibm-aix6.x @@ -0,0 +1,21 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. + +# Configuration file for building on the IBM AIX 6.X platforms. +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + +# Use the generic ibm-aix. +. $srcdir/config/ibm-aix diff --git a/config/ibm-flags b/config/ibm-flags index 9e63f79..5e092b8 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -28,7 +28,7 @@ # if test X = "X$cc_flags_set"; then # Verify this is an IBM XL compiler - cc_version="`$CC $CFLAGS -qversion 2>&1 | grep '^IBM XL C/C++'`" + cc_version="`$CC $CFLAGS -qversion 2>&1 | grep 'IBM XL C/C++'`" if test X != "X$cc_version"; then cc_vendor="XL" cc_version="`$CC $CFLAGS -qversion 2>&1 | sed -n 's/Version: \([0-9\.]*\).*/\1/p'`" diff --git a/config/intel-flags b/config/intel-flags index 5bf06d4..e6a9c31 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -70,13 +70,8 @@ if test "X-icc" = "X-$cc_vendor"; then # Default to C99 standard. H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch}" - # Production - # -Wl,-s to remove all symbols for smaller file - # O3 optimization causes compilation failures on many platforms; - # the problem exists in all versions of the icc compiler up to the latest 9.1 - # I changed optimization flag to default -O2. EIP, 2006-08-15 - #PROD_CFLAGS="-O3 -Wl,-s" - PROD_CFLAGS="-O2 -Wl,-s" + # Production is set to default; see settings for specific version further down + PROD_CFLAGS="-O" PROD_CPPFLAGS= # Debug @@ -98,6 +93,11 @@ fi # Please follow the pattern below by adding new versions at the top, copying # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in + icc-11*) + # -s became obsolete; we also fixed bugs that allow us to enable higher level + # of optimization starting with 1.8.7 + PROD_CFLAGS="-O3" + ;; icc-10*) PROD_CFLAGS="-O1 -Wl,-s" ;; diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 26a0c3a..8f04cf0 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -22,8 +22,14 @@ # The default compiler is `gcc'. if test -z "$CC"; then - CC=gcc - CC_BASENAME=gcc + if test "X-$enable_parallel" = "X-yes"; then + # default to use mpicc which is the defacto MPI compiler name + CC=mpicc + CC_BASENAME=mpicc + else + CC=gcc + CC_BASENAME=gcc + fi fi # Figure out GNU C compiler flags diff --git a/config/lt_vers.am b/config/lt_vers.am index 0d5db8d..7db6cff 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/config/powerpc-ibm-aix5.x b/config/powerpc-ibm-aix5.x index b39fb47..50a4e8c 100644 --- a/config/powerpc-ibm-aix5.x +++ b/config/powerpc-ibm-aix5.x @@ -1,7 +1,6 @@ # -*- shell-script -*- # # Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. # # This file is part of HDF5. The full HDF5 copyright notice, including @@ -18,151 +17,5 @@ # after configure starts and defines, among other things, flags for # the various compile modes. -# Use AIX supplied C compiler by default, xlc for serial, mpcc_r for parallel. -# Make sure this is applied to other API compile options such as C++. -if test "X-" = "X-$CC"; then - if test "X-$enable_parallel" = "X-yes"; then - CC=mpcc_r - CC_BASENAME=mpcc_r - else - CC=xlc - CC_BASENAME=xlc - fi -fi - -# Define RUNPARALLEL if parallel mode is enabled or a parallel compiler used. -if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then - RUNPARALLEL=${RUNPARALLEL="env MP_PROCS=\$\${NPROCS:=3} MP_TASKS_PER_NODE=\$\${NPROCS:=3} poe"} -fi - -# Temporary patch for Bug 1678. -q32 binary default to run with smaller memory. -# Ask for more memory so that "make check" will pass. Not necessary for -q64 -# mode but it does no harm. -RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA"} - - -#---------------------------------------------------------------------------- -# Compiler flags. The CPPFLAGS values should not include package debug -# flags like `-DH5G_DEBUG' since these are added with the -# `--enable-debug' switch of configure. - -case $CC_BASENAME in - xlc|xlc-*|mpcc_r|mpcc_r-*) - # Turn off shared lib option. It causes some test suite to fail. - enable_shared="${enable_shared:-no}" - # Make sure this is applied to other API compile options such as C++. - AM_CFLAGS="$AM_CFLAGS" - H5_CFLAGS="-qlanglvl=stdc99 $H5_CFLAGS" - DEBUG_CFLAGS="-g -qfullpath" - DEBUG_CPPFLAGS= - # -O causes test/dtypes to fail badly. Turn it off for now. - PROD_CFLAGS="" - PROD_CPPFLAGS= - PROFILE_CFLAGS="-g -qfullpath -pg" - PROFILE_CPPFLAGS= - ;; - - gcc) - . $srcdir/config/gnu-flags - ;; - - *) - H5_CFLAGS="$H5_CFLAGS -ansi" - DEBUG_CFLAGS="-g" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O" - PROD_CPPFLAGS= - PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= - ;; -esac - -#---------------------------------------------------------------------------- -# Values for overriding configuration tests when cross compiling. -# This includes compiling on some machines where the serial front end -# compiles for a parallel back end. - -# Set this to `yes' or `no' depending on whether the target is big -# endian or little endian. -hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} -ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} -ac_cv_header_stdc=${ac_cv_header_stdc='yes'} -ac_cv_header_sys_ioctl_h=${ac_cv_header_sys_ioctl_h=yes} - -# cache the sizeof of "standard C types" so that configure can run faster. -ac_cv_sizeof_char=${ac_cv_sizeof_char=1} -ac_cv_sizeof_short=${ac_cv_sizeof_short=2} -ac_cv_sizeof_int=${ac_cv_sizeof_int=4} -ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} -ac_cv_sizeof___int64=${ac_cv_sizeof___int64=8} -ac_cv_sizeof_float=${ac_cv_sizeof_float=4} -ac_cv_sizeof_double=${ac_cv_sizeof_double=8} -ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} -ac_cv_sizeof_int8_t=${ac_cv_sizeof_int8_t=1} -ac_cv_sizeof_uint8_t=${ac_cv_sizeof_uint8_t=1} -ac_cv_sizeof_int_least8_t=${ac_cv_sizeof_int_least8_t=1} -ac_cv_sizeof_uint_least8_t=${ac_cv_sizeof_uint_least8_t=1} -# Do not cache int_fast8_t since the vendor changes often. -ac_cv_sizeof_int16_t=${ac_cv_sizeof_int16_t=2} -ac_cv_sizeof_uint16_t=${ac_cv_sizeof_uint16_t=2} -ac_cv_sizeof_int_least16_t=${ac_cv_sizeof_int_least16_t=2} -ac_cv_sizeof_uint_least16_t=${ac_cv_sizeof_uint_least16_t=2} -# Do not cache int_fast16_t since the vendor changes often. -ac_cv_sizeof_int32_t=${ac_cv_sizeof_int32_t=4} -ac_cv_sizeof_uint32_t=${ac_cv_sizeof_uint32_t=4} -ac_cv_sizeof_int_least32_t=${ac_cv_sizeof_int_least32_t=4} -ac_cv_sizeof_uint_least32_t=${ac_cv_sizeof_uint_least32_t=4} -ac_cv_sizeof_int_fast32_t=${ac_cv_sizeof_int_fast32_t=4} -ac_cv_sizeof_uint_fast32_t=${ac_cv_sizeof_uint_fast32_t=4} -ac_cv_sizeof_int64_t=${ac_cv_sizeof_int64_t=8} -ac_cv_sizeof_uint64_t=${ac_cv_sizeof_uint64_t=8} -ac_cv_sizeof_int_least64_t=${ac_cv_sizeof_int_least64_t=8} -ac_cv_sizeof_uint_least64_t=${ac_cv_sizeof_uint_least64_t=8} -ac_cv_sizeof_int_fast64_t=${ac_cv_sizeof_int_fast64_t=8} -ac_cv_sizeof_uint_fast64_t=${ac_cv_sizeof_uint_fast64_t=8} - -# Don't cache long since it varies between 32 and 64 bits -#ac_cv_sizeof_long=${ac_cv_sizeof_long=4} - -# The default Fortran 90 compiler - -if test "X-" = "X-$FC"; then - if test "X-$enable_parallel" = "X-yes"; then - FC=mpxlf90_r - else - FC=xlf90 - fi -fi - -# While we try to avoid setting FCFLAGS directly for use in compilation, in -# this case we need the -k flag present for some configure checks. As such, -# the configure script saves the user's set FCFLAGS before running, and -# restores them when complete. We must then set up both FCFLAGS and H5_FCFLAGS -# to ensure the flag is present for both configure as well as for the build. -if test "X-" = "X-$f9x_flags_set"; then - F9XSUFFIXFLAG="-qsuffix=f=f90" - FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}" - H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}" - FSEARCH_DIRS="-I./ -I../src" - DEBUG_FCFLAGS="-O" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-O" - f9x_flags_set=yes -fi - -# With poe version 3.2.0.19 or lower(using lpp -l all | grep ppe.poe to check the version number, -# IBM MPI-IO implementation has a bug, -#it cannot generate correct MPI derived datatype. Please uncomment the following line: -#hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'} - -# The default C++ compiler - -# Use AIX supplied C++ compiler by default. -CXX=${CXX=xlC} - -# Added -qweaksymbol to suppress linker messages warning of duplicate -# symbols; these warnings are harmless. - BMR -H5_CXXFLAGS="$H5_CXXFLAGS -qweaksymbol" -AM_CXXFLAGS="$AM_CXXFLAGS" - - +# Use the generic ibm-aix. +. $srcdir/config/ibm-aix @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Id: configure.in 19506 2010-10-04 17:15:30Z lrknox . +# From configure.in Id: configure.in 19833 2010-11-19 21:34:29Z songyulu . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for HDF5 1.9.76. +# Generated by GNU Autoconf 2.68 for HDF5 1.9.80. # # Report bugs to <help@hdfgroup.org>. # @@ -92,6 +92,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -225,11 +226,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -563,8 +571,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.76' -PACKAGE_STRING='HDF5 1.9.76' +PACKAGE_VERSION='1.9.80' +PACKAGE_STRING='HDF5 1.9.80' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -667,7 +675,10 @@ OTOOL LIPO NMEDIT DSYMUTIL +MANIFEST_TOOL RANLIB +ac_ct_AR +DLLTOOL OBJDUMP LN_S NM @@ -839,6 +850,7 @@ ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking +enable_unsupported enable_fortran enable_cxx enable_shared @@ -846,6 +858,7 @@ enable_static with_pic enable_fast_install with_gnu_ld +with_sysroot enable_libtool_lock enable_static_exec enable_sharedlib_rpath @@ -1299,7 +1312,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1437,7 +1450,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.76 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.80 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1507,7 +1520,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.76:";; + short | recursive ) echo "Configuration of HDF5 1.9.80:";; esac cat <<\_ACEOF @@ -1519,6 +1532,7 @@ Optional Features: (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-unsupported Allow unsupported combinations of configure options --enable-fortran Compile the Fortran interface [default=no] --enable-cxx Compile the C++ interface [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] @@ -1590,6 +1604,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). For the following --with-xxx options, you can specify where the header files and libraries are in two different ways: @@ -1693,8 +1709,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.76 -generated by GNU Autoconf 2.67 +HDF5 configure 1.9.80 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1740,7 +1756,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1778,7 +1794,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_fc_try_compile @@ -1824,7 +1840,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1866,7 +1882,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_fc_try_run @@ -1904,7 +1920,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1941,7 +1957,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp @@ -1983,7 +1999,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run @@ -1997,7 +2013,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2015,7 +2031,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -2051,7 +2067,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -2093,7 +2109,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -2106,7 +2122,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2169,7 +2185,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2214,7 +2230,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link @@ -2260,7 +2276,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_fc_try_link @@ -2273,10 +2289,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -2343,7 +2359,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2352,7 +2368,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -2365,7 +2381,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2422,7 +2438,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -2647,7 +2663,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2661,7 +2677,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2721,7 +2737,7 @@ fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member @@ -2736,7 +2752,7 @@ ac_fn_c_check_decl () as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2775,15 +2791,15 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.76, which was -generated by GNU Autoconf 2.67. Invocation command line was +It was created by HDF5 $as_me 1.9.80, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3184,7 +3200,7 @@ am__api_version='1.11' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3361,7 +3377,7 @@ if test "$cross_compiling" != no; then set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -3401,7 +3417,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -3454,7 +3470,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3505,7 +3521,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -3545,7 +3561,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3603,7 +3619,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.76' + VERSION='1.9.80' cat >>confdefs.h <<_ACEOF @@ -3683,7 +3699,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -3717,7 +3733,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -3837,7 +3853,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cached host" >&5 $as_echo_n "checking for cached host... " >&6; } -if test "${hdf5_cv_host+set}" = set; then : +if ${hdf5_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_host="none" @@ -3951,7 +3967,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3991,7 +4007,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4044,7 +4060,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4084,7 +4100,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4143,7 +4159,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4187,7 +4203,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4470,7 +4486,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4521,7 +4537,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4558,7 +4574,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -4636,7 +4652,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4797,7 +4813,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4922,6 +4938,27 @@ fi CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if unsupported combinations of configure options are allowed" >&5 +$as_echo_n "checking if unsupported combinations of configure options are allowed... " >&6; } +# Check whether --enable-unsupported was given. +if test "${enable_unsupported+set}" = set; then : + enableval=$enable_unsupported; ALLOW_UNSUPPORTED=$enableval +fi + + +case "X-$ALLOW_UNSUPPORTED" in + X-|X-no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + X-yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) + ;; +esac + HDF5_INTERFACES="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran interface enabled" >&5 $as_echo_n "checking if Fortran interface enabled... " >&6; } @@ -4963,7 +5000,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_FC+set}" = set; then : +if ${ac_cv_prog_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$FC"; then @@ -5007,7 +5044,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_FC+set}" = set; then : +if ${ac_cv_prog_ac_ct_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_FC"; then @@ -5089,7 +5126,7 @@ ac_save_ext=$ac_ext ac_ext=F { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran compiler" >&5 $as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; } -if test "${ac_cv_fc_compiler_gnu+set}" = set; then : +if ${ac_cv_fc_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF @@ -5117,7 +5154,7 @@ ac_save_FCFLAGS=$FCFLAGS FCFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5 $as_echo_n "checking whether $FC accepts -g... " >&6; } -if test "${ac_cv_prog_fc_g+set}" = set; then : +if ${ac_cv_prog_fc_g+:} false; then : $as_echo_n "(cached) " >&6 else FCFLAGS=-g @@ -5164,7 +5201,7 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest ac_compiler_gnu=$ac_cv_fc_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran flag to compile .f90 files" >&5 $as_echo_n "checking for Fortran flag to compile .f90 files... " >&6; } -if test "${ac_cv_fc_srcext_f90+set}" = set; then : +if ${ac_cv_fc_srcext_f90+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=f90 @@ -5224,7 +5261,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_FC+set}" = set; then : +if ${ac_cv_prog_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$FC"; then @@ -5268,7 +5305,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_FC+set}" = set; then : +if ${ac_cv_prog_ac_ct_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_FC"; then @@ -5350,7 +5387,7 @@ ac_save_ext=$ac_ext ac_ext=F { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran compiler" >&5 $as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; } -if test "${ac_cv_fc_compiler_gnu+set}" = set; then : +if ${ac_cv_fc_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF @@ -5378,7 +5415,7 @@ ac_save_FCFLAGS=$FCFLAGS FCFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5 $as_echo_n "checking whether $FC accepts -g... " >&6; } -if test "${ac_cv_prog_fc_g+set}" = set; then : +if ${ac_cv_prog_fc_g+:} false; then : $as_echo_n "(cached) " >&6 else FCFLAGS=-g @@ -5525,7 +5562,7 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest ac_compiler_gnu=$ac_cv_fc_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $FC" >&5 $as_echo_n "checking how to get verbose linking output from $FC... " >&6; } -if test "${ac_cv_prog_fc_v+set}" = set; then : +if ${ac_cv_prog_fc_v+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF @@ -5555,7 +5592,8 @@ $as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5 # gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, # LIBRARY_PATH; skip all such settings. ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | - grep -v 'Driving:' | grep -v "^[_$as_cr_Letters][_$as_cr_alnum]*="` + sed '/^Driving:/d; /^Configured with:/d; + '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"` $as_echo "$ac_fc_v_output" >&5 FCFLAGS=$ac_save_FCFLAGS @@ -5620,7 +5658,7 @@ fi $as_echo "$ac_cv_prog_fc_v" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran libraries of $FC" >&5 $as_echo_n "checking for Fortran libraries of $FC... " >&6; } -if test "${ac_cv_fc_libs+set}" = set; then : +if ${ac_cv_fc_libs+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$FCLIBS" != "x"; then @@ -5645,7 +5683,8 @@ $as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5 # gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, # LIBRARY_PATH; skip all such settings. ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | - grep -v 'Driving:' | grep -v "^[_$as_cr_Letters][_$as_cr_alnum]*="` + sed '/^Driving:/d; /^Configured with:/d; + '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"` $as_echo "$ac_fc_v_output" >&5 FCFLAGS=$ac_save_FCFLAGS @@ -5833,7 +5872,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dummy main to link with Fortran libraries" >&5 $as_echo_n "checking for dummy main to link with Fortran libraries... " >&6; } -if test "${ac_cv_fc_dummy_main+set}" = set; then : +if ${ac_cv_fc_dummy_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_fc_dm_save_LIBS=$LIBS @@ -5944,7 +5983,7 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest ac_compiler_gnu=$ac_cv_fc_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran name-mangling scheme" >&5 $as_echo_n "checking for Fortran name-mangling scheme... " >&6; } -if test "${ac_cv_fc_mangling+set}" = set; then : +if ${ac_cv_fc_mangling+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF @@ -6284,7 +6323,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -6328,7 +6367,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -6406,7 +6445,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6451,7 +6490,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -6561,7 +6600,7 @@ depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -6692,7 +6731,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then : + if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -7080,7 +7119,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PERL+set}" = set; then : +if ${ac_cv_prog_PERL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PERL"; then @@ -7126,7 +7165,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -7172,7 +7211,7 @@ export AR $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -7207,7 +7246,7 @@ fi set dummy tr; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TR+set}" = set; then : +if ${ac_cv_path_TR+:} false; then : $as_echo_n "(cached) " >&6 else case $TR in @@ -7295,7 +7334,7 @@ $as_echo "$path/mpiexec" >&6; } RUNSERIAL="${RUNSERIAL:-none}" if test -z "$RUNPARALLEL"; then - RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=3}" + RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 @@ -7341,7 +7380,7 @@ $as_echo "$path/mpiexec" >&6; } RUNSERIAL="${RUNSERIAL:-none}" if test -z "$RUNPARALLEL"; then - RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=2}" + RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 @@ -7449,15 +7488,18 @@ if (${CC-cc} -V 2>&1 | grep '^pgcc 6.0') > /dev/null && test "X$enable_productio CC="${CC-cc} -Mx,28,0x8" fi -case "`uname`" in - CYGWIN*) - if test "X${enable_shared}" = "Xyes"; then - echo ' warning: shared libraries are not supported on Cygwin!' - echo ' disabling shared libraries' - fi - enable_shared="no" - ;; -esac +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + case "`uname`" in + CYGWIN*) + if test "X${enable_shared}" = "Xyes"; then + echo ' warning: shared libraries are not supported on Cygwin!' + echo ' disabling shared libraries' + echo ' use --enable-unsupported to override this warning and keep shared libraries enabled' + fi + enable_shared="no" + ;; + esac +fi enable_dlopen=yes @@ -7471,8 +7513,8 @@ esac -macro_version='2.2.10' -macro_revision='1.3175' +macro_version='2.4' +macro_revision='1.3293' @@ -7512,7 +7554,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. -if test "X`print -r -- -n 2>/dev/null`" = X-n && \ +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -7559,7 +7601,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -7641,7 +7683,7 @@ Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -7704,7 +7746,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -7771,7 +7813,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -7902,7 +7944,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test "${lt_cv_path_LD+set}" = set; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -7942,7 +7984,7 @@ fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -7969,7 +8011,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : +if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -8032,7 +8074,7 @@ else set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -8076,7 +8118,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then @@ -8148,7 +8190,7 @@ test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } -if test "${lt_cv_nm_interface+set}" = set; then : +if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" @@ -8183,7 +8225,7 @@ fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then : +if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 @@ -8328,8 +8370,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -8378,9 +8420,83 @@ esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then : +if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' @@ -8394,6 +8510,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -8416,7 +8537,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -8456,7 +8577,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -8515,7 +8636,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then : +if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -8717,6 +8838,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -8732,12 +8868,165 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -8750,7 +9039,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8770,14 +9059,18 @@ $as_echo "no" >&6; } fi + test -n "$AR" && break + done fi -if test -z "$ac_cv_prog_AR"; then +if test -z "$AR"; then ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -8790,7 +9083,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" + ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8809,6 +9102,10 @@ else $as_echo "no" >&6; } fi + + test -n "$ac_ct_AR" && break +done + if test "x$ac_ct_AR" = x; then AR="false" else @@ -8820,12 +9117,10 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi -else - AR="$ac_cv_prog_AR" fi -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru +: ${AR=ar} +: ${AR_FLAGS=cru} @@ -8837,12 +9132,78 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -8882,7 +9243,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -8941,7 +9302,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -8981,7 +9342,7 @@ if test -z "$ac_cv_prog_RANLIB"; then set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -9110,7 +9471,7 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : +if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else @@ -9171,8 +9532,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -9208,6 +9569,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -9249,6 +9611,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -9260,7 +9634,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT_DLSYM_CONST struct { const char *name; void *address; } @@ -9286,8 +9660,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -9297,8 +9671,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -9335,6 +9709,17 @@ else $as_echo "ok" >&6; } fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + @@ -9356,6 +9741,44 @@ fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; @@ -9481,7 +9904,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then : +if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c @@ -9557,6 +9980,123 @@ esac need_locks="$enable_libtool_lock" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + case $host_os in rhapsody* | darwin*) @@ -9565,7 +10105,7 @@ need_locks="$enable_libtool_lock" set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then @@ -9605,7 +10145,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then @@ -9657,7 +10197,7 @@ fi set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then : +if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then @@ -9697,7 +10237,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then @@ -9749,7 +10289,7 @@ fi set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then : +if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then @@ -9789,7 +10329,7 @@ if test -z "$ac_cv_prog_LIPO"; then set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then @@ -9841,7 +10381,7 @@ fi set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then : +if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then @@ -9881,7 +10421,7 @@ if test -z "$ac_cv_prog_OTOOL"; then set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then @@ -9933,7 +10473,7 @@ fi set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then : +if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then @@ -9973,7 +10513,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then @@ -10048,7 +10588,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then : +if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no @@ -10077,7 +10617,7 @@ fi $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : +if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no @@ -10117,7 +10657,7 @@ fi $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } -if test "${lt_cv_ld_force_load+set}" = set; then : +if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no @@ -10194,7 +10734,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -10322,7 +10862,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10461,7 +11001,7 @@ for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : +if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF @@ -10472,6 +11012,16 @@ done +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf + + + # Set options @@ -10646,7 +11196,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : +if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null @@ -10724,7 +11274,7 @@ file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -10790,7 +11340,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -10928,7 +11478,7 @@ if test "$GCC" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no @@ -10981,8 +11531,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -11147,6 +11695,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -11266,13 +11820,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. @@ -11280,7 +11838,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; } if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no @@ -11333,13 +11891,18 @@ fi + + + + + # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then : +if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no @@ -11382,7 +11945,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -11437,7 +12000,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -11683,7 +12246,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -11731,7 +12295,7 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler @@ -11801,8 +12365,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -11820,8 +12384,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -11867,8 +12431,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -11998,7 +12562,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef FC_DUMMY_MAIN @@ -12019,22 +12589,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" @@ -12046,7 +12623,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef FC_DUMMY_MAIN @@ -12067,22 +12650,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, @@ -12127,20 +12717,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac ;; darwin* | rhapsody*) @@ -12205,7 +12838,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -12213,7 +12846,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -12229,7 +12862,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -12253,10 +12886,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -12273,7 +12906,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } -if test "${lt_cv_prog_compiler__b+set}" = set; then : +if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no @@ -12335,23 +12968,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int foo(void) {} +int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' @@ -12436,7 +13082,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' @@ -12455,9 +13101,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -12645,7 +13291,7 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if test "${lt_cv_archive_cmds_need_lc+set}" = set; then : +if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* @@ -13033,8 +13679,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -13067,13 +13714,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -13287,7 +13992,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no @@ -13715,7 +14420,7 @@ else # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13757,7 +14462,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -13771,12 +14476,12 @@ fi *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : +if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13818,16 +14523,16 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13869,12 +14574,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : +if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13916,12 +14621,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : +if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13963,7 +14668,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -14004,7 +14709,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : +if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -14057,10 +14762,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); +int fnord () __attribute__((visibility("default"))); #endif -void fnord () { int i=42; } +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -14110,7 +14815,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; } wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : +if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -14163,10 +14868,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); +int fnord () __attribute__((visibility("default"))); #endif -void fnord () { int i=42; } +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -14347,7 +15052,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then : + if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -14558,6 +15263,7 @@ $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -14575,6 +15281,7 @@ $RM -r conftest* fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do @@ -14648,7 +15355,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test "${lt_cv_path_LD+set}" = set; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -14688,7 +15395,7 @@ fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -14714,8 +15421,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' @@ -14857,7 +15564,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef FC_DUMMY_MAIN @@ -14878,22 +15591,29 @@ main () _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -14906,7 +15626,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef FC_DUMMY_MAIN @@ -14927,22 +15653,29 @@ main () _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, @@ -14985,29 +15718,75 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; darwin* | rhapsody*) @@ -15113,7 +15892,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; *) if test "$GXX" = yes; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -15184,10 +15963,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -15228,9 +16007,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes @@ -15508,7 +16287,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -15595,9 +16374,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -15732,6 +16511,13 @@ private: }; _LT_EOF + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15745,7 +16531,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -15754,13 +16540,22 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -15780,8 +16575,10 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -15817,6 +16614,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in @@ -15917,8 +16715,6 @@ fi lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -16022,6 +16818,11 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; dgux*) case $cc_basename in ec++*) @@ -16239,10 +17040,17 @@ case $host_os in lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_prog_compiler_pic_CXX" >&6; } - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. @@ -16250,7 +17058,7 @@ $as_echo "$lt_prog_compiler_pic_CXX" >&6; } if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no @@ -16300,13 +17108,15 @@ fi + + # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then : +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no @@ -16346,7 +17156,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then : +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no @@ -16398,7 +17208,7 @@ $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then : +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no @@ -16477,6 +17287,7 @@ fi $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. @@ -16491,15 +17302,20 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } @@ -16531,7 +17347,7 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if test "${lt_cv_archive_cmds_need_lc_CXX+set}" = set; then : +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* @@ -16762,8 +17578,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -16795,13 +17612,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -17014,7 +17889,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no @@ -17363,6 +18238,7 @@ fi fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -17475,7 +18351,9 @@ $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -17550,6 +18428,13 @@ cat > conftest.$ac_ext <<_LT_EOF end _LT_EOF + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -17563,7 +18448,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -17572,13 +18457,22 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -17598,8 +18492,10 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 postdeps_FC="${postdeps_FC} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -17635,6 +18531,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken @@ -17663,8 +18560,6 @@ fi lt_prog_compiler_pic_FC= lt_prog_compiler_static_FC= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl_FC='-Wl,' @@ -17829,6 +18724,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic_FC='--shared' lt_prog_compiler_static_FC='--static' ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl_FC='-Wl,-Wl,,' + lt_prog_compiler_pic_FC='-PIC' + lt_prog_compiler_static_FC='-Bstatic' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -17948,10 +18849,17 @@ case $host_os in lt_prog_compiler_pic_FC="$lt_prog_compiler_pic_FC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_FC" >&5 -$as_echo "$lt_prog_compiler_pic_FC" >&6; } - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_FC+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_FC=$lt_prog_compiler_pic_FC +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_FC" >&5 +$as_echo "$lt_cv_prog_compiler_pic_FC" >&6; } +lt_prog_compiler_pic_FC=$lt_cv_prog_compiler_pic_FC # # Check to make sure the PIC flag actually works. @@ -17959,7 +18867,7 @@ $as_echo "$lt_prog_compiler_pic_FC" >&6; } if test -n "$lt_prog_compiler_pic_FC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_FC works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_FC works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works_FC+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_FC=no @@ -18009,13 +18917,15 @@ fi + + # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_FC eval lt_tmp_static_flag=\"$lt_prog_compiler_static_FC\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works_FC+set}" = set; then : +if ${lt_cv_prog_compiler_static_works_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_FC=no @@ -18055,7 +18965,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o_FC+set}" = set; then : +if ${lt_cv_prog_compiler_c_o_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_FC=no @@ -18107,7 +19017,7 @@ $as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o_FC+set}" = set; then : +if ${lt_cv_prog_compiler_c_o_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_FC=no @@ -18350,7 +19260,8 @@ _LT_EOF allow_undefined_flag_FC=unsupported always_export_symbols_FC=no enable_shared_with_static_runtimes_FC=yes - export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_FC='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -18398,7 +19309,7 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler @@ -18468,8 +19379,8 @@ _LT_EOF archive_cmds_FC='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -18487,8 +19398,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_FC=no fi @@ -18534,8 +19445,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_FC=no fi @@ -18665,29 +19576,42 @@ _LT_EOF allow_undefined_flag_FC='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat > conftest.$ac_ext <<_ACEOF + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__FC+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__FC"; then + lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath__FC"; then + lt_cv_aix_libpath__FC="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__FC +fi hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_FC='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" @@ -18699,29 +19623,42 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. - cat > conftest.$ac_ext <<_ACEOF + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__FC+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__FC"; then + lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath__FC"; then + lt_cv_aix_libpath__FC="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__FC +fi hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, @@ -18766,20 +19703,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - hardcode_libdir_flag_spec_FC=' ' - allow_undefined_flag_FC=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_FC='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds_FC='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_FC='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_FC='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_FC=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec_FC=' ' + allow_undefined_flag_FC=unsupported + always_export_symbols_FC=yes + file_list_spec_FC='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_FC='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, FC)='true' + enable_shared_with_static_runtimes_FC=yes + export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds_FC='chmod 644 $oldlib' + postlink_cmds_FC='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec_FC=' ' + allow_undefined_flag_FC=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_FC='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds_FC='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_FC='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes_FC=yes + ;; + esac ;; darwin* | rhapsody*) @@ -18844,7 +19824,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds_FC='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_FC='-R$libdir' hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no @@ -18852,7 +19832,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then - archive_cmds_FC='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds_FC='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_FC='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -18868,7 +19848,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_FC='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -18892,10 +19872,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -18935,22 +19915,37 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat > conftest.$ac_ext <<_ACEOF -int foo(void) {} + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat > conftest.$ac_ext <<_ACEOF + + subroutine foo + end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : - archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' @@ -19035,7 +20030,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_FC='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_FC=' -expect_unresolved \*' @@ -19054,9 +20049,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag_FC=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds_FC='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_FC='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -19235,7 +20230,7 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if test "${lt_cv_archive_cmds_need_lc_FC+set}" = set; then : +if ${lt_cv_archive_cmds_need_lc_FC+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* @@ -19466,8 +20461,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -19499,13 +20495,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -19718,7 +20772,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no @@ -20053,7 +21107,8 @@ fi fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes ac_ext=c @@ -20294,7 +21349,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5 $as_echo_n "checking for ceil in -lm... " >&6; } -if test "${ac_cv_lib_m_ceil+set}" = set; then : +if ${ac_cv_lib_m_ceil+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20336,7 +21391,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ceil" >&5 $as_echo "$ac_cv_lib_m_ceil" >&6; } -if test "x$ac_cv_lib_m_ceil" = x""yes; then : +if test "x$ac_cv_lib_m_ceil" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -20349,7 +21404,7 @@ fi if test "`uname`" = "SunOS" -o "`uname -sr`" = "HP-UX B.11.00"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20391,7 +21446,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF @@ -20402,7 +21457,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_int in -lnsl" >&5 $as_echo_n "checking for xdr_int in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_xdr_int+set}" = set; then : +if ${ac_cv_lib_nsl_xdr_int+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20444,7 +21499,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_xdr_int" >&5 $as_echo "$ac_cv_lib_nsl_xdr_int" >&6; } -if test "x$ac_cv_lib_nsl_xdr_int" = x""yes; then : +if test "x$ac_cv_lib_nsl_xdr_int" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF @@ -20458,7 +21513,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20578,7 +21633,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then : +if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20623,7 +21678,7 @@ fi for ac_func in difftime do : ac_fn_c_check_func "$LINENO" "difftime" "ac_cv_func_difftime" -if test "x$ac_cv_func_difftime" = x""yes; then : +if test "x$ac_cv_func_difftime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DIFFTIME 1 _ACEOF @@ -20634,7 +21689,7 @@ done for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : +if test "x$ac_cv_func_gettimeofday" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -20687,7 +21742,7 @@ done for ac_header in stdint.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = x""yes; then : +if test "x$ac_cv_header_stdint_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDINT_H 1 _ACEOF @@ -20750,7 +21805,7 @@ done for ac_header in sys/fpu.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/fpu.h" "ac_cv_header_sys_fpu_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_fpu_h" = x""yes; then : +if test "x$ac_cv_header_sys_fpu_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_FPU_H 1 _ACEOF @@ -20762,7 +21817,7 @@ done for ac_func in get_fpc_csr do : ac_fn_c_check_func "$LINENO" "get_fpc_csr" "ac_cv_func_get_fpc_csr" -if test "x$ac_cv_func_get_fpc_csr" = x""yes; then : +if test "x$ac_cv_func_get_fpc_csr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GET_FPC_CSR 1 _ACEOF @@ -20788,7 +21843,7 @@ $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_CC+set}" = set; then : +if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no @@ -20848,7 +21903,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test "${ac_cv_sys_file_offset_bits+set}" = set; then : +if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -20935,7 +21990,7 @@ rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if test "${ac_cv_sys_large_files+set}" = set; then : +if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -21022,7 +22077,7 @@ rm -rf conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking if large (64-bit) files are supported on this system." >&5 $as_echo_n "checking if large (64-bit) files are supported on this system.... " >&6; } - if test "${hdf5_cv_have_lfs+set}" = set; then : + if ${hdf5_cv_have_lfs+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -21184,7 +22239,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = x""yes; then : +if test "x$ac_cv_type_off_t" = xyes; then : else @@ -21195,7 +22250,7 @@ _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : +if test "x$ac_cv_type_size_t" = xyes; then : else @@ -21206,7 +22261,7 @@ _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = x""yes; then : +if test "x$ac_cv_type_ssize_t" = xyes; then : else @@ -21217,7 +22272,7 @@ _ACEOF fi ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" -if test "x$ac_cv_type_ptrdiff_t" = x""yes; then : +if test "x$ac_cv_type_ptrdiff_t" = xyes; then : else @@ -21229,7 +22284,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -21505,7 +22560,7 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 $as_echo_n "checking size of char... " >&6; } -if test "${ac_cv_sizeof_char+set}" = set; then : +if ${ac_cv_sizeof_char+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : @@ -21538,7 +22593,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : +if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -21571,7 +22626,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -21604,7 +22659,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned" >&5 $as_echo_n "checking size of unsigned... " >&6; } -if test "${ac_cv_sizeof_unsigned+set}" = set; then : +if ${ac_cv_sizeof_unsigned+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned))" "ac_cv_sizeof_unsigned" "$ac_includes_default"; then : @@ -21637,7 +22692,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : +if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -21670,7 +22725,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if test "${ac_cv_sizeof_long_long+set}" = set; then : +if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -21703,7 +22758,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5 $as_echo_n "checking size of __int64... " >&6; } -if test "${ac_cv_sizeof___int64+set}" = set; then : +if ${ac_cv_sizeof___int64+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64" "$ac_includes_default"; then : @@ -21736,7 +22791,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if test "${ac_cv_sizeof_float+set}" = set; then : +if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -21769,7 +22824,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -21802,7 +22857,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : +if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -21894,10 +22949,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -21921,7 +22987,7 @@ fi # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int8_t" >&5 $as_echo_n "checking size of int8_t... " >&6; } -if test "${ac_cv_sizeof_int8_t+set}" = set; then : +if ${ac_cv_sizeof_int8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int8_t))" "ac_cv_sizeof_int8_t" "$ac_includes_default"; then : @@ -21954,7 +23020,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint8_t" >&5 $as_echo_n "checking size of uint8_t... " >&6; } -if test "${ac_cv_sizeof_uint8_t+set}" = set; then : +if ${ac_cv_sizeof_uint8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint8_t))" "ac_cv_sizeof_uint8_t" "$ac_includes_default"; then : @@ -21987,7 +23053,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_least8_t" >&5 $as_echo_n "checking size of int_least8_t... " >&6; } -if test "${ac_cv_sizeof_int_least8_t+set}" = set; then : +if ${ac_cv_sizeof_int_least8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_least8_t))" "ac_cv_sizeof_int_least8_t" "$ac_includes_default"; then : @@ -22020,7 +23086,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_least8_t" >&5 $as_echo_n "checking size of uint_least8_t... " >&6; } -if test "${ac_cv_sizeof_uint_least8_t+set}" = set; then : +if ${ac_cv_sizeof_uint_least8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_least8_t))" "ac_cv_sizeof_uint_least8_t" "$ac_includes_default"; then : @@ -22053,7 +23119,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_fast8_t" >&5 $as_echo_n "checking size of int_fast8_t... " >&6; } -if test "${ac_cv_sizeof_int_fast8_t+set}" = set; then : +if ${ac_cv_sizeof_int_fast8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_fast8_t))" "ac_cv_sizeof_int_fast8_t" "$ac_includes_default"; then : @@ -22086,7 +23152,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_fast8_t" >&5 $as_echo_n "checking size of uint_fast8_t... " >&6; } -if test "${ac_cv_sizeof_uint_fast8_t+set}" = set; then : +if ${ac_cv_sizeof_uint_fast8_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_fast8_t))" "ac_cv_sizeof_uint_fast8_t" "$ac_includes_default"; then : @@ -22120,7 +23186,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int16_t" >&5 $as_echo_n "checking size of int16_t... " >&6; } -if test "${ac_cv_sizeof_int16_t+set}" = set; then : +if ${ac_cv_sizeof_int16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int16_t))" "ac_cv_sizeof_int16_t" "$ac_includes_default"; then : @@ -22153,7 +23219,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint16_t" >&5 $as_echo_n "checking size of uint16_t... " >&6; } -if test "${ac_cv_sizeof_uint16_t+set}" = set; then : +if ${ac_cv_sizeof_uint16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint16_t))" "ac_cv_sizeof_uint16_t" "$ac_includes_default"; then : @@ -22186,7 +23252,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_least16_t" >&5 $as_echo_n "checking size of int_least16_t... " >&6; } -if test "${ac_cv_sizeof_int_least16_t+set}" = set; then : +if ${ac_cv_sizeof_int_least16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_least16_t))" "ac_cv_sizeof_int_least16_t" "$ac_includes_default"; then : @@ -22219,7 +23285,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_least16_t" >&5 $as_echo_n "checking size of uint_least16_t... " >&6; } -if test "${ac_cv_sizeof_uint_least16_t+set}" = set; then : +if ${ac_cv_sizeof_uint_least16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_least16_t))" "ac_cv_sizeof_uint_least16_t" "$ac_includes_default"; then : @@ -22252,7 +23318,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_fast16_t" >&5 $as_echo_n "checking size of int_fast16_t... " >&6; } -if test "${ac_cv_sizeof_int_fast16_t+set}" = set; then : +if ${ac_cv_sizeof_int_fast16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_fast16_t))" "ac_cv_sizeof_int_fast16_t" "$ac_includes_default"; then : @@ -22285,7 +23351,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_fast16_t" >&5 $as_echo_n "checking size of uint_fast16_t... " >&6; } -if test "${ac_cv_sizeof_uint_fast16_t+set}" = set; then : +if ${ac_cv_sizeof_uint_fast16_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_fast16_t))" "ac_cv_sizeof_uint_fast16_t" "$ac_includes_default"; then : @@ -22319,7 +23385,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int32_t" >&5 $as_echo_n "checking size of int32_t... " >&6; } -if test "${ac_cv_sizeof_int32_t+set}" = set; then : +if ${ac_cv_sizeof_int32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int32_t))" "ac_cv_sizeof_int32_t" "$ac_includes_default"; then : @@ -22352,7 +23418,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint32_t" >&5 $as_echo_n "checking size of uint32_t... " >&6; } -if test "${ac_cv_sizeof_uint32_t+set}" = set; then : +if ${ac_cv_sizeof_uint32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint32_t))" "ac_cv_sizeof_uint32_t" "$ac_includes_default"; then : @@ -22385,7 +23451,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_least32_t" >&5 $as_echo_n "checking size of int_least32_t... " >&6; } -if test "${ac_cv_sizeof_int_least32_t+set}" = set; then : +if ${ac_cv_sizeof_int_least32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_least32_t))" "ac_cv_sizeof_int_least32_t" "$ac_includes_default"; then : @@ -22418,7 +23484,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_least32_t" >&5 $as_echo_n "checking size of uint_least32_t... " >&6; } -if test "${ac_cv_sizeof_uint_least32_t+set}" = set; then : +if ${ac_cv_sizeof_uint_least32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_least32_t))" "ac_cv_sizeof_uint_least32_t" "$ac_includes_default"; then : @@ -22451,7 +23517,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_fast32_t" >&5 $as_echo_n "checking size of int_fast32_t... " >&6; } -if test "${ac_cv_sizeof_int_fast32_t+set}" = set; then : +if ${ac_cv_sizeof_int_fast32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_fast32_t))" "ac_cv_sizeof_int_fast32_t" "$ac_includes_default"; then : @@ -22484,7 +23550,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_fast32_t" >&5 $as_echo_n "checking size of uint_fast32_t... " >&6; } -if test "${ac_cv_sizeof_uint_fast32_t+set}" = set; then : +if ${ac_cv_sizeof_uint_fast32_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_fast32_t))" "ac_cv_sizeof_uint_fast32_t" "$ac_includes_default"; then : @@ -22518,7 +23584,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int64_t" >&5 $as_echo_n "checking size of int64_t... " >&6; } -if test "${ac_cv_sizeof_int64_t+set}" = set; then : +if ${ac_cv_sizeof_int64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int64_t))" "ac_cv_sizeof_int64_t" "$ac_includes_default"; then : @@ -22551,7 +23617,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint64_t" >&5 $as_echo_n "checking size of uint64_t... " >&6; } -if test "${ac_cv_sizeof_uint64_t+set}" = set; then : +if ${ac_cv_sizeof_uint64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint64_t))" "ac_cv_sizeof_uint64_t" "$ac_includes_default"; then : @@ -22584,7 +23650,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_least64_t" >&5 $as_echo_n "checking size of int_least64_t... " >&6; } -if test "${ac_cv_sizeof_int_least64_t+set}" = set; then : +if ${ac_cv_sizeof_int_least64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_least64_t))" "ac_cv_sizeof_int_least64_t" "$ac_includes_default"; then : @@ -22617,7 +23683,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_least64_t" >&5 $as_echo_n "checking size of uint_least64_t... " >&6; } -if test "${ac_cv_sizeof_uint_least64_t+set}" = set; then : +if ${ac_cv_sizeof_uint_least64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_least64_t))" "ac_cv_sizeof_uint_least64_t" "$ac_includes_default"; then : @@ -22650,7 +23716,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int_fast64_t" >&5 $as_echo_n "checking size of int_fast64_t... " >&6; } -if test "${ac_cv_sizeof_int_fast64_t+set}" = set; then : +if ${ac_cv_sizeof_int_fast64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int_fast64_t))" "ac_cv_sizeof_int_fast64_t" "$ac_includes_default"; then : @@ -22683,7 +23749,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint_fast64_t" >&5 $as_echo_n "checking size of uint_fast64_t... " >&6; } -if test "${ac_cv_sizeof_uint_fast64_t+set}" = set; then : +if ${ac_cv_sizeof_uint_fast64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint_fast64_t))" "ac_cv_sizeof_uint_fast64_t" "$ac_includes_default"; then : @@ -22717,7 +23783,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if test "${ac_cv_sizeof_size_t+set}" = set; then : +if ${ac_cv_sizeof_size_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -22750,7 +23816,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ssize_t" >&5 $as_echo_n "checking size of ssize_t... " >&6; } -if test "${ac_cv_sizeof_ssize_t+set}" = set; then : +if ${ac_cv_sizeof_ssize_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (ssize_t))" "ac_cv_sizeof_ssize_t" "$ac_includes_default"; then : @@ -22783,7 +23849,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ptrdiff_t" >&5 $as_echo_n "checking size of ptrdiff_t... " >&6; } -if test "${ac_cv_sizeof_ptrdiff_t+set}" = set; then : +if ${ac_cv_sizeof_ptrdiff_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (ptrdiff_t))" "ac_cv_sizeof_ptrdiff_t" "$ac_includes_default"; then : @@ -22820,7 +23886,7 @@ EOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if test "${ac_cv_sizeof_off_t+set}" = set; then : +if ${ac_cv_sizeof_off_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : @@ -22853,7 +23919,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off64_t" >&5 $as_echo_n "checking size of off64_t... " >&6; } -if test "${ac_cv_sizeof_off64_t+set}" = set; then : +if ${ac_cv_sizeof_off64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off64_t))" "ac_cv_sizeof_off64_t" "$ac_includes_default"; then : @@ -22945,10 +24011,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -23016,7 +24093,7 @@ case $withval in for ac_header in dmalloc.h do : ac_fn_c_check_header_mongrel "$LINENO" "dmalloc.h" "ac_cv_header_dmalloc_h" "$ac_includes_default" -if test "x$ac_cv_header_dmalloc_h" = x""yes; then : +if test "x$ac_cv_header_dmalloc_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DMALLOC_H 1 _ACEOF @@ -23027,7 +24104,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_shutdown in -ldmalloc... " >&6; } -if test "${ac_cv_lib_dmalloc_dmalloc_shutdown+set}" = set; then : +if ${ac_cv_lib_dmalloc_dmalloc_shutdown+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23069,7 +24146,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dmalloc_dmalloc_shutdown" >&5 $as_echo "$ac_cv_lib_dmalloc_dmalloc_shutdown" >&6; } -if test "x$ac_cv_lib_dmalloc_dmalloc_shutdown" = x""yes; then : +if test "x$ac_cv_lib_dmalloc_dmalloc_shutdown" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDMALLOC 1 _ACEOF @@ -23127,7 +24204,7 @@ $as_echo "suppressed" >&6; } for ac_header in dmalloc.h do : ac_fn_c_check_header_mongrel "$LINENO" "dmalloc.h" "ac_cv_header_dmalloc_h" "$ac_includes_default" -if test "x$ac_cv_header_dmalloc_h" = x""yes; then : +if test "x$ac_cv_header_dmalloc_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DMALLOC_H 1 _ACEOF @@ -23146,7 +24223,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_shutdown in -ldmalloc... " >&6; } -if test "${ac_cv_lib_dmalloc_dmalloc_shutdown+set}" = set; then : +if ${ac_cv_lib_dmalloc_dmalloc_shutdown+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23188,7 +24265,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dmalloc_dmalloc_shutdown" >&5 $as_echo "$ac_cv_lib_dmalloc_dmalloc_shutdown" >&6; } -if test "x$ac_cv_lib_dmalloc_dmalloc_shutdown" = x""yes; then : +if test "x$ac_cv_lib_dmalloc_dmalloc_shutdown" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDMALLOC 1 _ACEOF @@ -23222,7 +24299,7 @@ case $withval in for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = x""yes; then : +if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF @@ -23233,7 +24310,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } -if test "${ac_cv_lib_z_compress2+set}" = set; then : +if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23275,7 +24352,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } -if test "x$ac_cv_lib_z_compress2" = x""yes; then : +if test "x$ac_cv_lib_z_compress2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF @@ -23287,7 +24364,7 @@ else fi ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" -if test "x$ac_cv_func_compress2" = x""yes; then : +if test "x$ac_cv_func_compress2" = xyes; then : HAVE_COMPRESS2="yes" fi @@ -23338,7 +24415,7 @@ $as_echo "suppressed" >&6; } for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = x""yes; then : +if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF @@ -23357,7 +24434,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } -if test "${ac_cv_lib_z_compress2+set}" = set; then : +if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23399,7 +24476,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } -if test "x$ac_cv_lib_z_compress2" = x""yes; then : +if test "x$ac_cv_lib_z_compress2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF @@ -23411,7 +24488,7 @@ else fi ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" -if test "x$ac_cv_func_compress2" = x""yes; then : +if test "x$ac_cv_func_compress2" = xyes; then : HAVE_COMPRESS2="yes" fi @@ -23451,7 +24528,7 @@ case $withval in for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" -if test "x$ac_cv_header_szlib_h" = x""yes; then : +if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF @@ -23462,7 +24539,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } -if test "${ac_cv_lib_sz_SZ_BufftoBuffCompress+set}" = set; then : +if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23504,7 +24581,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } -if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = x""yes; then : +if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSZ 1 _ACEOF @@ -23562,7 +24639,7 @@ $as_echo "suppressed" >&6; } for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" -if test "x$ac_cv_header_szlib_h" = x""yes; then : +if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF @@ -23581,7 +24658,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } -if test "${ac_cv_lib_sz_SZ_BufftoBuffCompress+set}" = set; then : +if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23623,7 +24700,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } -if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = x""yes; then : +if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSZ 1 _ACEOF @@ -23653,7 +24730,7 @@ $as_echo_n "checking for szlib encoder... " >&6; } LL_PATH="$LD_LIBRARY_PATH" - if test "${hdf5_cv_szlib_can_encode+set}" = set; then : + if ${hdf5_cv_szlib_can_encode+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -23791,10 +24868,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -23817,7 +24905,7 @@ case "$withval" in for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : +if test "x$ac_cv_header_pthread_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF @@ -23828,7 +24916,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23870,7 +24958,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -23918,7 +25006,7 @@ $as_echo "suppressed" >&6; } for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : +if test "x$ac_cv_header_pthread_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF @@ -23933,7 +25021,7 @@ done for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : +if test "x$ac_cv_header_pthread_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF @@ -23953,7 +25041,7 @@ done AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -23995,7 +25083,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -24010,7 +25098,7 @@ fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -24052,7 +25140,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -24240,7 +25328,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : +if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24285,7 +25373,7 @@ ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -24301,7 +25389,7 @@ $as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h> " -if test "x$ac_cv_have_decl_tzname" = x""yes; then : +if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -24313,7 +25401,7 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if test "${ac_cv_var_tzname+set}" = set; then : +if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24397,7 +25485,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$have_gettime" = "yes" -a "$have_struct_tz" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday() gives timezone" >&5 $as_echo_n "checking whether gettimeofday() gives timezone... " >&6; } - if test "${hdf5_cv_gettimeofday_tz+set}" = set; then : + if ${hdf5_cv_gettimeofday_tz+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -24716,14 +25804,14 @@ done for ac_func in vsnprintf do : ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" -if test "x$ac_cv_func_vsnprintf" = x""yes; then : +if test "x$ac_cv_func_vsnprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VSNPRINTF 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking if vsnprintf returns correct value" >&5 $as_echo_n "checking if vsnprintf returns correct value... " >&6; } - if test "${hdf5_cv_vsnprintf_works+set}" = set; then : + if ${hdf5_cv_vsnprintf_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -24787,7 +25875,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking if lone colon can be used as an argument" >&5 $as_echo_n "checking if lone colon can be used as an argument... " >&6; } -if test "${hdf5_cv_lone_colon+set}" = set; then : +if ${hdf5_cv_lone_colon+:} false; then : $as_echo_n "(cached) " >&6 else @@ -24814,7 +25902,7 @@ $as_echo "$hdf5_cv_lone_colon" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24902,7 +25990,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -25083,7 +26171,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print long long" >&5 $as_echo_n "checking how to print long long... " >&6; } -if test "${hdf5_cv_printf_ll+set}" = set; then : +if ${hdf5_cv_printf_ll+:} false; then : $as_echo_n "(cached) " >&6 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $AM_LDFLAGS $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`" @@ -25129,7 +26217,7 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking Threads support system scope" >&5 $as_echo_n "checking Threads support system scope... " >&6; } -if test "${hdf5_cv_system_scope_threads+set}" = set; then : +if ${hdf5_cv_system_scope_threads+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -25193,7 +26281,7 @@ case "X-$enableval" in for ac_header in gpfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "gpfs.h" "ac_cv_header_gpfs_h" "$ac_includes_default" -if test "x$ac_cv_header_gpfs_h" = x""yes; then : +if test "x$ac_cv_header_gpfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GPFS_H 1 _ACEOF @@ -25521,10 +26609,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -25538,19 +26637,25 @@ if test "${enable_parallel+set}" = set; then : fi -if test "X${HDF_CXX}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then - as_fn_error $? "--enable-cxx and --enable-parallel flags are incompatible" "$LINENO" 5 +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_CXX}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then + as_fn_error $? "--enable-cxx and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 + fi fi -if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then - as_fn_error $? "--enable-threadsafe and --enable-parallel flags are incompatible" "$LINENO" 5 +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then + as_fn_error $? "--enable-threadsafe and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 + fi fi -if test "X${PARALLEL}" != "X" -a "X${enable_cxx}" = "Xyes" ; then - as_fn_error $? "An MPI compiler is being used; --enable-cxx is not allowed" "$LINENO" 5 -fi -if test "X${PARALLEL}" != "X" -a "X${THREADSAFE}" = "Xyes"; then - as_fn_error $? "An MPI compiler is being used; --enable-threadsafe is not allowed" "$LINENO" 5 +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${PARALLEL}" != "X" -a "X${enable_cxx}" = "Xyes" ; then + as_fn_error $? "An MPI compiler is being used; --enable-cxx is not allowed. Use --enable-unsupported to override this error." "$LINENO" 5 + fi + if test "X${PARALLEL}" != "X" -a "X${THREADSAFE}" = "Xyes"; then + as_fn_error $? "An MPI compiler is being used; --enable-threadsafe is not allowed. Use --enable-unsupported to override this error." "$LINENO" 5 + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for parallel support files" >&5 @@ -25591,7 +26696,7 @@ else \ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 $as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if test "${ac_cv_lib_mpi_MPI_Init+set}" = set; then : +if ${ac_cv_lib_mpi_MPI_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25633,7 +26738,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 $as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = x""yes; then : +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPI 1 _ACEOF @@ -25644,7 +26749,7 @@ else \ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 $as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then : +if ${ac_cv_lib_mpich_MPI_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25686,7 +26791,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 $as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = x""yes; then : +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPICH 1 _ACEOF @@ -25728,7 +26833,7 @@ if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_File_open in -lmpio" >&5 $as_echo_n "checking for MPI_File_open in -lmpio... " >&6; } -if test "${ac_cv_lib_mpio_MPI_File_open+set}" = set; then : +if ${ac_cv_lib_mpio_MPI_File_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25770,7 +26875,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpio_MPI_File_open" >&5 $as_echo "$ac_cv_lib_mpio_MPI_File_open" >&6; } -if test "x$ac_cv_lib_mpio_MPI_File_open" = x""yes; then : +if test "x$ac_cv_lib_mpio_MPI_File_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPIO 1 _ACEOF @@ -25816,7 +26921,7 @@ $as_echo_n "checking for include 'mpif.h' integer:: ierr call mpi_file_open( ierr ) in -lmpi... " >&6; } -if eval "test \"\${$as_ac_Lib+set}\"" = set; then : +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25880,7 +26985,7 @@ $as_echo_n "checking for include 'mpif.h' integer:: ierr call mpi_file_open( ierr ) in -lmpio... " >&6; } -if eval "test \"\${$as_ac_Lib+set}\"" = set; then : +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25932,14 +27037,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then for path in `echo $PATH | ${TR} ":" " "`; do if test -x $path/aprun; then - RUNPARALLEL="aprun -q -n \$\${NPROCS:=3}" + RUNPARALLEL="aprun -q -n \$\${NPROCS:=6}" break; fi done fi if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then - RUNPARALLEL="mpiexec -n \$\${NPROCS:=3}" + RUNPARALLEL="mpiexec -n \$\${NPROCS:=6}" fi ;; @@ -26107,7 +27212,7 @@ $as_echo "suppressed" >&6; } for ac_header in mpe.h do : ac_fn_c_check_header_mongrel "$LINENO" "mpe.h" "ac_cv_header_mpe_h" "$ac_includes_default" -if test "x$ac_cv_header_mpe_h" = x""yes; then : +if test "x$ac_cv_header_mpe_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPE_H 1 _ACEOF @@ -26120,7 +27225,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5 $as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; } -if test "${ac_cv_lib_mpe_MPE_Init_log+set}" = set; then : +if ${ac_cv_lib_mpe_MPE_Init_log+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26162,7 +27267,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpe_MPE_Init_log" >&5 $as_echo "$ac_cv_lib_mpe_MPE_Init_log" >&6; } -if test "x$ac_cv_lib_mpe_MPE_Init_log" = x""yes; then : +if test "x$ac_cv_lib_mpe_MPE_Init_log" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPE 1 _ACEOF @@ -26175,7 +27280,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 $as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if test "${ac_cv_lib_lmpe_CLOG_Init+set}" = set; then : +if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26217,7 +27322,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 $as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = x""yes; then : +if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -26258,7 +27363,7 @@ fi for ac_header in mpe.h do : ac_fn_c_check_header_mongrel "$LINENO" "mpe.h" "ac_cv_header_mpe_h" "$ac_includes_default" -if test "x$ac_cv_header_mpe_h" = x""yes; then : +if test "x$ac_cv_header_mpe_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPE_H 1 _ACEOF @@ -26273,7 +27378,7 @@ done for ac_header in mpe.h do : ac_fn_c_check_header_mongrel "$LINENO" "mpe.h" "ac_cv_header_mpe_h" "$ac_includes_default" -if test "x$ac_cv_header_mpe_h" = x""yes; then : +if test "x$ac_cv_header_mpe_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPE_H 1 _ACEOF @@ -26293,7 +27398,7 @@ done AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5 $as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; } -if test "${ac_cv_lib_mpe_MPE_Init_log+set}" = set; then : +if ${ac_cv_lib_mpe_MPE_Init_log+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26335,7 +27440,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpe_MPE_Init_log" >&5 $as_echo "$ac_cv_lib_mpe_MPE_Init_log" >&6; } -if test "x$ac_cv_lib_mpe_MPE_Init_log" = x""yes; then : +if test "x$ac_cv_lib_mpe_MPE_Init_log" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPE 1 _ACEOF @@ -26348,7 +27453,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 $as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if test "${ac_cv_lib_lmpe_CLOG_Init+set}" = set; then : +if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26390,7 +27495,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 $as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = x""yes; then : +if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -26405,7 +27510,7 @@ fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5 $as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; } -if test "${ac_cv_lib_mpe_MPE_Init_log+set}" = set; then : +if ${ac_cv_lib_mpe_MPE_Init_log+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26447,7 +27552,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpe_MPE_Init_log" >&5 $as_echo "$ac_cv_lib_mpe_MPE_Init_log" >&6; } -if test "x$ac_cv_lib_mpe_MPE_Init_log" = x""yes; then : +if test "x$ac_cv_lib_mpe_MPE_Init_log" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMPE 1 _ACEOF @@ -26460,7 +27565,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 $as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if test "${ac_cv_lib_lmpe_CLOG_Init+set}" = set; then : +if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -26502,7 +27607,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 $as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = x""yes; then : +if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -26525,7 +27630,7 @@ $as_echo "#define HAVE_MPE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking if MPI_File_set_size works for files over 2GB" >&5 $as_echo_n "checking if MPI_File_set_size works for files over 2GB... " >&6; } - if test "${hdf5_cv_mpi_file_set_size_big+set}" = set; then : + if ${hdf5_cv_mpi_file_set_size_big+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_mpi_file_set_size_big=yes @@ -26572,7 +27677,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if irregular hyperslab optimization code works inside MPI-IO" >&5 $as_echo_n "checking if irregular hyperslab optimization code works inside MPI-IO... " >&6; } -if test "${hdf5_cv_mpi_complex_derived_datatype_works+set}" = set; then : +if ${hdf5_cv_mpi_complex_derived_datatype_works+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_mpi_complex_derived_datatype_works=yes @@ -26594,7 +27699,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if MPI-IO can do collective IO when one or more processes don't do IOs" >&5 $as_echo_n "checking if MPI-IO can do collective IO when one or more processes don't do IOs... " >&6; } -if test "${hdf5_cv_mpi_special_collective_io_works+set}" = set; then : +if ${hdf5_cv_mpi_special_collective_io_works+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_mpi_special_collective_io_works=yes @@ -26728,7 +27833,7 @@ fi if test "$DIRECT_VFD" = "yes"; then - if test "${hdf5_cv_direct_io+set}" = set; then : + if ${hdf5_cv_direct_io+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -26859,7 +27964,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if converting denormalized floating-point values is possible" >&5 $as_echo_n "checking if converting denormalized floating-point values is possible... " >&6; } -if test "${hdf5_cv_convert_denormal_float+set}" = set; then : +if ${hdf5_cv_convert_denormal_float+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_convert_denormal_float=yes @@ -26879,7 +27984,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if converting floating-point values to long long is not working" >&5 $as_echo_n "checking if converting floating-point values to long long is not working... " >&6; } -if test "${hdf5_cv_convert_float_llong_not_works+set}" = set; then : +if ${hdf5_cv_convert_float_llong_not_works+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_convert_float_llong_not_works=no @@ -26920,7 +28025,7 @@ $as_echo_n "checking if converting from long double to integers is accurate... " if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate=no} else - if test "${hdf5_cv_ldouble_to_integer_accurate+set}" = set; then : + if ${hdf5_cv_ldouble_to_integer_accurate+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_ldouble_to_integer_accurate=yes @@ -26946,7 +28051,7 @@ $as_echo_n "checking if converting from long double to integers works... " >&6; if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_integer_works=${hdf5_cv_ldouble_to_integer_works=no} else - if test "${hdf5_cv_ldouble_to_integer_works+set}" = set; then : + if ${hdf5_cv_ldouble_to_integer_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27011,7 +28116,7 @@ $as_echo_n "checking if accurately converting from integers to long double... " if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate=no} else - if test "${hdf5_cv_integer_to_ldouble_accurate+set}" = set; then : + if ${hdf5_cv_integer_to_ldouble_accurate+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_integer_to_ldouble_accurate=yes @@ -27033,7 +28138,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if accurately converting unsigned long to float values" >&5 $as_echo_n "checking if accurately converting unsigned long to float values... " >&6; } -if test "${hdf5_cv_ulong_to_float_accurate+set}" = set; then : +if ${hdf5_cv_ulong_to_float_accurate+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27102,7 +28207,7 @@ fi $as_echo_n "checking if accurately converting unsigned long long to floating-point values... " >&6; } if test ${host_os_novers} = "solaris2.x"; then - if test "${hdf5_cv_ulong_to_fp_bottom_bit_accurate+set}" = set; then : + if ${hdf5_cv_ulong_to_fp_bottom_bit_accurate+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27186,7 +28291,7 @@ fi fi else - if test "${hdf5_cv_ulong_to_fp_bottom_bit_accurate+set}" = set; then : + if ${hdf5_cv_ulong_to_fp_bottom_bit_accurate+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes @@ -27208,7 +28313,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if accurately roundup converting floating-point to unsigned long long values" >&5 $as_echo_n "checking if accurately roundup converting floating-point to unsigned long long values... " >&6; } -if test "${hdf5_cv_fp_to_ullong_accurate+set}" = set; then : +if ${hdf5_cv_fp_to_ullong_accurate+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27264,7 +28369,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if right maximum converting floating-point to unsigned long long values" >&5 $as_echo_n "checking if right maximum converting floating-point to unsigned long long values... " >&6; } -if test "${hdf5_cv_fp_to_ullong_right_maximum+set}" = set; then : +if ${hdf5_cv_fp_to_ullong_right_maximum+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27330,7 +28435,7 @@ $as_echo_n "checking if correctly converting long double to unsigned int values. if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_uint_accurate=${hdf5_cv_ldouble_to_uint_accurate=no} else - if test "${hdf5_cv_ldouble_to_uint_accurate+set}" = set; then : + if ${hdf5_cv_ldouble_to_uint_accurate+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27383,7 +28488,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiling unsigned long long to floating-point typecasts work" >&5 $as_echo_n "checking if compiling unsigned long long to floating-point typecasts work... " >&6; } -if test "${hdf5_cv_ullong_to_fp_cast_works+set}" = set; then : +if ${hdf5_cv_ullong_to_fp_cast_works+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_ullong_to_fp_cast_works=yes @@ -27403,7 +28508,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiling long long to floating-point typecasts work" >&5 $as_echo_n "checking if compiling long long to floating-point typecasts work... " >&6; } -if test "${hdf5_cv_llong_to_fp_cast_works+set}" = set; then : +if ${hdf5_cv_llong_to_fp_cast_works+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_llong_to_fp_cast_works=yes @@ -27427,7 +28532,7 @@ $as_echo_n "checking if converting unsigned long long to long double with precis if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ullong_to_ldouble_precision=${hdf5_cv_ullong_to_ldouble_precision=no} else - if test "${hdf5_cv_ullong_to_ldouble_precision+set}" = set; then : + if ${hdf5_cv_ullong_to_ldouble_precision+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27541,7 +28646,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if overflows normally converting floating-point to integer values" >&5 $as_echo_n "checking if overflows normally converting floating-point to integer values... " >&6; } -if test "${hdf5_cv_fp_to_integer_overflow_works+set}" = set; then : +if ${hdf5_cv_fp_to_integer_overflow_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27588,13 +28693,209 @@ else $as_echo "no" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if using special algorithm to convert long double to (unsigned) long values" >&5 +$as_echo_n "checking if using special algorithm to convert long double to (unsigned) long values... " >&6; } + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_ldouble_to_long_special=${hdf5_cv_ldouble_to_long_special=no} +else + if ${hdf5_cv_ldouble_to_long_special+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int main(void) + { + long double ld = 20041683600089727.779961L; + long ll; + unsigned long ull; + unsigned char s[16]; + unsigned char s2[8]; + int ret = 1; + + if(sizeof(long double) == 16 && sizeof(long) == 8) { + /*make sure the long double type has 16 bytes in size and + * 11 bits of exponent. If it is, + *the bit sequence should be like below. It's not + *a decent way to check but this info isn't available. */ + memcpy(s, &ld, 16); + if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && + s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { + + /* Assign the hexadecimal value of long double type. */ + s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; + s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; + s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + + ll = (long)ld; + memcpy(s2, &ll, 8); + + /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82 + * and gets wrong value 20041683600089730 on the IBM Power6 Linux. + * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f + * and gets the correct value 20041683600089727. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + + ull = (unsigned long)ld; + memcpy(s2, &ull, 8); + + /* The unsigned long is the same as signed long. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + } + } + + done: + exit(ret); + } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + hdf5_cv_ldouble_to_long_special=yes +else + hdf5_cv_ldouble_to_long_special=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi + +fi + +if test ${hdf5_cv_ldouble_to_long_special} = "yes"; then + +$as_echo "#define LDOUBLE_TO_LONG_SPECIAL 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if using special algorithm to convert (unsigned) long to long double values" >&5 +$as_echo_n "checking if using special algorithm to convert (unsigned) long to long double values... " >&6; } + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_long_to_ldouble_special=${hdf5_cv_long_to_ldouble_special=no} +else + if ${hdf5_cv_long_to_ldouble_special+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int main(void) + { + long double ld; + long ll; + unsigned long ull; + unsigned char s[16]; + int flag=0, ret=1; + + /*Determine if long double has 16 byte in size, 11 bit exponent, and + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { + ld = 1.0L; + memcpy(s, &ld, 16); + if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; + } + + if(flag==1 && sizeof(long)==8) { + ll = 0x003fffffffffffffL; + ld = (long double)ll; + memcpy(s, &ld, 16); + /* The library converts the value to 0x434fffffffffffff8000000000000000. + * In decimal it is 18014398509481982.000000, one value short of the original. + * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; + } + if(flag==1 && sizeof(unsigned long)==8) { + ull = 0xffffffffffffffffUL; + ld = (long double)ull; + memcpy(s, &ld, 16); + /* Use a different value from signed long to test. The problem is the same + * for both long and unsigned long. The value is 18446744073709551615. + * The library converts the value to 0x43effffffffffffffe000000000000000. + * In decimal it's 18446744073709548544.000000, very different from the original. + * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; + } + done: + exit(ret); + } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + hdf5_cv_long_to_ldouble_special=yes +else + hdf5_cv_long_to_ldouble_special=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi + +fi + +if test ${hdf5_cv_long_to_ldouble_special} = "yes"; then + +$as_echo "#define LONG_TO_LDOUBLE_SPECIAL 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if correctly converting long double to (unsigned) long long values" >&5 $as_echo_n "checking if correctly converting long double to (unsigned) long long values... " >&6; } if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no} else - if test "${hdf5_cv_ldouble_to_llong_accurate+set}" = set; then : + if ${hdf5_cv_ldouble_to_llong_accurate+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27668,13 +28969,14 @@ else $as_echo "no" >&6; } fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if correctly converting (unsigned) long long to long double values" >&5 $as_echo_n "checking if correctly converting (unsigned) long long to long double values... " >&6; } if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no} else - if test "${hdf5_cv_llong_to_ldouble_correct+set}" = set; then : + if ${hdf5_cv_llong_to_ldouble_correct+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -27754,7 +29056,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if bad code for log2 routine is generated" >&5 $as_echo_n "checking if bad code for log2 routine is generated... " >&6; } -if test "${hdf5_cv_bad_log2_code_generated+set}" = set; then : +if ${hdf5_cv_bad_log2_code_generated+:} false; then : $as_echo_n "(cached) " >&6 else hdf5_cv_bad_log2_code_generated=no @@ -28004,12 +29306,13 @@ else as_fn_error $? "invalid version of public symbols given" "$LINENO" 5 fi -if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then - as_fn_error $? "Removing old public API symbols not allowed when using them as default public API symbols" "$LINENO" 5 +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then + as_fn_error $? "Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error." "$LINENO" 5 + fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Whether to perform strict file format checks" >&5 $as_echo_n "checking Whether to perform strict file format checks... " >&6; }; # Check whether --enable-strict-format-checks was given. @@ -28222,7 +29525,7 @@ if test -n "$TESTPARALLEL"; then fi fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" cat >confcache <<\_ACEOF @@ -28289,10 +29592,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -28393,7 +29707,7 @@ if test -z "${BUILD_HDF5_HL_CONDITIONAL_TRUE}" && test -z "${BUILD_HDF5_HL_CONDI Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -28494,6 +29808,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -28800,8 +30115,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.76, which was -generated by GNU Autoconf 2.67. Invocation command line was +This file was extended by HDF5 $as_me 1.9.80, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -28866,8 +30181,8 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.76 -configured by $0, generated by GNU Autoconf 2.67, +HDF5 config.status 1.9.80 +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -29024,13 +30339,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' @@ -29045,14 +30367,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' @@ -29085,12 +30410,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' @@ -29136,10 +30461,10 @@ GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' GCC_FC='`$ECHO "$GCC_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_FC='`$ECHO "$lt_prog_compiler_no_builtin_flag_FC" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_FC='`$ECHO "$lt_prog_compiler_pic_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_FC='`$ECHO "$lt_prog_compiler_static_FC" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' @@ -29192,8 +30517,6 @@ inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst inherit_rpath_FC='`$ECHO "$inherit_rpath_FC" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_FC='`$ECHO "$link_all_deplibs_FC" | $SED "$delay_single_quote_subst"`' -fix_srcfile_path_CXX='`$ECHO "$fix_srcfile_path_CXX" | $SED "$delay_single_quote_subst"`' -fix_srcfile_path_FC='`$ECHO "$fix_srcfile_path_FC" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_FC='`$ECHO "$always_export_symbols_FC" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' @@ -29204,6 +30527,8 @@ include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_s include_expsyms_FC='`$ECHO "$include_expsyms_FC" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_FC='`$ECHO "$prelink_cmds_FC" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_FC='`$ECHO "$postlink_cmds_FC" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_FC='`$ECHO "$file_list_spec_FC" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' @@ -29249,8 +30574,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ +archiver_list_spec \ STRIP \ RANLIB \ CC \ @@ -29260,12 +30590,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ lt_prog_compiler_pic \ +lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ +MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ @@ -29281,7 +30613,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ -fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ @@ -29307,10 +30638,10 @@ compiler_CXX \ compiler_FC \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_no_builtin_flag_FC \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_wl_FC \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_pic_FC \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_wl_FC \ lt_prog_compiler_static_CXX \ lt_prog_compiler_static_FC \ lt_cv_prog_compiler_c_o_CXX \ @@ -29333,8 +30664,6 @@ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_flag_spec_ld_FC \ hardcode_libdir_separator_CXX \ hardcode_libdir_separator_FC \ -fix_srcfile_path_CXX \ -fix_srcfile_path_FC \ exclude_expsyms_CXX \ exclude_expsyms_FC \ include_expsyms_CXX \ @@ -29377,6 +30706,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ +postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ @@ -29401,7 +30731,9 @@ module_expsym_cmds_FC \ export_symbols_cmds_CXX \ export_symbols_cmds_FC \ prelink_cmds_CXX \ -prelink_cmds_FC; do +prelink_cmds_FC \ +postlink_cmds_CXX \ +postlink_cmds_FC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" @@ -29456,6 +30788,7 @@ do "test/testerror.sh") CONFIG_FILES="$CONFIG_FILES test/testerror.sh" ;; "test/H5srcdir_str.h") CONFIG_FILES="$CONFIG_FILES test/H5srcdir_str.h" ;; "test/testlibinfo.sh") CONFIG_FILES="$CONFIG_FILES test/testlibinfo.sh" ;; + "test/testlinks_env.sh") CONFIG_FILES="$CONFIG_FILES test/testlinks_env.sh" ;; "testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;; "testpar/testph5.sh") CONFIG_FILES="$CONFIG_FILES testpar/testph5.sh" ;; "perform/Makefile") CONFIG_FILES="$CONFIG_FILES perform/Makefile" ;; @@ -29539,9 +30872,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -29549,12 +30883,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -29576,7 +30911,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -29604,7 +30939,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -29652,7 +30987,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -29684,7 +31019,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -29718,7 +31053,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -29730,8 +31065,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -29851,7 +31186,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -29886,7 +31221,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ + *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; @@ -30023,21 +31358,22 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -30048,20 +31384,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. @@ -30344,19 +31680,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method -# Command to use when deplibs_check_method == "file_magic". +# Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + # The archiver. AR=$lt_AR + +# Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + # A symbol stripping program. STRIP=$lt_STRIP @@ -30386,6 +31745,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -30395,6 +31760,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL @@ -30509,12 +31877,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static @@ -30601,9 +31969,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols @@ -30619,6 +31984,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + # Specify filename containing input files. file_list_spec=$lt_file_list_spec @@ -30665,210 +32033,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -30896,12 +32223,12 @@ with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX @@ -30988,9 +32315,6 @@ inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path_CXX - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX @@ -31006,6 +32330,9 @@ include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX @@ -31053,12 +32380,12 @@ with_gcc=$GCC_FC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_FC -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_FC - # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_FC +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_FC + # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_FC @@ -31145,9 +32472,6 @@ inherit_rpath=$inherit_rpath_FC # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_FC -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path_FC - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_FC @@ -31163,6 +32487,9 @@ include_expsyms=$lt_include_expsyms_FC # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_FC +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_FC + # Specify filename containing input files. file_list_spec=$lt_file_list_spec_FC diff --git a/configure.in b/configure.in index fc1ffb2..79bc1cf 100644 --- a/configure.in +++ b/configure.in @@ -26,7 +26,7 @@ dnl dnl NOTE: Don't forget to change the version number here when we do a dnl release!!! dnl -AC_INIT([HDF5], [1.9.76], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.80], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AM_CONFIG_HEADER([src/H5config.h]) @@ -345,6 +345,28 @@ dnl AC_PROG_CC CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`" +dnl ---------------------------------------------------------------------------- +dnl Configure disallows unsupported combinations of options. However, users +dnl may want to override and build with unsupported combinations for their +dnl own use. They can use the --enable-unsupported configure flag, which +dnl ignores any errors from configure due to incompatible flags. +AC_MSG_CHECKING([if unsupported combinations of configure options are allowed]) +AC_ARG_ENABLE([unsupported], + [AC_HELP_STRING([--enable-unsupported], + [Allow unsupported combinations of configure options])], + [ALLOW_UNSUPPORTED=$enableval]) + +case "X-$ALLOW_UNSUPPORTED" in + X-|X-no) + AC_MSG_RESULT([no]) + ;; + X-yes) + AC_MSG_RESULT([yes]) + ;; + *) + ;; +esac + dnl ---------------------------------------------------------------------- dnl Check if they would like the Fortran interface compiled dnl @@ -694,9 +716,9 @@ dnl the executable name to run the executable on dnl multiple processors. For the serial library the dnl value will normally be the empty string. For dnl parallel library it should be something like -dnl `mpi -np $$NPROCS' where NPROCS will eventually -dnl contain the number of processors on which to run -dnl the executable (the double dollarsigns are to +dnl "mpiexec -n \$\${NPROCS:=6}" where NPROCS will +dnl eventually contain the number of processors on which +dnl to run the executable (the double dollarsigns are to dnl protect the expansion until make executes the dnl command). The value of this variable is dnl substituted in *.in files. @@ -738,7 +760,7 @@ case "$CC_BASENAME" in RUNSERIAL="${RUNSERIAL:-none}" if test -z "$RUNPARALLEL"; then - RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=3}" + RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}" fi else AC_MSG_RESULT([none]) @@ -792,7 +814,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then RUNSERIAL="${RUNSERIAL:-none}" if test -z "$RUNPARALLEL"; then - RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=2}" + RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}" fi else AC_MSG_RESULT([none]) @@ -908,16 +930,20 @@ if (${CC-cc} -V 2>&1 | grep '^pgcc 6.0') > /dev/null && test "X$enable_productio fi dnl ---------------------------------------------------------------------- -dnl Shared libraries are not currently supported under Cygwin. -case "`uname`" in - CYGWIN*) - if test "X${enable_shared}" = "Xyes"; then - echo ' warning: shared libraries are not supported on Cygwin!' - echo ' disabling shared libraries' - fi - enable_shared="no" - ;; -esac +dnl Shared libraries are not currently supported under Cygwin, so configure +dnl disables them unless --enable-unsupported has been supplied by the user. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + case "`uname`" in + CYGWIN*) + if test "X${enable_shared}" = "Xyes"; then + echo ' warning: shared libraries are not supported on Cygwin!' + echo ' disabling shared libraries' + echo ' use --enable-unsupported to override this warning and keep shared libraries enabled' + fi + enable_shared="no" + ;; + esac +fi dnl ---------------------------------------------------------------------- dnl Create libtool. If shared/static libraries are going to be enabled @@ -2460,24 +2486,33 @@ AC_ARG_ENABLE([parallel], [Search for MPI-IO and MPI support files])]) dnl The --enable-parallel flag is not compatible with --enable-cxx. -dnl If the user tried to specify both flags, throw an error. -if test "X${HDF_CXX}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then - AC_MSG_ERROR([--enable-cxx and --enable-parallel flags are incompatible]) +dnl If the user tried to specify both flags, throw an error, unless +dnl they also provided the --enable-unsupported flag. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_CXX}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then + AC_MSG_ERROR([--enable-cxx and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.]) + fi fi -dnl --enable-parallel is also incompatible with --enable-threadsafe. -if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then - AC_MSG_ERROR([--enable-threadsafe and --enable-parallel flags are incompatible]) +dnl --enable-parallel is also incompatible with --enable-threadsafe, unless +dnl --enable-unsupported has been specified on the configure line. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then + AC_MSG_ERROR([--enable-threadsafe and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.]) + fi fi dnl It's possible to build in parallel by specifying a parallel compiler dnl without using the --enable-parallel flag. This isn't allowed with -dnl C++ or threadsafe, either. -if test "X${PARALLEL}" != "X" -a "X${enable_cxx}" = "Xyes" ; then - AC_MSG_ERROR([An MPI compiler is being used; --enable-cxx is not allowed]) -fi -if test "X${PARALLEL}" != "X" -a "X${THREADSAFE}" = "Xyes"; then - AC_MSG_ERROR([An MPI compiler is being used; --enable-threadsafe is not allowed]) +dnl C++ or threadsafe, either, unless the --enable-unsupported flag +dnl has also been specified. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${PARALLEL}" != "X" -a "X${enable_cxx}" = "Xyes" ; then + AC_MSG_ERROR([An MPI compiler is being used; --enable-cxx is not allowed. Use --enable-unsupported to override this error.]) + fi + if test "X${PARALLEL}" != "X" -a "X${THREADSAFE}" = "Xyes"; then + AC_MSG_ERROR([An MPI compiler is being used; --enable-threadsafe is not allowed. Use --enable-unsupported to override this error.]) + fi fi AC_MSG_CHECKING([for parallel support files]) @@ -2550,7 +2585,7 @@ case "X-$enable_parallel" in dnl Find the path where aprun is located. for path in `echo $PATH | ${TR} ":" " "`; do if test -x $path/aprun; then - RUNPARALLEL="aprun -q -n \$\${NPROCS:=3}" + RUNPARALLEL="aprun -q -n \$\${NPROCS:=6}" break; fi done @@ -2558,7 +2593,7 @@ case "X-$enable_parallel" in dnl Set RUNPARALLEL to mpiexec if not set yet. if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then - RUNPARALLEL="mpiexec -n \$\${NPROCS:=3}" + RUNPARALLEL="mpiexec -n \$\${NPROCS:=6}" fi ;; @@ -3548,6 +3583,167 @@ else fi dnl ---------------------------------------------------------------------- +dnl Set the flag to indicate that the machine is using a special algorithm to convert +dnl 'long double' to '(unsigned) long' values. (This flag should only be set for +dnl the IBM Power6 Linux. When the bit sequence of long double is +dnl 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +dnl is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. +dnl The machine's conversion gets the correct value. We define the macro and disable +dnl this kind of test until we figure out what algorithm they use. +dnl +AC_MSG_CHECKING([if using special algorithm to convert long double to (unsigned) long values]) + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_ldouble_to_long_special=${hdf5_cv_ldouble_to_long_special=no} +else + AC_CACHE_VAL([hdf5_cv_ldouble_to_long_special], + [AC_TRY_RUN([ + int main(void) + { + long double ld = 20041683600089727.779961L; + long ll; + unsigned long ull; + unsigned char s[16]; + unsigned char s2[8]; + int ret = 1; + + if(sizeof(long double) == 16 && sizeof(long) == 8) { + /*make sure the long double type has 16 bytes in size and + * 11 bits of exponent. If it is, + *the bit sequence should be like below. It's not + *a decent way to check but this info isn't available. */ + memcpy(s, &ld, 16); + if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && + s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { + + /* Assign the hexadecimal value of long double type. */ + s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; + s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; + s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + + ll = (long)ld; + memcpy(s2, &ll, 8); + + /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82 + * and gets wrong value 20041683600089730 on the IBM Power6 Linux. + * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f + * and gets the correct value 20041683600089727. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + + ull = (unsigned long)ld; + memcpy(s2, &ull, 8); + + /* The unsigned long is the same as signed long. */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + ret = 0; + } + } + + done: + exit(ret); + } + ], [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no],)]) +fi + +if test ${hdf5_cv_ldouble_to_long_special} = "yes"; then + AC_DEFINE([LDOUBLE_TO_LONG_SPECIAL], [1], + [Define if your system converts long double to (unsigned) long values with special algorithm.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +dnl ---------------------------------------------------------------------- +dnl Set the flag to indicate that the machine is using a special algorithm +dnl to convert some values of '(unsigned) long' to 'long double' values. +dnl (This flag should be off for all machines, except for IBM Power6 Linux, +dnl when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +dnl ..., 7fffff..., the compiler uses a unknown algorithm. We define a +dnl macro and skip the test for now until we know about the algorithm. +dnl +AC_MSG_CHECKING([if using special algorithm to convert (unsigned) long to long double values]) + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_long_to_ldouble_special=${hdf5_cv_long_to_ldouble_special=no} +else + AC_CACHE_VAL([hdf5_cv_long_to_ldouble_special], + [AC_TRY_RUN([ + int main(void) + { + long double ld; + long ll; + unsigned long ull; + unsigned char s[16]; + int flag=0, ret=1; + + /*Determine if long double has 16 byte in size, 11 bit exponent, and + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { + ld = 1.0L; + memcpy(s, &ld, 16); + if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; + } + + if(flag==1 && sizeof(long)==8) { + ll = 0x003fffffffffffffL; + ld = (long double)ll; + memcpy(s, &ld, 16); + /* The library converts the value to 0x434fffffffffffff8000000000000000. + * In decimal it is 18014398509481982.000000, one value short of the original. + * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; + } + if(flag==1 && sizeof(unsigned long)==8) { + ull = 0xffffffffffffffffUL; + ld = (long double)ull; + memcpy(s, &ld, 16); + /* Use a different value from signed long to test. The problem is the same + * for both long and unsigned long. The value is 18446744073709551615. + * The library converts the value to 0x43effffffffffffffe000000000000000. + * In decimal it's 18446744073709548544.000000, very different from the original. + * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000. + * The value is correct in decimal. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. */ + if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + ret = 0; + } + done: + exit(ret); + } + ], [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no],)]) +fi + +if test ${hdf5_cv_long_to_ldouble_special} = "yes"; then + AC_DEFINE([LONG_TO_LDOUBLE_SPECIAL], [1], + [Define if your system can convert (unsigned) long to long double values with special algorithm.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +dnl ---------------------------------------------------------------------- dnl Set the flag to indicate that the machine can accurately convert dnl 'long double' to '(unsigned) long long' values. (This flag should be set for dnl all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence @@ -3610,6 +3806,7 @@ else AC_MSG_RESULT([no]) fi + dnl ---------------------------------------------------------------------- dnl Set the flag to indicate that the machine can accurately convert dnl '(unsigned) long long' to 'long double' values. (This flag should be set for @@ -3944,12 +4141,15 @@ else fi dnl It's an error to try to disable deprecated public API symbols while -dnl choosing an older version of the public API as the default. -if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then - AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols]) +dnl choosing an older version of the public API as the default. However, +dnl if the user insists on doing this via the --enable-unsupported configure +dnl flag, we'll let them. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then + AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error.]) + fi fi - dnl ---------------------------------------------------------------------- dnl Enable strict file format checks dnl @@ -4123,6 +4323,7 @@ AC_CONFIG_FILES([src/libhdf5.settings test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh + test/testlinks_env.sh testpar/Makefile testpar/testph5.sh perform/Makefile diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 71eaa34..86d9307 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -24,14 +24,24 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - H5_NAMING (${example}) - TARGET_WIN_PROPERTIES (${example}) + H5_NAMING (${example} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${example} ${HDF5_LIB_TARGET}) + + IF (BUILD_TESTING) + ADD_TEST (NAME ${example} COMMAND $<TARGET_FILE:${example}>) + ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) +IF (BUILD_TESTING) + FILE (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) +ENDIF (BUILD_TESTING) + IF (H5_HAVE_PARALLEL) ADD_EXECUTABLE (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - H5_NAMING (ph5example) - TARGET_WIN_PROPERTIES (ph5example) + H5_NAMING (ph5example ${LIB_TYPE}) TARGET_LINK_LIBRARIES (ph5example ${HDF5_LIB_TARGET}) + + IF (BUILD_TESTING) + ADD_TEST (NAME ph5example COMMAND $<TARGET_FILE:ph5example>) + ENDIF (BUILD_TESTING) ENDIF (H5_HAVE_PARALLEL) diff --git a/examples/Makefile.in b/examples/Makefile.in index 4e16fa4..0dfc9f4 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -120,6 +120,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -181,6 +182,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -237,6 +239,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -660,7 +663,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/fortran/Makefile.in b/fortran/Makefile.in index 4e7f208..5995c65 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -157,6 +157,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -218,6 +219,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -274,6 +276,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 6fe6cc7..c0ddf32 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -37,8 +37,8 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - H5_NAMING (f90_ex_${example}) - TARGET_FORTRAN_WIN_PROPERTIES (f90_ex_${example}) + H5_NAMING (f90_ex_${example} ${LIB_TYPE}) + TARGET_FORTRAN_WIN_PROPERTIES (f90_ex_${example} "") IF (WIN32 AND NOT CYGWIN) SET_PROPERTY (TARGET f90_ex_${example} APPEND PROPERTY COMPILE_DEFINITIONS @@ -50,12 +50,17 @@ FOREACH (example ${examples}) ${HDF5_LIB_TARGET} ) SET_TARGET_PROPERTIES (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) + + IF (BUILD_TESTING) + ADD_TEST (NAME f90_ex_${example} COMMAND $<TARGET_FILE:f90_ex_${example}>) + ENDIF (BUILD_TESTING) + ENDFOREACH (example ${examples}) IF (H5_HAVE_PARALLEL) ADD_EXECUTABLE (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - H5_NAMING (f90_ex_ph5example) - TARGET_FORTRAN_WIN_PROPERTIES (f90_ex_ph5example) + H5_NAMING (f90_ex_ph5example ${LIB_TYPE}) + TARGET_FORTRAN_WIN_PROPERTIES (f90_ex_ph5example "") IF (WIN32 AND NOT CYGWIN) SET_PROPERTY (TARGET f90_ex_ph5example APPEND PROPERTY COMPILE_DEFINITIONS @@ -67,4 +72,9 @@ IF (H5_HAVE_PARALLEL) ${HDF5_LIB_TARGET} ) SET_TARGET_PROPERTIES (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran) + + IF (BUILD_TESTING) + ADD_TEST (NAME f90_ex_ph5example COMMAND $<TARGET_FILE:f90_ex_ph5example>) + ENDIF (BUILD_TESTING) + ENDIF (H5_HAVE_PARALLEL) diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 4258d69..b3a123d 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -120,6 +120,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -181,6 +182,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -237,6 +239,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -656,7 +659,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 2af57c1..6a88eca 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -184,6 +184,7 @@ ENDIF (H5_HAVE_PARALLEL) # Add Main fortran library #----------------------------------------------------------------------------- ADD_LIBRARY (${HDF5_F90_LIB_TARGET} ${LIB_TYPE} ${f90_F_SRCS}) +SET (SHARED_LINK_FLAGS " ") IF (WIN32 AND NOT CYGWIN) IF (BUILD_SHARED_LIBS) SET_PROPERTY (TARGET ${HDF5_F90_LIB_TARGET} @@ -191,11 +192,7 @@ IF (WIN32 AND NOT CYGWIN) BUILD_HDF5_DLL ) IF (MSVC) - SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET} - PROPERTIES - COMPILE_FLAGS "/dll" - LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL /DEF:${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def" - ) + SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def") ENDIF (MSVC) ENDIF (BUILD_SHARED_LIBS) SET_PROPERTY (TARGET ${HDF5_F90_LIB_TARGET} @@ -203,6 +200,7 @@ IF (WIN32 AND NOT CYGWIN) HDF5F90_WINDOWS ) ENDIF (WIN32 AND NOT CYGWIN) +TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_F90_LIB_TARGET} ${SHARED_LINK_FLAGS}) SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) TARGET_LINK_LIBRARIES (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 939fd81..8e6158e 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -974,16 +974,16 @@ nh5aget_name_c(hid_t_f *attr_id, size_t_f *bufsize, _fcd buf) int_f ret_value=0; /* Return value */ c_bufsize = (size_t)*bufsize+1; + /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) HGOTO_DONE(FAIL); /* * Call H5Aget_name function */ - if ((ret_value = (int_f)H5Aget_name((hid_t)*attr_id, c_bufsize, c_buf)) < 0) HGOTO_DONE(FAIL); diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 9640444..3cfc9e3 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -47,37 +47,36 @@ nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, h * Define access flags */ c_access_flags = (unsigned) *access_flags; + /* * Define creation property */ c_crt_prp = *crt_prp; -/* - if ( H5P_DEFAULT_F == c_crt_prp ) c_crt_prp = H5P_DEFAULT; -*/ + /* * Define access property */ c_acc_prp = *acc_prp; -/* - if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT; -*/ /* * Convert FORTRAN name to C name */ c_namelen = *namelen; c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); - if (c_name == NULL) return ret_value; + if(c_name == NULL) + return ret_value; /* * Call H5Fcreate function. */ c_file_id = H5Fcreate(c_name, c_access_flags, c_crt_prp, c_acc_prp); - if (c_file_id < 0) return ret_value; - *file_id = c_file_id; + if (c_file_id >= 0) { + ret_value = 0; + *file_id = c_file_id; + } + HDfree(c_name); - ret_value = 0; return ret_value; } @@ -238,31 +237,31 @@ nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hi * Define access flags */ c_access_flags = (unsigned) *access_flags; + /* * Define access property */ c_acc_prp = *acc_prp; -/* - if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT; -*/ /* * Convert FORTRAN name to C name */ c_namelen = *namelen; c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); - if (c_name == NULL) return ret_value; + if(c_name == NULL) + return ret_value; /* * Call H5Fopen function. */ c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp); - if (c_file_id < 0) return ret_value; - *file_id = (hid_t_f)c_file_id; + if(c_file_id >= 0) { + ret_value = 0; + *file_id = (hid_t_f)c_file_id; + } /* end if */ HDfree(c_name); - ret_value = 0; return ret_value; } @@ -520,7 +519,7 @@ nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc((size_t)*buflen +1)) == NULL) + if(NULL == (c_buf = (char *)HDmalloc((size_t)*buflen + 1))) HGOTO_DONE(FAIL); /* diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index 4d3e31c..c971d5e 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -394,7 +394,7 @@ done: * Modifications: N/A *---------------------------------------------------------------------------*/ int_f -nh5lget_info_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, +nh5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type, haddr_t_f *address, size_t_f *val_size, hid_t_f *lapl_id) @@ -406,16 +406,16 @@ nh5lget_info_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, /* * Convert FORTRAN name to C name */ - if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL) - HGOTO_DONE(FAIL); + if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen))) + HGOTO_DONE(FAIL); + /* * Call H5Linfo function. */ if(H5Lget_info((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); + HGOTO_DONE(FAIL); /* Unpack the structure */ - *cset = (int_f)link_buff.cset; *corder = (int_f)link_buff.corder; *corder_valid = 0; @@ -425,6 +425,9 @@ nh5lget_info_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, *val_size = (size_t_f)link_buff.u.val_size; done: + if(c_link_name) + HDfree(c_link_name); + return ret_value; } @@ -606,7 +609,7 @@ nh5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, /* * Allocate buffer to hold name of an attribute */ - if ((c_name = HDmalloc(c_size)) == NULL) + if(NULL == (c_name = (char *)HDmalloc(c_size))) HGOTO_DONE(FAIL) if((*size = (size_t)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 96b771d..29ba593 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -22,7 +21,7 @@ /*---------------------------------------------------------------------------- * Name: h5pcreate_c * Purpose: Call H5Pcreate to create a property list - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * Outputs: prp_id - identifier of the created property list * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -31,12 +30,12 @@ *---------------------------------------------------------------------------*/ int_f -nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) +nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ) { hid_t c_prp_id; int_f ret_value = 0; - c_prp_id = H5Pcreate((hid_t)*class); + c_prp_id = H5Pcreate((hid_t)*cls); if(c_prp_id < 0) HGOTO_DONE(FAIL) @@ -264,7 +263,7 @@ nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ) herr_t status; int i; - c_dims = malloc(sizeof(hsize_t) * (*rank )); + c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * (*rank )); if (!c_dims) return ret_value; /* @@ -309,7 +308,7 @@ nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ) int c_max_rank; int i; - c_dims = malloc(sizeof(hsize_t) * (*max_rank )); + c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * (*max_rank )); if (!c_dims) return ret_value; c_prp_id = (hid_t)*prp_id; @@ -1311,8 +1310,8 @@ nh5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, h c_meta_ext_size = (size_t) *meta_ext_size; c_raw_ext_size = (size_t) *raw_ext_size; - c_meta_ext = (char*)malloc(sizeof(char)*c_meta_ext_size); - c_raw_ext = (char*)malloc(sizeof(char)*c_raw_ext_size); + c_meta_ext = (char *)HDmalloc(sizeof(char) * c_meta_ext_size); + c_raw_ext = (char *)HDmalloc(sizeof(char) * c_raw_ext_size); if(c_meta_ext == NULL || c_raw_ext == NULL) return ret_value; /* @@ -1481,7 +1480,7 @@ nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nel c_filter = (H5Z_filter_t)*filter; c_flags = (unsigned)*flags; c_cd_nelmts = (size_t)*cd_nelmts; - c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + c_cd_values = (unsigned int*)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts)); if (!c_cd_values) return ret_value; for (i = 0; i < c_cd_nelmts; i++) c_cd_values[i] = (unsigned int)cd_values[i]; @@ -1566,10 +1565,10 @@ nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* c_cd_nelmts = (size_t)*cd_nelmts; - if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1))) + if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1))) goto DONE; - if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts))) + if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts))) goto DONE; /* @@ -1702,7 +1701,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, /* * Allocate memory to store the name of the external file. */ - if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1); + if(c_namelen) c_name = (char*)HDmalloc(c_namelen + 1); if (c_name == NULL) return ret_value; /* @@ -2232,14 +2231,14 @@ nh5pget_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size) * Inputs: parent - property list class identifier * name - name of the new class * name_len - lenght of the "name" buffer - * Outputs: class - new class identifier + * Outputs: cls - new class identifier * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class) +nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls) { int ret_value = -1; hid_t c_parent; @@ -2255,7 +2254,7 @@ nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class) */ c_class = H5Pcreate_class(c_parent, c_name, NULL, NULL,NULL,NULL,NULL,NULL); if (c_class < 0) goto DONE; - *class = (hid_t_f)c_class; + *cls = (hid_t_f)c_class; ret_value = 0; DONE: @@ -2266,7 +2265,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5pregisterc_c * Purpose: Call h5pregister_c to registers a permanent property - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * name - name of the new property * name_len - length of the "name" buffer * size - property size @@ -2277,21 +2276,21 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pregisterc_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f UNUSED *value_len) +nh5pregisterc_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f UNUSED *value_len) { int ret_value = -1; /* * Call h5pregister_c function */ - ret_value = nh5pregister_c(class, name, name_len, size, _fcdtocp(value)); + ret_value = nh5pregister_c(cls, name, name_len, size, _fcdtocp(value)); return ret_value; } /*---------------------------------------------------------------------------- * Name: h5pregister_c * Purpose: Call H5Pregister2 to registers a permanent property - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * name - name of the new property * name_len - length of the "name" buffer * size - property size @@ -2302,7 +2301,7 @@ nh5pregisterc_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, _fcd * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void UNUSED *value) +nh5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void UNUSED *value) { char* c_name = NULL; int_f ret_value = -1; @@ -2313,7 +2312,7 @@ nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void /* * Call H5Pregister2 function. */ - if(H5Pregister2((hid_t)*class, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5Pregister2((hid_t)*cls, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto DONE; ret_value = 0; @@ -2324,30 +2323,30 @@ DONE: } int_f -nh5pregister_integer_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_integer_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } int_f -nh5pregister_real_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_real_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } int_f -nh5pregister_double_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_double_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } /*---------------------------------------------------------------------------- @@ -2450,7 +2449,7 @@ nh5pinsert_double_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pexist_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5pexist_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; hid_t c_class; @@ -2460,7 +2459,7 @@ nh5pexist_c(hid_t_f *class, _fcd name, int_f *name_len) c_name = (char *)HD5f2cstring(name, (size_t)*name_len); if (c_name == NULL) goto DONE; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Pexist function. */ @@ -2476,21 +2475,21 @@ DONE: * Purpose: Call H5Pisa_class to querie whether a property is a * member of a class * Inputs: plist - property list identifier - * class - property class identifier + * cls - property class identifier * Returns: nonnegative on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pisa_class_c(hid_t_f *plist, hid_t_f *class) +nh5pisa_class_c(hid_t_f *plist, hid_t_f *cls) { int_f ret_value = -1; hid_t c_class; hid_t c_plist; htri_t status; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; c_plist = (hid_t)*plist; /* @@ -2663,7 +2662,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5punregister_c * Purpose: Call H5Punregister to remove a property from a property class - * Inputs: class - identifier of property class + * Inputs: cls - identifier of property class * name - name of the property to unregister * name_len - length of the "name" buffer * Returns: 0 on success, -1 on failure @@ -2672,7 +2671,7 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; hid_t c_class; @@ -2681,7 +2680,7 @@ nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len) c_name = (char *)HD5f2cstring(name, (size_t)*name_len); if (c_name == NULL) goto DONE; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Punregister function. */ @@ -2695,19 +2694,19 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5pclose_class_c * Purpose: Call H5Pclose_class to close property class - * Inputs: class - identifier of property class to close + * Inputs: cls - identifier of property class to close * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pclose_class_c(hid_t_f *class) +nh5pclose_class_c(hid_t_f *cls) { int_f ret_value = -1; hid_t c_class; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Pclose_class function. */ @@ -2718,7 +2717,7 @@ nh5pclose_class_c(hid_t_f *class) /*---------------------------------------------------------------------------- * Name: h5pget_class_name_c * Purpose: Call H5Pget_class_name to get property class name - * Inputs: class - identifier of property class + * Inputs: cls - identifier of property class * name - ibuffer to retrieve name in * name_len - length of the "name" buffer * Returns: 0 on success, -1 on failure @@ -2727,22 +2726,24 @@ nh5pclose_class_c(hid_t_f *class) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pget_class_name_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; char *c_name = NULL; /* Buffer to hold C string */ size_t c_size; c_size = (size_t)*name_len + 1; + /* * Allocate buffer to hold name */ - if ((c_name = HDmalloc(c_size)) == NULL) + if(NULL == (c_name = (char *)HDmalloc(c_size))) goto DONE; + /* * Call H5Pget_class_name function. */ - c_name = H5Pget_class_name((hid_t)*class); + c_name = H5Pget_class_name((hid_t)*cls); if(c_name == NULL) goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); @@ -2752,6 +2753,7 @@ DONE: HDfree(c_name); return ret_value; } + /*---------------------------------------------------------------------------- * Name: h5pset_c * Purpose: Call h5setc_c to set property with the character string value @@ -3092,14 +3094,11 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f if (tmp ==NULL) return ret_value; tmp_p = tmp; for (i=0; i < H5FD_MEM_NTYPES; i++) { - c_memb_name[i] = malloc((size_t)len[i] + 1); - memcpy(c_memb_name[i], tmp_p, (size_t)len[i]); + c_memb_name[i] = (char *)HDmalloc((size_t)len[i] + 1); + HDmemcpy(c_memb_name[i], tmp_p, (size_t)len[i]); tmp_pp = c_memb_name[i]; tmp_pp[len[i]] = '\0'; tmp_p = tmp_p + c_lenmax; -/* printf(" %d \n", len[i]); - printf("name %s \n", c_memb_name[i]); -*/ } /* * Take care of othe arguments @@ -3108,25 +3107,22 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f c_prp_id = (hid_t)*prp_id; for (i=0; i < H5FD_MEM_NTYPES; i++) { c_memb_map[i] = (H5FD_mem_t)memb_map[i]; - /*printf("map %d \n", c_memb_map[i]); */ c_memb_fapl[i] = (hid_t)memb_fapl[i]; - /*printf("fapl %d \n", c_memb_fapl[i]); */ if(memb_addr[i] < 0) c_memb_addr[i] = HADDR_UNDEF; - /* else c_memb_addr[i] = (haddr_t)(((float)memb_addr[i])*(HADDR_MAX));*/ else c_memb_addr[i] = (haddr_t)(((float)memb_addr[i])*(tmp_max_addr)); - /*printf("address %Ld \n", c_memb_addr[i]); */ } /* * Call H5Pset_fapl_multi function */ - status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, c_memb_name, c_memb_addr, relax); + status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, (const char * const *)c_memb_name, c_memb_addr, relax); if ( status < 0 ) goto DONE; ret_value = 0; DONE: - free(tmp); - for (i=0; i < H5FD_MEM_NTYPES; i++) free(c_memb_name[i]); + HDfree(tmp); + for (i=0; i < H5FD_MEM_NTYPES; i++) + HDfree(c_memb_name[i]); return ret_value; } @@ -3203,9 +3199,9 @@ nh5pget_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f /* * Take care of names array */ - tmp = (char *)malloc(c_lenmax*H5FD_MEM_NTYPES + 1); + tmp = (char *)HDmalloc(c_lenmax*H5FD_MEM_NTYPES + 1); tmp_p = tmp; - memset(tmp,' ', c_lenmax*H5FD_MEM_NTYPES); + HDmemset(tmp,' ', c_lenmax*H5FD_MEM_NTYPES); tmp[c_lenmax*H5FD_MEM_NTYPES] = '\0'; for (i=0; i < H5FD_MEM_NTYPES; i++) { memcpy(tmp_p, c_memb_name[i], strlen(c_memb_name[i])); @@ -3228,8 +3224,9 @@ HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax*H5FD_MEM_NTYPES)); *flag = (int_f)relax; *maxlen_out = (int_f)length; ret_value = 0; - free(tmp); - for (i=0; i < H5FD_MEM_NTYPES; i++) free(c_memb_name[i]); + HDfree(tmp); + for (i=0; i < H5FD_MEM_NTYPES; i++) + HDfree(c_memb_name[i]); return ret_value; } @@ -3326,10 +3323,10 @@ nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f unsigned i; int_f ret_value = -1; - if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1))) + if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1))) goto DONE; - if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * ((int)c_cd_nelmts_in)))) + if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts_in)))) goto DONE; /* @@ -3385,7 +3382,7 @@ nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_ c_filter = (H5Z_filter_t)*filter; c_flags = (unsigned)*flags; c_cd_nelmts = (size_t)*cd_nelmts; - c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts)); if (!c_cd_values) return ret_value; for (i = 0; i < c_cd_nelmts; i++) c_cd_values[i] = (unsigned int)cd_values[i]; @@ -3977,7 +3974,7 @@ nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_l * Allocate memory to store the expression. */ if(c_expression_len) { - c_expression = (char*)HDmalloc(c_expression_len); + c_expression = (char *)HDmalloc(c_expression_len); if(NULL == c_expression) HGOTO_DONE(FAIL) } /* end if */ @@ -4223,7 +4220,7 @@ nh5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_den * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size ) +nh5pset_fapl_direct_c(hid_t_f UNUSED *fapl_id, size_t_f UNUSED *alignment, size_t_f UNUSED *block_size, size_t_f UNUSED *cbuf_size) { int ret_value = -1; #ifdef H5_HAVE_DIRECT @@ -4257,7 +4254,7 @@ nh5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_siz * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pget_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size ) +nh5pget_fapl_direct_c(hid_t_f UNUSED *fapl_id, size_t_f UNUSED *alignment, size_t_f UNUSED *block_size, size_t_f UNUSED *cbuf_size) { int ret_value = -1; #ifdef H5_HAVE_DIRECT diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index ba5d273..51a775f 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -16,6 +16,7 @@ /* This files contains C stubs for H5R Fortran APIs */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5rcreate_object_c @@ -27,39 +28,34 @@ * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_object_c (haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) +nh5rcreate_object_c(haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) { - int ret_value = -1; - hid_t c_loc_id; - int ret_value_c; - char *c_name; - size_t c_namelen; + char *c_name = NULL; hobj_ref_t ref_c; + int_f ret_value = 0; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* * Call H5Rcreate function. */ - c_loc_id = *loc_id; - ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_OBJECT, -1); + if(H5Rcreate(&ref_c, *loc_id, c_name, H5R_OBJECT, -1) < 0) + HGOTO_DONE(FAIL) - HDfree(c_name); - if (ret_value_c >= 0) { - *ref=(haddr_t_f)ref_c; - ret_value = 0; - } + /* Copy the reference created */ + *ref = (haddr_t_f)ref_c; +done: + if(c_name) + HDfree(c_name); return ret_value; -} +} /* nh5rcreate_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rcreate_region_c @@ -73,40 +69,34 @@ nh5rcreate_object_c (haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) +nh5rcreate_region_c(int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) { - int ret_value = -1; - hid_t c_loc_id; - hid_t c_space_id; - int ret_value_c; - char *c_name; - size_t c_namelen; + char *c_name = NULL; hdset_reg_ref_t ref_c; + int_f ret_value = 0; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* * Call H5Rcreate function. */ - c_loc_id = *loc_id; - c_space_id = *space_id; - ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_DATASET_REGION, c_space_id); - - HDfree(c_name); - if (ret_value_c >= 0) { - HDmemcpy (ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE); - ret_value = 0; - } + if(H5Rcreate(&ref_c, (hid_t)*loc_id, c_name, H5R_DATASET_REGION, (hid_t)*space_id) < 0) + HGOTO_DONE(FAIL) + + /* Copy the reference created */ + HDmemcpy(ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE); + +done: + if(c_name) + HDfree(c_name); return ret_value; -} +} /* end nh5rcreate_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rdereference_region_c @@ -117,29 +107,29 @@ nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) +nh5rdereference_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) { - int ret_value = -1; - hid_t c_dset_id; hdset_reg_ref_t ref_c; hid_t c_obj_id; + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to dereference */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rdereference function. */ - c_dset_id = *dset_id; - c_obj_id = H5Rdereference(c_dset_id, H5R_DATASET_REGION, &ref_c); - if(c_obj_id < 0) return ret_value; + if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the object's ID */ *obj_id = (hid_t_f)c_obj_id; - ret_value = 0; - return ret_value; -} +done: + return ret_value; +} /* end nh5rdereference_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rdereference_object_c @@ -150,28 +140,26 @@ nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) +nh5rdereference_object_c(hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) { - int ret_value = -1; - hid_t c_dset_id; hid_t c_obj_id; - hobj_ref_t ref_c; - - ref_c=*ref; + hobj_ref_t ref_c = (hobj_ref_t)*ref; + int_f ret_value = 0; /* * Call H5Rdereference function. */ - c_dset_id = *dset_id; - c_obj_id = H5Rdereference(c_dset_id, H5R_OBJECT, &ref_c); - if(c_obj_id < 0) return ret_value; + if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_OBJECT, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the object's ID */ *obj_id = (hid_t_f)c_obj_id; - ret_value = 0; + +done: return ret_value; -} +} /* end nh5rdereference_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_region_region_object_c @@ -182,28 +170,29 @@ nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) +nh5rget_region_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) { - int ret_value = -1; - hid_t c_dset_id; hid_t c_space_id; hdset_reg_ref_t ref_c; + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to dereference */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rget_region function. */ - c_dset_id = *dset_id; - c_space_id = H5Rget_region(c_dset_id, H5R_DATASET_REGION, &ref_c); - if(c_space_id < 0) return ret_value; + if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the dataspace ID */ *space_id = (hid_t_f)c_space_id; - ret_value = 0; + +done: return ret_value; -} +} /* end nh5rget_region_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_object_type_obj_c @@ -215,29 +204,26 @@ nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) +nh5rget_object_type_obj_c(hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) { H5O_type_t c_obj_type; - hobj_ref_t ref_c; - int_f ret_value = -1; - - ref_c = *ref; + hobj_ref_t ref_c = (hobj_ref_t)*ref; + int_f ret_value = 0; /* * Call H5Rget_object_type function. */ if(H5Rget_obj_type2((hid_t)*dset_id, H5R_OBJECT, &ref_c, &c_obj_type) < 0) - return ret_value; + HGOTO_DONE(FAIL) + /* Copy the object type */ *obj_type = (int_f)c_obj_type; - ret_value = 0; - +done: return ret_value; -} +} /* end nh5rget_object_type_obj_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_name_object_c @@ -252,42 +238,40 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) * Returns: 0 on success, -1 on failure * Programmer: M.S. Breitenfeld * March 31, 2008 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) +nh5rget_name_object_c(hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) { - hobj_ref_t ref_c; - int_f ret_value = -1; + hobj_ref_t ref_c = (hobj_ref_t)*ref; ssize_t c_size; - size_t c_bufsize; - char *c_buf= NULL; /* Buffer to hold C string */ + size_t c_bufsize = (size_t)*name_len + 1; + char *c_buf = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; - ref_c = *ref; - c_bufsize = (size_t)*name_len+1; /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) - return ret_value; - + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) + HGOTO_DONE(FAIL) + /* * Call H5Rget_name function. */ - if((c_size=H5Rget_name((hid_t)*loc_id, H5R_OBJECT, &ref_c, c_buf, c_bufsize)) < 0) - return ret_value; + if((c_size = H5Rget_name((hid_t)*loc_id, H5R_OBJECT, &ref_c, c_buf, c_bufsize)) < 0) + HGOTO_DONE(FAIL) + /* * Convert C name to FORTRAN and place it in the given buffer */ HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1); - *size_default = (size_t_f)c_size; - ret_value = 0; - if(c_buf) HDfree(c_buf); +done: + if(c_buf) + HDfree(c_buf); return ret_value; -} +} /* end nh5rget_name_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_name_region_c @@ -302,39 +286,40 @@ nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *nam * Returns: 0 on success, -1 on failure * Programmer: M.S. Breitenfeld * March 31, 2008 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) +nh5rget_name_region_c(hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) { hdset_reg_ref_t ref_c; - int_f ret_value = -1; ssize_t c_size; - size_t c_bufsize; - char *c_buf= NULL; /* Buffer to hold C string */ + size_t c_bufsize = (size_t)*name_len + 1; + char *c_buf = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to query */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); - c_bufsize = (size_t)*name_len+1; /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) - return ret_value; + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) + HGOTO_DONE(FAIL) /* * Call H5Rget_name function. */ - if((c_size=H5Rget_name((hid_t)*loc_id, H5R_DATASET_REGION, &ref_c, c_buf, c_bufsize)) < 0) - return ret_value; + if((c_size = H5Rget_name((hid_t)*loc_id, H5R_DATASET_REGION, &ref_c, c_buf, c_bufsize)) < 0) + HGOTO_DONE(FAIL) + /* * Convert C name to FORTRAN and place it in the given buffer */ - HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1); - + HD5packFstring(c_buf, _fcdtocp(name), c_bufsize - 1); *size_default = (size_t_f)c_size; - ret_value = 0; - if(c_buf) HDfree(c_buf); +done: + if(c_buf) + HDfree(c_buf); return ret_value; -} +} /* end nh5rget_name_region_c() */ + diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index dea3ff0..e161618 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -989,7 +989,7 @@ nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsi c_space_id = *space_id; rank = H5Sget_simple_extent_ndims(c_space_id); - c_coord = malloc(sizeof(hsize_t)*rank*(*nelements)); + c_coord = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank*(*nelements)); if(!c_coord) return ret_value; for (i=0; i< *nelements; i++) { for (j = 0; j < rank; j++) { @@ -1080,7 +1080,7 @@ nh5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) /* * Allocate buffer */ - if ((c_buf = HDmalloc(c_size)) == NULL) + if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size))) return ret_value; /* * Call H5Sencode function. diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 13fea93..37cfca0 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -990,7 +990,7 @@ nh5tget_member_name_c ( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *n char *c_name; c_type_id = *type_id; - c_index = *idx; + c_index = (unsigned)*idx; c_name = H5Tget_member_name(c_type_id, c_index); if (c_name == NULL ) return ret_value; @@ -1199,7 +1199,7 @@ nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype) /*---------------------------------------------------------------------------- * Name: h5tcreate_c * Purpose: Call H5Tcreate to create a datatype - * Inputs: class - class type + * Inputs: cls - class type * size - size of the class memeber * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -1208,14 +1208,14 @@ nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype) *---------------------------------------------------------------------------*/ int_f -nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id) +nh5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id) { int ret_value = -1; H5T_class_t c_class; size_t c_size; c_size =(size_t) *size; - c_class = (H5T_class_t) *class; + c_class = (H5T_class_t) *cls; *type_id = (hid_t_f)H5Tcreate(c_class, c_size); if(*type_id < 0) return ret_value; @@ -1419,7 +1419,7 @@ nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen) int_f c_value; c_value = *value; c_namelen = ((size_t)*namelen) +1; - c_name = (char *)malloc(sizeof(char)*c_namelen); + c_name = (char *)HDmalloc(sizeof(char)*c_namelen); c_type_id = (hid_t)*type_id; error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen); HD5packFstring(c_name, _fcdtocp(name), strlen(c_name)); @@ -1617,7 +1617,7 @@ nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ) * datatype member * Inputs: type_id - identifier of the dataspace * member_no - member's index - * Outputs: class - member's class + * Outputs: cls - member's class * and negative on failure. * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -1626,7 +1626,7 @@ nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ) *---------------------------------------------------------------------------*/ int_f -nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ) +nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls ) { int ret_value = 0; hid_t c_type_id; @@ -1638,7 +1638,7 @@ nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ) c_class = H5Tget_member_class(c_type_id, c_member_no); if ( c_class == H5T_NO_CLASS ) ret_value = -1; - *class = (int_f)c_class; + *cls = (int_f)c_class; return ret_value; } @@ -1766,18 +1766,18 @@ nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) return ret_value; } - c_size = (size_t)*nalloc; /* * Allocate buffer */ - if ((c_buf = HDmalloc(c_size)) == NULL) + c_size = (size_t)*nalloc; + if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size))) return ret_value; + /* * Call H5Tencode function. */ - if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0){ + if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0) return ret_value; - } /* copy the C buffer to the FORTRAN buffer. * Can not use HD5packFstring because we don't want to @@ -1788,7 +1788,8 @@ nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) HDmemcpy(_fcdtocp(buf),(char *)c_buf,c_size); ret_value = 0; - if(c_buf) HDfree(c_buf); + if(c_buf) + HDfree(c_buf); return ret_value; } diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index e0748b5b..12c55af 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -36,7 +36,6 @@ * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes ) @@ -254,7 +253,6 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f nh5close_types_c( hid_t_f * types, int_f *lentypes, @@ -300,13 +298,6 @@ nh5close_types_c( hid_t_f * types, int_f *lentypes, * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: Added Z flags. EIP, March 12, 2003 - * Added more FD flags and new H5LIB flags - * Added more FD flags for HDF5 file driver - * EIP, April 9, 2005 - * Added Generic flags introduced in version 1.8 - * MSB, January, 2008 - * Added types in lines h5*_flags = ( )variable to match input *---------------------------------------------------------------------------*/ int_f nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, @@ -644,36 +635,34 @@ nh5init1_flags_c(int_f *h5lib_flags) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Friday, November 17, 2000 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5open_c() +nh5open_c(void) { - int ret_value = -1; + if (H5open() < 0) return ret_value; ret_value = 0; return ret_value; } + /*--------------------------------------------------------------------------- * Name: h5close_c * Purpose: Calls H5close call to close C HDF5 library * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Friday, November 17, 2000 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5close_c() +nh5close_c(void) { - int ret_value = -1; + if (H5close() < 0) return ret_value; ret_value = 0; return ret_value; } - /*--------------------------------------------------------------------------- * Name: h5get_libversion_c * Purpose: Calls H5get_libversion function @@ -687,10 +676,9 @@ nh5close_c() * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) +nh5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum) { int ret_value = -1; @@ -705,7 +693,6 @@ nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) return ret_value; } - /*--------------------------------------------------------------------------- * Name: h5check_version_c * Purpose: Calls H5check_version function @@ -719,14 +706,13 @@ nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) * Returns: 0 on success, aborts on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5check_version_c( int_f *majnum, int_f *minnum, int_f *relnum) +nh5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum) { - int ret_value = -1; unsigned c_majnum, c_minnum, c_relnum; + c_majnum = (unsigned) *majnum; c_minnum = (unsigned) *minnum; c_relnum = (unsigned) *relnum; @@ -743,13 +729,12 @@ nh5check_version_c( int_f *majnum, int_f *minnum, int_f *relnum) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5garbage_collect_c() +nh5garbage_collect_c(void) { - int ret_value = -1; + if (H5garbage_collect() < 0) return ret_value; ret_value = 0; return ret_value; @@ -761,14 +746,14 @@ nh5garbage_collect_c() * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5dont_atexit_c() +nh5dont_atexit_c(void) { - int ret_value = -1; + if (H5dont_atexit() < 0) return ret_value; ret_value = 0; return ret_value; } + diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c index 68bb169..a809229 100644 --- a/fortran/src/H5f90kit.c +++ b/fortran/src/H5f90kit.c @@ -51,15 +51,15 @@ HD5f2cstring(_fcd fdesc, size_t len) /* Search for the end of the string */ str = _fcdtocp(fdesc); - for(i=(int)len-1; i>=0 && !isgraph((int)str[i]); i--) + for(i = (int)len - 1; i >= 0 && !HDisgraph((int)str[i]); i--) /*EMPTY*/; /* Allocate C string */ - if ((cstr = HDmalloc( (size_t)(i + 2))) == NULL) + if(NULL == (cstr = (char *)HDmalloc((size_t)(i + 2)))) return NULL; /* Copy text from FORTRAN to C string */ - HDmemcpy(cstr,str,(size_t)(i+1)); + HDmemcpy(cstr, str, (size_t)(i + 1)); /* Terminate C string */ cstr[i + 1] = '\0'; diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 7f16359..3958e61 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -671,7 +671,7 @@ H5_FCDLL int_f nh5arename_c( hid_t_f *loc_id, # define nh5tcompiler_conv_c H5_FC_FUNC_(h5tcompiler_conv_c, H5TCOMPILER_CONV_C) # define nh5tget_native_type_c H5_FC_FUNC_(h5tget_native_type_c, H5TGET_NATIVE_TYPE_C) -H5_FCDLL int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id); +H5_FCDLL int_f nh5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id); H5_FCDLL int_f nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id ); H5_FCDLL int_f nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *lcpl_id, hid_t_f *tcpl_id, hid_t_f *tapl_id); H5_FCDLL int_f nh5tclose_c ( hid_t_f *type_id ); @@ -726,7 +726,7 @@ H5_FCDLL int_f nh5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims); H5_FCDLL int_f nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id); H5_FCDLL int_f nh5tvlen_create_c ( hid_t_f *type_id , hid_t_f *vltype_id); H5_FCDLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); -H5_FCDLL int_f nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ); +H5_FCDLL int_f nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls ); H5_FCDLL int_f nh5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id, hid_t_f *tcpl_id, hid_t_f *tapl_id); H5_FCDLL int_f nh5tdecode_c ( _fcd buf, hid_t_f *obj_id ); H5_FCDLL int_f nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ); @@ -908,7 +908,7 @@ H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, s # define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C) # define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C) -H5_FCDLL int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ); +H5_FCDLL int_f nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ); H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); H5_FCDLL int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id); H5_FCDLL int_f nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f *c_flag); @@ -990,12 +990,12 @@ H5_FCDLL int_f nh5pset_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); H5_FCDLL int_f nh5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); -H5_FCDLL int_f nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class); -H5_FCDLL int_f nh5pregister_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_integer_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_real_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_double_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregisterc_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); +H5_FCDLL int_f nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls); +H5_FCDLL int_f nh5pregister_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_integer_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_real_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_double_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregisterc_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); H5_FCDLL int_f nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f nh5pinsert_integer_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f nh5pinsert_real_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); @@ -1018,8 +1018,8 @@ H5_FCDLL int_f nh5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id); H5_FCDLL int_f nh5pisa_class_c(hid_t_f *plist, hid_t_f *pclass); H5_FCDLL int_f nh5pcopy_prop_c(hid_t_f *dst_id, hid_t_f *src_id, _fcd name, int_f *name_len); H5_FCDLL int_f nh5premove_c(hid_t_f *plid, _fcd name, int_f *name_len); -H5_FCDLL int_f nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len); -H5_FCDLL int_f nh5pclose_class_c(hid_t_f * class); +H5_FCDLL int_f nh5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len); +H5_FCDLL int_f nh5pclose_class_c(hid_t_f * cls); H5_FCDLL int_f nh5pget_class_name_c(hid_t_f *prp_id, _fcd name, int_f *name_len); H5_FCDLL int_f nh5pset_shuffle_c ( hid_t_f *prp_id); H5_FCDLL int_f nh5pset_fletcher32_c ( hid_t_f *prp_id ); diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index cbb002b..c5a16bc 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -209,6 +209,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -270,6 +271,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -326,6 +328,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -436,7 +439,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index a536c2e..3c905e7 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -30,6 +30,7 @@ ADD_LIBRARY (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.f90) ADD_DEPENDENCIES(${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_TARGET} ) +SET (SHARED_LINK_FLAGS " ") IF (WIN32 AND NOT CYGWIN) IF (BUILD_SHARED_LIBS) SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET} @@ -37,11 +38,7 @@ IF (WIN32 AND NOT CYGWIN) BUILD_HDF5_DLL ) IF (MSVC) - SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} - PROPERTIES - COMPILE_FLAGS "/dll" - LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL" - ) + SET (SHARED_LINK_FLAGS "/DLL") ENDIF (MSVC) ENDIF (BUILD_SHARED_LIBS) SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET} @@ -49,6 +46,7 @@ IF (WIN32 AND NOT CYGWIN) HDF5F90_WINDOWS ) ENDIF (WIN32 AND NOT CYGWIN) +TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} ${SHARED_LINK_FLAGS}) SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) TARGET_LINK_LIBRARIES (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} ${LIB_TYPE}) @@ -74,8 +72,8 @@ ADD_EXECUTABLE (testhdf5_fortran tH5VL.f90 tH5Z.f90 ) -H5_NAMING (testhdf5_fortran) -TARGET_FORTRAN_WIN_PROPERTIES (testhdf5_fortran) +H5_NAMING (testhdf5_fortran ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (testhdf5_fortran "") TARGET_LINK_LIBRARIES (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} @@ -96,8 +94,8 @@ ADD_EXECUTABLE (testhdf5_fortran_1_8 tH5A_1_8.f90 tH5G_1_8.f90 ) -H5_NAMING (testhdf5_fortran_1_8) -TARGET_FORTRAN_WIN_PROPERTIES (testhdf5_fortran_1_8) +H5_NAMING (testhdf5_fortran_1_8 ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (testhdf5_fortran_1_8 "") TARGET_LINK_LIBRARIES (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} @@ -112,8 +110,8 @@ ADD_TEST (NAME testhdf5_fortran_1_8 COMMAND $<TARGET_FILE:testhdf5_fortran_1_8>) #-- Adding test for fflush1 ADD_EXECUTABLE (fflush1 fflush1.f90) -H5_NAMING (fflush1) -TARGET_FORTRAN_WIN_PROPERTIES (fflush1) +H5_NAMING (fflush1 ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (fflush1 "") TARGET_LINK_LIBRARIES (fflush1 ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} @@ -128,8 +126,8 @@ ADD_TEST (NAME fflush1 COMMAND $<TARGET_FILE:fflush1>) #-- Adding test for fflush2 ADD_EXECUTABLE (fflush2 fflush2.f90) -H5_NAMING (fflush2) -TARGET_FORTRAN_WIN_PROPERTIES (fflush2) +H5_NAMING (fflush2 ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (fflush2 "") TARGET_LINK_LIBRARIES (fflush2 ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 4c0b03f..6fdfdf4 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -190,6 +190,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -251,6 +252,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -307,6 +309,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/fortran/test/tH5A_1_8.f90 b/fortran/test/tH5A_1_8.f90 index 223877c..c48420e 100644 --- a/fortran/test/tH5A_1_8.f90 +++ b/fortran/test/tH5A_1_8.f90 @@ -158,13 +158,13 @@ SUBROUTINE attribute_test_1_8(cleanup, total_error) !!$ CALL test_attr_corder_transition(my_fcpl, my_fapl) !!$ CALL test_attr_corder_delete(my_fcpl, my_fapl) ret_total_error = 0 - CALL test_attr_info_by_idx(new_format, my_fcpl, my_fapl, ret_total_error) + CALL test_attr_info_by_idx(new_format(i), my_fcpl, my_fapl, ret_total_error) CALL write_test_status(ret_total_error, & ' - Testing querying attribute info by index', & total_error) ret_total_error = 0 - CALL test_attr_delete_by_idx(new_format, my_fcpl, my_fapl, ret_total_error) + CALL test_attr_delete_by_idx(new_format(i), my_fcpl, my_fapl, ret_total_error) CALL write_test_status(ret_total_error, & ' - Testing deleting attribute by index', & total_error) @@ -718,7 +718,7 @@ SUBROUTINE test_attr_create_by_name(new_format,fcpl,fapl, total_error) CALL check("h5aclose_f",error,total_error) ! /* Verify information for NEW attribute */ - CALL attr_info_by_idx_check(my_dataset, attrname, INT(u,HSIZE_T), use_index, total_error) + CALL attr_info_by_idx_check(my_dataset, attrname, INT(u,HSIZE_T), use_index(i), total_error) ! CALL check("FAILED IN attr_info_by_idx_check",total_error) ENDDO diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index edabb35..9cfbae5 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -21,8 +21,8 @@ ADD_EXECUTABLE (parallel_test hyper.f90 mdset.f90 ) -H5_NAMING (parallel_test) -TARGET_FORTRAN_WIN_PROPERTIES (parallel_test) +H5_NAMING (parallel_test ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (parallel_test "") TARGET_LINK_LIBRARIES (parallel_test ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index f2e70b4..e592160 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -143,6 +143,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -204,6 +205,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -260,6 +262,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 2871734..9ce3043 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -6,6 +6,8 @@ PROJECT (HDF5_HL) #----------------------------------------------------------------------------- IF (BUILD_SHARED_LIBS) SET (HL_BUILT_AS_DYNAMIC_LIB 1) +ELSE (BUILD_SHARED_LIBS) + SET (HL_BUILT_AS_STATIC_LIB 1) ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- diff --git a/hl/Makefile.in b/hl/Makefile.in index f599f5c..9924bc9 100755 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -157,6 +157,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -218,6 +219,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -274,6 +276,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index f0a1d05..2ff76ec 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -153,6 +153,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -214,6 +215,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -270,6 +272,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 23b0db3..9b86027 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -10,29 +10,25 @@ INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src) # -------------------------------------------------------------------- # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- -IF (HDF5_BUILD_EXAMPLES) - ADD_EXECUTABLE (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) - H5_NAMING (ptExampleFL) - TARGET_WIN_PROPERTIES (ptExampleFL) - TARGET_LINK_LIBRARIES ( - ptExampleFL - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} - ) +ADD_EXECUTABLE (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) +H5_NAMING (ptExampleFL ${LIB_TYPE}) +TARGET_LINK_LIBRARIES ( + ptExampleFL + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} +) - ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) - - ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp) - H5_NAMING (ptExampleVL) - TARGET_WIN_PROPERTIES (ptExampleVL) - TARGET_LINK_LIBRARIES ( - ptExampleVL - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} - ) +ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp) +H5_NAMING (ptExampleVL ${LIB_TYPE}) +TARGET_LINK_LIBRARIES ( + ptExampleVL + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} +) +IF (BUILD_TESTING) + ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) ADD_TEST (NAME cpp_hl_ex_ptExampleVL COMMAND $<TARGET_FILE:ptExampleVL>) - -ENDIF (HDF5_BUILD_EXAMPLES) +ENDIF (BUILD_TESTING) diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index 837f4c8..009b7d2 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -119,6 +119,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -180,6 +181,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -236,6 +238,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -613,7 +616,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index e20c7e9..5e31fcf 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -165,6 +165,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -226,6 +227,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -282,6 +284,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -392,7 +395,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index cf621a2..c7fb793 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -17,8 +17,7 @@ IF (BUILD_TESTING) INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) - H5_NAMING (hl_ptableTest) - TARGET_WIN_PROPERTIES (hl_ptableTest) + H5_NAMING (hl_ptableTest ${LIB_TYPE}) TARGET_LINK_LIBRARIES ( hl_ptableTest ${HDF5_LIB_TARGET} diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index 3128fe8..29a7ab1 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -139,6 +139,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -200,6 +201,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -256,6 +258,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 227f066..298ce94 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,6 +1,20 @@ cmake_minimum_required (VERSION 2.8) PROJECT (HDF5_HL_EXAMPLES ) +SET (HDF5_TEST_FILES +) + +FOREACH (h5_file ${HDF5_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying ${h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET h5dump + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +ENDFOREACH (h5_file ${HDF5_TEST_FILES}) + #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- @@ -29,9 +43,28 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - H5_NAMING (hl_ex_${example}) - TARGET_WIN_PROPERTIES (hl_ex_${example}) + H5_NAMING (hl_ex_${example} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + + IF (BUILD_TESTING) + ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) + ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) +IF (BUILD_TESTING) + SET (HDF5_TEST_FILES + image24pixel.txt + image8.txt + ) + FOREACH (h5_file ${HDF5_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying ${h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET hl_ex_ex_ds1 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) + ENDFOREACH (h5_file ${HDF5_TEST_FILES}) +ENDIF (BUILD_TESTING) diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 48cc9d9..b7bd414 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -119,6 +119,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -180,6 +181,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -236,6 +238,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -654,7 +657,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index cbf948b..4ea48ae 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -157,6 +157,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -218,6 +219,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -274,6 +276,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 5e20da3..698407d 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -18,12 +18,17 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - H5_NAMING (hl_f90_ex_${example}) - TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_ex_${example}) + H5_NAMING (hl_f90_ex_${example} ${LIB_TYPE}) + TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_ex_${example} "") TARGET_LINK_LIBRARIES (hl_f90_ex_${example} ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) + + IF (BUILD_TESTING) + ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) + ENDIF (BUILD_TESTING) + ENDFOREACH (example ${examples}) diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 0351309..9b11c56 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -120,6 +120,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -181,6 +182,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -237,6 +239,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -616,7 +619,8 @@ uninstall-local: install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ + chmod a-x $(EXAMPLEDIR)/$$f; \ fi; \ done @for f in X $(INSTALL_SCRIPT_FILES); do \ diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 421fdff..ca0a35f 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -51,6 +51,7 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE}) ADD_LIBRARY (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) +SET (SHARED_LINK_FLAGS " ") IF (BUILD_SHARED_LIBS) IF (WIN32 AND NOT CYGWIN) SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} @@ -58,11 +59,7 @@ IF (BUILD_SHARED_LIBS) BUILD_HDF5_DLL ) IF (MSVC) - SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} - PROPERTIES - COMPILE_FLAGS "/dll" - LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL" - ) + SET (SHARED_LINK_FLAGS "/DLL") ENDIF (MSVC) ENDIF (WIN32 AND NOT CYGWIN) ENDIF (BUILD_SHARED_LIBS) @@ -72,6 +69,7 @@ IF (WIN32 AND NOT CYGWIN) HDF5F90_WINDOWS ) ENDIF (WIN32 AND NOT CYGWIN) +TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} ${SHARED_LINK_FLAGS}) SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET} diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 8a9d6c0..3e45531 100755 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -23,8 +23,8 @@ #include <string.h> -H5_DLL char* HD5f2cstring (_fcd fdesc, int len); -H5_DLL void HD5packFstring (char *src, char *dest, size_t len); +HDF5_HL_F90CSTUBDLL char* HD5f2cstring (_fcd fdesc, int len); +HDF5_HL_F90CSTUBDLL void HD5packFstring (char *src, char *dest, size_t len); /* @@ -139,7 +139,7 @@ H5_DLL void HD5packFstring (char *src, char *dest, size_t len); # define nh5tbget_table_info_c H5_FC_FUNC_(h5tbget_table_info_c, H5TBGET_TABLE_INFO_C) # define nh5tbget_field_info_c H5_FC_FUNC_(h5tbget_field_info_c, H5TBGET_FIELD_INFO_C) -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_c (hid_t_f *loc_id, int_f *namelen, @@ -149,7 +149,7 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_int1_c (hid_t_f *loc_id, int_f *namelen, @@ -159,7 +159,7 @@ nh5ltmake_dataset_int1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_int2_c (hid_t_f *loc_id, int_f *namelen, @@ -169,7 +169,7 @@ nh5ltmake_dataset_int2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_int3_c (hid_t_f *loc_id, int_f *namelen, @@ -179,7 +179,7 @@ nh5ltmake_dataset_int3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_fl1_c (hid_t_f *loc_id, int_f *namelen, @@ -189,7 +189,7 @@ nh5ltmake_dataset_fl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_fl2_c (hid_t_f *loc_id, int_f *namelen, @@ -199,7 +199,7 @@ nh5ltmake_dataset_fl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_fl3_c (hid_t_f *loc_id, int_f *namelen, @@ -209,7 +209,7 @@ nh5ltmake_dataset_fl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_dl1_c (hid_t_f *loc_id, int_f *namelen, @@ -219,7 +219,7 @@ nh5ltmake_dataset_dl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_dl2_c (hid_t_f *loc_id, int_f *namelen, @@ -229,7 +229,7 @@ nh5ltmake_dataset_dl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_dl3_c (hid_t_f *loc_id, int_f *namelen, @@ -239,7 +239,7 @@ nh5ltmake_dataset_dl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nint1_c (hid_t_f *loc_id, int_f *namelen, @@ -249,7 +249,7 @@ nh5ltmake_dataset_nint1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, int_f *namelen, @@ -259,7 +259,7 @@ nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, int_f *namelen, @@ -269,7 +269,7 @@ nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id, int_f *namelen, @@ -279,7 +279,7 @@ nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id, int_f *namelen, @@ -289,7 +289,7 @@ nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_nfl3_c (hid_t_f *loc_id, int_f *namelen, @@ -299,7 +299,7 @@ nh5ltmake_dataset_nfl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_ndl1_c (hid_t_f *loc_id, int_f *namelen, @@ -309,7 +309,7 @@ nh5ltmake_dataset_ndl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_ndl2_c (hid_t_f *loc_id, int_f *namelen, @@ -319,7 +319,7 @@ nh5ltmake_dataset_ndl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_ndl3_c (hid_t_f *loc_id, int_f *namelen, @@ -329,7 +329,7 @@ nh5ltmake_dataset_ndl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_c (hid_t_f *loc_id, int_f *namelen, @@ -339,7 +339,7 @@ nh5ltread_dataset_c (hid_t_f *loc_id, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_int1_c (hid_t_f *loc_id, int_f *namelen, @@ -348,7 +348,7 @@ nh5ltread_dataset_int1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_int2_c (hid_t_f *loc_id, int_f *namelen, @@ -357,7 +357,7 @@ nh5ltread_dataset_int2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_int3_c (hid_t_f *loc_id, int_f *namelen, @@ -366,7 +366,7 @@ nh5ltread_dataset_int3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_fl1_c (hid_t_f *loc_id, int_f *namelen, @@ -375,7 +375,7 @@ nh5ltread_dataset_fl1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_fl2_c (hid_t_f *loc_id, int_f *namelen, @@ -384,7 +384,7 @@ nh5ltread_dataset_fl2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_fl3_c (hid_t_f *loc_id, int_f *namelen, @@ -393,7 +393,7 @@ nh5ltread_dataset_fl3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_dl1_c (hid_t_f *loc_id, int_f *namelen, @@ -402,7 +402,7 @@ nh5ltread_dataset_dl1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_dl2_c (hid_t_f *loc_id, int_f *namelen, @@ -411,7 +411,7 @@ nh5ltread_dataset_dl2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_dl3_c (hid_t_f *loc_id, int_f *namelen, @@ -420,7 +420,7 @@ nh5ltread_dataset_dl3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nint1_c (hid_t_f *loc_id, int_f *namelen, @@ -429,7 +429,7 @@ nh5ltread_dataset_nint1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nint2_c (hid_t_f *loc_id, int_f *namelen, @@ -438,7 +438,7 @@ nh5ltread_dataset_nint2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nint3_c (hid_t_f *loc_id, int_f *namelen, @@ -447,7 +447,7 @@ nh5ltread_dataset_nint3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nfl1_c (hid_t_f *loc_id, int_f *namelen, @@ -456,7 +456,7 @@ nh5ltread_dataset_nfl1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nfl2_c (hid_t_f *loc_id, int_f *namelen, @@ -465,7 +465,7 @@ nh5ltread_dataset_nfl2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_nfl3_c (hid_t_f *loc_id, int_f *namelen, @@ -474,7 +474,7 @@ nh5ltread_dataset_nfl3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_ndl1_c (hid_t_f *loc_id, int_f *namelen, @@ -483,7 +483,7 @@ nh5ltread_dataset_ndl1_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_ndl2_c (hid_t_f *loc_id, int_f *namelen, @@ -492,7 +492,7 @@ nh5ltread_dataset_ndl2_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_ndl3_c (hid_t_f *loc_id, int_f *namelen, @@ -501,7 +501,7 @@ nh5ltread_dataset_ndl3_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltset_attribute_int_c(hid_t_f *loc_id, int_f *namelen, @@ -511,7 +511,7 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, size_t_f *size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltset_attribute_float_c(hid_t_f *loc_id, int_f *namelen, @@ -521,7 +521,7 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, size_t_f *size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltset_attribute_double_c(hid_t_f *loc_id, int_f *namelen, @@ -531,7 +531,7 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, size_t_f *size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltset_attribute_string_c(hid_t_f *loc_id, int_f *namelen, @@ -542,7 +542,7 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_int_c(hid_t_f *loc_id, int_f *namelen, @@ -551,7 +551,7 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, _fcd attrname, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_float_c(hid_t_f *loc_id, int_f *namelen, @@ -560,7 +560,7 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, _fcd attrname, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_double_c(hid_t_f *loc_id, int_f *namelen, @@ -569,7 +569,7 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, _fcd attrname, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_string_c(hid_t_f *loc_id, int_f *namelen, @@ -578,20 +578,20 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, _fcd attrname, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_dataset_ndims_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *rank); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltfind_dataset_c(hid_t_f *loc_id, int_f *namelen, _fcd name); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *namelen, @@ -600,7 +600,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *type_class, size_t_f *type_size); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_ndims_c(hid_t_f *loc_id, int_f *namelen, @@ -608,7 +608,7 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, int_f *attrnamelen, _fcd attrname, int_f *rank); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltget_attribute_info_c(hid_t_f *loc_id, int_f *namelen, @@ -619,7 +619,7 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, int_f *type_class, size_t_f *type_size); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *namelen, @@ -627,7 +627,7 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *buflen, char *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5ltread_dataset_string_c (hid_t_f *loc_id, int_f *namelen, @@ -639,7 +639,7 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, *------------------------------------------------------------------------- */ -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5immake_image_8bit_c (hid_t_f *loc_id, int_f *namelen, @@ -647,14 +647,14 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, hsize_t_f *width, hsize_t_f *height, int_f *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imread_image_c (hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5immake_image_24bit_c (hid_t_f *loc_id, int_f *namelen, @@ -664,7 +664,7 @@ nh5immake_image_24bit_c (hid_t_f *loc_id, hsize_t_f *width, hsize_t_f *height, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imget_image_info_c(hid_t_f *loc_id, int_f *namelen, @@ -677,14 +677,14 @@ nh5imget_image_info_c(hid_t_f *loc_id, _fcd interlace); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imis_image_c(hid_t_f *loc_id, int_f *namelen, _fcd name); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5immake_palette_c (hid_t_f *loc_id, int_f *namelen, @@ -692,7 +692,7 @@ nh5immake_palette_c (hid_t_f *loc_id, hsize_t_f *dims, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imlink_palette_c (hid_t_f *loc_id, int_f *namelen, @@ -700,7 +700,7 @@ nh5imlink_palette_c (hid_t_f *loc_id, int_f *ilen, _fcd pal_name); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imunlink_palette_c (hid_t_f *loc_id, int_f *namelen, @@ -708,7 +708,7 @@ nh5imunlink_palette_c (hid_t_f *loc_id, int_f *ilen, _fcd pal_name); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imget_npalettes_c(hid_t_f *loc_id, int_f *namelen, @@ -716,7 +716,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id, hsize_t_f *npals); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imget_palette_info_c(hid_t_f *loc_id, int_f *namelen, @@ -724,7 +724,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id, int_f *pal_number, hsize_t_f *dims); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imget_palette_c(hid_t_f *loc_id, int_f *namelen, @@ -732,7 +732,7 @@ nh5imget_palette_c(hid_t_f *loc_id, int_f *pal_number, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5imis_palette_c(hid_t_f *loc_id, int_f *namelen, @@ -745,7 +745,7 @@ nh5imis_palette_c(hid_t_f *loc_id, *------------------------------------------------------------------------- */ -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbmake_table_c(int_f *namelen1, _fcd name1, @@ -762,7 +762,7 @@ nh5tbmake_table_c(int_f *namelen1, int_f *len, /* field_names lenghts */ _fcd buf); /* field_names */ -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, @@ -774,7 +774,7 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_name_int_c(hid_t_f *loc_id, int_f *namelen, @@ -786,7 +786,7 @@ nh5tbwrite_field_name_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -798,7 +798,7 @@ nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -810,7 +810,7 @@ nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_name_st_c(hid_t_f *loc_id, int_f *namelen, @@ -822,7 +822,7 @@ nh5tbwrite_field_name_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_name_c(hid_t_f *loc_id, int_f *namelen, @@ -834,7 +834,7 @@ nh5tbread_field_name_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_name_int_c(hid_t_f *loc_id, int_f *namelen, @@ -846,7 +846,7 @@ nh5tbread_field_name_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_name_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -858,7 +858,7 @@ nh5tbread_field_name_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_name_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -870,7 +870,7 @@ nh5tbread_field_name_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_name_st_c(hid_t_f *loc_id, int_f *namelen, @@ -882,7 +882,7 @@ nh5tbread_field_name_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_index_c(hid_t_f *loc_id, int_f *namelen, @@ -893,7 +893,7 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_index_int_c(hid_t_f *loc_id, int_f *namelen, @@ -904,7 +904,7 @@ nh5tbwrite_field_index_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -915,7 +915,7 @@ nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -926,7 +926,7 @@ nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbwrite_field_index_st_c(hid_t_f *loc_id, int_f *namelen, @@ -937,7 +937,7 @@ nh5tbwrite_field_index_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_index_c(hid_t_f *loc_id, int_f *namelen, @@ -948,7 +948,7 @@ nh5tbread_field_index_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_index_int_c(hid_t_f *loc_id, int_f *namelen, @@ -959,7 +959,7 @@ nh5tbread_field_index_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_index_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -970,7 +970,7 @@ nh5tbread_field_index_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_index_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -981,7 +981,7 @@ nh5tbread_field_index_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbread_field_index_st_c(hid_t_f *loc_id, int_f *namelen, @@ -992,7 +992,7 @@ nh5tbread_field_index_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbinsert_field_c(hid_t_f *loc_id, int_f *namelen, @@ -1003,7 +1003,7 @@ nh5tbinsert_field_c(hid_t_f *loc_id, int_f *position, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbinsert_field_int_c(hid_t_f *loc_id, int_f *namelen, @@ -1013,7 +1013,7 @@ nh5tbinsert_field_int_c(hid_t_f *loc_id, hid_t_f *field_type, int_f *position, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbinsert_field_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -1023,7 +1023,7 @@ nh5tbinsert_field_fl_c(hid_t_f *loc_id, hid_t_f *field_type, int_f *position, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbinsert_field_dl_c(hid_t_f *loc_id, int_f *namelen, @@ -1033,7 +1033,7 @@ nh5tbinsert_field_dl_c(hid_t_f *loc_id, hid_t_f *field_type, int_f *position, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbinsert_field_st_c(hid_t_f *loc_id, int_f *namelen, @@ -1043,7 +1043,7 @@ nh5tbinsert_field_st_c(hid_t_f *loc_id, hid_t_f *field_type, int_f *position, void *buf); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, @@ -1052,7 +1052,7 @@ nh5tbdelete_field_c(hid_t_f *loc_id, _fcd field_name); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbget_table_info_c(hid_t_f *loc_id, int_f *namelen, @@ -1060,7 +1060,7 @@ nh5tbget_table_info_c(hid_t_f *loc_id, hsize_t_f *nfields, hsize_t_f *nrecords); -H5_DLL +HDF5_HL_F90CSTUBDLL int_f nh5tbget_field_info_c(hid_t_f *loc_id, int_f *namelen, diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index e942138..76a3f1c 100755 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -32,9 +32,6 @@ * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ int_f @@ -58,11 +55,7 @@ nh5tbmake_table_c(int_f *namelen1, hsize_t num_elem; hsize_t i; int max_len = 1; - hid_t c_loc_id = *loc_id; - hsize_t c_nfields = *nfields; - hsize_t c_nrecords = *nrecords; - hsize_t c_chunk_size = *chunk_size; - size_t c_type_size = *type_size; + hsize_t c_nfields = (hsize_t)*nfields; size_t *c_field_offset = NULL; hid_t *c_field_types = NULL; char **c_field_names = NULL; @@ -70,10 +63,9 @@ nh5tbmake_table_c(int_f *namelen1, int_f ret_value = 0; num_elem = *nfields; - for(i = 0; i < num_elem; i++) { + for(i = 0; i < num_elem; i++) if(namelen2[i] > max_len) max_len = namelen2[i]; - } /* * convert FORTRAN name to C name @@ -87,10 +79,10 @@ nh5tbmake_table_c(int_f *namelen1, if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - for (i = 0; i < num_elem; i++) { + for(i = 0; i < num_elem; i++) { c_field_offset[i] = field_offset[i]; c_field_types[i] = field_types[i]; - } + } /* end for */ /* * allocate array of character pointers @@ -118,9 +110,9 @@ nh5tbmake_table_c(int_f *namelen1, /* * call H5TBmake_table function. */ - if(H5TBmake_table(c_name1, c_loc_id, c_name, c_nfields, c_nrecords, - c_type_size, c_field_names, c_field_offset, c_field_types, - c_chunk_size, NULL, *compress, NULL) < 0) + if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, + (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types, + (hsize_t)*chunk_size, NULL, *compress, NULL) < 0) HGOTO_DONE(FAIL) done: @@ -132,7 +124,7 @@ done: for(i = 0; i < num_elem; i++) { if(c_field_names[i]) HDfree(c_field_names[i]); - } + } /* end for */ HDfree(c_field_names); } /* end if */ if(tmp) @@ -143,8 +135,7 @@ done: HDfree(c_field_types); return ret_value; -} - +} /* end nh5tbmake_table_c() */ /*------------------------------------------------------------------------- * Function: h5tbwrite_field_name_c @@ -159,12 +150,8 @@ done: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, @@ -177,26 +164,23 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, void *buf) { char *c_name = NULL; - char *c_name1 = NULL; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; + char *c_name1 = NULL; + size_t c_type_size[1] = {(size_t)*type_size}; int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* - * call H5TBwrite_fields_name function. - */ - if(H5TBwrite_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords, - c_type_size, 0, &c_type_size, buf) < 0) + * call H5TBwrite_fields_name function. + */ + if(H5TBwrite_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, + (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: @@ -219,8 +203,10 @@ nh5tbwrite_field_name_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } + int_f nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, int_f *namelen, @@ -232,7 +218,8 @@ nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } int_f @@ -246,7 +233,8 @@ nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } int_f @@ -260,7 +248,8 @@ nh5tbwrite_field_name_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } /*------------------------------------------------------------------------- @@ -276,12 +265,8 @@ nh5tbwrite_field_name_st_c(hid_t_f *loc_id, * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbread_field_name_c(hid_t_f *loc_id, int_f *namelen, @@ -295,25 +280,22 @@ nh5tbread_field_name_c(hid_t_f *loc_id, { char *c_name = NULL; char *c_name1 = NULL; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; + size_t c_type_size[1] = {(size_t)*type_size}; int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* - * call H5TBread_fields_name function. - */ - if(H5TBread_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords, - c_type_size, 0, &c_type_size, buf) < 0) + * call H5TBread_fields_name function. + */ + if(H5TBread_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, + (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: @@ -336,7 +318,8 @@ nh5tbread_field_name_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } int_f @@ -350,7 +333,8 @@ nh5tbread_field_name_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } int_f @@ -364,7 +348,8 @@ nh5tbread_field_name_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } int_f @@ -378,7 +363,8 @@ nh5tbread_field_name_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id, namelen, name, namelen1, field_name, + start, nrecords, type_size, buf); } /*------------------------------------------------------------------------- @@ -394,12 +380,8 @@ nh5tbread_field_name_st_c(hid_t_f *loc_id, * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbwrite_field_index_c(hid_t_f *loc_id, int_f *namelen, @@ -411,25 +393,22 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, void *buf) { char *c_name = NULL; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; int c_field_index = *field_index - 1; /* C zero based index */ int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) /* - * call H5TBwrite_fields_name function. - */ - if(H5TBwrite_fields_index(c_loc_id, c_name, (hsize_t)1, &c_field_index, - c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0) + * call H5TBwrite_fields_name function. + */ + if(H5TBwrite_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, + (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: @@ -449,7 +428,8 @@ nh5tbwrite_field_index_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -462,7 +442,8 @@ nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -475,7 +456,8 @@ nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -488,7 +470,8 @@ nh5tbwrite_field_index_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } /*------------------------------------------------------------------------- @@ -504,12 +487,8 @@ nh5tbwrite_field_index_st_c(hid_t_f *loc_id, * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbread_field_index_c(hid_t_f *loc_id, int_f *namelen, @@ -521,9 +500,6 @@ nh5tbread_field_index_c(hid_t_f *loc_id, void *buf) { char *c_name = NULL; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; size_t c_type_size = *type_size; int c_field_index = *field_index - 1; /* C zero based index */ int_f ret_value = 0; @@ -537,8 +513,8 @@ nh5tbread_field_index_c(hid_t_f *loc_id, /* * call H5TBread_fields_index function. */ - if(H5TBread_fields_index(c_loc_id, c_name,(hsize_t)1, &c_field_index, - c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0) + if(H5TBread_fields_index((hid_t)*loc_id, c_name,(hsize_t)1, &c_field_index, + (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: @@ -558,7 +534,8 @@ nh5tbread_field_index_int_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -571,7 +548,8 @@ nh5tbread_field_index_fl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -584,7 +562,8 @@ nh5tbread_field_index_dl_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } int_f @@ -597,7 +576,8 @@ nh5tbread_field_index_st_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id, namelen, name, field_index, start, + nrecords, type_size, buf); } /*------------------------------------------------------------------------- @@ -613,12 +593,8 @@ nh5tbread_field_index_st_c(hid_t_f *loc_id, * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbinsert_field_c(hid_t_f *loc_id, int_f *namelen, @@ -631,29 +607,25 @@ nh5tbinsert_field_c(hid_t_f *loc_id, { char *c_name = NULL; char *c_name1 = NULL; - hid_t c_loc_id = *loc_id; - hid_t c_field_type = *field_type; - hsize_t c_position = *position; int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* - * call H5TBinsert_field function. - */ - - if(H5TBinsert_field(c_loc_id, c_name, c_name1, c_field_type, c_position, - NULL, buf) < 0) + * call H5TBinsert_field function. + */ + if(H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type, + (hsize_t)*position, NULL, buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name ) + if(c_name) HDfree(c_name); if(c_name1) HDfree(c_name1); @@ -671,7 +643,8 @@ nh5tbinsert_field_int_c(hid_t_f *loc_id, int_f *position, void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id, namelen, name, namelen1, field_name, + field_type, position, buf); } int_f @@ -684,7 +657,8 @@ nh5tbinsert_field_fl_c(hid_t_f *loc_id, int_f *position, void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id, namelen, name, namelen1, field_name, + field_type, position, buf); } int_f @@ -697,7 +671,8 @@ nh5tbinsert_field_dl_c(hid_t_f *loc_id, int_f *position, void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id, namelen, name, namelen1, field_name, + field_type, position, buf); } int_f @@ -710,7 +685,8 @@ nh5tbinsert_field_st_c(hid_t_f *loc_id, int_f *position, void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id, namelen, name, namelen1, field_name, + field_type, position, buf); } /*------------------------------------------------------------------------- @@ -726,12 +702,8 @@ nh5tbinsert_field_st_c(hid_t_f *loc_id, * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, @@ -741,7 +713,6 @@ nh5tbdelete_field_c(hid_t_f *loc_id, { char *c_name = NULL; char *c_name1 = NULL; - hid_t c_loc_id = *loc_id; int_f ret_value = 0; /* @@ -755,13 +726,12 @@ nh5tbdelete_field_c(hid_t_f *loc_id, /* * call H5TBinsert_field function. */ - if(H5TBdelete_field(c_loc_id, c_name, c_name1) < 0) + if(H5TBdelete_field((hid_t)*loc_id, c_name, c_name1) < 0) HGOTO_DONE(FAIL) done: if(c_name) HDfree(c_name); - if(c_name1) HDfree(c_name1); @@ -781,12 +751,8 @@ done: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - int_f nh5tbget_table_info_c(hid_t_f *loc_id, int_f *namelen, @@ -795,7 +761,6 @@ nh5tbget_table_info_c(hid_t_f *loc_id, hsize_t_f *nrecords) { char *c_name = NULL; - hid_t c_loc_id = *loc_id; hsize_t c_nfields; hsize_t c_nrecords; int_f ret_value = 0; @@ -809,7 +774,7 @@ nh5tbget_table_info_c(hid_t_f *loc_id, /* * call H5TBread_fields_index function. */ - if(H5TBget_table_info(c_loc_id, c_name, &c_nfields, &c_nrecords) < 0) + if(H5TBget_table_info((hid_t)*loc_id, c_name, &c_nfields, &c_nrecords) < 0) HGOTO_DONE(FAIL) *nfields = (hsize_t_f) c_nfields;; @@ -822,8 +787,6 @@ done: return ret_value; } - - /*------------------------------------------------------------------------- * Function: h5tbget_field_info_c * @@ -837,9 +800,6 @@ done: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ int_f @@ -856,9 +816,7 @@ nh5tbget_field_info_c(hid_t_f *loc_id, { char *c_name = NULL; hsize_t num_elem; - hsize_t i; int max_len = 1; - hid_t c_loc_id = *loc_id; hsize_t c_nfields = *nfields; size_t *c_field_sizes = NULL; size_t *c_field_offsets = NULL; @@ -866,13 +824,13 @@ nh5tbget_field_info_c(hid_t_f *loc_id, char **c_field_names = NULL; char *tmp = NULL, *tmp_p; int c_lenmax = HLTB_MAX_FIELD_LEN; + hsize_t i; int_f ret_value = 0; num_elem = c_nfields; - for(i = 0; i < num_elem; i++) { + for(i = 0; i < num_elem; i++) if(namelen2[i] > max_len) max_len = namelen2[i]; - } /* * convert FORTRAN name to C name @@ -893,11 +851,11 @@ nh5tbget_field_info_c(hid_t_f *loc_id, /* * call H5TBget_field_info function. */ - if(H5TBget_field_info(c_loc_id, c_name, c_field_names, c_field_sizes, + if(H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes, c_field_offsets, &c_type_size) < 0) HGOTO_DONE(FAIL) - /* return values*/ + /* return values */ /* names array */ if(NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1))) @@ -912,14 +870,14 @@ nh5tbget_field_info_c(hid_t_f *loc_id, HDmemcpy(tmp_p, c_field_names[i], field_name_len); namelen2[i] = (int_f)field_name_len; tmp_p += c_lenmax; - } + } /* end for */ HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax * c_nfields)); *type_size = (size_t_f)c_type_size; for(i = 0; i < num_elem; i++) { field_sizes[i] = (size_t_f)c_field_sizes[i]; field_offsets[i] = (size_t_f)c_field_offsets[i]; - } + } /* end for */ done: if(c_name) diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index cbcfa47..7f8a35f 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -174,6 +174,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -235,6 +236,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -291,6 +293,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -401,7 +404,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index b4f4075..280089a 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -12,10 +12,24 @@ LINK_DIRECTORIES ( ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_fortran_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1image.h5 + f1tab.h5 +) + #-- Adding test for hl_f90_tstlite ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) -H5_NAMING (hl_f90_tstlite) -TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstlite) +H5_NAMING (hl_f90_tstlite ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstlite "") TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) @@ -23,8 +37,8 @@ ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) #-- Adding test for hl_f90_tstimage ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90) -H5_NAMING (hl_f90_tstimage) -TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstimage) +H5_NAMING (hl_f90_tstimage ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstimage "") TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) @@ -32,8 +46,8 @@ ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) #-- Adding test for hl_f90_tsttable ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90) -H5_NAMING (hl_f90_tsttable) -TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tsttable) +H5_NAMING (hl_f90_tsttable ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tsttable "") TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index f81614b..d43b434 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -148,6 +148,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -209,6 +210,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -265,6 +267,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index faa6d30..432a725 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -132,12 +132,12 @@ herr_t H5DSattach_scale(hid_t did, hid_t ntid = -1; /* attribute native type ID */ hid_t aid = -1; /* attribute ID */ int rank; /* rank of dataset */ - hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */ + hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */ ds_list_t dsl; /* attribute data in the DS pointing to the dataset */ - ds_list_t *dsbuf=NULL; /* array of attribute data in the DS pointing to the dataset */ + ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */ hobj_ref_t ref_to_ds; /* reference to the DS */ hobj_ref_t ref_j; /* iterator reference */ - hvl_t *buf=NULL; /* VL buffer to store in the attribute */ + hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ H5O_info_t oi1, oi2; H5I_type_t it1, it2; @@ -254,8 +254,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - + buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -270,25 +269,21 @@ herr_t H5DSattach_scale(hid_t did, ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; /* write the attribute with the reference */ - if (H5Awrite(aid,tid,buf) < 0) + if(H5Awrite(aid, tid, buf) < 0) goto out; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid) < 0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } - + free(buf); + buf = NULL; } /*------------------------------------------------------------------------- @@ -296,8 +291,7 @@ herr_t H5DSattach_scale(hid_t did, * and insert the new reference *------------------------------------------------------------------------- */ - - else if ( has_dimlist == 1 ) + else if(has_dimlist == 1) { if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0) goto out; @@ -309,8 +303,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - + buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -320,13 +313,12 @@ herr_t H5DSattach_scale(hid_t did, /* check to avoid inserting duplicates. it is not FAIL, just do nothing */ /* iterate all the REFs in this dimension IDX */ - for (i=0; i<(int)buf[idx].len; i++) - { + for(i = 0; i < (int)buf[idx].len; i++) { /* get the reference */ ref_j = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0) + if((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0) goto out; /* get info for DS in the parameter list */ @@ -342,48 +334,41 @@ herr_t H5DSattach_scale(hid_t did, found_ds = 1; /* close the dereferenced dataset */ - if (H5Dclose(dsid_j) < 0) + if(H5Dclose(dsid_j) < 0) goto out; - } + } /* end for */ - if (found_ds==0) - { + if(found_ds == 0) { /* we are adding one more DS to this dimension */ - if ( buf[idx].len > 0 ) - { + if(buf[idx].len > 0) { buf[idx].len++; len = buf[idx].len; - buf[idx].p = realloc( buf[idx].p, len * sizeof(hobj_ref_t)); - ((hobj_ref_t *)buf[idx].p)[ len-1 ] = ref_to_ds; - } - else - { + buf[idx].p = realloc(buf[idx].p, len * sizeof(hobj_ref_t)); + ((hobj_ref_t *)buf[idx].p)[len - 1] = ref_to_ds; + } /* end if */ + else { /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; - buf[idx].p = malloc( 1 * sizeof(hobj_ref_t)); + buf[idx].p = malloc(sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; - } - } + } /* end else */ + } /* end if */ /* write the attribute with the new references */ - if (H5Awrite(aid,tid,buf) < 0) + if(H5Awrite(aid, tid, buf) < 0) goto out; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid) < 0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } - + free(buf); + buf = NULL; } /* has_dimlist */ /*------------------------------------------------------------------------- @@ -392,20 +377,18 @@ herr_t H5DSattach_scale(hid_t did, */ /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ - if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST)) < 0) + if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0) goto out; /*------------------------------------------------------------------------- * it does not exist. we create the attribute and its reference data *------------------------------------------------------------------------- */ - if (has_reflist == 0) - { - + if(has_reflist == 0) { dims[0] = 1; /* space for the attribute */ - if ((sid = H5Screate_simple(1,dims,NULL)) < 0) + if((sid = H5Screate_simple(1,dims,NULL)) < 0) goto out; /* create the compound datatype for the attribute "REFERENCE_LIST" */ @@ -438,16 +421,13 @@ herr_t H5DSattach_scale(hid_t did, goto out; if(H5Aclose(aid) < 0) goto out; - - } + } /* end if */ /*------------------------------------------------------------------------- * the "REFERENCE_LIST" array already exists, open it and extend it *------------------------------------------------------------------------- */ - - else if(has_reflist == 1) - { + else if(has_reflist == 1) { if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0) goto out; @@ -468,17 +448,16 @@ herr_t H5DSattach_scale(hid_t did, nelmts++; dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); - - if (dsbuf == NULL) + if(dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if(H5Aread(aid, ntid, dsbuf) < 0) goto out; /* close */ - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if (H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; /*------------------------------------------------------------------------- @@ -492,7 +471,7 @@ herr_t H5DSattach_scale(hid_t did, /* store the IDX information (index of the dataset that has the DS) */ dsl.dim_idx = idx; - dsbuf[nelmts-1] = dsl; + dsbuf[nelmts - 1] = dsl; /* create a new data space for the new references array */ dims[0] = nelmts; @@ -518,12 +497,8 @@ herr_t H5DSattach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - if (dsbuf) - { - free(dsbuf); - dsbuf = NULL; - } - + free(dsbuf); + dsbuf = NULL; } /* has_reflist */ /*------------------------------------------------------------------------- @@ -531,11 +506,10 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ - if ((is_ds=H5DSis_scale(dsid)) < 0) + if((is_ds=H5DSis_scale(dsid)) < 0) return FAIL; - if (is_ds == 0 ) - { + if(is_ds == 0) { if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS) < 0) return FAIL; } @@ -544,17 +518,10 @@ herr_t H5DSattach_scale(hid_t did, /* error zone */ out: - - if (buf) - { + if(buf) free(buf); - buf = NULL; - } - if (dsbuf) - { + if(dsbuf) free(dsbuf); - dsbuf = NULL; - } H5E_BEGIN_TRY { H5Sclose(sid); @@ -706,13 +673,12 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - + buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf) < 0) + if(H5Aread(aid, tid, buf) < 0) goto out; /* reset */ @@ -747,7 +713,8 @@ herr_t H5DSdetach_scale(hid_t did, and reset to NULL */ size_t len = buf[idx].len; - if(j<len-1) + + if(j < len - 1) ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { @@ -768,36 +735,33 @@ herr_t H5DSdetach_scale(hid_t did, /* Write the attribute, but check first, if we have any scales left, because if not, we should delete the attribute according to the spec */ - for(i=0; i < rank; i++) { + for(i = 0; i < rank; i++) { if(buf[i].len > 0) { have_ds = 1; break; } } if(have_ds) { - if(H5Awrite(aid,tid,buf) < 0) + if(H5Awrite(aid, tid, buf) < 0) goto out; } else { - if(H5Adelete(did,DIMENSION_LIST) < 0) + if(H5Adelete(did, DIMENSION_LIST) < 0) goto out; } /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid) < 0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } + free(buf); + buf = NULL; /*------------------------------------------------------------------------- @@ -826,7 +790,7 @@ herr_t H5DSdetach_scale(hid_t did, if(dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if(H5Aread(aid, ntid, dsbuf) < 0) goto out; for(ii=0; ii<nelmts; ii++) { @@ -914,12 +878,8 @@ herr_t H5DSdetach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - if (dsbuf) - { - free(dsbuf); - dsbuf=NULL; - } - + free(dsbuf); + dsbuf = NULL; return SUCCEED; @@ -931,21 +891,19 @@ out: H5Tclose(ntid); H5Tclose(tid); - if (dsbuf) - { + if(dsbuf) { free(dsbuf); - dsbuf=NULL; + dsbuf = NULL; } - if (buf) - { + if(buf) { /* Failure occured before H5Dvlen_reclaim was called; free the pointers allocated when we read data in */ - for(i=0; i<rank; i++) { + for(i = 0; i < rank; i++) { if(buf[i].p) free(buf[i].p); } free(buf); - buf=NULL; + buf = NULL; } } H5E_END_TRY; return FAIL; @@ -991,9 +949,9 @@ htri_t H5DSis_attached(hid_t did, hid_t ntid = -1; /* attribute native type ID */ hid_t aid = -1; /* attribute ID */ int rank; /* rank of dataset */ - ds_list_t *dsbuf; /* array of attribute data in the DS pointing to the dataset */ + ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */ hobj_ref_t ref; /* reference to the DS */ - hvl_t *buf; /* VL buffer to store in the attribute */ + hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ hid_t did_i; /* dataset ID in REFERENCE_LIST */ H5O_info_t oi1, oi2, oi3, oi4; @@ -1078,7 +1036,6 @@ htri_t H5DSis_attached(hid_t did, /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - if(buf == NULL) goto out; @@ -1124,11 +1081,8 @@ htri_t H5DSis_attached(hid_t did, goto out; if (H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } + free(buf); + buf = NULL; } /* has_dimlist */ /*------------------------------------------------------------------------- @@ -1217,11 +1171,9 @@ htri_t H5DSis_attached(hid_t did, goto out; if (H5Aclose(aid) < 0) goto out; - if (dsbuf) - { - free(dsbuf); - dsbuf = NULL; - } + + free(dsbuf); + dsbuf = NULL; } /* has_reflist */ if (found_ds && found_dset) @@ -1238,13 +1190,11 @@ out: H5Tclose(ntid); } H5E_END_TRY; - if (buf) - { + if (buf) { free(buf); buf = NULL; } - if (dsbuf) - { + if(dsbuf) { free(dsbuf); dsbuf = NULL; } @@ -1307,7 +1257,7 @@ herr_t H5DSiterate_scales(hid_t did, hid_t sid; /* space ID */ hid_t tid = -1; /* attribute type ID */ hid_t aid = -1; /* attribute ID */ - hvl_t *buf=NULL; /* VL buffer to store in the attribute */ + hvl_t *buf = NULL; /* VL buffer to store in the attribute */ H5I_type_t it; /* ID type */ herr_t ret_value=0; int j_idx; @@ -1431,20 +1381,16 @@ herr_t H5DSiterate_scales(hid_t did, goto out; if (H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } + free(buf); + buf = NULL; } /* if has_dimlist */ return ret_value; out: H5E_BEGIN_TRY { - if (buf) - { + if(buf) { H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf); free(buf); } @@ -1452,6 +1398,7 @@ out: H5Aclose(aid); H5Tclose(tid); } H5E_END_TRY; + return FAIL; } @@ -2048,7 +1995,7 @@ int H5DSget_num_scales(hid_t did, hid_t tid = -1; /* attribute type ID */ hid_t aid = -1; /* attribute ID */ int rank; /* rank of dataset */ - hvl_t *buf; /* VL buffer to store in the attribute */ + hvl_t *buf = NULL; /* VL buffer to store in the attribute */ H5I_type_t it; /* ID type */ int nscales; @@ -2057,10 +2004,10 @@ int H5DSget_num_scales(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did)) < 0) + if((it = H5Iget_type(did)) < 0) return FAIL; - if (H5I_DATASET!=it) + if(H5I_DATASET != it) return FAIL; /*------------------------------------------------------------------------- @@ -2068,19 +2015,19 @@ int H5DSget_num_scales(hid_t did, *------------------------------------------------------------------------- */ /* get dataset space */ - if ((sid = H5Dget_space(did)) < 0) + if((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) + if((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; /* dimemsion index IDX range checking */ - if (idx>=(unsigned int )rank) + if(idx >= (unsigned int )rank) return FAIL; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ @@ -2095,9 +2042,7 @@ int H5DSget_num_scales(hid_t did, * the attribute exists, open it *------------------------------------------------------------------------- */ - - else - { + else { if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0) goto out; if((tid = H5Aget_type(aid)) < 0) @@ -2106,8 +2051,7 @@ int H5DSget_num_scales(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - + buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -2115,23 +2059,19 @@ int H5DSget_num_scales(hid_t did, if(H5Aread(aid, tid, buf) < 0) goto out; - nscales=(int)buf[idx].len; + nscales = (int)buf[idx].len; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid) < 0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - if (buf) - { - free(buf); - buf = NULL; - } - + free(buf); + buf = NULL; } /* has_dimlist */ return nscales; @@ -2144,11 +2084,9 @@ out: H5Tclose(tid); } H5E_END_TRY; - if (buf) - { + if(buf) free(buf); - buf = NULL; - } + return FAIL; } diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 9c0b74c..2e04858 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -165,6 +165,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -226,6 +227,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -282,6 +284,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -392,7 +395,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 182fd14..4c345dd 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -22,8 +22,7 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- MACRO (HL_ADD_TEST hl_name files) ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c) - H5_NAMING (hl_${hl_name}) - TARGET_WIN_PROPERTIES (hl_${hl_name}) + H5_NAMING (hl_${hl_name} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_${hl_name} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -48,6 +47,33 @@ MACRO (HL_ADD_TEST hl_name files) ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) ENDMACRO (HL_ADD_TEST) +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + combine_tables1.h5 + combine_tables2.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_table.h5 +) + HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") HL_ADD_TEST (test_lite "dtype_file.txt") @@ -60,8 +86,7 @@ HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.h # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (hl_gen_test_ds gen_test_ds.c) - H5_NAMING (hl_gen_test_ds) - TARGET_WIN_PROPERTIES (hl_gen_test_ds) + H5_NAMING (hl_gen_test_ds ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_gen_test_ds ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 831048c..4e639a6 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -169,6 +169,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -230,6 +231,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -286,6 +288,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 7a612a8..3c258c1 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -31,7 +31,9 @@ #define TEST_FILE_NAME "test_packet_table.h5" #define TEST_COMPRESS_FILE "test_packet_compress.h5" #define PT_NAME "Test Packet Table" +#ifdef VLPT_REMOVED #define VL_TABLE_NAME "Varlen Test Table" +#endif /* VLPT_REMOVED */ #define H5TB_TABLE_NAME "Table1" /*------------------------------------------------------------------------- @@ -774,7 +776,7 @@ test_compress(void) size_t c; size_t num_elems = 1; unsigned filter_vals[1]; - particle_t readPart; + particle_t readPart[1]; hsize_t count; TESTING("packet table compression"); @@ -807,13 +809,14 @@ test_compress(void) if( count != BIG_TABLE_SIZE ) TEST_ERROR; /* Read particles to ensure that all of them were written correctly */ + HDmemset(readPart, 0, sizeof(readPart)); for(c = 0; c < BIG_TABLE_SIZE; c++) { - err = H5PTget_next(table, 1, &readPart); + err = H5PTget_next(table, 1, readPart); if(err < 0) TEST_ERROR; /* Ensure that particles were read correctly */ - if( cmp_par(c % 8, 0, testPart, &readPart) != 0) TEST_ERROR; + if( cmp_par(c % 8, 0, testPart, readPart) != 0) TEST_ERROR; } /* Close the table */ diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 8ed3fab..df45631 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -18,8 +18,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5) ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS}) -H5_NAMING (gif2h5) -TARGET_WIN_PROPERTIES (gif2h5) +H5_NAMING (gif2h5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #-- Add h52gif program @@ -28,8 +27,7 @@ SET (hdf2gif_SRCS ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdfgifwr.c ) ADD_EXECUTABLE (hdf2gif ${hdf2gif_SRCS}) -H5_NAMING (hdf2gif) -TARGET_WIN_PROPERTIES (hdf2gif) +H5_NAMING (hdf2gif ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) # -------------------------------------------------------------------- @@ -39,8 +37,7 @@ TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_T # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) - H5_NAMING (hl_h52gifgentest) - TARGET_WIN_PROPERTIES (hl_h52gifgentest) + H5_NAMING (hl_h52gifgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) # ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index d0fa11a..20d761d 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -154,6 +154,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -215,6 +216,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -271,6 +273,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index eae6de5..3b6d2da 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -154,6 +154,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -215,6 +216,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -271,6 +273,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 22924a8..d812584 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -168,10 +168,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -748,15 +751,12 @@ _LT_EOF # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) - _LT_PROG_XSI_SHELLFNS + _LT_PROG_REPLACE_SHELLFNS - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -1073,30 +1073,41 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], fi ]) -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi ])# _LT_SYS_MODULE_PATH_AIX @@ -1121,7 +1132,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. -if test "X`print -r -- -n 2>/dev/null`" = X-n && \ +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -1165,6 +1176,39 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], @@ -1311,14 +1355,47 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1658,10 +1735,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); +int fnord () __attribute__((visibility("default"))); #endif -void fnord () { int i=42; } +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -2201,8 +2278,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2235,13 +2313,71 @@ m4_if([$1], [],[ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2945,6 +3081,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -3163,6 +3304,21 @@ tpf*) ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -3170,7 +3326,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3273,6 +3433,67 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + # LT_LIB_M # -------- @@ -3399,8 +3620,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3436,6 +3657,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -3469,6 +3691,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -3480,7 +3714,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT@&t@_DLSYM_CONST struct { const char *name; void *address; } @@ -3506,15 +3740,15 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -3547,6 +3781,13 @@ else AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3557,6 +3798,8 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3568,7 +3811,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= -AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -3673,6 +3915,12 @@ m4_if([$1], [CXX], [ ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; dgux*) case $cc_basename in ec++*) @@ -4047,6 +4295,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -4166,9 +4420,11 @@ case $host_os in _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. @@ -4187,6 +4443,8 @@ fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -4207,6 +4465,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -4215,6 +4474,7 @@ m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. @@ -4229,15 +4489,20 @@ m4_if([$1], [CXX], [ ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -4405,7 +4670,8 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -4453,7 +4719,7 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler @@ -4523,8 +4789,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -4542,8 +4808,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4589,8 +4855,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4720,7 +4986,7 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else @@ -4731,7 +4997,7 @@ _LT_EOF else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. @@ -4775,20 +5041,63 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -4826,7 +5135,7 @@ _LT_EOF # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4834,7 +5143,7 @@ _LT_EOF hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -4850,7 +5159,7 @@ _LT_EOF hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -4874,10 +5183,10 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -4924,16 +5233,31 @@ _LT_EOF irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' @@ -5018,7 +5342,7 @@ _LT_EOF osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' @@ -5037,9 +5361,9 @@ _LT_EOF _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -5311,8 +5635,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -5323,6 +5645,8 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5424,6 +5748,7 @@ CC="$lt_save_CC" m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then @@ -5485,6 +5810,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -5502,6 +5828,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -5523,8 +5850,8 @@ if test "$_lt_caught_CXX_error" != yes; then # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5665,7 +5992,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" @@ -5677,7 +6004,7 @@ if test "$_lt_caught_CXX_error" != yes; then else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. @@ -5719,29 +6046,75 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -5816,7 +6189,7 @@ if test "$_lt_caught_CXX_error" != yes; then ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -5887,10 +6260,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -5931,9 +6304,9 @@ if test "$_lt_caught_CXX_error" != yes; then *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6211,7 +6584,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6298,9 +6671,9 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -6429,6 +6802,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -6443,6 +6817,29 @@ AC_LANG_POP ])# _LT_LANG_CXX_CONFIG +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -6451,6 +6848,7 @@ AC_LANG_POP # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -6501,6 +6899,13 @@ public class foo { }; _LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6512,7 +6917,7 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -6521,13 +6926,22 @@ if AC_TRY_EVAL(ac_compile); then test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -6547,8 +6961,10 @@ if AC_TRY_EVAL(ac_compile); then _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -6584,6 +7000,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -6733,7 +7150,9 @@ if test "$_lt_disable_F77" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} + CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6787,6 +7206,7 @@ if test "$_lt_disable_F77" != yes; then GCC=$lt_save_GCC CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP @@ -6863,7 +7283,9 @@ if test "$_lt_disable_FC" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -6919,7 +7341,8 @@ if test "$_lt_disable_FC" != yes; then fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -6956,10 +7379,12 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -6990,7 +7415,8 @@ fi AC_LANG_RESTORE GCC=$lt_save_GCC -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG @@ -7025,9 +7451,11 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} +CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -7040,7 +7468,8 @@ fi GCC=$lt_save_GCC AC_LANG_RESTORE -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG @@ -7099,6 +7528,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) # _LT_DECL_SED # ------------ @@ -7192,8 +7630,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -7232,206 +7670,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` -} + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'` -} + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) -_LT_EOF -esac + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac ;; - esac + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac ]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index 93fc771..9c7b5d4 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -7,17 +7,17 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# Generated from ltversion.in. +# @configure_input@ -# serial 3175 ltversion.m4 +# serial 3293 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.10]) -m4_define([LT_PACKAGE_REVISION], [1.3175]) +m4_define([LT_PACKAGE_VERSION], [2.4]) +m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.10' -macro_revision='1.3175' +[macro_version='2.4' +macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index 2c0c517..578b5a6 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -11,6 +11,21 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib ) # Add Tests #----------------------------------------------------------------------------- +# Remove any output file left over from previous test run +ADD_TEST ( + NAME h5perform-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + chunk.h5 + iopipe.h5 + iopipe.raw + x-diag-rd.dat + x-diag-wr.dat + x-rowmaj-rd.dat + x-rowmaj-wr.dat + x-gnuplot +) + #-- Adding test for h5perf_serial SET (h5perf_serial_SRCS ${HDF5_PERFORM_SOURCE_DIR}/sio_timer.c @@ -18,19 +33,34 @@ SET (h5perf_serial_SRCS ${HDF5_PERFORM_SOURCE_DIR}/sio_engine.c ) ADD_EXECUTABLE (h5perf_serial ${h5perf_serial_SRCS}) -H5_NAMING (h5perf_serial) -TARGET_WIN_PROPERTIES (h5perf_serial) +H5_NAMING (h5perf_serial ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_TEST (NAME h5perf_serial COMMAND $<TARGET_FILE:h5perf_serial>) +IF (HDF5_BUILD_PERFORM_STANDALONE) + #-- Adding test for h5perf_serial_alone + SET (h5perf_serial_alone_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/sio_timer.c + ${HDF5_PERFORM_SOURCE_DIR}/sio_perf.c + ${HDF5_PERFORM_SOURCE_DIR}/sio_engine.c + ) + ADD_EXECUTABLE (h5perf_serial_alone ${h5perf_serial_alone_SRCS}) + SET_PROPERTY (TARGET h5perf_serial_alone + APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE + ) + H5_NAMING (h5perf_serial_alone ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + + ADD_TEST (NAME h5perf_serial_alone COMMAND $<TARGET_FILE:h5perf_serial_alone>) +ENDIF (HDF5_BUILD_PERFORM_STANDALONE) + #-- Adding test for chunk SET (chunk_SRCS ${HDF5_PERFORM_SOURCE_DIR}/chunk.c ) ADD_EXECUTABLE(chunk ${chunk_SRCS}) -H5_NAMING (chunk) -TARGET_WIN_PROPERTIES (chunk) +H5_NAMING (chunk ${LIB_TYPE}) TARGET_LINK_LIBRARIES(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_TEST (NAME chunk COMMAND $<TARGET_FILE:chunk>) @@ -40,8 +70,7 @@ SET (iopipe_SRCS ${HDF5_PERFORM_SOURCE_DIR}/iopipe.c ) ADD_EXECUTABLE (iopipe ${iopipe_SRCS}) -H5_NAMING (iopipe) -TARGET_WIN_PROPERTIES (iopipe) +H5_NAMING (iopipe ${LIB_TYPE}) TARGET_LINK_LIBRARIES (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_TEST (NAME iopipe COMMAND $<TARGET_FILE:iopipe>) @@ -51,8 +80,7 @@ SET (overhead_SRCS ${HDF5_PERFORM_SOURCE_DIR}/overhead.c ) ADD_EXECUTABLE (overhead ${overhead_SRCS}) -H5_NAMING (overhead) -TARGET_WIN_PROPERTIES (overhead) +H5_NAMING (overhead ${LIB_TYPE}) TARGET_LINK_LIBRARIES (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_TEST (NAME overhead COMMAND $<TARGET_FILE:overhead>) @@ -62,8 +90,7 @@ SET (perf_meta_SRCS ${HDF5_PERFORM_SOURCE_DIR}/perf_meta.c ) ADD_EXECUTABLE (perf_meta ${perf_meta_SRCS}) -H5_NAMING (perf_meta) -TARGET_WIN_PROPERTIES (perf_meta) +H5_NAMING (perf_meta ${LIB_TYPE}) TARGET_LINK_LIBRARIES (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME perf_meta COMMAND $<TARGET_FILE:perf_meta>) @@ -73,8 +100,7 @@ SET (zip_perf_SRCS ${HDF5_PERFORM_SOURCE_DIR}/zip_perf.c ) ADD_EXECUTABLE (zip_perf ${zip_perf_SRCS}) -H5_NAMING (zip_perf) -TARGET_WIN_PROPERTIES (zip_perf) +H5_NAMING (zip_perf ${LIB_TYPE}) TARGET_LINK_LIBRARIES (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME zip_perf COMMAND $<TARGET_FILE:zip_perf> "-h") @@ -87,19 +113,34 @@ IF (H5_HAVE_PARALLEL) ${HDF5_PERFORM_SOURCE_DIR}/pio_engine.c ) ADD_EXECUTABLE (h5perf ${h5perf_SRCS}) - H5_NAMING (h5perf) - TARGET_WIN_PROPERTIESS (h5perf) + H5_NAMING (h5perf ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>) + IF (HDF5_BUILD_PERFORM_STANDALONE) + #-- Adding test for h5perf + SET (h5perf_alone_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/pio_timer.c + ${HDF5_PERFORM_SOURCE_DIR}/pio_perf.c + ${HDF5_PERFORM_SOURCE_DIR}/pio_engine.c + ) + ADD_EXECUTABLE (h5perf_alone ${h5perf_alone_SRCS}) + SET_PROPERTY (TARGET h5perf_alone + APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE + ) + H5_NAMING (h5perf_alone ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + + ADD_TEST (NAME h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>) + ENDIF (HDF5_BUILD_PERFORM_STANDALONE) + #-- Adding test for benchpar SET (benchpar_SRCS ${HDF5_PERFORM_SOURCE_DIR}/benchpar.c ) ADD_EXECUTABLE (benchpar ${benchpar_SRCS}) - H5_NAMING (benchpar) - TARGET_WIN_PROPERTIES (benchpar) + H5_NAMING (benchpar ${LIB_TYPE}) TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) @@ -109,8 +150,7 @@ IF (H5_HAVE_PARALLEL) ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c ) ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) - H5_NAMING (mpi-perf) - TARGET_WIN_PROPERTIES (mpi-perf) + H5_NAMING (mpi-perf ${LIB_TYPE}) TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) diff --git a/perform/Makefile.am b/perform/Makefile.am index 6836a2b..4b44b43 100644 --- a/perform/Makefile.am +++ b/perform/Makefile.am @@ -23,11 +23,11 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib +# bin_PROGRAMS will be installed. if BUILD_PARALLEL_CONDITIONAL - bin_PROGRAMS=h5perf - TEST_PROG_PARA=h5perf perf + bin_PROGRAMS=h5perf_serial h5perf else - bin_PROGRAMS=h5perf_serial + bin_PROGRAMS=h5perf_serial endif # Add h5perf and h5perf_serial specific linker flags here @@ -38,16 +38,25 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. if BUILD_PARALLEL_CONDITIONAL - PARA_BUILD_ALL=benchpar mpi-perf + PARA_BUILD_ALL=benchpar mpi-perf endif if BUILD_ALL_CONDITIONAL - BUILD_ALL_PROGS=$(PARA_BUILD_ALL) + BUILD_ALL_PROGS=$(PARA_BUILD_ALL) endif -# These are the programs that `make all' or `make tests' will build and which -# `make check' will run. List them in the order they should be run. +# Define programs that will be run in 'make check' +# List them in the order they should be run. +# Parallel test programs. +if BUILD_PARALLEL_CONDITIONAL + TEST_PROG_PARA=h5perf perf +endif +# Serial test programs. TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) -check_PROGRAMS=$(TEST_PROG_PARA) $(TEST_PROG) + +# check_PROGRAMS will be built but not installed. Do not any executable +# that is in bin_PROGRAMS already. Otherwise, it will be removed twice in +# "make clean" and some systems, e.g., AIX, do not like it. +check_PROGRAMS= iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf h5perf_SOURCES=pio_perf.c pio_engine.c pio_timer.c h5perf_serial_SOURCES=sio_perf.c sio_engine.c sio_timer.c diff --git a/perform/Makefile.in b/perform/Makefile.in index e2e05b8..d79c2de 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -56,8 +56,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/conclude.am COPYING @BUILD_PARALLEL_CONDITIONAL_FALSE@bin_PROGRAMS = \ @BUILD_PARALLEL_CONDITIONAL_FALSE@ h5perf_serial$(EXEEXT) -@BUILD_PARALLEL_CONDITIONAL_TRUE@bin_PROGRAMS = h5perf$(EXEEXT) -check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_4) +@BUILD_PARALLEL_CONDITIONAL_TRUE@bin_PROGRAMS = \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf_serial$(EXEEXT) \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf$(EXEEXT) +check_PROGRAMS = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \ + zip_perf$(EXEEXT) perf_meta$(EXEEXT) $(am__EXEEXT_2) \ + perf$(EXEEXT) TESTS = $(check_PROGRAMS) subdir = perform ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -69,14 +73,9 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" -@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = h5perf$(EXEEXT) \ -@BUILD_PARALLEL_CONDITIONAL_TRUE@ perf$(EXEEXT) -@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_2 = benchpar$(EXEEXT) \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = benchpar$(EXEEXT) \ @BUILD_PARALLEL_CONDITIONAL_TRUE@ mpi-perf$(EXEEXT) -@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) -am__EXEEXT_4 = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \ - zip_perf$(EXEEXT) perf_meta$(EXEEXT) h5perf_serial$(EXEEXT) \ - $(am__EXEEXT_3) +@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = $(am__EXEEXT_1) PROGRAMS = $(bin_PROGRAMS) benchpar_SOURCES = benchpar.c benchpar_OBJECTS = benchpar.$(OBJEXT) @@ -190,6 +189,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -251,6 +251,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -307,6 +308,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -414,7 +416,6 @@ TRACE = perl $(top_srcdir)/bin/trace # *.clog are from the MPE option. CHECK_CLEANFILES = *.chkexe *.chklog *.clog INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf # Add h5perf and h5perf_serial specific linker flags here h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -426,8 +427,11 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = benchpar mpi-perf @BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = $(PARA_BUILD_ALL) -# These are the programs that `make all' or `make tests' will build and which -# `make check' will run. List them in the order they should be run. +# Define programs that will be run in 'make check' +# List them in the order they should be run. +# Parallel test programs. +@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf +# Serial test programs. TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) h5perf_SOURCES = pio_perf.c pio_engine.c pio_timer.c h5perf_serial_SOURCES = sio_perf.c sio_engine.c sio_timer.c diff --git a/perform/iopipe.c b/perform/iopipe.c index 77d4fc8..c72e3aa 100644 --- a/perform/iopipe.c +++ b/perform/iopipe.c @@ -21,15 +21,6 @@ /* See H5private.h for how to include headers */ #include "hdf5.h" -#if defined (__MWERKS__) -#ifdef H5_HAVE_SYS_TIMEB -#undef H5_HAVE_SYS_TIMEB -#endif -#ifdef H5_HAVE_SYSTEM -#undef H5_HAVE_SYSTEM -#endif -#endif /* __MWERKS__*/ - #include "H5private.h" #ifdef H5_HAVE_SYS_TIMEB @@ -142,18 +133,10 @@ synchronize (void) { #ifdef H5_HAVE_SYSTEM #if defined(_WIN32) && ! defined(__CYGWIN__) - _flushall(); + _flushall(); #else - HDsystem ("sync"); - HDsystem ("df >/dev/null"); -#endif -#if 0 - /* - * This works well on Linux to get rid of all cached disk buffers. The - * number should be approximately the amount of RAM in MB. Do not - * include swap space in that amount or the command will fail. - */ - system ("/sbin/swapout 128"); + HDsystem("sync"); + HDsystem("df >/dev/null"); #endif #endif } @@ -179,10 +162,10 @@ int main (void) { static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; - static int nread=NREAD_REQUESTS, nwrite=NWRITE_REQUESTS; + static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; unsigned char *the_data = NULL; - hid_t file, dset, file_space=-1; + hid_t file, dset, file_space = -1; herr_t status; #ifdef H5_HAVE_GETRUSAGE struct rusage r_start, r_stop; @@ -190,7 +173,8 @@ main (void) struct timeval r_start, r_stop; #endif struct timeval t_start, t_stop; - int i, fd; + int fd; + unsigned u; hssize_t n; off_t offset; hsize_t start[2]; @@ -220,35 +204,34 @@ main (void) assert(file_space >= 0); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); assert(dset >= 0); - the_data = malloc((size_t)(size[0] * size[1])); + the_data = (unsigned char *)malloc((size_t)(size[0] * size[1])); /* initial fill for lazy malloc */ - memset(the_data, 0xAA, (size_t)(size[0] * size[1])); + HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1])); /* Fill raw */ synchronize (); #ifdef H5_HAVE_GETRUSAGE -printf("Before getrusage() call\n"); - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill raw"); - for (i=0; i<nwrite; i++) { + for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); - fflush (stderr); - memset (the_data, 0xAA, (size_t)(size[0]*size[1])); + HDfflush(stderr); + HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -267,28 +250,28 @@ printf("Before getrusage() call\n"); /* Fill hdf5 */ synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill hdf5"); - for (i=0; i<nread; i++) { + for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -306,29 +289,29 @@ printf("Before getrusage() call\n"); /* Write the raw dataset */ synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out raw"); - for (i=0; i<nwrite; i++) { + for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); assert (0==offset); n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -346,28 +329,28 @@ printf("Before getrusage() call\n"); /* Write the hdf5 dataset */ synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out hdf5"); - for (i=0; i<nwrite; i++) { + for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, the_data); assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -385,29 +368,29 @@ printf("Before getrusage() call\n"); /* Read the raw dataset */ synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in raw"); - for (i=0; i<nread; i++) { + for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); assert (0==offset); n = HDread (fd, the_data, (size_t)(size[0]*size[1])); assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -426,28 +409,28 @@ printf("Before getrusage() call\n"); /* Read the hdf5 dataset */ synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5"); - for (i=0; i<nread; i++) { + for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -470,28 +453,28 @@ printf("Before getrusage() call\n"); assert (status>=0); synchronize (); #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_start); + HDgetrusage(RUSAGE_SELF, &r_start); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_start, NULL); + HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5 partial"); - for (i=0; i<nread; i++) { + for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); - fflush (stderr); + HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &r_stop); + HDgetrusage(RUSAGE_SELF, &r_stop); #endif #ifdef H5_HAVE_GETTIMEOFDAY - gettimeofday (&t_stop, NULL); + HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB _ftime(tbstop); @@ -501,18 +484,20 @@ printf("Before getrusage() call\n"); t_stop.tv_usec = tbstop->millitm; #endif #endif - putc ('\n', stderr); - print_stats ("in hdf5 partial", + putc('\n', stderr); + print_stats("in hdf5 partial", &r_start, &r_stop, &t_start, &t_stop, (size_t)(nread*count[0]*count[1])); /* Close everything */ - HDclose (fd); - H5Dclose (dset); - H5Sclose (file_space); - H5Fclose (file); + HDclose(fd); + H5Dclose(dset); + H5Sclose(file_space); + H5Fclose(file); + free(the_data); return 0; } + diff --git a/perform/overhead.c b/perform/overhead.c index 5076103..cfd96b8 100644 --- a/perform/overhead.c +++ b/perform/overhead.c @@ -220,15 +220,8 @@ test(fill_t fill_style, const double splits[], if((fspace = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; if((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0) goto error; if((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT, - fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - -#if !defined( __MWERKS__) - - /* - workaround for a bug in the Metrowerks version 6.0 open function - */ + fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error; -#endif for (i=1; i<=cur_size[0]; i++) { @@ -264,8 +257,6 @@ test(fill_t fill_style, const double splits[], } -#if !defined( __MWERKS__) - /* Determine overhead */ if (verbose) { if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; @@ -279,7 +270,6 @@ test(fill_t fill_style, const double splits[], (unsigned long)i, (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); } -#endif } @@ -312,20 +302,14 @@ test(fill_t fill_style, const double splits[], abort(); } -#if !defined( __MWERKS__) - if (HDfstat(fd, &sb) < 0) goto error; printf("%-7s %8.3f\n", sname, (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ (hssize_t)cur_size[0]); -#endif - } -#if !defined( __MWERKS__) HDclose(fd); -#endif return 0; diff --git a/perform/pio_standalone.h b/perform/pio_standalone.h index ab4ee94..a4bc8b5 100644 --- a/perform/pio_standalone.h +++ b/perform/pio_standalone.h @@ -60,62 +60,41 @@ extern char *strdup(const char *s); #endif /* _WIN32 */ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); -#define HDstrcmp(S,T) strcmp(S,T) -#define HDstrlen(S) strlen(S) -#define HDstrncmp(S,T,L) strncmp(S,T,L) -#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) -#define HDstrchr(S,C) strchr(S,C) -#define HDfree(M) free(M) +#define HDstrcmp(S,T) strcmp(S,T) +#define HDstrlen(S) strlen(S) +#define HDstrncmp(S,T,L) strncmp(S,T,L) +#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) +#define HDstrchr(S,C) strchr(S,C) +#define HDfree(M) free(M) #ifdef _O_BINARY -#define HDopen(S,F,M) open(S,F|_O_BINARY,M) +#define HDopen(S,F,M) open(S,F|_O_BINARY,M) #else -#define HDopen(S,F,M) open(S,F,M) +#define HDopen(S,F,M) open(S,F,M) #endif -#define HDclose(F) close(F) +#define HDclose(F) close(F) #ifdef _WIN32 - #ifdef __MWERKS__ - #define HDlseek(F,O,W) lseek(F,O,W) - #else /*MSVS */ - #define HDlseek(F,O,W) _lseeki64(F,O,W) - #endif +#define HDlseek(F,O,W) _lseeki64(F,O,W) #else -#define HDlseek(F,O,W) lseek(F,O,W) +#define HDlseek(F,O,W) lseek(F,O,W) #endif -#if defined (__MWERKS__) -/* workaround for a bug in the Metrowerks version 6.0 header file for write - which is not defined as const void* - */ -#define HDwrite(F,M,Z) write(F,(void*)M,Z) -#else #define HDwrite(F,M,Z) write(F,M,Z) -#endif #define HDread(F,M,Z) read(F,M,Z) #ifdef _WIN32 - #ifdef __MWERKS__ - #define HDstat(S,B) stat(S,B) - #else /*MSVC*/ #define HDstat(S,B) _stati64(S,B) - #endif #else #define HDstat(S,B) stat(S,B) #endif #ifdef _WIN32 - #ifdef __MWERKS__ - #define HDfstat(F,B) fstat(F,B) - typedef struct stat h5_stat_t; - typedef off_t h5_stat_size_t; - #else /*MSVC*/ - #define HDfstat(F,B) _fstati64(F,B) - typedef struct _stati64 h5_stat_t; - typedef __int64 h5_stat_size_t; - #endif +#define HDfstat(F,B) _fstati64(F,B) +typedef struct _stati64 h5_stat_t; +typedef __int64 h5_stat_size_t; #else #define HDfstat(F,B) fstat(F,B) typedef struct stat h5_stat_t; diff --git a/perform/sio_engine.c b/perform/sio_engine.c index 978ac03..e892bcc 100644 --- a/perform/sio_engine.c +++ b/perform/sio_engine.c @@ -98,7 +98,7 @@ static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *bu static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer); static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); -static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer); +static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2); static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer); static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags); @@ -130,7 +130,6 @@ static size_t cont_size; /* size of contiguous POSIX access */ static hid_t fapl; /* file access list */ static unsigned char *buf_p; /* buffer pointer */ static const char *multi_letters = "msbrglo"; /* string for multi driver */ -static char *buffer2=NULL; /* buffer for data verification */ /* HDF5 global variables */ static hsize_t h5count[MAX_DIMS]; /*selection count */ @@ -212,10 +211,8 @@ do_sio(parameters param) } /* Allocate transfer buffer */ - buffer2 = malloc(linear_buf_size); if ((buffer = malloc(linear_buf_size)) == NULL){ - HDfprintf(stderr, "malloc for transfer buffer size (%Hd) failed\n", - (long long)(linear_buf_size)); + HDfprintf(stderr, "malloc for transfer buffer size (%Hd) failed\n", (long long)(linear_buf_size)); GOTOERROR(FAIL); } @@ -404,10 +401,10 @@ sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si /* Remove any double slashes in the filename */ for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) { - if (*ptr != '/' || last != '/') - fullname[j++] = *ptr; + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; - last = *ptr; + last = *ptr; } return fullname; @@ -766,6 +763,7 @@ done: static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer) { + char *buffer2 = NULL; /* Buffer for data verification */ int ret_code = SUCCESS; char dname[64]; long i; @@ -777,14 +775,19 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) hsize_t h5start[MAX_DIMS]; /*selection start */ int rank; - /* Prepare buffer for verifying data */ - for (i=0; i < linear_buf_size; i++) - buffer2[i]=i%128; + /* Allocate data verification buffer */ + if(NULL == (buffer2 = (char *)malloc(linear_buf_size))) { + HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size); + GOTOERROR(FAIL); + } /* end if */ + + /* Prepare buffer for verifying data */ + for(i = 0; i < linear_buf_size; i++) + buffer2[i] = i % 128; rank = parms->rank; - for (i=0; i<rank; i++) { + for(i = 0; i < rank; i++) h5offset[i] = offset[i] = 0; - } /* I/O Access specific setup */ switch (parms->io_type) { @@ -853,7 +856,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) /* Start "raw data" read timer */ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START); - hrc = dset_read(rank-1, fd, parms, buffer); + hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { fprintf(stderr, "Error in dataset read\n"); @@ -910,6 +913,10 @@ done: } } + /* release generic resources */ + if(buffer2) + free(buffer2); + return ret_code; } @@ -921,7 +928,8 @@ done: * Modifications: */ -static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, + void *buffer, const char *buffer2) { int cur_dim = order[local_dim]-1; int ret_code = SUCCESS; @@ -936,7 +944,7 @@ static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, void * /* if traverse in order array is incomplete, recurse */ if (local_dim > 0){ - ret_code = dset_read(local_dim-1, fd, parms, buffer); + ret_code = dset_read(local_dim-1, fd, parms, buffer, buffer2); /* otherwise, write buffer into dataset */ }else{ diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h index 7c4810b..77bb7f8 100644 --- a/perform/sio_standalone.h +++ b/perform/sio_standalone.h @@ -114,12 +114,7 @@ #define HDexecve(S,AV,E) execve(S,AV,E) #define HDexecvp(S,AV) execvp(S,AV) #define HDexit(N) exit(N) -#if defined __MWERKS__ -#include <abort_exit.h> -#define HD_exit(N) __exit(N) -#else /* __MWERKS __ */ #define HD_exit(N) _exit(N) -#endif /* __MWERKS __ */ #define HDexp(X) exp(X) #define HDfabs(X) fabs(X) /* use ABS() because fabsf() fabsl() are not common yet. */ @@ -175,19 +170,11 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); * xxx64 versions if available. */ #ifdef _WIN32 - #ifdef __MWERKS__ - #define HDfstat(F,B) fstat(F,B) - #define HDlstat(S,B) lstat(S,B) - #define HDstat(S,B) stat(S,B) - typedef struct stat h5_stat_t; - typedef off_t h5_stat_size_t; - #else /*MSVC*/ #define HDfstat(F,B) _fstati64(F,B) #define HDlstat(S,B) _lstati64(S,B) #define HDstat(S,B) _stati64(S,B) typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; - #endif #elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) #define HDfstat(F,B) fstat64(F,B) #define HDlstat(S,B) lstat64(S,B) @@ -249,17 +236,13 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDlog10(X) log10(X) #define HDlongjmp(J,N) longjmp(J,N) #ifdef _WIN32 - #ifdef __MWERKS__ - #define HDlseek(F,O,W) lseek(F,O,W) - #else /*MSVS */ - #define HDlseek(F,O,W) _lseeki64(F,O,W) - #endif + #define HDlseek(F,O,W) _lseeki64(F,O,W) #else - #ifdef H5_HAVE_LSEEK64 + #ifdef H5_HAVE_LSEEK64 #define HDlseek(F,O,W) lseek64(F,O,W) - #else + #else #define HDlseek(F,O,W) lseek(F,O,W) - #endif + #endif #endif #define HDmalloc(Z) malloc(Z) #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z) @@ -454,15 +437,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDwaitpid(P,W,O) waitpid(P,W,O) #define HDwcstombs(S,P,Z) wcstombs(S,P,Z) #define HDwctomb(S,C) wctomb(S,C) - -#if defined (__MWERKS__) -/* workaround for a bug in the Metrowerks version 6.0 header file for write - which is not defined as const void* - */ -#define HDwrite(F,M,Z) write(F,(void*)M,Z) -#else #define HDwrite(F,M,Z) write(F,M,Z) -#endif /* * And now for a couple non-Posix functions... Watch out for systems that diff --git a/perform/sio_timer.h b/perform/sio_timer.h index 82f053d..1fa880d 100644 --- a/perform/sio_timer.h +++ b/perform/sio_timer.h @@ -26,9 +26,9 @@ # include <time.h> #endif -#ifdef _WIN32 +#ifdef H5_HAVE_WINSOCK_H # include <winsock2.h> -#endif /* _WIN32 */ +#endif /* H5_HAVE_WINSOCK_H */ /* The different types of timers we can have */ typedef enum timer_type_ { diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 7d96405..08177d8 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -62,10 +62,6 @@ # define fileno(file) file->__file #endif /* RISCOS */ -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fileno */ -#endif /* __MWERKS__ ... */ - #ifndef GZ_SUFFIX # define GZ_SUFFIX ".gz" #endif /* GZ_SUFFIX */ diff --git a/release_docs/CMake.txt b/release_docs/CMake.txt index e9c764e..0540fb6 100755 --- a/release_docs/CMake.txt +++ b/release_docs/CMake.txt @@ -14,15 +14,21 @@ Notes: This short instruction is written for users who want to quickly build all the operating systems supported by CMake. NOTES: - 1. CMake use is still experimental. While we have attempted to - provide error-free files, please understand that development - with CMake has just began. The CMake specific files may change + 1. Using CMake for building and using HDF5 is under active development. + While we have attempted to provide error-free files, please + understand that development with CMake has not been extensively + tested outside of HDF. The CMake specific files may change before the next release. - 2. CMake has been introduced to support development on Windows, however - it should be usuable on any system where CMake is supported. Please - send us any comments on how CMake support can be improved on any - system. + 2. CMake was originally introduced to support development on Windows, + however it should be usable on any system where CMake is supported. + Please send us any comments on how CMake support can be improved on + any system. Visit the KitWare site for more information about CMake. + + 3. Build and test results can be submitted to our CDash server at: + www.cdash.hdfgroup.org. + Please read the HDF and CDash document at: + www.hdfgroup.org/CDash/HowToSubmit. ======================================================================== @@ -32,10 +38,26 @@ Notes: This short instruction is written for users who want to quickly build 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.8.x product requires CMake version 2.8.2. - 2. If you plan to use Zlib or Szip, download the packages and install them - in a central location. For example on Windows, create a folder extlibs - and install the packages there. Windows users should also read Section V - in INSTALL_Windows.txt. + 2. If you plan to use Zlib or Szip; + A. Download the packages and install them + in a central location. For example on Windows, create a folder extlibs + and install the packages there. Windows users should also read Section V + in INSTALL_Windows.txt. + B. Use source packages from a SVN server by adding the following CMake + options: + HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" + ZLIB_SVN_URL:STRING="http://some_location/zlib/trunk" + SZIP_SVN_URL:STRING="http://some_location/szip/trunk" + where "some_location" is the URL to the SVN repository. + C. Use source packages from a compressed file by adding the following CMake + options: + HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" + ZLIB_TGZ_NAME:STRING="zlib_src.ext" + SZIP_TGZ_NAME:STRING="szip_src.ext" + TGZ_PATH:STRING="some_location" + where "some_location" is the URL or full path to the compressed file and + ext is the type of compression file. + ======================================================================== Building HDF5 C/C++ Libraries with CMake @@ -146,7 +168,31 @@ Notes: This short instruction is written for users who want to quickly build 3.1 If you wish to use the Visual Studio environment, open the solution file in your build directory. Be sure to select either Debug or Release and build the solution. - + + 3.2.1 The external libraries (zlib and szip) can be configured + to allow building the libraries by downloading from a SVN repository. + The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following + configuration option: + -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" + + The options to control the SVN URL (config/cmake/cacheinit.cmake file): + ZLIB_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/zlib/trunk" + SZIP_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/szip/trunk" + These should be changed to your location. + + 3.2.2 Or the external libraries (zlib and szip) can be configured + to allow building the libraries by using a compressed file. + The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following + configuration option: + -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" + + The options to control the SVN URL (config/cmake/cacheinit.cmake file): + ZLIB_TGZ_NAME:STRING="zlib_src.ext" + SZIP_TGZ_NAME:STRING="szip_src.ext" + TGZ_PATH:STRING="some_location" + where "some_location/xxxx_src.ext" is the URL or full path to the + compressed file and where ext is the type of the compression file like: + .bz2, .tar, .tar.gz, .tgz, .zip 4. Test HDF5. @@ -163,20 +209,20 @@ Notes: This short instruction is written for users who want to quickly build To package the build into a simple installer using the NullSoft installer NSIS on Windows, or into compressed files (.tar.gz, .sh, .zip), use the CPack tool. - To pacakage the build, navigate to your build directory and execute; + To package the build, navigate to your build directory and execute; cpack -C {Debug | Release} CPackConfig.cmake NOTE: We have just introduced the packaging capability and it has not been extensively tested. Please send us comments on how it can be improved. - 5. The files that support building HDF5 with CMake are all the files in the + 6. The files that support building HDF5 with CMake are all the files in the config/cmake folder, the CMakeLists.txt files in each source folder, and CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing performed by The HDF Group. It should be altered for the users installation and needs. - 6. More information about using CMake can be found at the KitWare site, + 7. More information about using CMake can be found at the KitWare site, www.cmake.org. diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index 04643b2..d771c0b 100644 --- a/release_docs/INSTALL_parallel +++ b/release_docs/INSTALL_parallel @@ -232,10 +232,10 @@ compiler is `mpicc' and the user hasn't specified values for RUNSERIAL and RUNPARALLEL then configure chooses `mpiexec' from the same directory as `mpicc': RUNSERIAL: /usr/local/mpi/bin/mpiexec -np 1 - RUNPARALLEL: /usr/local/mpi/bin/mpiexec -np $${NPROCS:=3} + RUNPARALLEL: /usr/local/mpi/bin/mpiexec -np $${NPROCS:=6} -The `$${NPROCS:=3}' will be substituted with the value of the NPROCS -environment variable at the time `make check' is run (or the value 3). +The `$${NPROCS:=6}' will be substituted with the value of the NPROCS +environment variable at the time `make check' is run (or the value 6). 4. Parallel test suite diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 279ec7e..3f32a43 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.76 currently under development +HDF5 version 1.9.80 currently under development ================================================================================ @@ -39,6 +39,12 @@ New Features Configuration: ------------- + - Added a new configure option, "--enable-unsupported", which can + be used to stop configure from preventing the use of unsupported + configure option combinations, such as c++ in parallel or parallel + HDF5 with threadsafe. Use at your own risk, as it may result in a + library that won't compile or run as expected! + (MAM - 2010/11/17 - Bug 2061) - PHDF5 changed to use "mpiexec", instead of mpirun, as the default MPI applications startup command as defined in the MPI-2 definition, section 4.1. (AKC - 2010/6/11 - Bug 1921) @@ -76,6 +82,8 @@ New Features Library: -------- + - Removed all old code for Metraowerks compilers, bracketed by + __MWERKS__). Metraowerks compiler is long gone. (AKC - 2010/11/17) - Added support for threadsafety on windows using the windows threads library. Use the HDF5_ENABLE_THREADSAFE option in CMake while on a windows platform to enable this functionality. This is supported on @@ -240,6 +248,7 @@ New Features Support for new platforms, languages and compilers. ======================================= + - Intel V11.1 uses now -O3 optimization in production mode (EIP - 2010/10/08) - PathScale compilers are recognized and can build the HDF5 library properly. AKC - 2009/7/28 - @@ -248,6 +257,14 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Fixed a bug that caused big endian machines to generate corrupt files + when using the scale-offset filter with floating point data or + fill values. Note that such datasets will no longer be readable + by any machine after this patch. (NAF - 2010/02/02 - Bug 2131) + - Retrieving a link's name by index in the case where the link is + external and the file that the link refers to doesn't exist will + now fail gracefully rather than cause a segmentation fault. + (MAM - 2010/11/17) - Modified library to always cache symbol table information. Libraries version 1.6.3 have a bug which causes them to require this information for some operations. (NAF - 2010/09/21 - 1864) @@ -473,6 +490,24 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - Fixed h5diff for the segfault when compares compound datasets + with combination of fixed length string types and vlen string types + in certain orders. bug#2089 (JKM 2010/12/28) + - Improve h5diff performance. 1) use HDmemcmp() before comparing each + elements. 2) replace expensive H5Tequals() calls 3) retrieve datatype + information at dataset level not each element level for compound + datasets + - Fixed h5ls to display nested compound type with curly bracket + when -S (--simple) option is used with -l (--label), so it shows + which member (in curly bracket) belong to which nested compound type + and make the output make sense. bug#1979 (JKM 2010/11/09) + - Fixed h5diff to handle variable-length strings in a compound dataset + correctly. (also variable-length string array in a compound dataset) + Garbage values were displayed when h5diff compared multiple + variable-length strings in a compound type dataset. + Bug#1989 (JKM 2010/10/28) + - Fixed h5copy to fail gracefully when copying object to non-exist + group without -p option. Bug#2040 (JKM 2010/10/18) - Fixed to compare member objects and groups recursively when two files or groups are specified to be compared. Bug#1975 (JKM 2010/9/16) @@ -640,15 +675,22 @@ Platforms Tested Intel(R) C++ Version 8.1 Intel(R) Fortran Compiler Version 8.1 mpich-gm-1.2.5..10-intel-r2 + + Windows XP Visual Studio 2008 w/ Intel Fortran 11.1 + Visual Studio 2010 + Cygwin(1.7.7 native gcc(4.3.4) compiler and gfortran) - Windows XP Visual Studio 2008 w/ Intel Fortran 10.1 - Cygwin(1.7.5 native gcc compiler and gfortran) + Windows XP x64 Visual Studio 2008 w/ Intel Fortran 11.1 + Visual Studio 2010 + Cygwin(1.7.7 native gcc(4.3.4) compiler and gfortran) + + Windows Vista Visual Studio 2008 w/ Intel Fortran 11.1 - Windows XP x64 Visual Studio 2008 w/ Intel Fortran 10.1 + Windows Vista x64 Visual Studio 2008 w/ Intel Fortran 11.1 - Windows Vista Visual Studio 2008 w/ Intel Fortran 10.1 + Windows 7 Visual Studio 2010 - Windows Vista x64 Visual Studio 2008 w/ Intel Fortran 10.1 + Windows 7 x64 Visual Studio 2010 MAC OS 10.5 (Intel) gcc i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 G95 (GCC 4.0.3 (g95 0.91!) Nov 21 2006) @@ -708,8 +750,8 @@ Cray XT3 (not tested for this release) n n n x n Windows XP y y(3) y y n Windows XP x64 y y(3) y y n -Windows Vista y y(3) y y n -Windows Vista x64 y y(3) y y n +Windows Vista y y(3) y y y +Windows Vista x64 y y(3) y y y Mac OS X 10.5 Intel y y y x n FreeBSD 6.2 32-bit y y y x n FreeBSD 6.2 64-bit y y y x n @@ -738,6 +780,18 @@ SuSe Linux 2.6.5 Known Problems ============== +* While working on the 1.8.6 release of HDF5, a bug was discovered that can + occur when reading from a dataset in parallel shortly after it has been + written to collectively. The issue was exposed by a new test in the parallel + HDF5 test suite, but had existed before that. We believe the problem lies with + certain MPI implementations and/or filesystems. + + We have provided a pure MPI test program, as well as a standalone HDF5 + program, that can be used to determine if this is an issue on your system. + They should be run across multiple nodes with a varying number of processes. + These programs can be found at: + http://www.hdfgroup.org/ftp/HDF5/examples/known_problems/ + * Parallel mode in AIX will fail some of the testcheck_version.sh tests where it treats "exit(134) the same as if process 0 had received an abort signal. This is fixed and will be available in the next release. AKC - 2009/11/3 diff --git a/release_docs/USING_Windows.txt b/release_docs/USING_Windows.txt new file mode 100644 index 0000000..03dbc67 --- /dev/null +++ b/release_docs/USING_Windows.txt @@ -0,0 +1,629 @@ + +*********************************************************************** +* HDF5 Build and Install Instructions for Windows XP/VISTA * +* (Full Version) * +*********************************************************************** + +The following instructions assume that the HDF5 binary code package from +HDF website (http://hdfgroup.org) is used. + +Warnings: +Please read CAREFULLY about the following preconditions and notes first. + +Contents: + + Section : Preconditions and Notes + Section I : What do we provide? + Section II : How to build examples (optional) + Section III : How to build an application using the HDF5 library or DLL + Section IV : How to build HDF5 for 64-bit Windows + Section V : How to build HDF5 applications using Visual Studio 2010 + Section VI : Misc. + + +======================================================================== + Preconditions and Notes +======================================================================== + +Preconditions: + + 1. Installed Microsoft Visual Studio. This document is written for Visual + Studio 2008. Express Editions may work with the project files + but not from the command line. We do not support the Express Editions. + + 2. (Optional) Installed Intel Compiler 10.1 or 11.1 if you want to use HDF5 + Fortran libraries. + + 3. Install Winzip or 7-zip for extracting source tarball. + + Note: 1. 7zip is an open-source alternative to WinZip. Some of the + advanced functionality is disabled in WinZip unless you buy the + software. With 7zip, most of this functionality is included for + free. + + 5. Set up a directory structure to unpack the library. For example: + + c:\ (any drive) + MyHDFstuff\ (any folder name) + + 6. Download the hdf5-1.8.x binary code package and use 7zip or WinZip to + extract the HDF5 package into c:\MyHDFstuff. This creates a directory + called 'hdf5-1.8.x' under MyHDFstuff which contains several files and + directories. Rename "hdf5-1.8.x" to "hdf5". + + 7. HDF5 provide options to do in-memory compression within HDF5 library. + Currently, two external compression libraries Zlib and Szip can be used + with HDF5. + + 7.1 HDF5 uses Zlib version 1.2.5 for compression and Zlib is + distributed with HDF5 library in 1.8.x release. + + 7.2 HDF5 uses Szip version 2.1 for compression and Szip compression + software is provided with HDF5 products in 1.8.x release. + + Please note that Szip is not a totally open-source free software. + For licensing issue of Szip, please check "Licensing terms" at + http://hdfgroup.org/doc_resource/SZIP/index.html. + + Szip compression feature inside HDF5 is enabled by default. + + 8. Set up path for libraries and headers + + Invoke Microsoft Visual Studio and go to "Tools" and select "Options", + find "Projects", and then "VC++ Directories". + + 8.1 If you are building on 64-bit Windows, find the "Platform" dropdown + and select "x64". + + 8.2 Find the box "Show directories for", choose "Include files", if you + can not find your HDF5 header path (for example, + c:\MyHDFstuff\include) from the directory list, add the + header path (c:\MyHDFstuff\include) to the included + directories. + + 8.3 Find the box "Show directories for", choose "Library files". If you + cannot find your HDF5 library path (for example, + c:\MyHDFstuff\dll) from the directory list, add the library + path (c:\MyHDFstuff\dll) to the library directories. + + 8.4 If building Fortran applications, you will also need to setup the path + for the Intel Fortran compiler. Please see Section VI. + +Notes: + + 1. HDF4-related tools are not built and released with HDF5 library packages + any more. To obtain HDF4 related tools, please check + http://hdfgroup.org/h4toh5/ and ftp://ftp.hdfgroup.org/HDF5/h4toh5 + + 2. For Fortran users, Intel Fortran Compiler 10.1 is currently supported + -- please see Section VI. Intel Compiler 11.1 can be used but the project files + must be upgraded within the Visual Studio IDE. + + +======================================================================== + Section I: What do we provide? +======================================================================== + + 1. Provide + + HDF5 static library: + release version + + HDF5 Dynamic Link Library(DLL): + release version as well as export libraries for DLL + + HDF5 High-Level Library (Optional): + HDF5 C++ Library + HDF5 HL-Fortran Library + + HDF5 tools: + HDF5 tools + + HDF5 tool library: + release version + + HDF5 tool export library for DLL: + release version + + 2. Examples (Not included in the binary distribution) + + HDF5 examples: + Simple HDF5 C/C++/Fortran and High level C/Fortran examples + +======================================================================== + Section II: How To Build Examples (Optional) +======================================================================== + +Simple examples have been provided for users to test HDF5 C/C++/Fortran and +High level C/Fortran library and tools. + +Note: + 1) To build HDF5 C++ examples, HDF5 C++ library must have been installed in + Step I. + + 2) To build HDF5 Fortran or HL Fortran examples, please see Section VI, + Step 3. + + 3) To build HDF5 High Level C examples, HDF5 High level library must have + been installed in step I. + + 4) By default, the HDF5 binary distribution only includes the release + versions of HDF5 C/C++ libraries and DLLs. + +To build and test HDF5 C examples: +---------------------------------- + 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open + Solution" option. + + Then open the solution + c:\MyHDFstuff\hdf5\windows\examples\allexamples\allexamples.sln. + + 2. Select "Build", and "Configuration Manager". + + 2.1 To build debug versions of C examples: + + In "Active Solution Configuration", select "Debug". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + debug version of project "allexamples". + + 2.2 To build release versions of C examples. + + In "Active Solution Configuration", select "Release". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + release version of project "allexamples". + + When the debug and release build is done, there should be the following + subdirectories in c:\MyHDFstuff\hdf5\examples\ + + attributetest + attributetestdll + chunkread + chunkreaddll + compoundtest + compoundtestdll + extendwritetest + extendwritetestdll + grouptest + grouptestdll + readtest + readtestdll + selectest + selectestdll + writetest + writetestdll + + 3. Invoke a command prompt window and run the batch file InstallExamples.bat + which resides in the top level directory (c:\MyHDFstuff\hdf5). This file + creates 4 new directories, examplesREL, examplesRELDLL, examplesDBG, and + examplesDBGDLL, in the c:\MyHDFstuff\hdf5\examples directory and places + all the executables in it. Both the release and debug versions of the + examples should be built before this step is done. + + 4. We provide a batch file named testExamples.bat and an expected examples + tests output file named testExamples_exp_output.txt in + c:\MyHDFstuff\hdf5\examples directory for you to test HDF5 C examples. + + testExamples.bat batch file has 4 options: + + testExamples release -- for release version + + testExamples release dll -- for release DLL version + + testExamples debug -- for debug version + + testExamples debug dll -- for debug DLL version + + Invoke a command prompt and run testExamples.bat with appropriate options. + You should get "All HDF5 C examples tests passed." when the C examples are + built successfully. Otherwise, the difference between the expected + outputs and actual outputs will be given. + +To build and test HDF5 C++ examples: +------------------------------------ + + 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open + Solution" option. + + Then open the solution + c:\MyHDFstuff\hdf5\windows\examples\allexamples\allcppexamples.sln. + + 2. Select "Build", and "Configuration Manager". + + 2.1 To build debug versions of C examples: + + In "Active Solution Configuration", select "Debug". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + debug version of project "allcppexamples". + + 2.2 To build release versions of C examples. + + In "Active Solution Configuration", select "Release". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + release version of project "allcppexamples". + + When the debug build or release build is done, there should be the following + subdirectories in c:\MyHDFstuff\hdf5\c++\examples\ + + chunks + chunksdll + compound + compounddll + create + createdll + extend_ds + extend_dsll + h5group + h5groupdll + readdata + readdatadll + writedata + writedatadll + + 3. Invoke a command prompt window and run the batch file + InstallcppExamples.bat which resides in the top level directory + (c:\MyHDFstuff\hdf5). This file creates 4 new directories, + cppexamplesREL, cppexamplesRELDLL, cppexamplesDBG, and cppexamplesDBGDLL, + in the c:\MyHDFstuff\c++\examples directory and places all the executables + in it. Both the release and debug versions of the examples should be + built before this step is done. + + 4. We provide a batch file named testcppExamples.bat in + c:\MyHDFstuff\hdf5\c++\examples directory for you to test HDF5 C++ + examples. + + testcppExamples.bat batch file has 4 options: + + testcppExamples release -- for release version + + testcppExamples release dll -- for release DLL version + + testcppExamples debug -- for debug version + + testcppExamples debug dll -- for debug DLL version + + Invoke a command prompt and run testcppExamples.bat with appropriate + options. You should get "All HDF5 C++ examples tests passed." when the + C++ examples are built successfully. Otherwise, the difference between + the expected outputs and actual outputs will be given. + + +To build and test HDF5 High Level C examples: +--------------------------------------------- + + 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open + Solution" option. + + Then open the solution + c:\MyHDFstuff\hdf5\windows\hl\examples\allhlcexamples\allhlcexamples.sln + + 2. Select "Build", and "Configuration Manager". + + 2.1 To build debug versions of C examples: + + In "Active Solution Configuration", select "Debug". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + debug version of project "allhlcexamples". + + 2.2 To build release versions of C examples. + + In "Active Solution Configuration", select "Release". Select "Close". + Select "Build" -> "Build Solution" or "Rebuild Solution" to build + release version of project "allhlcexamples". + + When the debug and release build is done, binaries will be built in the + following subdirectories of c:\MyHDFstuff\hdf5\examples\ + + ex_image[1-2](dll) + ex_lite1(dll) + ex_table[01-12](dll) + ex_ds1(dll) + ptExample[FL+VL](dll) + + 3. Invoke a command prompt and run the batch file Install_hlcexamples.bat + which resides in the top level directory (c:\MyHDFstuff\hdf5). This file + creates 4 new directories, HLCexamplesRELEASE, HLCexamplesRELEASEDLL, + HLCexamplesDEBUG, and HLCexamplesDEBUGDLL, in the + c:\MyHDFstuff\hdf5\hl\examples directory and places all the executables in + it. Both the release and debug versions of the examples should be built + before this step is done. + + 4. We provide a batch file named test_hl_cexamples.bat in + c:\MyHDFstuff\hdf5\hl\examples directory for you to test HDF5 high level C + examples. + + test_hl_cexamples.bat batch file has 4 options: + + Options purpose + + test_hl_cexamples release -- for release version + + test_hl_cexamples release dll -- for release DLL version + + test_hl_cexamples debug -- for debug version + + test_hl_cexamples debug dll -- for debug DLL version + + Invoke a command prompt window and run test_hl_cexamples with + appropriate options. + + Invoke a command prompt and run testExamples.bat with appropriate options. + You should get "All of the HL C Examples Passed!" when the HL C examples + are built successfully. Otherwise, the difference between the expected + outputs and actual outputs will be given. + + +======================================================================== + Section III: Building an application using the HDF5 library or DLL +======================================================================== + +Waring: The instructions below will only describe how to build an application + using the release version of the HDF5 library or DLL. To use the debug + version of the HDF5 library or DLL, you need to substitute the release + version of the HDF5 library or DLL with the debug version. + + +To build an application that uses the HDF5 static library the following +locations will need to be specified for locating header files and linking with +the HDF static library, for example: + +c:\MyHDFstuff\hdf5\hdf5lib\release\include +c:\MyHDFstuff\hdf5\hdf5lib\release\lib + +We assume that you will use Zlib and Szip compression with HDF5 library. + +1. Specifying Include Directories + +To specify the include directories in the settings for your Visual Studio +project, you may choose one of the following two methods. + + Method One: Project-wide Settings + + 1. Open your project in Microsoft Visual Studio and make sure it is the + active project. + + 2. Go to the Project menu and chose the "Properties" option. + + 3. Choose the build configuration you would like to modify in the drop + down menu labeled "Configuration:" + + 4. Choose the "C/C++" tab, and select "General". + + 5. In a text-area labeled with "Additional Include Directories:", add + HDF5, Zlib, and Szip header files directories. For example: + + c:\MyHDFstuff\hdf5\hdf5lib\release\include + c:\zlib\include + c:\szip\include + + Then click OK. + + 6. (Optional) To use HDF5 Fortran static library, the location of + Fortran module files should be specified by following Project-> + Settings->Fortran->Preprocessor, and in the text-area labeled + "Additional Include Directories", add HDF5 Fortran module files + directories. For example: + + c:\MyHDFstuff\hdf5\hdf5lib\release\include + + Method Two: Visual Studio Settings + + 1. In Visual STudio, go to Tools->Options->Projects-> + VC++ Directories. Under "Show Directories For", select "Include files" + + 2. Insert the correct HDF5, Zlib, Szip paths for headers(include). For + example, + + c:\MyHDFstuff\hdf5\hdf5lib\release\include + c:\zlib\include + c:\szip\include + + +2. Specifying Library Directories + +To specify the library directories in the settings for your Visual Studio +project, you may choose one of the following two methods. + + Method One: Project-wide Settings + + 1. Open your project in Microsoft Visual Studio and make sure it is the + active project. + + 2. Go to the Project menu and chose the "Properties" option. + + 3. Choose the build configuration you would like to modify in the drop + down menu labeled "Configuration:" + + 4. Choose the "Linker" tab, and select "General". + + 5. In a text-area labeled with "Additional Library Directories:", add + HDF5, Zlib, and Szip library files directories. For example: + + c:\MyHDFstuff\hdf5\hdf5lib\release\lib + c:\zlib\dll + c:\szip\dll + + Note: To link with HDF5 DLLs rathern that static libraries, simply + specify the "dll" directory rather than "lib", and link with the + corresponding DLL link library below. + + Then click OK. + + + Method Two: Visual Studio Settings + + 1. In Visual STudio, go to Tools->Options->Projects-> + VC++ Directories. Under "Show Directories For", select "Library files" + + 2. Insert the correct HDF5, Zlib, Szip paths for link libraries. For + example, + + c:\MyHDFstuff\hdf5\hdf5lib\release\lib + c:\zlib\dll + c:\szip\dll + + Note: To link with HDF5 DLLs rathern that static libraries, simply + specify the "dll" directory rather than "lib", and link with the + corresponding DLL link library below. + + +3. Specifying Libraries to Link + + To link the HDF5 static library with your application: + + 1. In Visual Studio, go to the Project menu and choose "Properties". + + 2. Find the "Link" option and "Input" category. In the "Additional + Dependencies" field, insert "zlib.lib, libszip.lib, hdf5.lib". + + 3. (Optional) Also insert "hdf5_cpp.lib" if you want to use HDF5 C++ + static library. + + 4. (Optional) Also insert "hdf5_fortran.lib" if you want to use HDF5 + Fortran static library. + + 5. (Optional) Also insert "hdf5_hl.lib" if you want to use HDF5 high + level static library. + + 6. (Optional) Also insert "hdf5_hl_cpp.lib" if you want to use HDF5 High + Level C++ static library. + + 7. (Optional) Also insert "hdf5_hl_fortran.lib" if you want to use HDF5 + High Level Fortran static library. + + + To link the HDF5 DLL library with your application: + + 1. Follow the steps for linking the HDF5 static library as shown above, + except now link the export library that is created with the DLL. + + The export library is called hdf5dll.lib for HDF5 C libray, + hdf5_cppdll.lib for HDF5 C++ library, and hdf5_fortrandll.lib + for HDF5 Fortran library. + + 2. In the Project Properties dialog, go to the C/C++ > Preprocessor + subsection. In the "Preprocessor Definitions" box, add "_HDF5USEDLL_" + to the list. + + 3. (Optional) Also add HDF5CPP_USEDLL to use HDF5 C++ DLL. + + 4. (Optional) Also add _HDF5USEHLDLL_ to use HDF5 high level DLL. + + 5. (Optional) Also add HDF5USE_HLCPPDLL use HDF5 high level C++ DLL. + + 6. (Optional) Follow Project->Settings->Fortran->Category->General-> + Predefined Preprocess or Symbols, and add "HDF5F90_WINDOWS" to use HDF5 + Fortran DLL. + + 7. Place the DLLs in a location that Windows will be able to locate. The + searched path and order for DLL's is + + a) The directory where the executable module for the current + process is located. + b) The current directory. + c} The Windows system directory. The GetSystemDirectory function + retrieves the path of this directory. + d) The Windows directory. The GetWindowsDirectory function + retrieves the path of this directory. + e) The directories listed in the PATH environment variable. + + +======================================================================== + Section IV: How to build HDF5 for 64-bit Windows +======================================================================== + +HDF5 is available for 64-bit Windows in Visual Studio 2008. + +Prerequisites: + + 1. A 64-bit Windows machine. + + 2. Microsoft Visual Studio 2008 installed with x64 Extensions. + + +Building: + + Building 64-bit Windows binaries is very similar to the process for 32-bit. + Therefore, you may follow the instructions in Section II with the following + modifications. + + 1. The x64 platform must be selected in the build configuration for + debug and release versions. Before building, go to "Build", + "Configuration Manager". In the "Active solution platform" box, + select "x64", and press "Close". + + 2. 64-bit HDF5 applications must be built with 64-bit external libraries. + You must add the include and + library paths for x64 configurations as you have in the + "Prerequisites" section. This is also true for Intel Fortran if + Fortran libraries are to be built. + +======================================================================== + Section V: How to build HDF5 applications using Visual Studio 2010 +======================================================================== +Building with Visual Studio 2010 is very similar to building with Visual Studio +2008, with some minor changes. Therefore, follow the build instructions above, +with the following considerations: + + 1. Visual Studio 2010 uses a new format for project files, but Visual Studio + 2008 project files can be easily converted. The HDF5 project files + will need to be converted on first use. To do so: + + 1.1. Open the HDF5 Visual Studio 2008 solution file as in Section II + (all.sln) + + NOTE. Intel Fortran 11.1 currently does not integrate with Visual Studio 2010. + + 1.2. You will be prompted with an automatic conversion wizard. Click + through, accepting the default values. You may choose to create + backups of the project files, although it isn't necessary. + + 1.3. When it is finished, it should state that all projects were + converted successfully with no errors. Warnings can be ignored. + + 2. Once the project files have been converted, build and test normally. + Note that the converted project files aren't backwards compatible with + previous versions of Visual Studio. + + +======================================================================== + Section VI: Misc. +======================================================================== + +1. Helpful Pointers + +Here are some helpful notes if you are not familiar with +using the Visual C++ Development Environment. + + 1.1 Project name and location issues: + + It is recommended that you use the given directory structure for building + HDF5. However, it is possible to create your own structure. If you must + install all.sln and all.vcproj in another directory, relative to hdf5 + directory, you will be asked to locate the sub-project files, when you open + the project all.sln. + + If you want to rename "all" (the entire project), you will need to modify + two files all.sln and all.vcproj as text (contrary to the explicit warnings + in the files). + + + 1.2 Settings... details: + + If you create your own project, the necessary settings can be read + from the all.vcproj file (as text), or from the Project Settings in the + Visual Studio project settings dialog. + + 1.3 FAQ + + Many other common questions and hints are located online and being updated + in the HDF5 FAQ. For Windows-specific questions, please see: + + http://www.hdfgroup.uiuc.edu/windows/faq.html + + For all other general questions, you can look in the general FAQ: + + http://hdfgroup.org/HDF5-FAQ.html + + +************************************************************************ + Please send email to help@hdfgroup.org for further assistance. @@ -1824,6 +1824,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_dump_cache + * + * Purpose: Dumps a summary of the contents of the metadata cache + * to stdout. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * Sunday, October 10, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_dump_cache(const H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5AC_dump_cache, FAIL) + + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + + if ( H5C_dump_cache(f->shared->cache, H5F_OPEN_NAME(f)) < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_dump_cache() failed.") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_dump_cache() */ + + +/*------------------------------------------------------------------------- * Function: H5AC_get_cache_auto_resize_config * * Purpose: Wrapper function for H5C_get_cache_auto_resize_config(). @@ -2465,7 +2499,9 @@ H5AC_open_trace_file(H5AC_t * cache_ptr, #else /* H5_HAVE_PARALLEL */ - sprintf(file_name, "%s", trace_file_name); + HDsnprintf(file_name, + (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1), + "%s", trace_file_name); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 79f355c..456eb0d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -372,6 +372,8 @@ H5_DLL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); H5_DLL herr_t H5AC_stats(const H5F_t *f); +H5_DLL herr_t H5AC_dump_cache(const H5F_t *f); + H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr); @@ -120,6 +120,8 @@ 4 + /*type, level, num entries */ \ 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ +/* Default initializer for H5B_ins_ud_t */ +#define H5B_INS_UD_T_NULL {NULL, HADDR_UNDEF, H5AC__NO_FLAGS_SET} /******************/ /* Local Typedefs */ @@ -131,24 +133,32 @@ typedef struct H5B_iter_ud_t { void *udata; /* Node type's 'udata' for loading & iterator callback */ } H5B_info_ud_t; +/* Convenience struct for the arguments needed to unprotect a b-tree after a + * call to H5B_iterate_helper() or H5B_split() */ +typedef struct H5B_ins_ud_t { + H5B_t *bt; /* B-tree */ + haddr_t addr; /* B-tree address */ + unsigned cache_flags; /* Cache flags for H5AC_unprotect() */ +} H5B_ins_ud_t; + /********************/ /* Local Prototypes */ /********************/ -static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, +static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed, - haddr_t *retval); + H5B_ins_ud_t *split_bt_ud/*out*/); static herr_t H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key); -static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, - unsigned *old_bt_flags, haddr_t old_addr, - unsigned idx, void *udata, haddr_t *new_addr/*out*/); +static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, + unsigned idx, void *udata, + H5B_ins_ud_t *split_bt_ud/*out*/); static H5B_t * H5B_copy(const H5B_t *old_bt); @@ -374,7 +384,7 @@ done: * The UDATA pointer is passed to the sizeof_rkey() method but is * otherwise unused. * - * The OLD_BT argument is a pointer to a protected B-tree + * The BT_UD argument is a pointer to a protected B-tree * node. * * Return: Non-negative on success (The address of the new node is @@ -387,14 +397,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, - haddr_t old_addr, unsigned idx, void *udata, haddr_t *new_addr_p/*out*/) +H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, + void *udata, H5B_ins_ud_t *split_bt_ud/*out*/) { H5P_genplist_t *dx_plist; /* Data transfer property list */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - unsigned new_bt_flags = H5AC__NO_FLAGS_SET; - H5B_t *new_bt = NULL; unsigned nleft, nright; /* Number of keys in left & right halves */ double split_ratios[3]; /* B-tree split ratios */ herr_t ret_value = SUCCEED; /* Return value */ @@ -405,16 +413,18 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, * Check arguments. */ HDassert(f); - HDassert(old_bt); - HDassert(old_bt_flags); - HDassert(H5F_addr_defined(old_addr)); + HDassert(bt_ud); + HDassert(bt_ud->bt); + HDassert(H5F_addr_defined(bt_ud->addr)); + HDassert(split_bt_ud); + HDassert(!split_bt_ud->bt); /* * Initialize variables. */ - shared = (H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt_ud->bt->rc_shared); HDassert(shared); - HDassert(old_bt->nchildren == shared->two_k); + HDassert(bt_ud->bt->nchildren == shared->two_k); /* Get the dataset transfer property list */ if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -428,11 +438,11 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, if(H5DEBUG(B)) { const char *side; - if(!H5F_addr_defined(old_bt->left) && !H5F_addr_defined(old_bt->right)) + if(!H5F_addr_defined(bt_ud->bt->left) && !H5F_addr_defined(bt_ud->bt->right)) side = "ONLY"; - else if(!H5F_addr_defined(old_bt->right)) + else if(!H5F_addr_defined(bt_ud->bt->right)) side = "RIGHT"; - else if(!H5F_addr_defined(old_bt->left)) + else if(!H5F_addr_defined(bt_ud->bt->left)) side = "LEFT"; else side = "MIDDLE"; @@ -445,9 +455,9 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, * Decide how to split the children of the old node among the old node * and the new node. */ - if(!H5F_addr_defined(old_bt->right)) + if(!H5F_addr_defined(bt_ud->bt->right)) nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/ - else if(!H5F_addr_defined(old_bt->left)) + else if(!H5F_addr_defined(bt_ud->bt->left)) nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/ else nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/ @@ -470,69 +480,66 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, /* * Create the new B-tree node. */ - if(H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0) + if(H5B_create(f, dxpl_id, shared->type, udata, &split_bt_ud->addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; - cache_udata.rc_shared = old_bt->rc_shared; - if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, &cache_udata, H5AC_WRITE))) + cache_udata.rc_shared = bt_ud->bt->rc_shared; + if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") - new_bt->level = old_bt->level; + split_bt_ud->bt->level = bt_ud->bt->level; /* * Copy data from the old node to the new node. */ - /* this function didn't used to mark the new bt entry as dirty. Since - * we just inserted the entry, this doesn't matter unless the entry - * somehow gets flushed between the insert and the protect. At present, - * I don't think this can happen, but it doesn't hurt to mark the entry - * dirty again. - * -- JRM - */ - new_bt_flags |= H5AC__DIRTIED_FLAG; - HDmemcpy(new_bt->native, - old_bt->native + nleft * shared->type->sizeof_nkey, + split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG; + HDmemcpy(split_bt_ud->bt->native, + bt_ud->bt->native + nleft * shared->type->sizeof_nkey, (nright + 1) * shared->type->sizeof_nkey); - HDmemcpy(new_bt->child, - &old_bt->child[nleft], + HDmemcpy(split_bt_ud->bt->child, + &bt_ud->bt->child[nleft], nright * sizeof(haddr_t)); - new_bt->nchildren = nright; + split_bt_ud->bt->nchildren = nright; /* * Truncate the old node. */ - *old_bt_flags |= H5AC__DIRTIED_FLAG; - old_bt->nchildren = nleft; + bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; + bt_ud->bt->nchildren = nleft; /* * Update sibling pointers. */ - new_bt->left = old_addr; - new_bt->right = old_bt->right; + split_bt_ud->bt->left = bt_ud->addr; + split_bt_ud->bt->right = bt_ud->bt->right; - if(H5F_addr_defined(old_bt->right)) { + if(H5F_addr_defined(bt_ud->bt->right)) { H5B_t *tmp_bt; H5B_cache_ud_t cache_udata2; /* User-data for metadata cache callback */ cache_udata2.f = f; cache_udata2.type = shared->type; - cache_udata2.rc_shared = old_bt->rc_shared; - if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, &cache_udata2, H5AC_WRITE))) + cache_udata2.rc_shared = bt_ud->bt->rc_shared; + if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt_ud->bt->right, &cache_udata2, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling") - tmp_bt->left = *new_addr_p; + tmp_bt->left = split_bt_ud->addr; - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud->bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") } /* end if */ - old_bt->right = *new_addr_p; + bt_ud->bt->right = split_bt_ud->addr; done: - if(new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, new_bt_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + if(ret_value < 0) { + if(split_bt_ud->bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, split_bt_ud->addr, split_bt_ud->bt, split_bt_ud->cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + split_bt_ud->bt = NULL; + split_bt_ud->addr = HADDR_UNDEF; + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_split() */ @@ -541,8 +548,7 @@ done: /*------------------------------------------------------------------------- * Function: H5B_insert * - * Purpose: Adds a new item to the B-tree. If the root node of - * the B-tree splits then the B-tree gets a new address. + * Purpose: Adds a new item to the B-tree. * * Return: Non-negative on success/Negative on failure * @@ -565,10 +571,11 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, uint8_t *rt_key=(uint8_t*)_rt_key; hbool_t lt_key_changed = FALSE, rt_key_changed = FALSE; - haddr_t child, old_root; + haddr_t old_root_addr = HADDR_UNDEF; unsigned level; - H5B_t *bt; - H5B_t *new_bt; /* Copy of B-tree info */ + H5B_ins_ud_t bt_ud = H5B_INS_UD_T_NULL; /* (Old) root node */ + H5B_ins_ud_t split_bt_ud = H5B_INS_UD_T_NULL; /* Split B-tree node */ + H5B_t *new_root_bt = NULL; /* New root node */ H5RC_t *rc_shared; /* Ref-counted shared info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ @@ -583,118 +590,111 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDassert(type->sizeof_nkey <= sizeof _lt_key); HDassert(H5F_addr_defined(addr)); - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key, - <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") - if(H5B_INS_NOOP == my_ins) - HGOTO_DONE(SUCCEED) - HDassert(H5B_INS_RIGHT == my_ins); - /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared); HDassert(shared); - /* the current root */ + /* Protect the root node */ cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree") + bt_ud.addr = addr; + if(NULL == (bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree") + + /* Insert the object */ + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &bt_ud, type, lt_key, + <_key_changed, md_key, udata, rt_key, &rt_key_changed, + &split_bt_ud/*out*/)) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") + if(H5B_INS_NOOP == my_ins) { + HDassert(!split_bt_ud.bt); + HGOTO_DONE(SUCCEED) + } /* end if */ + HDassert(H5B_INS_RIGHT == my_ins); + HDassert(split_bt_ud.bt); + HDassert(H5F_addr_defined(split_bt_ud.addr)); - level = bt->level; + /* Get level of old root */ + level = bt_ud.bt->level; + /* update left and right keys */ if(!lt_key_changed) - HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey); - - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") - bt = NULL; - - /* the new node */ - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new node") - + HDmemcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey); if(!rt_key_changed) - HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); - - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") - bt = NULL; + HDmemcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey); /* - * Copy the old root node to some other file location and make the new - * root at the old root's previous address. This prevents the B-tree - * from "moving". + * Copy the old root node to some other file location and make the new root + * at the old root's previous address. This prevents the B-tree from + * "moving". */ H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); - if(HADDR_UNDEF == (old_root = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) + if(HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") - /* update the new child's left pointer */ - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child") - - bt->left = old_root; - - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") - bt = NULL; /* Make certain future references will be caught */ - /* - * Move the node to the new location by checking it out & checking it in - * at the new location -QAK + * Move the node to the new location */ - /* Bring the old root into the cache if it's not already */ - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child") - - /* Make certain the old root info is marked as dirty before moving it, */ - /* so it is certain to be written out at the new location */ /* Make a copy of the old root information */ - if(NULL == (new_bt = H5B_copy(bt))) { - HCOMMON_ERROR(H5E_BTREE, H5E_CANTCOPY, "unable to copy old root"); + if(NULL == (new_root_bt = H5B_copy(bt_ud.bt))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to copy old root"); - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") - - HGOTO_DONE(FAIL) - } /* end if */ - - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child") - bt = NULL; /* Make certain future references will be caught */ + /* Unprotect the old root so we can move it. Also force it to be marked + * dirty so it is written to the new location. */ + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") + bt_ud.bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ - if(H5AC_move_entry(f, H5AC_BT, addr, old_root) < 0) + if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") + bt_ud.addr = old_root_addr; + + /* Update the split b-tree's left pointer to point to the new location */ + split_bt_ud.bt->left = bt_ud.addr; + split_bt_ud.cache_flags |= H5AC__DIRTIED_FLAG; /* clear the old root info at the old address (we already copied it) */ - new_bt->left = HADDR_UNDEF; - new_bt->right = HADDR_UNDEF; + new_root_bt->left = HADDR_UNDEF; + new_root_bt->right = HADDR_UNDEF; /* Set the new information for the copy */ - new_bt->level = level + 1; - new_bt->nchildren = 2; + new_root_bt->level = level + 1; + new_root_bt->nchildren = 2; - new_bt->child[0] = old_root; - HDmemcpy(H5B_NKEY(new_bt, shared, 0), lt_key, shared->type->sizeof_nkey); + new_root_bt->child[0] = bt_ud.addr; + HDmemcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey); - new_bt->child[1] = child; - HDmemcpy(H5B_NKEY(new_bt, shared, 1), md_key, shared->type->sizeof_nkey); - HDmemcpy(H5B_NKEY(new_bt, shared, 2), rt_key, shared->type->sizeof_nkey); + new_root_bt->child[1] = split_bt_ud.addr; + HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey); + HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey); /* Insert the modified copy of the old root into the file again */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node") + if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add old B-tree root node to cache") + +done: + if(ret_value < 0) + if(new_root_bt && H5B_node_dest(new_root_bt) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to free B-tree root node"); + + if(bt_ud.bt) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud.addr, bt_ud.bt, bt_ud.cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect old root") + + if(split_bt_ud.bt) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, split_bt_ud.addr, split_bt_ud.bt, split_bt_ud.cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect new child") #ifdef H5B_DEBUG - H5B_assert(f, dxpl_id, addr, type, udata); + if(ret_value >= 0) + H5B_assert(f, dxpl_id, addr, type, udata); #endif -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_insert() */ @@ -725,6 +725,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, HDassert(bt); HDassert(bt_flags); + HDassert(H5F_addr_defined(child)); shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); HDassert(bt->nchildren < shared->two_k); @@ -803,20 +804,21 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, *------------------------------------------------------------------------- */ static H5B_ins_t -H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, +H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, + const H5B_class_t *type, uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed, - haddr_t *new_node_p/*out*/) + H5B_ins_ud_t *split_bt_ud/*out*/) { - unsigned bt_flags = H5AC__NO_FLAGS_SET, twin_flags = H5AC__NO_FLAGS_SET; - H5B_t *bt = NULL, *twin = NULL; + H5B_t *bt; /* Convenience pointer to B-tree */ H5RC_t *rc_shared; /* Ref-counted shared info */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ + H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ unsigned lt = 0, idx = 0, rt; /* Left, final & right index values */ int cmp = -1; /* Key comparison value */ - haddr_t child_addr = HADDR_UNDEF; + H5B_ins_ud_t child_bt_ud = H5B_INS_UD_T_NULL; /* Child B-tree */ + H5B_ins_ud_t new_child_bt_ud = H5B_INS_UD_T_NULL; /* Newly split child B-tree */ H5B_ins_t my_ins = H5B_INS_ERROR; H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */ @@ -826,7 +828,9 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Check arguments */ HDassert(f); - HDassert(H5F_addr_defined(addr)); + HDassert(bt_ud); + HDassert(bt_ud->bt); + HDassert(H5F_addr_defined(bt_ud->addr)); HDassert(type); HDassert(type->decode); HDassert(type->cmp3); @@ -835,7 +839,12 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HDassert(lt_key_changed); HDassert(rt_key); HDassert(rt_key_changed); - HDassert(new_node_p); + HDassert(split_bt_ud); + HDassert(!split_bt_ud->bt); + HDassert(!H5F_addr_defined(split_bt_ud->addr)); + HDassert(split_bt_ud->cache_flags == H5AC__NO_FLAGS_SET); + + bt = bt_ud->bt; *lt_key_changed = FALSE; *rt_key_changed = FALSE; @@ -851,11 +860,6 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * data. When the search completes IDX points to the child that * should get the new data. */ - cache_udata.f = f; - cache_udata.type = type; - cache_udata.rc_shared = rc_shared; - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") rt = bt->nchildren; while(lt < rt && cmp) { @@ -866,6 +870,11 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type lt = idx + 1; } /* end while */ + /* Set up user data for cache callbacks */ + cache_udata.f = f; + cache_udata.type = type; + cache_udata.rc_shared = rc_shared; + if(0 == bt->nchildren) { /* * The value being inserted will be the only value in this tree. We @@ -876,13 +885,13 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type H5B_NKEY(bt, shared, 1), bt->child + 0/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node") bt->nchildren = 1; - bt_flags |= H5AC__DIRTIED_FLAG; + bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; idx = 0; if(type->follow_min) { if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), - rt_key_changed, &child_addr/*out*/)) < 0) + rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node") } /* end if */ else @@ -893,10 +902,14 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * The value being inserted is less than any value in this tree. * Follow the minimum branch out of this node to a subtree. */ - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + child_bt_ud.addr = bt->child[idx]; + if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, - &child_addr/*out*/)) < 0) + &new_child_bt_ud/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree") } else if(type->follow_min) { /* @@ -906,7 +919,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), - rt_key_changed, &child_addr/*out*/)) < 0) + rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") } else { /* @@ -917,7 +930,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type my_ins = H5B_INS_LEFT; HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); if((type->new_node)(f, dxpl_id, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata, - md_key, &child_addr/*out*/) < 0) + md_key, &new_child_bt_ud.addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") *lt_key_changed = TRUE; } /* end else */ @@ -935,9 +948,14 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Follow the maximum branch out of this node to a subtree. */ idx = bt->nchildren - 1; - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + child_bt_ud.addr = bt->child[idx]; + if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, - H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) + H5B_NKEY(bt, shared, idx + 1), rt_key_changed, + &new_child_bt_ud/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree") } else if(type->follow_max) { /* @@ -948,7 +966,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type idx = bt->nchildren - 1; if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), - rt_key_changed, &child_addr/*out*/)) < 0) + rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") } else { /* @@ -960,7 +978,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type my_ins = H5B_INS_RIGHT; HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); if((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata, - H5B_NKEY(bt, shared, idx + 1), &child_addr/*out*/) < 0) + H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") *rt_key_changed = TRUE; } /* end else */ @@ -985,9 +1003,13 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Follow a branch out of this node to another subtree. */ HDassert(idx < bt->nchildren); - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + child_bt_ud.addr = bt->child[idx]; + if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + + if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, - H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0) + H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree") } else { /* @@ -996,7 +1018,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HDassert(idx < bt->nchildren); if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), - rt_key_changed, &child_addr/*out*/)) < 0) + rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node") } HDassert((int)my_ins >= 0); @@ -1005,18 +1027,20 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Update the left and right keys of the current node. */ if(*lt_key_changed) { - bt_flags |= H5AC__DIRTIED_FLAG; + bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if(idx > 0) { HDassert(type->critical_key == H5B_LEFT); + HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *lt_key_changed = FALSE; } /* end if */ else HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); } /* end if */ if(*rt_key_changed) { - bt_flags |= H5AC__DIRTIED_FLAG; + bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if(idx + 1 < bt->nchildren) { HDassert(type->critical_key == H5B_RIGHT); + HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *rt_key_changed = FALSE; } /* end if */ else @@ -1026,9 +1050,10 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type /* * The insertion simply changed the address for the child. */ - bt->child[idx] = child_addr; - bt_flags |= H5AC__DIRTIED_FLAG; - ret_value = H5B_INS_NOOP; + HDassert(!child_bt_ud.bt); + HDassert(bt->level == 0); + bt->child[idx] = new_child_bt_ud.addr; + bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; } else if(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { hbool_t *tmp_bt_flags_ptr = NULL; H5B_t *tmp_bt; @@ -1037,26 +1062,24 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * If this node is full then split it before inserting the new child. */ if(bt->nchildren == shared->two_k) { - if(H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/) < 0) + if(H5B_split(f, dxpl_id, bt_ud, idx, udata, split_bt_ud/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node") - if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") if(idx < bt->nchildren) { tmp_bt = bt; - tmp_bt_flags_ptr = &bt_flags; + tmp_bt_flags_ptr = &bt_ud->cache_flags; } else { idx -= bt->nchildren; - tmp_bt = twin; - tmp_bt_flags_ptr = &twin_flags; + tmp_bt = split_bt_ud->bt; + tmp_bt_flags_ptr = &split_bt_ud->cache_flags; } } /* end if */ else { tmp_bt = bt; - tmp_bt_flags_ptr = &bt_flags; + tmp_bt_flags_ptr = &bt_ud->cache_flags; } /* end else */ /* Insert the child */ - if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0) + if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") } @@ -1064,8 +1087,8 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * If this node split, return the mid key (the one that is shared * by the left and right node). */ - if(twin) { - HDmemcpy(md_key, H5B_NKEY(twin, shared, 0), type->sizeof_nkey); + if(split_bt_ud->bt) { + HDmemcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey); ret_value = H5B_INS_RIGHT; #ifdef H5B_DEBUG /* @@ -1073,7 +1096,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * in the new node. */ cmp = (type->cmp2)(H5B_NKEY(bt, shared, bt->nchildren), udata, - H5B_NKEY(twin, shared, 0)); + H5B_NKEY(split_bt_ud->bt, shared, 0)); HDassert(0 == cmp); #endif } /* end if */ @@ -1081,12 +1104,13 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type ret_value = H5B_INS_NOOP; done: - { - herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0); - herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin, twin_flags) < 0); - if(e1 || e2) /*use vars to prevent short-circuit of side effects */ - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node(s)") - } + if(child_bt_ud.bt) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, child_bt_ud.bt, child_bt_ud.cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect child") + + if(new_child_bt_ud.bt) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, new_child_bt_ud.addr, new_child_bt_ud.bt, new_child_bt_ud.cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect new child") FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 55d9617..23ea9c8 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -177,7 +177,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void H5RC_t *rc_shared; /* Ref-counted shared info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - int i, ncell, cmp; + int ncell, cmp; static int ncalls = 0; herr_t status; herr_t ret_value = SUCCEED; /* Return value */ @@ -210,7 +210,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void HDassert(bt); shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - cur = H5MM_calloc(sizeof(struct child_t)); + cur = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); HDassert(cur); cur->addr = addr; cur->level = bt->level; @@ -242,24 +242,26 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void HDassert(!H5F_addr_defined(bt->left)); if(cur->level > 0) { - for(i = 0; i < bt->nchildren; i++) { + unsigned u; + + for(u = 0; u < bt->nchildren; u++) { /* * Check that child nodes haven't already been seen. If they * have then the tree has a cycle. */ for(tmp = head; tmp; tmp = tmp->next) - HDassert(H5F_addr_ne(tmp->addr, bt->child[i])); + HDassert(H5F_addr_ne(tmp->addr, bt->child[u])); /* Add the child node to the end of the queue */ - tmp = H5MM_calloc(sizeof(struct child_t)); + tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); HDassert(tmp); - tmp->addr = bt->child[i]; + tmp->addr = bt->child[u]; tmp->level = bt->level - 1; tail->next = tmp; tail = tmp; /* Check that the keys are monotonically increasing */ - cmp = (type->cmp2)(H5B_NKEY(bt, shared, i), udata, H5B_NKEY(bt, shared, i + 1)); + cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1)); HDassert(cmp < 0); } /* end for */ } /* end if */ @@ -4392,15 +4392,26 @@ done: herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5C_set_prefix) + herr_t ret_value = SUCCEED; /* Return value */ - HDassert((cache_ptr) && (cache_ptr->magic == H5C__H5C_T_MAGIC)); - HDassert(prefix); - HDassert(HDstrlen(prefix) < H5C__PREFIX_LEN); + FUNC_ENTER_NOAPI(H5C_set_prefix, FAIL) - HDstrcpy(&(cache_ptr->prefix[0]), prefix); + if ( ( cache_ptr == NULL ) || + ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || + ( prefix == NULL ) || + ( HDstrlen(prefix) >= H5C__PREFIX_LEN ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") + } + + HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); + + cache_ptr->prefix[H5C__PREFIX_LEN - 1] = '\0'; + +done: + + FUNC_LEAVE_NOAPI(ret_value) - FUNC_LEAVE_NOAPI(SUCCEED) } /* H5C_set_prefix() */ @@ -5018,6 +5029,137 @@ H5C_stats__reset(H5C_t UNUSED * cache_ptr) /*------------------------------------------------------------------------- + * Function: H5C_dump_cache + * + * Purpose: Print a summary of the contents of the metadata cache for + * debugging purposes. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 10/10/10 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_dump_cache(H5C_t * cache_ptr, + const char * cache_name) +{ + herr_t ret_value = SUCCEED; /* Return value */ + int i; + H5C_cache_entry_t * entry_ptr = NULL; + H5SL_t * slist_ptr = NULL; + H5SL_node_t * node_ptr = NULL; + + FUNC_ENTER_NOAPI(H5C_dump_cache, FAIL) + + HDassert(cache_ptr != NULL); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_name != NULL ); + + /* First, create a skip list */ + slist_ptr = H5SL_create(H5SL_TYPE_HADDR); + + if ( slist_ptr == NULL ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list.") + } + + /* Next, scan the index, and insert all entries in the skip list. + * Do this, as we want to display cache entries in increasing address + * order. + */ + for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ ) { + + entry_ptr = cache_ptr->index[i]; + + while ( entry_ptr != NULL ) { + + HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + + if ( H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "Can't insert entry in skip list") + } + + entry_ptr = entry_ptr->ht_next; + } + } + + /* If we get this far, all entries in the cache are listed in the + * skip list -- scan the skip list generating the desired output. + */ + + HDfprintf(stdout, "\n\nDump of metadata cache \"%s\".\n", cache_name); + HDfprintf(stdout, + "Num: Addr: Len: Type: Prot: Pinned: Dirty:\n"); + + i = 0; + + node_ptr = H5SL_first(slist_ptr); + + if ( node_ptr != NULL ) { + + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + } else { + + entry_ptr = NULL; + } + + while ( entry_ptr != NULL ) { + + HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + + HDfprintf(stdout, + "%s%d 0x%08llx 0x%3llx %2d %d %d %d\n", + cache_ptr->prefix, i, + (long long)(entry_ptr->addr), + (long long)(entry_ptr->size), + (int)(entry_ptr->type->id), + (int)(entry_ptr->is_protected), + (int)(entry_ptr->is_pinned), + (int)(entry_ptr->is_dirty)); + + /* increment node_ptr before we delete its target */ + node_ptr = H5SL_next(node_ptr); + + /* remove the first item in the skip list */ + if ( H5SL_remove(slist_ptr, &(entry_ptr->addr)) != entry_ptr ) { + + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "Can't delete entry from skip list.") + } + + if ( node_ptr != NULL ) { + + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + } else { + + entry_ptr = NULL; + } + + i++; + } + + HDfprintf(stdout, "\n\n"); + + /* Finally, discard the skip list */ + + HDassert( H5SL_count(slist_ptr) == 0 ); + + H5SL_close(slist_ptr); + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_dump_cache() */ + + +/*------------------------------------------------------------------------- * Function: H5C_unpin_entry_from_client() * * Purpose: Internal routine to unpin a cache entry from a client action. @@ -7792,7 +7934,7 @@ end_of_inner_loop: */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Pinned entry count not decreasing.") + "Pinned entry count not decreasing, cur_pel_len = %d, old_pel_len = %d", (int)cur_pel_len, (int)old_pel_len) } else if ( ( cur_pel_len == 0 ) && ( old_pel_len == 0 ) ) { @@ -8713,7 +8855,7 @@ H5C_make_space_in_cache(H5F_t * f, #endif /* H5C_COLLECT_CACHE_STATS */ HDassert( ( entries_examined > (2 * initial_list_len) ) || - ( (cache_ptr->pl_size + cache_ptr->min_clean_size) > + ( (cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) > cache_ptr->max_cache_size ) || ( ( cache_ptr->clean_index_size + empty_space ) >= cache_ptr->min_clean_size ) ); @@ -9132,7 +9274,7 @@ H5C_mark_tagged_entries(H5C_t * cache_ptr, haddr_t tag) H5C_cache_entry_t *next_entry_ptr; /* entry pointer */ unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT(H5C_mark_tagged_entries) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5C_mark_tagged_entries) /* Assertions */ HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 9f10409..0c7631a 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1180,6 +1180,9 @@ H5_DLL herr_t H5C_stats(H5C_t * cache_ptr, H5_DLL void H5C_stats__reset(H5C_t * cache_ptr); +H5_DLL herr_t H5C_dump_cache(H5C_t * cache_ptr, + const char * cache_name); + H5_DLL herr_t H5C_unpin_entry(void *thing); H5_DLL herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing); @@ -256,6 +256,20 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") done: + /* Release the dataset's object header, if it was created */ + if(dset) { + H5O_loc_t *oloc; /* Object location for dataset */ + + /* Get the new dataset's object location */ + if(NULL == (oloc = H5D_oloc(dset))) + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") + + /* Decrement refcount on dataset's object header in memory */ + if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + } /* end if */ + + /* Cleanup on failure */ if(ret_value < 0) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index a2b3a37..06a25b4 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -822,7 +822,7 @@ done: */ static herr_t H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *space, - haddr_t UNUSED dset_ohdr_addr) + haddr_t dset_ohdr_addr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -836,6 +836,8 @@ H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *space HDassert(idx_info->storage); HDassert(H5F_addr_defined(dset_ohdr_addr)); + idx_info->storage->u.btree.dset_ohdr_addr = dset_ohdr_addr; + /* Allocate the shared structure */ if(H5D_btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 910497b..e7a5bf1 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -108,7 +108,7 @@ typedef struct H5D_chunk_it_ud1_t { const H5D_chk_idx_info_t *idx_info; /* Chunked index info */ const H5D_io_info_t *io_info; /* I/O info for dataset operation */ const hsize_t *space_dim; /* New dataset dimensions */ - const hbool_t *shrunk_dim; /* Dimensions which have been shrunk */ + const hbool_t *shrunk_dim; /* Dimensions which have been shrunk */ H5S_t *chunk_space; /* Dataspace for a chunk */ uint32_t elmts_per_chunk;/* Elements in chunk */ hsize_t *hyper_start; /* Starting location of hyperslab */ @@ -649,7 +649,7 @@ H5D_chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info #ifdef H5_HAVE_PARALLEL && !(io_info->using_mpi_vfd) #endif /* H5_HAVE_PARALLEL */ - ) { + && H5S_SEL_ALL != H5S_GET_SELECT_TYPE(file_space)) { /* Initialize skip list for chunk selections */ fm->sel_chunks = NULL; fm->use_single = TRUE; @@ -2253,6 +2253,7 @@ H5D_chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, udata->common.layout = &(dset->shared->layout.u.chunk); udata->common.storage = &(dset->shared->layout.storage.u.chunk); udata->common.offset = chunk_offset; + udata->common.rdcc = &(dset->shared->cache.chunk); /* Reset information about the chunk we are looking for */ udata->nbytes = 0; @@ -2265,7 +2266,8 @@ H5D_chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, ent = dset->shared->cache.chunk.slot[udata->idx_hint]; if(ent) - for(u = 0, found = TRUE; u < dset->shared->layout.u.chunk.ndims; u++) + for(u = 0, found = TRUE; u < dset->shared->layout.u.chunk.ndims - 1; + u++) if(chunk_offset[u] != ent->offset[u]) { found = FALSE; break; @@ -2344,6 +2346,7 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.common.offset = ent->offset; + udata.common.rdcc = &(dset->shared->cache.chunk); udata.filter_mask = 0; udata.nbytes = dset->shared->layout.u.chunk.size; udata.addr = ent->chunk_addr; @@ -3282,7 +3285,7 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, chunk_offset[op_dim] = min_unalloc[op_dim]; carry = FALSE; - } /* end if */ + } /* end else */ while(!carry) { size_t chunk_size = orig_chunk_size; /* Size of chunk in bytes, possibly filtered */ @@ -3360,6 +3363,7 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; udata.common.offset = chunk_offset; + udata.common.rdcc = NULL; H5_ASSIGN_OVERFLOW(udata.nbytes, chunk_size, size_t, uint32_t); udata.filter_mask = filter_mask; udata.addr = HADDR_UNDEF; @@ -3412,9 +3416,9 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end for */ } /* end while(!carry) */ - /* Adjust max_unalloc_dim_idx so we don't allocate the same chunk twice. - * Also check if this dimension started from 0 (and hence allocated all - * of the chunks. */ + /* Adjust max_unalloc so we don't allocate the same chunk twice. Also + * check if this dimension started from 0 (and hence allocated all of + * the chunks. */ if(min_unalloc[op_dim] == 0) break; else @@ -3764,6 +3768,7 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDmemset(&udata, 0, sizeof udata); udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; + udata.common.rdcc = rdcc; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; udata.space_dim = space_dim; @@ -4041,7 +4046,8 @@ H5D_chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) HDmemset(&udata, 0, sizeof(udata)); udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = &dset->shared->layout.storage.u.chunk; - udata.chunk_addr = chunk_addr; + udata.common.rdcc = &(dset->shared->cache.chunk); + udata.chunk_addr = chunk_addr; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -4365,6 +4371,7 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata_dst.common.layout = udata->idx_info_dst->layout; udata_dst.common.storage = udata->idx_info_dst->storage; udata_dst.common.offset = chunk_rec->offset; + udata_dst.common.rdcc = NULL; udata_dst.nbytes = chunk_rec->nbytes; udata_dst.filter_mask = chunk_rec->filter_mask; udata_dst.addr = HADDR_UNDEF; @@ -4608,6 +4615,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, HDmemset(&udata, 0, sizeof udata); udata.common.layout = layout_src; udata.common.storage = storage_src; + udata.common.rdcc = NULL; udata.file_src = f_src; udata.idx_info_dst = &idx_info_dst; udata.buf = buf; diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 9b4f338..9a6e08f 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1301,7 +1301,7 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, void *reclaim_buf = NULL; /* Buffer for reclaiming data */ H5S_t *buf_space = NULL; /* Dataspace describing buffer */ hid_t buf_sid = -1; /* ID for buffer dataspace */ - hsize_t buf_dim; /* Dimension for buffer */ + hsize_t buf_dim[1] = {0}; /* Dimension for buffer */ hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */ hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1382,10 +1382,10 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, buf_size = nelmts * max_dt_size; /* Create dataspace for number of elements in buffer */ - buf_dim = nelmts; + buf_dim[0] = nelmts; /* Create the space and set the initial extent */ - if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) + if(NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Atomize */ @@ -1441,10 +1441,10 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, mem_nbytes = nelmts * mem_dt_size; /* Adjust size of buffer's dataspace dimension */ - buf_dim = nelmts; + buf_dim[0] = nelmts; /* Adjust size of buffer's dataspace */ - if(H5S_set_extent_real(buf_space, &buf_dim) < 0) + if(H5S_set_extent_real(buf_space, buf_dim) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size") } /* end if */ else diff --git a/src/H5Dint.c b/src/H5Dint.c index 4c076f7..947c0fe 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -789,7 +789,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) ohdr_size += layout->storage.u.compact.size; /* Create an object header for the dataset */ - if(H5O_create(file, dxpl_id, ohdr_size, dset->shared->dcpl_id, oloc/*out*/) < 0) + if(H5O_create(file, dxpl_id, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header") HDassert(file == dset->oloc.file); @@ -1063,6 +1063,8 @@ done: if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") if(H5F_addr_defined(new_dset->oloc.addr)) { + if(H5O_dec_rc_by_loc(&(new_dset->oloc), dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") if(H5O_close(&(new_dset->oloc)) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header") if(file) { diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 96acc58..44b44d9 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -253,6 +253,9 @@ typedef struct H5D_chunk_common_ud_t { const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ const hsize_t *offset; /* Logical offset of chunk */ + const struct H5D_rdcc_t *rdcc; /* Chunk cache. Only necessary if the index may + * be modified, and if any chunks in the dset + * may be cached */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -170,13 +170,20 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) -#ifdef H5_USE_16_API +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; - stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; #else /* H5_USE_16_API */ stk->auto_op.vers = 2; - stk->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_USE_16_API */ +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.is_default = TRUE; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1555,6 +1562,11 @@ done: * Programmer: Robb Matzke * Saturday, February 28, 1998 * + * Modification:Raymond Lu + * 4 October 2010 + * If the printing function isn't the default H5Eprint1 or 2, + * and H5Eset_auto1 has been called to set the old style + * printing function, a call to H5Eget_auto2 should fail. *------------------------------------------------------------------------- */ herr_t @@ -1578,8 +1590,15 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) /* Get the automatic error reporting information */ if(H5E_get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto1 */ + if(!op.is_default && op.vers == 1) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called") +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + if(func) - *func = op.u.func2; + *func = op.func2; done: FUNC_LEAVE_API(ret_value) @@ -1606,6 +1625,9 @@ done: * Programmer: Robb Matzke * Friday, February 27, 1998 * + * Modification:Raymond Lu + * 4 October 2010 + * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -1627,9 +1649,23 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* Get the automatic error reporting information */ + if(H5E_get_auto(estack, &op, NULL) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + /* Set the automatic error reporting information */ + if(func != op.func2_default) + op.is_default = FALSE; + else + op.is_default = TRUE; + op.vers = 2; - op.u.func2 = func; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + /* Set the automatic error reporting function */ + op.func2 = func; + if(H5E_set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") @@ -1672,7 +1708,11 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) /* Check if the error stack reporting function is the "newer" stack type */ if(is_stack) +#ifndef H5_NO_DEPRECATED_SYMBOLS *is_stack = estack->auto_op.vers > 1; +#else + *is_stack = 1; +#endif done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 30f3ae9..0a028d9 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -370,6 +370,11 @@ done: * Programmer: Raymond Lu * Sep 16, 2003 * + * Modification:Raymond Lu + * 4 October 2010 + * If the printing function isn't the default H5Eprint1 or 2, + * and H5Eset_auto2 has been called to set the new style + * printing function, a call to H5Eget_auto1 should fail. *------------------------------------------------------------------------- */ herr_t @@ -389,8 +394,13 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data) /* Get the automatic error reporting information */ if(H5E_get_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + + /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */ + if(!auto_op.is_default && auto_op.vers == 2) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto2 has been called") + if(func) - *func = auto_op.u.func1; + *func = auto_op.func1; done: FUNC_LEAVE_API(ret_value) @@ -418,6 +428,9 @@ done: * Programmer: Raymond Lu * Sep 16, 2003 * + * Modification:Raymond Lu + * 4 October 2010 + * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -434,9 +447,18 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + /* Get the automatic error reporting information */ + if(H5E_get_auto(estack, &auto_op, NULL) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + /* Set the automatic error reporting information */ auto_op.vers = 1; - auto_op.u.func1 = func; + if(func != auto_op.func1_default) + auto_op.is_default = FALSE; + else + auto_op.is_default = TRUE; + auto_op.func1 = func; + if(H5E_set_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") diff --git a/src/H5Eint.c b/src/H5Eint.c index 584ba40..f650581 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -1011,18 +1011,20 @@ H5E_dump_api_stack(hbool_t is_api) H5E_t *estack = H5E_get_my_stack(); HDassert(estack); + +#ifdef H5_NO_DEPRECATED_SYMBOLS + if(estack->auto_op.func2) + (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); +#else /* H5_NO_DEPRECATED_SYMBOLS */ if(estack->auto_op.vers == 1) { -#ifndef H5_NO_DEPRECATED_SYMBOLS - if(estack->auto_op.u.func1) - (void)((estack->auto_op.u.func1)(estack->auto_data)); -#else /* H5_NO_DEPRECATED_SYMBOLS */ - HDassert(0 && "version 1 error stack dump without deprecated symbols!"); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + if(estack->auto_op.func1) + (void)((estack->auto_op.func1)(estack->auto_data)); } /* end if */ else { - if(estack->auto_op.u.func2) - (void)((estack->auto_op.u.func2)(H5E_DEFAULT, estack->auto_data)); + if(estack->auto_op.func2) + (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); } /* end else */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ done: diff --git a/src/H5Epkg.h b/src/H5Epkg.h index a85ddc9..9a1163a 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -68,15 +68,20 @@ /****************************/ /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ -typedef struct { - unsigned vers; /* Which version callback to use */ - union { #ifndef H5_NO_DEPRECATED_SYMBOLS - H5E_auto1_t func1; /* Old-style callback, NO error stack param. */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5E_auto2_t func2; /* New-style callback, with error stack param. */ - }u; +typedef struct { + unsigned vers; /* Which version callback to use */ + hbool_t is_default; /* If the printing function is the library's own. */ + H5E_auto1_t func1; /* Old-style callback, NO error stack param. */ + H5E_auto2_t func2; /* New-style callback, with error stack param. */ + H5E_auto1_t func1_default; /* The saved library's default function - old style. */ + H5E_auto2_t func2_default; /* The saved library's default function - new style. */ +} H5E_auto_op_t; +#else /* H5_NO_DEPRECATED_SYMBOLS */ +typedef struct { + H5E_auto_t func2; /* Only the new style callback function is available. */ } H5E_auto_op_t; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ typedef struct { @@ -1048,7 +1048,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) } /* end if */ /* Destroy other components of the file */ - if(H5F_accum_reset(f, dxpl_id) < 0) + if(H5F_accum_reset(f, dxpl_id, TRUE) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 70b33f7..29fd84f 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -120,7 +120,7 @@ typedef struct H5FD_direct_t { # define file_offset_t off64_t # define file_seek lseek64 # define file_truncate ftruncate64 -#elif defined (_WIN32) && !defined(__MWERKS__) +#elif defined (_WIN32) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 diff --git a/src/H5FDlog.c b/src/H5FDlog.c index c21fc92..96df596 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -35,27 +35,18 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5FDlog.h" /* Logging file driver */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#ifdef MAX -#undef MAX -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) -#endif /* MAX */ - /* The driver identification number, initialized at runtime */ static hid_t H5FD_LOG_g = 0; -/* File operations */ -#define OP_UNKNOWN 0 -#define OP_READ 1 -#define OP_WRITE 2 - /* Driver-specific file access properties */ typedef struct H5FD_log_fapl_t { char *logfile; /* Allocated log file name */ - unsigned flags; /* Flags for logging behavior */ + unsigned long long flags; /* Flags for logging behavior */ size_t buf_size; /* Size of buffers for track flavor and number of times each byte is accessed */ } H5FD_log_fapl_t; @@ -88,20 +79,19 @@ typedef struct H5FD_log_t { haddr_t eoa; /*end of allocated region */ haddr_t eof; /*end of file; current file size*/ haddr_t pos; /*current file I/O position */ - int op; /*last operation */ - unsigned char *nread; /* Number of reads from a file location */ - unsigned char *nwrite; /* Number of write to a file location */ - unsigned char *flavor; /* Flavor of information written to file location */ - size_t iosize; /* Size of I/O information buffers */ - FILE *logfp; /* Log file pointer */ - H5FD_log_fapl_t fa; /*driver-specific file access properties*/ + H5FD_file_op_t op; /*last operation */ + char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef _WIN32 /* * On most systems the combination of device and i-node number uniquely * identify a file. */ dev_t device; /*file device number */ +#ifdef H5_VMS + ino_t inode[3]; /*file i-node number */ +#else ino_t inode; /*file i-node number */ +#endif /*H5_VMS*/ #else /* * On _WIN32 the low-order word of a unique identifier associated with the @@ -115,6 +105,25 @@ typedef struct H5FD_log_t { DWORD fileindexlo; DWORD fileindexhi; #endif + + /* Information from properties set by 'h5repart' tool */ + hbool_t fam_to_sec2; /* Whether to eliminate the family driver info + * and convert this file to a single file */ + + /* Fields for tracking I/O operations */ + unsigned char *nread; /* Number of reads from a file location */ + unsigned char *nwrite; /* Number of write to a file location */ + unsigned char *flavor; /* Flavor of information written to file location */ + unsigned long long total_read_ops; /* Total number of read operations */ + unsigned long long total_write_ops; /* Total number of write operations */ + unsigned long long total_seek_ops; /* Total number of seek operations */ + unsigned long long total_truncate_ops; /* Total number of truncate operations */ + double total_read_time; /* Total time spent in read operations */ + double total_write_time; /* Total time spent in write operations */ + double total_seek_time; /* Total time spent in seek operations */ + size_t iosize; /* Size of I/O information buffers */ + FILE *logfp; /* Log file pointer */ + H5FD_log_fapl_t fa; /* Driver-specific file access properties*/ } H5FD_log_t; @@ -123,34 +132,14 @@ typedef struct H5FD_log_t { * some macros here so we don't have to have conditional compilations later * throughout the code. * - * file_offset_t: The datatype for file offsets, the second argument of - * the lseek() or lseek64() call. + * HDoff_t: The datatype for file offsets, the second argument of + * the lseek() or lseek64() call. * - * file_seek: The function which adjusts the current file position, - * either lseek() or lseek64(). */ -/* adding for windows NT file system support. */ - -#ifdef H5_HAVE_LSEEK64 -# define file_offset_t off64_t -# define file_seek lseek64 -#elif defined (_WIN32) -# ifdef __MWERKS__ -# define file_offset_t off_t -# define file_seek lseek -# else /*MSVC*/ -# define file_offset_t __int64 -# define file_seek _lseeki64 -# endif -#else -# define file_offset_t off_t -# define file_seek lseek -#endif - /* * These macros check for overflow of various quantities. These macros - * assume that file_offset_t is signed and haddr_t and size_t are unsigned. + * assume that HDoff_t is signed and haddr_t and size_t are unsigned. * * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' * is too large to be represented by the second argument @@ -163,14 +152,13 @@ typedef struct H5FD_log_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - sizeof(file_offset_t)<sizeof(size_t) || \ HADDR_UNDEF==(A)+(Z) || \ - (file_offset_t)((A)+(Z))<(file_offset_t)(A)) + (HDoff_t)((A)+(Z))<(HDoff_t)(A)) /* Prototypes */ static void *H5FD_log_fapl_get(H5FD_t *file); @@ -192,21 +180,6 @@ static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, const void *buf); static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -#ifdef OLD_WAY -/* - * The free list map which causes each request type to use no free lists - */ -#define H5FD_FLMAP_NOLIST { \ - H5FD_MEM_NOLIST, /*default*/ \ - H5FD_MEM_NOLIST, /*super*/ \ - H5FD_MEM_NOLIST, /*btree*/ \ - H5FD_MEM_NOLIST, /*draw*/ \ - H5FD_MEM_NOLIST, /*gheap*/ \ - H5FD_MEM_NOLIST, /*lheap*/ \ - H5FD_MEM_NOLIST /*ohdr*/ \ -} -#endif /* OLD_WAY */ - static const H5FD_class_t H5FD_log_g = { "log", /*name */ MAXADDR, /*maxaddr */ @@ -241,6 +214,9 @@ static const H5FD_class_t H5FD_log_g = { H5FD_FLMAP_SINGLE /*fl_map */ }; +/* Declare a free list to manage the H5FD_log_t struct */ +H5FL_DEFINE_STATIC(H5FD_log_t); + /*-------------------------------------------------------------------------- NAME @@ -271,32 +247,29 @@ H5FD_log_init_interface(void) * library. * * Return: Success: The driver ID for the log driver. - * * Failure: Negative. * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5FD_log_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_init, FAIL) - if (H5I_VFL!=H5Iget_type(H5FD_LOG_g)) - H5FD_LOG_g = H5FD_register(&H5FD_log_g,sizeof(H5FD_class_t),FALSE); + if(H5I_VFL != H5I_get_type(H5FD_LOG_g)) + H5FD_LOG_g = H5FD_register(&H5FD_log_g, sizeof(H5FD_class_t), FALSE); /* Set return value */ - ret_value=H5FD_LOG_g; + ret_value = H5FD_LOG_g; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_init() */ /*--------------------------------------------------------------------------- @@ -309,8 +282,6 @@ done: * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ void @@ -319,7 +290,7 @@ H5FD_log_term(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_term) /* Reset VFL ID */ - H5FD_LOG_g=0; + H5FD_LOG_g = 0; FUNC_LEAVE_NOAPI_VOID } /* end H5FD_log_term() */ @@ -337,16 +308,10 @@ H5FD_log_term(void) * Programmer: Robb Matzke * Thursday, February 19, 1998 * - * Modifications: - * We copy the LOGFILE value into our own access properties. - * - * Raymond Lu, 2001-10-25 - * Changed the file access list to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned flags, size_t buf_size) +H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size) { H5FD_log_fapl_t fa; /* File access property list information */ H5P_genplist_t *plist; /* Property list pointer */ @@ -355,7 +320,7 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned flags, size_t buf_s FUNC_ENTER_API(H5Pset_fapl_log, FAIL) H5TRACE4("e", "i*sIuz", fapl_id, logfile, flags, buf_size); - if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") fa.logfile = (char *)logfile; @@ -377,28 +342,24 @@ done: * * Return: Success: Ptr to new file access property list with all * members copied from the file struct. - * * Failure: NULL * * Programmer: Quincey Koziol * Thursday, April 20, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * H5FD_log_fapl_get(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t*)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_fapl_get, NULL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_fapl_get) /* Set return value */ - ret_value= H5FD_log_fapl_copy(&(file->fa)); + ret_value = H5FD_log_fapl_copy(&(file->fa)); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_log_fapl_get() */ @@ -423,7 +384,7 @@ H5FD_log_fapl_copy(const void *_old_fa) H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_fapl_copy, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_fapl_copy) HDassert(old_fa); @@ -499,22 +460,29 @@ H5FD_log_fapl_free(void *_fa) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr) +H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - int fd = (-1); H5FD_log_t *file = NULL; - H5FD_log_fapl_t *fa; /* File access property list information */ + H5P_genplist_t *plist; /* Property list */ + H5FD_log_fapl_t *fa; /* File access property list information */ + int fd = (-1); /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef _WIN32 HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - h5_stat_t sb; - H5P_genplist_t *plist; /* Property list */ - H5FD_t *ret_value; +#ifdef H5_HAVE_GETTIMEOFDAY + struct timeval timeval_start; + struct timeval open_timeval_diff; + struct timeval stat_timeval_diff; +#endif /* H5_HAVE_GETTIMEOFDAY */ + h5_stat_t sb; + H5FD_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_open) - FUNC_ENTER_NOAPI(H5FD_log_open, NULL) + /* Sanity check on file offsets */ + HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ if(!name || !*name) @@ -533,22 +501,65 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, if(H5F_ACC_EXCL & flags) o_flags |= O_EXCL; - /* Open the file */ - if((fd = HDopen(name, o_flags, 0666)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - if(HDfstat(fd, &sb) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") - - /* Create the new file struct */ - if(NULL == (file = (H5FD_log_t *)H5MM_calloc(sizeof(H5FD_log_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist); HDassert(fa); +#ifdef H5_HAVE_GETTIMEOFDAY + if(fa->flags & H5FD_LOG_TIME_OPEN) + HDgettimeofday(&timeval_start, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Open the file */ + if((fd = HDopen(name, o_flags, 0666)) < 0) { + int myerrno = errno; + + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags); + } /* end if */ +#ifdef H5_HAVE_GETTIMEOFDAY + if(fa->flags & H5FD_LOG_TIME_OPEN) { + struct timeval timeval_stop; + + HDgettimeofday(&timeval_stop, NULL); + + /* Calculate the elapsed gettimeofday time */ + open_timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + open_timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(open_timeval_diff.tv_usec < 0) { + open_timeval_diff.tv_usec += 1000000; + open_timeval_diff.tv_sec--; + } /* end if */ + } /* end if */ +#endif /* H5_HAVE_GETTIMEOFDAY */ + +#ifdef H5_HAVE_GETTIMEOFDAY + if(fa->flags & H5FD_LOG_TIME_STAT) + HDgettimeofday(&timeval_start, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Get the file stats */ + if(HDfstat(fd, &sb) < 0) + HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") +#ifdef H5_HAVE_GETTIMEOFDAY + if(fa->flags & H5FD_LOG_TIME_STAT) { + struct timeval timeval_stop; + + HDgettimeofday(&timeval_stop, NULL); + + /* Calculate the elapsed gettimeofday time */ + stat_timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + stat_timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(stat_timeval_diff.tv_usec < 0) { + stat_timeval_diff.tv_usec += 1000000; + stat_timeval_diff.tv_sec--; + } /* end if */ + } /* end if */ +#endif /* H5_HAVE_GETTIMEOFDAY */ + + /* Create the new file struct */ + if(NULL == (file = H5FL_CALLOC(H5FD_log_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + file->fd = fd; H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; @@ -558,16 +569,28 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else +#else /* _WIN32 */ file->device = sb.st_dev; +#ifdef H5_VMS + file->inode[0] = sb.st_ino[0]; + file->inode[1] = sb.st_ino[1]; + file->inode[2] = sb.st_ino[2]; +#else file->inode = sb.st_ino; -#endif +#endif /*H5_VMS*/ + +#endif /* _WIN32 */ + + /* Retain a copy of the name used to open the file, for possible error reporting */ + HDstrncpy(file->filename, name, sizeof(file->filename)); + file->filename[sizeof(file->filename) - 1] = '\0'; /* Get the flags for logging */ file->fa.flags = fa->flags; /* Check if we are doing any logging at all */ if(file->fa.flags != 0) { + /* Allocate buffers for tracking file accesses and data "flavor" */ file->iosize = fa->buf_size; if(file->fa.flags & H5FD_LOG_FILE_READ) { file->nread = (unsigned char *)H5MM_calloc(file->iosize); @@ -581,10 +604,32 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, file->flavor = (unsigned char *)H5MM_calloc(file->iosize); HDassert(file->flavor); } /* end if */ + + /* Set the log file pointer */ if(fa->logfile) file->logfp = HDfopen(fa->logfile, "w"); else file->logfp = stderr; + +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_OPEN) + HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0)); + if(file->fa.flags & H5FD_LOG_TIME_STAT) + HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0)); +#endif /* H5_HAVE_GETTIMEOFDAY */ + + } /* end if */ + + /* Check for non-default FAPL */ + if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { + /* This step is for h5repart tool only. If user wants to change file driver from + * family to sec2 while using h5repart, this private property should be set so that + * in the later step, the library can ignore the family driver information saved + * in the superblock. + */ + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") } /* end if */ /* Set return value */ @@ -594,7 +639,8 @@ done: if(NULL == ret_value) { if(fd >= 0) HDclose(fd); - file = (H5FD_log_t *)H5MM_xfree(file); + if(file) + file = H5FL_FREE(H5FD_log_t, file); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -617,24 +663,27 @@ done: static herr_t H5FD_log_close(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t*)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; #ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start,timeval_stop; - struct timeval timeval_diff; + struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_close) - FUNC_ENTER_NOAPI(H5FD_log_close, FAIL) + /* Sanity check */ + HDassert(file); #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags&H5FD_LOG_TIME_CLOSE) - HDgettimeofday(&timeval_start,NULL); + HDgettimeofday(&timeval_start, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ + /* Close the underlying file */ if(HDclose(file->fd) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags&H5FD_LOG_TIME_CLOSE) - HDgettimeofday(&timeval_stop,NULL); + HDgettimeofday(&timeval_stop, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ /* Dump I/O information */ @@ -645,6 +694,8 @@ H5FD_log_close(H5FD_t *_file) #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_CLOSE) { + struct timeval timeval_diff; + /* Calculate the elapsed gettimeofday time */ timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; @@ -656,6 +707,24 @@ H5FD_log_close(H5FD_t *_file) } /* end if */ #endif /* H5_HAVE_GETTIMEOFDAY */ + /* Dump the total number of seek/read/write operations */ + if(file->fa.flags & H5FD_LOG_NUM_READ) + HDfprintf(file->logfp, "Total number of read operations: %llu\n", file->total_read_ops); + if(file->fa.flags & H5FD_LOG_NUM_WRITE) + HDfprintf(file->logfp, "Total number of write operations: %llu\n", file->total_write_ops); + if(file->fa.flags & H5FD_LOG_NUM_SEEK) + HDfprintf(file->logfp, "Total number of seek operations: %llu\n", file->total_seek_ops); + if(file->fa.flags & H5FD_LOG_NUM_TRUNCATE) + HDfprintf(file->logfp, "Total number of truncate operations: %llu\n", file->total_truncate_ops); + + /* Dump the total time in seek/read/write */ + if(file->fa.flags & H5FD_LOG_TIME_READ) + HDfprintf(file->logfp, "Total time in read operations: %f s\n", file->total_read_time); + if(file->fa.flags & H5FD_LOG_TIME_WRITE) + HDfprintf(file->logfp, "Total time in write operations: %f s\n", file->total_write_time); + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDfprintf(file->logfp, "Total time in seek operations: %f s\n", file->total_seek_time); + /* Dump the write I/O information */ if(file->fa.flags & H5FD_LOG_FILE_WRITE) { HDfprintf(file->logfp, "Dumping write I/O information:\n"); @@ -718,7 +787,8 @@ H5FD_log_close(H5FD_t *_file) fclose(file->logfp); } /* end if */ - H5MM_xfree(file); + /* Release the file info */ + file = H5FL_FREE(H5FD_log_t, file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -732,53 +802,56 @@ done: * arbitrary (but consistent) ordering. * * Return: Success: A value like strcmp() - * * Failure: never fails (arguments were checked by the * caller). * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_log_t *f1 = (const H5FD_log_t*)_f1; - const H5FD_log_t *f2 = (const H5FD_log_t*)_f2; - int ret_value=0; + const H5FD_log_t *f1 = (const H5FD_log_t *)_f1; + const H5FD_log_t *f2 = (const H5FD_log_t *)_f2; + int ret_value = 0; - FUNC_ENTER_NOAPI(H5FD_log_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_cmp) #ifdef _WIN32 - if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) - if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) + if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) + if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) - if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1) - if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1) + if(f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1) + if(f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1) #else #ifdef H5_DEV_T_IS_SCALAR - if (f1->device < f2->device) HGOTO_DONE(-1) - if (f1->device > f2->device) HGOTO_DONE(1) + if(f1->device < f2->device) HGOTO_DONE(-1) + if(f1->device > f2->device) HGOTO_DONE(1) #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1) - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1) + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) HGOTO_DONE(-1) + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1) #endif /* H5_DEV_T_IS_SCALAR */ - if (f1->inode < f2->inode) HGOTO_DONE(-1) - if (f1->inode > f2->inode) HGOTO_DONE(1) +#ifndef H5_VMS + if(f1->inode < f2->inode) HGOTO_DONE(-1) + if(f1->inode > f2->inode) HGOTO_DONE(1) +#else + if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1) + if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1) +#endif /*H5_VMS*/ + #endif done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_cmp() */ /*------------------------------------------------------------------------- @@ -788,20 +861,18 @@ done: * (listed in H5FDpublic.h) * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t -H5FD_log_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) +H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) { + const H5FD_log_t *file = (const H5FD_log_t *)_file; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_query) /* Set the VFL feature flags that this driver supports */ @@ -812,6 +883,10 @@ H5FD_log_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* VFD handle is POSIX I/O call compatible */ + + /* Check for flags that are set by h5repart */ + if(file->fam_to_sec2) + *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -824,56 +899,52 @@ H5FD_log_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) * Purpose: Allocate file memory. * * Return: Success: Address of new memory - * * Failure: HADDR_UNDEF * * Programmer: Quincey Koziol * Monday, April 17, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t size) { - H5FD_log_t *file = (H5FD_log_t*)_file; - haddr_t addr; + H5FD_log_t *file = (H5FD_log_t *)_file; + haddr_t addr; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_alloc, HADDR_UNDEF) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_alloc) /* Compute the address for the block to allocate */ addr = file->eoa; /* Check if we need to align this block */ - if(size>=file->pub.threshold) { + if(size >= file->pub.threshold) { /* Check for an already aligned block */ - if(addr%file->pub.alignment!=0) - addr=((addr/file->pub.alignment)+1)*file->pub.alignment; + if(addr % file->pub.alignment != 0) + addr = ((addr / file->pub.alignment) + 1) * file->pub.alignment; } /* end if */ - file->eoa = addr+size; + file->eoa = addr + size; /* Retain the (first) flavor of the information written to the file */ - if(file->fa.flags!=0) { - if(file->fa.flags&H5FD_LOG_FLAVOR) { - assert(addr<file->iosize); - H5_CHECK_OVERFLOW(size,hsize_t,size_t); - HDmemset(&file->flavor[addr],(int)type,(size_t)size); + if(file->fa.flags != 0) { + if(file->fa.flags & H5FD_LOG_FLAVOR) { + HDassert(addr < file->iosize); + H5_CHECK_OVERFLOW(size, hsize_t, size_t); + HDmemset(&file->flavor[addr], (int)type, (size_t)size); } /* end if */ - if(file->fa.flags&H5FD_LOG_ALLOC) - HDfprintf(file->logfp,"%10a-%10a (%10Hu bytes) (%s) Allocated\n",addr,addr+size-1,size,flavors[type]); + if(file->fa.flags & H5FD_LOG_ALLOC) + HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", addr, (addr + size) - 1, size, flavors[type]); } /* end if */ /* Set return value */ - ret_value=addr; + ret_value = addr; -done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_log_alloc() */ +} /* end H5FD_log_alloc() */ /*------------------------------------------------------------------------- @@ -884,33 +955,22 @@ done: * format address space. * * Return: Success: The end-of-address marker. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Monday, August 2, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_log_t *file = (const H5FD_log_t*)_file; - haddr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5FD_log_get_eoa, HADDR_UNDEF) + const H5FD_log_t *file = (const H5FD_log_t *)_file; - /* Set return value */ - ret_value=file->eoa; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_get_eoa) -done: - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(file->eoa) +} /* end H5FD_log_get_eoa() */ /*------------------------------------------------------------------------- @@ -921,32 +981,24 @@ done: * to tell the driver where the end of the HDF5 data is located. * * Return: Success: 0 - * * Failure: -1 * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_log_t *file = (H5FD_log_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; - FUNC_ENTER_NOAPI(H5FD_log_set_eoa, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_set_eoa) file->eoa = addr; -done: - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD_log_set_eoa() */ /*------------------------------------------------------------------------- @@ -959,30 +1011,22 @@ done: * Return: Success: End of file address, the first address past * the end of the "file", either the Unix file * or the HDF5 file. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t H5FD_log_get_eof(const H5FD_t *_file) { - const H5FD_log_t *file = (const H5FD_log_t*)_file; - haddr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5FD_log_get_eof, HADDR_UNDEF) + const H5FD_log_t *file = (const H5FD_log_t *)_file; - /* Set return value */ - ret_value=MAX(file->eof, file->eoa); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_get_eof) -done: - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa)) +} /* end H5FD_log_get_eof() */ /*------------------------------------------------------------------------- @@ -995,18 +1039,16 @@ done: * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ static herr_t -H5FD_log_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +H5FD_log_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void **file_handle) { H5FD_log_t *file = (H5FD_log_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5FD_log_get_handle, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_get_handle) if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -1015,7 +1057,7 @@ H5FD_log_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_get_handle() */ /*------------------------------------------------------------------------- @@ -1027,14 +1069,11 @@ done: * * Return: Success: Zero. Result is stored in caller-supplied * buffer BUF. - * * Failure: -1, Contents of buffer BUF are undefined. * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1042,91 +1081,171 @@ static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - H5FD_log_t *file = (H5FD_log_t*)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; ssize_t nbytes; - herr_t ret_value=SUCCEED; /* Return value */ + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; +#ifdef H5_HAVE_GETTIMEOFDAY + struct timeval timeval_start, timeval_stop; +#endif /* H5_HAVE_GETTIMEOFDAY */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_read, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_read) - assert(file && file->pub.cls); - assert(buf); + HDassert(file && file->pub.cls); + HDassert(buf); /* Check for overflow conditions */ - if (HADDR_UNDEF==addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") - if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") + if(!H5F_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if(REGION_OVERFLOW(addr, size)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) if((addr + size) > file->eoa) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) /* Log the I/O information about the read */ - if(file->fa.flags!=0) { - size_t tmp_size=size; - haddr_t tmp_addr=addr; + if(file->fa.flags != 0) { + size_t tmp_size = size; + haddr_t tmp_addr = addr; /* Log information about the number of times these locations are read */ - if(file->fa.flags&H5FD_LOG_FILE_READ) { - assert((addr+size)<file->iosize); - while(tmp_size-->0) + if(file->fa.flags & H5FD_LOG_FILE_READ) { + HDassert((addr + size) < file->iosize); + while(tmp_size-- > 0) file->nread[tmp_addr++]++; } /* end if */ + } /* end if */ - /* Log information about the seek, if it's going to occur */ - if(file->fa.flags&H5FD_LOG_LOC_SEEK) { - if(addr!=file->pos || OP_READ!=file->op) - HDfprintf(file->logfp,"Seek: From %10a To %10a\n",file->pos,addr); - } /* end if */ + /* Seek to the correct location */ + if(addr != file->pos || OP_READ != file->op) { +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDgettimeofday(&timeval_start, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDgettimeofday(&timeval_stop, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + + /* Log information about the seek */ + if(file->fa.flags & H5FD_LOG_NUM_SEEK) + file->total_seek_ops++; + if(file->fa.flags & H5FD_LOG_LOC_SEEK) { + HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + struct timeval timeval_diff; + double time_diff; + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(timeval_diff.tv_usec < 0) { + timeval_diff.tv_usec += 1000000; + timeval_diff.tv_sec--; + } /* end if */ + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + HDfprintf(file->logfp, " (%f s)\n", time_diff); - /* Log information about the read */ - if(file->fa.flags&H5FD_LOG_LOC_READ) { - HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) (%s) Read\n",addr,addr+size-1,size,flavors[type]); -/* XXX: Verify the flavor information, if we have it? */ + /* Add to total seek time */ + file->total_seek_time += time_diff; + } /* end if */ + else + HDfprintf(file->logfp, "\n"); +#else /* H5_HAVE_GETTIMEOFDAY */ + HDfprintf(file->logfp, "\n"); +#endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ } /* end if */ - /* Seek to the correct location */ - if ((addr!=file->pos || OP_READ!=file->op) && - file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) { - file->pos = HADDR_UNDEF; - file->op = OP_UNKNOWN; - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } - /* * Read data, being careful of interrupted system calls, partial results, * and the end of the file. */ - while (size>0) { +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_READ) + HDgettimeofday(&timeval_start, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + while(size > 0) { do { nbytes = HDread(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) { - /* error */ - file->pos = HADDR_UNDEF; - file->op = OP_UNKNOWN; - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - } - if (0==nbytes) { + } while(-1 == nbytes && EINTR == errno); + if(-1 == nbytes) { /* error */ + int myerrno = errno; + time_t mytime = HDtime(NULL); + HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + if(file->fa.flags & H5FD_LOG_LOC_READ) + HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); + + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + } /* end if */ + if(0 == nbytes) { /* end of file but not end of format address space */ HDmemset(buf, 0, size); - size = 0; - } - assert(nbytes>=0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + break; + } /* end if */ + HDassert(nbytes >= 0); + HDassert((size_t)nbytes <= size); + H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); addr += (haddr_t)nbytes; - buf = (char*)buf + nbytes; - } + buf = (char *)buf + nbytes; + } /* end while */ +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_READ) + HDgettimeofday(&timeval_stop, NULL); +#endif /* H5_HAVE_GETTIMEOFDAY */ + + /* Log information about the read */ + if(file->fa.flags & H5FD_LOG_NUM_READ) + file->total_read_ops++; + if(file->fa.flags & H5FD_LOG_LOC_READ) { + HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); + + /* XXX: Verify the flavor information, if we have it? */ + +#ifdef H5_HAVE_GETTIMEOFDAY + if(file->fa.flags & H5FD_LOG_TIME_READ) { + struct timeval timeval_diff; + double time_diff; + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(timeval_diff.tv_usec < 0) { + timeval_diff.tv_usec += 1000000; + timeval_diff.tv_sec--; + } /* end if */ + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + HDfprintf(file->logfp, " (%f s)\n", time_diff); + + /* Add to total read time */ + file->total_read_time += time_diff; + } /* end if */ + else + HDfprintf(file->logfp, "\n"); +#else /* H5_HAVE_GETTIMEOFDAY */ + HDfprintf(file->logfp, "\n"); +#endif /* H5_HAVE_GETTIMEOFDAY */ + } /* end if */ /* Update current position */ file->pos = addr; file->op = OP_READ; done: + if(ret_value < 0) { + /* Reset last file I/O information */ + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_read() */ /*------------------------------------------------------------------------- @@ -1137,14 +1256,11 @@ done: * DXPL_ID. * * Return: Success: Zero - * * Failure: -1 * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1152,80 +1268,86 @@ static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_log_t *file = (H5FD_log_t*)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; ssize_t nbytes; - size_t orig_size=size; /* Save the original size for later */ - haddr_t orig_addr=addr; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; #ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start,timeval_stop; - struct timeval timeval_diff; + struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_log_write, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_write) - assert(file && file->pub.cls); - assert(size>0); - assert(buf); + HDassert(file && file->pub.cls); + HDassert(size > 0); + HDassert(buf); /* Verify that we are writing out the type of data we allocated in this location */ if(file->flavor) { - assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[addr] || (H5FD_mem_t)file->flavor[addr]==H5FD_MEM_DEFAULT); - assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[(addr+size)-1] || (H5FD_mem_t)file->flavor[(addr+size)-1]==H5FD_MEM_DEFAULT); + HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] || (H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT); + HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] || (H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT); } /* end if */ /* Check for overflow conditions */ - if (HADDR_UNDEF==addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") - if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") + if(!H5F_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if(REGION_OVERFLOW(addr, size)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", (unsigned long long)addr, (unsigned long long)size) + if((addr + size) > file->eoa) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)addr, (unsigned long long)size, (unsigned long long)file->eoa) /* Log the I/O information about the write */ - if(file->fa.flags&H5FD_LOG_FILE_WRITE) { - size_t tmp_size=size; - haddr_t tmp_addr=addr; + if(file->fa.flags & H5FD_LOG_FILE_WRITE) { + size_t tmp_size = size; + haddr_t tmp_addr = addr; - assert((addr+size)<file->iosize); - while(tmp_size-->0) + /* Log information about the number of times these locations are read */ + HDassert((addr + size) < file->iosize); + while(tmp_size-- > 0) file->nwrite[tmp_addr++]++; } /* end if */ /* Seek to the correct location */ - if (addr!=file->pos || OP_WRITE!=file->op) { + if(addr != file->pos || OP_WRITE != file->op) { #ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_start,NULL); + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDgettimeofday(&timeval_start, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ - if(file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) { - file->pos = HADDR_UNDEF; - file->op = OP_UNKNOWN; - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") #ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_stop,NULL); + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDgettimeofday(&timeval_stop, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ /* Log information about the seek */ - if(file->fa.flags&H5FD_LOG_LOC_SEEK) { + if(file->fa.flags & H5FD_LOG_NUM_SEEK) + file->total_seek_ops++; + if(file->fa.flags & H5FD_LOG_LOC_SEEK) { + HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); #ifdef H5_HAVE_GETTIMEOFDAY - HDfprintf(file->logfp,"Seek: From %10a To %10a",file->pos,addr); - if(file->fa.flags&H5FD_LOG_TIME_SEEK) { - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec; - timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec; - if(timeval_diff.tv_usec<0) { - timeval_diff.tv_usec+=1000000; - timeval_diff.tv_sec--; - } /* end if */ - HDfprintf(file->logfp," (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)); + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + struct timeval timeval_diff; + double time_diff; + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(timeval_diff.tv_usec < 0) { + timeval_diff.tv_usec += 1000000; + timeval_diff.tv_sec--; + } /* end if */ + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + HDfprintf(file->logfp, " (%f s)\n", time_diff); + + /* Add to total seek time */ + file->total_seek_time += time_diff; } /* end if */ else - HDfprintf(file->logfp,"\n"); + HDfprintf(file->logfp, "\n"); #else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp,"Seek: From %10a To %10a\n",file->pos,addr); + HDfprintf(file->logfp, "\n"); #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ } /* end if */ @@ -1236,70 +1358,87 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add */ #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags&H5FD_LOG_TIME_WRITE) - HDgettimeofday(&timeval_start,NULL); + HDgettimeofday(&timeval_start, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ - while (size>0) { + while(size > 0) { do { nbytes = HDwrite(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) { - /* error */ - file->pos = HADDR_UNDEF; - file->op = OP_UNKNOWN; - if(file->fa.flags&H5FD_LOG_LOC_WRITE) - HDfprintf(file->logfp,"Error! Writing: %10a-%10a (%10Zu bytes)\n",orig_addr,orig_addr+orig_size-1,orig_size); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - } - assert(nbytes>0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + } while(-1 == nbytes && EINTR == errno); + if(-1 == nbytes) { /* error */ + int myerrno = errno; + time_t mytime = HDtime(NULL); + HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + + if(file->fa.flags & H5FD_LOG_LOC_WRITE) + HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); + + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + } /* end if */ + HDassert(nbytes > 0); + HDassert((size_t)nbytes <= size); + H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); addr += (haddr_t)nbytes; - buf = (const char*)buf + nbytes; - } + buf = (const char *)buf + nbytes; + } /* end while */ #ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_WRITE) - HDgettimeofday(&timeval_stop,NULL); + if(file->fa.flags & H5FD_LOG_TIME_WRITE) + HDgettimeofday(&timeval_stop, NULL); #endif /* H5_HAVE_GETTIMEOFDAY */ /* Log information about the write */ - if(file->fa.flags&H5FD_LOG_LOC_WRITE) { - HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) (%s) Written",orig_addr,orig_addr+orig_size-1,orig_size,flavors[type]); + if(file->fa.flags & H5FD_LOG_NUM_WRITE) + file->total_write_ops++; + if(file->fa.flags & H5FD_LOG_LOC_WRITE) { + HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Check if this is the first write into a "default" section, grabbed by the metadata agregation algorithm */ - if(file->fa.flags&H5FD_LOG_FLAVOR) { - if((H5FD_mem_t)file->flavor[orig_addr]==H5FD_MEM_DEFAULT) - HDmemset(&file->flavor[orig_addr],(int)type,orig_size); + if(file->fa.flags & H5FD_LOG_FLAVOR) { + if((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) + HDmemset(&file->flavor[orig_addr], (int)type, orig_size); } /* end if */ #ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_WRITE) { - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec; - timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec; - if(timeval_diff.tv_usec<0) { - timeval_diff.tv_usec+=1000000; - timeval_diff.tv_sec--; - } /* end if */ - HDfprintf(file->logfp," (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)); + if(file->fa.flags & H5FD_LOG_TIME_WRITE) { + struct timeval timeval_diff; + double time_diff; + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; + timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; + if(timeval_diff.tv_usec < 0) { + timeval_diff.tv_usec += 1000000; + timeval_diff.tv_sec--; + } /* end if */ + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + HDfprintf(file->logfp, " (%f s)\n", time_diff); + + /* Add to total write time */ + file->total_write_time += time_diff; } /* end if */ else - HDfprintf(file->logfp,"\n"); + HDfprintf(file->logfp, "\n"); #else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp,"\n"); + HDfprintf(file->logfp, "\n"); #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; - if (file->pos>file->eof) + if(file->pos > file->eof) file->eof = file->pos; done: + if(ret_value < 0) { + /* Reset last file I/O information */ + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_log_write() */ /*------------------------------------------------------------------------- @@ -1318,22 +1457,53 @@ done: */ /* ARGSUSED */ static herr_t -H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing) +H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_log_t *file = (H5FD_log_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FD_log_truncate) + + HDassert(file); + + /* Extend the file to make sure it's large enough */ + if(!H5F_addr_eq(file->eoa, file->eof)) { +#ifdef _WIN32 + HFILE filehandle; /* Windows file handle */ + LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ + + /* Map the posix file handle to a Windows file handle */ + filehandle = _get_osfhandle(file->fd); + + /* Translate 64-bit integers into form Windows wants */ + /* [This algorithm is from the Windows documentation for SetFilePointer()] */ + li.QuadPart = (LONGLONG)file->eoa; + (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); + if(SetEndOfFile((HANDLE)filehandle) == 0) + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") +#else /* _WIN32 */ +#ifdef H5_VMS + /* Reset seek offset to the beginning of the file, so that the file isn't + * re-extended later. This may happen on Open VMS. */ + if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET)) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") +#endif - FUNC_ENTER_NOAPI(H5FD_log_truncate, FAIL) + if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") +#endif /* _WIN32 */ - if(file->eoa>file->eof) { - if(-1 == file_seek(file->fd, (file_offset_t)(file->eoa - 1), SEEK_SET)) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - if(HDwrite(file->fd, "", (size_t)1) != 1) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + /* Log information about the truncate */ + if(file->fa.flags & H5FD_LOG_NUM_TRUNCATE) + file->total_truncate_ops++; + + /* Update the eof value */ file->eof = file->eoa; - file->pos = file->eoa; - file->op = OP_WRITE; - } + + /* Reset last file I/O information */ + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDlog.h b/src/H5FDlog.h index e829016..bd1bbe2 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -28,30 +28,32 @@ /* Flags for H5Pset_fapl_log() */ /* Flags for tracking where reads/writes/seeks occur */ -#define H5FD_LOG_LOC_READ 0x0001 -#define H5FD_LOG_LOC_WRITE 0x0002 -#define H5FD_LOG_LOC_SEEK 0x0004 +#define H5FD_LOG_LOC_READ 0x00000001 +#define H5FD_LOG_LOC_WRITE 0x00000002 +#define H5FD_LOG_LOC_SEEK 0x00000004 #define H5FD_LOG_LOC_IO (H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE|H5FD_LOG_LOC_SEEK) /* Flags for tracking number of times each byte is read/written */ -#define H5FD_LOG_FILE_READ 0x0008 -#define H5FD_LOG_FILE_WRITE 0x0010 +#define H5FD_LOG_FILE_READ 0x00000008 +#define H5FD_LOG_FILE_WRITE 0x00000010 #define H5FD_LOG_FILE_IO (H5FD_LOG_FILE_READ|H5FD_LOG_FILE_WRITE) /* Flag for tracking "flavor" (type) of information stored at each byte */ -#define H5FD_LOG_FLAVOR 0x0020 +#define H5FD_LOG_FLAVOR 0x00000020 /* Flags for tracking total number of reads/writes/seeks */ -#define H5FD_LOG_NUM_READ 0x0040 -#define H5FD_LOG_NUM_WRITE 0x0080 -#define H5FD_LOG_NUM_SEEK 0x0100 -#define H5FD_LOG_NUM_IO (H5FD_LOG_NUM_READ|H5FD_LOG_NUM_WRITE|H5FD_LOG_NUM_SEEK) +#define H5FD_LOG_NUM_READ 0x00000040 +#define H5FD_LOG_NUM_WRITE 0x00000080 +#define H5FD_LOG_NUM_SEEK 0x00000100 +#define H5FD_LOG_NUM_TRUNCATE 0x00000200 +#define H5FD_LOG_NUM_IO (H5FD_LOG_NUM_READ|H5FD_LOG_NUM_WRITE|H5FD_LOG_NUM_SEEK|H5FD_LOG_NUM_TRUNCATE) /* Flags for tracking time spent in open/read/write/seek/close */ -#define H5FD_LOG_TIME_OPEN 0x0200 /* Not implemented yet */ -#define H5FD_LOG_TIME_READ 0x0400 /* Not implemented yet */ -#define H5FD_LOG_TIME_WRITE 0x0800 /* Partially implemented (need to track total time) */ -#define H5FD_LOG_TIME_SEEK 0x1000 /* Partially implemented (need to track total time & track time for seeks during reading) */ -#define H5FD_LOG_TIME_CLOSE 0x2000 /* Fully implemented */ -#define H5FD_LOG_TIME_IO (H5FD_LOG_TIME_OPEN|H5FD_LOG_TIME_READ|H5FD_LOG_TIME_WRITE|H5FD_LOG_TIME_SEEK|H5FD_LOG_TIME_CLOSE) +#define H5FD_LOG_TIME_OPEN 0x00000400 +#define H5FD_LOG_TIME_STAT 0x00000800 +#define H5FD_LOG_TIME_READ 0x00001000 +#define H5FD_LOG_TIME_WRITE 0x00002000 +#define H5FD_LOG_TIME_SEEK 0x00004000 +#define H5FD_LOG_TIME_CLOSE 0x00008000 +#define H5FD_LOG_TIME_IO (H5FD_LOG_TIME_OPEN|H5FD_LOG_TIME_STAT|H5FD_LOG_TIME_READ|H5FD_LOG_TIME_WRITE|H5FD_LOG_TIME_SEEK|H5FD_LOG_TIME_CLOSE) /* Flag for tracking allocation of space in file */ -#define H5FD_LOG_ALLOC 0x4000 +#define H5FD_LOG_ALLOC 0x00010000 #define H5FD_LOG_ALL (H5FD_LOG_ALLOC|H5FD_LOG_TIME_IO|H5FD_LOG_NUM_IO|H5FD_LOG_FLAVOR|H5FD_LOG_FILE_IO|H5FD_LOG_LOC_IO) #ifdef __cplusplus @@ -60,10 +62,11 @@ extern "C" { H5_DLL hid_t H5FD_log_init(void); H5_DLL void H5FD_log_term(void); -H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned flags, size_t buf_size); +H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size); #ifdef __cplusplus } #endif #endif + diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 5bea8fe..7ca38cc 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -138,7 +138,7 @@ typedef struct H5FD_mpiposix_t { # define file_offset_t off64_t # define file_seek lseek64 # define file_truncate ftruncate64 -#elif defined (_WIN32) && !defined(__MWERKS__) +#elif defined (_WIN32) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index cb40e5c..fe770d2 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -31,13 +31,40 @@ */ #include "H5FDmpi.h" /* MPI-based file drivers */ -/* Macros */ + +/**************************/ +/* Library Private Macros */ +/**************************/ + +/* Length of filename buffer */ +#define H5FD_MAX_FILENAME_LEN 1024 + + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* File operations */ +typedef enum { + OP_UNKNOWN = 0, /* Unknown last file operation */ + OP_READ = 1, /* Last file I/O operation was a read */ + OP_WRITE = 2 /* Last file I/O operation was a write */ +} H5FD_file_op_t; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/******************************/ +/* Library Private Prototypes */ +/******************************/ /* Forward declarations for prototype arguments */ struct H5P_genplist_t; struct H5F_t; -/* Prototypes */ H5_DLL int H5FD_term_interface(void); H5_DLL H5FD_class_t *H5FD_get_class(hid_t id); H5_DLL hsize_t H5FD_sb_size(H5FD_t *file); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index d9fa4d9..1153df7 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -42,15 +42,6 @@ /* The driver identification number, initialized at runtime */ static hid_t H5FD_SEC2_g = 0; -/* File operations */ -typedef enum { - OP_UNKNOWN = 0, /* Unknown last file operation */ - OP_READ = 1, /* Last file I/O operation was a read */ - OP_WRITE = 2 /* Last file I/O operation was a write */ -} H5FD_sec2_file_op_t; - -#define H5FD_SEC2_MAX_FILENAME_LEN 1024 - /* * The description of a file belonging to this driver. The `eoa' and `eof' * determine the amount of hdf5 address space in use and the high-water mark @@ -69,8 +60,8 @@ typedef struct H5FD_sec2_t { haddr_t eoa; /*end of allocated region */ haddr_t eof; /*end of file; current file size*/ haddr_t pos; /*current file I/O position */ - H5FD_sec2_file_op_t op; /*last operation */ - char filename[H5FD_SEC2_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ + H5FD_file_op_t op; /*last operation */ + char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef _WIN32 /* * On most systems the combination of device and i-node number uniquely @@ -165,10 +156,10 @@ static const H5FD_class_t H5FD_sec2_g = { 0, /*dxpl_size */ NULL, /*dxpl_copy */ NULL, /*dxpl_free */ - H5FD_sec2_open, /*open */ - H5FD_sec2_close, /*close */ - H5FD_sec2_cmp, /*cmp */ - H5FD_sec2_query, /*query */ + H5FD_sec2_open, /*open */ + H5FD_sec2_close, /*close */ + H5FD_sec2_cmp, /*cmp */ + H5FD_sec2_query, /*query */ NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ @@ -228,7 +219,7 @@ H5FD_sec2_init_interface(void) hid_t H5FD_sec2_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_init, FAIL) @@ -290,14 +281,14 @@ H5Pset_fapl_sec2(hid_t fapl_id) FUNC_ENTER_API(H5Pset_fapl_sec2, FAIL) H5TRACE1("e", "i", fapl_id); - if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value= H5P_set_driver(plist, H5FD_SEC2, NULL); + ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_fapl_sec2() */ /*------------------------------------------------------------------------- @@ -308,22 +299,19 @@ done: * Return: Success: A pointer to a new file data structure. The * public fields will be initialized by the * caller, which is always H5FD_open(). - * * Failure: NULL * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_sec2_t *file = NULL; /* sec2 VFD info */ - int fd = (-1); /* File descriptor */ - int o_flags; /* Flags for open() call */ + int fd = (-1); /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef _WIN32 HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; @@ -331,10 +319,10 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) h5_stat_t sb; H5FD_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_open) /* Sanity check on file offsets */ - HDassert(sizeof(HDoff_t) >= sizeof(size_t)); + HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ if(!name || !*name) @@ -430,7 +418,6 @@ done: * Purpose: Closes a Unix file. * * Return: Success: 0 - * * Failure: -1, file not closed. * * Programmer: Robb Matzke @@ -441,10 +428,10 @@ done: static herr_t H5FD_sec2_close(H5FD_t *_file) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_sec2_close, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_close) /* Sanity check */ HDassert(file); @@ -468,59 +455,56 @@ done: * arbitrary (but consistent) ordering. * * Return: Success: A value like strcmp() - * * Failure: never fails (arguments were checked by the * caller). * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_sec2_t *f1 = (const H5FD_sec2_t*)_f1; - const H5FD_sec2_t *f2 = (const H5FD_sec2_t*)_f2; - int ret_value=0; + const H5FD_sec2_t *f1 = (const H5FD_sec2_t *)_f1; + const H5FD_sec2_t *f2 = (const H5FD_sec2_t *)_f2; + int ret_value = 0; - FUNC_ENTER_NOAPI(H5FD_sec2_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_cmp) #ifdef _WIN32 - if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) - if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) + if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) + if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) - if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1) - if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1) + if(f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1) + if(f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1) #else #ifdef H5_DEV_T_IS_SCALAR - if (f1->device < f2->device) HGOTO_DONE(-1) - if (f1->device > f2->device) HGOTO_DONE(1) + if(f1->device < f2->device) HGOTO_DONE(-1) + if(f1->device > f2->device) HGOTO_DONE(1) #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1) - if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1) + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) HGOTO_DONE(-1) + if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1) #endif /* H5_DEV_T_IS_SCALAR */ #ifndef H5_VMS - if (f1->inode < f2->inode) HGOTO_DONE(-1) - if (f1->inode > f2->inode) HGOTO_DONE(1) + if(f1->inode < f2->inode) HGOTO_DONE(-1) + if(f1->inode > f2->inode) HGOTO_DONE(1) #else - if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))<0) HGOTO_DONE(-1) - if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))>0) HGOTO_DONE(1) + if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1) + if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1) #endif /*H5_VMS*/ #endif done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sec2_cmp() */ /*------------------------------------------------------------------------- @@ -540,7 +524,7 @@ done: static herr_t H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) { - const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; /* sec2 VFD info */ + const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; /* sec2 VFD info */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_query) @@ -570,32 +554,21 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) * format address space. * * Return: Success: The end-of-address marker. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Monday, August 2, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; - haddr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF) + const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - /* Set return value */ - ret_value = file->eoa; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_get_eoa) -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(file->eoa) } /* end H5FD_sec2_get_eoa() */ @@ -607,31 +580,23 @@ done: * to tell the driver where the end of the HDF5 data is located. * * Return: Success: 0 - * * Failure: -1 * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI(H5FD_sec2_set_eoa, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_set_eoa) file->eoa = addr; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_sec2_set_eoa() */ @@ -645,30 +610,22 @@ done: * Return: Success: End of file address, the first address past * the end of the "file", either the Unix file * or the HDF5 file. - * * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file) { - const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; - haddr_t ret_value; /* Return value */ + const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI(H5FD_sec2_get_eof, HADDR_UNDEF) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_get_eof) - /* Set return value */ - ret_value=MAX(file->eof, file->eoa); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa)) +} /* end H5FD_sec2_get_eof() */ /*------------------------------------------------------------------------- @@ -690,10 +647,11 @@ H5FD_sec2_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void **file_handle) H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5FD_sec2_get_handle, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_get_handle) if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + *file_handle = &(file->fd); done: @@ -722,11 +680,11 @@ static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; ssize_t nbytes; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_sec2_read, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_read) HDassert(file && file->pub.cls); HDassert(buf); @@ -740,9 +698,10 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) /* Seek to the correct location */ - if((addr != file->pos || OP_READ != file->op) && - HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + if(addr != file->pos || OP_READ != file->op) { + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + } /* end if */ /* * Read data, being careful of interrupted system calls, partial results, @@ -808,11 +767,11 @@ static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; ssize_t nbytes; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_sec2_write, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_write) HDassert(file && file->pub.cls); HDassert(buf); @@ -826,9 +785,10 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)addr, (unsigned long long)size, (unsigned long long)file->eoa) /* Seek to the correct location */ - if((addr != file->pos || OP_WRITE != file->op) && - HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + if(addr != file->pos || OP_WRITE != file->op) { + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + } /* end if */ /* * Write the data, being careful of interrupted system calls and partial @@ -878,7 +838,6 @@ done: * than the end-of-address. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Robb Matzke @@ -890,10 +849,10 @@ done: static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_sec2_truncate, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5FD_sec2_truncate) HDassert(file); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 20fa31f..9bc4161 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -130,14 +130,8 @@ typedef struct H5FD_stdio_t { /* Use file_xxx to indicate these are local macros, avoiding confusing * with the global HD_xxx macros. - * Need fseeko, off_t, ftell and ftruncate are all of the same 32 or 64 - * versions. * Assume fseeko, which is POSIX standard, is always supported; * but prefer to use fseeko64 if supported. - * [Note: the ifndef H5_HAVE_FSEEKO condition to determine BIG FILE not - * supported was old code. This condition is not supposed to be true in Unix - * like systems but may happen in non-Unix systems like Windows. They are left - * in for now and will be cleaned later. -AKC-] */ #ifndef file_fseek #ifdef H5_HAVE_FSEEKO64 @@ -175,11 +169,6 @@ typedef struct H5FD_stdio_t { #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A)) -#ifndef H5_HAVE_FSEEKO -/* Define big file as 2GB */ -#define BIG_FILE 0x80000000UL -#endif - /* Prototypes */ static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); @@ -587,9 +576,6 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; haddr_t addr; -#ifndef H5_HAVE_FSEEKO - static const char *func = "H5FD_stdio_alloc"; /* Function Name for error reporting */ -#endif haddr_t ret_value; /* Return value */ /* Shut compiler up */ @@ -609,12 +595,6 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp addr = ((addr / file->pub.alignment) + 1) * file->pub.alignment; } /* end if */ -#ifndef H5_HAVE_FSEEKO - /* If fseeko isn't available, big files (>2GB) won't be supported. */ - if((addr + size) > BIG_FILE) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "can't write file bigger than 2GB because fseeko isn't available", HADDR_UNDEF) -#endif - file->eoa = addr + size; /* Set return value */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 17f8f6a..d1c8a2a 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -555,7 +555,7 @@ H5FS_cache_hdr_size(const H5F_t UNUSED *f, const H5FS_t *fspace, size_t *size_pt *------------------------------------------------------------------------- */ static H5FS_sinfo_t * -H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) +H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) { H5FS_sinfo_t *sinfo = NULL; /* Free space section info */ H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 2fc53ea..c89ff33 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -111,11 +111,11 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); * *------------------------------------------------------------------------- */ -htri_t +herr_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { - htri_t ret_value = FALSE; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_accum_read, FAIL) @@ -124,90 +124,135 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(buf); /* Check if this information is in the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW - && size < H5F_ACCUM_MAX_SIZE) { - /* Sanity check */ - HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); - - /* Current read adjoins or overlaps with metadata accumulator */ - if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size) - || ((addr + size) == f->shared->accum.loc) - || (f->shared->accum.loc + f->shared->accum.size) == addr) { - size_t amount_before; /* Amount to read before current accumulator */ - haddr_t new_addr; /* New address of the accumulator buffer */ - size_t new_size; /* New size of the accumulator buffer */ - - /* Compute new values for accumulator */ - new_addr = MIN(addr, f->shared->accum.loc); - new_size = (size_t)(MAX((addr + size), (f->shared->accum.loc + f->shared->accum.size)) - - new_addr); - - /* Check if we need more buffer space */ - if(new_size > f->shared->accum.alloc_size) { - size_t new_alloc_size; /* New size of accumulator */ - - /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(new_size - 1))); - - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") - - /* Note the new buffer size */ - f->shared->accum.alloc_size = new_alloc_size; + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if(size < H5F_ACCUM_MAX_SIZE) { + /* Sanity check */ + HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); + + /* Current read adjoins or overlaps with metadata accumulator */ + if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size) + || ((addr + size) == f->shared->accum.loc) + || (f->shared->accum.loc + f->shared->accum.size) == addr) { + size_t amount_before; /* Amount to read before current accumulator */ + haddr_t new_addr; /* New address of the accumulator buffer */ + size_t new_size; /* New size of the accumulator buffer */ + + /* Compute new values for accumulator */ + new_addr = MIN(addr, f->shared->accum.loc); + new_size = (size_t)(MAX((addr + size), (f->shared->accum.loc + f->shared->accum.size)) + - new_addr); + + /* Check if we need more buffer space */ + if(new_size > f->shared->accum.alloc_size) { + size_t new_alloc_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(new_size - 1))); + + /* Reallocate the metadata accumulator buffer */ + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") + + /* Note the new buffer size */ + f->shared->accum.alloc_size = new_alloc_size; #ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size)); + HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size)); #endif /* H5_CLEAR_MEMORY */ - } /* end if */ + } /* end if */ - /* Read the part before the metadata accumulator */ - if(addr < f->shared->accum.loc) { - /* Set the amount to read */ - H5_ASSIGN_OVERFLOW(amount_before, (f->shared->accum.loc - addr), hsize_t, size_t); + /* Read the part before the metadata accumulator */ + if(addr < f->shared->accum.loc) { + /* Set the amount to read */ + H5_ASSIGN_OVERFLOW(amount_before, (f->shared->accum.loc - addr), hsize_t, size_t); - /* Make room for the metadata to read in */ - HDmemmove(f->shared->accum.buf + amount_before, f->shared->accum.buf, f->shared->accum.size); + /* Make room for the metadata to read in */ + HDmemmove(f->shared->accum.buf + amount_before, f->shared->accum.buf, f->shared->accum.size); - /* Adjust dirty region tracking info, if present */ - if(f->shared->accum.dirty) - f->shared->accum.dirty_off += amount_before; + /* Adjust dirty region tracking info, if present */ + if(f->shared->accum.dirty) + f->shared->accum.dirty_off += amount_before; - /* Dispatch to driver */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_before, f->shared->accum.buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") - } /* end if */ - else - amount_before = 0; + /* Dispatch to driver */ + if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_before, f->shared->accum.buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + } /* end if */ + else + amount_before = 0; - /* Read the part after the metadata accumulator */ - if((addr + size) > (f->shared->accum.loc + f->shared->accum.size)) { - size_t amount_after; /* Amount to read at a time */ + /* Read the part after the metadata accumulator */ + if((addr + size) > (f->shared->accum.loc + f->shared->accum.size)) { + size_t amount_after; /* Amount to read at a time */ - /* Set the amount to read */ - H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (f->shared->accum.loc + f->shared->accum.size)), hsize_t, size_t); + /* Set the amount to read */ + H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (f->shared->accum.loc + f->shared->accum.size)), hsize_t, size_t); - /* Dispatch to driver */ - if(H5FD_read(f->shared->lf, dxpl_id, type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") - } /* end if */ + /* Dispatch to driver */ + if(H5FD_read(f->shared->lf, dxpl_id, type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + } /* end if */ - /* Copy the data out of the buffer */ - HDmemcpy(buf, f->shared->accum.buf + (addr - new_addr), size); + /* Copy the data out of the buffer */ + HDmemcpy(buf, f->shared->accum.buf + (addr - new_addr), size); - /* Adjust the accumulator address & size */ - f->shared->accum.loc = new_addr; - f->shared->accum.size = new_size; + /* Adjust the accumulator address & size */ + f->shared->accum.loc = new_addr; + f->shared->accum.size = new_size; + } /* end if */ + /* Current read doesn't overlap with metadata accumulator, read it from file */ + else { + /* Dispatch to driver */ + if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + } /* end else */ } /* end if */ - /* Current read doesn't overlap with metadata accumulator, read it from file */ else { - /* Dispatch to driver */ + /* Read the data */ if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") - } /* end else */ - /* Indicate success */ - HGOTO_DONE(TRUE); + /* Check for overlap w/dirty accumulator */ + /* (Note that this could be improved by updating the non-dirty + * information in the accumulator with [some of] the information + * just read in. -QAK) + */ + if(f->shared->accum.dirty && + H5F_addr_overlap(addr, size, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len)) { + haddr_t dirty_loc = f->shared->accum.loc + f->shared->accum.dirty_off; /* File offset of dirty information */ + size_t buf_off; /* Offset of dirty region in buffer */ + size_t dirty_off; /* Offset within dirty region */ + size_t overlap_size; /* Size of overlap with dirty region */ + + /* Check for read starting before beginning dirty region */ + if(H5F_addr_le(addr, dirty_loc)) { + /* Compute offset of dirty region within buffer */ + buf_off = (size_t)(dirty_loc - addr); + + /* Compute offset within dirty region */ + dirty_off = 0; + + /* Check for read ending within dirty region */ + if(H5F_addr_lt(addr + size, dirty_loc + f->shared->accum.dirty_len)) + overlap_size = (size_t)((addr + size) - buf_off); + else /* Access covers whole dirty region */ + overlap_size = f->shared->accum.dirty_len; + } /* end if */ + else { /* Read starts after beginning of dirty region */ + /* Compute dirty offset within buffer and overlap size */ + buf_off = 0; + dirty_off = (size_t)(addr - dirty_loc); + overlap_size = (size_t)((dirty_loc + f->shared->accum.dirty_len) - addr); + } /* end else */ + + /* Copy the dirty region to buffer */ + HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)f->shared->accum.buf + f->shared->accum.dirty_off + dirty_off, overlap_size); + } /* end if */ + } /* end else */ } /* end if */ + else { + /* Read the data */ + if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -312,12 +357,6 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, accum->dirty = FALSE; } /* end if */ - /* Move remnant of accumulator down */ - HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); - - /* Adjust accumulator's location */ - accum->loc += shrink_size; - /* Adjust dirty region tracking info */ accum->dirty_off -= shrink_size; } /* end else */ @@ -325,6 +364,15 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, /* Trim the accumulator's use of its buffer */ accum->size = remnant_size; + + /* When appending, need to adjust location of accumulator */ + if(H5F_ACCUM_APPEND == adjust) { + /* Move remnant of accumulator down */ + HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); + + /* Adjust accumulator's location */ + accum->loc += shrink_size; + } /* end if */ } /* end if */ /* Check for accumulator needing to be reallocated */ @@ -352,8 +400,8 @@ done: /*------------------------------------------------------------------------- * Function: H5F_accum_write * - * Purpose: Attempts to read some data from the metadata accumulator for - * a file into a buffer. + * Purpose: Attempts to write some data to the metadata accumulator for + * a file from a buffer. * * Return: Non-negative on success/Negative on failure * @@ -363,11 +411,11 @@ done: * *------------------------------------------------------------------------- */ -htri_t +herr_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { - htri_t ret_value = FALSE; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_accum_write, FAIL) @@ -377,248 +425,284 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, HDassert(buf); /* Check for accumulating metadata */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW - && size < H5F_ACCUM_MAX_SIZE) { - /* Sanity check */ - HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); - - /* Check if there is already metadata in the accumulator */ - if(f->shared->accum.size > 0) { - /* Check if the new metadata adjoins the beginning of the current accumulator */ - if((addr + size) == f->shared->accum.loc) { - /* Check if we need to adjust accumulator size */ - if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") - - /* Move the existing metadata to the proper location */ - HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf, f->shared->accum.size); - - /* Copy the new metadata at the front */ - HDmemcpy(f->shared->accum.buf, buf, size); - - /* Set the new size & location of the metadata accumulator */ - f->shared->accum.loc = addr; - f->shared->accum.size += size; - - /* Adjust the dirty region and mark accumulator dirty */ - if(f->shared->accum.dirty) - f->shared->accum.dirty_len = size + f->shared->accum.dirty_off - + f->shared->accum.dirty_len; - else { - f->shared->accum.dirty_len = size; - f->shared->accum.dirty = TRUE; - } /* end else */ - f->shared->accum.dirty_off = 0; - } /* end if */ - /* Check if the new metadata adjoins the end of the current accumulator */ - else if(addr == (f->shared->accum.loc + f->shared->accum.size)) { - /* Check if we need to adjust accumulator size */ - if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW) { + if(size < H5F_ACCUM_MAX_SIZE) { + /* Sanity check */ + HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size)); + + /* Check if there is already metadata in the accumulator */ + if(f->shared->accum.size > 0) { + /* Check if the new metadata adjoins the beginning of the current accumulator */ + if((addr + size) == f->shared->accum.loc) { + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") - /* Copy the new metadata to the end */ - HDmemcpy(f->shared->accum.buf + f->shared->accum.size, buf, size); + /* Move the existing metadata to the proper location */ + HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf, f->shared->accum.size); - /* Adjust the dirty region and mark accumulator dirty */ - if(f->shared->accum.dirty) - f->shared->accum.dirty_len = size + (f->shared->accum.size - - f->shared->accum.dirty_off); - else { - f->shared->accum.dirty_off = f->shared->accum.size; - f->shared->accum.dirty_len = size; - f->shared->accum.dirty = TRUE; - } /* end else */ + /* Copy the new metadata at the front */ + HDmemcpy(f->shared->accum.buf, buf, size); - /* Set the new size of the metadata accumulator */ - f->shared->accum.size += size; - } /* end if */ - /* Check if the piece of metadata being written overlaps the metadata accumulator */ - else if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) { - size_t add_size; /* New size of the accumulator buffer */ + /* Set the new size & location of the metadata accumulator */ + f->shared->accum.loc = addr; + f->shared->accum.size += size; - /* Check if the new metadata is entirely within the current accumulator */ - if(addr >= f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { - size_t dirty_off = (size_t)(addr - f->shared->accum.loc); + /* Adjust the dirty region and mark accumulator dirty */ + if(f->shared->accum.dirty) + f->shared->accum.dirty_len = size + f->shared->accum.dirty_off + + f->shared->accum.dirty_len; + else { + f->shared->accum.dirty_len = size; + f->shared->accum.dirty = TRUE; + } /* end else */ + f->shared->accum.dirty_off = 0; + } /* end if */ + /* Check if the new metadata adjoins the end of the current accumulator */ + else if(addr == (f->shared->accum.loc + f->shared->accum.size)) { + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") - /* Copy the new metadata to the proper location within the accumulator */ - HDmemcpy(f->shared->accum.buf + dirty_off, buf, size); + /* Copy the new metadata to the end */ + HDmemcpy(f->shared->accum.buf + f->shared->accum.size, buf, size); /* Adjust the dirty region and mark accumulator dirty */ - if(f->shared->accum.dirty) { - /* Check for new metadata starting before current dirty region */ - if(dirty_off <= f->shared->accum.dirty_off) { - if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) - f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - dirty_off; - else - f->shared->accum.dirty_len = size; - f->shared->accum.dirty_off = dirty_off; - } /* end if */ - else { - if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) - ; /* f->shared->accum.dirty_len doesn't change */ - else - f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off; - } /* end else */ - } /* end if */ + if(f->shared->accum.dirty) + f->shared->accum.dirty_len = size + (f->shared->accum.size - + f->shared->accum.dirty_off); else { - f->shared->accum.dirty_off = dirty_off; + f->shared->accum.dirty_off = f->shared->accum.size; f->shared->accum.dirty_len = size; f->shared->accum.dirty = TRUE; } /* end else */ + + /* Set the new size of the metadata accumulator */ + f->shared->accum.size += size; } /* end if */ - /* Check if the new metadata overlaps the beginning of the current accumulator */ - else if(addr < f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { - size_t old_offset; /* Offset of old data within the accumulator buffer */ + /* Check if the piece of metadata being written overlaps the metadata accumulator */ + else if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) { + size_t add_size; /* New size of the accumulator buffer */ + + /* Check if the new metadata is entirely within the current accumulator */ + if(addr >= f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { + size_t dirty_off = (size_t)(addr - f->shared->accum.loc); + + /* Copy the new metadata to the proper location within the accumulator */ + HDmemcpy(f->shared->accum.buf + dirty_off, buf, size); + + /* Adjust the dirty region and mark accumulator dirty */ + if(f->shared->accum.dirty) { + /* Check for new metadata starting before current dirty region */ + if(dirty_off <= f->shared->accum.dirty_off) { + if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) + f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - dirty_off; + else + f->shared->accum.dirty_len = size; + f->shared->accum.dirty_off = dirty_off; + } /* end if */ + else { + if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) + ; /* f->shared->accum.dirty_len doesn't change */ + else + f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off; + } /* end else */ + } /* end if */ + else { + f->shared->accum.dirty_off = dirty_off; + f->shared->accum.dirty_len = size; + f->shared->accum.dirty = TRUE; + } /* end else */ + } /* end if */ + /* Check if the new metadata overlaps the beginning of the current accumulator */ + else if(addr < f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) { + size_t old_offset; /* Offset of old data within the accumulator buffer */ - /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ - H5_ASSIGN_OVERFLOW(add_size, (f->shared->accum.loc - addr), hsize_t, size_t); + /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ + H5_ASSIGN_OVERFLOW(add_size, (f->shared->accum.loc - addr), hsize_t, size_t); - /* Check if we need to adjust accumulator size */ - if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, add_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_PREPEND, add_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") - /* Calculate the proper offset of the existing metadata */ - H5_ASSIGN_OVERFLOW(old_offset, (addr + size) - f->shared->accum.loc, hsize_t, size_t); + /* Calculate the proper offset of the existing metadata */ + H5_ASSIGN_OVERFLOW(old_offset, (addr + size) - f->shared->accum.loc, hsize_t, size_t); - /* Move the existing metadata to the proper location */ - HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf + old_offset, (f->shared->accum.size - old_offset)); + /* Move the existing metadata to the proper location */ + HDmemmove(f->shared->accum.buf + size, f->shared->accum.buf + old_offset, (f->shared->accum.size - old_offset)); - /* Copy the new metadata at the front */ - HDmemcpy(f->shared->accum.buf, buf, size); + /* Copy the new metadata at the front */ + HDmemcpy(f->shared->accum.buf, buf, size); - /* Set the new size & location of the metadata accumulator */ - f->shared->accum.loc = addr; - f->shared->accum.size += add_size; + /* Set the new size & location of the metadata accumulator */ + f->shared->accum.loc = addr; + f->shared->accum.size += add_size; - /* Adjust the dirty region and mark accumulator dirty */ - if(f->shared->accum.dirty) { - size_t curr_dirty_end = add_size + f->shared->accum.dirty_off + f->shared->accum.dirty_len; + /* Adjust the dirty region and mark accumulator dirty */ + if(f->shared->accum.dirty) { + size_t curr_dirty_end = add_size + f->shared->accum.dirty_off + f->shared->accum.dirty_len; - f->shared->accum.dirty_off = 0; - if(size <= curr_dirty_end) - f->shared->accum.dirty_len = curr_dirty_end; - else + f->shared->accum.dirty_off = 0; + if(size <= curr_dirty_end) + f->shared->accum.dirty_len = curr_dirty_end; + else + f->shared->accum.dirty_len = size; + } /* end if */ + else { + f->shared->accum.dirty_off = 0; f->shared->accum.dirty_len = size; + f->shared->accum.dirty = TRUE; + } /* end else */ } /* end if */ - else { - f->shared->accum.dirty_off = 0; - f->shared->accum.dirty_len = size; - f->shared->accum.dirty = TRUE; - } /* end else */ - } /* end if */ - /* Check if the new metadata overlaps the end of the current accumulator */ - else if(addr >= f->shared->accum.loc && (addr + size) > (f->shared->accum.loc + f->shared->accum.size)) { - size_t dirty_off = (size_t)(addr - f->shared->accum.loc); + /* Check if the new metadata overlaps the end of the current accumulator */ + else if(addr >= f->shared->accum.loc && (addr + size) > (f->shared->accum.loc + f->shared->accum.size)) { + size_t dirty_off; /* Offset of dirty region */ - /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ - H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (f->shared->accum.loc + f->shared->accum.size), hsize_t, size_t); + /* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */ + H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (f->shared->accum.loc + f->shared->accum.size), hsize_t, size_t); - /* Check if we need to adjust accumulator size */ - if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, add_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + /* Check if we need to adjust accumulator size */ + if(H5F_accum_adjust(&f->shared->accum, f->shared->lf, dxpl_id, H5F_ACCUM_APPEND, add_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") - /* Copy the new metadata to the end */ - HDmemcpy(f->shared->accum.buf + dirty_off, buf, size); + /* Compute offset of dirty region (after adjusting accumulator) */ + dirty_off = (size_t)(addr - f->shared->accum.loc); - /* Set the new size of the metadata accumulator */ - f->shared->accum.size += add_size; + /* Copy the new metadata to the end */ + HDmemcpy(f->shared->accum.buf + dirty_off, buf, size); - /* Adjust the dirty region and mark accumulator dirty */ - if(f->shared->accum.dirty) { - /* Check for new metadata starting before current dirty region */ - if(dirty_off <= f->shared->accum.dirty_off) { - f->shared->accum.dirty_off = dirty_off; - f->shared->accum.dirty_len = size; + /* Set the new size of the metadata accumulator */ + f->shared->accum.size += add_size; + + /* Adjust the dirty region and mark accumulator dirty */ + if(f->shared->accum.dirty) { + /* Check for new metadata starting before current dirty region */ + if(dirty_off <= f->shared->accum.dirty_off) { + f->shared->accum.dirty_off = dirty_off; + f->shared->accum.dirty_len = size; + } /* end if */ + else { + f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off; + } /* end else */ } /* end if */ else { - f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off; + f->shared->accum.dirty_off = dirty_off; + f->shared->accum.dirty_len = size; + f->shared->accum.dirty = TRUE; } /* end else */ } /* end if */ + /* New metadata overlaps both ends of the current accumulator */ else { - f->shared->accum.dirty_off = dirty_off; + /* Check if we need more buffer space */ + if(size > f->shared->accum.alloc_size) { + size_t new_alloc_size; /* New size of accumulator */ + + /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ + new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + + /* Reallocate the metadata accumulator buffer */ + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") + + /* Note the new buffer size */ + f->shared->accum.alloc_size = new_alloc_size; +#ifdef H5_CLEAR_MEMORY +HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); +#endif /* H5_CLEAR_MEMORY */ + } /* end if */ + + /* Copy the new metadata to the buffer */ + HDmemcpy(f->shared->accum.buf, buf, size); + + /* Set the new size & location of the metadata accumulator */ + f->shared->accum.loc = addr; + f->shared->accum.size = size; + + /* Adjust the dirty region and mark accumulator dirty */ + f->shared->accum.dirty_off = 0; f->shared->accum.dirty_len = size; f->shared->accum.dirty = TRUE; } /* end else */ } /* end if */ - /* New metadata overlaps both ends of the current accumulator */ + /* New piece of metadata doesn't adjoin or overlap the existing accumulator */ else { - /* Check if we need more buffer space */ + /* Write out the existing metadata accumulator, with dispatch to driver */ + if(f->shared->accum.dirty) { + if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + + /* Reset accumulator dirty flag */ + f->shared->accum.dirty = FALSE; + } /* end if */ + + /* Cache the new piece of metadata */ + /* Check if we need to resize the buffer */ if(size > f->shared->accum.alloc_size) { - size_t new_alloc_size; /* New size of accumulator */ + size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) + /* Grow the metadata accumulator buffer */ + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") /* Note the new buffer size */ - f->shared->accum.alloc_size = new_alloc_size; + f->shared->accum.alloc_size = new_size; #ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); +{ +size_t clear_size = MAX(f->shared->accum.size, size); +HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - clear_size)); +} #endif /* H5_CLEAR_MEMORY */ } /* end if */ + else { + /* Check if we should shrink the accumulator buffer */ + if(size < (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE) && + f->shared->accum.alloc_size > H5F_ACCUM_THRESHOLD) { + size_t tmp_size = (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE); /* New size of accumulator buffer */ - /* Copy the new metadata to the buffer */ - HDmemcpy(f->shared->accum.buf, buf, size); + /* Shrink the accumulator buffer */ + if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, tmp_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") - /* Set the new size & location of the metadata accumulator */ + /* Note the new buffer size */ + f->shared->accum.alloc_size = tmp_size; + } /* end if */ + } /* end else */ + + /* Update the metadata accumulator information */ f->shared->accum.loc = addr; f->shared->accum.size = size; + /* Store the piece of metadata in the accumulator */ + HDmemcpy(f->shared->accum.buf, buf, size); + /* Adjust the dirty region and mark accumulator dirty */ f->shared->accum.dirty_off = 0; f->shared->accum.dirty_len = size; f->shared->accum.dirty = TRUE; } /* end else */ } /* end if */ - /* New piece of metadata doesn't adjoin or overlap the existing accumulator */ + /* No metadata in the accumulator, grab this piece and keep it */ else { - /* Write out the existing metadata accumulator, with dispatch to driver */ - if(f->shared->accum.dirty) { - if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - - /* Reset accumulator dirty flag */ - f->shared->accum.dirty = FALSE; - } /* end if */ - - /* Cache the new piece of metadata */ - /* Check if we need to resize the buffer */ + /* Check if we need to reallocate the buffer */ if(size > f->shared->accum.alloc_size) { size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); - /* Grow the metadata accumulator buffer */ + /* Reallocate the metadata accumulator buffer */ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") /* Note the new buffer size */ f->shared->accum.alloc_size = new_size; #ifdef H5_CLEAR_MEMORY -{ -size_t clear_size = MAX(f->shared->accum.size, size); -HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - clear_size)); -} +HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); #endif /* H5_CLEAR_MEMORY */ } /* end if */ - else { - /* Check if we should shrink the accumulator buffer */ - if(size < (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE) && - f->shared->accum.alloc_size > H5F_ACCUM_THRESHOLD) { - size_t tmp_size = (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE); /* New size of accumulator buffer */ - - /* Shrink the accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, tmp_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") - - /* Note the new buffer size */ - f->shared->accum.alloc_size = tmp_size; - } /* end if */ - } /* end else */ /* Update the metadata accumulator information */ f->shared->accum.loc = addr; @@ -633,42 +717,96 @@ HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - cl f->shared->accum.dirty = TRUE; } /* end else */ } /* end if */ - /* No metadata in the accumulator, grab this piece and keep it */ else { - /* Check if we need to reallocate the buffer */ - if(size > f->shared->accum.alloc_size) { - size_t new_size; /* New size of accumulator */ + /* Write the data */ + if(H5FD_write(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + + /* Check for overlap w/accumulator */ + /* (Note that this could be improved by updating the accumulator + * with [some of] the information just read in. -QAK) + */ + if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) { + /* Check for write starting before beginning of accumulator */ + if(H5F_addr_le(addr, f->shared->accum.loc)) { + /* Check for write ending within accumulator */ + if(H5F_addr_le(addr + size, f->shared->accum.loc + f->shared->accum.size)) { + size_t overlap_size; /* Size of overlapping region */ + + /* Compute overlap size */ + overlap_size = (size_t)((addr + size) - f->shared->accum.loc); + + /* Check for dirty region */ + if(f->shared->accum.dirty) { + haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off; /* File address of start of dirty region */ + haddr_t dirty_end = dirty_start + f->shared->accum.dirty_len; /* File address of end of dirty region */ + + /* Check if entire dirty region is overwritten */ + if(H5F_addr_le(dirty_end, addr + size)) { + f->shared->accum.dirty = FALSE; + f->shared->accum.dirty_len = 0; + } /* end if */ + else { + /* Check for dirty region falling after write */ + if(H5F_addr_le(addr + size, dirty_start)) + f->shared->accum.dirty_off = overlap_size; + else { /* Dirty region overlaps w/written region */ + f->shared->accum.dirty_off = 0; + f->shared->accum.dirty_len -= (size_t)((addr + size) - dirty_start); + } /* end else */ + } /* end if */ + } /* end if */ - /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + /* Trim bottom of accumulator off */ + f->shared->accum.loc += overlap_size; + f->shared->accum.size -= overlap_size; + HDmemmove(f->shared->accum.buf, f->shared->accum.buf + overlap_size, f->shared->accum.size); + } /* end if */ + else { /* Access covers whole accumulator */ + /* Reset accumulator, but don't flush */ + if(H5F_accum_reset(f, dxpl_id, FALSE) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") + } /* end else */ + } /* end if */ + else { /* Write starts after beginning of accumulator */ + size_t overlap_size; /* Size of overlapping region */ - /* Reallocate the metadata accumulator buffer */ - if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer") + /* Sanity check */ + HDassert(H5F_addr_gt(addr + size, f->shared->accum.loc + f->shared->accum.size)); - /* Note the new buffer size */ - f->shared->accum.alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ - } /* end if */ + /* Compute overlap size */ + overlap_size = (size_t)((f->shared->accum.loc + f->shared->accum.size) - addr); - /* Update the metadata accumulator information */ - f->shared->accum.loc = addr; - f->shared->accum.size = size; + /* Check for dirty region */ + if(f->shared->accum.dirty) { + haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off; /* File address of start of dirty region */ + haddr_t dirty_end = dirty_start + f->shared->accum.dirty_len; /* File address of end of dirty region */ - /* Store the piece of metadata in the accumulator */ - HDmemcpy(f->shared->accum.buf, buf, size); + /* Check if entire dirty region is overwritten */ + if(H5F_addr_ge(dirty_start, addr)) { + f->shared->accum.dirty = FALSE; + f->shared->accum.dirty_len = 0; + } /* end if */ + else { + /* Check for dirty region falling before write */ + if(H5F_addr_le(dirty_end, addr)) + ; /* noop */ + else /* Dirty region overlaps w/written region */ + f->shared->accum.dirty_len = (size_t)(addr - dirty_start); + } /* end if */ + } /* end if */ - /* Adjust the dirty region and mark accumulator dirty */ - f->shared->accum.dirty_off = 0; - f->shared->accum.dirty_len = size; - f->shared->accum.dirty = TRUE; + /* Trim top of accumulator off */ + f->shared->accum.size -= overlap_size; + } /* end else */ + } /* end if */ } /* end else */ - - /* Indicate success */ - HGOTO_DONE(TRUE); } /* end if */ + else { + /* Write the data */ + if(H5FD_write(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -775,22 +913,20 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr, HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") } /* end if */ /* Block to free overlaps with some/all of dirty region */ - else { + /* Check for unfreed dirty region to write */ + else if(H5F_addr_lt(tail_addr, dirty_end)) { size_t write_size; + size_t dirty_delta; write_size = (size_t)(dirty_end - tail_addr); + dirty_delta = f->shared->accum.dirty_len - write_size; - /* Check for unfreed dirty region to write */ - if(write_size > 0) { - size_t dirty_delta; - - dirty_delta = f->shared->accum.dirty_len - write_size; + HDassert(write_size > 0); - /* Write out the unfreed dirty region of the accumulator */ - if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - } /* end if */ - } /* end else */ + /* Write out the unfreed dirty region of the accumulator */ + if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + } /* end if */ /* Reset dirty flag */ f->shared->accum.dirty = FALSE; @@ -800,19 +936,16 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr, /* Check if block to free ends before end of dirty region */ if(H5F_addr_lt(tail_addr, dirty_end)) { size_t write_size; + size_t dirty_delta; write_size = (size_t)(dirty_end - tail_addr); + dirty_delta = f->shared->accum.dirty_len - write_size; - /* Check for unfreed dirty region to write */ - if(write_size > 0) { - size_t dirty_delta; + HDassert(write_size > 0); - dirty_delta = f->shared->accum.dirty_len - write_size; - - /* Write out the unfreed end of the dirty region of the accumulator */ - if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - } /* end if */ + /* Write out the unfreed end of the dirty region of the accumulator */ + if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") } /* end if */ /* Check for block to free beginning at same location as dirty region */ @@ -822,7 +955,7 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr, } /* end if */ /* Block to free eliminates end of dirty region */ else { - f->shared->accum.dirty_len = (addr - dirty_start); + f->shared->accum.dirty_len = (size_t)(addr - dirty_start); } /* end else */ } /* end else */ @@ -852,7 +985,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_accum_flush(H5F_t *f, hid_t dxpl_id) +H5F_accum_flush(const H5F_t *f, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -890,7 +1023,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_accum_reset(H5F_t *f, hid_t dxpl_id) +H5F_accum_reset(const H5F_t *f, hid_t dxpl_id, hbool_t flush) { herr_t ret_value = SUCCEED; /* Return value */ @@ -899,9 +1032,10 @@ H5F_accum_reset(H5F_t *f, hid_t dxpl_id) HDassert(f); HDassert(f->shared); - /* Flush any dirty data in accumulator */ - if(H5F_accum_flush(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") + /* Flush any dirty data in accumulator, if requested */ + if(flush) + if(H5F_accum_flush(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") /* Check if we need to reset the metadata accumulator information */ if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { diff --git a/src/H5Fio.c b/src/H5Fio.c index 407f950..c8c75b2 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -95,7 +95,6 @@ herr_t H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, void *buf/*out*/) { - htri_t accumulated; /* Whether the data was accepted by the metadata accumulator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_block_read, FAIL) @@ -103,19 +102,15 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, HDassert(f); HDassert(f->shared); HDassert(buf); + HDassert(H5F_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") - /* Check if this I/O can be satisfied by the metadata accumulator */ - if((accumulated = H5F_accum_read(f, dxpl_id, type, addr, size, buf)) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read from metadata accumulator failed") - else if(accumulated == FALSE) { - /* Read the data */ - if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") - } /* end else */ + /* Pass through metadata accumulator layer */ + if(H5F_accum_read(f, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through metadata accumulator failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -141,7 +136,6 @@ herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf) { - htri_t accumulated; /* Whether the data was accepted by the metadata accumulator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_block_write, FAIL) @@ -153,19 +147,15 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size); HDassert(f->shared); HDassert(f->intent & H5F_ACC_RDWR); HDassert(buf); + HDassert(H5F_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") - /* Check for accumulating metadata */ - if((accumulated = H5F_accum_write(f, dxpl_id, type, addr, size, buf)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to metadata accumulator failed") - else if(accumulated == FALSE) { - /* Write the data */ - if(H5FD_write(f->shared->lf, dxpl_id, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - } /* end else */ + /* Pass through metadata accumulator layer */ + if(H5F_accum_write(f, dxpl_id, type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index d264d04..c98bda4 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -310,17 +310,18 @@ H5_DLL herr_t H5F_super_free(H5F_super_t *sblock); H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create); H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id); -H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr); +H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, + hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL htri_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, +H5_DLL herr_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); -H5_DLL htri_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, +H5_DLL herr_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL herr_t H5F_accum_flush(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_accum_reset(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F_accum_flush(const H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F_accum_reset(const H5F_t *f, hid_t dxpl_id, hbool_t flush); /* Shared file list related routines */ H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index a259dde..2510487 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -204,7 +204,7 @@ H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr) * extension. */ H5O_loc_reset(ext_ptr); - if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) + if(H5O_create(f, dxpl_id, 0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension") /* Record the address of the superblock extension */ @@ -267,7 +267,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr) +H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, + hbool_t was_created) { herr_t ret_value = SUCCEED; /* Return value */ @@ -277,6 +278,17 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr) HDassert(f); HDassert(ext_ptr); + /* Check if extension was created */ + if(was_created) { + /* Increment link count on superblock extension's object header */ + if(H5O_link(ext_ptr, 1, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count") + + /* Decrement refcount on superblock extension's object header in memory */ + if(H5O_dec_rc_by_loc(ext_ptr, dxpl_id) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement refcount on superblock extension") + } /* end if */ + /* Twiddle the number of open objects to avoid closing the file. */ f->nopen_objs++; if(H5O_close(ext_ptr) < 0) @@ -384,7 +396,9 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) hsize_t superblock_size; /* Size of superblock, in bytes */ size_t driver_size; /* Size of driver info block (bytes) */ unsigned super_vers = HDF5_SUPERBLOCK_VERSION_DEF; /* Superblock version for file */ + H5O_loc_t ext_loc; /* Superblock extension object location */ hbool_t need_ext; /* Whether the superblock extension is needed */ + hbool_t ext_created = FALSE; /* Whether the extension has been created */ herr_t ret_value = SUCCEED; /* Return Value */ FUNC_ENTER_NOAPI_TAG(H5F_super_init, dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) @@ -545,8 +559,6 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { - H5O_loc_t ext_loc; /* Superblock extension object location */ - /* The superblock extension isn't actually a group, but the * default group creation list should work fine. * If we don't supply a size for the object header, HDF5 will @@ -557,6 +569,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) */ if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension") + ext_created = TRUE; /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. @@ -615,13 +628,13 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message") } /* end if */ - - /* Close superblock extension */ - if(H5F_super_ext_close(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") } /* end if */ done: + /* Close superblock extension, if it was created */ + if(ext_created && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + /* Cleanup on failure */ if(ret_value < 0) { /* Check if the superblock has been allocated yet */ @@ -786,7 +799,8 @@ done: herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create) { - hbool_t sblock_dirty = FALSE; /* Whether superblock was dirtied */ + hbool_t ext_created = FALSE; /* Whether superblock extension was created */ + hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ htri_t status; /* Indicate whether the message exists or not */ herr_t ret_value = SUCCEED; /* Return value */ @@ -807,9 +821,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ HDassert(may_create); if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") - sblock_dirty = TRUE; + ext_created = TRUE; } /* end else */ HDassert(H5F_addr_defined(ext_loc.addr)); + ext_opened = TRUE; /* Check if message with ID does not exist in the object header */ if((status = H5O_msg_exists(&ext_loc, id, dxpl_id)) < 0) @@ -833,15 +848,14 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to write the message in object header") } /* end else */ - /* Close the superblock extension object header */ - if(H5F_super_ext_close(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") - done: - /* Mark superblock dirty in cache, if necessary */ - if(sblock_dirty) - if(H5AC_mark_entry_dirty(f->shared->sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + /* Close the superblock extension, if it was opened */ + if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + + /* Mark superblock dirty in cache, if superblock extension was created */ + if(ext_created && H5AC_mark_entry_dirty(f->shared->sblock) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_ext_write_msg() */ @@ -861,9 +875,10 @@ done: herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) { - htri_t status; /* Indicate whether the message exists or not */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */ int null_count = 0; /* # of null messages */ + htri_t status; /* Indicate whether the message exists or not */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_super_ext_remove_msg, FAIL) @@ -874,6 +889,7 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) /* Open superblock extension object header */ if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") + ext_opened = TRUE; /* Check if message with ID exists in the object header */ if((status = H5O_msg_exists(&ext_loc, id, dxpl_id)) < 0) @@ -902,10 +918,11 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) } /* end if */ } /* end if */ - /* Close superblock extension object header */ - if(H5F_super_ext_close(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") done: + /* Close superblock extension object header, if opened */ + if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_ext_remove_msg() */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index f9a29e8..56f9219 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -595,7 +595,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) } /* end if */ /* Close superblock extension */ - if(H5F_super_ext_close(f, &ext_loc) < 0) + if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "unable to close file's superblock extension") } /* end if */ @@ -794,7 +794,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message") /* Close the superblock extension object header */ - if(H5F_super_ext_close(f, &ext_loc) < 0) + if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension") } /* end if */ } /* end if */ @@ -353,6 +353,20 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") done: + /* Release the group's object header, if it was created */ + if(grp) { + H5O_loc_t *oloc; /* Object location for group */ + + /* Get the new group's object location */ + if(NULL == (oloc = H5G_oloc(grp))) + HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") + + /* Decrement refcount on group's object header in memory */ + if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + } /* end if */ + + /* Cleanup on failure */ if(ret_value < 0) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") @@ -901,6 +915,8 @@ done: if(ret_value == NULL) { /* Check if we need to release the file-oriented symbol table info */ if(oloc_init) { + if(H5O_dec_rc_by_loc(&(grp->oloc), dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") if(H5O_close(&(grp->oloc)) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header") if(H5O_delete(file, dxpl_id, grp->oloc.addr) < 0) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index ce11990..b0add06 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -160,8 +160,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Call the "real" group creation routine now */ - if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcrt_info, oloc) - < 0) + if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcrt_info, oloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group") done: @@ -264,7 +263,7 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, * since nothing refers to it yet. The link count will be * incremented if the object is added to the group directed graph. */ - if(H5O_create(f, dxpl_id, hdr_size, gcpl_id, oloc/*out*/) < 0) + if(H5O_create(f, dxpl_id, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") /* Check for format of group to create */ diff --git a/src/H5Groot.c b/src/H5Groot.c index a79a5dd..ff4a8c4 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -15,7 +15,7 @@ /*------------------------------------------------------------------------- * - * Created: H5Gobj.c + * Created: H5Groot.c * Apr 8 2009 * Neil Fortner <nfortne2@hdfgroup.org> * @@ -148,6 +148,10 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) if(1 != H5O_link(root_loc.oloc, 1, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)") + /* Decrement refcount on root group's object header in memory */ + if(H5O_dec_rc_by_loc(root_loc.oloc, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on root group's object header") + /* Mark superblock dirty, so root group info is flushed */ sblock_dirty = TRUE; diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 4016068..bb8e590 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -792,15 +792,17 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, - pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) + if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") /* Insert new group into current group's symbol table */ - if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, - H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) + if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group") + /* Decrement refcount on intermediate group's object header in memory */ + if(H5O_dec_rc_by_loc(obj_loc.oloc, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + /* Close new group */ if(H5O_close(obj_loc.oloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 38b7047..f301701 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -106,6 +106,9 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if (h->obj[u].begin) { sprintf (buf, "Object %u", u); fprintf (stream, "%*s%s\n", indent, "", buf); + fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MIN(fwidth-3, 0), + "Obffset in block:", + (unsigned long)(h->obj[u].begin - h->chunk)); fprintf (stream, "%*s%-*s %d\n", indent+3, "", MIN(fwidth-3, 0), "Reference count:", h->obj[u].nrefs); @@ -1664,8 +1664,9 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */ hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ H5G_loc_t temp_loc; /* For UD callback */ - hbool_t temp_loc_init = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ + hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5L_link_cb) @@ -1690,6 +1691,9 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED /* Set object path to use for setting object name (below) */ udata->path = new_loc.path; + + /* Indicate that an object was created */ + obj_created = TRUE; } /* end if */ else { /* Check that both objects are in same file */ @@ -1763,6 +1767,20 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED } /* end if */ done: + /* Check if an object was created */ + if(obj_created) { + H5O_loc_t oloc; /* Object location for created object */ + + /* Set up object location */ + HDmemset(&oloc, 0, sizeof(oloc)); + oloc.file = grp_loc->oloc->file; + oloc.addr = udata->lnk->u.hard.addr; + + /* Decrement refcount on superblock extension's object header in memory */ + if(H5O_dec_rc_by_loc(&oloc, udata->dxpl_id) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + } /* end if */ + /* Close the location given to the user callback if it was created */ if(grp_id >= 0) { if(H5I_dec_app_ref(grp_id) < 0) @@ -2396,8 +2414,8 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, H5G_own_loc_t *own_loc/*out*/) { H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */ - H5G_t *grp=NULL; /* H5G_t for this group, opened to pass to user callback */ - hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ + H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */ + hid_t grp_id = FAIL; /* ID for this group (passed to user callback */ H5G_loc_t temp_loc; /* For UD callback */ hbool_t temp_loc_init = FALSE; herr_t ret_value = SUCCEED; /* Return value */ @@ -2482,6 +2500,10 @@ done: * location for the object */ *own_loc = H5G_OWN_NONE; + /* Reset the "name" field in udata->lnk because it is owned by traverse() + * and must not be manipulated after traverse closes */ + udata->lnk->name = NULL; + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_move_dest_cb() */ @@ -2521,7 +2543,7 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy") /* Set up user data for move_dest_cb */ - if((udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL)) == NULL) + if(NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved") /* In this special case, the link's name is going to be replaced at its @@ -2582,16 +2604,11 @@ done: H5MM_xfree(orig_name); /* If udata_out.lnk was copied, free any memory allocated - * In this special case, the H5L_move_dest_cb callback frees the name - * if it succeeds + * In this special case, the H5L_move_dest_cb callback resets the name + * so H5O_msg_free shouldn't try to free it */ - if(link_copied) { - if(udata_out.lnk->type == H5L_TYPE_SOFT) - udata_out.lnk->u.soft.name = (char *)H5MM_xfree(udata_out.lnk->u.soft.name); - else if(udata_out.lnk->type >= H5L_TYPE_UD_MIN && udata_out.lnk->u.ud.size > 0) - udata_out.lnk->u.ud.udata = H5MM_xfree(udata_out.lnk->u.ud.udata); - H5MM_xfree(udata_out.lnk); - } /* end if */ + if(link_copied) + H5O_msg_free(H5O_LINK_ID, udata_out.lnk); /* Indicate that this callback didn't take ownership of the group * * location for the object */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 9cab8cf..eb2ffe5 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -188,6 +188,9 @@ done: * Otherwise, the file access property retrieved from H5Pget_elink_fapl() * is used to H5F_open() the target file. * + * Vailin Choi; Nov 2010 + * Free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case. + * *------------------------------------------------------------------------- */ static hid_t @@ -343,9 +346,9 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, char *env_prefix; if(NULL != (env_prefix = HDgetenv("HDF5_EXT_PREFIX"))) { - char *tmp_env_prefix; + char *tmp_env_prefix, *saved_env; - if(NULL == (tmp_env_prefix = H5MM_strdup(env_prefix))) + if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) HGOTO_ERROR(H5E_LINK, H5E_NOSPACE, FAIL, "memory allocation failed") while((tmp_env_prefix) && (*tmp_env_prefix)) { @@ -353,8 +356,10 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, out_prefix_name = H5L_getenv_prefix_name(&tmp_env_prefix/*in,out*/); if(out_prefix_name && (*out_prefix_name)) { - if(H5L_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) + if(H5L_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { + saved_env = (char *)H5MM_xfree(saved_env); HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + } ext_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id); full_name = (char *)H5MM_xfree(full_name); @@ -363,6 +368,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, H5E_clear_stack(NULL); } /* end if */ } /* end while */ + saved_env = (char *)H5MM_xfree(saved_env); } /* end if */ } /* end if */ @@ -1106,14 +1106,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, - H5O_loc_t *loc/*out*/) +H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, + hid_t ocpl_id, H5O_loc_t *loc/*out*/) { H5P_genplist_t *oc_plist; /* Object creation property list */ H5O_t *oh = NULL; /* Object header created */ haddr_t oh_addr; /* Address of initial object header */ size_t oh_size; /* Size of initial object header */ uint8_t oh_flags; /* Object header's initial status flags */ + unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */ hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */ herr_t ret_value = SUCCEED; /* return value */ @@ -1243,11 +1244,18 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh); oh->mesg[0].chunkno = 0; + /* Check for non-zero initial refcount on the object header */ + if(initial_rc > 0) { + /* Set the initial refcount & pin the header when its inserted */ + oh->rc = initial_rc; + insert_flags |= H5AC__PIN_ENTRY_FLAG; + } /* end if */ + /* Set metadata tag in dxpl_id */ H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL); /* Cache object header */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, insert_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh = NULL; @@ -1654,7 +1662,10 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) /* check args */ HDassert(loc); HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); + + /* Check for valid address */ + if(!H5F_addr_defined(loc->addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined") /* Check for write access on the file */ file_intent = H5F_INTENT(loc->file); @@ -3422,6 +3433,49 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_dec_rc_by_loc + * + * Purpose: Decrement the refcount of an object header, using its + * object location information. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 08 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_dec_rc_by_loc(const H5O_loc_t *loc, hid_t dxpl_id) +{ + H5O_t *oh = NULL; /* Object header */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_dec_rc_by_loc, FAIL) + + /* check args */ + HDassert(loc); + + /* Get header */ + if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + + /* Decrement the reference count on the object header */ + /* (which will unpin it, if appropriate) */ + if(H5O_dec_rc(oh) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header") + +done: + /* Release the object header from the cache */ + if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_dec_rc_by_loc() */ + + +/*------------------------------------------------------------------------- * Function: H5O_free * * Purpose: Destroys an object header. diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 9e909a6..e64262b 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -560,6 +560,21 @@ done: * koziol@ncsa.uiuc.edu * Mar 20 2003 * + * Changes: In the parallel case, there is the possibility that the + * the object header may be flushed by different processes + * over the life of the computation. Thus we must ensure + * that the chunk images are up to date before we mark the + * messages clean -- as otherwise we may overwrite valid + * data with a blank section of a chunk image. + * + * To deal with this, I have added code to call + * H5O_chunk_serialize() for all chunks before we + * mark all messages as clean if we are not destroying the + * object. Do this in the parallel case only, as the problem + * can only occur in this context. + * + * JRM -- 10/12/10 + * *------------------------------------------------------------------------- */ static herr_t @@ -573,6 +588,30 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) /* check args */ HDassert(oh); +#ifdef H5_HAVE_PARALLEL + if ( ( oh->cache_info.is_dirty ) && ( ! destroy ) ) { + + size_t i; + + /* scan through all chunks associated with the object header, + * and cause them to update their images for all entries currently + * marked dirty. Must do this in the parallel case, as it is possible + * that this processor may clear this object header several times + * before flushing it -- thus causing undefined sections of the image + * to be written to disk overwriting valid data. + */ + + for ( i = 0; i < oh->nchunks; i++ ) { + + if ( H5O_chunk_serialize(f, oh, i) < 0 ) { + + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, + "unable to serialize object header chunk") + } + } + } +#endif /* H5_HAVE_PARALLEL */ + /* Mark messages as clean */ for(u = 0; u < oh->nmesgs; u++) oh->mesg[u].dirty = FALSE; @@ -830,6 +869,30 @@ done: * koziol@hdfgroup.org * July 12, 2008 * + * Changes: In the parallel case, there is the possibility that the + * the object header chunk may be flushed by different + * processes over the life of the computation. Thus we must + * ensure that the chunk image is up to date before we mark its + * messages clean -- as otherwise we may overwrite valid + * data with a blank section of a chunk image. + * + * To deal with this, I have added code to call + * H5O_chunk_serialize() for this chunk before we + * mark all messages as clean if we are not destroying the + * chunk. + * + * Do this in the parallel case only, as the problem + * can only occur in this context. + * + * Note that at present at least, it seems that this fix + * is not necessary, as we don't seem to be able to + * generate a dirty chunk without creating a dirty object + * header. However, the object header code will be changing + * a lot in the near future, so I'll leave this fix in + * for now, unless Quincey requests otherwise. + * + * JRM -- 10/12/10 + * *------------------------------------------------------------------------- */ static herr_t @@ -843,6 +906,17 @@ H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t destroy) /* check args */ HDassert(chk_proxy); +#ifdef H5_HAVE_PARALLEL + if ( ( chk_proxy->oh->cache_info.is_dirty ) && ( ! destroy ) ) { + + if ( H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0 ) { + + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, + "unable to serialize object header chunk") + } + } +#endif /* H5_HAVE_PARALLEL */ + /* Mark messages in chunk as clean */ for(u = 0; u < chk_proxy->oh->nmesgs; u++) if(chk_proxy->oh->mesg[u].chunkno == chk_proxy->chunkno) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index a14d471..54e7233 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -610,6 +610,7 @@ H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs); H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val); H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc, hid_t dxpl_id); +H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc); #endif /* H5O_TESTING */ /* Object header debugging routines */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 63264d8..56901f3 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -369,6 +369,7 @@ typedef struct H5O_storage_contig_t { } H5O_storage_contig_t; typedef struct H5O_storage_chunk_btree_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ } H5O_storage_chunk_btree_t; @@ -623,13 +624,14 @@ struct H5P_genplist_t; /* Object header routines */ H5_DLL herr_t H5O_init(void); H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, - hid_t ocpl_id, H5O_loc_t *loc/*out*/); + size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc/*out*/); H5_DLL herr_t H5O_open(H5O_loc_t *loc); H5_DLL herr_t H5O_close(H5O_loc_t *loc); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id); H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot); H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id); H5_DLL herr_t H5O_unpin(H5O_t *oh); +H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc, hid_t dxpl_id); H5_DLL herr_t H5O_unprotect(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, unsigned oh_flags); H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); diff --git a/src/H5Otest.c b/src/H5Otest.c index 557ac9e..883bfcd 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -536,3 +536,52 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O_expunge_chunks_test() */ + +/*-------------------------------------------------------------------------- + NAME + H5O_get_rc + PURPOSE + Retrieve the refcount for the object header + USAGE + herr_t H5O_expunge_chunks_test(loc, dxpl_id, rc) + const H5O_loc_t *loc; IN: Object location for object header to query + hid_t dxpl_id; IN: DXPL to use for operation + unsigned *rc; OUT: Pointer to refcount for object header + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Protects object header, retrieves the object header's refcount, and + unprotects object header. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5O_get_rc(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc) +{ + H5O_t *oh = NULL; /* Object header */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_get_rc, FAIL) + + /* Sanity check */ + HDassert(loc); + HDassert(rc); + + /* Get the object header */ + if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + + /* Save the refcount for the object header */ + *rc = oh->nlink; + +done: + /* Release the object header */ + if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_expunge_chunks_test() */ + diff --git a/src/H5Smpio.c b/src/H5Smpio.c index e9d0541..d6131b9 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -35,6 +35,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Spkg.h" /* Dataspaces */ +#include "H5Vprivate.h" /* Vector and array functions */ #ifdef H5_HAVE_PARALLEL @@ -83,7 +84,7 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size, HDassert(space); /* Just treat the entire extent as a block of bytes */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(space)) < 0) + if((snelmts = (hssize_t)H5S_GET_EXTENT_NPOINTS(space)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, hsize_t); @@ -160,14 +161,15 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, hsize_t count; } d[H5S_MAX_RANK]; - int i; - int offset[H5S_MAX_RANK]; - int max_xtent[H5S_MAX_RANK]; + hsize_t offset[H5S_MAX_RANK]; + hsize_t max_xtent[H5S_MAX_RANK]; H5S_hyper_dim_t *diminfo; /* [rank] */ - int rank; + unsigned rank; int block_length[3]; MPI_Datatype inner_type, outer_type, old_types[3]; MPI_Aint extent_len, displacement[3]; + unsigned u; /* Local index variable */ + int i; /* Local index variable */ int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; @@ -192,66 +194,68 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, if(sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) { /* Flattened selection */ rank = sel_iter.u.hyp.iter_rank; - HDassert(rank >= 0 && rank <= H5S_MAX_RANK); /* within array bounds */ + HDassert(rank <= H5S_MAX_RANK); /* within array bounds */ #ifdef H5S_DEBUG if(H5DEBUG(S)) HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC); #endif - for(i = 0; i < rank; ++i) { - d[i].start = diminfo[i].start + sel_iter.u.hyp.sel_off[i]; - d[i].strid = diminfo[i].stride; - d[i].block = diminfo[i].block; - d[i].count = diminfo[i].count; - d[i].xtent = sel_iter.u.hyp.size[i]; + for(u = 0; u < rank; ++u) { + H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) + d[u].start = (hssize_t)diminfo[u].start + sel_iter.u.hyp.sel_off[u]; + d[u].strid = diminfo[u].stride; + d[u].block = diminfo[u].block; + d[u].count = diminfo[u].count; + d[u].xtent = sel_iter.u.hyp.size[u]; #ifdef H5S_DEBUG if(H5DEBUG(S)){ HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", - FUNC, d[i].start, d[i].strid, d[i].count, d[i].block, d[i].xtent ); - if (i==0) - HDfprintf(H5DEBUG(S), " rank=%d\n", rank ); + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent ); + if (u==0) + HDfprintf(H5DEBUG(S), " rank=%u\n", rank ); else HDfprintf(H5DEBUG(S), "\n" ); } #endif - if(0 == d[i].block) + if(0 == d[u].block) goto empty; - if(0 == d[i].count) + if(0 == d[u].count) goto empty; - if(0 == d[i].xtent) + if(0 == d[u].xtent) goto empty; } /* end for */ } /* end if */ else { /* Non-flattened selection */ rank = space->extent.rank; - HDassert(rank >= 0 && rank <= H5S_MAX_RANK); /* within array bounds */ + HDassert(rank <= H5S_MAX_RANK); /* within array bounds */ if(0 == rank) goto empty; #ifdef H5S_DEBUG if(H5DEBUG(S)) HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC); #endif - for(i = 0; i < rank; ++i) { - d[i].start = diminfo[i].start + space->select.offset[i]; - d[i].strid = diminfo[i].stride; - d[i].block = diminfo[i].block; - d[i].count = diminfo[i].count; - d[i].xtent = space->extent.size[i]; + for(u = 0; u < rank; ++u) { + H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) + d[u].start = (hssize_t)diminfo[u].start + space->select.offset[u]; + d[u].strid = diminfo[u].stride; + d[u].block = diminfo[u].block; + d[u].count = diminfo[u].count; + d[u].xtent = space->extent.size[u]; #ifdef H5S_DEBUG if(H5DEBUG(S)){ HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", - FUNC, d[i].start, d[i].strid, d[i].count, d[i].block, d[i].xtent ); - if (i==0) - HDfprintf(H5DEBUG(S), " rank=%d\n", rank ); + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent ); + if (u==0) + HDfprintf(H5DEBUG(S), " rank=%u\n", rank ); else HDfprintf(H5DEBUG(S), "\n" ); } #endif - if(0 == d[i].block) + if(0 == d[u].block) goto empty; - if(0 == d[i].count) + if(0 == d[u].count) goto empty; - if(0 == d[i].xtent) + if(0 == d[u].xtent) goto empty; } /* end for */ } /* end else */ @@ -264,17 +268,17 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, max_xtent[rank - 1] = d[rank - 1].xtent; #ifdef H5S_DEBUG if(H5DEBUG(S)) { - i=rank-1; - HDfprintf(H5DEBUG(S), " offset[%2d]=%d; max_xtent[%2d]=%d\n", + i = ((int)rank) - 1; + HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); } #endif - for(i = rank - 2; i >= 0; --i) { + for(i = ((int)rank) - 2; i >= 0; --i) { offset[i] = offset[i + 1] * d[i + 1].xtent; max_xtent[i] = max_xtent[i + 1] * d[i].xtent; #ifdef H5S_DEBUG if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), " offset[%2d]=%d; max_xtent[%2d]=%d\n", + HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); #endif } /* end for */ @@ -290,7 +294,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, #ifdef H5S_DEBUG if(H5DEBUG(S)) { HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size); - for (i=rank-1; i>=0; --i) + for(i = ((int)rank) - 1; i >= 0; --i) HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent); } #endif @@ -301,7 +305,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, * Construct the type by walking the hyperslab dims * from the inside out: *******************************************************/ - for(i = rank - 1; i >= 0; --i) { + for(i = ((int)rank) - 1; i >= 0; --i) { #ifdef H5S_DEBUG if(H5DEBUG(S)) HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n" @@ -538,7 +542,8 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, /* Store displacement & block length */ disp[outercount] = (MPI_Aint)elmt_size * tspan->low; - blocklen[outercount] = tspan->nelem; + H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int) + blocklen[outercount] = (int)tspan->nelem; tspan = tspan->next; outercount++; @@ -710,12 +715,15 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, } /* end else */ break; + case H5S_SEL_ERROR: + case H5S_SEL_N: default: HDassert("unknown selection type" && 0); break; } /* end switch */ break; + case H5S_NO_CLASS: default: HDassert("unknown data space type" && 0); break; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 2c289b0..a52d538 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -279,6 +279,7 @@ H5T_bit_get_d(uint8_t *buf, size_t offset, size_t size) case H5T_ORDER_ERROR: case H5T_ORDER_VAX: case H5T_ORDER_NONE: + case H5T_ORDER_MIXED: default: /* Unknown endianness. Bail out. */ HGOTO_DONE(UFAIL) @@ -326,6 +327,7 @@ H5T_bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) case H5T_ORDER_ERROR: case H5T_ORDER_VAX: case H5T_ORDER_NONE: + case H5T_ORDER_MIXED: default: HDabort(); } /* end switch */ @@ -534,7 +536,7 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) else mask = ((unsigned)1 << (8 - start)) - 1; acc = ((unsigned)buf[idx] >> start) & mask; - acc += 1; + acc++; carry = acc & ((unsigned)1 << MIN(size, 8 - start)); buf[idx] &= (uint8_t)(~(mask << start)); buf[idx] |= (uint8_t)((acc & mask) << start); @@ -546,7 +548,7 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) /* The middle */ while(carry && size >= 8) { acc = buf[idx]; - acc += 1; + acc++; carry = acc & 0x100; buf[idx] = acc & 0xff; idx++; @@ -557,7 +559,7 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) if(carry && size > 0) { mask = ((unsigned)1 << size) - 1; acc = buf[idx] & mask; - acc += 1; + acc++; carry = acc & ((unsigned)1 << size); buf[idx] &= (uint8_t)(~mask); buf[idx] |= (uint8_t)(acc & mask); @@ -606,7 +608,7 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size) */ if(!(buf[idx] >> pos)) borrow = 1; - buf[idx] -= 1 << pos; + buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); idx++; size -= (8 - pos); @@ -614,7 +616,7 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size) while(borrow && size >= 8) { if(buf[idx]) borrow = 0; - buf[idx] -= 1; + buf[idx]--; idx++; size -= 8; @@ -624,9 +626,9 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size) if(borrow && size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp = buf[idx]; - buf[idx] -= 1; + buf[idx]--; if((buf[idx] >> size) != tmp >> size) - buf[idx] += 1 << size; + buf[idx] = (uint8_t)(buf[idx] + (1 << size)); } /* end if */ } /* end if */ else { /* bit sequence ends in the same byte as starts */ @@ -635,9 +637,9 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size) * not equal). We need to put this bit back by increment 1000000. */ tmp = buf[idx]; - buf[idx] -= 1 << pos; + buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); if((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { - buf[idx] += 1 << (pos + size); + buf[idx] = (uint8_t)(buf[idx] + (1 << (pos + size))); borrow = 1; } /* end if */ } /* end else */ @@ -664,7 +666,7 @@ H5T_bit_neg(uint8_t *buf, size_t start, size_t size) { size_t idx = start / 8; size_t pos = start % 8; - uint8_t tmp; + uint8_t tmp[1]; /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_neg); @@ -673,12 +675,11 @@ H5T_bit_neg(uint8_t *buf, size_t start, size_t size) HDassert(size); /* The first partial byte */ - tmp = buf[idx]; - tmp = (uint8_t)~tmp; + tmp[0] = (uint8_t)~buf[idx]; /* Simply copy the negated bit field back to the original byte */ if((size + start - 1) / 8 > idx) { /*bit sequence doesn't end in the same byte as starts*/ - H5T_bit_copy(&(buf[idx]), pos, &tmp, pos, (8-pos)); + H5T_bit_copy(&(buf[idx]), pos, tmp, pos, (8-pos)); idx++; size -= (8 - pos); @@ -692,13 +693,12 @@ H5T_bit_neg(uint8_t *buf, size_t start, size_t size) /* The last partial byte */ if(size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ - tmp = buf[idx]; - tmp = (uint8_t)~tmp; - H5T_bit_copy(&(buf[idx]), (size_t)0, &tmp, (size_t)0, size); + tmp[0] = (uint8_t)~buf[idx]; + H5T_bit_copy(&(buf[idx]), (size_t)0, tmp, (size_t)0, size); } /* end if */ } /* end if */ else /* bit sequence ends in the same byte as starts */ - H5T_bit_copy(&(buf[idx]), pos, &tmp, pos, size); + H5T_bit_copy(&(buf[idx]), pos, tmp, pos, size); FUNC_LEAVE_NOAPI_VOID } /* end H5T_bit_neg() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index b924b61..e109f95 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -302,6 +302,19 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(H5T_commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + /* Release the datatype's object header */ + { + H5O_loc_t *oloc; /* Object location for datatype */ + + /* Get the new committed datatype's object location */ + if(NULL == (oloc = H5T_oloc(type))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") + + /* Decrement refcount on committed datatype's object header in memory */ + if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + } /* end if */ + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit_anon() */ @@ -379,7 +392,7 @@ H5T_commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id) * Create the object header and open it for write access. Insert the data * type message and then give the object header a name. */ - if(H5O_create(file, dxpl_id, dtype_size, tcpl_id, &temp_oloc) < 0) + if(H5O_create(file, dxpl_id, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") @@ -415,6 +428,8 @@ done: H5G_name_free(&temp_path); } /* end if */ if((type->shared->state == H5T_STATE_TRANSIENT || type->shared->state == H5T_STATE_RDONLY) && (type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED)) { + if(H5O_dec_rc_by_loc(&(type->oloc), dxpl_id) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") if(H5O_close(&(type->oloc)) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header") if(H5O_delete(file, dxpl_id, type->sh_loc.u.loc.oh_addr) < 0) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 9d98e50..927a9dc 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -662,17 +662,16 @@ CI_INC_DST(d_mv) \ \ /* Get the plist structure */ \ - if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) \ - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); \ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) \ + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") \ \ /* Get conversion exception callback property */ \ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) \ - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); \ + if(H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) \ + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") \ \ /* Get source and destination datatypes */ \ - if (NULL==(st=(H5T_t*)H5I_object(src_id)) || NULL==(dt=(H5T_t*)H5I_object(dst_id))) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \ - "unable to dereference datatype object ID") \ + if(NULL == (st = (H5T_t *)H5I_object(src_id)) || NULL == (dt = (H5T_t *)H5I_object(dst_id))) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference datatype object ID") \ \ /* Get source & destination precisions into a variable */ \ tclass = st->shared->type; \ @@ -1041,9 +1040,8 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, switch(cdata->command) { case H5T_CONV_INIT: /* Capability query */ - if(NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) @@ -1055,7 +1053,7 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, !((H5T_ORDER_BE == src->shared->u.atomic.order && H5T_ORDER_LE == dst->shared->u.atomic.order) || (H5T_ORDER_LE == src->shared->u.atomic.order && H5T_ORDER_BE == dst->shared->u.atomic.order))) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") - if (src->shared->size != 1 && src->shared->size != 2 && src->shared->size != 4 && + if(src->shared->size != 1 && src->shared->size != 2 && src->shared->size != 4 && src->shared->size != 8 && src->shared->size != 16) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") switch(src->shared->type) { @@ -1085,14 +1083,14 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, case H5T_CONV_CONV: /* The conversion */ - if(NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Check for "no op" reference conversion */ if(src->shared->type == H5T_REFERENCE) { /* Sanity check */ - HDassert(dst->shared->type == H5T_REFERENCE); + if(dst->shared->type != H5T_REFERENCE) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype") /* Check if we are on a little-endian machine (the order that * the addresses in the file must be) and just get out now, there @@ -1452,7 +1450,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Capability query */ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset || !((H5T_ORDER_BE == src->shared->u.atomic.order && @@ -1487,9 +1485,8 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* The conversion */ - if(NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(NULL == (src = (H5T_t *)H5I_object(src_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") buf_stride = buf_stride ? buf_stride : src->shared->size; md = src->shared->size / 2; @@ -1535,7 +1532,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, void UNUSED *background, hid_t dxpl_id) { uint8_t *buf = (uint8_t*)_buf; - H5T_t *src = NULL, *dst = NULL; /*source and dest data types */ + H5T_t *src = NULL, *dst = NULL; /*source and dest datatypes */ int direction; /*direction of traversal */ size_t elmtno; /*element number */ size_t olap; /*num overlapping elements */ @@ -1558,7 +1555,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Capability query */ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(H5T_ORDER_LE != src->shared->u.atomic.order && H5T_ORDER_BE != src->shared->u.atomic.order) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") @@ -1572,10 +1569,9 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ - if(NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + /* Get the datatypes */ + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* * Do we process the values from beginning to end or vice versa? Also, @@ -1777,24 +1773,26 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) hid_t *src_memb_id = priv->src_memb_id, *dst_memb_id = priv->dst_memb_id; unsigned i; - int status; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_conv_struct_free) - for (i=0; i<priv->src_nmembs; i++) - if (src2dst[i] >= 0) { + for(i = 0; i < priv->src_nmembs; i++) + if(src2dst[i] >= 0) { + int status; + status = H5I_dec_ref(src_memb_id[i]); HDassert(status >= 0); status = H5I_dec_ref(dst_memb_id[src2dst[i]]); HDassert(status >= 0); - } + } /* end if */ H5MM_xfree(src2dst); H5MM_xfree(src_memb_id); H5MM_xfree(dst_memb_id); H5MM_xfree(priv->memb_path); - FUNC_LEAVE_NOAPI((H5T_conv_struct_t *)H5MM_xfree(priv)); -} + + FUNC_LEAVE_NOAPI((H5T_conv_struct_t *)H5MM_xfree(priv)) +} /* end H5T_conv_struct_free() */ /*------------------------------------------------------------------------- @@ -1852,9 +1850,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) int *src2dst = NULL; unsigned src_nmembs, dst_nmembs; unsigned i, j; - H5T_t *type = NULL; - hid_t tid; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_conv_struct_init) @@ -1900,9 +1896,12 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) } /* end if */ } /* end for */ if(src2dst[i] >= 0) { + hid_t tid; + H5T_t *type; + type = H5T_copy(src->shared->u.compnd.memb[i].type, H5T_COPY_ALL); tid = H5I_register(H5I_DATATYPE, type, FALSE); - HDassert(tid>=0); + HDassert(tid >= 0); priv->src_memb_id[i] = tid; type = H5T_copy(dst->shared->u.compnd.memb[src2dst[i]].type, H5T_COPY_ALL); @@ -1933,7 +1932,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) H5T_path_t *tpath = H5T_path_find(src->shared->u.compnd.memb[i].type, dst->shared->u.compnd.memb[src2dst[i]].type, NULL, NULL, dxpl_id, FALSE); if(NULL == (priv->memb_path[i] = tpath)) { - cdata->priv = priv = H5T_conv_struct_free(priv); + cdata->priv = H5T_conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member datatype") } /* end if */ } /* end if */ @@ -1959,8 +1958,8 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) * the end of src. */ if(priv->subset_info.subset == H5T_SUBSET_SRC) - priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs-1].offset - + src->shared->u.compnd.memb[src_nmembs-1].size; + priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs - 1].offset + + src->shared->u.compnd.memb[src_nmembs - 1].size; } else if(dst_nmembs < src_nmembs) { priv->subset_info.subset = H5T_SUBSET_DST; for(i = 0; i < dst_nmembs; i++) { @@ -2075,23 +2074,23 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, { uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ - uint8_t *xbuf=buf, *xbkg=bkg; /*temp pointers into buf and bkg*/ + uint8_t *xbuf = buf, *xbkg = bkg; /*temp pointers into buf and bkg*/ H5T_t *src = NULL; /*source datatype */ H5T_t *dst = NULL; /*destination datatype */ int *src2dst = NULL; /*maps src member to dst member */ H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/ H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */ size_t offset; /*byte offset wrt struct */ - size_t src_delta; /*source stride */ + size_t src_delta; /*source stride */ size_t elmtno; - unsigned u; /*counters */ - int i; /*counters */ + unsigned u; /*counters */ + int i; /*counters */ H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv); - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_conv_struct, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: /* * First, determine if this conversion function applies to the @@ -2099,35 +2098,35 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * otherwise initialize the `priv' field of `cdata' with information * that remains (almost) constant for this conversion path. */ - if (NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - assert (H5T_COMPOUND==src->shared->type); - assert (H5T_COMPOUND==dst->shared->type); + if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_COMPOUND != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + if(H5T_COMPOUND != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") - if (H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); + if(H5T_conv_struct_init(src, dst, cdata, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") break; case H5T_CONV_FREE: /* * Free the private conversion data. */ - cdata->priv = priv = H5T_conv_struct_free(priv); + cdata->priv = H5T_conv_struct_free(priv); break; case H5T_CONV_CONV: /* * Conversion. */ - if (NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - assert (priv); - assert (bkg && cdata->need_bkg); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HDassert(priv); + HDassert(bkg && cdata->need_bkg); - if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); + if(cdata->recalc && H5T_conv_struct_init(src, dst, cdata, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") /* * Insure that members are sorted. @@ -2139,7 +2138,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Direction of conversion and striding through background. */ - if (buf_stride) { + if(buf_stride) { src_delta = buf_stride; if(!bkg_stride) bkg_stride = dst->shared->size; @@ -2156,7 +2155,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end else */ /* Conversion loop... */ - for (elmtno=0; elmtno<nelmts; elmtno++) { + for(elmtno = 0; elmtno < nelmts; elmtno++) { /* * For each source member which will be present in the * destination, convert the member to the destination type unless @@ -2165,8 +2164,9 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * data point as small as possible with all the free space on the * right side. */ - for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) { - if (src2dst[u]<0) continue; /*subsetting*/ + for(u = 0, offset = 0; u < src->shared->u.compnd.nmembs; u++) { + if(src2dst[u] < 0) + continue; /*subsetting*/ src_memb = src->shared->u.compnd.memb + u; dst_memb = dst->shared->u.compnd.memb + src2dst[u]; @@ -2176,15 +2176,16 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)1, (size_t)0, (size_t)0, /*no striding (packed array)*/ xbuf + src_memb->offset, xbkg + dst_memb->offset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member") HDmemmove(xbuf + offset, xbuf + src_memb->offset, dst_memb->size); offset += dst_memb->size; - } else { + } /* end if */ + else { HDmemmove (xbuf+offset, xbuf+src_memb->offset, src_memb->size); offset += src_memb->size; - } - } + } /* end else */ + } /* end for */ /* * For each source member which will be present in the @@ -2193,8 +2194,9 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * yet). Then copy the member to the destination offset in the * background buffer. */ - for (i=src->shared->u.compnd.nmembs-1; i>=0; --i) { - if (src2dst[i]<0) continue; /*subsetting*/ + for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) { + if(src2dst[i] < 0) + continue; /*subsetting*/ src_memb = src->shared->u.compnd.memb + i; dst_memb = dst->shared->u.compnd.memb + src2dst[i]; @@ -2205,43 +2207,44 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)1, (size_t)0, (size_t)0, /*no striding (packed array)*/ xbuf + offset, xbkg + dst_memb->offset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); - } else + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member") + } /* end if */ + else offset -= dst_memb->size; HDmemmove(xbkg + dst_memb->offset, xbuf + offset, dst_memb->size); - } - assert (0==offset); + } /* end for */ + HDassert(0 == offset); /* * Update pointers */ xbuf += src_delta; xbkg += bkg_stride; - } + } /* end for */ /* If the bkg_stride was set to -(dst->shared->size), make it positive now */ - if(buf_stride==0 && dst->shared->size>src->shared->size) - bkg_stride=dst->shared->size; + if(buf_stride == 0 && dst->shared->size > src->shared->size) + bkg_stride = dst->shared->size; /* * Copy the background buffer back into the in-place conversion * buffer. */ - for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) { + for(xbuf = buf, xbkg = bkg, elmtno = 0; elmtno < nelmts; elmtno++) { HDmemmove(xbuf, xbkg, dst->shared->size); xbuf += buf_stride ? buf_stride : dst->shared->size; xbkg += bkg_stride; - } + } /* end for */ break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_struct() */ /*------------------------------------------------------------------------- @@ -2337,7 +2340,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_struct_opt, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: /* * First, determine if this conversion function applies to the @@ -2347,8 +2350,10 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - HDassert(H5T_COMPOUND == src->shared->type); - HDassert(H5T_COMPOUND == dst->shared->type); + if(H5T_COMPOUND != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + if(H5T_COMPOUND != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") /* Initialize data which is relatively constant */ if(H5T_conv_struct_init(src, dst, cdata, dxpl_id) < 0) @@ -2383,7 +2388,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, if(dst_memb->size > src_memb->size) { offset -= src_memb->size; if(dst_memb->size > src->shared->size-offset) { - cdata->priv = priv = H5T_conv_struct_free(priv); + cdata->priv = H5T_conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "convertion is unsupported by this function") } /* end if */ } /* end if */ @@ -2395,8 +2400,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /* * Free the private conversion data. */ - priv = (H5T_conv_struct_t *)(cdata->priv); - cdata->priv = priv = H5T_conv_struct_free(priv); + cdata->priv = H5T_conv_struct_free((H5T_conv_struct_t *)(cdata->priv)); break; case H5T_CONV_CONV: @@ -2410,8 +2414,8 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, if(cdata->recalc && H5T_conv_struct_init(src, dst, cdata, dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") priv = (H5T_conv_struct_t *)(cdata->priv); - src2dst = priv->src2dst; HDassert(priv); + src2dst = priv->src2dst; HDassert(bkg && cdata->need_bkg); /* @@ -2558,20 +2562,20 @@ done: static herr_t H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) { - H5T_enum_struct_t *priv=NULL; /*private conversion data */ + H5T_enum_struct_t *priv = NULL; /*private conversion data */ int n; /*src value cast as native int */ int domain[2] = {0, 0}; /*min and max source values */ - int *map=NULL; /*map from src value to dst idx */ + int *map = NULL; /*map from src value to dst idx */ unsigned length; /*nelmts in map array */ unsigned i, j; /*counters */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_conv_enum_init) cdata->need_bkg = H5T_BKG_NO; - if (NULL==(priv=(H5T_enum_struct_t *)(cdata->priv=H5MM_calloc(sizeof(*priv))))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if (0==src->shared->u.enumer.nmembs) + if(NULL == (priv = (H5T_enum_struct_t *)(cdata->priv = H5MM_calloc(sizeof(*priv))))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(0 == src->shared->u.enumer.nmembs) HGOTO_DONE(SUCCEED); /* @@ -2581,18 +2585,18 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) */ H5T_sort_name(src, NULL); H5T_sort_name(dst, NULL); - if (NULL==(priv->src2dst=(int *)H5MM_malloc(src->shared->u.enumer.nmembs*sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");; - for (i=0, j=0; - i<src->shared->u.enumer.nmembs && j<dst->shared->u.enumer.nmembs; + if(NULL == (priv->src2dst = (int *)H5MM_malloc(src->shared->u.enumer.nmembs * sizeof(int)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + for(i = 0, j = 0; + i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) { - while (j<dst->shared->u.enumer.nmembs && + while(j < dst->shared->u.enumer.nmembs && HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j])) j++; - if (j>=dst->shared->u.enumer.nmembs) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source type is not a subset of destination type"); + if(j >= dst->shared->u.enumer.nmembs) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source type is not a subset of destination type") priv->src2dst[i] = j; - } + } /* end for */ /* * The conversion function will use an O(log N) lookup method for each @@ -2634,7 +2638,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) priv->base = domain[0]; priv->length = length; if (NULL==(map=(int *)H5MM_malloc(length*sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") for (i=0; i<length; i++) map[i] = -1; /*entry unused*/ for (i=0; i<src->shared->u.enumer.nmembs; i++) { @@ -2701,20 +2705,20 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, void UNUSED *bkg, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; /*cast for pointer arithmetic */ - H5T_t *src=NULL, *dst=NULL; /*src and dst datatypes */ - uint8_t *s=NULL, *d=NULL; /*src and dst BUF pointers */ + H5T_t *src = NULL, *dst = NULL; /*src and dst datatypes */ + uint8_t *s = NULL, *d = NULL; /*src and dst BUF pointers */ int src_delta, dst_delta; /*conversion strides */ int n; /*src value cast as native int */ - size_t i; /*counters */ H5T_enum_struct_t *priv = (H5T_enum_struct_t*)(cdata->priv); H5P_genplist_t *plist; /*property list pointer */ H5T_conv_cb_t cb_struct; /*conversion callback structure */ H5T_conv_ret_t except_ret; /*return of callback function */ - herr_t ret_value=SUCCEED; /* Return value */ + size_t i; /*counters */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_conv_enum, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: /* * Determine if this conversion function applies to the conversion @@ -2722,13 +2726,15 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * the `priv' field of `cdata' with information about the underlying * integer conversion. */ - if (NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - assert (H5T_ENUM==src->shared->type); - assert (H5T_ENUM==dst->shared->type); - if (H5T_conv_enum_init(src, dst, cdata)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data"); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_ENUM != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + if(H5T_ENUM != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + + if(H5T_conv_enum_init(src, dst, cdata) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data") break; case H5T_CONV_FREE: @@ -2747,26 +2753,28 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - if (NULL == (src = (H5T_t *)H5I_object(src_id)) || - NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - assert (H5T_ENUM==src->shared->type); - assert (H5T_ENUM==dst->shared->type); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_ENUM != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + if(H5T_ENUM != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") /* priv->src2dst map was computed for certain sort keys. Make sure those same * sort keys are used here during conversion. See H5T_conv_enum_init(). But * we actually don't care about the source type's order when doing the O(1) * conversion algorithm, which is turned on by non-zero priv->length */ H5T_sort_name(dst, NULL); - if (!priv->length) H5T_sort_value(src, NULL); + if(!priv->length) + H5T_sort_value(src, NULL); /* * Direction of conversion. */ - if (buf_stride) { + if(buf_stride) { src_delta = dst_delta = (int)buf_stride; s = d = buf; - } else if (dst->shared->size <= src->shared->size) { + } else if(dst->shared->size <= src->shared->size) { src_delta = (int)src->shared->size; /*overflow shouldn't be possible*/ dst_delta = (int)dst->shared->size; /*overflow shouldn't be possible*/ s = d = buf; @@ -2778,25 +2786,24 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + if(H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") - for (i=0; i<nelmts; i++, s+=src_delta, d+=dst_delta) { - if (priv->length) { + for(i = 0; i < nelmts; i++, s += src_delta, d += dst_delta) { + if(priv->length) { /* Use O(1) lookup */ - if (1==src->shared->size) { + if(1 == src->shared->size) n = *((signed char*)s); - } else if (sizeof(short)==src->shared->size) { + else if(sizeof(short) == src->shared->size) n = *((short*)s); - } else { + else n = *((int*)s); - } n -= priv->base; - if (n<0 || n>=priv->length || priv->src2dst[n]<0) { + if(n < 0 || n >= priv->length || priv->src2dst[n] < 0) { /*overflow*/ except_ret = H5T_CONV_UNHANDLED; if(cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -2818,19 +2825,19 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, int lt = 0; int rt = src->shared->u.enumer.nmembs; int md, cmp; - while (lt<rt) { - md = (lt+rt)/2; - cmp = HDmemcmp(s, src->shared->u.enumer.value+md*src->shared->size, + + while(lt < rt) { + md = (lt + rt) / 2; + cmp = HDmemcmp(s, src->shared->u.enumer.value + md * src->shared->size, src->shared->size); - if (cmp<0) { + if(cmp < 0) rt = md; - } else if (cmp>0) { - lt = md+1; - } else { + else if(cmp > 0) + lt = md + 1; + else break; - } - } - if (lt>=rt) { + } /* end while */ + if(lt >= rt) { except_ret = H5T_CONV_UNHANDLED; if(cb_struct.func) { /*If user's exception handler is present, use it*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, @@ -2841,23 +2848,24 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDmemset(d, 0xff, dst->shared->size); } else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") - } else { + } /* end if */ + else { HDmemcpy(d, dst->shared->u.enumer.value+priv->src2dst[md]*dst->shared->size, dst->shared->size); - } + } /* end else */ } } break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_enum() */ /*------------------------------------------------------------------------- @@ -2930,7 +2938,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, FUNC_ENTER_NOAPI(H5T_conv_vlen, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: /* * First, determine if this conversion function applies to the @@ -2940,9 +2948,11 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * conversion path. */ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - HDassert(H5T_VLEN == src->shared->type); - HDassert(H5T_VLEN == dst->shared->type); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_VLEN != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype") + if(H5T_VLEN != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype") /* Variable-length types don't need a background buffer */ cdata->need_bkg = H5T_BKG_NO; @@ -3331,8 +3341,8 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } /* end switch */ + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: /* Release the background buffer, if we have one */ @@ -3340,7 +3350,7 @@ done: bkg_buf = H5FL_BLK_FREE(array_seq, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_conv_array() */ +} /* end H5T_conv_array() */ /*------------------------------------------------------------------------- @@ -3396,19 +3406,16 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, FUNC_ENTER_NOAPI(H5T_conv_i_i, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: - if (NULL==(src=(H5T_t *)H5I_object(src_id)) || - NULL==(dst=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - if (H5T_ORDER_LE!=src->shared->u.atomic.order && - H5T_ORDER_BE!=src->shared->u.atomic.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (H5T_ORDER_LE!=dst->shared->u.atomic.order && - H5T_ORDER_BE!=dst->shared->u.atomic.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (dst->shared->size>sizeof dbuf) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_ORDER_LE != src->shared->u.atomic.order && H5T_ORDER_BE != src->shared->u.atomic.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(H5T_ORDER_LE != dst->shared->u.atomic.order && H5T_ORDER_BE != dst->shared->u.atomic.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(dst->shared->size > sizeof dbuf) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") cdata->need_bkg = H5T_BKG_NO; break; @@ -3417,9 +3424,8 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the datatypes */ - if (NULL==(src=(H5T_t *)H5I_object(src_id)) || - NULL==(dst=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* * Do we process the values from beginning to end or vice versa? Also, @@ -3441,18 +3447,18 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, double olap_d = HDceil((double)(src->shared->size)/ (double)(dst->shared->size-src->shared->size)); olap = (size_t)olap_d; - sp = (uint8_t*)buf + (nelmts-1) * src->shared->size; - dp = (uint8_t*)buf + (nelmts-1) * dst->shared->size; + sp = (uint8_t*)buf + (nelmts - 1) * src->shared->size; + dp = (uint8_t*)buf + (nelmts - 1) * dst->shared->size; direction = -1; } /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + if(H5P_get(plist,H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t*)H5MM_calloc(src->shared->size); @@ -3741,14 +3747,14 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: if(src_rev) H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_i_i() */ /*------------------------------------------------------------------------- @@ -3783,7 +3789,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, +H5T_conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t dxpl_id) { @@ -3799,44 +3805,43 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t olap; /*num overlapping elements */ ssize_t bitno = 0; /*bit number */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev=NULL; /*order-reversed source buffer */ + uint8_t *src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ /* Conversion-related variables */ hssize_t expo; /*exponent */ hssize_t expo_max; /*maximum possible dst exponent */ - size_t msize=0; /*useful size of mantissa in src*/ + size_t msize = 0; /*useful size of mantissa in src*/ size_t mpos; /*offset to useful mant is src */ hssize_t sign; /*source sign bit value */ size_t mrsh; /*amount to right shift mantissa*/ - hbool_t carry=0; /*carry after rounding mantissa */ + hbool_t carry = 0; /*carry after rounding mantissa */ size_t i; /*miscellaneous counters */ size_t implied; /*destination implied bits */ - hbool_t denormalized=FALSE; /*is either source or destination denormalized?*/ + hbool_t denormalized = FALSE; /*is either source or destination denormalized?*/ H5P_genplist_t *plist; /*property list pointer */ - H5T_conv_cb_t cb_struct={NULL, NULL}; /*conversion callback structure */ + H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */ H5T_conv_ret_t except_ret; /*return of callback function */ hbool_t reverse; /*if reverse the order of destination */ - herr_t ret_value=SUCCEED; /*return value */ + herr_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_NOAPI(H5T_conv_f_f, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: - if (NULL==(src_p=(H5T_t *)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; - if (H5T_ORDER_LE!=src.order && H5T_ORDER_BE!=src.order && H5T_ORDER_VAX!=src.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (H5T_ORDER_LE!=dst.order && H5T_ORDER_BE!=dst.order && H5T_ORDER_VAX!=dst.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (dst_p->shared->size>sizeof(dbuf)) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); - if (8*sizeof(expo)-1<src.u.f.esize || 8*sizeof(expo)-1<dst.u.f.esize) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); + if(H5T_ORDER_LE != src.order && H5T_ORDER_BE != src.order && H5T_ORDER_VAX != src.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(H5T_ORDER_LE != dst.order && H5T_ORDER_BE != dst.order && H5T_ORDER_VAX != dst.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(dst_p->shared->size > sizeof(dbuf)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + if(8 * sizeof(expo) - 1 < src.u.f.esize || 8 * sizeof(expo) - 1 < dst.u.f.esize) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") cdata->need_bkg = H5T_BKG_NO; break; @@ -3845,9 +3850,8 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the datatypes */ - if (NULL==(src_p=(H5T_t *)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; expo_max = ((hssize_t)1 << dst.u.f.esize) - 1; @@ -3878,11 +3882,11 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + if(H5P_get(plist,H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t*)H5MM_calloc(src_p->shared->size); @@ -4319,15 +4323,15 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: if(src_rev) H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_f_f() */ /*------------------------------------------------------------------------- @@ -4365,22 +4369,21 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, FUNC_ENTER_NOAPI(H5T_conv_s_s, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: - if (NULL==(src=(H5T_t *)H5I_object(src_id)) || - NULL==(dst=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - if (8*src->shared->size != src->shared->u.atomic.prec || 8*dst->shared->size != dst->shared->u.atomic.prec) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision"); - if (0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad offset"); - if (H5T_CSET_ASCII != src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != src->shared->u.atomic.u.s.cset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad source character set"); - if (H5T_CSET_ASCII != dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != dst->shared->u.atomic.u.s.cset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad destination character set"); - if (src->shared->u.atomic.u.s.pad<0 || src->shared->u.atomic.u.s.pad>=H5T_NPAD || - dst->shared->u.atomic.u.s.pad<0 || dst->shared->u.atomic.u.s.pad>=H5T_NPAD) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding"); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(8 * src->shared->size != src->shared->u.atomic.prec || 8 * dst->shared->size != dst->shared->u.atomic.prec) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision") + if(0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad offset") + if(H5T_CSET_ASCII != src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != src->shared->u.atomic.u.s.cset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad source character set") + if(H5T_CSET_ASCII != dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != dst->shared->u.atomic.u.s.cset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad destination character set") + if(src->shared->u.atomic.u.s.pad < 0 || src->shared->u.atomic.u.s.pad >= H5T_NPAD || + dst->shared->u.atomic.u.s.pad < 0 || dst->shared->u.atomic.u.s.pad >= H5T_NPAD) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding") cdata->need_bkg = H5T_BKG_NO; break; @@ -4389,9 +4392,8 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the datatypes */ - if (NULL==(src=(H5T_t *)H5I_object(src_id)) || - NULL==(dst=(H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* * Do we process the values from beginning to end or vice versa? Also, @@ -4422,22 +4424,22 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* Allocate the overlap buffer */ - if (NULL==(dbuf=(uint8_t *)H5MM_malloc(dst->shared->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion"); + if(NULL == (dbuf = (uint8_t *)H5MM_malloc(dst->shared->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion") /* The conversion loop. */ - for (elmtno=0; elmtno<nelmts; elmtno++) { + for(elmtno = 0; elmtno < nelmts; elmtno++) { /* * If the source and destination buffers overlap then use a * temporary buffer for the destination. */ - if (direction>0) { + if(direction > 0) { s = sp; - d = elmtno<olap ? dbuf : dp; + d = elmtno < olap ? dbuf : dp; } else { s = sp; - d = elmtno+olap >= nelmts ? dbuf : dp; + d = elmtno + olap >= nelmts ? dbuf : dp; } #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ @@ -4453,7 +4455,7 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, #endif /* Copy characters from source to destination */ - switch (src->shared->u.atomic.u.s.pad) { + switch(src->shared->u.atomic.u.s.pad) { case H5T_STR_NULLTERM: for (nchars=0; nchars<dst->shared->size && nchars<src->shared->size && s[nchars]; @@ -4493,24 +4495,24 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_STR_RESERVED_14: case H5T_STR_RESERVED_15: case H5T_STR_ERROR: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source string padding method not supported"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source string padding method not supported") + } /* end switch */ /* Terminate or pad the destination */ - switch (dst->shared->u.atomic.u.s.pad) { + switch(dst->shared->u.atomic.u.s.pad) { case H5T_STR_NULLTERM: - while (nchars<dst->shared->size) + while(nchars < dst->shared->size) d[nchars++] = '\0'; - d[dst->shared->size-1] = '\0'; + d[dst->shared->size - 1] = '\0'; break; case H5T_STR_NULLPAD: - while (nchars<dst->shared->size) + while(nchars < dst->shared->size) d[nchars++] = '\0'; break; case H5T_STR_SPACEPAD: - while (nchars<dst->shared->size) + while(nchars < dst->shared->size) d[nchars++] = ' '; break; @@ -4528,8 +4530,8 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_STR_RESERVED_14: case H5T_STR_RESERVED_15: case H5T_STR_ERROR: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination string padding method not supported"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination string padding method not supported") + } /* end switch */ /* * If we used a temporary buffer for the destination then we @@ -4544,17 +4546,18 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, sp += direction * src->shared->size; dp += direction * dst->shared->size; } - } + } /* end for */ break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown converson command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown converson command") + } /* end switch */ done: H5MM_xfree(dbuf); + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_s_s() */ /*------------------------------------------------------------------------- @@ -9714,7 +9717,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, +H5T_conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t dxpl_id) { @@ -9750,19 +9753,18 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, FUNC_ENTER_NOAPI(H5T_conv_f_i, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: - if (NULL==(src_p=(H5T_t*)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t*)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t*)H5I_object(src_id)) || NULL == (dst_p = (H5T_t*)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; - if (H5T_ORDER_LE!=src.order && H5T_ORDER_BE!=src.order && H5T_ORDER_VAX!=src.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (dst_p->shared->size>sizeof(dbuf)) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); - if (8*sizeof(expo)-1<src.u.f.esize) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); + if(H5T_ORDER_LE != src.order && H5T_ORDER_BE != src.order && H5T_ORDER_VAX != src.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(dst_p->shared->size > sizeof(dbuf)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + if(8 * sizeof(expo) - 1 < src.u.f.esize) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") cdata->need_bkg = H5T_BKG_NO; break; @@ -9771,9 +9773,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the datatypes */ - if (NULL==(src_p=(H5T_t*)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t*)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t*)H5I_object(src_id)) || NULL == (dst_p = (H5T_t*)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -9782,7 +9783,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * how many of the elements have the source and destination areas * overlapping? */ - if (src_p->shared->size==dst_p->shared->size || buf_stride) { + if(src_p->shared->size==dst_p->shared->size || buf_stride) { sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; @@ -9809,11 +9810,11 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Get the plist structure. Do I need to close it? */ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ if(H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t*)H5MM_calloc(src_p->shared->size); @@ -10265,16 +10266,17 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: if(int_buf) H5MM_xfree(int_buf); if(src_rev) H5MM_free(src_rev); + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_f_i() */ /*------------------------------------------------------------------------- @@ -10302,7 +10304,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, +H5T_conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t dxpl_id) { @@ -10317,7 +10319,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t tsize; /*type size for swapping bytes */ size_t olap; /*num overlapping elements */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev=NULL; /*order-reversed source buffer */ + uint8_t *src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ @@ -10327,32 +10329,31 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t sign; /*source sign bit value */ hbool_t is_max_neg; /*source is maximal negative value*/ hbool_t do_round; /*whether there is roundup */ - uint8_t *int_buf=NULL; /*buffer for temporary value */ + uint8_t *int_buf = NULL; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ size_t i; /*miscellaneous counters */ size_t first; /*first bit(MSB) in an integer */ ssize_t sfirst; /*a signed version of `first' */ H5P_genplist_t *plist; /*Property list pointer */ - H5T_conv_cb_t cb_struct={NULL, NULL}; /*conversion callback structure */ + H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */ H5T_conv_ret_t except_ret; /*return of callback function */ hbool_t reverse; /*if reverse the order of destination */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_conv_i_f, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: - if (NULL==(src_p=(H5T_t*)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t*)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; - if (H5T_ORDER_LE!=dst.order && H5T_ORDER_BE!=dst.order && H5T_ORDER_VAX!=dst.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (dst_p->shared->size>sizeof(dbuf)) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); - if (8*sizeof(expo)-1<src.u.f.esize) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); + if(H5T_ORDER_LE != dst.order && H5T_ORDER_BE != dst.order && H5T_ORDER_VAX != dst.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(dst_p->shared->size > sizeof(dbuf)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + if(8 * sizeof(expo) - 1 < src.u.f.esize) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") cdata->need_bkg = H5T_BKG_NO; break; @@ -10361,9 +10362,8 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the datatypes */ - if (NULL==(src_p=(H5T_t*)H5I_object(src_id)) || - NULL==(dst_p=(H5T_t*)H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -10399,11 +10399,11 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + if(H5P_get(plist,H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t*)H5MM_calloc(src_p->shared->size); @@ -10696,16 +10696,17 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: if(int_buf) H5MM_xfree(int_buf); if(src_rev) H5MM_free(src_rev); + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_conv_i_f() */ /*------------------------------------------------------------------------- diff --git a/src/H5Znbit.c b/src/H5Znbit.c index bcdd549..263b2cd 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -1365,17 +1365,17 @@ static void H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offs static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t *buffer_size, const unsigned parms[]) { - /* i: index of data, j: index of buffer, + /* i: index of data, new_size: index of buffer, buf_len: number of bits to be filled in current byte */ - size_t i, j, size; + size_t i, size; + size_t new_size = 0; int buf_len; parms_atomic p; /* must initialize buffer to be zeros */ - for(j = 0; j < *buffer_size; j++) buffer[j] = 0; + HDmemset(buffer, 0, *buffer_size); /* initialization before the loop */ - j = 0; buf_len = sizeof(unsigned char) * 8; switch(parms[3]) { @@ -1387,14 +1387,14 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c p.offset = parms[7]; for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_atomic(data, i*p.size, buffer, &j, &buf_len, p); + H5Z_nbit_compress_one_atomic(data, i*p.size, buffer, &new_size, &buf_len, p); } break; case H5Z_NBIT_ARRAY: size = parms[4]; parms_index = 4; for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_array(data, i*size, buffer, &j, &buf_len, parms); + H5Z_nbit_compress_one_array(data, i*size, buffer, &new_size, &buf_len, parms); parms_index = 4; } break; @@ -1402,10 +1402,14 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c size = parms[4]; parms_index = 4; for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_compound(data, i*size, buffer, &j, &buf_len, parms); + H5Z_nbit_compress_one_compound(data, i*size, buffer, &new_size, &buf_len, parms); parms_index = 4; } break; } /* end switch */ + + /* Update the size to the new value after compression. If there are any bits hanging over in + * the last byte, increment the value by 1. */ + *buffer_size = new_size + 1; } #endif /* H5_HAVE_FILTER_NBIT */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index eb3c6e6..c524141 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -53,16 +53,16 @@ static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size); static unsigned H5Z_scaleoffset_log2(unsigned long long num); static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, - enum H5Z_scaleoffset_t type, unsigned filavail, const void *filval_buf, + enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval); static void H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, - enum H5Z_scaleoffset_t type, unsigned filavail, const void *filval_buf, + enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval); static herr_t H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, - enum H5Z_scaleoffset_t type, unsigned filavail, const void *filval_buf, + enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval, double D_val); static herr_t H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, - enum H5Z_scaleoffset_t type, unsigned filavail, const void *filval_buf, + enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval, double D_val); static void H5Z_scaleoffset_next_byte(size_t *j, unsigned *buf_len); static void H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, @@ -119,24 +119,71 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Store fill value in cd_values[] */ #define H5Z_scaleoffset_save_filval(type, cd_values, fill_val) \ { \ - unsigned char *fill_parm; /* Pointer to fill value parameter */ \ + unsigned _i = H5Z_SCALEOFFSET_PARM_FILVAL; /* index into cd_values */ \ + uint32_t _cd_value; /* Current cd_value */ \ + char *_fv_p; /* Pointer to current byte in fill_val */ \ + size_t _copy_size = 4; /* # of bytes to copy this iteration */ \ + size_t _size_rem = sizeof(type); /* # of bytes left to copy to cd_values */ \ \ /* Store the fill value as the last entry in cd_values[] \ * Store byte by byte from least significant byte to most significant byte \ * Plenty of space left for the fill value (from index 8 to 19) \ + * H5O_pline_encode will byte-swap each individual cd value, but we still \ + * need to swap the cd values as a whole if we are on a BE machine. Note \ + * that we need to make sure to put the data only in the lowest 4 bytes of \ + * each, if sizeof(unsigned) > 4. \ */ \ - fill_parm = (unsigned char *)&cd_values[H5Z_SCALEOFFSET_PARM_FILVAL]; \ - if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(fill_parm, &fill_val, sizeof(type)); \ - else { \ - unsigned char *fill_buf; /* Pointer to fill value in memory */ \ - unsigned u; /* index */ \ + if(H5T_native_order_g == H5T_ORDER_LE) { \ + _fv_p = (char *)&(fill_val); \ + /* Copy 4 bytes at a time to each cd value */ \ + do { \ + if(_size_rem < 4) { \ + /* Amount left to copy is smaller than a cd_value, adjust copy \ + * size and initialize cd_value as it will not be fully \ + * overwritten */ \ + _copy_size = _size_rem; \ + _cd_value = (uint32_t)0; \ + } /* end if */ \ + \ + /* Copy the value */ \ + HDmemcpy(&_cd_value, _fv_p, _copy_size); \ + (cd_values)[_i] = (unsigned)_cd_value; \ \ + /* Next field */ \ + _i++; \ + _fv_p += _copy_size; \ + _size_rem -= _copy_size; \ + } while(_size_rem); \ + } /* end if */ \ + else { \ HDassert(H5T_native_order_g == H5T_ORDER_BE); \ \ - fill_buf = (unsigned char *)&fill_val; \ - for(u = 0; u < sizeof(type); u++) \ - fill_parm[u] = fill_buf[sizeof(type) - (u + 1)]; \ + /* Copy 4 bytes at a time to each cd value, but start at the end \ + * (highest address) of fill_val */ \ + _fv_p = ((char *)&(fill_val)) + sizeof(type) - MIN(4, _size_rem); \ + while(_size_rem >= 4) { \ + /* Copy the value */ \ + HDmemcpy(&_cd_value, _fv_p, _copy_size); \ + (cd_values)[_i] = (unsigned)_cd_value; \ + \ + /* Next field */ \ + _i++; \ + _size_rem -= 4; \ + if(_size_rem >= 4) \ + _fv_p -= 4; \ + else \ + _fv_p -= _size_rem; \ + } /* end while */ \ + \ + HDassert(_fv_p == (char *)&(fill_val)); \ + if(_size_rem) { \ + /* Amount left to copy is smaller than a cd_value, initialize \ + * _cd_value as it will not be fully overwritten and copy to the end \ + * of _cd value as it is BE. */ \ + _cd_value = (uint32_t)0; \ + HDmemcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \ + (cd_values)[_i] = (unsigned)_cd_value; \ + } /* end if */ \ } /* end else */ \ } @@ -180,7 +227,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ \ /* Store the fill value as the last entry in cd_values[] */ \ - ((unsigned char *)&cd_values[H5Z_SCALEOFFSET_PARM_FILVAL])[0] = (unsigned char)fill_val; \ + (cd_values)[H5Z_SCALEOFFSET_PARM_FILVAL] = (unsigned)((unsigned char)fill_val); \ } /* Set the fill value parameter in cd_values[] for floating-point type */ @@ -199,33 +246,78 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Get the fill value for integer type */ -#define H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ -{ \ - const unsigned char *fill_parm; /* Pointer to fill value parameter */ \ - \ - /* retrieve fill value from corresponding positions of cd_values[] \ - * retrieve them corresponding to how they are stored \ - */ \ - fill_parm = (const unsigned char *)filval_buf; \ - if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(&filval, fill_parm, sizeof(type)); \ - else { \ - unsigned char *fill_buf; /* Pointer to fill value in memory */ \ - unsigned u; /* index */ \ - \ - HDassert(H5T_native_order_g == H5T_ORDER_BE); \ - \ - fill_buf = (unsigned char *)&filval; \ - for(u = 0; u < sizeof(type); u++) \ - fill_buf[u] = fill_parm[sizeof(type) - (u + 1)]; \ - } /* end else */ \ +#define H5Z_scaleoffset_get_filval_1(type, cd_values, fill_val) \ +{ \ + unsigned _i = H5Z_SCALEOFFSET_PARM_FILVAL; /* index into cd_values */ \ + uint32_t _cd_value; /* Current cd_value */ \ + char *_fv_p; /* Pointer to current byte in fill_val */ \ + size_t _copy_size = 4; /* # of bytes to copy this iteration */ \ + size_t _size_rem = sizeof(type); /* # of bytes left to copy to filval */ \ + \ + /* Retrieve the fill value from the last entry in cd_values[] \ + * Store byte by byte from least significant byte to most significant byte \ + * Plenty of space left for the fill value (from index 8 to 19) \ + * H5O_pline_encode will byte-swap each individual cd value, but we still \ + * need to swap the cd values as a whole if we are on a BE machine. Note \ + * that we need to make sure to put the data only in the lowest 4 bytes of \ + * each, if sizeof(unsigned) > 4. \ + */ \ + if(H5T_native_order_g == H5T_ORDER_LE) { \ + _fv_p = (char *)&(fill_val); \ + /* Copy 4 bytes at a time to each cd value */ \ + do { \ + if(_size_rem < 4) \ + /* Amount left to copy is smaller than a cd_value, adjust copy \ + * size and initialize cd_value as it will not be fully \ + * overwritten */ \ + _copy_size = _size_rem; \ + \ + /* Copy the value */ \ + _cd_value = (uint32_t)(cd_values)[_i]; \ + HDmemcpy(_fv_p, &_cd_value, _copy_size); \ + \ + /* Next field */ \ + _i++; \ + _fv_p += _copy_size; \ + _size_rem -= _copy_size; \ + } while(_size_rem); \ + } /* end if */ \ + else { \ + HDassert(H5T_native_order_g == H5T_ORDER_BE); \ + \ + /* Copy 4 bytes at a time to each cd value, but start at the end \ + * (highest address) of fill_val */ \ + _fv_p = ((char *)&(fill_val)) + sizeof(type) - MIN(4, _size_rem); \ + while(_size_rem >= 4) { \ + /* Copy the value */ \ + _cd_value = (uint32_t)(cd_values)[_i]; \ + HDmemcpy(_fv_p, &_cd_value, _copy_size); \ + \ + /* Next field */ \ + _i++; \ + _size_rem -= 4; \ + if(_size_rem >=4) \ + _fv_p -= 4; \ + else \ + _fv_p -= _size_rem; \ + } /* end while */ \ + \ + HDassert(_fv_p == (char *)&(fill_val)); \ + if(_size_rem) { \ + /* Amount left to copy is smaller than a cd_value, initialize \ + * _cd_value as it will not be fully overwritten and copy to the end \ + * of _cd value as it is BE. */ \ + _cd_value = (uint32_t)(cd_values)[_i]; \ + HDmemcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \ + } /* end if */ \ + } /* end else */ \ } /* Get the fill value for floating-point type */ -#define H5Z_scaleoffset_get_filval_2(type, filval_buf, filval) \ +#define H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ { \ if(sizeof(type) <= sizeof(long long)) \ - H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval) \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -258,7 +350,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) i++; \ if(i < d_nelmts) min = max = buf[i]; \ for(; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ continue; /* ignore fill value */ \ if(buf[i] > max) max = buf[i]; \ if(buf[i] < min) min = buf[i]; \ @@ -321,13 +413,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Precompress for unsigned integer type */ -#define H5Z_scaleoffset_precompress_1(type, data, d_nelmts, filavail, filval_buf, minbits, minval)\ +#define H5Z_scaleoffset_precompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval)\ { \ type *buf = (type *)data, min = 0, max = 0, span, filval = 0; \ unsigned i; \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval) \ if(*minbits == H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ @@ -354,13 +446,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Precompress for signed integer type */ -#define H5Z_scaleoffset_precompress_2(type, data, d_nelmts, filavail, filval_buf, minbits, minval)\ +#define H5Z_scaleoffset_precompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval)\ { \ type *buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned type span; unsigned i; \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval) \ if(*minbits == H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ @@ -423,15 +515,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -439,38 +531,33 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Save the minimum value for floating-point type */ #define H5Z_scaleoffset_save_min(i, type, minval, min) \ { \ - if(sizeof(type) <= sizeof(long long)) { \ - unsigned char *min_parm; /* Pointer to min value parameter */ \ - \ - min_parm = (unsigned char *)minval; \ + if(sizeof(type) <= sizeof(long long)) \ + /* Save min value to corresponding position \ + * byte-order will be swapped as appropriate, but be sure to \ + * account for offset in BE if sizes differ \ + */ \ if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(min_parm, &min, sizeof(type)); \ + HDmemcpy(minval, &min, sizeof(type)); \ else { \ - unsigned char *min_buf; /* Pointer to min value in memory */ \ - unsigned u; /* index */ \ - \ HDassert(H5T_native_order_g == H5T_ORDER_BE); \ - \ - min_buf = (unsigned char *)&min; \ - for(u = 0; u < sizeof(type); u++) \ - min_parm[u] = min_buf[sizeof(type) - (u + 1)]; \ + HDmemcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \ + &min, sizeof(type)); \ } /* end else */ \ - } /* end if */ \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Precompress for floating-point type using variable-minimum-bits method */ -#define H5Z_scaleoffset_precompress_3(type, data, d_nelmts, filavail, filval_buf, \ +#define H5Z_scaleoffset_precompress_3(type, data, d_nelmts, filavail, cd_values, \ minbits, minval, D_val) \ { \ - type *buf = (type *)data, min = 0, max = 0, filval = 0; \ + type *buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned long long span; \ unsigned i; \ \ *minval = 0; \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_2(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ @@ -489,12 +576,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Postdecompress for unsigned integer type */ -#define H5Z_scaleoffset_postdecompress_1(type, data, d_nelmts, filavail, filval_buf, minbits, minval)\ +#define H5Z_scaleoffset_postdecompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval)\ { \ type *buf = (type *)data, filval = 0; unsigned i; \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((buf[i] == (((type)1 << minbits) - 1)) ? filval : (buf[i] + minval)); \ } else /* fill value undefined */ \ @@ -502,13 +589,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Postdecompress for signed integer type */ -#define H5Z_scaleoffset_postdecompress_2(type, data, d_nelmts, filavail, filval_buf, minbits, minval)\ +#define H5Z_scaleoffset_postdecompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval)\ { \ type *buf = (type *)data, filval = 0; \ unsigned i; \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)(((unsigned type)buf[i] == (((unsigned type)1 << minbits) - 1)) ? filval : (buf[i] + minval));\ } else /* fill value undefined */ \ @@ -519,26 +606,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Retrive minimum value of floating-point type */ #define H5Z_scaleoffset_get_min(type, minval, min) \ { \ - if(sizeof(type) <= sizeof(long long)) { \ - const unsigned char *min_parm; /* Pointer to min value parameter */ \ - \ - /* retrieve min value from corresponding positions \ - * retrieve them corresponding to how they are stored \ + if(sizeof(type) <= sizeof(long long)) \ + /* retrieve min value from corresponding position \ + * byte-order has already been swapped as appropriate, but be sure to \ + * account for offset in BE if sizes differ \ */ \ - min_parm = (const unsigned char *)&minval; \ if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(&min, min_parm, sizeof(type)); \ + HDmemcpy(&min, &minval, sizeof(type)); \ else { \ - unsigned char *min_buf; /* Pointer to min value in memory */ \ - unsigned u; /* index */ \ - \ HDassert(H5T_native_order_g == H5T_ORDER_BE); \ - \ - min_buf = (unsigned char *)&min; \ - for(u = 0; u < sizeof(type); u++) \ - min_buf[u] = min_parm[sizeof(type) - (u + 1)]; \ + HDmemcpy(&min, ((char *)&minval) + (sizeof(long long) \ + - sizeof(type)), sizeof(type)); \ } /* end else */ \ - } /* end if */ \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -579,7 +658,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Postdecompress for floating-point type using variable-minimum-bits method */ -#define H5Z_scaleoffset_postdecompress_3(type, data, d_nelmts, filavail, filval_buf, \ +#define H5Z_scaleoffset_postdecompress_3(type, data, d_nelmts, filavail, cd_values, \ minbits, minval, D_val) \ { \ type *buf = (type *)data, filval = 0, min = 0; \ @@ -588,7 +667,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_min(type, minval, min) \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_2(type, filval_buf, filval) \ + H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_modify_3(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ } else /* fill value undefined */ \ H5Z_scaleoffset_modify_4(i, type, buf, d_nelmts, min, D_val) \ @@ -1125,12 +1204,12 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* postprocess after decompression */ if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) H5Z_scaleoffset_postdecompress_i(outbuf, d_nelmts, type, filavail, - &cd_values[H5Z_SCALEOFFSET_PARM_FILVAL], minbits, minval); + cd_values, minbits, minval); if(dtype_class==H5Z_SCALEOFFSET_CLS_FLOAT) if(scale_type==0) { /* variable-minimum-bits method */ if(H5Z_scaleoffset_postdecompress_fd(outbuf, d_nelmts, type, filavail, - &cd_values[H5Z_SCALEOFFSET_PARM_FILVAL], minbits, minval, D_val)==FAIL) + cd_values, minbits, minval, D_val)==FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "post-decompression failed") } @@ -1153,12 +1232,12 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* preprocess before compression */ if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) H5Z_scaleoffset_precompress_i(*buf, d_nelmts, type, filavail, - &cd_values[H5Z_SCALEOFFSET_PARM_FILVAL], &minbits, &minval); + cd_values, &minbits, &minval); if(dtype_class==H5Z_SCALEOFFSET_CLS_FLOAT) if(scale_type==0) { /* variable-minimum-bits method */ if(H5Z_scaleoffset_precompress_fd(*buf, d_nelmts, type, filavail, - &cd_values[H5Z_SCALEOFFSET_PARM_FILVAL], &minbits, &minval, D_val)==FAIL) + cd_values, &minbits, &minval, D_val)==FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "pre-compression failed") } @@ -1308,30 +1387,30 @@ H5Z_scaleoffset_log2(unsigned long long num) /* precompress for integer type */ static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, - unsigned filavail, const void *filval_buf, uint32_t *minbits, unsigned long long *minval) + unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval) { if(type == t_uchar) H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_ushort) H5Z_scaleoffset_precompress_1(unsigned short, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_uint) H5Z_scaleoffset_precompress_1(unsigned int, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_ulong) H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_ulong_long) H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_schar) { signed char *buf = (signed char *)data, min = 0, max = 0, filval = 0; unsigned char span; unsigned i; if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ - H5Z_scaleoffset_get_filval_1(signed char, filval_buf, filval); + H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval); if(*minbits == H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) if((unsigned char)(max - min) > (unsigned char)(~(unsigned char)0 - 2)) { @@ -1365,46 +1444,46 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse } else if(type == t_short) H5Z_scaleoffset_precompress_2(short, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_int) H5Z_scaleoffset_precompress_2(int, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_long) H5Z_scaleoffset_precompress_2(long, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) else if(type == t_long_long) H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, - filavail, filval_buf, minbits, minval) + filavail, cd_values, minbits, minval) } /* postdecompress for integer type */ static void H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, - unsigned filavail, const void *filval_buf, uint32_t minbits, unsigned long long minval) + unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval) { long long sminval = *(long long*)&minval; /* for signed integer types */ if(type == t_uchar) H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, - filval_buf, minbits, minval) + cd_values, minbits, minval) else if(type == t_ushort) H5Z_scaleoffset_postdecompress_1(unsigned short, data, d_nelmts, filavail, - filval_buf, minbits, minval) + cd_values, minbits, minval) else if(type == t_uint) H5Z_scaleoffset_postdecompress_1(unsigned int, data, d_nelmts, filavail, - filval_buf, minbits, minval) + cd_values, minbits, minval) else if(type == t_ulong) H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, - filval_buf, minbits, minval) + cd_values, minbits, minval) else if(type == t_ulong_long) H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail, - filval_buf, minbits, minval) + cd_values, minbits, minval) else if(type == t_schar) { signed char *buf = (signed char *)data, filval = 0; unsigned i; if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ - H5Z_scaleoffset_get_filval_1(signed char, filval_buf, filval) + H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for(i = 0; i < d_nelmts; i++) buf[i] = (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval : (buf[i] + sminval)); } else /* fill value undefined */ @@ -1413,23 +1492,23 @@ H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleof } else if(type == t_short) H5Z_scaleoffset_postdecompress_2(short, data, d_nelmts, filavail, - filval_buf, minbits, sminval) + cd_values, minbits, sminval) else if(type == t_int) H5Z_scaleoffset_postdecompress_2(int, data, d_nelmts, filavail, - filval_buf, minbits, sminval) + cd_values, minbits, sminval) else if(type == t_long) H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, - filval_buf, minbits, sminval) + cd_values, minbits, sminval) else if(type == t_long_long) H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, - filval_buf, minbits, sminval) + cd_values, minbits, sminval) } /* precompress for floating-point type, variable-minimum-bits method success: non-negative, failure: negative 4/15/05 */ static herr_t H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, - unsigned filavail, const void *filval_buf, uint32_t *minbits, + unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval, double D_val) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1438,10 +1517,10 @@ H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffs if(type == t_float) H5Z_scaleoffset_precompress_3(float, data, d_nelmts, - filavail, filval_buf, minbits, minval, D_val) + filavail, cd_values, minbits, minval, D_val) else if(type == t_double) H5Z_scaleoffset_precompress_3(double, data, d_nelmts, - filavail, filval_buf, minbits, minval, D_val) + filavail, cd_values, minbits, minval, D_val) done: FUNC_LEAVE_NOAPI(ret_value) @@ -1451,7 +1530,7 @@ done: success: non-negative, failure: negative 4/15/05 */ static herr_t H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, - unsigned filavail, const void *filval_buf, uint32_t minbits, + unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval, double D_val) { long long sminval = (long long)minval; /* for signed integer types */ @@ -1461,10 +1540,10 @@ H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleo if(type == t_float) H5Z_scaleoffset_postdecompress_3(float, data, d_nelmts, filavail, - filval_buf, minbits, sminval, D_val) + cd_values, minbits, sminval, D_val) else if(type == t_double) H5Z_scaleoffset_postdecompress_3(double, data, d_nelmts, filavail, - filval_buf, minbits, sminval, D_val) + cd_values, minbits, sminval, D_val) done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index dbd8d94..fc0b467 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -235,7 +235,7 @@ #define H5_FCDLLVAR extern #endif /* H5_FCDLL */ -#if defined(hdf5_f90Ctest_EXPORTS) +#if defined(hdf5_test_f90cstub_EXPORTS) #if defined (_MSC_VER) /* MSVC Compiler Case */ #define H5_FCTESTDLL __declspec(dllexport) #define H5_FCTESTDLLVAR extern __declspec(dllexport) @@ -281,10 +281,26 @@ #define HDF5_HL_F90CSTUBDLLVAR extern #endif /* HDF5_HL_F90CSTUBDLL */ +#elif defined(H5_BUILT_AS_STATIC_LIB) + #define H5_DLL + #define H5_HLDLL + #define H5_HLCPPDLL + #define HDF5_HL_F90CSTUBDLL + #define H5_DLLVAR extern + #define H5_DLLCPP + #define H5TEST_DLL + #define H5TEST_DLLVAR extern + #define H5TOOLS_DLL + #define H5TOOLS_DLLVAR extern + #define H5_FCDLL + #define H5_FCDLLVAR extern + #define H5_FCTESTDLL + #define H5_FCTESTDLLVAR extern + #else /* This is the original HDFGroup defined preprocessor code which should still work * with the VS projects that are maintained by "The HDF Group" - * This will be removed after the next release. + * The Visual Studio project files will not be supported in the next major release of 1.10. */ #if defined(_WIN32) diff --git a/src/H5config.h.in b/src/H5config.h.in index 3283893..c53ccca 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -435,6 +435,10 @@ values correctly. */ #undef LDOUBLE_TO_LLONG_ACCURATE +/* Define if your system converts long double to (unsigned) long values with + special algorithm. */ +#undef LDOUBLE_TO_LONG_SPECIAL + /* Define if your system can convert long double to unsigned int values correctly. */ #undef LDOUBLE_TO_UINT_ACCURATE @@ -446,6 +450,10 @@ values correctly. */ #undef LLONG_TO_LDOUBLE_CORRECT +/* Define if your system can convert (unsigned) long to long double values + with special algorithm. */ +#undef LONG_TO_LDOUBLE_SPECIAL + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR diff --git a/src/H5private.h b/src/H5private.h index f13ad84..9cebdaa 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -403,11 +403,6 @@ # error "nothing appropriate for int32_t" #endif -/* Definition of uint32_t was moved to H5public.h */ - -/* Definition of int64_t was moved to H5public.h */ -/* Definition of uint64_t was moved to H5public.h */ - /* * Maximum and minimum values. These should be defined in <limits.h> for the * most part. diff --git a/src/H5public.h b/src/H5public.h index 19791b3..1f835f7 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 76 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 80 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.76" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.80" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index d478e4c..fb37059 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -56,12 +56,7 @@ typedef __int64 h5_stat_size_t; #endif /* H5_HAVE_GETTIMEOFDAY */ #define HDgetdrive() _getdrive() #define HDlseek(F,O,W) _lseeki64(F,O,W) -#if !defined(__MWERKS__) -# /*MSVC*/ -# define HDoff_t __int64 -#else -# define HDoff_t off_t -#endif +#define HDoff_t __int64 #define HDmemset(X,C,Z) memset((void*)(X),C,Z) #define HDmkdir(S,M) _mkdir(S) #define HDopen(S,F,M) _open(S,F|_O_BINARY,M) diff --git a/src/Makefile.in b/src/Makefile.in index f6a3a31..55e52ae 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -228,6 +228,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -289,6 +290,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -345,6 +347,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -455,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 66 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f59be26..98fffe0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,11 +22,9 @@ CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) ADD_LIBRARY (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS}) -IF (BUILD_SHARED_LIBS) - IF (MSVC) - TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") - ENDIF (MSVC) -ENDIF (BUILD_SHARED_LIBS) +IF (MSVC) + TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") +ENDIF (MSVC) TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) @@ -57,16 +55,17 @@ SET (HDF5_REFERENCE_FILES err_compat_2 error_test_1 error_test_2 + links_env.out ) FOREACH (ref_file ${HDF5_REFERENCE_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}") + SET (dest "${PROJECT_BINARY_DIR}/${ref_file}") #MESSAGE (STATUS " Copying ${h5_file}") ADD_CUSTOM_COMMAND ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} + COMMAND ${XLATE_UTILITY} + ARGS ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} -l3 ) ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) @@ -147,8 +146,7 @@ SET (testhdf5_SRCS #-- Adding test for testhdf5 ADD_EXECUTABLE (testhdf5 ${testhdf5_SRCS}) -H5_NAMING (testhdf5) -TARGET_WIN_PROPERTIES (testhdf5) +H5_NAMING (testhdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) @@ -161,14 +159,86 @@ ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) MACRO (ADD_H5_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - H5_NAMING (${file}) - TARGET_WIN_PROPERTIES (${file}) + H5_NAMING (${file} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>) ENDMACRO (ADD_H5_TEST file) +# Remove any output file left over from previous test run +ADD_TEST ( + NAME h5test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + cache_test.h5 + coord.h5 + dt_arith1.h5 + dt_arith2.h5 + dtransform.h5 + dtypes4.h5 + dtypes5.h5 + extlinks16A00000.h5 + extlinks16A00001.h5 + extlinks16A00002.h5 + extlinks16B-b.h5 + extlinks16B-g.h5 + extlinks16B-l.h5 + extlinks16B-r.h5 + extlinks16B-s.h5 + extlinks19B00000.h5 + extlinks19B00001.h5 + extlinks19B00002.h5 + extlinks19B00003.h5 + extlinks19B00004.h5 + extlinks19B00005.h5 + extlinks19B00006.h5 + extlinks19B00007.h5 + extlinks19B00008.h5 + extlinks19B00009.h5 + extlinks19B00010.h5 + extlinks19B00011.h5 + extlinks19B00012.h5 + extlinks19B00013.h5 + extlinks19B00014.h5 + extlinks19B00015.h5 + extlinks19B00016.h5 + extlinks19B00017.h5 + extlinks19B00018.h5 + extlinks19B00019.h5 + extlinks19B00020.h5 + extlinks19B00021.h5 + extlinks19B00022.h5 + extlinks19B00023.h5 + extlinks19B00024.h5 + extlinks19B00025.h5 + extlinks19B00026.h5 + extlinks19B00027.h5 + extlinks19B00028.h5 + fheap.h5 + objcopy_ext.h5 + sys_file1 + tattr.h5 + testmeta.h5 + tfile1.h5 + tfile2.h5 + tfile3.h5 + tfile4.h5 + tfile5.h5 + th5o_file + th5s1.h5 + th5s2.h5 + th5s3.h5 + tnullspace.h5 + tselect.h5 + tsohm.h5 + tsohm_dst.h5 + tsohm_src.h5 + tstint1.h5 + tstint2.h5 +) + SET (H5_TESTS + accum lheap ohdr stab @@ -212,21 +282,17 @@ SET (H5_TESTS earray btree2 fheap - error_test - err_compat + #error_test + #err_compat tcheck_version testmeta + #links_env ) FOREACH (test ${H5_TESTS}) ADD_H5_TEST(${test}) ENDFOREACH (test ${H5_TESTS}) -#-- Allow extra time for fheap to complete 30min -IF (WIN32) - SET_TESTS_PROPERTIES (fheap PROPERTIES TIMEOUT 2500) -ENDIF (WIN32) - ############################################################################## ############################################################################## @@ -236,24 +302,21 @@ ENDIF (WIN32) #-- Adding test for cache ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache) -TARGET_WIN_PROPERTIES (cache) +H5_NAMING (cache ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache COMMAND $<TARGET_FILE:cache>) #-- Adding test for cache_api ADD_EXECUTABLE (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache_api) -TARGET_WIN_PROPERTIES (cache_api) +H5_NAMING (cache_api ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) #-- Adding test for cache_tagging ADD_EXECUTABLE (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache_tagging) -TARGET_WIN_PROPERTIES (cache_tagging) +H5_NAMING (cache_tagging ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>) @@ -265,12 +328,62 @@ ADD_EXECUTABLE (ttsafe ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c ) -H5_NAMING (ttsafe) -TARGET_WIN_PROPERTIES (ttsafe) +H5_NAMING (ttsafe ${LIB_TYPE}) TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) +#-- Adding test for err_compat +IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + ADD_EXECUTABLE (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c) + H5_NAMING (err_compat ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + + ADD_TEST (NAME err_compat COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=err_compat.txt" + -D "TEST_REFERENCE=err_compat_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) +ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + +#-- Adding test for error_test +ADD_EXECUTABLE (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c) +H5_NAMING (error_test ${LIB_TYPE}) +TARGET_LINK_LIBRARIES (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + +ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:error_test>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" +) + +#-- Adding test for links_env +ADD_EXECUTABLE (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c) +H5_NAMING (links_env ${LIB_TYPE}) +TARGET_LINK_LIBRARIES (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + +ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:links_env>" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" + -D "TEST_ENV_VALUE:STRING=.:tmp" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=links_env.txt" + -D "TEST_REFERENCE=links_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" +) + IF (HDF5_TEST_VFD) SET (VFD_LIST @@ -281,13 +394,66 @@ IF (HDF5_TEST_VFD) multi family ) + + SET (H5_VFD_TESTS + testhdf5 + accum + lheap + ohdr + stab + gheap + cache + cache_api + cache_tagging + pool + hyperslab + istore + bittests + dt_arith + dtypes + cmpd_dset + filter_fail + extend + external + objcopy + links + unlink + big + mtime + fillval + mount + flush1 + flush2 + app_ref + enum + set_extent + ttsafe + getname + vfd + ntypes + dangle + dtransform + reserved + cross_read + freespace + mf + farray + earray + btree2 + #fheap + error_test + err_compat + tcheck_version + testmeta + links_env +) IF (DIRECT_VFD) SET (VFD_LIST ${VFD_LIST} direct) ENDIF (DIRECT_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) - FOREACH (test ${H5_TESTS}) + FOREACH (test ${H5_VFD_TESTS}) ADD_TEST ( NAME VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" @@ -295,10 +461,24 @@ IF (HDF5_TEST_VFD) -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${test}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + ) + ENDFOREACH (test ${H5_VFD_TESTS}) + IF (HDF5_TEST_FHEAP_VFD) + ADD_TEST ( + NAME VFD-${vfdname}-fheap + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:fheap>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=fheap" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) - ENDFOREACH (test ${H5_TESTS}) + ENDIF (HDF5_TEST_FHEAP_VFD) ENDMACRO (ADD_VFD_TEST) # Run test with different Virtual File Driver @@ -317,8 +497,7 @@ ENDIF (HDF5_TEST_VFD) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) MACRO (ADD_H5_GENERATOR genfile) ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - H5_NAMING (${genfile}) - TARGET_WIN_PROPERTIES (${genfile}) + H5_NAMING (${genfile} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ENDMACRO (ADD_H5_GENERATOR genfile) @@ -345,7 +524,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) FOREACH (gen ${H5_GENERATORS}) ADD_EXECUTABLE (${gen} ${HDF5_TEST_SOURCE_DIR}/${gen}.c) - H5_NAMING (${gen}) + H5_NAMING (${gen} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ENDFOREACH (gen ${H5_GENERATORS}) diff --git a/test/Makefile.am b/test/Makefile.am index cef0165..06c56f8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -24,9 +24,9 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh +TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh check_SCRIPTS = $(TEST_SCRIPT) -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) +SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) # These are our main targets. They should be listed in the order to be @@ -36,8 +36,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # These tests (fheap, btree2) are under development and are not used by # the library yet. Move them to the end so that their failure do not block # other current library code tests. -TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ - pool hyperslab istore bittests dt_arith \ +TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ + pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe \ @@ -50,7 +50,7 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ # 'make check' doesn't run them directly, so they are not included in TEST_PROG. # Also build testmeta, which is used for timings test. It builds quickly, # and this lets automake keep all its test programs in one place. -check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta +check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_env # These programs generate test files for the tests. They don't need to be @@ -104,7 +104,7 @@ flush2.chkexe_: flush1.chkexe_ # specifying a file prefix or low-level driver. Changing the file # prefix or low-level driver with environment variables will influence # the temporary file name in ways that the makefile is not aware of. -CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \ +CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ @@ -134,6 +134,6 @@ testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ tvlstr.c tvltypes.c # Temporary files. -DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh +DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh include $(top_srcdir)/config/conclude.am diff --git a/test/Makefile.in b/test/Makefile.in index 493a684..a734045 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -55,10 +55,11 @@ host_triplet = @host@ DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/testcheck_version.sh.in \ $(srcdir)/testerror.sh.in $(srcdir)/testlibinfo.sh.in \ - $(top_srcdir)/config/commence.am \ + $(srcdir)/testlinks_env.sh.in $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am COPYING check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \ - err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT) + err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT) \ + links_env$(EXEEXT) @BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2) TESTS = $(check_PROGRAMS) $(check_SCRIPTS) subdir = test @@ -69,7 +70,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir_str.h \ - testlibinfo.sh + testlibinfo.sh testlinks_env.sh CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libh5test_la_LIBADD = @@ -77,18 +78,18 @@ am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \ - cache_tagging$(EXEEXT) pool$(EXEEXT) hyperslab$(EXEEXT) \ - istore$(EXEEXT) bittests$(EXEEXT) dt_arith$(EXEEXT) \ - dtypes$(EXEEXT) dsets$(EXEEXT) cmpd_dset$(EXEEXT) \ - filter_fail$(EXEEXT) extend$(EXEEXT) external$(EXEEXT) \ - objcopy$(EXEEXT) links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) \ - mtime$(EXEEXT) fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \ - flush2$(EXEEXT) app_ref$(EXEEXT) enum$(EXEEXT) \ - set_extent$(EXEEXT) ttsafe$(EXEEXT) getname$(EXEEXT) \ - vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ - dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ - freespace$(EXEEXT) mf$(EXEEXT) farray$(EXEEXT) earray$(EXEEXT) \ - btree2$(EXEEXT) fheap$(EXEEXT) + cache_tagging$(EXEEXT) pool$(EXEEXT) accum$(EXEEXT) \ + hyperslab$(EXEEXT) istore$(EXEEXT) bittests$(EXEEXT) \ + dt_arith$(EXEEXT) dtypes$(EXEEXT) dsets$(EXEEXT) \ + cmpd_dset$(EXEEXT) filter_fail$(EXEEXT) extend$(EXEEXT) \ + external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \ + unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ + mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ + app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ + ttsafe$(EXEEXT) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \ + dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \ + cross_read$(EXEEXT) freespace$(EXEEXT) mf$(EXEEXT) \ + farray$(EXEEXT) earray$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \ gen_new_array$(EXEEXT) gen_new_fill$(EXEEXT) \ @@ -98,6 +99,10 @@ am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ space_overflow$(EXEEXT) gen_filespace$(EXEEXT) \ gen_specmetaread$(EXEEXT) gen_sizes_lheap$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) +accum_SOURCES = accum.c +accum_OBJECTS = accum.$(OBJEXT) +accum_LDADD = $(LDADD) +accum_DEPENDENCIES = libh5test.la $(LIBHDF5) app_ref_SOURCES = app_ref.c app_ref_OBJECTS = app_ref.$(OBJEXT) app_ref_LDADD = $(LDADD) @@ -294,6 +299,10 @@ links_SOURCES = links.c links_OBJECTS = links.$(OBJEXT) links_LDADD = $(LDADD) links_DEPENDENCIES = libh5test.la $(LIBHDF5) +links_env_SOURCES = links_env.c +links_env_OBJECTS = links_env.$(OBJEXT) +links_env_LDADD = $(LDADD) +links_env_DEPENDENCIES = libh5test.la $(LIBHDF5) mf_SOURCES = mf.c mf_OBJECTS = mf.$(OBJEXT) mf_LDADD = $(LDADD) @@ -385,21 +394,7 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \ - cache.c cache_api.c cache_tagging.c cmpd_dset.c cross_read.c \ - dangle.c dsets.c dt_arith.c dtransform.c dtypes.c earray.c \ - enum.c err_compat.c error_test.c extend.c external.c farray.c \ - fheap.c fillval.c filter_fail.c flush1.c flush2.c freespace.c \ - gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ - gen_filespace.c gen_filters.c gen_new_array.c gen_new_fill.c \ - gen_new_group.c gen_new_mtime.c gen_new_super.c \ - gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \ - gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c mf.c mount.c mtime.c ntypes.c \ - objcopy.c ohdr.c pool.c reserved.c set_extent.c \ - space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \ - testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c -DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \ +SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ earray.c enum.c err_compat.c error_test.c extend.c external.c \ @@ -409,10 +404,25 @@ DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \ gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \ gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \ gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c mf.c mount.c mtime.c ntypes.c \ - objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c +DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \ + bittests.c btree2.c cache.c cache_api.c cache_tagging.c \ + cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c \ + dtransform.c dtypes.c earray.c enum.c err_compat.c \ + error_test.c extend.c external.c farray.c fheap.c fillval.c \ + filter_fail.c flush1.c flush2.c freespace.c gen_bad_ohdr.c \ + gen_bogus.c gen_cross.c gen_deflate.c gen_filespace.c \ + gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \ + gen_new_mtime.c gen_new_super.c gen_noencoder.c \ + gen_nullspace.c gen_sizes_lheap.c gen_specmetaread.c \ + gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \ + links.c links_env.c mf.c mount.c mtime.c ntypes.c objcopy.c \ + ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \ + tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ + $(ttsafe_SOURCES) unlink.c vfd.c ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -464,6 +474,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -525,6 +536,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -581,6 +593,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -692,7 +705,7 @@ TRACE = perl $(top_srcdir)/bin/trace # specifying a file prefix or low-level driver. Changing the file # prefix or low-level driver with environment variables will influence # the temporary file name in ways that the makefile is not aware of. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \ +CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ compact_dataset.h5 dataset.h5 dset_offset.h5 \ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ @@ -718,9 +731,9 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \ INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh +TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh check_SCRIPTS = $(TEST_SCRIPT) -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) +SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. @@ -730,7 +743,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # the library yet. Move them to the end so that their failure do not block # other current library code tests. TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ - pool hyperslab istore bittests dt_arith \ + pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe \ @@ -773,7 +786,7 @@ testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ # Temporary files. -DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh +DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -832,6 +845,8 @@ H5srcdir_str.h: $(top_builddir)/config.status $(srcdir)/H5srcdir_str.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testlibinfo.sh: $(top_builddir)/config.status $(srcdir)/testlibinfo.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +testlinks_env.sh: $(top_builddir)/config.status $(srcdir)/testlinks_env.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @@ -861,6 +876,9 @@ clean-noinstPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +accum$(EXEEXT): $(accum_OBJECTS) $(accum_DEPENDENCIES) + @rm -f accum$(EXEEXT) + $(LINK) $(accum_OBJECTS) $(accum_LDADD) $(LIBS) app_ref$(EXEEXT): $(app_ref_OBJECTS) $(app_ref_DEPENDENCIES) @rm -f app_ref$(EXEEXT) $(LINK) $(app_ref_OBJECTS) $(app_ref_LDADD) $(LIBS) @@ -1008,6 +1026,9 @@ lheap$(EXEEXT): $(lheap_OBJECTS) $(lheap_DEPENDENCIES) links$(EXEEXT): $(links_OBJECTS) $(links_DEPENDENCIES) @rm -f links$(EXEEXT) $(LINK) $(links_OBJECTS) $(links_LDADD) $(LIBS) +links_env$(EXEEXT): $(links_env_OBJECTS) $(links_env_DEPENDENCIES) + @rm -f links_env$(EXEEXT) + $(LINK) $(links_env_OBJECTS) $(links_env_LDADD) $(LIBS) mf$(EXEEXT): $(mf_OBJECTS) $(mf_DEPENDENCIES) @rm -f mf$(EXEEXT) $(LINK) $(mf_OBJECTS) $(mf_LDADD) $(LIBS) @@ -1066,6 +1087,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app_ref.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bittests.Po@am__quote@ @@ -1117,6 +1139,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/istore.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lheap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/links.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/links_env.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime.Po@am__quote@ diff --git a/test/accum.c b/test/accum.c new file mode 100644 index 0000000..c5f6610 --- /dev/null +++ b/test/accum.c @@ -0,0 +1,1809 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Mike McGreevy + * October 7, 2010 + */ +#include "h5test.h" + +#define H5F_PACKAGE +#include "H5Fpkg.h" +#include "H5FDprivate.h" +#include "H5Iprivate.h" + +/* Filename */ +#define FILENAME "accum.h5" + +/* "big" I/O test values */ +#define BIG_BUF_SIZE (6 * 1024 * 1024) + +/* Random I/O test values */ +#define RANDOM_BUF_SIZE (1 * 1024 * 1024) +#define MAX_RANDOM_SEGMENTS (5 * 1024) +#define RAND_SEG_LEN (1024) +#define RANDOM_BASE_OFF (1024 * 1024) + +/* Make file global to all tests */ +H5F_t * f = NULL; + +/* Function Prototypes */ +unsigned test_write_read(void); +unsigned test_write_read_nonacc_front(void); +unsigned test_write_read_nonacc_end(void); +unsigned test_accum_overlap(void); +unsigned test_accum_overlap_clean(void); +unsigned test_accum_overlap_size(void); +unsigned test_accum_non_overlap_size(void); +unsigned test_accum_adjust(void); +unsigned test_read_after(void); +unsigned test_free(void); +unsigned test_big(void); +unsigned test_random_write(void); + +/* Helper Function Prototypes */ +void accum_printf(void); + +/* Private Test H5Faccum Function Wrappers */ +#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) +#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) +#define accum_free(a,s) H5F_accum_free(f, H5P_DATASET_XFER_DEFAULT, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) +#define accum_flush() H5F_accum_flush(f, H5P_DATASET_XFER_DEFAULT) +#define accum_reset() H5F_accum_reset(f, H5P_DATASET_XFER_DEFAULT, TRUE) + +/* ================= */ +/* Main Test Routine */ +/* ================= */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test the metadata accumulator code + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mike McGreevy + * October 7, 2010 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrors = 0; /* track errors */ + hid_t fid = -1; + + /* Test Setup */ + puts("Testing the metadata accumulator"); + + /* Create a test file */ + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Get H5F_t * to internal file structure */ + if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR + + /* We'll be writing lots of garbage data, so extend the + file a ways. 10MB should do. */ + if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR + + /* Reset metadata accumulator for the file */ + if(accum_reset() < 0) FAIL_STACK_ERROR + + /* Test Functions */ + nerrors += test_write_read(); + nerrors += test_write_read_nonacc_front(); + nerrors += test_write_read_nonacc_end(); + nerrors += test_accum_overlap(); + nerrors += test_accum_overlap_clean(); + nerrors += test_accum_overlap_size(); + nerrors += test_accum_non_overlap_size(); + nerrors += test_accum_adjust(); + nerrors += test_read_after(); + nerrors += test_free(); + nerrors += test_big(); + nerrors += test_random_write(); + + /* End of test code, close and delete file */ + if(H5Fclose(fid) < 0) TEST_ERROR + HDremove(FILENAME); + + if(nerrors) + goto error; + puts("All metadata accumulator tests passed."); + + return 0; + +error: + puts("*** TESTS FAILED ***"); + return 1; +} /* end main() */ + +/* ============================= */ +/* Individual Unit Test Routines */ +/* ============================= */ + + +/*------------------------------------------------------------------------- + * Function: test_write_read + * + * Purpose: Simple test to write to then read from metadata accumulator. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mike McGreevy + * October 7, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_write_read(void) +{ + int i = 0; + int *write_buf, *read_buf; + + TESTING("simple write/read to/from metadata accumulator"); + + /* Allocate buffers */ + write_buf = (int *)HDmalloc(1024 * sizeof(int)); + HDassert(write_buf); + read_buf = (int *)HDcalloc(1024, sizeof(int)); + HDassert(read_buf); + + /* Fill buffer with data, zero out read buffer */ + for(i = 0; i < 1024; i++) + write_buf[i] = i + 1; + + /* Do a simple write/read/verify of data */ + /* Write 1KB at Address 0 */ + if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR; + if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 0; + +error: + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 1; +} /* test_write_read */ + + +/*------------------------------------------------------------------------- + * Function: test_write_read_nonacc_front + * + * Purpose: Simple test to write to then read from before metadata accumulator. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Allen Byrne + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_write_read_nonacc_front(void) +{ + int i = 0; + int *write_buf, *read_buf; + + TESTING("simple write/read to/from before metadata accumulator"); + + /* Allocate buffers */ + write_buf = (int *)HDmalloc(2048 * sizeof(int)); + HDassert(write_buf); + read_buf = (int *)HDcalloc(2048, sizeof(int)); + HDassert(read_buf); + + /* Fill buffer with data, zero out read buffer */ + for(i = 0; i < 2048; i++) + write_buf[i] = i + 1; + + /* Do a simple write/read/verify of data */ + /* Write 1KB at Address 0 */ + if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR; + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR; + if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 0; + +error: + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 1; +} /* test_write_read */ + + +/*------------------------------------------------------------------------- + * Function: test_write_read_nonacc_end + * + * Purpose: Simple test to write to then read from after metadata accumulator. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Allen Byrne + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_write_read_nonacc_end(void) +{ + int i = 0; + int *write_buf, *read_buf; + + TESTING("simple write/read to/from after metadata accumulator"); + + /* Allocate buffers */ + write_buf = (int *)HDmalloc(2048 * sizeof(int)); + HDassert(write_buf); + read_buf = (int *)HDcalloc(2048, sizeof(int)); + HDassert(read_buf); + + /* Fill buffer with data, zero out read buffer */ + for(i = 0; i < 2048; i++) + write_buf[i] = i + 1; + + /* Do a simple write/read/verify of data */ + /* Write 1KB at Address 0 */ + if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR; + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR; + if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 0; + +error: + /* Release memory */ + HDfree(write_buf); + HDfree(read_buf); + + return 1; +} /* test_write_read */ + + +/*------------------------------------------------------------------------- + * Function: test_free + * + * Purpose: Simple test to free metadata accumulator. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Raymond Lu + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_free(void) +{ + int i = 0; + int32_t *wbuf = NULL; + int32_t *rbuf = NULL; + int32_t *expect = NULL; + + TESTING("simple freeing metadata accumulator"); + + /* Write and free the whole accumulator. */ + wbuf = (int32_t *)HDmalloc(256 * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDmalloc(256 * sizeof(int32_t)); + HDassert(rbuf); + expect = (int32_t *)HDmalloc(256 * sizeof(int32_t)); + HDassert(expect); + + /* Fill buffer with data */ + for(i = 0; i < 256; i++) + wbuf[i] = (int32_t)(i + 1); + + if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + + if(accum_free(0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Free an empty accumulator */ + if(accum_free(0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Write second quarter of the accumulator */ + if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + + /* Free the second quarter of the accumulator, the requested area + * is bigger than the data region on the right side. */ + if(accum_free(64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + + /* Write half of the accumulator. */ + if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + + /* Free the first block of 4B */ + if(accum_free(0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Free the block of 4B at 127*4B */ + if(accum_free(127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Free the block of 4B at 2*4B */ + if(accum_free(2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf + 1, rbuf, 1 * sizeof(int32_t)) != 0) TEST_ERROR; + if(accum_read(3 * sizeof(int32_t), 124 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf + 3, rbuf, 124 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section that overlaps the start of the accumulator and is + * entirely before dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t)); + if(accum_free(62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 66, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section that overlaps the start of the accumulator and + * completely contains dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t)); + if(accum_free(62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section completely contained in accumulator and is entirely + * before dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); + if(accum_free(66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 70, rbuf, 122 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section completely contained in accumulator, starts before + * dirty section, and ends in dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); + if(accum_free(70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 74, rbuf, 118 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section completely contained in accumulator and completely + * contains dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); + if(accum_free(70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0) TEST_ERROR; + + + /* Test freeing section completely contained in accumulator, starts at start + * of dirty section, and ends in dirty section */ + if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); + if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t)); + if(accum_free(72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + + /* Check that the accumulator still contains the correct data */ + if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(expect + 76, rbuf, 116 * sizeof(int32_t)) != 0) TEST_ERROR; + + HDfree(wbuf); + HDfree(rbuf); + HDfree(expect); + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + return 0; + +error: + HDfree(wbuf); + HDfree(rbuf); + HDfree(expect); + + return 1; +} /* test_free */ + + +/*------------------------------------------------------------------------- + * Function: test_accum_overlap + * + * Purpose: This test will write a series of pieces of data + * to the accumulator with the goal of overlapping + * the writes in various different ways. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mike McGreevy + * October 7, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_accum_overlap(void) +{ + int i = 0; + int32_t *wbuf, *rbuf; + + TESTING("overlapping write to metadata accumulator"); + + /* Allocate buffers */ + wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t)); + HDassert(rbuf); + + /* Case 1: No metadata in accumulator */ + /* Write 10 1's at address 40 */ + /* @0:| 1111111111| */ + /* Put some data in the accumulator initially */ + for(i = 0; i < 10; i++) + wbuf[i] = 1; + if(accum_write(40, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(40, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 2: End of new piece aligns with start of accumulated data */ + /* Write 5 2's at address 20 */ + /* @0:| 222221111111111| */ + for(i = 0; i < 5; i++) + wbuf[i] = 2; + if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(20, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 3: Start of new piece aligns with start of accumulated data */ + /* Write 3 3's at address 20 */ + /* @0:| 333221111111111| */ + for(i = 0; i < 3; i++) + wbuf[i] = 3; + if(accum_write(20, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(20, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 4: New piece overlaps start of accumulated data */ + /* Write 5 4's at address 8 */ + /* @0:| 444443221111111111| */ + for(i = 0; i < 5; i++) + wbuf[i] = 4; + if(accum_write(8, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(8, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 5: New piece completely within accumulated data */ + /* Write 4 5's at address 48 */ + /* @0:| 444443221155551111| */ + for(i = 0; i < 4; i++) + wbuf[i] = 5; + if(accum_write(48, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(48, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 6: End of new piece aligns with end of accumulated data */ + /* Write 3 6's at address 68 */ + /* @0:| 444443221155551666| */ + for(i = 0; i < 3; i++) + wbuf[i] = 6; + if(accum_write(68, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(68, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 7: New piece overlaps end of accumulated data */ + /* Write 5 7's at address 76 */ + /* @0:| 4444432211555516677777| */ + for(i = 0; i < 5; i++) + wbuf[i] = 7; + if(accum_write(76, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(76, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 8: Start of new piece aligns with end of accumulated data */ + /* Write 3 8's at address 96 */ + /* @0:| 4444432211555516677777888| */ + for(i = 0; i < 3; i++) + wbuf[i] = 8; + if(accum_write(96, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(96, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Set up expected data buffer and verify contents of + accumulator as constructed by cases 1-8, above */ + for(i = 0; i < 5; i++) + wbuf[i] = 4; + for(i = 5; i < 6; i++) + wbuf[i] = 3; + for(i = 6; i < 8; i++) + wbuf[i] = 2; + for(i = 8; i < 10; i++) + wbuf[i] = 1; + for(i = 10; i < 14; i++) + wbuf[i] = 5; + for(i = 14; i < 15; i++) + wbuf[i] = 1; + for(i = 15; i < 17; i++) + wbuf[i] = 6; + for(i = 17; i < 22; i++) + wbuf[i] = 7; + for(i = 22; i < 25; i++) + wbuf[i] = 8; + if(accum_read(8, 25 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 25 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 9: New piece completely before accumulated data */ + /* Write 1 9 at address 0 */ + /* @0:|9 4444432211555516677777888| */ + for(i = 0; i < 1; i++) + wbuf[i] = 9; + if(accum_write(0, 1 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(0, 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 1 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 10: New piece completely after accumulated data */ + /* Write 4 3's at address 116 */ + /* @0:|9 4444432211555516677777888 3333| */ + for(i = 0; i < 4; i++) + wbuf[i] = 3; + if(accum_write(116, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(116, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 11: New piece completely overlaps accumulated data */ + /* Write 6 4's at address 112 */ + /* @0:|9 4444432211555516677777888 444444| */ + for(i = 0; i < 6; i++) + wbuf[i] = 4; + if(accum_write(112, 6 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(112, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* test_accum_overlap */ + + +/*------------------------------------------------------------------------- + * Function: test_accum_overlap_clean + * + * Purpose: This test will write a series of pieces of data + * to the accumulator with the goal of overlapping + * the writes in various different ways, with clean + * areas in the accumulator. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Neil Fortner + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_accum_overlap_clean(void) +{ + int i = 0; + int32_t *wbuf, *rbuf; + + TESTING("overlapping write to partially clean metadata accumulator"); + + /* Allocate buffers */ + wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t)); + HDassert(rbuf); + + /* Case 1: No metadata in accumulator */ + /* Write 10 1's at address 40 */ + /* @0:| 1111111111| */ + /* Put some data in the accumulator initially */ + for(i = 0; i < 10; i++) + wbuf[i] = 1; + if(accum_write(40, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(40, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 2: End of new piece aligns with start of clean accumulated data */ + /* Write 5 2's at address 20 */ + /* @0:| 222221111111111| */ + if(accum_flush() < 0) FAIL_STACK_ERROR; + for(i = 0; i < 5; i++) + wbuf[i] = 2; + if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(20, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 3: Start of new piece aligns with start of accumulated data, + * completely encloses dirty section of accumulator */ + /* Write 6 3's at address 20 */ + /* @0:| 333333111111111| */ + for(i = 0; i < 6; i++) + wbuf[i] = 3; + if(accum_write(20, 6 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(20, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 4: New piece completely within accumulated data, overlaps + * end of dirty section of accumulator */ + /* Write 2 4's at address 40 */ + /* @0:| 333334411111111| */ + for(i = 0; i < 2; i++) + wbuf[i] = 4; + if(accum_write(40, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(40, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 5: New piece completely within accumulated data, completely + * after dirty section of accumulator */ + /* Write 2 5's at address 52 */ + /* @0:| 333334415511111| */ + for(i = 0; i < 2; i++) + wbuf[i] = 5; + if(accum_write(52, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(52, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 6: New piece completely within clean accumulated data */ + /* Write 3 6's at address 44 */ + /* @0:| 333334666511111| */ + if(accum_flush() < 0) FAIL_STACK_ERROR; + for(i = 0; i < 3; i++) + wbuf[i] = 6; + if(accum_write(44, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(44, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 7: New piece overlaps start of clean accumulated data */ + /* Write 2 7's at address 16 */ + /* @0:| 7733334666511111| */ + if(accum_flush() < 0) FAIL_STACK_ERROR; + for(i = 0; i < 2; i++) + wbuf[i] = 7; + if(accum_write(16, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(16, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 8: New piece overlaps start of accumulated data, completely + * encloses dirty section of accumulator */ + /* Write 4 8's at address 12 */ + /* @0:| 88883334666511111| */ + for(i = 0; i < 4; i++) + wbuf[i] = 8; + if(accum_write(12, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(12, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 9: Start of new piece aligns with end of clean accumulated data */ + /* Write 3 9's at address 80 */ + /* @0:| 88883334666511111999| */ + if(accum_flush() < 0) FAIL_STACK_ERROR; + for(i = 0; i < 3; i++) + wbuf[i] = 9; + if(accum_write(80, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(80, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 10: New piece overlaps end of clean accumulated data */ + /* Write 3 2's at address 88 */ + /* @0:| 888833346665111119922| */ + if(accum_flush() < 0) FAIL_STACK_ERROR; + for(i = 0; i < 2; i++) + wbuf[i] = 2; + if(accum_write(88, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(88, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 11: New piece overlaps end of accumulated data, completely encloses + * dirty section of accumulator */ + /* Write 4 7's at address 84 */ + /* @0:| 8888333466651111197777| */ + for(i = 0; i < 4; i++) + wbuf[i] = 7; + if(accum_write(84, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(84, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Set up expected data buffer and verify contents of + accumulator as constructed by cases 1-11, above */ + for(i = 0; i < 4; i++) + wbuf[i] = 8; + for(i = 4; i < 7; i++) + wbuf[i] = 3; + for(i = 7; i < 8; i++) + wbuf[i] = 4; + for(i = 8; i < 11; i++) + wbuf[i] = 6; + for(i = 11; i < 12; i++) + wbuf[i] = 5; + for(i = 12; i < 17; i++) + wbuf[i] = 1; + for(i = 17; i < 18; i++) + wbuf[i] = 9; + for(i = 18; i < 22; i++) + wbuf[i] = 7; + if(accum_read(12, 22 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* test_accum_overlap_clean */ + + +/*------------------------------------------------------------------------- + * Function: test_accum_non_overlap_size + * + * Purpose: This test will write a series of pieces of data + * to the accumulator with the goal of not overlapping + * the writes with a data size larger then the accum size. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Allen Byrne + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_accum_non_overlap_size(void) +{ + int i = 0; + int32_t *wbuf, *rbuf; + + TESTING("non-overlapping write to accumulator larger then accum_size"); + + /* Allocate buffers */ + wbuf = (int *)HDmalloc(4096 * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int *)HDcalloc(4096, sizeof(int32_t)); + HDassert(rbuf); + + /* Case 1: No metadata in accumulator */ + /* Write 10 1's at address 140 */ + /* @0:| 1111111111| */ + /* Put some data in the accumulator initially */ + for(i = 0; i < 10; i++) + wbuf[i] = 1; + if(accum_write(140, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(140, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 9: New piece completely before accumulated data */ + /* Write 20 9 at address 0 */ + /* @0:|9 1111111111| */ + for(i = 0; i < 20; i++) + wbuf[i] = 9; + if(accum_write(0, 20 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(0, 20 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* test_accum_non_overlap_size */ + +/*------------------------------------------------------------------------- + * Function: test_accum_overlap_size + * + * Purpose: This test will write a series of pieces of data + * to the accumulator with the goal of overlapping + * the writes with a data size completely overlapping + * the accumulator at both ends. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Allen Byrne + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_accum_overlap_size(void) +{ + int i = 0; + int32_t *wbuf, *rbuf; + + TESTING("overlapping write to accumulator larger then accum_size"); + + /* Allocate buffers */ + wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t)); + HDassert(rbuf); + + /* Case 1: No metadata in accumulator */ + /* Write 10 1's at address 64 */ + /* @0:| 1111111111| */ + /* Put some data in the accumulator initially */ + for(i = 0; i < 10; i++) + wbuf[i] = 1; + if(accum_write(64, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(64, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR; + + /* Case 9: New piece completely before accumulated data */ + /* Write 72 9 at address 60 */ + /* @0:|9 1111111111| */ + for(i = 0; i < 72; i++) + wbuf[i] = 9; + if(accum_write(60, 72 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(60, 72 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* test_accum_overlap_size */ + + +/*------------------------------------------------------------------------- + * Function: test_accum_adjust + * + * Purpose: This test examines the various ways the accumulator might + * adjust itself as a result of data appending or prepending + * to it. + * + * This test program covers all the code in H5F_accum_adjust, + * but NOT all possible paths through said code. It only covers + * six potential paths through the function. (Again, though, each + * piece of code within an if/else statement in H5F_accum_adjust is + * covered by one of the paths in this test function). Since there + * are a ridiculous number of total possible paths through this + * function due to its large number of embedded if/else statements, + * that's certainly a lot of different test cases to write by hand. + * (Though if someone comes across this code and has some free + * time, go for it). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mike McGreevy + * October 11, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_accum_adjust(void) +{ + int i = 0; + int s = 1048576; /* size of buffer */ + int32_t *wbuf, *rbuf; + + TESTING("accumulator adjustments after append/prepend of data"); + + /* Allocate buffers */ + wbuf = (int32_t *)HDmalloc((size_t)s * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDcalloc((size_t)s, sizeof(int32_t)); + HDassert(rbuf); + + /* Fill up write buffer */ + for(i = 0; i < s; i++) + wbuf[i] = i + 1; + + /* ================================================================ */ + /* CASE 1: Prepending small block to large, fully dirty accumulator */ + /* ================================================================ */ + + /* Write data to the accumulator to fill it just under 1MB (max size), + * but not quite full. This will force the accumulator to, on subsequent + * writes, a) have to adjust since it's nearly full, and b) prevent + * an increase in size because it's already at it's maximum size */ + if(accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a small (1KB) block that prepends to the front of the accumulator. */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is less than half maximum size of accumulator */ + /* ==> New block is being prepended to accumulator */ + /* ==> Accumulator is dirty, it will be flushed. */ + /* ==> Dirty region overlaps region to eliminate from accumulator */ + if(accum_write((1024 * 1024) - 1024, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read back and verify first write */ + if(accum_read((1024 * 1024), (1024 * 1024) - 1, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, (1024 * 1024) - 1) != 0) TEST_ERROR; + + /* Read back and verify second write */ + if(accum_read((1024 * 1024) - 1024, 1024, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR; + + /* Reset accumulator for next case */ + if(accum_reset() < 0) FAIL_STACK_ERROR; + + /* ================================================================ */ + /* Case 2: Prepending large block to large, fully dirty accumulator */ + /* ================================================================ */ + + /* Write data to the accumulator to fill it just under 1MB (max size), + * but not quite full. This will force the accumulator to, on subsequent + * writes, a) have to adjust since it's nearly full, and b) prevent + * an increase in size because it's already at it's maximum size */ + if(accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a large (just under 1MB) block to the front of the accumulator. */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is larger than half maximum size of accumulator */ + /* ==> New block is being prepended to accumulator */ + /* ==> Accumulator is dirty, it will be flushed. */ + /* ==> Dirty region overlaps region to eliminate from accumulator */ + if(accum_write(5, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read back and verify both pieces of data */ + if(accum_read(1048576, 1048575, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 1048576) != 0) TEST_ERROR; + + if(accum_read(5, 1048571, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 1048571) != 0) TEST_ERROR; + + /* Reset accumulator for next case */ + if(accum_reset() < 0) FAIL_STACK_ERROR; + + /* ========================================================= */ + /* Case 3: Appending small block to large, clean accumulator */ + /* ========================================================= */ + + /* Write data to the accumulator to fill it just under 1MB (max size), + * but not quite full. This will force the accumulator to, on subsequent + * writes, a) have to adjust since it's nearly full, and b) prevent + * an increase in size because it's already at it's maximum size */ + if(accum_write(0, (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Flush the accumulator -- we want to test the case when + accumulator contains clean data */ + if(accum_flush() < 0) FAIL_STACK_ERROR + + /* Write a small (1KB) block to the end of the accumulator */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is larger than half maximum size of accumulator */ + /* ==> New block being appended to accumulator */ + /* ==> Accumulator is NOT dirty */ + /* ==> Since we're appending, need to adjust location of accumulator */ + if(accum_write((1024 * 1024) - 1, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a piece of metadata outside current accumulator to force write + to disk */ + if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read in the piece we wrote to disk above, and then verify that + the data is as expected */ + if(accum_read((1024 * 1024) - 1, 1024, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR; + + /* Reset accumulator for next case */ + if(accum_reset() < 0) FAIL_STACK_ERROR; + + /* ==================================================================== */ + /* Case 4: Appending small block to large, partially dirty accumulator, */ + /* with existing dirty region NOT aligning with the new block */ + /* ==================================================================== */ + + /* Write data to the accumulator to fill it just under 1MB (max size), + * but not quite full. This will force the accumulator to, on subsequent + * writes, a) have to adjust since it's nearly full, and b) prevent + * an increase in size because it's already at it's maximum size */ + if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; + + /* Flush the accumulator to clean it */ + if(accum_flush() < 0) FAIL_STACK_ERROR + + /* write to part of the accumulator so just the start of it is dirty */ + if(accum_write(0, 5, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a small (~340KB) piece of data to the other end of the accumulator */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is less than than half maximum size of accumulator */ + /* ==> New block being appended to accumulator */ + /* ==> We can slide the dirty region down, to accomodate the request */ + /* ==> Max Buffer Size - (dirty offset + adjust size) >= 2 * size) */ + /* ==> Need to adjust location of accumulator while appending */ + /* ==> Accumulator will need to be reallocated */ + if(accum_write(1048571, 349523, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a piece of metadata outside current accumulator to force write + to disk */ + if(accum_write(1398900, 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read in the piece we wrote to disk above, and then verify that + the data is as expected */ + if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR; + + /* Reset accumulator for next case */ + if(accum_reset() < 0) FAIL_STACK_ERROR; + + /* ==================================================================== */ + /* Case 5: Appending small block to large, partially dirty accumulator, */ + /* with existing dirty region aligning with new block */ + /* ==================================================================== */ + + /* Write data to the accumulator to fill it just under max size (but not full) */ + if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; + + /* Flush the accumulator to clean it */ + if(accum_flush() < 0) FAIL_STACK_ERROR + + /* write to part of the accumulator so it's dirty, but not entirely dirty */ + /* (just the begging few bytes will be clean) */ + if(accum_write(10, (1024 * 1024) - 15, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a small piece of data to the dirty end of the accumulator */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is less than than half maximum size of accumulator */ + /* ==> New block being appended to accumulator */ + /* ==> We can slide the dirty region down, to accomodate the request */ + /* ==> Max Buffer Size - (dirty offset + adjust size) < 2 * size) */ + /* ==> Need to adjust location of accumulator while appending */ + if(accum_write((1024 * 1024) - 5, 10, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a piece of metadata outside current accumulator to force write + to disk */ + if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read in the piece we wrote to disk above, and then verify that + the data is as expected */ + if(accum_read((1024 * 1024) - 5, 10, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 10) != 0) TEST_ERROR; + + /* Reset accumulator for next case */ + if(accum_reset() < 0) FAIL_STACK_ERROR; + + /* ================================================================= */ + /* Case 6: Appending small block to large, fully dirty accumulator */ + /* ================================================================= */ + + /* Write data to the accumulator to fill it just under 1MB (max size), + * but not quite full. This will force the accumulator to, on subsequent + * writes, a) have to adjust since it's nearly full, and b) prevent + * an increase in size because it's already at it's maximum size */ + if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a small (~340KB) piece of data to the end of the accumulator */ + /* ==> Accumulator will need more buffer space */ + /* ==> Accumulator will try to resize, but see that it's getting too big */ + /* ==> Size of new block is less than than half maximum size of accumulator */ + /* ==> New block being appended to accumulator */ + /* ==> We cannot slide dirty region down, it's all dirty */ + /* ==> Dirty region overlaps region to eliminate from accumulator */ + /* ==> Need to adjust location of accumulator while appending */ + if(accum_write(1048571, 349523, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a piece of metadata outside current accumulator to force write + to disk */ + if(accum_write(1398900, 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read in the piece we wrote to disk above, and then verify that + the data is as expected */ + if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* test_accum_adjust */ + + +/*------------------------------------------------------------------------- + * Function: test_read_after + * + * Purpose: This test will verify the case when metadata is read partly + * from the accumulator and partly from disk. The test will + * write a block of data at address 512, force the data to be + * written to disk, write new data partially overlapping the + * original block from below, then read data at address 512. + * The data read should be partly new and partly original. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Larry Knox + * October 8, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_read_after(void) +{ + int i = 0; + int s = 128; /* size of buffer */ + int32_t *wbuf, *rbuf; + + TESTING("reading data from both accumulator and disk"); + + /* Allocate buffers */ + wbuf = (int32_t *)HDmalloc((size_t)s * sizeof(int32_t)); + HDassert(wbuf); + rbuf = (int32_t *)HDcalloc((size_t)s, sizeof(int32_t)); + HDassert(rbuf); + + /* Fill up write buffer with 1s */ + for(i = 0; i < s; i++) + wbuf[i] = 1; + + /* Write data to the accumulator to fill it. */ + if(accum_write(512, 512, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write a piece of metadata outside current accumulator to force write + to disk */ + if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR; + + /* Fill up write buffer with 2s */ + for(i = 0; i < s; i++) + wbuf[i] = 2; + + /* Write a block of 2s of the original size that will overlap the lower half + of the original block */ + if(accum_write(256, 512, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read 128 bytes at the original address, and then */ + if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR; + + /* Set the second half of wbuf back to 1s */ + for(i = 64; i < s; i++) + wbuf[i] = 1; + + /* Read in the piece we wrote to disk above, and then verify that + the data is as expected */ + if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf, rbuf, 128) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + + return 1; +} /* end test_read_after */ + + +/*------------------------------------------------------------------------- + * Function: test_big + * + * Purpose: This test exercises writing large pieces of metadata to the + * file. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * October 12, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_big(void) +{ + uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */ + unsigned u; /* Local index variable */ + + /* Allocate space for the write & read buffers */ + wbuf = (uint8_t *)HDmalloc(BIG_BUF_SIZE); + HDassert(wbuf); + wbuf2 = (uint8_t *)HDmalloc(BIG_BUF_SIZE); + HDassert(wbuf2); + rbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1); + HDassert(rbuf); + zbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1); + HDassert(zbuf); + + /* Initialize write buffers */ + for(u = 0; u < BIG_BUF_SIZE; u++) { + wbuf[u] = (uint8_t)u; + wbuf2[u] = (uint8_t)(u + 1); + } /* end for */ + + TESTING("large metadata I/O operations"); + + /* Write large data segment to file */ + if(accum_write(0, BIG_BUF_SIZE, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read entire segment back from file */ + if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to middle of accumulator */ + if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read entire segment back from file */ + /* (Read covers entire dirty region) */ + if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(zbuf, rbuf, 1024) != 0) TEST_ERROR; + if(HDmemcmp(wbuf, rbuf + 1024, 1024) != 0) TEST_ERROR; + if(HDmemcmp(zbuf, rbuf + 2048, (BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to overlap with end of "big" region */ + if(accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read entire segment back from file */ + /* (Read covers bottom half of dirty region) */ + if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(zbuf, rbuf, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR; + if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), 512) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to overlap with beginning of "big" region */ + if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read entire segment back from file */ + /* (Read covers bottom half of dirty region) */ + if(accum_read(512, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf + 512, rbuf, 512) != 0) TEST_ERROR; + if(HDmemcmp(zbuf, rbuf + 512, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to middle of accumulator */ + /* (With write buffer #1) */ + if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Write covers entire dirty region) */ + if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read entire segment back from file */ + if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to overlap with end of "big" region */ + /* (With write buffer #1) */ + if(accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Read covers bottom half of dirty region) */ + if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments back from file */ + if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR; + if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE + 512); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to be past "big" region */ + /* (With write buffer #1) */ + if(accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read section before "big" region */ + /* (To enlarge accumulator, to it will intersect with big write) */ + if(accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Doesn't overlap with small section) */ + if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments & gap back from file */ + if(accum_read(0, BIG_BUF_SIZE + 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR; + if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR; + if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, 512) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE + 1024); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section to be past "big" region */ + /* (With write buffer #1) */ + if(accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read section before "big" region */ + /* (To enlarge accumulator, so it will intersect with big write) */ + if(accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0) FAIL_STACK_ERROR; + if(accum_read(BIG_BUF_SIZE + 1536, 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Overwriting dirty region, but not invalidating entire accumulator) */ + if(accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments & gap back from file */ + if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(zbuf, rbuf, 1536) != 0) TEST_ERROR; + if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section before "big" region */ + /* (With write buffer #1) */ + if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read section before "big" region */ + /* (To enlarge accumulator, so it will intersect with big write) */ + if(accum_read(0, 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Overwriting dirty region, but not invalidating entire accumulator) */ + if(accum_write(512, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments & gap back from file */ + if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(zbuf, rbuf, 512) != 0) TEST_ERROR; + if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE + 512); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section before "big" region */ + /* (With write buffer #1) */ + if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read section before "big" region */ + /* (To enlarge accumulator, so it will intersect with big write) */ + if(accum_read(1024, 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Avoiding dirty region, and not invalidating entire accumulator) */ + if(accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments & gap back from file */ + if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR; + if(HDmemcmp(zbuf, rbuf + 1024, 512) != 0) TEST_ERROR; + if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + /* Reset data in file back to zeros & reset the read buffer */ + if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR; + HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536); + if(accum_reset() < 0) FAIL_STACK_ERROR; + + + /* Write small section before "big" region */ + /* (With write buffer #1) */ + if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR; + + /* Read section before "big" region */ + /* (To enlarge accumulator, so it will intersect with big write) */ + if(accum_read(1024, 1024, rbuf) < 0) FAIL_STACK_ERROR; + + /* Write entire segment to from file */ + /* (With write buffer #2) */ + /* (Partially overwriting dirty region, and not invalidating entire accumulator) */ + if(accum_write(512, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR; + + /* Read both segments back from file */ + if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read */ + if(HDmemcmp(wbuf, rbuf, 512) != 0) TEST_ERROR; + if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR; + + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(wbuf2); + HDfree(rbuf); + HDfree(zbuf); + + return 0; + +error: + HDfree(wbuf); + HDfree(wbuf2); + HDfree(rbuf); + HDfree(zbuf); + + return 1; +} /* end test_big() */ + + +/*------------------------------------------------------------------------- + * Function: test_random_write + * + * Purpose: This test writes random pieces of data to the file and + * then reads it all back. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * October 11, 2010 + * + *------------------------------------------------------------------------- + */ +unsigned +test_random_write(void) +{ + uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */ + unsigned long seed = 0; /* Random # seed */ + size_t *off; /* Offset of buffer segments to write */ + size_t *len; /* Size of buffer segments to write */ + size_t cur_off; /* Current offset */ + size_t nsegments; /* Number of segments to write */ + size_t swap; /* Position to swap with */ + unsigned u; /* Local index variable */ + + /* Allocate space for the write & read buffers */ + wbuf = (uint8_t *)malloc(RANDOM_BUF_SIZE); + HDassert(wbuf); + rbuf = (uint8_t *)calloc(RANDOM_BUF_SIZE, 1); + HDassert(rbuf); + + /* Initialize write buffer */ + for(u = 0; u < RANDOM_BUF_SIZE; u++) + wbuf[u] = (uint8_t)u; + + TESTING("random writes to accumulator"); + + /* Choose random # seed */ + seed = (unsigned long)HDtime(NULL); +#ifdef QAK +/* seed = (unsigned long)1155438845; */ +HDfprintf(stderr, "Random # seed was: %lu\n", seed); +#endif /* QAK */ + HDsrandom(seed); + + /* Allocate space for the segment length buffer */ + off = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); + HDassert(off); + len = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t)); + HDassert(len); + + /* Randomly choose lengths of segments */ + cur_off = 0; + for(u = 0; u < MAX_RANDOM_SEGMENTS; ) { + size_t length = 0; /* Length of current segment */ + + /* Choose random length of segment, allowing for variance */ + do { + length += (size_t)(HDrandom() % RAND_SEG_LEN) + 1; + } while((HDrandom() & 256) >= 128); /* end while */ + + /* Check for going off end of buffer */ + if((cur_off + length) > RANDOM_BUF_SIZE) + length = RANDOM_BUF_SIZE - cur_off; + + /* Set offset & length of segment */ + off[u] = cur_off; + len[u] = length; + + /* Advance array offset */ + u++; + + /* Advance current offset */ + cur_off += length; + + /* If we've used up entire buffer before hitting limit of segments, get out */ + if(cur_off >= RANDOM_BUF_SIZE) + break; + } /* end for */ + nsegments = u; + + /* Increase length of last segment, if it doesn't reach end of buffer */ + if(nsegments < MAX_RANDOM_SEGMENTS) + len[nsegments - 1] = RANDOM_BUF_SIZE - off[nsegments - 1]; + + /* Shuffle order of segments, to randomize positions to write */ + for(u = 0; u < nsegments; u++) { + size_t tmp; /* Temporary holder for offset & length values */ + + /* Choose value within next few elements to to swap with */ + swap = ((size_t)HDrandom() % 8) + u; + if(swap >= nsegments) + swap = nsegments - 1; + + /* Swap values */ + tmp = off[u]; off[u] = off[swap]; off[swap] = tmp; + tmp = len[u]; len[u] = len[swap]; len[swap] = tmp; + } /* end for */ + + /* Write data segments to file */ + for(u = 0; u < nsegments; u++) { + if(accum_write(RANDOM_BASE_OFF + off[u], len[u], wbuf + off[u]) < 0) FAIL_STACK_ERROR; + + /* Verify individual reads */ + if(accum_read(RANDOM_BASE_OFF + off[u], len[u], rbuf) < 0) FAIL_STACK_ERROR; + if(HDmemcmp(wbuf + off[u], rbuf, len[u]) != 0) TEST_ERROR; + } /* end for */ + + /* Read entire region back from file */ + if(accum_read(RANDOM_BASE_OFF, RANDOM_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR; + + /* Verify data read back in */ + if(HDmemcmp(wbuf, rbuf, RANDOM_BUF_SIZE) != 0) TEST_ERROR; + + if(accum_reset() < 0) FAIL_STACK_ERROR; + + PASSED(); + + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(off); + HDfree(len); + + return 0; + +error: + /* Release memory */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(off); + HDfree(len); + + HDfprintf(stderr, "Random # seed was: %lu\n", seed); + return 1; +} /* end test_random_write() */ + + +/*------------------------------------------------------------------------- + * Function: accum_printf + * + * Purpose: Debug function to print some stats about the accumulator + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mike McGreevy + * October 7, 2010 + * + *------------------------------------------------------------------------- + */ +void +accum_printf(void) +{ + H5F_meta_accum_t * accum = &f->shared->accum; + + printf("\n"); + printf("Current contents of accumulator:\n"); + if (accum->alloc_size == 0) { + printf("=====================================================\n"); + printf(" No accumulator allocated.\n"); + printf("=====================================================\n"); + } else { + printf("=====================================================\n"); + printf(" accumulator allocated size == %lu\n", (unsigned long)accum->alloc_size); + printf(" accumulated data size == %lu\n", (unsigned long)accum->size); + printf(" accumulator dirty? == %d\n", accum->dirty); + printf("=====================================================\n"); + printf(" start of accumulated data, loc = %llu\n", accum->loc); + if (accum->dirty) printf(" start of dirty region, loc = %llu\n", accum->loc + accum->dirty_off); + if (accum->dirty) printf(" end of dirty region, loc = %llu\n", accum->loc + accum->dirty_off + accum->dirty_len); + printf(" end of accumulated data, loc = %llu\n", accum->loc + accum->size); + printf(" end of accumulator allocation, loc = %llu\n", accum->loc + accum->alloc_size); + printf("=====================================================\n"); + } + printf("\n\n"); +} /* accum_printf() */ + diff --git a/test/be_data.h5 b/test/be_data.h5 Binary files differindex f906545..0feefa3 100644 --- a/test/be_data.h5 +++ b/test/be_data.h5 @@ -16,16 +16,45 @@ /* * Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, April 8, 1998 + * Modified: Albert Cheng <acheng@hdfgroup.org> + * September 11, 2010 + */ +/* + * The purpose of this test is to verify if a virtual file driver can handle: + * a. Large file (2GB) + * This should exceed 32bits I/O system since offset is a signed + * integral type (in order to support negative offset with respect to + * end of file). + * b. Extra Large file (4GB) + * This definite exceeds 32bit I/O and file systems. + * c. Huge file (tens of GB) + * This verifies the HDF5 library handles big logical file size + * correctly. + * In practice, if a VFD can handle a big file size, there is no need to + * test the smaller file sizes. E.g., If it can handle the Huge file, + * there is no need to test the Extra large or Large files. Therefore the + * test starts with larger size files and continues to test the smaller size + * files only if the large sige file tests have failed. + * + * Another consideration is that even if a VFD is capable to handle a + * huge file but it is likely to take a long time to write every byte + * of a huge file. E.g., a simple workstation may have disks of write + * speed of 10MB/sec. A huge file of 30GB will take about an hour to + * write it. Therefore, this test will run the huge file test only if the + * underlying file system supports sparse file. (A Sparse file here means + * that disk space is allocated only when the contents are actually written. + * E.g., If one creates a new file, seeks forward 10 million bytes, writes + * 1 bytes and closes the file, then a sparse file, will show file size of + * 10 million bytes but actaully uses only couple disk blocks, much smaller + * than the formal file size.) + * + * One more consideration is that we want to distinguish an HDF5 library + * failure from some system limits such as current free disk space or user + * disk space quota. Therefore, the test will first attempt to verify no + * such limits exist before running the actual VFD tests. */ #include "h5test.h" -const char *FILENAME[] = { - "big", - "sec2", - "stdio", - NULL -}; - #define DNAME "big.data" #define WRT_N 50 @@ -42,8 +71,29 @@ const char *FILENAME[] = { # define GB8LL 0 /*cannot do the test*/ #endif +/* Define Small, Large, Extra Large, Huge File which + * corrspond to less than 2GB, 2GB, 4GB, and tens of GB file size. + * NOFILE stands for "no file" to be tested. + */ +typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NOFILE} fsizes_t; +/* Lists of vfd to test */ +typedef enum vfd_t { SEC2_VFD, STDIO_VFD, FAMILY_VFD } vfd_t; +fsizes_t file_size= NOFILE; + +const char *FILENAME[] = { + "big", + "sec2", + "stdio", + NULL +}; +int cflag=1; /* check file system before test */ +int sparse_support=0; /* sparse file supported, default false */ +int have_space=0; /* enough space for huge file test, default false */ +hsize_t family_size_def=FAMILY_SIZE; /* default family file size */ + /* Protocols */ static void usage(void); +int testvfd(vfd_t vfd); /* Array used to record all addresses at which data has been written */ /* so far. Used to prevent overlapping writes. */ @@ -129,7 +179,7 @@ is_sparse(void) if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; if (HDclose(fd) < 0) return 0; if (HDstat("x.h5", &sb) < 0) return 0; - if (HDunlink("x.h5") < 0) return 0; + if (HDremove("x.h5") < 0) return 0; #ifdef H5_HAVE_STAT_ST_BLOCKS return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size); #else @@ -156,25 +206,67 @@ is_sparse(void) * *------------------------------------------------------------------------- */ -static int -supports_big(void) +static fsizes_t +supports_big(vfd_t vfd) { - int fd; + int fd = -1; + fsizes_t fsize = NOFILE; + + switch (vfd){ + case FAMILY_VFD: + case SEC2_VFD: + case STDIO_VFD: + if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) + goto error; - if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; + /* Write a few byte at the beginning */ + if (5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = SFILE; - /* Write a few bytes at 2GB */ - if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) return 0; - if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; + /* Write a few bytes at 2GB */ + if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) + goto quit; + if (5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = LFILE; - /* Write a few bytes at 4GB */ - if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) return 0; - if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; + /* Write a few bytes at 4GB */ + if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) + goto quit; + if (5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = XLFILE; - if (HDclose(fd) < 0) return 0; - if (HDremove("y.h5") < 0) return 0; + /* If this supports sparse_file, write a few bytes at 32GB */ + if (!sparse_support) + goto quit; + if (HDlseek(fd, 32*GB, SEEK_SET) != 32*GB) + goto quit; + if (5!=HDwrite(fd, "hello", (size_t)5)) + goto quit; + fsize = HUGEFILE; - return (1); + break; + default: + /* unknown or unsupported VFD */ + goto error; + break; + } + +quit: + if (HDclose(fd) < 0) + goto error; + if (HDremove("y.h5") < 0) + goto error; + return(fsize); + +error: + if (fd >= 0){ + HDclose(fd); + HDremove("y.h5"); + } + return (fsize); } @@ -231,7 +323,7 @@ enough_room(hid_t fapl) HDsnprintf(name, sizeof name, filename, i); if(HDclose(fd[i]) < 0) ret_value=0; - HDunlink(name); + HDremove(name); } return ret_value; @@ -257,7 +349,7 @@ enough_room(hid_t fapl) *------------------------------------------------------------------------- */ static int -writer (char* filename, hid_t fapl, int wrt_n) +writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n) { hsize_t size1[4] = {8, 1024, 1024, 1024}; hsize_t size2[1] = {GB8LL}; @@ -269,7 +361,39 @@ writer (char* filename, hid_t fapl, int wrt_n) FILE *out = fopen(DNAME, "w"); hid_t dcpl; - TESTING("large dataset write"); + switch(testsize){ + case LFILE: + TESTING("Large dataset write(2GB)"); + /* reduce size1 to produce a 2GB dataset */ + size1[1] = 1024/16; + size2[0] /= 16; + break; + + case XLFILE: + TESTING("Extra large dataset write(4GB)"); + /* reduce size1 to produce a 4GB dataset */ + size1[1] = 1024/8; + size2[0] /= 8; + break; + + case HUGEFILE: + TESTING("Huge dataset write"); + /* Leave size1 as 32GB */ + break; + + case SFILE: + TESTING("small dataset write(1GB)"); + /* reduce size1 to produce a 1GB dataset */ + size1[1] = 1024/32; + size2[0] /= 32; + break; + + case NOFILE: + /* what to do?? */ + HDfprintf(stdout, "Unexpected file size of NOFILE\n"); + goto error; + break; + } /* * We might be on a machine that has 32-bit files, so create an HDF5 file @@ -475,6 +599,124 @@ usage(void) +/* Flush stdout at the end of this test routine to ensure later output to */ +/* stderr will not come out before it.*/ +int testvfd(vfd_t vfd) +{ + hid_t fapl=-1; + hsize_t family_size; + char filename[1024]; + fsizes_t testsize; + + + switch(vfd){ + case FAMILY_VFD: + /* Test huge file with the family driver */ + puts("Testing big file with the Family Driver "); + if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) + goto error; + + if (cflag){ + /* + * We shouldn't run this test if the file system doesn't support holes + * because we would generate multi-gigabyte files. + */ + puts("Checking if file system is adequate for this test..."); + if (sizeof(long long)<8 || 0==GB8LL) { + puts("Test skipped because sizeof(long long) is too small. This"); + puts("hardware apparently doesn't support 64-bit integer types."); + usage(); + goto quit; + } + if (!sparse_support) { + puts("Test skipped because file system does not support holes."); + usage(); + goto quit; + } + if (!enough_room(fapl)) { + puts("Test skipped because of quota (file size or num open files)."); + usage(); + goto quit; + } + } + + /* Do the test with the Family Driver */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if (writer(filename, fapl, HUGEFILE, WRT_N)) goto error; + if (reader(filename, fapl)) goto error; + + puts("Test passed with the Family Driver."); + break; + + case SEC2_VFD: + testsize = supports_big(SEC2_VFD); + if (testsize == NOFILE) { + HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n"); + goto quit; + } + /* Test big file with the SEC2 driver */ + puts("Testing big file with the SEC2 Driver "); + + if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + if(H5Pset_fapl_sec2(fapl) < 0) + goto error; + + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + + if (writer(filename, fapl, testsize, WRT_N)) goto error; + if (reader(filename, fapl)) goto error; + + puts("Test passed with the SEC2 Driver."); + break; + + case STDIO_VFD: + testsize = supports_big(STDIO_VFD); + if (testsize == NOFILE) { + HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n"); + goto quit; + } + puts("\nTesting big file with the STDIO Driver "); + + if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + if(H5Pset_fapl_stdio(fapl) < 0) + goto error; + + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + + if (writer(filename, fapl, testsize, WRT_N)) goto error; + if (reader(filename, fapl)) goto error; + puts("Test passed with the STDIO Driver."); + break; + + default: + puts("Unsupprted VFD"); + usage(); + goto error;; + } /* end of switch (vfd) */ + +quit: + /* End with normal return code */ + /* Clean up the test file */ + if (h5_cleanup(FILENAME, fapl)) HDremove(DNAME); + fflush(stdout); + return 0; + + +error: + if (fapl>=0) H5Pclose(fapl); + puts("*** TEST FAILED ***"); + fflush(stdout); + return 1; +} + + + /*------------------------------------------------------------------------- * Function: main * @@ -501,15 +743,9 @@ usage(void) int main (int ac, char **av) { - hid_t fapl=-1; - hsize_t family_size; - hsize_t family_size_def; /* default family file size */ unsigned long seed = 0; /* Random # seed */ - int cflag=1; /* check file system before test */ - char filename[1024]; /* parameters setup */ - family_size_def = FAMILY_SIZE; while (--ac > 0){ av++; @@ -538,6 +774,11 @@ main (int ac, char **av) } } + /* check sparse file support unless cflag is not set. */ + if (cflag) + sparse_support = is_sparse(); + + /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK @@ -546,113 +787,18 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); #endif /* QAK */ HDsrandom(seed); - /* Reset library */ - h5_reset(); - fapl = h5_fileaccess(); - - /* Test big file with the family driver */ - puts("Testing big file with the Family Driver "); - if (H5FD_FAMILY!=H5Pget_driver(fapl)) { - HDfprintf(stdout, - "Changing file drivers to the family driver, %Hu bytes each\n", - family_size_def); - if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) goto error; - } else if (H5Pget_fapl_family(fapl, &family_size, NULL) < 0) { +/*=================================================*/ + if (testvfd(FAMILY_VFD) != 0) + goto error; + if (testvfd(SEC2_VFD) != 0) + goto error; + if (testvfd(STDIO_VFD) != 0) goto error; - } else if (family_size!=family_size_def) { - HDfprintf(stdout, "Changing family member size from %Hu to %Hu\n", - family_size, family_size_def); - if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) - goto error; - } - - if (cflag){ - /* - * We shouldn't run this test if the file system doesn't support holes - * because we would generate multi-gigabyte files. - */ - puts("Checking if file system is adequate for this test..."); - if (sizeof(long long)<8 || 0==GB8LL) { - puts("Test skipped because sizeof(long long) is too small. This"); - puts("hardware apparently doesn't support 64-bit integer types."); - usage(); - goto quit; - } - if (!is_sparse()) { - puts("Test skipped because file system does not support holes."); - usage(); - goto quit; - } - if (!enough_room(fapl)) { - puts("Test skipped because of quota (file size or num open files)."); - usage(); - goto quit; - } - } - - /* Do the test with the Family Driver */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - - if (writer(filename, fapl, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; - - puts("Test passed with the Family Driver."); - - /* - * We shouldn't run this test if the file system doesn't support big files - * because we would generate multi-gigabyte files. - */ - puts("\nChecking if file system supports big files..."); - if (!supports_big()) { - puts("Tests for sec2 and stdio are skipped because file system does not support big files."); - usage(); - goto quit; - } - - /* Clean up the test file */ - if (h5_cleanup(FILENAME, fapl)) remove(DNAME); - - /* Test big file with the SEC2 driver */ - puts("Testing big file with the SEC2 Driver "); - - fapl = h5_fileaccess(); - if(H5Pset_fapl_sec2(fapl) < 0) - - HDmemset(filename, 0, sizeof(filename)); - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - - if (writer(filename, fapl, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; - - puts("Test passed with the SEC2 Driver."); - -#ifdef H5_HAVE_FSEEKO - /* Clean up the test file */ - if (h5_cleanup(FILENAME, fapl)) remove(DNAME); - - /* Test big file with the STDIO driver only if fseeko is supported, - * because the OFFSET parameter of fseek has the type LONG, not big - * enough to support big files. */ - puts("\nTesting big file with the STDIO Driver "); - - fapl = h5_fileaccess(); - if(H5Pset_fapl_stdio(fapl) < 0) - - HDmemset(filename, 0, sizeof(filename)); - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - - if (writer(filename, fapl, WRT_N)) goto error; - if (reader(filename, fapl)) goto error; - puts("Test passed with the STDIO Driver."); -#endif -quit: /* End with normal exit code */ - if (h5_cleanup(FILENAME, fapl)) remove(DNAME); return 0; error: - if (fapl>=0) H5Pclose(fapl); puts("*** TEST FAILED ***"); return 1; } diff --git a/test/bittests.c b/test/bittests.c index e435d6c..f063cee 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -908,41 +908,36 @@ test_clear (void) * Programmer: Robb Matzke * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int -main (void) +main(void) { - int nerrors=0; + int nerrors = 0; /* - * Open the library explicitly for thread-safe builds, so per-thread - * things are initialized correctly. + * Open the library explicitly. */ -#ifdef H5_HAVE_THREADSAFE H5open(); -#endif /* H5_HAVE_THREADSAFE */ - - nerrors += test_find ()<0?1:0; - nerrors += test_set ()<0?1:0; - nerrors += test_clear()<0?1:0; - nerrors += test_copy ()<0?1:0; - nerrors += test_shift()<0?1:0; - nerrors += test_increment ()<0?1:0; - nerrors += test_decrement ()<0?1:0; - nerrors += test_negate ()<0?1:0; - - if (nerrors) { + + nerrors += test_find() < 0 ? 1 : 0; + nerrors += test_set() < 0 ? 1 : 0; + nerrors += test_clear() < 0 ? 1 : 0; + nerrors += test_copy() < 0 ? 1 : 0; + nerrors += test_shift() < 0 ? 1 : 0; + nerrors += test_increment() < 0 ? 1 : 0; + nerrors += test_decrement() < 0 ? 1 : 0; + nerrors += test_negate() < 0 ? 1 : 0; + + if(nerrors) { printf("***** %u FAILURE%s! *****\n", - nerrors, 1==nerrors?"":"S"); + nerrors, 1 == nerrors ? "" : "S"); exit(1); } printf("All bit tests passed.\n"); -#ifdef H5_HAVE_THREADSAFE H5close(); -#endif /* H5_HAVE_THREADSAFE */ + return 0; } + diff --git a/test/cross_read.c b/test/cross_read.c index 6b2badf..6588031 100755 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -17,8 +17,8 @@ * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> * Thursday, March 23, 2006 * - * Purpose: Check if floating-point data created on OpenVMS (VAX type), Solaris, - * and Linux machines can be read on the machine running this test. + * Purpose: Check if floating-point data created on OpenVMS, big-endian, and + * little-endian machines can be read on the machine running this test. */ #include "h5test.h" @@ -31,21 +31,63 @@ const char *FILENAME[] = { NULL }; -#define DATASETNAME "Array" -#define NX 5 /* output buffer dimensions */ -#define NY 6 -#define RANK 2 +#define DATASETNAME "Array" +#define DATASETNAME2 "Scale_offset_float_data_le" +#define DATASETNAME3 "Scale_offset_float_data_be" +#define DATASETNAME4 "Scale_offset_double_data_le" +#define DATASETNAME5 "Scale_offset_double_data_be" +#define DATASETNAME6 "Scale_offset_char_data_le" +#define DATASETNAME7 "Scale_offset_char_data_be" +#define DATASETNAME8 "Scale_offset_short_data_le" +#define DATASETNAME9 "Scale_offset_short_data_be" +#define DATASETNAME10 "Scale_offset_int_data_le" +#define DATASETNAME11 "Scale_offset_int_data_be" +#define DATASETNAME12 "Scale_offset_long_long_data_le" +#define DATASETNAME13 "Scale_offset_long_long_data_be" +#define NX 6 +#define NY 6 + +/*------------------------------------------------------------------------- + * Function: read_data + * + * Purpose: Read data from a data file. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Raymond Lu + * 21 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ static int read_data(char *fname) { const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */ hid_t file, dataset; /* handles */ - hid_t datatype; - hid_t dt; - double data_in[NX][NY]; /* input buffer */ - double data_out[NX][NY]; /* output buffer */ + double data_in[NX+1][NY]; /* input buffer */ + double data_out[NX+1][NY]; /* output buffer */ + long long int_data_in[NX+1][NY]; /* input buffer */ + long long int_data_out[NX+1][NY]; /* output buffer */ int i, j; unsigned nerrors = 0; + const char *not_supported= " Scaleoffset filter is not enabled."; + + /* + * Open the file. + */ + if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + TEST_ERROR; + + TESTING("regular dataset"); + + /* + * Open the regular dataset. + */ + if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) + TEST_ERROR; /* * Data and output buffer initialization. @@ -56,42 +98,277 @@ static int read_data(char *fname) data_out[j][i] = 0; } } + for (i = 0; i < NY; i++) { + data_in[NX][i] = -2.2; + data_out[NX][i] = 0; + } /* * 0 1 2 3 4 5 * 1 2 3 4 5 6 * 2 3 4 5 6 7 * 3 4 5 6 7 8 * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + * -2.2 -2.2 -2.2 -2.2 -2.2 -2.2 */ /* - * Open the file and the dataset. + * Read data from hyperslab in the file into the hyperslab in + * memory and display. */ - if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data_out) < 0) TEST_ERROR; - if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + /* if (data_out[j][i] != data_in[j][i]) { */ + if (!FLT_ABS_EQUAL(data_out[j][i], data_in[j][i])) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %g but should have been %g\n", + j, i, data_out[j][i], data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + + TESTING("dataset of LE FLOAT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME2, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + data_in[j][i] = ((double)(i + j + 1))/3; + data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + data_in[NX][i] = -2.2; + data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %g but should have been %g\n", + j, i, data_out[j][i], data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE FLOAT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + data_in[j][i] = ((double)(i + j + 1))/3; + data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + data_in[NX][i] = -2.2; + data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %g but should have been %g\n", + j, i, data_out[j][i], data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of LE DOUBLE with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) TEST_ERROR; /* - * Get datatype and dataspace handles and then query - * dataset class, order, size, rank and dimensions. + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + data_in[j][i] = ((double)(i + j + 1))/3; + data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + data_in[NX][i] = -2.2; + data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. */ - if((dt = H5Dget_type(dataset)) < 0) /* datatype handle */ + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data_out) < 0) TEST_ERROR; - if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT)) < 0) + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %g but should have been %g\n", + j, i, data_out[j][i], data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE DOUBLE with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME5, H5P_DEFAULT)) < 0) TEST_ERROR; /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + data_in[j][i] = ((double)(i + j + 1))/3; + data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + data_in[NX][i] = -2.2; + data_out[NX][i] = 0; + } + + /* * Read data from hyperslab in the file into the hyperslab in * memory and display. */ - if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0) + if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data_out) < 0) TEST_ERROR; /* Check results */ - for (j=0; j<NX; j++) { + for (j=0; j<(NX+1); j++) { for (i=0; i<NY; i++) { - if (data_out[j][i] != data_in[j][i]) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { if (!nerrors++) { H5_FAILED(); printf("element [%d][%d] is %g but should have been %g\n", @@ -104,10 +381,519 @@ static int read_data(char *fname) /* * Close/release resources. */ - H5Tclose(dt); - H5Tclose(datatype); - H5Dclose(dataset); - H5Fclose(file); + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of LE CHAR with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME6, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE CHAR with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME7, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of LE SHORT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME8, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE SHORT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME9, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of LE INT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME10, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE INT with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME11, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of LE LONG LONG with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME12, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + TESTING("dataset of BE LONG LONG with scale-offset filter"); + +#ifdef H5_HAVE_FILTER_SCALEOFFSET + /* + * Open the dataset with scale-offset filter. + */ + if((dataset = H5Dopen2(file, DATASETNAME13, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + int_data_in[j][i] = i + j; + int_data_out[j][i] = 0; + } + } + for (i = 0; i < NY; i++) { + int_data_in[NX][i] = -2; + int_data_out[NX][i] = 0; + } + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, + int_data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<(NX+1); j++) { + for (i=0; i<NY; i++) { + if (int_data_out[j][i] != int_data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been %d\n", + j, i, (int)int_data_out[j][i], + (int)int_data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + if(H5Dclose(dataset) < 0) + TEST_ERROR /* Failure */ if (nerrors) { @@ -116,6 +902,14 @@ static int read_data(char *fname) } PASSED(); + +#else /*H5_HAVE_FILTER_SCALEOFFSET*/ + SKIPPED(); + puts(not_supported); +#endif /*H5_HAVE_FILTER_SCALEOFFSET*/ + + if(H5Fclose(file)) + TEST_ERROR return 0; error: @@ -125,6 +919,20 @@ error: return 1; } + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the basic features of Virtual File Drivers + * + * Return: Success: exit(0) + * Failure: exit(1) + * + * Programmer: Raymond Lu + * Tuesday, Sept 24, 2002 + * + *------------------------------------------------------------------------- + */ int main(void) { char filename[1024]; @@ -132,15 +940,15 @@ int main(void) h5_reset(); - TESTING("reading data created on OpenVMS"); + puts("Testing reading data created on OpenVMS"); h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); nerrors += read_data(filename); - TESTING("reading data created on Linux"); + puts("Testing reading data created on Linux"); h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename); nerrors += read_data(filename); - TESTING("reading data created on Solaris"); + puts("Testing reading data created on Solaris"); h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename); nerrors += read_data(filename); diff --git a/test/dangle.c b/test/dangle.c index 2f8a67e..dfa73ba 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -513,6 +513,132 @@ error: /*------------------------------------------------------------------------- + * Function: test_dangle_force + * + * Purpose: Shut down all danging IDs with generic file & ID routines, + * instead of letting library shut then down. + * + * Return: Success: zero + * Failure: non-zero + * + * Programmer: Quincey Koziol + * Friday, October 29, 2010 + * + *------------------------------------------------------------------------- + */ +static int +test_dangle_force(void) +{ + char filename[1024]; + hid_t fid; /* File ID */ + hid_t gid, gid2; /* Group IDs */ + hid_t dsid, dsid2; /* Dataset IDs */ + hid_t sid; /* Dataspace ID */ + hid_t aid, aid2; /* Attribute IDs */ + hid_t tid, tid2; /* Named datatype IDs */ + ssize_t count; /* Count of open objects */ + hid_t *objs = NULL; /* Pointer to list of open objects */ + size_t u; /* Local index variable */ + + TESTING("force dangling IDs to close, from API routines"); + + h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create a dataspace for the dataset & attribute to use */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + FAIL_STACK_ERROR + + /* Create a dataset */ + if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Re-open the dataset */ + if((dsid2 = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create an attribute on the dataset */ + if((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Re-open the attribute */ + if((aid2 = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close the dataspace ID */ + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + + /* Open a group ID */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Open group again */ + if((gid2 = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create a named datatype */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + FAIL_STACK_ERROR + if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Re-open the named datatype */ + if((tid2 = H5Topen2(fid, TYPENAME, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Increment the ref count on all the "second" objects */ + if(H5Iinc_ref(dsid2) < 0) + FAIL_STACK_ERROR + if(H5Iinc_ref(aid2) < 0) + FAIL_STACK_ERROR + if(H5Iinc_ref(gid2) < 0) + FAIL_STACK_ERROR + if(H5Iinc_ref(aid2) < 0) + FAIL_STACK_ERROR + + /* Get the number of open objects */ + if((count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) + FAIL_STACK_ERROR + if(0 == count) + TEST_ERROR; + + /* Allocate the array of object IDs */ + objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + + /* Get the list of open IDs */ + if(H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) + FAIL_STACK_ERROR + + /* Close all open IDs */ + for(u = 0; u < (size_t)count; u++) + while(H5Iget_type(objs[u]) != H5I_BADID && H5Iget_ref(objs[u]) > 0) + H5Idec_ref(objs[u]); + + /* Get the number of open objects */ + if((count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) + FAIL_STACK_ERROR + if(0 != count) + TEST_ERROR; + + /* Clean up temporary file */ + HDremove(filename); + + /* Release object ID array */ + HDfree(objs); + + PASSED(); + return 0; + +error: + if(objs) + HDfree(objs); + return 1; +} + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Executes dangling ID tests @@ -556,6 +682,9 @@ main(void) nerrors += test_dangle_datatype2(H5F_CLOSE_STRONG); nerrors += test_dangle_attribute(H5F_CLOSE_STRONG); + /* Close open IDs "the hard way" */ + nerrors += test_dangle_force(); + /* Check for errors */ if (nerrors) goto error; diff --git a/test/dsets.c b/test/dsets.c index 1d831f1..b2b2521 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -53,6 +53,7 @@ const char *FILENAME[] = { NULL }; #define FILENAME_BUF_SIZE 1024 +#define KB 1024 #define FILE_DEFLATE_NAME "deflate.h5" @@ -99,6 +100,8 @@ const char *FILENAME[] = { #define DSET_NBIT_COMPOUND_NAME "nbit_compound" #define DSET_NBIT_COMPOUND_NAME_2 "nbit_compound_2" #define DSET_NBIT_COMPOUND_NAME_3 "nbit_compound_3" +#define DSET_NBIT_INT_SIZE_NAME "nbit_int_size" +#define DSET_NBIT_FLT_SIZE_NAME "nbit_flt_size" #define DSET_SCALEOFFSET_INT_NAME "scaleoffset_int" #define DSET_SCALEOFFSET_INT_NAME_2 "scaleoffset_int_2" #define DSET_SCALEOFFSET_FLOAT_NAME "scaleoffset_float" @@ -3933,6 +3936,384 @@ error: /*------------------------------------------------------------------------- + * Function: test_nbit_int_size + * + * Purpose: Tests the correct size of the integer datatype for nbit filter + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Raymond Lu + * 19 November 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_nbit_int_size(hid_t file) +{ +#ifdef H5_HAVE_FILTER_NBIT + hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props; + hsize_t dims[2], chunk_size[2]; + hsize_t dset_size = 0; + int orig_data[DSET_DIM1][DSET_DIM2]; + int i, j; + size_t precision, offset; +#else /* H5_HAVE_FILTER_NBIT */ + const char *not_supported= " Nbit is not enabled."; +#endif /* H5_HAVE_FILTER_NBIT */ + + TESTING(" nbit integer dataset size"); +#ifdef H5_HAVE_FILTER_NBIT + + /* Define dataset datatype (integer), and set precision, offset */ + if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { + H5_FAILED(); + printf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } /* end if */ + + precision = 16; /* precision includes sign bit */ + if(H5Tset_precision(datatype,precision)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_precision failed\n",__LINE__); + goto error; + } /* end if */ + + offset = 8; + if(H5Tset_offset(datatype,offset)<0) { + H5_FAILED(); + printf(" line %d: H5Tset_offset failed\n",__LINE__); + goto error; + } /* end if */ + + /* Copy to memory datatype */ + if((mem_datatype = H5Tcopy(datatype)) < 0) { + H5_FAILED(); + printf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } /* end if */ + + /* Set order of dataset datatype */ + if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_order failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Tset_size(datatype, 4)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_size failed\n",__LINE__); + goto error; + } /* end if */ + + /* Initiliaze data buffer with random data within correct range + * corresponding to the memory datatype's precision and offset. + */ + for (i=0; i < DSET_DIM1; i++) + for (j=0; j < DSET_DIM2; j++) + orig_data[i][j] = rand() % (int)pow(2, precision-1) <<offset; + + + /* Describe the dataspace. */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((dataspace = H5Screate_simple (2, dims, NULL))<0) { + H5_FAILED(); + printf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Set the dataset creation property list to specify the chunks + */ + chunk_size[0] = DSET_DIM1/10; + chunk_size[1] = DSET_DIM2/10; + if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { + H5_FAILED(); + printf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_chunk failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Set for n-bit compression + */ + if(H5Pset_nbit (dset_create_props)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_nbit failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Create a new dataset within the file. + */ + if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype, + dataspace, H5P_DEFAULT, + dset_create_props, H5P_DEFAULT))<0) { + H5_FAILED(); + printf(" line %d: H5dwrite failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Write the array to the file. + */ + if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, + H5P_DEFAULT, orig_data)<0) { + H5_FAILED(); + printf(" Line %d: H5Dwrite failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Get the precision of the data type + */ + if((precision = H5Tget_precision(datatype)) == 0) { + H5_FAILED(); + printf(" Line %d: wrong precision size: %d\n",__LINE__, precision); + goto error; + } /* end if */ + + /* + * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 + */ + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { + H5_FAILED(); + printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size); + goto error; + } /* end if */ + + H5Tclose (datatype); + H5Tclose (mem_datatype); + H5Dclose (dataset); + H5Sclose (dataspace); + H5Pclose (dset_create_props); + + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + return 0; +error: + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_nbit_flt_size + * + * Purpose: Tests the correct size of the floating-number datatype for + * nbit filter + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Raymond Lu + * 19 November 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_nbit_flt_size(hid_t file) +{ +#ifdef H5_HAVE_FILTER_NBIT + hid_t dataspace, dataset, datatype, dset_create_props; + hsize_t dims[2], chunk_size[2]; + hsize_t dset_size = 0; + float orig_data[DSET_DIM1][DSET_DIM2]; + int i, j; + size_t precision, offset; + size_t spos, epos, esize, mpos, msize; +#else /* H5_HAVE_FILTER_NBIT */ + const char *not_supported= " Nbit is not enabled."; +#endif /* H5_HAVE_FILTER_NBIT */ + + TESTING(" nbit floating-number dataset size"); +#ifdef H5_HAVE_FILTER_NBIT + + /* Define floating-point type for dataset + *------------------------------------------------------------------- + * size=4 byte, precision=16 bits, offset=8 bits, + * mantissa size=9 bits, mantissa position=8, + * exponent size=6 bits, exponent position=17, + * exponent bias=31. + * It can be illustrated in little-endian order as: + * (S - sign bit, E - exponent bit, M - mantissa bit, + * ? - padding bit) + * + * 3 2 1 0 + * ???????? SEEEEEEM MMMMMMMM ???????? + * + * To create a new floating-point type, the following + * properties must be set in the order of + * set fields -> set offset -> set precision -> set size. + * All these properties must be set before the type can function. + * Other properties can be set anytime. Derived type size cannot + * be expanded bigger than original size but can be decreased. + * There should be no holes among the significant bits. Exponent + * bias usually is set 2^(n-1)-1, where n is the exponent size. + *-------------------------------------------------------------------*/ + if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) { + H5_FAILED(); + printf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } /* end if */ + + msize = 9; + spos = 23; + epos = 17; + esize = 6; + mpos = 8; + offset = 8; + precision = 16; + + if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) { + H5_FAILED(); + printf(" line %d: H5Tset_fields failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Tset_offset(datatype,offset)<0) { + H5_FAILED(); + printf(" line %d: H5Tset_offset failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Tset_precision(datatype,precision)<0) { + H5_FAILED(); + printf(" line %d: H5Tset_precision failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Tset_size(datatype, 4)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_size failed\n",__LINE__); + goto error; + } /* end if */ + + /* Set order of dataset datatype */ + if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_order failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Tset_ebias(datatype, 31)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_size failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Initiliaze data buffer with random data + */ + for (i=0; i < DSET_DIM1; i++) + for (j=0; j < DSET_DIM2; j++) + orig_data[i][j] = (rand() % 1234567) / 2; + + + /* Describe the dataspace. */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((dataspace = H5Screate_simple (2, dims, NULL))<0) { + H5_FAILED(); + printf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Set the dataset creation property list to specify the chunks + */ + chunk_size[0] = DSET_DIM1/10; + chunk_size[1] = DSET_DIM2/10; + if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { + H5_FAILED(); + printf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } /* end if */ + + if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_chunk failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Set for n-bit compression + */ + if(H5Pset_nbit (dset_create_props)<0) { + H5_FAILED(); + printf(" line %d: H5Pset_nbit failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Create a new dataset within the file. + */ + if((dataset = H5Dcreate2 (file, DSET_NBIT_FLT_SIZE_NAME, datatype, + dataspace, H5P_DEFAULT, + dset_create_props, H5P_DEFAULT))<0) { + H5_FAILED(); + printf(" line %d: H5dwrite failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Write the array to the file. + */ + if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, orig_data)<0) { + H5_FAILED(); + printf(" Line %d: H5Dwrite failed\n",__LINE__); + goto error; + } /* end if */ + + /* + * Get the precision of the data type + */ + if((precision = H5Tget_precision(datatype)) == 0) { + H5_FAILED(); + printf(" Line %d: wrong precision size: %d\n",__LINE__, precision); + goto error; + } /* end if */ + + /* + * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 + */ + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { + H5_FAILED(); + printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size); + goto error; + } /* end if */ + + H5Tclose (datatype); + H5Dclose (dataset); + H5Sclose (dataspace); + H5Pclose (dset_create_props); + + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + return 0; +error: + return -1; +} + +/*------------------------------------------------------------------------- * Function: test_scaleoffset_int * * Purpose: Tests the integer datatype for scaleoffset filter @@ -7770,6 +8151,8 @@ main(void) nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); + nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); diff --git a/test/dt_arith.c b/test/dt_arith.c index 8d4b65b..078242d 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -5107,9 +5107,25 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); #if H5_SIZEOF_LONG!=H5_SIZEOF_INT +#ifndef H5_LONG_TO_LDOUBLE_SPECIAL nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); +#else + { + char str[256]; /*string */ + + sprintf(str, "Testing %s %s -> %s conversions", + name, "(unsigned) long", "long double"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the special algorithm of hardware conversion."); +#else + HDputs(" Test skipped due to disabled long double."); #endif + } +#endif +#endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */ #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG #if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); @@ -5177,8 +5193,8 @@ run_int_fp_conv(const char *name) static int run_fp_int_conv(const char *name) { -#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS int nerrors = 0; +#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS int test_values; #ifdef H5_VMS @@ -5272,9 +5288,25 @@ run_fp_int_conv(const char *name) } #endif /*H5_LDOUBLE_TO_UINT_ACCURATE*/ #if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 +#ifndef H5_LDOUBLE_TO_LONG_SPECIAL nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); +#else + { + char str[256]; /*string */ + + sprintf(str, "Testing %s %s -> %s conversions", + name, "long double", "(unsigned) long"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the special algorithm of hardware conversion."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif + } #endif +#endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 */ #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0 #ifdef H5_LDOUBLE_TO_LLONG_ACCURATE diff --git a/test/err_compat.c b/test/err_compat.c index be86a2d..c08e259 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -42,20 +42,187 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" #define FAKE_ID -1 -herr_t custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data); +herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data); +herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data); /*------------------------------------------------------------------------- - * Function: test_error + * Function: user_print1 * - * Purpose: Test error API functions + * Purpose: This function is a user-defined old-style printing function. + * This is just a convenience function for H5Ewalk1() with a + * function that prints error messages. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 4 October 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +user_print1(FILE *stream) +{ + /* Customized way to print errors */ + fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + if(H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0) + TEST_ERROR; + + return 0; + + error: + return -1; + +} + + +/*------------------------------------------------------------------------- + * Function: user_print2 + * + * Purpose: This function is a user-defined new-style printing function. + * This is just a convenience function for H5Ewalk2() with a + * function that prints error messages. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 4 October 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +user_print2(hid_t err_stack, FILE *stream) +{ + /* Customized way to print errors */ + fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + if(H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0) + TEST_ERROR; + + return 0; + + error: + return -1; + +} + + +/*------------------------------------------------------------------------- + * Function: custom_print_cb1 + * + * Purpose: Callback function to print error stack in customized way + * for H5Ewalk1. * * Return: Success: 0 * * Failure: -1 * * Programmer: Raymond Lu - * July 10, 2003 + * 4 October 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) +{ + FILE *stream = (FILE *)client_data; + char *maj = NULL; + char *min = NULL; + const int indent = 4; + + if(NULL == (min = H5Eget_minor(err_desc->min_num))) + TEST_ERROR; + + if(NULL == (maj = H5Eget_major(err_desc->maj_num))) + TEST_ERROR; + + fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + + HDfree(maj); + HDfree(min); + + return 0; + +error: + if(maj) + HDfree(maj); + if(min) + HDfree(min); + + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: custom_print_cb2 + * + * Purpose: Callback function to print error stack in customized way + * for H5Ewalk1. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Raymond Lu + * 4 October 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) +{ + FILE *stream = (FILE *)client_data; + char *maj = NULL; + char *min = NULL; + const int indent = 4; + + if(NULL == (min = H5Eget_minor(err_desc->min_num))) + TEST_ERROR; + + if(NULL == (maj = H5Eget_major(err_desc->maj_num))) + TEST_ERROR; + + fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + + HDfree(maj); + HDfree(min); + + return 0; + +error: + if(maj) + HDfree(maj); + if(min) + HDfree(min); + + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_error1 + * + * Purpose: Test the backward compatibility of H5Eset/get_auto. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Raymond Lu + * 17 September 2010 * * * Modifications: @@ -63,13 +230,143 @@ herr_t custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data); *------------------------------------------------------------------------- */ static herr_t -test_error(hid_t file) +test_error1(void) { hid_t dataset, space; hsize_t dims[2]; - const char *FUNC_test_error="test_error"; - H5E_auto1_t old_func; + H5E_auto1_t old_func1; + H5E_auto2_t old_func2; void *old_data; + herr_t ret; + + TESTING("error API H5Eset/get_auto"); + fprintf(stderr, "\n"); + + /* Create the data space */ + dims[0] = DIM0; + dims[1] = DIM1; + if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + + /* Use H5Eget_auto2 to query the default printing function. The library + *should indicate H5Eprint2 as the default. */ + if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0) + TEST_ERROR; + if (old_data != NULL) + TEST_ERROR; + if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) + TEST_ERROR; + + /* This function sets the default printing function to be H5Eprint2. */ + if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0) + TEST_ERROR; + + /* Try the printing function. Dataset creation should fail because the file + * doesn't exist. */ + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + if(dataset >= 0) + TEST_ERROR; + + /* This call should work. It simply returns H5Eprint1. */ + if((ret = H5Eget_auto1(&old_func1, &old_data))<0) + TEST_ERROR; + if (old_data != NULL) + TEST_ERROR; + if (!old_func1 || (H5E_auto1_t)H5Eprint1 != old_func1) + TEST_ERROR; + + /* This function changes the old-style printing function to be user_print1. */ + if(H5Eset_auto1((H5E_auto1_t)user_print1, stderr)<0) + TEST_ERROR; + + /* Try the printing function. Dataset creation should fail because the file + * doesn't exist. */ + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + if(dataset >= 0) + TEST_ERROR; + + /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. + * Once the H5Eset_auto1 is called with a user-defined printing function, + * a call to H5Eget_auto2 will fail. But keep in mind the printing function is + * user_print1. */ + if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))>=0) + TEST_ERROR; + + /* This function changes the new-style printing function to be user_print2. */ + if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr)<0) + TEST_ERROR; + + /* Try the printing function. Dataset creation should fail because the file + * doesn't exist. */ + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + if(dataset >= 0) + TEST_ERROR; + + /* This function changes the new-style printing function back to the default H5Eprint2. */ + if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL)<0) + TEST_ERROR; + + /* This call should work because the H5Eset_auto2 above restored the default printing + * function H5Eprint2. It simply returns user_print1. */ + if((ret = H5Eget_auto1(&old_func1, &old_data))<0) + TEST_ERROR; + if (old_data != NULL) + TEST_ERROR; + if (!old_func1 || (H5E_auto1_t)user_print1 != old_func1) + TEST_ERROR; + + /* This function changes the new-style printing function back to the default H5Eprint1. */ + if(H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL)<0) + TEST_ERROR; + + /* This call should work because the H5Eset_auto1 above restored the default printing + * function H5Eprint1. It simply returns H5Eprint2. */ + if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))<0) + TEST_ERROR; + if (old_data != NULL) + TEST_ERROR; + if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) + TEST_ERROR; + + /* Try the printing function. Dataset creation should fail because the file + * doesn't exist. */ + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + if(dataset >= 0) + TEST_ERROR; + + return 0; + + error: + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_error2 + * + * Purpose: Test error API functions, mainly on H5Epush1. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Raymond Lu + * July 10, 2003 + * + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_error2(hid_t file) +{ + hid_t dataset, space; + hsize_t dims[2]; + const char *FUNC_test_error="test_error2"; TESTING("error API based on data I/O"); fprintf(stderr, "\n"); @@ -92,22 +389,12 @@ test_error(hid_t file) goto error; } - /* Test enabling and disabling default printing */ - if (H5Eget_auto1(&old_func, &old_data)<0) - TEST_ERROR; - if (old_data != NULL) - TEST_ERROR; - if (!old_func) - TEST_ERROR; -#ifdef H5_USE_16_API - if (old_func != (H5E_auto1_t)H5Eprint1) - TEST_ERROR; -#else /* H5_USE_16_API */ - if (old_func != (H5E_auto1_t)H5Eprint2) - TEST_ERROR; -#endif /* H5_USE_16_API */ - - if(H5Eset_auto1(NULL, NULL)<0) + /* Disable the library's default printing function */ +#ifdef H5_USE_16_API_DEFAULT + if(H5Eset_auto(NULL, NULL)<0) +#else + if(H5Eset_auto(H5E_DEFAULT, NULL, NULL)<0) +#endif TEST_ERROR; /* Make H5Dwrite fail, verify default print is disabled */ @@ -117,9 +404,6 @@ test_error(hid_t file) goto error; } - if(H5Eset_auto1(old_func, old_data)<0) - TEST_ERROR; - /* In case program comes to this point, close dataset */ if(H5Dclose(dataset)<0) TEST_ERROR; @@ -157,7 +441,7 @@ dump_error(void) /* Customized way to print errors */ fprintf(stderr, "\n********* Print error stack in customized way *********\n"); - if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb, stderr) < 0) + if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0) TEST_ERROR; return 0; @@ -166,57 +450,6 @@ dump_error(void) return -1; } -/*------------------------------------------------------------------------- - * Function: custom_print_cb - * - * Purpose: Callback function to print error stack in customized way. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Raymond Lu - * July 17, 2003 - * - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data) -{ - FILE *stream = (FILE *)client_data; - char *maj = NULL; - char *min = NULL; - const int indent = 4; - - if(NULL == (min = H5Eget_minor(err_desc->min_num))) - TEST_ERROR; - - if(NULL == (maj = H5Eget_major(err_desc->maj_num))) - TEST_ERROR; - - fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); - - fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); - fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); - - HDfree(maj); - HDfree(min); - - return 0; - -error: - if(maj) - HDfree(maj); - if(min) - HDfree(min); - - return -1; -} /*------------------------------------------------------------------------- @@ -258,7 +491,9 @@ main(void) H5Eclear1(); /* Test error API */ - if(test_error(file) < 0) { + if(test_error1() < 0) TEST_ERROR ; + + if(test_error2(file) < 0) { H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "Error test failed"); H5Eprint1(stderr); @@ -275,4 +510,3 @@ main(void) return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/test/external.c b/test/external.c index 7fd344e..3e1388c 100644 --- a/test/external.c +++ b/test/external.c @@ -879,7 +879,7 @@ test_4 (hid_t fapl) if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; - /* Open the external link */ + /* Open the external link which is "/ link" as created previously via H5Lcreate_external() */ if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) goto error; diff --git a/test/fheap.c b/test/fheap.c index e38302c..3d8e69d 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7621,14 +7621,14 @@ test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from root direct block of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill the heap up */ state.man_size = DBLOCK_SIZE(fh, 0); @@ -7695,14 +7695,14 @@ test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from two direct blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill the first block in heap */ state.man_size = DBLOCK_SIZE(fh, 0); @@ -7784,14 +7784,14 @@ test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from first row of direct blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill first row of direct blocks */ if(fill_root_row(fh, dxpl, 0, fill_size, &state, &keep_ids)) @@ -7855,14 +7855,14 @@ test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_par fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from first two rows of direct blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill first two rows of direct blocks */ if(fill_root_row(fh, dxpl, 0, fill_size, &state, &keep_ids)) @@ -7928,14 +7928,14 @@ test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from first four rows of direct blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill first two rows of direct blocks */ if(fill_root_row(fh, dxpl, 0, fill_size, &state, &keep_ids)) @@ -8005,14 +8005,14 @@ test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from all direct blocks of root group in absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -8076,14 +8076,14 @@ test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from 2nd level indirect blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -8151,14 +8151,14 @@ test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "removing all objects from 3rd level indirect blocks of absolute heap %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -8235,14 +8235,14 @@ test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "inserting object that is too large for starting block, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1; state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0); state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1); @@ -8313,14 +8313,14 @@ test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "skipping starting block, then adding object back to first block, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Insert object too large for starting block size */ obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1; @@ -8413,14 +8413,14 @@ test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "skipping starting block, then adding objects to backfill and extend, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Insert object too large for starting block size */ obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1; @@ -8522,14 +8522,14 @@ test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert object to initial block, then add object too large for starting direct blocks, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Insert small object, to create root direct block */ state.man_size = DBLOCK_SIZE(fh, 0); @@ -8621,14 +8621,14 @@ test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes const char *base_desc = "insert object to initial block, then add object too large for starting direct blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Insert small object, to create root direct block */ state.man_size = DBLOCK_SIZE(fh, 0); @@ -8766,14 +8766,14 @@ test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t * const char *base_desc = "skipping blocks with indirect root, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variable */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill initial direct block */ state.man_size = DBLOCK_SIZE(fh, 0); @@ -8931,14 +8931,14 @@ test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "filling first row, then skipping rows, then backfill and extend, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill first row of direct blocks */ if(fill_root_row(fh, dxpl, 0, fill_size, &state, &keep_ids)) @@ -9060,14 +9060,14 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_ const char *base_desc = "skipping direct blocks to last row and skipping two rows of root indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Compute # direct block rows in root indirect block */ num_direct_rows = DTABLE_MAX_DROWS(fh); @@ -9185,14 +9185,14 @@ test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_crea fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "filling direct blocks and skipping blocks in non-root indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -9312,14 +9312,14 @@ test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_ const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variable */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -9440,14 +9440,14 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, except last one, and insert object too large for 2nd level indirect blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -9587,14 +9587,14 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5 const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then skip row of direct blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variable */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -9757,14 +9757,14 @@ test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_ const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -9911,14 +9911,14 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, skip one row of root indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -10088,14 +10088,14 @@ test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, and skip first rows of direct blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -10217,14 +10217,14 @@ test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first rows of direct blocks of 3rd level indirect block's 2nd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, dxpl, fill_size, &state, &keep_ids)) @@ -10357,14 +10357,14 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first row of indirect blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -10509,14 +10509,14 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped( const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first two rows of indirect blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -10672,14 +10672,14 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect blocks, except last one, fill all direct blocks in last 3rd level indirect block, and insert object too large for it's 2nd level indirect blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -10835,14 +10835,14 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect blocks, fill all direct blocks in next 3rd level indirect block, fill all 1st row of 2nd level indirect blocks, except last one, and insert object too large for 2nd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11002,14 +11002,14 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5 const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill 4th level indirect block's direct blocks, and skip first row of 2nd indirect blocks of 4th level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11164,14 +11164,14 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill 4th level indirect block's direct, 2nd level indirect blocks and 3rd level direct block, and skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11344,14 +11344,14 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 4th level indirect blocks, fill 2nd row 4th level indirect block's direct, 2nd level indirect blocks, first row of 3rd level indirect blocks, 3rd level direct block in 2nd row, and skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11559,14 +11559,14 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 3rd level indirect blocks in 4th level indirect block except last 3rd level block, fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11756,14 +11756,14 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 4th level indirect blocks, except last one, fill first row of 3rd level indirect blocks in last 4th level indirect block except last 3rd level block, fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -11982,14 +11982,14 @@ test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar const char *base_desc = "fragmenting small blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Insert objects small enough to fit into initial blocks, but not to * share them with other objects of the same size, until the next larger @@ -12115,14 +12115,14 @@ test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar const char *base_desc = "fragmenting direct blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Retrieve # of direct rows in root indirect block */ root_direct_rows = H5HF_get_dtable_max_drows_test(fh); @@ -12288,14 +12288,14 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * const char *base_desc = "fill root direct blocks, then fragment 2nd level indirect block's direct blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Compute # of bits used in first row */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); @@ -12402,14 +12402,14 @@ test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * const char *base_desc = "fill root direct blocks and 2nd level indirect blocks, then fragment 3rd level indirect block's direct blocks, then backfill and extend, then remove all objects %s"; /* Test description */ unsigned u, v; /* Local index variables */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Compute # of direct rows in root indirect block */ root_direct_rows = DTABLE_MAX_DROWS(fh); @@ -12519,14 +12519,14 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert one huge object, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -12673,14 +12673,14 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert two huge objects, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -12907,14 +12907,14 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert three huge objects, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -13217,14 +13217,14 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert mix of normal & huge objects, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -13855,14 +13855,14 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert one tiny object, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -14009,14 +14009,14 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert two tiny objects, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -14248,14 +14248,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar fheap_heap_state_t state; /* State of fractal heap */ const char *base_desc = "insert mix of normal, huge & tiny objects, then remove %s"; /* Test description */ - /* Perform common file & heap open operations */ - if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) - TEST_ERROR - /* Perform common test initialization operations */ if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0) TEST_ERROR + /* Perform common file & heap open operations */ + if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) + TEST_ERROR + /* Allocate heap ID(s) */ if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR @@ -15365,6 +15365,9 @@ test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_pa fheap_heap_state_t state; /* State of fractal heap */ size_t u; /* Local index variable */ + /* Initialize the heap ID structure */ + HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); + /* Copy heap creation properties */ HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); @@ -15404,9 +15407,6 @@ test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_pa TESTING("inserting random-sized objects, then remove all objects (all - random)") } /* end else */ - /* Initialize the heap ID structure */ - HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); - /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK @@ -15569,6 +15569,9 @@ test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_te fheap_heap_state_t state; /* State of fractal heap */ size_t u; /* Local index variable */ + /* Initialize the heap ID structure */ + HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); + /* Copy heap creation properties */ HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); @@ -15608,9 +15611,6 @@ test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_te TESTING("inserting random-sized objects with power of 2 distribution, then remove all objects (all - random)") } /* end else */ - /* Initialize the heap ID structure */ - HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); - /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK @@ -15805,6 +15805,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) else TESTING("writing objects in heap") + /* Initialize the heap ID structure */ + HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); + /* Copy heap creation properties */ HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t)); @@ -15843,9 +15846,6 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(id_len > MAX_HEAP_ID_LEN) TEST_ERROR - /* Initialize the heap ID structure */ - HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); - /* Create 'tiny' and 'huge' objects */ obj_size = id_len / 2; @@ -16072,6 +16072,9 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) */ TESTING("bug1: inserting several objects & removing one, then re-inserting") + /* Initialize the heap ID structure */ + HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); + /* Perform common file & heap open operations */ if(open_heap(filename, fapl, dxpl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0) TEST_ERROR @@ -16082,9 +16085,6 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(id_len > MAX_HEAP_ID_LEN) TEST_ERROR - /* Initialize the heap ID structure */ - HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t)); - /* Insert objects */ obj_size = 44; obj_loc = 1; diff --git a/test/filter_fail.c b/test/filter_fail.c index abb25cd..9b46421 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -25,13 +25,13 @@ #include "H5srcdir.h" #define DSET_NAME "dset_fail" -#define ONE_MB 1048576 #define H5Z_FILTER_FAIL_TEST 312 #define DIM 10 #define FILTER_CHUNK_DIM 2 const char *FILENAME[] = { - "filter_fail", + "filter_fail_with_cache", + "filter_fail_without_cache", NULL }; @@ -70,9 +70,6 @@ filter_fail(unsigned int flags, size_t cd_nelmts, size_t *buf_size, void **buf) { int *dst = (int*)(*buf); - unsigned int offset; - unsigned int length; - unsigned int value; size_t ret_value = 0; if(flags & H5Z_FLAG_REVERSE) { /* do nothing during read */ @@ -89,7 +86,6 @@ filter_fail(unsigned int flags, size_t cd_nelmts, } } /* end else */ -error: return ret_value; } /* end filter_fail() */ @@ -112,27 +108,30 @@ error: * 25 August 2010 * * Modifications: - * + * Raymond Lu + * 5 Oct 2010 + * Test when the chunk cache is enable and disabled to make + * sure the library behaves properly. *------------------------------------------------------------------------- */ static herr_t -test_filter_write(char *file_name, hid_t my_fapl) +test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) { - char filename[1024]; hid_t file = -1; hid_t dataset=-1; /* dataset ID */ hid_t sid=-1; /* dataspace ID */ hid_t dcpl=-1; /* dataset creation property list ID */ hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/ hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/ - int nfilters; /* number of filters in DCPL */ - unsigned flags; /* flags for filter */ int points[DIM]; /* Data */ - int rbuf[DIM]; /* Data */ herr_t ret; /* generic return value */ int i; - TESTING("data writing when a mandatory filter fails"); + if(cache_enabled) { + TESTING("data writing when a mandatory filter fails and chunk cache is enabled"); + } else { + TESTING("data writing when a mandatory filter fails and chunk cache is disabled"); + } /* Create file */ if((file = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR @@ -161,24 +160,44 @@ test_filter_write(char *file_name, hid_t my_fapl) for(i = 0; i < DIM; i++) points[i] = i; - /* Write data */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0) TEST_ERROR + /* Write data. If the chunk cache is enabled, H5Dwrite should succeed. If it is + * diabled, H5Dwrite should fail. */ + if(cache_enabled) { + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0) + TEST_ERROR + } else { + /* Data writing should fail */ + H5E_BEGIN_TRY { + ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points); + } H5E_END_TRY; + if(ret >= 0) { + H5_FAILED(); + puts(" Data writing is supposed to fail because the chunk can't be written to file."); + TEST_ERROR + } + } /* clean up objects used for this test */ if(H5Pclose (dcpl) < 0) TEST_ERROR if(H5Sclose (sid) < 0) TEST_ERROR - /* Dataset closing should fail */ - H5E_BEGIN_TRY { - ret = H5Dclose (dataset); - } H5E_END_TRY; - if(ret >= 0) { - H5_FAILED(); - puts(" Dataset is supposed to fail because the chunk can't be flushed to file."); - TEST_ERROR + /* Close dataset. If the chunk cache is enabled, the flushing of chunks should fail + * during H5Dclose. If it is diabled, H5Dwrite should fail but H5Dclose should succeed. */ + if(cache_enabled) { + H5E_BEGIN_TRY { + ret = H5Dclose (dataset); + } H5E_END_TRY; + if(ret >= 0) { + H5_FAILED(); + puts(" Dataset is supposed to fail because the chunk can't be flushed to file."); + TEST_ERROR + } + } else { + if(H5Dclose (dataset) < 0) + TEST_ERROR } - /* Even though H5Dclose fails, it should release all resources. + /* Even though H5Dclose or H5Dwrite fails, it should release all resources. * So the file should close successfully. */ if(H5Fclose (file) < 0) TEST_ERROR @@ -222,7 +241,6 @@ test_filter_read(char *file_name, hid_t my_fapl) hid_t sid = -1; hid_t mspace = -1; hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/ - hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/ int rbuf[DIM]; /* Data */ hsize_t dset_size = 0; /* Dataset storage size */ hsize_t hs_offset[H5S_MAX_RANK]; @@ -346,9 +364,9 @@ int main(void) { hid_t fapl; int mdc_nelmts = 0; - size_t rdcc_nelmts = 521; - size_t rdcc_nbytes = ONE_MB; - double rdcc_w0 = 0.75; + size_t rdcc_nelmts = 0; + size_t rdcc_nbytes = 0; + double rdcc_w0 = 0; char filename[1024]; unsigned nerrors = 0; @@ -357,12 +375,21 @@ int main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Make sure the chunk cache is used. All values are default. */ + /* The chunk cache is used so that the flushing of data chunks happens + * during H5Dclose. All values are default. */ + nerrors += (test_filter_write(filename, fapl, TRUE) < 0 ? 1 : 0); + nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); + + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + + /* Disable the chunk cache so that the writing of data chunks happens + * during H5Dwrite. */ if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) TEST_ERROR - nerrors += (test_filter_write(filename, fapl) < 0 ? 1 : 0); - nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); + /* Run the test again. */ + nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0); + nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); h5_cleanup(FILENAME, fapl); diff --git a/test/gen_cross.c b/test/gen_cross.c index 46afc35..32be867 100755 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -27,19 +27,56 @@ #include "h5test.h" #define H5FILE_NAME "data.h5" -#define DATASETNAME "Array" -#define NX 5 /* dataset dimensions */ -#define NY 6 -#define RANK 2 +#define DATASETNAME "Array" +#define DATASETNAME2 "Scale_offset_float_data_le" +#define DATASETNAME3 "Scale_offset_float_data_be" +#define DATASETNAME4 "Scale_offset_double_data_le" +#define DATASETNAME5 "Scale_offset_double_data_be" +#define DATASETNAME6 "Scale_offset_char_data_le" +#define DATASETNAME7 "Scale_offset_char_data_be" +#define DATASETNAME8 "Scale_offset_short_data_le" +#define DATASETNAME9 "Scale_offset_short_data_be" +#define DATASETNAME10 "Scale_offset_int_data_le" +#define DATASETNAME11 "Scale_offset_int_data_be" +#define DATASETNAME12 "Scale_offset_long_long_data_le" +#define DATASETNAME13 "Scale_offset_long_long_data_be" +#define NX 6 +#define NY 6 +#define RANK 2 +#define CHUNK0 4 +#define CHUNK1 3 +int create_normal_dset(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid); +int create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid); + + +/*------------------------------------------------------------------------- + * Function: create_normal_dset + * + * Purpose: Create a regular dataset of DOUBLE datatype. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Raymond Lu + * Some time ago + * + * Modifications: + * + *------------------------------------------------------------------------- + */ int -main (void) +create_normal_dset(hid_t fid, hid_t fsid, hid_t msid) { - hid_t file, dataset; /* file and dataset handles */ - hid_t datatype, dataspace; /* handles */ - hsize_t dimsf[2]; /* dataset dimensions */ - herr_t status; + hid_t dataset; /* file and dataset handles */ + hid_t dcpl; float data[NX][NY]; /* data to write */ + float fillvalue = -2.2; int i, j; /* @@ -55,49 +92,776 @@ main (void) * 2 3 4 5 6 7 * 3 4 5 6 7 8 * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + * -2.2 -2.2 -2.2 -2.2 -2.2 -2.2 */ /* - * Create a new file using H5F_ACC_TRUNC access, - * default file creation properties, and default file - * access properties. + * Create the dataset creation property list, set the fill value. */ - file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0) + TEST_ERROR /* - * Describe the size of the array and create the data space for fixed - * size dataset. + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. */ - dimsf[0] = NX; - dimsf[1] = NY; - dataspace = H5Screate_simple(RANK, dimsf, NULL); + if((dataset = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_DOUBLE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. + * Write the data to the dataset using default transfer properties. */ - datatype = H5Tcopy(H5T_NATIVE_DOUBLE); + if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dsets_float + * + * Purpose: Create a dataset of FLOAT datatype with scale-offset filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * 27 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + float data[NX][NY]; /* data to write */ + float fillvalue = -2.2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = ((float)(i + j + 1))/3; + } + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. + */ + if((dataset = H5Dcreate2(fid, DATASETNAME2, H5T_IEEE_F32LE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* + * Write the data to the dataset using default transfer properties. + */ + if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME3, H5T_IEEE_F32BE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dsets_double + * + * Purpose: Create a dataset of DOUBLE datatype with scale-offset filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Raymond Lu + * 21 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + double data[NX][NY]; /* data to write */ + double fillvalue = -2.2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = ((double)(i + j + 1))/3; + } + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. + */ + if((dataset = H5Dcreate2(fid, DATASETNAME4, H5T_IEEE_F64LE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* + * Write the data to the dataset using default transfer properties. + */ + if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME5, H5T_IEEE_F64BE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dset_char + * + * Purpose: Create a dataset of CHAR datatype with scale-offset filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * 27 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + char data[NX][NY]; /* data to write */ + char fillvalue = -2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + */ + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. + */ + if((dataset = H5Dcreate2(fid, DATASETNAME6, H5T_STD_I8LE, fsid, H5P_DEFAULT, + dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* + * Write the data to the dataset using default transfer properties. + */ + if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME7, H5T_STD_I8BE, fsid, H5P_DEFAULT, + dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dset_short + * + * Purpose: Create a dataset of SHORT datatype with scale-offset filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * 27 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + short data[NX][NY]; /* data to write */ + short fillvalue = -2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + */ + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. + */ + if((dataset = H5Dcreate2(fid, DATASETNAME8, H5T_STD_I16LE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* + * Write the data to the dataset using default transfer properties. + */ + if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME9, H5T_STD_I16BE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dset_int + * + * Purpose: Create a dataset of INT datatype with scale-offset filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Raymond Lu + * 21 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + int data[NX][NY]; /* data to write */ + int fillvalue = -2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + */ + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. + */ + if((dataset = H5Dcreate2(fid, DATASETNAME10, H5T_STD_I32LE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* + * Write the data to the dataset using default transfer properties. + */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME11, H5T_STD_I32BE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: create_scale_offset_dset_long_long + * + * Purpose: Create a dataset of LONG LONG datatype with scale-offset + * filter + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * 27 January 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid) +{ +#ifdef H5_HAVE_FILTER_SCALEOFFSET + hid_t dataset; /* dataset handles */ + hid_t dcpl; + long long data[NX][NY]; /* data to write */ + long long fillvalue = -2; + hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + * 5 6 7 8 9 10 + */ + + /* + * Create the dataset creation property list, add the Scale-Offset + * filter, set the chunk size, and set the fill value. + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0) + TEST_ERROR + if(H5Pset_chunk(dcpl, RANK, chunk) < 0) + TEST_ERROR + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LLONG, &fillvalue) < 0) + TEST_ERROR + + /* + * Create a new dataset within the file using defined dataspace, little + * endian datatype and default dataset creation properties. */ - dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if((dataset = H5Dcreate2(fid, DATASETNAME12, H5T_STD_I64LE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR /* * Write the data to the dataset using default transfer properties. */ - status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); + if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + + /* Close dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* Now create a dataset with a big-endian type */ + if((dataset = H5Dcreate2(fid, DATASETNAME13, H5T_STD_I64BE, fsid, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0) + TEST_ERROR + if(H5Dclose(dataset) < 0) + TEST_ERROR + + /* + * Close/release resources. + */ + if(H5Pclose(dcpl) < 0) + TEST_ERROR + +#else /* H5_HAVE_FILTER_SCALEOFFSET */ + const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset."; + + puts(not_supported); +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ + + return 0; + +#ifdef H5_HAVE_FILTER_SCALEOFFSET +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dataset); + } H5E_END_TRY; + + return -1; +#endif /* H5_HAVE_FILTER_SCALEOFFSET */ +} + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Create a file for cross_read.c test. + * + * Return: Success: exit(0) + * Failure: exit(1) + * + * Programmer: Raymond Lu + * Some time ago + * + *------------------------------------------------------------------------- + */ +int +main (void) +{ + hid_t file = -1; + hid_t filespace = -1; + hid_t memspace = -1; + hsize_t dimsf[RANK]; + hsize_t start[RANK] = {0, 0}; + + /* + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ + if((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) + < 0) + {H5_FAILED(); AT(); return 1;} + + /* + * Describe the size of the array and create the data space for fixed + * size dataset. Increase the size in the X direction to have some fill + * values. + */ + dimsf[0] = NX + 1; + dimsf[1] = NY; + if((filespace = H5Screate_simple(RANK, dimsf, NULL)) < 0) + {H5_FAILED(); AT(); return 1;} + dimsf[0] = NX; + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL) + < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create memory space. This does not include the extra row for fill + * values. */ + HDassert(dimsf[0] == NX); + HDassert(dimsf[1] == NY); + if((memspace = H5Screate_simple(RANK, dimsf, NULL)) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a regular dataset */ + if(create_normal_dset(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of FLOAT with scale-offset filter */ + if(create_scale_offset_dsets_float(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of DOUBLE with scale-offset filter */ + if(create_scale_offset_dsets_double(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of CHAR with scale-offset filter */ + if(create_scale_offset_dsets_char(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of SHORT with scale-offset filter */ + if(create_scale_offset_dsets_short(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of INT with scale-offset filter */ + if(create_scale_offset_dsets_int(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} + + /* Create a dataset of LONG LONG with scale-offset filter */ + if(create_scale_offset_dsets_long_long(file, filespace, memspace) < 0) + {H5_FAILED(); AT(); return 1;} /* * Close/release resources. */ - H5Sclose(dataspace); - H5Tclose(datatype); - H5Dclose(dataset); - H5Fclose(file); + if(H5Sclose(memspace) < 0) + {H5_FAILED(); AT(); return 1;} + if(H5Sclose(filespace) < 0) + {H5_FAILED(); AT(); return 1;} + if(H5Fclose(file) < 0) + {H5_FAILED(); AT(); return 1;} return 0; } diff --git a/test/h5test.c b/test/h5test.c index 229efec..25b751f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -27,11 +27,11 @@ #include "h5test.h" #include "H5srcdir.h" -#ifdef _WIN32 +#ifdef H5_HAVE_WINSOCK_H #include <process.h> #include <direct.h> #include <winsock2.h> -#endif /* _WIN32 */ +#endif /* H5_HAVE_WINSOCK_H */ /* * Define these environment variables or constants to influence functions in @@ -648,7 +648,7 @@ void h5_show_hostname(void) { char hostname[80]; -#ifdef _WIN32 +#ifdef H5_HAVE_WINSOCK_H WSADATA wsaData; int err; #endif @@ -670,7 +670,7 @@ h5_show_hostname(void) #else printf("thread 0."); #endif -#ifdef _WIN32 +#ifdef H5_HAVE_WINSOCK_H err = WSAStartup( MAKEWORD(2,2), &wsaData ); if ( err != 0 ) { @@ -700,7 +700,7 @@ h5_show_hostname(void) #else printf(" gethostname not supported\n"); #endif -#ifdef _WIN32 +#ifdef H5_HAVE_WINSOCK_H WSACleanup(); #endif } diff --git a/test/h5test.h b/test/h5test.h index 70408d9..0467cd7 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -83,7 +83,7 @@ * This contains the filename prefix specificied as command line option for * the parallel test files. */ -H5_DLLVAR char *paraprefix; +H5TEST_DLLVAR char *paraprefix; #ifdef H5_HAVE_PARALLEL extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #endif diff --git a/test/le_data.h5 b/test/le_data.h5 Binary files differindex c944c9f..1225d21 100644 --- a/test/le_data.h5 +++ b/test/le_data.h5 diff --git a/test/links.c b/test/links.c index 12b8ba4..c8ece99 100644 --- a/test/links.c +++ b/test/links.c @@ -2640,6 +2640,8 @@ external_link_dangling(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group IDs */ + hid_t rid = (-1); /* Root Group ID */ + hid_t status = (-1); /* Status */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -2672,6 +2674,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) /* Open first file */ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Get root group ID */ + if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); @@ -2692,125 +2697,36 @@ external_link_dangling(hid_t fapl, hbool_t new_format) goto error; } - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - - PASSED(); - return 0; - - error: + /* Try to get name of object by index through dangling file external link */ H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + status = H5Lget_name_by_idx(rid, "no_file", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 0, H5P_DEFAULT); } H5E_END_TRY; - return -1; -} /* end external_link_dangling() */ - - - -/*------------------------------------------------------------------------- - * Function: external_link_env: test 1 - * - * Purpose: - * 1. target link: "extlinks1" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks1" - * 4. The environment variable "HDF5_EXT_PREFIX" should be set to ".:tmp" - * Should be able to access the target file in tmp directory through searching - * the pathnames set in HDF5_EXT_PREFIX. - * This test will be skipped if HDF5_EXT_PREFIX is not set as expected. - * - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -external_link_env(hid_t fapl, hbool_t new_format) -{ - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - const char *envval = NULL; - - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; - - if(new_format) - TESTING("external links via environment variable (w/new group format)") - else - TESTING("external links via environment variable") - - if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp")) { - SKIPPED(); - return(0); - } - - /* set up name for main file:"extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* set up name for external linked target file: "extlinks1" */ - h5_fixname(FILENAME[14], fapl, filename2, sizeof filename2); - - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* set up name for target file: "tmp/extlinks1" */ - h5_fixname(FILENAME[15], fapl, filename3, sizeof filename3); + if (status >= 0) { + H5_FAILED(); + puts(" Retreiving name of object by index through dangling file external link should have failed."); + } /* end if */ - /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Close root group */ + if(H5Gclose(rid) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; - - /* should be able to find the target file from pathnames set via environment variable */ - if (gid < 0) { - H5_FAILED(); - puts(" Should have found the file in tmp directory."); - goto error; - } - - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; -} /* end external_link_env() */ +} /* end external_link_dangling() */ /*------------------------------------------------------------------------- - * Function: external_link_prefix: test 2 + * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" * 2. main file: "extlinks0" @@ -4033,6 +3949,7 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; + herr_t ret; unsigned flags; if(new_format) @@ -4083,6 +4000,24 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(subgroup != FAIL) TEST_ERROR + /* Attempt to set invalid flags on gapl */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_DEBUG); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + /* Close file1 and group */ if(H5Gclose(group) < 0) TEST_ERROR if(H5Fclose(file1) < 0) TEST_ERROR @@ -13996,7 +13931,6 @@ main(void) nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; /* tests for external link */ - nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; diff --git a/test/links_env.c b/test/links_env.c new file mode 100644 index 0000000..c792386 --- /dev/null +++ b/test/links_env.c @@ -0,0 +1,192 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests hard, soft (symbolic) & external links. + */ + +#define H5G_PACKAGE +#define H5G_TESTING + +#include "h5test.h" +#include "H5srcdir.h" +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ + +#ifdef H5_VMS +#define TMPDIR "[.tmp]" +#else /* H5_VMS */ +#define TMPDIR "tmp/" +#endif /* H5_VMS */ +#define NAME_BUF_SIZE 1024 + +const char *FILENAME[] = { + "extlinks_env0", /* 0: main file */ + "extlinks_env1", /* 1: target file */ + TMPDIR "extlinks_env1", /* 2 */ + NULL +}; + +static int external_link_env(hid_t fapl, hbool_t new_format); + + +/*------------------------------------------------------------------------- + * Function: external_link_env (moved from links.c) + * + * Purpose: Verify that the target file is found successfully in "tmp" directory + * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX. + * 1. Target link: "extlinks_env1" + * 2. Main file: "extlinks_env0" + * 3. Target file is created in: "tmp/extlinks_env1" + * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp" + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Vailin Choi + * Feb. 20, 2008 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +external_link_env(hid_t fapl, hbool_t new_format) +{ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + const char *envval = NULL; /* Pointer to environment variable */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; /* Holders for filename */ + + if(new_format) + TESTING("external links via environment variable (w/new group format)") + else + TESTING("external links via environment variable") + + if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) + envval = "nomatch"; + if (HDstrcmp(envval, ".:tmp")) TEST_ERROR + + /* Set up name for main file:"extlinks_env0" */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + + /* Set up name for external linked target file: "extlinks_env1" */ + h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); + + /* Create "tmp" directory */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + + /* Set up name (location) for the target file: "tmp/extlinks1" */ + h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); + + /* Create the target file in "tmp" directory */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; + + /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ + if (gid < 0) { + H5_FAILED(); + puts(" Should have found the file in tmp directory."); + goto error; + } + + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; +} /* end external_link_env() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test external link with environment variable HDF5_EXT_PREFIX + * + * Return: Success: exit(0) + * Failure: exit(non-zero) + * + * Programmer: Vailin Choi; Nov 2010 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl; /* File access property lists */ + int nerrors = 0; /* Error from tests */ + const char *env_h5_drvr; /* File Driver value from environment */ + + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + h5_reset(); + fapl = h5_fileaccess(); + + nerrors += external_link_env(fapl, FALSE) < 0 ? 1 : 0; + + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + + nerrors += external_link_env(fapl, TRUE) < 0 ? 1 : 0; + + h5_cleanup(FILENAME, fapl); + + /* Results */ + if(nerrors) { + printf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "s"); + exit(1); + } + printf("All external Link (HDF5_EXT_PREFIX) tests passed.\n"); + + /* clean up tmp directory created by external link tests */ + HDrmdir(TMPDIR); + + return 0; + +error: + puts("*** TESTS FAILED ***"); + return 1; +} @@ -178,7 +178,7 @@ static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -277,9 +277,12 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -291,6 +294,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -317,7 +321,7 @@ static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -403,8 +407,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); - if (new_ma_addr != ma_addr) TEST_ERROR - if (new_ma_size != ma_size) TEST_ERROR + if(new_ma_addr != ma_addr) + TEST_ERROR + if(new_ma_size != ma_size) + TEST_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -414,7 +420,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR PASSED() @@ -462,7 +468,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR PASSED() @@ -506,7 +512,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR PASSED() @@ -538,8 +544,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); - if (new_ma_addr != ma_addr) TEST_ERROR - if (new_ma_size != ma_size) TEST_ERROR + if(new_ma_addr != ma_addr) + TEST_ERROR + if(new_ma_size != ma_size) + TEST_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -549,9 +557,12 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+10)) + if(new_file_size != (file_size + 10)) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -563,6 +574,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -585,7 +597,7 @@ static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* File size */ @@ -621,8 +633,10 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Turn off using meta/small data aggregator */ - H5Pset_meta_block_size(fapl_new, (hsize_t)0); - H5Pset_small_data_block_size(fapl_new, (hsize_t)0); + if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) + FAIL_STACK_ERROR + if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) + FAIL_STACK_ERROR /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) @@ -652,7 +666,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR /* Re-open the file */ @@ -682,7 +696,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)) TEST_ERROR PASSED() @@ -715,12 +729,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); - if (addr < (haddr_t)file_size) + if(addr < (haddr_t)file_size) TEST_ERROR /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); - if (new_ma_addr != ma_addr) + if(new_ma_addr != ma_addr) TEST_ERROR extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50)); @@ -742,9 +756,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size+TEST_BLOCK_SIZE30) + if(new_file_size != file_size + TEST_BLOCK_SIZE30) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -756,6 +773,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -947,7 +965,7 @@ static unsigned test_mf_fs_start(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1010,15 +1028,19 @@ test_mf_fs_start(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1054,7 +1076,7 @@ static unsigned test_mf_fs_alloc_free(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1343,15 +1365,19 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1399,7 +1425,7 @@ static unsigned test_mf_fs_extend(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1889,15 +1915,19 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -6635,7 +6665,7 @@ error: HDmemset(memb_name, 0, sizeof memb_name); \ HDmemset(memb_addr, 0, sizeof memb_addr); \ HDmemset(sv, 0, sizeof sv); \ - for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) { \ + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \ memb_map[mt] = H5FD_MEM_SUPER; \ memb_fapl[mt] = H5P_DEFAULT; \ } \ @@ -6670,20 +6700,21 @@ error: static unsigned test_mf_fs_drivers(hid_t fapl) { - hid_t fcpl; /* file creation property list */ - hid_t fapl_new; /* copy of file access property list */ - hid_t fapl2; /* copy of file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t fapl_new = -1; /* copy of file access property list */ + hid_t fapl2 = -1; /* copy of file access property list */ hbool_t new_format; /* To use new library format or not */ unsigned ret = 0; /* return value */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */ - char sv[H5FD_MEM_NTYPES][500]; /* Name generators */ + char sv[H5FD_MEM_NTYPES][64]; /* Name generators */ const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */ /* Create a non-standard file-creation template */ - fcpl = H5Pcreate(H5P_FILE_CREATE); + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + FAIL_STACK_ERROR if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0) TEST_ERROR @@ -6784,14 +6815,19 @@ test_mf_fs_drivers(hid_t fapl) } /* end for new_format */ - if (H5Pclose(fcpl) < 0) + if(H5Pclose(fcpl) < 0) FAIL_STACK_ERROR - if (H5Pclose(fapl2) < 0) + if(H5Pclose(fapl2) < 0) FAIL_STACK_ERROR return(ret); error: + H5E_BEGIN_TRY { + H5Pclose(fcpl); + H5Pclose(fapl2); + H5Pclose(fapl_new); + } H5E_END_TRY; return(1); } /* test_mf_fs_drivers() */ @@ -6804,7 +6840,7 @@ static unsigned test_filespace_strategy_threshold(hid_t fapl_new) { hid_t file = -1; /* File ID */ - hid_t fcpl; /* File creation property list template */ + hid_t fcpl = -1; /* File creation property list template */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FD_mem_t type; /* File allocation type */ @@ -6922,7 +6958,10 @@ test_filespace_strategy_threshold(hid_t fapl_new) TEST_ERROR break; + case H5F_FILE_SPACE_DEFAULT: + case H5F_FILE_SPACE_NTYPES: default: + TEST_ERROR break; } /* end switch */ @@ -6941,6 +6980,7 @@ test_filespace_strategy_threshold(hid_t fapl_new) error: H5E_BEGIN_TRY { + H5Pclose(fcpl); H5Fclose(file); } H5E_END_TRY; return(1); @@ -6954,7 +6994,7 @@ static unsigned test_filespace_gone(hid_t fapl_new) { hid_t file = -1; /* File ID */ - hid_t fcpl; /* File creation propertly list template */ + hid_t fcpl = -1; /* File creation propertly list template */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FD_mem_t type; /* File allocation type */ @@ -7074,6 +7114,7 @@ test_filespace_gone(hid_t fapl_new) error: H5E_BEGIN_TRY { + H5Pclose(fcpl); H5Fclose(file); } H5E_END_TRY; return(1); @@ -7085,14 +7126,14 @@ error: static unsigned test_filespace_drivers(hid_t fapl) { - hid_t fapl_new; /* copy of file access property list */ - hid_t fapl2; /* copy of file access property list */ + hid_t fapl_new = -1; /* copy of file access property list */ + hid_t fapl2 = -1; /* copy of file access property list */ hbool_t new_format; /* Using library new format or not */ unsigned ret = 0; /* return value */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */ - char sv[H5FD_MEM_NTYPES][500]; /* Name generators */ + char sv[H5FD_MEM_NTYPES][64]; /* Name generators */ const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */ @@ -7201,6 +7242,10 @@ test_filespace_drivers(hid_t fapl) return(ret); error: + H5E_BEGIN_TRY { + H5Pclose(fapl_new); + H5Pclose(fapl2); + } H5E_END_TRY; return(1); } /* test_filespace_drivers() */ @@ -7259,10 +7304,9 @@ main(void) nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); /* Tests for alignment */ - for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { + for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) { switch(curr_test) { - case TEST_NORMAL: /* set alignment = 1024 */ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0) TEST_ERROR @@ -7273,6 +7317,7 @@ main(void) TEST_ERROR break; + case TEST_NTESTS: default: TEST_ERROR; break; @@ -7294,7 +7339,7 @@ main(void) /* tests for file space management */ nerrors += test_filespace_drivers(fapl); - if (H5Pclose(new_fapl) < 0) + if(H5Pclose(new_fapl) < 0) FAIL_STACK_ERROR h5_cleanup(FILENAME, fapl); @@ -7302,13 +7347,14 @@ main(void) goto error; puts("All free-space manager tests for file memory passed."); - return (0); + return(0); error: puts("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); + H5Pclose(new_fapl); } H5E_END_TRY; - return (1); + return(1); } /* main() */ diff --git a/test/ohdr.c b/test/ohdr.c index dad06cf..109d59c 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -68,6 +68,9 @@ test_cont(char *filename, hid_t fapl) TESTING("object header continuation block"); + HDmemset(&oh_locA, 0, sizeof(oh_locA)); + HDmemset(&oh_locB, 0, sizeof(oh_locB)); + /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR @@ -77,13 +80,10 @@ test_cont(char *filename, hid_t fapl) goto error; } - HDmemset(&oh_locA, 0, sizeof(oh_locA)); - HDmemset(&oh_locB, 0, sizeof(oh_locB)); - - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) FAIL_STACK_ERROR - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) FAIL_STACK_ERROR time_new = 11111111; @@ -107,6 +107,10 @@ test_cont(char *filename, hid_t fapl) if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR + if(1 != H5O_link(&oh_locA, 1, H5P_DATASET_XFER_DEFAULT)) + FAIL_STACK_ERROR + if(1 != H5O_link(&oh_locB, 1, H5P_DATASET_XFER_DEFAULT)) + FAIL_STACK_ERROR if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_expunge_chunks_test(&oh_locA, H5P_DATASET_XFER_DEFAULT) < 0) @@ -148,6 +152,149 @@ error: return -1; } /* test_cont() */ +/* + * Verify that object headers are held in the cache until they are linked + * to a location in the graph, or assigned an ID. This is done by + * creating an object header, then forcing it out of the cache by creating + * local heaps until the object header is evicted from the cache, then + * modifying the object header. The refcount on the object header is + * checked as verifying that the object header has remained in the cache. + */ +static herr_t +test_ohdr_cache(char *filename, hid_t fapl) +{ + hid_t file = -1; /* File ID */ + hid_t my_fapl; /* FAPL ID */ + hid_t my_dxpl; /* DXPL ID */ + H5AC_cache_config_t mdc_config; /* Metadata cache configuration info */ + H5F_t *f = NULL; /* File handle */ + H5HL_t *lheap, *lheap2, *lheap3; /* Pointer to local heaps */ + haddr_t lheap_addr, lheap_addr2, lheap_addr3; /* Local heap addresses */ + H5O_loc_t oh_loc; /* Object header location */ + time_t time_new; /* Time value for modification time message */ + unsigned rc; /* Refcount for object */ + + TESTING("object header creation in cache"); + + /* Make a copy of the FAPL */ + if((my_fapl = H5Pcopy(fapl)) < 0) + FAIL_STACK_ERROR + + /* Tweak down the size of the metadata cache to only 64K */ + mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; + if(H5Pget_mdc_config(my_fapl, &mdc_config) < 0) + FAIL_STACK_ERROR + mdc_config.set_initial_size = TRUE; + mdc_config.initial_size = 32 * 1024; + mdc_config.max_size = 64 * 1024; + mdc_config.min_size = 8 * 1024; + if(H5Pset_mdc_config(my_fapl, &mdc_config) < 0) + FAIL_STACK_ERROR + + /* Make a copy of the default DXPL */ + if((my_dxpl = H5Pcopy(H5P_DATASET_XFER_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create the file to operate on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + FAIL_STACK_ERROR + if(H5Pclose(my_fapl) < 0) + FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + if(H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + + /* Create object (local heap) that occupies most of cache */ + if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr) < 0) + FAIL_STACK_ERROR + + /* Protect local heap (which actually pins it in the cache) */ + if(NULL == (lheap = H5HL_protect(f, my_dxpl, lheap_addr, H5AC_READ))) + FAIL_STACK_ERROR + + /* Create an object header */ + HDmemset(&oh_loc, 0, sizeof(oh_loc)); + if(H5O_create(f, my_dxpl, (size_t)2048, (size_t)1, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + FAIL_STACK_ERROR + + /* Query object header information */ + rc = 0; + if(H5O_get_rc(&oh_loc, my_dxpl, &rc) < 0) + FAIL_STACK_ERROR + if(0 != rc) + TEST_ERROR + + /* Create object (local heap) that occupies most of cache */ + if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr2) < 0) + FAIL_STACK_ERROR + + /* Protect local heap (which actually pins it in the cache) */ + if(NULL == (lheap2 = H5HL_protect(f, my_dxpl, lheap_addr2, H5AC_READ))) + FAIL_STACK_ERROR + + /* Unprotect local heap (which actually unpins it from the cache) */ + if(H5HL_unprotect(lheap2) < 0) + FAIL_STACK_ERROR + + /* Create object header message in new object header */ + time_new = 11111111; + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, my_dxpl) < 0) + FAIL_STACK_ERROR + + /* Create object (local heap) that occupies most of cache */ + if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr3) < 0) + FAIL_STACK_ERROR + + /* Protect local heap (which actually pins it in the cache) */ + if(NULL == (lheap3 = H5HL_protect(f, my_dxpl, lheap_addr3, H5AC_READ))) + FAIL_STACK_ERROR + + /* Unprotect local heap (which actually unpins it from the cache) */ + if(H5HL_unprotect(lheap3) < 0) + FAIL_STACK_ERROR + + /* Query object header information */ + /* (Note that this is somewhat of a weak test, since it doesn't actually + * verify that the object header was evicted from the cache, but it's + * very difficult to verify when an entry is evicted from the cache in + * a non-invasive way -QAK) + */ + rc = 0; + if(H5O_get_rc(&oh_loc, my_dxpl, &rc) < 0) + FAIL_STACK_ERROR + if(0 != rc) + TEST_ERROR + + /* Decrement reference count o object header */ + if(H5O_dec_rc_by_loc(&oh_loc, my_dxpl) < 0) + FAIL_STACK_ERROR + + /* Close object header created */ + if(H5O_close(&oh_loc) < 0) + FAIL_STACK_ERROR + + /* Unprotect local heap (which actually unpins it from the cache) */ + if(H5HL_unprotect(lheap) < 0) + FAIL_STACK_ERROR + + if(H5Pclose(my_dxpl) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + + return -1; +} /* test_ohdr_cache() */ + /*------------------------------------------------------------------------- * Function: main @@ -216,7 +363,7 @@ main(void) */ TESTING("object header creation"); HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) FAIL_STACK_ERROR PASSED(); @@ -226,6 +373,8 @@ main(void) time_new = 11111111; if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR + if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) + FAIL_STACK_ERROR if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) @@ -378,12 +527,16 @@ main(void) */ TESTING("locking messages"); HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + FAIL_STACK_ERROR + if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR /* Create second object header, to guarantee that first object header uses multiple chunks */ HDmemset(&oh_loc2, 0, sizeof(oh_loc2)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + FAIL_STACK_ERROR + if(1 != H5O_link(&oh_loc2, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR /* Fill object header with messages, creating multiple chunks */ @@ -452,12 +605,16 @@ main(void) /* Open first object header */ HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + FAIL_STACK_ERROR + if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR /* Create second object header, to guarantee that first object header uses multiple chunks */ HDmemset(&oh_loc2, 0, sizeof(oh_loc2)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + FAIL_STACK_ERROR + if(1 != H5O_link(&oh_loc2, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR /* Add message to move to object header */ @@ -632,6 +789,10 @@ main(void) /* Close the file we created */ if(H5Fclose(file) < 0) TEST_ERROR + + /* Test object header creation metadata cache issues */ + if(test_ohdr_cache(filename, fapl) < 0) + TEST_ERROR } /* end for */ puts("All object header tests passed."); diff --git a/test/testerror.sh.in b/test/testerror.sh.in index 7f9657a..440be4f 100644 --- a/test/testerror.sh.in +++ b/test/testerror.sh.in @@ -71,6 +71,8 @@ TEST() { -e 's/line [0-9]*/line (number)/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ + -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext cat $actual_ext >> $actual diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 032e7bc..e2b37ab 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,7 +1,7 @@ ############################# Expected output for err_compat ############################# -Testing error API based on data I/O All error API tests passed. +Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): @@ -15,10 +15,46 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dcreate2(): not a location ID + major: Invalid arguments to routine + minor: Inappropriate type + #001: (file name) line (number) in H5G_loc(): invalid object ID + major: Invalid arguments to routine + minor: Bad value + +********* Print error stack in customized way ********* + error #000: (file name) in H5G_loc(): line (number) + major: Invalid arguments to routine + minor: Bad value + error #001: (file name) in H5Dcreate2(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type + +********* Print error stack in customized way ********* + error #000: (file name) in H5Eget_auto(1 or 2)(): line (number) + major: Error API + minor: Can't get value + +********* Print error stack in customized way ********* + error #000: (file name) in H5G_loc(): line (number) + major: Invalid arguments to routine + minor: Bad value + error #001: (file name) in H5Dcreate2(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dcreate2(): not a location ID + major: Invalid arguments to routine + minor: Inappropriate type + #001: (file name) line (number) in H5G_loc(): invalid object ID + major: Invalid arguments to routine + minor: Bad value + +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed major: Error API minor: Unrecognized message - #001: (file name) line (number) in test_error(): H5Dwrite shouldn't succeed + #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed major: Error API minor: Write failed #002: (file name) line (number) in H5Dwrite(): not a dataset diff --git a/test/testfiles/links_env.out b/test/testfiles/links_env.out new file mode 100644 index 0000000..3ca9b99 --- /dev/null +++ b/test/testfiles/links_env.out @@ -0,0 +1,6 @@ +############################# +Expected output for links_env +############################# +Testing external links via environment variable PASSED +Testing external links via environment variable (w/new group format) PASSED +All external Link (HDF5_EXT_PREFIX) tests passed. diff --git a/test/testframe.c b/test/testframe.c index 082a27f..6fbace1 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -124,7 +124,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con */ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) { -#if !(defined MAC || defined __MWERKS__ || defined SYMANTEC_C) +#if !(defined MAC) /* Un-buffer the stdout and stderr */ setbuf(stderr, NULL); setbuf(stdout, NULL); diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in new file mode 100644 index 0000000..e71dfc8 --- /dev/null +++ b/test/testlinks_env.sh.in @@ -0,0 +1,46 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Test for external link with environment variable: HDF5_EXT_PREFIX + +nerrors=0 + +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for external links with HDF5_EXT_PREFIX +echo "Testing external link with HDF5_EXT_PREFIX" +TEST_NAME=links_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXT_PREFIX=.:tmp" # The environment variable & value +# +# Run the test +$ENVCMD $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test for HDF5_EXT_PREFIX PASSED" + else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXT_PREFIX test***" +fi +exit $nerrors diff --git a/test/th5o.c b/test/th5o.c index 6091776..17619ee 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -898,6 +898,337 @@ test_h5o_link(void) /**************************************************************** ** +** test_h5o_comment(): Test H5Oset(get)_comment functions. +** +****************************************************************/ +static void +test_h5o_comment(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + hid_t attr_space, attr_id; + hsize_t dims[RANK]; + hsize_t attr_dims = 1; + int attr_value = 5; + const char *file_comment = "file comment"; + const char *grp_comment = "group comment"; + const char *dset_comment = "dataset comment"; + const char *dtype_comment = "datatype comment"; + char check_comment[64]; + ssize_t comment_len = 0; + herr_t ret; /* Value returned from API calls */ + int ret_value; + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create an attribute for the file */ + attr_space = H5Screate_simple(1, &attr_dims, NULL); + CHECK(attr_space, FAIL, "H5Screate_simple"); + attr_id = H5Acreate2(fid, "file attribute", H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate2"); + ret = H5Awrite(attr_id, H5T_NATIVE_INT, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Putting a comment on the file through its attribute */ + ret = H5Oset_comment(attr_id, file_comment); + CHECK(ret, FAIL, "H5Oset_comment"); + + ret = H5Sclose(attr_space); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Aclose(attr_id); + CHECK(ret, FAIL, "H5Aclose"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + + /* Putting a comment on the group */ + ret = H5Oset_comment(grp, grp_comment); + CHECK(ret, FAIL, "H5Oset_comment"); + + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Putting a comment on the committed data type */ + ret = H5Oset_comment(dtype, dtype_comment); + CHECK(ret, FAIL, "H5Oset_comment"); + + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + + /* Putting a comment on the dataset */ + ret = H5Oset_comment(dset, dset_comment); + CHECK(ret, FAIL, "H5Oset_comment"); + + /* Putting a comment on the dataspace. It's supposed to fail. */ + H5E_BEGIN_TRY { + ret = H5Oset_comment(dspace, "dataspace comment"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Oset_comment"); + + /* Close the file */ + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + + /* Now make sure that the comments are correct all 4 types of objects */ + /* Open file */ + fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Getting the comment on the file and verify it */ + comment_len = H5Oget_comment(fid, NULL, (size_t)0); + CHECK(comment_len, FAIL, "H5Oget_comment"); + + ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1); + CHECK(ret, FAIL, "H5Oget_comment"); + + ret_value = HDstrcmp(file_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment"); + + /* Open the group */ + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); + + /* Getting the comment on the group and verify it */ + comment_len = H5Oget_comment(grp, NULL, (size_t)0); + CHECK(comment_len, FAIL, "H5Oget_comment"); + + ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1); + CHECK(ret, FAIL, "H5Oget_comment"); + + ret_value = HDstrcmp(grp_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment"); + + /* Open the datatype */ + dtype = H5Topen2(fid, "group/datatype", H5P_DEFAULT); + CHECK(dtype, FAIL, "H5Topen2"); + + /* Getting the comment on the datatype and verify it */ + comment_len = H5Oget_comment(dtype, NULL, (size_t)0); + CHECK(comment_len, FAIL, "H5Oget_comment"); + + ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1); + CHECK(ret, FAIL, "H5Oget_comment"); + + ret_value = HDstrcmp(dtype_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment"); + + /* Open the dataset */ + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); + + /* Getting the comment on the dataset and verify it */ + comment_len = H5Oget_comment(dset, NULL, (size_t)0); + CHECK(comment_len, FAIL, "H5Oget_comment"); + + ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1); + CHECK(ret, FAIL, "H5Oget_comment"); + + ret_value = HDstrcmp(dset_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment"); + + + /* Close the IDs */ + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_h5o_comment() */ + + +/**************************************************************** +** +** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions. +** +****************************************************************/ +static void +test_h5o_comment_by_name(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + hid_t attr_space, attr_id; + hsize_t dims[RANK]; + hsize_t attr_dims = 1; + int attr_value = 5; + const char *file_comment = "file comment by name"; + const char *grp_comment = "group comment by name"; + const char *dset_comment = "dataset comment by name"; + const char *dtype_comment = "datatype comment by name"; + char check_comment[64]; + ssize_t comment_len = 0; + herr_t ret; /* Value returned from API calls */ + int ret_value; + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create an attribute for the file */ + attr_space = H5Screate_simple(1, &attr_dims, NULL); + CHECK(attr_space, FAIL, "H5Screate_simple"); + attr_id = H5Acreate2(fid, "file attribute", H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate2"); + ret = H5Awrite(attr_id, H5T_NATIVE_INT, &attr_value); + CHECK(ret, FAIL, "H5Awrite"); + + /* Putting a comment on the file through its attribute */ + ret = H5Oset_comment_by_name(attr_id, ".", file_comment, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oset_comment_by_name"); + + ret = H5Sclose(attr_space); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Aclose(attr_id); + CHECK(ret, FAIL, "H5Aclose"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + + /* Putting a comment on the group */ + ret = H5Oset_comment_by_name(fid, "group", grp_comment, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oset_comment_by_name"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Putting a comment on the committed data type */ + ret = H5Oset_comment_by_name(grp, "datatype", dtype_comment, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oset_comment_by_name"); + + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + + /* Putting a comment on the dataset */ + ret = H5Oset_comment_by_name(fid, "dataset", dset_comment, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oset_comment_by_name"); + + /* Putting a comment on the dataspace. It's supposed to fail. */ + H5E_BEGIN_TRY { + ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Oset_comment"); + + /* Close the file */ + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Now make sure that the comments are correct all 4 types of objects */ + /* Open file */ + fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Getting the comment on the file and verify it */ + comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT); + CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); + + ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_comment_by_name"); + + ret_value = HDstrcmp(file_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment_by_name"); + + /* Open the group */ + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); + + /* Getting the comment on the group and verify it */ + comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT); + CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); + + ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_comment_by_name"); + + ret_value = HDstrcmp(grp_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment_by_name"); + + /* Getting the comment on the datatype and verify it */ + comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT); + CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); + + ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_comment"); + + ret_value = HDstrcmp(dtype_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment_by_name"); + + /* Getting the comment on the dataset and verify it */ + comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT); + CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); + + ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_comment_by_name"); + + ret_value = HDstrcmp(dset_comment, check_comment); + VERIFY(ret_value, 0, "H5Oget_comment_by_name"); + + /* Close the IDs */ + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_h5o_comment_by_name() */ + + + +/**************************************************************** +** ** test_h5o(): Main H5O (generic object) testing routine. ** ****************************************************************/ @@ -913,6 +1244,8 @@ test_h5o(void) test_h5o_refcount(); /* Test incrementing and decrementing reference count */ test_h5o_plist(); /* Test object creation properties */ test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ } /* test_h5o() */ diff --git a/test/vms_data.h5 b/test/vms_data.h5 Binary files differindex 9c243ff..14aeef2 100644 --- a/test/vms_data.h5 +++ b/test/vms_data.h5 diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index c378506..f6ad731 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -17,24 +17,21 @@ SET (testphdf5_SRCS ${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c - ${HDF5_TEST_PAR_SOURCE_DIR}/t_rank_projection.c ) #-- Adding test for testhdf5 ADD_EXECUTABLE (testphdf5 ${testphdf5_SRCS}) -H5_NAMING (testphdf5) -TARGET_WIN_PROPERTIES (testphdf5) +H5_NAMING (testphdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:testphdf5>) MACRO (ADD_H5P_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - H5_NAMING (${file}) - TARGET_WIN_PROPERTIES (${file}) + H5_NAMING (${file} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}>) + ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}> -p) ENDMACRO (ADD_H5P_TEST file) SET (H5P_TESTS @@ -43,9 +40,53 @@ SET (H5P_TESTS t_cache t_pflush1 t_pflush2 + t_shapesame ) FOREACH (testp ${H5P_TESTS}) ADD_H5P_TEST(${testp}) ENDFOREACH (testp ${H5P_TESTS}) +IF (HDF5_TEST_VFD) + + SET (VFD_LIST + sec2 + stdio + core + split + multi + family + ) + + SET (H5P_VFD_TESTS + t_pflush1 + t_pflush2 + ) + + IF (DIRECT_VFD) + SET (VFD_LIST ${VFD_LIST} direct) + ENDIF (DIRECT_VFD) + + MACRO (ADD_VFD_TEST vfdname resultcode) + FOREACH (test ${H5P_VFD_TESTS}) + ADD_TEST ( + NAME VFD-${vfdname}-${test} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${test}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${test}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + ) + ENDFOREACH (test ${H5P_VFD_TESTS}) + ENDMACRO (ADD_VFD_TEST) + + # Run test with different Virtual File Driver + FOREACH (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) + ENDFOREACH (vfd ${VFD_LIST}) + +ENDIF (HDF5_TEST_VFD) + diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 6e76e88..5a7a3f3 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -25,15 +25,14 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 +TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 t_shapesame TEST_SCRIPT_PARA=testph5.sh check_PROGRAMS = $(TEST_PROG_PARA) check_SCRIPTS= $(TEST_SCRIPT) testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \ - t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_rank_projection.c + t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c # The tests all depend on the hdf5 library and the test library LDADD = $(LIBH5TEST) $(LIBHDF5) diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 4d1008c..ceeb92b 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -66,7 +66,7 @@ CONFIG_CLEAN_FILES = testph5.sh CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = t_mpi$(EXEEXT) t_posix_compliant$(EXEEXT) \ testphdf5$(EXEEXT) t_cache$(EXEEXT) t_pflush1$(EXEEXT) \ - t_pflush2$(EXEEXT) + t_pflush2$(EXEEXT) t_shapesame$(EXEEXT) t_cache_SOURCES = t_cache.c t_cache_OBJECTS = t_cache.$(OBJEXT) t_cache_LDADD = $(LDADD) @@ -87,11 +87,14 @@ t_posix_compliant_SOURCES = t_posix_compliant.c t_posix_compliant_OBJECTS = t_posix_compliant.$(OBJEXT) t_posix_compliant_LDADD = $(LDADD) t_posix_compliant_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) +t_shapesame_SOURCES = t_shapesame.c +t_shapesame_OBJECTS = t_shapesame.$(OBJEXT) +t_shapesame_LDADD = $(LDADD) +t_shapesame_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) am_testphdf5_OBJECTS = testphdf5.$(OBJEXT) t_dset.$(OBJEXT) \ t_file.$(OBJEXT) t_mdset.$(OBJEXT) t_ph5basic.$(OBJEXT) \ t_coll_chunk.$(OBJEXT) t_span_tree.$(OBJEXT) \ - t_chunk_alloc.$(OBJEXT) t_filter_read.$(OBJEXT) \ - t_rank_projection.$(OBJEXT) + t_chunk_alloc.$(OBJEXT) t_filter_read.$(OBJEXT) testphdf5_OBJECTS = $(am_testphdf5_OBJECTS) testphdf5_LDADD = $(LDADD) testphdf5_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) @@ -109,9 +112,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c \ - t_posix_compliant.c $(testphdf5_SOURCES) + t_posix_compliant.c t_shapesame.c $(testphdf5_SOURCES) DIST_SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c \ - t_posix_compliant.c $(testphdf5_SOURCES) + t_posix_compliant.c t_shapesame.c $(testphdf5_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -164,6 +167,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -225,6 +229,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -281,6 +286,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -397,12 +403,11 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA = t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 +TEST_PROG_PARA = t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 t_shapesame TEST_SCRIPT_PARA = testph5.sh check_SCRIPTS = $(TEST_SCRIPT) testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \ - t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_rank_projection.c + t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c # The tests all depend on the hdf5 library and the test library @@ -484,6 +489,9 @@ t_pflush2$(EXEEXT): $(t_pflush2_OBJECTS) $(t_pflush2_DEPENDENCIES) t_posix_compliant$(EXEEXT): $(t_posix_compliant_OBJECTS) $(t_posix_compliant_DEPENDENCIES) @rm -f t_posix_compliant$(EXEEXT) $(LINK) $(t_posix_compliant_OBJECTS) $(t_posix_compliant_LDADD) $(LIBS) +t_shapesame$(EXEEXT): $(t_shapesame_OBJECTS) $(t_shapesame_DEPENDENCIES) + @rm -f t_shapesame$(EXEEXT) + $(LINK) $(t_shapesame_OBJECTS) $(t_shapesame_LDADD) $(LIBS) testphdf5$(EXEEXT): $(testphdf5_OBJECTS) $(testphdf5_DEPENDENCIES) @rm -f testphdf5$(EXEEXT) $(LINK) $(testphdf5_OBJECTS) $(testphdf5_LDADD) $(LIBS) @@ -506,7 +514,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pflush2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ph5basic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_posix_compliant.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_rank_projection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_shapesame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_span_tree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testphdf5.Po@am__quote@ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 066e763..3c626d3 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7236,6 +7236,14 @@ main(int argc, char **argv) world_server_mpi_rank = mpi_size - 1; world_mpi_comm = MPI_COMM_WORLD; + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); express_test = do_express_test(); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 51f06d7..8fc739e 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -1671,6 +1671,899 @@ void io_mode_confusion(void) #undef N +/* + * At present, the object header code maintains an image of its on disk + * representation, which is updates as necessary instead of generating on + * request. + * + * Prior to the fix that this test in designed to verify, the image of the + * on disk representation was only updated on flush -- not when the object + * header was marked clean. + * + * This worked perfectly well as long as all writes of a given object + * header were written from a single process. However, with the implementation + * of round robin metadata data writes in parallel HDF5, this is no longer + * the case -- it is possible for a given object header to be flushed from + * several different processes, with the object header simply being marked + * clean in all other processes on each flush. This resulted in NULL or + * out of data object header information being written to disk. + * + * To repair this, I modified the object header code to update its + * on disk image both on flush on when marked clean. + * + * This test is directed at verifying that the fix performs as expected. + * + * The test functions by creating a HDF5 file with several small datasets, + * and then flushing the file. This should result of at least one of + * the associated object headers being flushed by a process other than + * process 0. + * + * Then for each data set, add an attribute and flush the file again. + * + * Close the file and re-open it. + * + * Open the each of the data sets in turn. If all opens are successful, + * the test passes. Otherwise the test fails. + * + * Note that this test will probably become irrelevent shortly, when we + * land the journaling modifications on the trunk -- at which point all + * cache clients will have to construct on disk images on demand. + * + * JRM -- 10/13/10 + * + * Changes: + * Break it into two parts, a writer to write the file and a reader + * the correctness of the writer. AKC -- 2010/10/27 + */ + +#define NUM_DATA_SETS 4 +#define LOCAL_DATA_SIZE 4 +#define LARGE_ATTR_SIZE 256 +/* Since all even and odd processes are split into writer and reader comm + * respectively, process 0 and 1 in COMM_WORLD become the root process of + * the writer and reader comm respectively. + */ +#define Writer_Root 0 +#define Reader_Root 1 +#define Reader_wait(mpi_err, xsteps) \ + mpi_err = MPI_Bcast(&xsteps, 1, MPI_INT, Writer_Root, MPI_COMM_WORLD) +#define Reader_result(mpi_err, xsteps_done) \ + mpi_err = MPI_Bcast(&xsteps_done, 1, MPI_INT, Reader_Root, MPI_COMM_WORLD) +#define Reader_check(mpi_err, xsteps, xsteps_done) \ + { Reader_wait(mpi_err, xsteps); \ + Reader_result(mpi_err, xsteps_done);} + +/* object names used by both rr_obj_hdr_flush_confusion and + * rr_obj_hdr_flush_confusion_reader. + */ +const char * dataset_name[NUM_DATA_SETS] = + { + "dataset_0", + "dataset_1", + "dataset_2", + "dataset_3" + }; +const char * att_name[NUM_DATA_SETS] = + { + "attribute_0", + "attribute_1", + "attribute_2", + "attribute_3" + }; +const char * lg_att_name[NUM_DATA_SETS] = + { + "large_attribute_0", + "large_attribute_1", + "large_attribute_2", + "large_attribute_3" + }; + +void rr_obj_hdr_flush_confusion(void) +{ + /* MPI variables */ + /* private communicator size and rank */ + int mpi_size; + int mpi_rank; + int mrc; /* mpi error code */ + int is_reader; /* 1 for reader process; 0 for writer process. */ + MPI_Comm comm; + + + /* test bed related variables */ + const char * fcn_name = "rr_obj_hdr_flush_confusion"; + const hbool_t verbose = FALSE; + + /* Create two new private communicators from MPI_COMM_WORLD. + * Even and odd ranked processes go to comm_writers and comm_readers + * respectively. + */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + if (mpi_size < 3){ + HDfprintf(stdout, "%s needs at least 3 processes to run. Terminated.\n", + fcn_name); + nerrors++; + return; + } + is_reader = mpi_rank % 2; + mrc = MPI_Comm_split(MPI_COMM_WORLD, is_reader, mpi_rank, &comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_split"); + + /* The reader proocesses branches off to do reading + * while the writer processes continues to do writing + * Whenever writers finish one writing step, including a H5Fflush, + * they inform the readers, via MPI_COMM_WORLD, to verify. + * They will wait for the result from the readers before doing the next + * step. When all steps are done, they inform readers to end. + */ + if (is_reader) + rr_obj_hdr_flush_confusion_reader(comm); + else + rr_obj_hdr_flush_confusion_writer(comm); + + MPI_Comm_free(&comm); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name); + + return; + +} /* rr_obj_hdr_flush_confusion() */ + +void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) +{ + int i; + int j; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dxpl_id = -1; + hid_t att_id[NUM_DATA_SETS]; + hid_t att_space[NUM_DATA_SETS]; + hid_t lg_att_id[NUM_DATA_SETS]; + hid_t lg_att_space[NUM_DATA_SETS]; + hid_t disk_space[NUM_DATA_SETS]; + hid_t mem_space[NUM_DATA_SETS]; + hid_t dataset[NUM_DATA_SETS]; + hsize_t att_size[1]; + hsize_t lg_att_size[1]; + hsize_t disk_count[1]; + hsize_t disk_size[1]; + hsize_t disk_start[1]; + hsize_t mem_count[1]; + hsize_t mem_size[1]; + hsize_t mem_start[1]; + herr_t err; + double data[LOCAL_DATA_SIZE]; + double att[LOCAL_DATA_SIZE]; + double lg_att[LARGE_ATTR_SIZE]; + + /* MPI variables */ + /* world communication size and rank */ + int mpi_world_size; + int mpi_world_rank; + /* private communicator size and rank */ + int mpi_size; + int mpi_rank; + int mrc; /* mpi error code */ + /* steps to verify and have been verified */ + int steps = 0; + int steps_done = 0; + + /* test bed related variables */ + const char * fcn_name = "rr_obj_hdr_flush_confusion_writer"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t * pt; + char * filename; + + /* + * setup test bed related variables: + */ + + pt = (const H5Ptest_param_t *)GetTestParameters(); + filename = pt->name; + + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_world_size); + MPI_Comm_rank(comm, &mpi_rank); + MPI_Comm_size(comm, &mpi_size); + + /* + * Set up file access property list with parallel I/O access + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up property list.\n", + mpi_rank, fcn_name); + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); + + err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); + VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); + + + /* + * Create a new file collectively and release property list identifier. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Creating new file \"%s\".\n", + mpi_rank, fcn_name, filename); + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((file_id >= 0 ), "H5Fcreate() failed"); + + err = H5Pclose(fapl_id); + VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); + + + /* + * Step 1: create the data sets and write data. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Creating the datasets.\n", + mpi_rank, fcn_name); + + disk_size[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_size); + mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + + disk_space[i] = H5Screate_simple(1, disk_size, NULL); + VRFY((disk_space[i] >= 0), "H5Screate_simple(1) failed.\n"); + + dataset[i] = H5Dcreate2(file_id, dataset_name[i], H5T_NATIVE_DOUBLE, + disk_space[i], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + VRFY((dataset[i] >= 0), "H5Dcreate(1) failed.\n"); + } + + /* + * setup data transfer property list + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); + + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); + + err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); + VRFY((err >= 0), + "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); + + /* + * write data to the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Writing datasets.\n", mpi_rank, fcn_name); + + disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); + mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_start[0] = (hsize_t)(0); + + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + data[j] = (double)(mpi_rank + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + NULL, disk_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); + mem_space[i] = H5Screate_simple(1, mem_size, NULL); + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + mem_start, NULL, mem_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); + err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + disk_space[i], dxpl_id, data); + VRFY((err >= 0), "H5Dwrite(1) failed.\n"); + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + data[j] *= 10.0; + } + + /* + * close the data spaces + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sclose(disk_space[i]); + VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); + err = H5Sclose(mem_space[i]); + VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); + } + + /* End of Step 1: create the data sets and write data. */ + + /* + * flush the metadata cache + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + mpi_rank, fcn_name); + err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); + VRFY((err >= 0), "H5Fflush(1) failed.\n"); + + /* Tell the reader to check the file up to steps. */ + steps++; + Reader_check(mrc, steps, steps_done); + + /* + * Step 2: write attributes to each dataset + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: writing attributes.\n", mpi_rank, fcn_name); + + att_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + att[j] = (double)(j + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + att_space[i] = H5Screate_simple(1, att_size, NULL); + VRFY((att_space[i] >= 0), "H5Screate_simple(3) failed.\n"); + att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, + att_space[i], H5P_DEFAULT, H5P_DEFAULT); + VRFY((att_id[i] >= 0), "H5Acreate(1) failed.\n"); + err = H5Awrite(att_id[i], H5T_NATIVE_DOUBLE, att); + VRFY((err >= 0), "H5Awrite(1) failed.\n"); + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + att[j] /= 10.0; + } + } + + /* + * close attribute IDs and spaces + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing attr ids and spaces .\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + + err = H5Sclose(att_space[i]); + VRFY((err >= 0), "H5Sclose(att_space[i]) failed.\n"); + err = H5Aclose(att_id[i]); + VRFY((err >= 0), "H5Aclose(att_id[i]) failed.\n"); + } + + /* End of Step 2: write attributes to each dataset */ + + /* + * flush the metadata cache again + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + mpi_rank, fcn_name); + err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); + VRFY((err >= 0), "H5Fflush(2) failed.\n"); + + /* Tell the reader to check the file up to steps. */ + steps++; + Reader_check(mrc, steps, steps_done); + + /* + * Step 3: write large attributes to each dataset + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: writing large attributes.\n", + mpi_rank, fcn_name); + + lg_att_size[0] = (hsize_t)(LARGE_ATTR_SIZE); + + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + lg_att[j] = (double)(j + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + lg_att_space[i] = H5Screate_simple(1, lg_att_size, NULL); + VRFY((lg_att_space[i] >= 0), "H5Screate_simple(4) failed.\n"); + lg_att_id[i] = H5Acreate2(dataset[i], lg_att_name[i], H5T_NATIVE_DOUBLE, + lg_att_space[i], H5P_DEFAULT, H5P_DEFAULT); + VRFY((lg_att_id[i] >= 0), "H5Acreate(2) failed.\n"); + err = H5Awrite(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att); + VRFY((err >= 0), "H5Awrite(2) failed.\n"); + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + lg_att[j] /= 10.0; + } + } + + /* Step 3: write large attributes to each dataset */ + + /* + * flush the metadata cache yet again to clean the object headers. + * + * This is an attempt to crate a situation where we have dirty + * object header continuation chunks, but clean opject headers + * to verify a speculative bug fix -- it doesn't seem to work, + * but I will leave the code in anyway, as the object header + * code is going to change a lot in the near future. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + mpi_rank, fcn_name); + err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); + VRFY((err >= 0), "H5Fflush(3) failed.\n"); + + /* Tell the reader to check the file up to steps. */ + steps++; + Reader_check(mrc, steps, steps_done); + + /* + * Step 4: write different large attributes to each dataset + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: writing different large attributes.\n", + mpi_rank, fcn_name); + + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + lg_att[j] = (double)(j + 2); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Awrite(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att); + VRFY((err >= 0), "H5Awrite(2) failed.\n"); + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + lg_att[j] /= 10.0; + } + } + + /* End of Step 4: write different large attributes to each dataset */ + + /* + * flush the metadata cache again + */ + if(verbose ) + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + mpi_rank, fcn_name); + err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); + VRFY((err >= 0), "H5Fflush(3) failed.\n"); + + /* Tell the reader to check the file up to steps. */ + steps++; + Reader_check(mrc, steps, steps_done); + + /* Step 5: Close all objects and the file */ + + /* + * close large attribute IDs and spaces + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing large attr ids and spaces .\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + + err = H5Sclose(lg_att_space[i]); + VRFY((err >= 0), "H5Sclose(lg_att_space[i]) failed.\n"); + err = H5Aclose(lg_att_id[i]); + VRFY((err >= 0), "H5Aclose(lg_att_id[i]) failed.\n"); + } + + + /* + * close the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing datasets .\n", mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Dclose(dataset[i]); + VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); + } + + /* + * close the data transfer property list. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); + + err = H5Pclose(dxpl_id); + VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); + + + /* + * Close file. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing file.\n", mpi_rank, fcn_name); + + err = H5Fclose(file_id); + VRFY((err >= 0 ), "H5Fclose(1) failed"); + + /* End of Step 5: Close all objects and the file */ + /* Tell the reader to check the file up to steps. */ + steps++; + Reader_check(mrc, steps, steps_done); + + + /* All done. Inform reader to end. */ + steps=0; + Reader_check(mrc, steps, steps_done); + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name); + + return; + +} /* rr_obj_hdr_flush_confusion_writer() */ + +void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) +{ + int i; + int j; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dxpl_id = -1; + hid_t lg_att_id[NUM_DATA_SETS]; + hid_t lg_att_type[NUM_DATA_SETS]; + hid_t disk_space[NUM_DATA_SETS]; + hid_t mem_space[NUM_DATA_SETS]; + hid_t dataset[NUM_DATA_SETS]; + hsize_t disk_count[1]; + hsize_t disk_start[1]; + hsize_t mem_count[1]; + hsize_t mem_size[1]; + hsize_t mem_start[1]; + herr_t err; + htri_t tri_err; + double data[LOCAL_DATA_SIZE]; + double data_read[LOCAL_DATA_SIZE]; + double att[LOCAL_DATA_SIZE]; + double att_read[LOCAL_DATA_SIZE]; + double lg_att[LARGE_ATTR_SIZE]; + double lg_att_read[LARGE_ATTR_SIZE]; + + /* MPI variables */ + /* world communication size and rank */ + int mpi_world_size; + int mpi_world_rank; + /* private communicator size and rank */ + int mpi_size; + int mpi_rank; + int mrc; /* mpi error code */ + int steps = -1; /* How far (steps) to verify the file */ + int steps_done = -1; /* How far (steps) have been verified */ + + /* test bed related variables */ + const char * fcn_name = "rr_obj_hdr_flush_confusion_reader"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t * pt; + char * filename; + + /* + * setup test bed related variables: + */ + + pt = (const H5Ptest_param_t *)GetTestParameters(); + filename = pt->name; + + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_world_size); + MPI_Comm_rank(comm, &mpi_rank); + MPI_Comm_size(comm, &mpi_size); + + /* Repeatedly re-open the file and verify its contents until it is */ + /* told to end (when steps=0). */ + while (steps_done != 0){ + Reader_wait(mrc, steps); + VRFY((mrc >= 0), "Reader_wait failed"); + steps_done = 0; + + if (steps > 0 ){ + /* + * Set up file access property list with parallel I/O access + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up property list.\n", + mpi_rank, fcn_name); + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); + err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); + VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); + + /* + * Create a new file collectively and release property list identifier. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", + mpi_rank, fcn_name, filename); + + file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); + VRFY((file_id >= 0 ), "H5Fopen() failed"); + err = H5Pclose(fapl_id); + VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); + +#if 1 + if (steps >= 1){ + /*=====================================================* + * Step 1: open the data sets and read data. + *=====================================================*/ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: opening the datasets.\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = -1; + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT); + VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n"); + disk_space[i] = H5Dget_space(dataset[i]); + VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n"); + } + + /* + * setup data transfer property list + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); + + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); + err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); + VRFY((err >= 0), + "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); + + /* + * read data from the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name); + + disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); + + mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + + mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_start[0] = (hsize_t)(0); + + /* set up expected data for verification */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + data[j] = (double)(mpi_rank + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + NULL, disk_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); + mem_space[i] = H5Screate_simple(1, mem_size, NULL); + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + mem_start, NULL, mem_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); + err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + disk_space[i], dxpl_id, data_read); + VRFY((err >= 0), "H5Dread(1) failed.\n"); + + /* compare read data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (data_read[j] != data[j]){ + HDfprintf(stdout, + "%0d:%s: Reading datasets value failed in " + "Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, data[j], data_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + data[j] *= 10.0; + } + + /* + * close the data spaces + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sclose(disk_space[i]); + VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); + err = H5Sclose(mem_space[i]); + VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); + } + steps_done++; + } + /* End of Step 1: open the data sets and read data. */ +#endif + +#if 1 + /*=====================================================* + * Step 2: reading attributes from each dataset + *=====================================================*/ + + if (steps >= 2){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name); + + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + + att[j] = (double)(j + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + hid_t att_id, att_type; + + att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT); + VRFY((att_id >= 0), "H5Aopen failed.\n"); + att_type = H5Aget_type(att_id); + VRFY((att_type >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + }else{ + /* should verify attribute size before H5Aread */ + err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (att_read[j] != att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, att[j], att_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + + att[j] /= 10.0; + } + } + err = H5Aclose(att_id); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + steps_done++; + } + /* End of Step 2: reading attributes from each dataset */ +#endif + + +#if 1 + /*=====================================================* + * Step 3 or 4: read large attributes from each dataset. + * Step 4 has different attribute value from step 3. + *=====================================================*/ + + if (steps >= 3){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name); + + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + + lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT); + VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n"); + lg_att_type[i] = H5Aget_type(lg_att_id[i]); + VRFY((err >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Large attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + }else{ + /* should verify large attribute size before H5Aread */ + err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) + if (lg_att_read[j] != lg_att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); + nerrors++; + } + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + + lg_att[j] /= 10.0; + } + } + err = H5Tclose(lg_att_type[i]); + VRFY((err >= 0), "H5Tclose failed.\n"); + err = H5Aclose(lg_att_id[i]); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + /* Both step 3 and 4 use this same read checking code. */ + steps_done = (steps==3) ? 3 : 4; + } + + /* End of Step 3 or 4: read large attributes from each dataset */ +#endif + + + /*=====================================================* + * Step 5: read all objects from the file + *=====================================================*/ + if (steps>=5){ + /* nothing extra to verify. The file is closed normally. */ + /* Just increment steps_done */ + steps_done++; + } + + /* + * Close the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing datasets again.\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + if ( dataset[i] >= 0 ) { + err = H5Dclose(dataset[i]); + VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); + } + } + + /* + * close the data transfer property list. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); + + err = H5Pclose(dxpl_id); + VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); + + /* + * Close the file + */ + if(verbose) + HDfprintf(stdout, "%0d:%s: closing file again.\n", + mpi_rank, fcn_name); + err = H5Fclose(file_id); + VRFY((err >= 0 ), "H5Fclose(1) failed"); + + } /* else if (steps_done==0) */ + Reader_result(mrc, steps_done); + } /* end while(1) */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name); + + return; +} /* rr_obj_hdr_flush_confusion_reader() */ + +#undef NUM_DATA_SETS +#undef LOCAL_DATA_SIZE +#undef LARGE_ATTR_SIZE +#undef Reader_check +#undef Reader_wait +#undef Reader_result +#undef Writer_Root +#undef Reader_Root + /*============================================================================= * End of t_mdset.c *===========================================================================*/ diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 9033e70..c3e04de 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1137,6 +1137,14 @@ main(int argc, char **argv) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); if (parse_options(argc, argv) != 0){ if (MAINPROCESS) diff --git a/testpar/t_rank_projection.c b/testpar/t_shapesame.c index 16d8c53..3f8006f 100644 --- a/testpar/t_rank_projection.c +++ b/testpar/t_shapesame.c @@ -1,7 +1,5 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -249,50 +247,20 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* initialize the buffers */ ptr_0 = small_ds_buf_0; - ptr_1 = small_ds_buf_1; - ptr_2 = small_ds_buf_2; - - for ( i = 0; i < (int)small_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; + for(i = 0; i < (int)small_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); + HDmemset(small_ds_buf_2, 0, sizeof(uint32_t) * small_ds_size); - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); ptr_0 = large_ds_buf_0; - ptr_1 = large_ds_buf_1; - ptr_2 = large_ds_buf_2; - - for ( i = 0; i < (int)large_ds_size; i++ ) { + for(i = 0; i < (int)large_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); + HDmemset(large_ds_buf_2, 0, sizeof(uint32_t) * large_ds_size); - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = large_ds_slice_buf; - - for ( i = 0; i < (int)large_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_slice_buf, 0, sizeof(uint32_t) * large_ds_slice_size); filename = (const char *)GetTestParameters(); HDassert( filename != NULL ); @@ -397,28 +365,6 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, "H5Screate_simple() large_ds_slice_sid succeeded"); - /* Select the entire extent of the full small ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_small_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_small_ds_sid) succeeded"); - - ret = H5Sselect_all(small_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(small_ds_slice_sid) succeeded"); - - - /* Select the entire extent of the full large ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_large_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_large_ds_sid) succeeded"); - - ret = H5Sselect_all(large_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(large_ds_slice_sid) succeeded"); - - /* if chunk edge size is greater than zero, set up the small and * large data set creation property lists to specify chunked * datasets. @@ -491,14 +437,9 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, xfer_plist = H5Pcreate(H5P_DATASET_XFER); VRFY((xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - if ( ! use_collective_io ) { - - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, - H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded"); + if(use_collective_io) { + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } /* setup selection to write initial data to the small and large data sets */ @@ -562,9 +503,11 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + if ( ! use_collective_io ) { + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + } /* read the small data set back to verify that it contains the * expected data. Note that each process reads in the entire @@ -668,8 +611,11 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + } /* read the small data set back to verify that it contains the @@ -685,7 +631,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((ret >= 0), "H5Dread() large_dataset initial read succeeded"); - /* verify that the correct data was written to the small data set */ + /* verify that the correct data was written to the large data set */ expected_value = 0; mis_match = FALSE; ptr_1 = large_ds_buf_1; @@ -703,6 +649,15 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY( (mis_match == FALSE), "large ds init data good."); + /* sync with the other processes before changing data */ + + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync initial values check"); + } + + /* first, verify that we can read from disk correctly using selections * of different rank that H5S_select_shape_same() views as being of the * same shape. @@ -735,13 +690,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } /* zero out the buffer we will be reading into */ - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -924,12 +873,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, #endif /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); /* set up start, stride, count, and block -- note that we will * change start[] so as to read slices of the large cube. @@ -1171,12 +1115,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } /* zero out the in memory small ds */ - ptr_1 = small_ds_buf_1; - for ( n = 0; n < (int)small_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG @@ -1428,12 +1367,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -1699,7 +1633,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /*------------------------------------------------------------------------- - * Function: contig_hyperslab_dr_pio_test() + * Function: contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) * * Purpose: Test I/O to/from hyperslab selections of different rank in * the parallel case. @@ -1718,12 +1652,15 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * if two or more processes are banging on the same * block of memory. * JRM -- 9/10/10 + * Break this one big test into 4 smaller tests according + * to {independent,collective}x{contigous,chunked} datasets. + * AKC -- 2010/01/14 * *------------------------------------------------------------------------- */ void -contig_hyperslab_dr_pio_test(void) +contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { int test_num = 0; int edge_size = 10; @@ -1734,7 +1671,7 @@ contig_hyperslab_dr_pio_test(void) int skip_counters[4] = {0, 0, 0, 0}; int tests_skiped[4] = {0, 0, 0, 0}; int mpi_result; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY hbool_t time_tests = TRUE; hbool_t display_skips = FALSE; @@ -1755,11 +1692,10 @@ contig_hyperslab_dr_pio_test(void) long long sample_times[4] = {0, 0, 0, 0}; struct timeval timeval_a; struct timeval timeval_b; - - MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); #endif /* H5_HAVE_GETTIMEOFDAY */ + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); + local_express_test = GetTestExpress(); mpi_result = MPI_Allreduce((void *)&local_express_test, @@ -1774,15 +1710,15 @@ contig_hyperslab_dr_pio_test(void) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - - chunk_edge_size = 0; - + switch(sstest_type){ + case IND_CONTIG: /* contiguous data set, independent I/O */ + chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -1799,13 +1735,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[col_contig_idx]); } test_num++; + break; + /* end of case IND_CONTIG */ + case COL_CONTIG: /* contiguous data set, collective I/O */ + chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -1822,15 +1762,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[ind_contig_idx]); } test_num++; + break; + /* end of case COL_CONTIG */ - chunk_edge_size = 5; - + case IND_CHUNKED: /* chunked data set, independent I/O */ + chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -1847,13 +1789,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[col_chunked_idx]); } test_num++; + break; + /* end of case IND_CHUNKED */ + case COL_CHUNKED: /* chunked data set, collective I/O */ + chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -1870,6 +1816,9 @@ contig_hyperslab_dr_pio_test(void) sample_times[ind_chunked_idx]); } test_num++; + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -2678,50 +2627,20 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* initialize the buffers */ ptr_0 = small_ds_buf_0; - ptr_1 = small_ds_buf_1; - ptr_2 = small_ds_buf_2; + for(i = 0; i < (int)small_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); + HDmemset(small_ds_buf_2, 0, sizeof(uint32_t) * small_ds_size); - for ( i = 0; i < (int)small_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)i; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); ptr_0 = large_ds_buf_0; - ptr_1 = large_ds_buf_1; - ptr_2 = large_ds_buf_2; - - for ( i = 0; i < (int)large_ds_size; i++ ) { + for(i = 0; i < (int)large_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); + HDmemset(large_ds_buf_2, 0, sizeof(uint32_t) * large_ds_size); - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = large_ds_slice_buf; - - for ( i = 0; i < (int)large_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_slice_buf, 0, sizeof(uint32_t) * large_ds_slice_size); filename = (const char *)GetTestParameters(); HDassert( filename != NULL ); @@ -2838,28 +2757,6 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, "H5Screate_simple() large_ds_slice_sid succeeded"); - /* Select the entire extent of the full small ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_small_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_small_ds_sid) succeeded"); - - ret = H5Sselect_all(small_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(small_ds_slice_sid) succeeded"); - - - /* Select the entire extent of the full large ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_large_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_large_ds_sid) succeeded"); - - ret = H5Sselect_all(large_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(large_ds_slice_sid) succeeded"); - - /* if chunk edge size is greater than zero, set up the small and * large data set creation property lists to specify chunked * datasets. @@ -2928,21 +2825,16 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((ret != FAIL), "H5Dcreate2() large_dataset succeeded"); - /* setup xfer property list */ xfer_plist = H5Pcreate(H5P_DATASET_XFER); VRFY((xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - if ( ! use_collective_io ) { - - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, - H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded"); + if(use_collective_io) { + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } + /* setup selection to write initial data to the small and large data sets */ start[0] = mpi_rank; stride[0] = 2 * (mpi_size + 1); @@ -3003,9 +2895,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + if ( ! use_collective_io ) { + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + } /* read the small data set back to verify that it contains the * expected data. Note that each process reads in the entire @@ -3109,8 +3003,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + } /* read the small data set back to verify that it contains the @@ -3142,6 +3039,15 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, expected_value++; } VRFY( (mis_match == FALSE), "large ds init data good."); + + /* sync with the other processes before changing data */ + + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after initial values check"); + } + /***********************************/ /***** INITIALIZATION COMPLETE *****/ @@ -3172,14 +3078,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, sel_start); /* zero out the buffer we will be reading into */ - - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, "%s:%d: initial small_ds_slice_buf = ", @@ -3386,12 +3285,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, #endif /* zero out the buffer we will be reading into */ - ptr_0 = large_ds_buf_1; - for ( i = 0; i < (int)large_ds_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); /* set up start, stride, count, and block -- note that we will * change start[] so as to read the slice of the small data set @@ -3700,12 +3594,7 @@ int m; } /* zero out the in memory small ds */ - ptr_1 = small_ds_buf_1; - for ( n = 0; n < (int)small_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG @@ -3994,12 +3883,7 @@ int m; } /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -4307,12 +4191,15 @@ int m; * if two or more processes are banging on the same * block of memory. * JRM -- 9/10/10 + * Break this one big test into 4 smaller tests according + * to {independent,collective}x{contigous,chunked} datasets. + * AKC -- 2010/01/17 * *------------------------------------------------------------------------- */ void -checker_board_hyperslab_dr_pio_test(void) +checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { int test_num = 0; int edge_size = 10; @@ -4324,7 +4211,7 @@ checker_board_hyperslab_dr_pio_test(void) int skip_counters[4] = {0, 0, 0, 0}; int tests_skiped[4] = {0, 0, 0, 0}; int mpi_result; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY hbool_t time_tests = TRUE; hbool_t display_skips = FALSE; @@ -4352,6 +4239,8 @@ checker_board_hyperslab_dr_pio_test(void) local_express_test = GetTestExpress(); + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); + mpi_result = MPI_Allreduce((void *)&local_express_test, (void *)&express_test, 1, @@ -4372,15 +4261,15 @@ checker_board_hyperslab_dr_pio_test(void) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - - chunk_edge_size = 0; - + switch(sstest_type){ + case IND_CONTIG: /* contiguous data set, independent I/O */ + chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -4400,13 +4289,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case IND_CONTIG */ + case COL_CONTIG: /* contiguous data set, collective I/O */ + chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -4426,15 +4319,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case COL_CONTIG */ - chunk_edge_size = 5; - + case IND_CHUNKED: /* chunked data set, independent I/O */ + chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -4454,14 +4349,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case IND_CHUNKED */ - + case COL_CHUNKED: /* chunked data set, collective I/O */ + chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -4481,6 +4379,9 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -4556,3 +4457,484 @@ checker_board_hyperslab_dr_pio_test(void) } /* checker_board_hyperslab_dr_pio_test() */ +/* Main Body. Here for now, may have to move them to a separated file later. */ + +/* + * Main driver of the Parallel HDF5 tests + */ + +#include "testphdf5.h" + +#ifndef PATH_MAX +#define PATH_MAX 512 +#endif /* !PATH_MAX */ + +/* global variables */ +int dim0; +int dim1; +int chunkdim0; +int chunkdim1; +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ +int ngroups = 512; /* number of groups to create in root + * group. */ +int facc_type = FACC_MPIO; /*Test file access type */ +int dxfer_coll_type = DXFER_COLLECTIVE_IO; + +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ + +/* other option flags */ + +/* FILENAME and filenames must have the same number of names. + * Use PARATESTFILE in general and use a separated filename only if the file + * created in one test is accessed by a different test. + * filenames[0] is reserved as the file name for PARATESTFILE. + */ +#define NFILENAME 2 +#define PARATESTFILE filenames[0] +const char *FILENAME[NFILENAME]={ + "ShapeSameTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ + +#ifdef USE_PAUSE +/* pause the process for a moment to allow debugger to attach if desired. */ +/* Will pause more if greenlight file is not persent but will eventually */ +/* continue. */ +#include <sys/types.h> +#include <sys/stat.h> + +void pause_proc(void) +{ + + int pid; + h5_stat_t statbuf; + char greenlight[] = "go"; + int maxloop = 10; + int loops = 0; + int time_int = 10; + + /* mpi variables */ + int mpi_size, mpi_rank; + int mpi_namelen; + char mpi_name[MPI_MAX_PROCESSOR_NAME]; + + pid = getpid(); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Get_processor_name(mpi_name, &mpi_namelen); + + if (MAINPROCESS) + while ((stat(greenlight, &statbuf) == -1) && loops < maxloop){ + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } + MPI_Barrier(MPI_COMM_WORLD); +} + +/* Use the Profile feature of MPI to call the pause_proc() */ +int MPI_Init(int *argc, char ***argv) +{ + int ret_code; + ret_code=PMPI_Init(argc, argv); + pause_proc(); + return (ret_code); +} +#endif /* USE_PAUSE */ + + +/* + * Show command usage + */ +static void +usage(void) +{ + printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] " + "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); + printf("\t-m<n_datasets>" + "\tset number of datasets for the multiple dataset test\n"); + printf("\t-n<n_groups>" + "\tset number of groups for the multiple group test\n"); + printf("\t-f <prefix>\tfilename prefix\n"); + printf("\t-2\t\tuse Split-file together with MPIO\n"); + printf("\t-p\t\tuse combo MPI-POSIX driver\n"); + printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", + ROW_FACTOR, COL_FACTOR); + printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + printf("\n"); +} + + +/* + * parse the command line options + */ +static int +parse_options(int argc, char **argv) +{ + int mpi_size, mpi_rank; /* mpi variables */ + + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup default chunk-size. Make sure sizes are > 0 */ + + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + + while (--argc){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ + nerrors++; + return(1); + } + break; + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'p': /* Use the MPI-POSIX driver access */ + facc_type = FACC_MPIPOSIX; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + case '2': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } + } /*while*/ + + /* check validity of dimension and chunk sizes */ + if (dim0 <= 0 || dim1 <= 0){ + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); + } + if (chunkdim0 <= 0 || chunkdim1 <= 0){ + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); + } + + /* Make sure datasets can be divided into equal portions by the processes */ + if ((dim0 % mpi_size) || (dim1 % mpi_size)){ + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); + } + + /* compose the test filenames */ + { + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); + } + + return(0); +} + + +/* + * Create the appropriate File access property list + */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, + hbool_t use_gpfs) +{ + hid_t ret_pl = -1; + herr_t ret; /* generic return value */ + int mpi_rank; /* mpi variables */ + + /* need the rank for error checking macros */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); + + if (l_facc_type == FACC_DEFAULT) + return (ret_pl); + + if (l_facc_type == FACC_MPIO){ + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); + } + + if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); + } + + if (l_facc_type == FACC_MPIPOSIX) { + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); + VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); + return(ret_pl); + } + + /* unknown file access types */ + return (ret_pl); +} + + +/* Shape Same test using contigous hyperslab using independent IO on contigous datasets */ +static void +sscontig1(void) +{ + contig_hyperslab_dr_pio_test(IND_CONTIG); +} + +/* Shape Same test using contigous hyperslab using collective IO on contigous datasets */ +static void +sscontig2(void) +{ + contig_hyperslab_dr_pio_test(COL_CONTIG); +} + +/* Shape Same test using contigous hyperslab using independent IO on chunked datasets */ +static void +sscontig3(void) +{ + contig_hyperslab_dr_pio_test(IND_CHUNKED); +} + +/* Shape Same test using contigous hyperslab using collective IO on chunked datasets */ +static void +sscontig4(void) +{ + contig_hyperslab_dr_pio_test(COL_CHUNKED); +} + + +/* Shape Same test using checker hyperslab using independent IO on contigous datasets */ +static void +sschecker1(void) +{ + checker_board_hyperslab_dr_pio_test(IND_CONTIG); +} + +/* Shape Same test using checker hyperslab using collective IO on contigous datasets */ +static void +sschecker2(void) +{ + checker_board_hyperslab_dr_pio_test(COL_CONTIG); +} + +/* Shape Same test using checker hyperslab using independent IO on chunked datasets */ +static void +sschecker3(void) +{ + checker_board_hyperslab_dr_pio_test(IND_CHUNKED); +} + +/* Shape Same test using checker hyperslab using collective IO on chunked datasets */ +static void +sschecker4(void) +{ + checker_board_hyperslab_dr_pio_test(COL_CHUNKED); +} + + +int main(int argc, char **argv) +{ + int mpi_size, mpi_rank; /* mpi variables */ + H5Ptest_param_t ndsets_params, ngroups_params; + H5Ptest_param_t collngroups_params; + H5Ptest_param_t io_mode_confusion_params; + H5Ptest_param_t rr_obj_flush_confusion_params; + + /* Un-buffer the stdout and stderr */ + setbuf(stderr, NULL); + setbuf(stdout, NULL); + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + dim0 = ROW_FACTOR*mpi_size; + dim1 = COL_FACTOR*mpi_size; + + if (MAINPROCESS){ + printf("===================================\n"); + printf("Shape Same Tests Start\n"); + printf("===================================\n"); + } + + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; + H5open(); + h5_show_hostname(); + + /* Initialize testing framework */ + TestInit(argv[0], usage, parse_options); + + /* Shape Same tests using contigous hyperslab */ + AddTest("sscontig1", sscontig1, NULL, + "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE); + AddTest("sscontig2", sscontig2, NULL, + "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE); + AddTest("sscontig3", sscontig3, NULL, + "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE); + AddTest("sscontig4", sscontig4, NULL, + "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE); + + /* Shape Same tests using checker board hyperslab */ + AddTest("sschecker1", sschecker1, NULL, + "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE); + AddTest("sschecker2", sschecker2, NULL, + "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE); + AddTest("sschecker3", sschecker3, NULL, + "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE); + AddTest("sschecker4", sschecker4, NULL, + "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE); + + /* Display testing information */ + TestInfo(argv[0]); + + /* setup file access property list */ + fapl = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); + + /* Parse command line arguments */ + TestParseCmdLine(argc, argv); + + if (facc_type == FACC_MPIPOSIX && MAINPROCESS){ + printf("===================================\n" + " Using MPIPOSIX driver\n" + "===================================\n"); + } + + if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); + } + + + /* Perform requested testing */ + PerformTests(); + + /* make sure all processes are finished before final report, cleanup + * and exit. + */ + MPI_Barrier(MPI_COMM_WORLD); + + /* Display test summary, if requested */ + if (MAINPROCESS && GetTestSummary()) + TestSummary(); + + /* Clean up test files */ + h5_cleanup(FILENAME, fapl); + + nerrors += GetTestNumErrs(); + + /* Gather errors from all processes */ + { + int temp; + MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); + nerrors=temp; + } + + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); + } + /* close HDF5 library */ + H5close(); + + /* MPI_Finalize must be called AFTER H5close which may use MPI calls */ + MPI_Finalize(); + + /* cannot just return (nerrors) because exit code is limited to 1byte */ + return(nerrors!=0); +} diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index e54d0a8..2730ea2 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -2616,10 +2616,11 @@ lower_dim_size_comp_test(void) /* const char *fcnName = "lower_dim_size_comp_test()"; */ int chunk_edge_size = 0; int use_collective_io = 1; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #if 0 sleep(60); #endif + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); for ( use_collective_io = (hbool_t)0; (int)use_collective_io <= 1; (hbool_t)(use_collective_io++) ) { diff --git a/testpar/testpar.h b/testpar/testpar.h index 02fc915..ce11204 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -26,25 +26,36 @@ /* Define some handy debugging shorthands, routines, ... */ /* debugging tools */ -#define MESG(x) \ - if (VERBOSE_MED) printf("%s\n", x); \ +/* Print message mesg if verbose level is at least medium and + * mesg is not an empty string. + */ +#define MESG(mesg) \ + if (VERBOSE_MED && *mesg != '\0') \ + printf("%s\n", mesg) +/* + * VRFY: Verify if the condition val is true. + * If it is true, then call MESG to print mesg, depending on the verbose + * level. + * If val is not true, it prints error messages and if the verbose + * level is lower than medium, it calls MPI_Abort to abort the program. + * If verbose level is at least medium, it will not abort. + * This will allow program to continue and can be used for debugging. + * (The "do {...} while(0)" is to group all the statements as one unit.) + */ #define VRFY(val, mesg) do { \ if (val) { \ - if (*mesg != '\0') { \ - MESG(mesg); \ - } \ + MESG(mesg); \ } else { \ printf("Proc %d: ", mpi_rank); \ - printf("*** PHDF5 ERROR ***\n"); \ - printf(" Assertion (%s) failed at line %4d in %s\n", \ + printf("*** Parallel ERROR ***\n"); \ + printf(" VRFY (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ ++nerrors; \ fflush(stdout); \ - if (!VERBOSE_MED) { \ - printf("aborting MPI process\n"); \ - MPI_Finalize(); \ - exit(nerrors); \ + if (!VERBOSE_MED) { \ + printf("aborting MPI processes\n"); \ + MPI_Abort(MPI_COMM_WORLD, 1); \ } \ } \ } while(0) @@ -56,9 +67,7 @@ */ #define INFO(val, mesg) do { \ if (val) { \ - if (*mesg != '\0') { \ - MESG(mesg); \ - } \ + MESG(mesg); \ } else { \ printf("Proc %d: ", mpi_rank); \ printf("*** PHDF5 REMARK (not an error) ***\n"); \ diff --git a/testpar/testph5.sh.in b/testpar/testph5.sh.in index 11a6e7e..f78cfac 100644 --- a/testpar/testph5.sh.in +++ b/testpar/testph5.sh.in @@ -60,6 +60,17 @@ TOOLTEST() { # testphdf5 test using the MPI-POSIX VFL driver TOOLTEST -p +# Temporary patch: +# Run t_shapesame this way. Need more permanent solution. +echo $RUNPARALLEL ./t_shapesame -p +eval $RUNPARALLEL ./t_shapesame -p + +# Check if the command failed and increment nerrors if so. +if test $? -ne 0 ; then + nerrors="`expr $nerrors + 1`" +fi +# Temporary patch ended. + # Emit message about testing status if test $nerrors -eq 0 ; then echo "All $TEST_APP tests passed." diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 0864b11..8b24f87 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -317,6 +317,7 @@ int main(int argc, char **argv) H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; + H5Ptest_param_t rr_obj_flush_confusion_params; /* Un-buffer the stdout and stderr */ setbuf(stderr, NULL); @@ -334,6 +335,15 @@ int main(int argc, char **argv) printf("PHDF5 TESTS START\n"); printf("===================================\n"); } + + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); h5_show_hostname(); @@ -472,6 +482,12 @@ int main(int argc, char **argv) "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); + rr_obj_flush_confusion_params.name = PARATESTFILE; + rr_obj_flush_confusion_params.count = 0; /* value not used */ + AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, + "round robin object header flush confusion test", + &rr_obj_flush_confusion_params); + AddTest("tldsc", lower_dim_size_comp_test, NULL, "test lower dim size comp in span tree to mpi derived type", @@ -482,15 +498,6 @@ int main(int argc, char **argv) "test mpi derived type management", PARATESTFILE); - /* rank projections / shape same tests */ - - AddTest("chsssdrpio", - contig_hyperslab_dr_pio_test, NULL, - "contiguous hyperslab shape same different rank PIO",PARATESTFILE); - - AddTest("cbhsssdrpio", - checker_board_hyperslab_dr_pio_test, NULL, - "checker board hyperslab shape same different rank PIO",PARATESTFILE); /* Display testing information */ TestInfo(argv[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index ba46e4d..2b83047 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -186,6 +186,14 @@ typedef struct H5Ptest_param_t /* holds extra test parameters */ /* Dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; +/* Shape Same Tests Definitions */ +typedef enum { + IND_CONTIG, /* Independent IO on contigous datasets */ + COL_CONTIG, /* Collective IO on contigous datasets */ + IND_CHUNKED, /* Independent IO on chunked datasets */ + COL_CHUNKED /* Collective IO on chunked datasets */ +} ShapeSameTestMethods; + /* Shared global variables */ extern int dim0, dim1; /*Dataset dimensions */ extern int chunkdim0, chunkdim1; /*Chunk dimensions */ @@ -237,10 +245,13 @@ void coll_irregular_simple_chunk_write(void); void coll_irregular_complex_chunk_read(void); void coll_irregular_complex_chunk_write(void); void io_mode_confusion(void); +void rr_obj_hdr_flush_confusion(void); +void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm); +void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm); void lower_dim_size_comp_test(void); void link_chunk_collective_io_test(void); -void contig_hyperslab_dr_pio_test(void); -void checker_board_hyperslab_dr_pio_test(void); +void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); +void checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); #ifdef H5_HAVE_FILTER_DEFLATE void compress_readAll(void); #endif /* H5_HAVE_FILTER_DEFLATE */ diff --git a/tools/Makefile.in b/tools/Makefile.in index 9e408d4..e26c4e8 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -154,6 +154,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -215,6 +216,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -271,6 +273,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index 4ef368e..bc3ccd1 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5copy and test executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5copy ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copy.c) -H5_NAMING (h5copy) -TARGET_WIN_PROPERTIES (h5copy) +H5_NAMING (h5copy ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5copy) @@ -26,8 +25,7 @@ SET (H5_DEP_EXECUTABLES h5copy) IF (BUILD_TESTING) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c) - H5_NAMING (h5copygentest) - TARGET_WIN_PROPERTIES (h5copygentest) + H5_NAMING (h5copygentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>) @@ -46,6 +44,7 @@ IF (BUILD_TESTING) h5copy_extlinks_trg.h5 h5copy_ref.h5 h5copytst.h5 + h5copy_misc1.out ) FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") @@ -101,10 +100,9 @@ IF (BUILD_TESTING) ENDIF (NOT ${resultcode} STREQUAL "2") ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname) - - MACRO (ADD_H5LS_TEST file) + MACRO (ADD_H5LS_TEST file filetest) ADD_TEST ( - NAME H5COPY-H5LS_${file} + NAME H5COPY-H5LS_${file}-${filetest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" -D "TEST_ARGS=-Svr;./testfiles/${file}.out.h5" @@ -115,7 +113,22 @@ IF (BUILD_TESTING) -D "TEST_MASK=true" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - ENDMACRO (ADD_H5LS_TEST file) + ENDMACRO (ADD_H5LS_TEST file filetest) + + MACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname) + ADD_TEST ( + NAME H5COPY-CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5copy>" + -D "TEST_ARGS=-i;${testfile}.h5;-o;./testfiles/${testfile}.out.h5;-${vparam};-s;${srcname};-d;${dstname}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=./testfiles/${testname}.out.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=./testfiles/${testname}.out" + -D "TEST_MASK=true" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + ENDMACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname) ############################################################################## ############################################################################## @@ -131,15 +144,20 @@ IF (BUILD_TESTING) SET (HDF_EXT_SRC_FILE h5copy_extlinks_src) SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg) -############# COPY OBJECTS ############## - # Remove any output file left over from previous test run ADD_TEST ( - NAME H5COPY-clear-objects + NAME H5COPY-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${HDF_FILE1}.out.h5 ./testfiles/${HDF_FILE1}.out.out + ./testfiles/${HDF_FILE1}.out.out.err + ./testfiles/${HDF_FILE2}.out.h5 + ./testfiles/${HDF_FILE2}.out.out + ./testfiles/${HDF_FILE2}.out.out.err + ./testfiles/${HDF_EXT_SRC_FILE}.out.h5 + ./testfiles/${HDF_EXT_SRC_FILE}.out.out + ./testfiles/${HDF_EXT_SRC_FILE}.out.out.err ) # "Test copying various forms of datasets" @@ -179,7 +197,7 @@ IF (BUILD_TESTING) ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1} vp /grp_nested /G/H/grp_nested) # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_FILE1}) + ADD_H5LS_TEST (${HDF_FILE1} basic) ############# COPY REFERENCES ############## @@ -190,13 +208,14 @@ IF (BUILD_TESTING) -E remove ./testfiles/${HDF_FILE2}.out.h5 ./testfiles/${HDF_FILE2}.out.out + ./testfiles/${HDF_FILE2}.out.out.err ) # "Test copying object and region references" ADD_H5_TEST (region_ref 2 ${HDF_FILE2} v / /COPY ref) # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_FILE2}) + ADD_H5LS_TEST (${HDF_FILE2} refs) ############# COPY EXT LINKS ############## @@ -207,6 +226,7 @@ IF (BUILD_TESTING) -E remove ./testfiles/${HDF_EXT_SRC_FILE}.out.h5 ./testfiles/${HDF_EXT_SRC_FILE}.out.out + ./testfiles/${HDF_EXT_SRC_FILE}.out.out.err ) # "Test copying external link directly without -f ext" @@ -234,7 +254,29 @@ IF (BUILD_TESTING) ADD_H5_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy2_group ext) # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_EXT_SRC_FILE}) + ADD_H5LS_TEST (${HDF_EXT_SRC_FILE} links) + +############# Test misc. ############## + + ADD_CUSTOM_COMMAND ( + TARGET h5copy + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5 ${PROJECT_BINARY_DIR}/h5copytst.h5 + ) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5COPY-clear-misc + COMMAND ${CMAKE_COMMAND} + -E remove + ./testfiles/${HDF_FILE1}.out.h5 + ./testfiles/${HDF_FILE1}.out.out + ./testfiles/${HDF_FILE1}.out.out.err + ) + + # "Test copying object into group which doesn't exist, without -p" + ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1} v /simple /g1/g2/simple) ENDIF (BUILD_TESTING) diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 83fb97d..7ebfff5 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -146,6 +146,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -207,6 +208,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -263,6 +265,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index eb16754..3760d6f 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - +#include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" #include <string.h> @@ -54,9 +54,8 @@ static struct long_options l_opts[] = { static void leave(int ret) { - h5tools_close(); - - exit(ret); + h5tools_close(); + exit(ret); } @@ -76,7 +75,7 @@ leave(int ret) static void usage (void) { - fprintf(stdout, "\ + fprintf(stdout, "\ usage: h5copy [OPTIONS] [OBJECTS...]\n\ OBJECTS\n\ -i, --input input file name\n\ @@ -144,45 +143,45 @@ usage: h5copy [OPTIONS] [OBJECTS...]\n\ static int parse_flag(const char* str_flag, unsigned *flag) { - unsigned fla=0; - - if (strcmp(str_flag,"shallow")==0) - { - fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG; - } - else if (strcmp(str_flag,"soft")==0) - { - fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG; - } - else if (strcmp(str_flag,"ext")==0) - { - fla = H5O_COPY_EXPAND_EXT_LINK_FLAG; - } - else if (strcmp(str_flag,"ref")==0) - { - fla = H5O_COPY_EXPAND_REFERENCE_FLAG; - } - else if (strcmp(str_flag,"noattr")==0) - { - fla = H5O_COPY_WITHOUT_ATTR_FLAG; - } - else if (strcmp(str_flag,"allflags")==0) - { - fla = H5O_COPY_ALL; - } - else if (strcmp(str_flag,"nullmsg")==0) - { - fla = H5O_COPY_PRESERVE_NULL_FLAG; - } - else - { - error_msg("Error in input flag\n"); - return -1; - } - - *flag = (*flag) | fla; - - return 0; + unsigned fla=0; + + if (HDstrcmp(str_flag,"shallow")==0) + { + fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG; + } + else if (HDstrcmp(str_flag,"soft")==0) + { + fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG; + } + else if (HDstrcmp(str_flag,"ext")==0) + { + fla = H5O_COPY_EXPAND_EXT_LINK_FLAG; + } + else if (HDstrcmp(str_flag,"ref")==0) + { + fla = H5O_COPY_EXPAND_REFERENCE_FLAG; + } + else if (HDstrcmp(str_flag,"noattr")==0) + { + fla = H5O_COPY_WITHOUT_ATTR_FLAG; + } + else if (HDstrcmp(str_flag,"allflags")==0) + { + fla = H5O_COPY_ALL; + } + else if (HDstrcmp(str_flag,"nullmsg")==0) + { + fla = H5O_COPY_PRESERVE_NULL_FLAG; + } + else + { + error_msg("Error in input flag\n"); + return -1; + } + + *flag = (*flag) | fla; + + return 0; } /*------------------------------------------------------------------------- @@ -200,141 +199,147 @@ static int parse_flag(const char* str_flag, unsigned *flag) int main (int argc, const char *argv[]) { - hid_t fid_src=-1; - hid_t fid_dst=-1; - char *fname_src=NULL; - char *fname_dst=NULL; - char *oname_src=NULL; - char *oname_dst=NULL; - unsigned flag=0; - unsigned verbose=0; - unsigned parents=0; - hid_t ocpl_id = (-1); /* Object copy property list */ - hid_t lcpl_id = (-1); /* Link creation property list */ - char str_flag[20]; - int opt; - int li_ret; - h5tool_link_info_t linkinfo; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); -/* initialize h5tools lib */ - h5tools_init(); - - /* Check for no command line parameters */ - if(argc == 1) { - usage(); - leave(EXIT_FAILURE); - } /* end if */ - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char)opt) - { - case 'd': - oname_dst = strdup(opt_arg); - break; - - case 'f': - /* validate flag */ - if (parse_flag(opt_arg,&flag)<0) - { - usage(); - leave(EXIT_FAILURE); - } - strcpy(str_flag,opt_arg); - break; - - case 'h': - usage(); - leave(EXIT_SUCCESS); - break; - - case 'i': - fname_src = strdup(opt_arg); - break; - - case 'o': - fname_dst = strdup(opt_arg); - break; - - case 'p': - parents = 1; - break; - - case 's': - oname_src = strdup(opt_arg); - break; - - case 'V': - print_version(h5tools_getprogname()); - leave(EXIT_SUCCESS); - break; - - case 'v': - verbose = 1; - break; - - default: - usage(); - leave(EXIT_FAILURE); - } - } - -/*------------------------------------------------------------------------- - * check for missing file/object names - *-------------------------------------------------------------------------*/ - - if (fname_src==NULL) - { - error_msg("Input file name missing\n"); - usage(); - leave(EXIT_FAILURE); - } - - if (fname_dst==NULL) - { - error_msg("Output file name missing\n"); - usage(); - leave(EXIT_FAILURE); - } - - if (oname_src==NULL) - { - error_msg("Source object name missing\n"); - usage(); - leave(EXIT_FAILURE); - } - - if (oname_dst==NULL) - { - error_msg("Destination object name missing\n"); - usage(); - leave(EXIT_FAILURE); - } - - -/*------------------------------------------------------------------------- - * open input file - *-------------------------------------------------------------------------*/ + hid_t fid_src=-1; + hid_t fid_dst=-1; + char *fname_src=NULL; + char *fname_dst=NULL; + char *oname_src=NULL; + char *oname_dst=NULL; + unsigned flag=0; + unsigned verbose=0; + unsigned parents=0; + hid_t ocpl_id = (-1); /* Object copy property list */ + hid_t lcpl_id = (-1); /* Link creation property list */ + char str_flag[20]; + int opt; + int li_ret; + h5tool_link_info_t linkinfo; + int i, len; + char *str_ptr=NULL; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + /* initialize h5tools lib */ + h5tools_init(); + + /* init linkinfo struct */ + HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t)); + + /* Check for no command line parameters */ + if(argc == 1) + { + usage(); + leave(EXIT_FAILURE); + } /* end if */ - fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0); + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) + { + switch ((char)opt) + { + case 'd': + oname_dst = HDstrdup(opt_arg); + break; + + case 'f': + /* validate flag */ + if (parse_flag(opt_arg,&flag)<0) + { + usage(); + leave(EXIT_FAILURE); + } + HDstrcpy(str_flag,opt_arg); + break; + + case 'h': + usage(); + leave(EXIT_SUCCESS); + break; + + case 'i': + fname_src = HDstrdup(opt_arg); + break; + + case 'o': + fname_dst = HDstrdup(opt_arg); + break; + + case 'p': + parents = 1; + break; + + case 's': + oname_src = HDstrdup(opt_arg); + break; + + case 'V': + print_version(h5tools_getprogname()); + leave(EXIT_SUCCESS); + break; + + case 'v': + verbose = 1; + break; + + default: + usage(); + leave(EXIT_FAILURE); + } + } /* end of while */ /*------------------------------------------------------------------------- - * test for error in opening input file + * check for missing file/object names *-------------------------------------------------------------------------*/ - if (fid_src==-1) - { - error_msg("Could not open input file <%s>...Exiting\n", fname_src); - if (fname_src) - free(fname_src); - leave(EXIT_FAILURE); - } -/*------------------------------------------------------------------------- - * open output file - *-------------------------------------------------------------------------*/ + if (fname_src==NULL) + { + error_msg("Input file name missing\n"); + usage(); + leave(EXIT_FAILURE); + } + + if (fname_dst==NULL) + { + error_msg("Output file name missing\n"); + usage(); + leave(EXIT_FAILURE); + } + + if (oname_src==NULL) + { + error_msg("Source object name missing\n"); + usage(); + leave(EXIT_FAILURE); + } + + if (oname_dst==NULL) + { + error_msg("Destination object name missing\n"); + usage(); + leave(EXIT_FAILURE); + } + + + /*------------------------------------------------------------------------- + * open input file + *-------------------------------------------------------------------------*/ + + fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0); + + /*------------------------------------------------------------------------- + * test for error in opening input file + *-------------------------------------------------------------------------*/ + if (fid_src==-1) + { + error_msg("Could not open input file <%s>...Exiting\n", fname_src); + if (fname_src) + HDfree(fname_src); + leave(EXIT_FAILURE); + } + + /*------------------------------------------------------------------------- + * open output file + *-------------------------------------------------------------------------*/ /* Attempt to open an existing HDF5 file first */ fid_dst = h5tools_fopen(fname_dst, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, 0); @@ -344,49 +349,46 @@ main (int argc, const char *argv[]) if(fid_dst < 0) fid_dst = H5Fcreate(fname_dst, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); -/*------------------------------------------------------------------------- - * test for error in opening output file - *-------------------------------------------------------------------------*/ - if (fid_dst==-1) - { - error_msg("Could not open output file <%s>...Exiting\n", fname_dst); - if (fname_src) - free(fname_src); - if (fname_dst) - free(fname_dst); - leave(EXIT_FAILURE); - } - -/*------------------------------------------------------------------------- - * print some info - *-------------------------------------------------------------------------*/ - - if (verbose) - { - printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", - fname_src, - oname_src, - fname_dst, - oname_dst); - if (flag) - printf("Using %s flag\n", str_flag); - } - - -/*------------------------------------------------------------------------- - * create property lists for copy - *-------------------------------------------------------------------------*/ - - /* create property to pass copy options */ - if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; + /*------------------------------------------------------------------------- + * test for error in opening output file + *-------------------------------------------------------------------------*/ + if (fid_dst==-1) + { + error_msg("Could not open output file <%s>...Exiting\n", fname_dst); + if (fname_src) + HDfree(fname_src); + if (fname_dst) + HDfree(fname_dst); + leave(EXIT_FAILURE); + } + + /*------------------------------------------------------------------------- + * print some info + *-------------------------------------------------------------------------*/ + + if (verbose) + { + printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", + fname_src, oname_src, fname_dst, oname_dst); + if (flag) + printf("Using %s flag\n", str_flag); + } + + + /*------------------------------------------------------------------------- + * create property lists for copy + *-------------------------------------------------------------------------*/ + + /* create property to pass copy options */ + if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) + goto error; - /* set options for object copy */ - if (flag) - { - if ( H5Pset_copy_object(ocpl_id, flag) < 0) - goto error; - } + /* set options for object copy */ + if (flag) + { + if ( H5Pset_copy_object(ocpl_id, flag) < 0) + goto error; + } /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { @@ -406,88 +408,107 @@ main (int argc, const char *argv[]) if(verbose) printf("%s: Creating parent groups\n", h5tools_getprogname()); } /* end if */ - -/*------------------------------------------------------------------------- - * do the copy - *-------------------------------------------------------------------------*/ - /* init linkinfo struct */ - memset(&linkinfo, 0, sizeof(h5tool_link_info_t)); + else /* error, if parent groups doesn't already exist in destination file */ + { + len = HDstrlen(oname_dst); + /* check if all the parents groups exist. skip root group */ + for (i = 1; i < len; i++) + { + if ('/'==oname_dst[i]) + { + str_ptr = (char*)HDcalloc((size_t)i+1, sizeof(char)); + HDstrncpy (str_ptr, oname_dst, (size_t)i); + str_ptr[i]='\0'; + if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) + { + error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr); + HDfree(str_ptr); + goto error; + } + HDfree(str_ptr); + } + } + } + + /*------------------------------------------------------------------------- + * do the copy + *-------------------------------------------------------------------------*/ - if(verbose) - linkinfo.opt.msg_mode = 1; + if(verbose) + linkinfo.opt.msg_mode = 1; - li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1); - if (li_ret == 0) /* dangling link */ - { - if(H5Lcopy(fid_src, oname_src, - fid_dst, oname_dst, - H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - } - else /* valid link */ - { - if (H5Ocopy(fid_src, /* Source file or group identifier */ - oname_src, /* Name of the source object to be copied */ - fid_dst, /* Destination file or group identifier */ - oname_dst, /* Name of the destination object */ - ocpl_id, /* Object copy property list */ - lcpl_id)<0) /* Link creation property list */ - goto error; - } - - /* free link info path */ - if (linkinfo.trg_path) - free(linkinfo.trg_path); - - /* close propertis */ - if(H5Pclose(ocpl_id)<0) - goto error; - if(H5Pclose(lcpl_id)<0) - goto error; - - /* close files */ - if (H5Fclose(fid_src)<0) - goto error; - if (H5Fclose(fid_dst)<0) - goto error; - - if (fname_src) - free(fname_src); - if (fname_dst) - free(fname_dst); - if (oname_dst) - free(oname_dst); - if (oname_src) - free(oname_src); - - h5tools_close(); - - return EXIT_SUCCESS; + li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1); + if (li_ret == 0) /* dangling link */ + { + if(H5Lcopy(fid_src, oname_src, + fid_dst, oname_dst, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + } + else /* valid link */ + { + if (H5Ocopy(fid_src, /* Source file or group identifier */ + oname_src, /* Name of the source object to be copied */ + fid_dst, /* Destination file or group identifier */ + oname_dst, /* Name of the destination object */ + ocpl_id, /* Object copy property list */ + lcpl_id)<0) /* Link creation property list */ + goto error; + } + + /* free link info path */ + if (linkinfo.trg_path) + HDfree(linkinfo.trg_path); + + /* close propertis */ + if(H5Pclose(ocpl_id)<0) + goto error; + if(H5Pclose(lcpl_id)<0) + goto error; + + /* close files */ + if (H5Fclose(fid_src)<0) + goto error; + if (H5Fclose(fid_dst)<0) + goto error; + + if (fname_src) + HDfree(fname_src); + if (fname_dst) + HDfree(fname_dst); + if (oname_dst) + HDfree(oname_dst); + if (oname_src) + HDfree(oname_src); + + h5tools_close(); + + return EXIT_SUCCESS; error: - printf("Error in copy...Exiting\n"); + printf("Error in copy...Exiting\n"); - /* free link info path */ - if (linkinfo.trg_path) - free(linkinfo.trg_path); + /* free link info path */ + if (linkinfo.trg_path) + HDfree(linkinfo.trg_path); H5E_BEGIN_TRY { - H5Pclose(ocpl_id); - H5Pclose(lcpl_id); - H5Fclose(fid_src); - H5Fclose(fid_dst); - } H5E_END_TRY; - if (fname_src) - free(fname_src); - if (fname_dst) - free(fname_dst); - if (oname_dst) - free(oname_dst); - if (oname_src) - free(oname_src); - - h5tools_close(); - - return EXIT_FAILURE; + H5Pclose(ocpl_id); + H5Pclose(lcpl_id); + H5Fclose(fid_src); + H5Fclose(fid_dst); + } H5E_END_TRY; + if (fname_src) + HDfree(fname_src); + if (fname_dst) + HDfree(fname_dst); + if (oname_dst) + HDfree(oname_dst); + if (oname_src) + HDfree(oname_src); + + h5tools_close(); + + return EXIT_FAILURE; } diff --git a/tools/h5copy/testfiles/h5copy_misc1.out b/tools/h5copy/testfiles/h5copy_misc1.out new file mode 100644 index 0000000..370b1a5 --- /dev/null +++ b/tools/h5copy/testfiles/h5copy_misc1.out @@ -0,0 +1,3 @@ +Copying file <h5copytst.h5> and object </simple> to file <./testfiles/h5copytst.out.h5> and object </g1/g2/simple> +Error in copy...Exiting +h5copy error: group </g1> doesn't exist. Use -p to create parent groups. diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index a54816e..7d26b3b 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -91,6 +91,15 @@ VERIFY_H5LS() echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012' } +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +VERIFY_OUTPUT() +{ + SPACES=" " + echo "Verifying output files $* $SPACES" | cut -c1-70 | tr -d '\012' +} + # Run a test and print PASS or *FAIL*. If h5copy can complete # with exit status 0, consider it pass. If a test fails then increment # the `nerrors' global variable. @@ -143,44 +152,74 @@ TOOLTEST() } +# Compare the two text files +# PASS if same +# FAIL if different, and show the diff +# +# Assumed arguments: +# $1 is text file1 (expected output) +# $2 is text file2 (actual output) +CMP_OUTPUT() +{ + expect=$1 + actual=$2 + + VERIFY_OUTPUT $@ + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output differs from actual output" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi +} + TOOLTEST_FAIL() { - runh5diff=yes - if [ "$1" = -i ]; then + expectout="$INDIR/$1" + actualout="$OUTDIR/$1.out" + actualerr="$OUTDIR/$1.err" + shift + if [ "$1" = -i ]; then inputfile=$2 - else - runh5diff=no - fi - if [ "$3" = -o ]; then + fi + if [ "$3" = -o ]; then outputfile=$4 - else - runh5diff=no - fi - + fi + TESTING $H5COPY $@ ( - echo "#############################" - echo " output for '$H5COPY $@'" - echo "#############################" + #echo "#############################" + #echo " output for '$H5COPY $@'" + #echo "#############################" $RUNSERIAL $H5COPY_BIN $@ - ) > output.out + ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then + echo " PASSED" + # Verifying output text from h5copy + if [ "$expectout" != "SKIP" ]; then + # combine stderr to stdout to compare the output at once. + # We may seperate stdout and stderr later. + cat $actualerr >> $actualout + CMP_OUTPUT $expectout $actualout + fi + else echo "*FAILED*" echo "failed result is:" - cat output.out + cat $actualout nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f output.out - fi fi - if [ $runh5diff != no ]; then - H5DIFFTEST_FAIL $inputfile $outputfile $7 $9 + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actualout $actualerr fi } @@ -389,6 +428,28 @@ COPY_EXT_LINKS() fi } +# Test misc. +# +# Assumed arguments: +# <none> +TEST_MISC() +{ + TESTFILE="$HDF_FILE1" + FILEOUT="$OUTDIR/`basename $HDF_FILE1 .h5`.out.h5" + + # Remove any output file left over from previous test run + rm -f $FILEOUT + + echo "Test copying object into group which doesn't exist, without -p" + TOOLTEST_FAIL h5copy_misc1.out -v -i $TESTFILE -o $FILEOUT -s /simple -d /g1/g2/simple + + # Remove output file created, if the "no cleanup" environment variable is + # not defined + if test -z "$HDF5_NOCLEANUP"; then + rm -f $FILEOUT + fi +} + ############################################################################## ### T H E T E S T S ### ############################################################################## @@ -396,6 +457,7 @@ COPY_EXT_LINKS() COPY_OBJECTS COPY_REFERENCES COPY_EXT_LINKS +TEST_MISC if test $nerrors -eq 0 ; then diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 4b8ddca..aabb899 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -14,8 +14,7 @@ ADD_EXECUTABLE (h5diff ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_main.c ) -H5_NAMING (h5diff) -TARGET_WIN_PROPERTIES (h5diff) +H5_NAMING (h5diff ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5diff) @@ -32,8 +31,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - H5_NAMING (h5diffgentest) - TARGET_WIN_PROPERTIES (h5diffgentest) + H5_NAMING (h5diffgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>) @@ -147,6 +145,7 @@ IF (BUILD_TESTING) h5diff_516.txt h5diff_517.txt h5diff_518.txt + h5diff_530.txt h5diff_600.txt h5diff_601.txt h5diff_603.txt @@ -209,6 +208,7 @@ IF (BUILD_TESTING) h5diff_exclude1-2.h5 h5diff_exclude2-1.h5 h5diff_exclude2-2.h5 + h5diff_comp_vl_strs.h5 ) FOREACH (txt_file ${HDF5_REFERENCE_FILES}) @@ -293,40 +293,324 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # test file names # -------------------------------------------------------------------- -SET (FILE1 h5diff_basic1.h5) -SET (FILE2 h5diff_basic2.h5) -SET (FILE3 h5diff_types.h5) -SET (FILE4 h5diff_dtypes.h5) -SET (FILE5 h5diff_attr1.h5) -SET (FILE6 h5diff_attr2.h5) -SET (FILE7 h5diff_dset1.h5) -SET (FILE8 h5diff_dset2.h5) -SET (FILE9 h5diff_hyper1.h5) -SET (FILE10 h5diff_hyper2.h5) -SET (FILE11 h5diff_empty.h5) -SET (FILE12 h5diff_links.h5) -SET (FILE13 h5diff_softlinks.h5) -SET (FILE14 h5diff_linked_softlink.h5) -SET (FILE15 h5diff_extlink_src.h5) -SET (FILE16 h5diff_extlink_trg.h5) -SET (FILE17 h5diff_ext2softlink_src.h5) -SET (FILE18 h5diff_ext2softlink_trg.h5) -SET (DANGLE_LINK_FILE1 h5diff_danglelinks1.h5) -SET (DANGLE_LINK_FILE2 h5diff_danglelinks2.h5) -SET (GRP_RECURSE_FILE1 h5diff_grp_recurse1.h5) -SET (GRP_RECURSE_FILE2 h5diff_grp_recurse2.h5) -# group recursive - same structure via external links through files -SET (GRP_RECURSE1_EXT h5diff_grp_recurse_ext1.h5) -SET (GRP_RECURSE2_EXT1 h5diff_grp_recurse_ext2-1.h5) -SET (GRP_RECURSE2_EXT2 h5diff_grp_recurse_ext2-2.h5) -SET (GRP_RECURSE2_EXT3 h5diff_grp_recurse_ext2-3.h5) -# same structure, same obj name with different value -SET (EXCLUDE_FILE1_1 h5diff_exclude1-1.h5) -SET (EXCLUDE_FILE1_2 h5diff_exclude1-2.h5) -# different structure and obj names -SET (EXCLUDE_FILE2_1 h5diff_exclude2-1.h5) -SET (EXCLUDE_FILE2_2 h5diff_exclude2-2.h5) + SET (FILE1 h5diff_basic1.h5) + SET (FILE2 h5diff_basic2.h5) + SET (FILE3 h5diff_types.h5) + SET (FILE4 h5diff_dtypes.h5) + SET (FILE5 h5diff_attr1.h5) + SET (FILE6 h5diff_attr2.h5) + SET (FILE7 h5diff_dset1.h5) + SET (FILE8 h5diff_dset2.h5) + SET (FILE9 h5diff_hyper1.h5) + SET (FILE10 h5diff_hyper2.h5) + SET (FILE11 h5diff_empty.h5) + SET (FILE12 h5diff_links.h5) + SET (FILE13 h5diff_softlinks.h5) + SET (FILE14 h5diff_linked_softlink.h5) + SET (FILE15 h5diff_extlink_src.h5) + SET (FILE16 h5diff_extlink_trg.h5) + SET (FILE17 h5diff_ext2softlink_src.h5) + SET (FILE18 h5diff_ext2softlink_trg.h5) + SET (DANGLE_LINK_FILE1 h5diff_danglelinks1.h5) + SET (DANGLE_LINK_FILE2 h5diff_danglelinks2.h5) + SET (GRP_RECURSE_FILE1 h5diff_grp_recurse1.h5) + SET (GRP_RECURSE_FILE2 h5diff_grp_recurse2.h5) + # group recursive - same structure via external links through files + SET (GRP_RECURSE1_EXT h5diff_grp_recurse_ext1.h5) + SET (GRP_RECURSE2_EXT1 h5diff_grp_recurse_ext2-1.h5) + SET (GRP_RECURSE2_EXT2 h5diff_grp_recurse_ext2-2.h5) + SET (GRP_RECURSE2_EXT3 h5diff_grp_recurse_ext2-3.h5) + # same structure, same obj name with different value + SET (EXCLUDE_FILE1_1 h5diff_exclude1-1.h5) + SET (EXCLUDE_FILE1_2 h5diff_exclude1-2.h5) + # different structure and obj names + SET (EXCLUDE_FILE2_1 h5diff_exclude2-1.h5) + SET (EXCLUDE_FILE2_2 h5diff_exclude2-2.h5) + # compound type with multiple vlen string types + SET (COMP_VL_STRS_FILE h5diff_comp_vl_strs.h5) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DIFF-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5diff_10.out + h5diff_10.out.err + h5diff_100.out + h5diff_100.out.err + h5diff_101.out + h5diff_101.out.err + h5diff_102.out + h5diff_102.out.err + h5diff_11.out + h5diff_11.out.err + h5diff_12.out + h5diff_12.out.err + h5diff_13.out + h5diff_13.out.err + h5diff_14.out + h5diff_14.out.err + h5diff_15.out + h5diff_15.out.err + h5diff_16_1.out + h5diff_16_1.out.err + h5diff_16_2.out + h5diff_16_2.out.err + h5diff_16_3.out + h5diff_16_3.out.err + h5diff_17.out + h5diff_17.out.err + h5diff_171.out + h5diff_171.out.err + h5diff_172.out + h5diff_172.out.err + h5diff_18_1.out + h5diff_18_1.out.err + h5diff_18.out + h5diff_18.out.err + h5diff_20.out + h5diff_20.out.err + h5diff_200.out + h5diff_200.out.err + h5diff_201.out + h5diff_201.out.err + h5diff_202.out + h5diff_202.out.err + h5diff_203.out + h5diff_203.out.err + h5diff_204.out + h5diff_204.out.err + h5diff_205.out + h5diff_205.out.err + h5diff_206.out + h5diff_206.out.err + h5diff_207.out + h5diff_207.out.err + h5diff_21.out + h5diff_21.out.err + h5diff_22.out + h5diff_22.out.err + h5diff_23.out + h5diff_23.out.err + h5diff_24.out + h5diff_24.out.err + h5diff_25.out + h5diff_25.out.err + h5diff_26.out + h5diff_26.out.err + h5diff_27.out + h5diff_27.out.err + h5diff_28.out + h5diff_28.out.err + h5diff_300.out + h5diff_300.out.err + h5diff_400.out + h5diff_400.out.err + h5diff_401.out + h5diff_401.out.err + h5diff_402.out + h5diff_402.out.err + h5diff_403.out + h5diff_403.out.err + h5diff_404.out + h5diff_404.out.err + h5diff_405.out + h5diff_405.out.err + h5diff_406.out + h5diff_406.out.err + h5diff_407.out + h5diff_407.out.err + h5diff_408.out + h5diff_408.out.err + h5diff_409.out + h5diff_409.out.err + h5diff_410.out + h5diff_410.out.err + h5diff_411.out + h5diff_411.out.err + h5diff_412.out + h5diff_412.out.err + h5diff_413.out + h5diff_413.out.err + h5diff_414.out + h5diff_414.out.err + h5diff_415.out + h5diff_415.out.err + h5diff_416.out + h5diff_416.out.err + h5diff_417.out + h5diff_417.out.err + h5diff_418.out + h5diff_418.out.err + h5diff_419.out + h5diff_419.out.err + h5diff_420.out + h5diff_420.out.err + h5diff_421.out + h5diff_421.out.err + h5diff_422.out + h5diff_422.out.err + h5diff_423.out + h5diff_423.out.err + h5diff_424.out + h5diff_424.out.err + h5diff_425.out + h5diff_425.out.err + h5diff_450.out + h5diff_450.out.err + h5diff_451.out + h5diff_451.out.err + h5diff_452.out + h5diff_452.out.err + h5diff_453.out + h5diff_453.out.err + h5diff_454.out + h5diff_454.out.err + h5diff_455.out + h5diff_455.out.err + h5diff_456.out + h5diff_456.out.err + h5diff_457.out + h5diff_457.out.err + h5diff_458.out + h5diff_458.out.err + h5diff_459.out + h5diff_459.out.err + h5diff_480.out + h5diff_480.out.err + h5diff_481.out + h5diff_481.out.err + h5diff_482.out + h5diff_482.out.err + h5diff_483.out + h5diff_483.out.err + h5diff_484.out + h5diff_484.out.err + h5diff_50.out + h5diff_50.out.err + h5diff_51.out + h5diff_51.out.err + h5diff_52.out + h5diff_52.out.err + h5diff_53.out + h5diff_53.out.err + h5diff_54.out + h5diff_54.out.err + h5diff_55.out + h5diff_55.out.err + h5diff_56.out + h5diff_56.out.err + h5diff_57.out + h5diff_57.out.err + h5diff_58.out + h5diff_58.out.err + h5diff_500.out + h5diff_500.out.err + h5diff_501.out + h5diff_501.out.err + h5diff_502.out + h5diff_502.out.err + h5diff_503.out + h5diff_503.out.err + h5diff_504.out + h5diff_504.out.err + h5diff_505.out + h5diff_505.out.err + h5diff_506.out + h5diff_506.out.err + h5diff_507.out + h5diff_507.out.err + h5diff_508.out + h5diff_508.out.err + h5diff_509.out + h5diff_509.out.err + h5diff_510.out + h5diff_510.out.err + h5diff_511.out + h5diff_511.out.err + h5diff_512.out + h5diff_512.out.err + h5diff_513.out + h5diff_513.out.err + h5diff_514.out + h5diff_514.out.err + h5diff_515.out + h5diff_515.out.err + h5diff_516.out + h5diff_516.out.err + h5diff_517.out + h5diff_517.out.err + h5diff_518.out + h5diff_518.out.err + h5diff_530.out + h5diff_530.out.err + h5diff_600.out + h5diff_600.out.err + h5diff_601.out + h5diff_601.out.err + h5diff_603.out + h5diff_603.out.err + h5diff_604.out + h5diff_604.out.err + h5diff_605.out + h5diff_605.out.err + h5diff_606.out + h5diff_606.out.err + h5diff_607.out + h5diff_607.out.err + h5diff_608.out + h5diff_608.out.err + h5diff_609.out + h5diff_609.out.err + h5diff_610.out + h5diff_610.out.err + h5diff_612.out + h5diff_612.out.err + h5diff_613.out + h5diff_613.out.err + h5diff_614.out + h5diff_614.out.err + h5diff_615.out + h5diff_615.out.err + h5diff_616.out + h5diff_616.out.err + h5diff_617.out + h5diff_617.out.err + h5diff_618.out + h5diff_618.out.err + h5diff_619.out + h5diff_619.out.err + h5diff_621.out + h5diff_621.out.err + h5diff_622.out + h5diff_622.out.err + h5diff_623.out + h5diff_623.out.err + h5diff_624.out + h5diff_624.out.err + h5diff_625.out + h5diff_625.out.err + h5diff_626.out + h5diff_626.out.err + h5diff_627.out + h5diff_627.out.err + h5diff_628.out + h5diff_628.out.err + h5diff_629.out + h5diff_629.out.err + h5diff_70.out + h5diff_70.out.err + h5diff_80.out + h5diff_80.out.err + h5diff_90.out + h5diff_90.out.err + ) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DIFF-help COMMAND h5diff -h) + ADD_TEST (NAME H5DIFF-normal-mode COMMAND h5diff ${FILE1} ${FILE2}) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) # ############################################################################ # # Common usage @@ -783,6 +1067,11 @@ ADD_H5_TEST (h5diff_483 1 -v --exclude-path "/group1" ${EXCLUDE_FILE2_1} ${EXCLU # Exclude from group compare ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2} /group1) +# ############################################################################## +# # diff various multiple vlen and fixed strings in a compound type dataset +# ############################################################################## +ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE}) + ENDIF (BUILD_TESTING) diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 3bfbf8e..457f6c3 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -153,6 +153,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -214,6 +215,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -270,6 +272,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index d66f821..c3a92cb 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -68,6 +68,8 @@ /* different structure and obj names */ #define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5" #define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5" +/* compound type with multiple vlen string types */ +#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 @@ -116,6 +118,7 @@ static int test_group_recurse(const char *fname1, const char *fname2); static int test_group_recurse2(); static int test_exclude_obj1(const char *fname1, const char *fname2); static int test_exclude_obj2(const char *fname1, const char *fname2); +static int test_comp_vlen_strings(const char *fname1); /* called by test_attributes() and test_datasets() */ static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); @@ -171,6 +174,9 @@ int main(void) test_exclude_obj1(EXCLUDE_FILE1_1, EXCLUDE_FILE1_2); test_exclude_obj2(EXCLUDE_FILE2_1, EXCLUDE_FILE2_2); + /* diff various multiple vlen and fixlen string types in a compound dataset */ + test_comp_vlen_strings(COMP_VL_STRS_FILE ); + return 0; } @@ -2919,6 +2925,706 @@ out: } /*------------------------------------------------------------------------- +* +* Purpose: Create test files for multiple variable length string/string array +* along with fixed length string/string array types in +* a compound type dataset. +* +* Programmer: Jonathan Kim (Oct, 26, 2010) +* +*-------------------------------------------------------------------------*/ +#define STR_RANK 1 +#define VLEN_STR_DIM 1 +#define FIXLEN_STR_SIZE 21 +#define FIXLEN_STR_DIM 1 +#define VLEN_STR_ARRY_DIM 3 +#define FIXLEN_STR_ARRY_DIM 3 +#define FIXLEN_STR_ARRY_SIZE 30 +#define COMP_RANK 1 +#define COMP_DIM 1 +static int test_comp_vlen_strings(const char *fname1) +{ + int i; + + hid_t fid1; /* file id */ + + /* compound1 datatype */ + typedef struct comp1_t + { + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + } comp1_t; + + /* compound2 datatype */ + typedef struct comp2_t + { + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + } comp2_t; + + /* compound3 datatype */ + typedef struct comp3_t + { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + } comp3_t; + + /* compound4 datatype */ + typedef struct comp4_t + { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + } comp4_t; + + /* compound5 datatype */ + typedef struct comp5_t + { + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + } comp5_t; + + /* compound6 datatype */ + typedef struct comp6_t + { + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + } comp6_t; + + /* compound7 datatype */ + typedef struct comp7_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + } comp7_t; + + /* compound8 datatype */ + typedef struct comp8_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + } comp8_t; + + /* compound9 datatype */ + typedef struct comp9_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + int int_data1; + hobj_ref_t objref1; /* reference */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + hobj_ref_t objref2; /* reference */ + char *str_vlen; /* vlen string */ + int int_data2; + char *str_vlen_repeat; /* vlen string */ + hobj_ref_t objref3; /* reference */ + int int_data3; + } comp9_t; + + /* vlen string */ + hid_t sid_vlen_str=0; /* dataspace ID */ + hid_t tid_vlen_str=0; /* datatype ID */ + const char vlen_str_buf[]= { + "Variable length string" + }; + hsize_t dims_vlen_str[] = {VLEN_STR_DIM}; + + /* fixlen string */ + hid_t sid_fixlen_str=0; /* dataspace ID */ + hid_t tid_fixlen_str=0; /* datatype ID */ + const char fixlen_str_buf[FIXLEN_STR_SIZE]= { + "Fixed length string" + }; + hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM}; + + /* vlen string array */ + hid_t sid_vlen_str_array=0; /* dataspace ID */ + hid_t tid_vlen_str_array_pre=0; /* datatype ID */ + hid_t tid_vlen_str_array=0; /* datatype ID */ + const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= { + "1 - Variable length string Array", + "2 - Testing variable length string array in compound type", + "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," + }; + hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM}; + + /* fixlen string array */ + hid_t sid_fixlen_str_array=0; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre=0; /* datatype ID */ + hid_t tid_fixlen_str_array=0; /* datatype ID */ + const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM]= { + "1 - Fixed length string Array", + "2 - Fixed length string Array", + "3 - Fixed length string Array" + }; + hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM}; + + /* objref */ + hsize_t objref_dims[1]={1}; + + /*------------------------------------------ + * compound dataset + *------------------------------------------*/ + hid_t sid_comp=0; /* dataspace ID */ + hid_t tid1_comp=0; /* datatype ID */ + hid_t tid2_comp=0; /* datatype ID */ + hid_t tid3_comp=0; /* datatype ID */ + hid_t tid4_comp=0; /* datatype ID */ + hid_t tid5_comp=0; /* datatype ID */ + hid_t tid6_comp=0; /* datatype ID */ + hid_t tid7_comp=0; /* datatype ID */ + hid_t tid8_comp=0; /* datatype ID */ + hid_t tid9_comp=0; /* datatype ID */ + hid_t did_comp=0; /* dataset ID */ + hsize_t dims_comp[] = {COMP_DIM}; + herr_t status = SUCCEED; + + /* make compound strings data */ + comp1_t comp1_buf; + comp2_t comp2_buf; + comp3_t comp3_buf; + comp4_t comp4_buf; + comp5_t comp5_buf; + comp6_t comp6_buf; + comp7_t comp7_buf; + comp8_t comp8_buf; + comp9_t comp9_buf; + + /* copy vlen string data to compound buffers */ + comp1_buf.str_vlen = comp1_buf.str_vlen_repeat = vlen_str_buf; + comp2_buf.str_vlen = comp2_buf.str_vlen_repeat = vlen_str_buf; + comp3_buf.str_vlen = comp3_buf.str_vlen_repeat = vlen_str_buf; + comp4_buf.str_vlen = comp4_buf.str_vlen_repeat = vlen_str_buf; + comp5_buf.str_vlen = comp5_buf.str_vlen_repeat = vlen_str_buf; + comp6_buf.str_vlen = comp6_buf.str_vlen_repeat = vlen_str_buf; + comp7_buf.str_vlen = comp7_buf.str_vlen_repeat = vlen_str_buf; + comp8_buf.str_vlen = comp8_buf.str_vlen_repeat = vlen_str_buf; + comp9_buf.str_vlen = comp9_buf.str_vlen_repeat = vlen_str_buf; + + /* copy fixlen string data to compound buffers */ + HDstrcpy(comp1_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp1_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp2_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp2_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp4_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp4_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp5_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp5_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp6_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp6_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp7_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp7_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp8_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp8_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp9_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp9_buf.str_fixlen_repeat, fixlen_str_buf); + + /* copy vlen string array data to compound buffers */ + for (i=0; i < VLEN_STR_ARRY_DIM; i++) + { + comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + + } + + /* copy fixlen string attay data to compound buffers */ + for (i=0; i < FIXLEN_STR_ARRY_DIM; i++) + { + HDstrcpy(comp1_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp1_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp2_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp2_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp3_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp3_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp4_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp4_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp5_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp5_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp6_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp6_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp7_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp7_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp8_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp8_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp9_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp9_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + } + + /* int data */ + comp9_buf.int_data1 = 10; + comp9_buf.int_data2 = 20; + comp9_buf.int_data3 = 30; + + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Variable length String1 - Create space and type + *------------------------------------------------------------------------*/ + sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); + if (sid_vlen_str < 0) + { + fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + status = FAIL; + goto out; + } + + tid_vlen_str = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Fixed length String2 - Create space and type + *------------------------------------------------------------------------*/ + sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); + if (sid_fixlen_str < 0) + { + fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + status = FAIL; + goto out; + } + + tid_fixlen_str = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Fixed length String3 array - Create space and type + *------------------------------------------------------------------------*/ + sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); + if (sid_vlen_str_array < 0) + { + fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + status = FAIL; + goto out; + } + + tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + status = FAIL; + goto out; + } + + /* Create the array data type for the string array */ + tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array); + if (tid_vlen_str_array < 0) + { + fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Variable length String4 array - Create space and type + *------------------------------------------------------------------------*/ + sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); + if (sid_fixlen_str_array < 0) + { + fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + status = FAIL; + goto out; + } + + tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + status = FAIL; + goto out; + } + /* Create the array data type for the string array */ + tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array); + if (tid_fixlen_str_array < 0) + { + fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*------------------------------------------------------------------------- + * Compound dataset + *------------------------------------------------------------------------*/ + sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL); + if (sid_comp < 0) + { + fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + status = FAIL; + goto out; + } + tid1_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp1_t)); + tid2_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp2_t)); + tid3_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp3_t)); + tid4_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp4_t)); + tid5_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp5_t)); + tid6_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp6_t)); + tid7_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp7_t)); + tid8_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp8_t)); + tid9_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp9_t)); + + /* compound 1 */ + H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid1_comp, "VLEN_STR_ARRAY2", HOFFSET(comp1_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp1_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 2 */ + H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid2_comp, "VLEN_STR_ARRAY2", HOFFSET(comp2_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp2_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 3 */ + H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid3_comp, "VLEN_STR_ARRAY2", HOFFSET(comp3_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp3_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 4 */ + H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid4_comp, "VLEN_STR_ARRAY2", HOFFSET(comp4_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp4_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 5 */ + H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 6 */ + H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid6_comp, "VLEN_STR_ARRAY2", HOFFSET(comp6_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp6_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 7 */ + H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid7_comp, "VLEN_STR_ARRAY2", HOFFSET(comp7_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp7_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 8 */ + H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid8_comp, "VLEN_STR_ARRAY2", HOFFSET(comp8_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp8_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 9 */ + H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid9_comp, "VLEN_STR_ARRAY2", HOFFSET(comp9_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp9_t, str_fixlen_array_again), tid_fixlen_str_array); + H5Tinsert(tid9_comp, "INT_DATA1", HOFFSET(comp9_t, int_data1), H5T_STD_I32LE); + H5Tinsert(tid9_comp, "INT_DATA2", HOFFSET(comp9_t, int_data2), H5T_STD_I32BE); + H5Tinsert(tid9_comp, "INT_DATA3", HOFFSET(comp9_t, int_data3), H5T_STD_I32LE); + H5Tinsert(tid9_comp, "OBJREF1", HOFFSET(comp9_t, objref1), H5T_STD_REF_OBJ); + H5Tinsert(tid9_comp, "OBJREF2", HOFFSET(comp9_t, objref2), H5T_STD_REF_OBJ); + H5Tinsert(tid9_comp, "OBJREF3", HOFFSET(comp9_t, objref3), H5T_STD_REF_OBJ); + + + /* Write data to compound 1 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 2 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 3 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 4 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 5 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 6 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 7 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 8 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 9 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* obj references */ + status=H5Rcreate(&(comp9_buf.objref1),fid1,"/Compound_dset2",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref2),fid1,"/Compound_dset3",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref3),fid1,"/Compound_dset4",H5R_OBJECT,-1); + + status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + + + H5Dclose(did_comp); + + did_comp=0; +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + /* vlen string */ + if(tid_vlen_str) + H5Tclose(tid_vlen_str); + if(sid_vlen_str) + H5Sclose(sid_vlen_str); + /* fixed len string */ + if(tid_fixlen_str) + H5Tclose(tid_fixlen_str); + if(sid_fixlen_str) + H5Sclose(sid_fixlen_str); + /* vlen string array */ + if(tid_vlen_str_array_pre) + H5Tclose(tid_vlen_str_array_pre); + if(tid_vlen_str_array) + H5Tclose(tid_vlen_str_array); + if(sid_vlen_str_array) + H5Sclose(sid_vlen_str_array); + /* fixed len string array */ + if(tid_fixlen_str_array_pre) + H5Tclose(tid_fixlen_str_array_pre); + if(tid_fixlen_str_array) + H5Tclose(tid_fixlen_str_array); + if(sid_fixlen_str_array) + H5Sclose(sid_fixlen_str_array); + /* compound */ + if(tid1_comp) + H5Tclose(tid1_comp); + if(tid2_comp) + H5Tclose(tid2_comp); + if(tid3_comp) + H5Tclose(tid3_comp); + if(tid4_comp) + H5Tclose(tid4_comp); + if(tid5_comp) + H5Tclose(tid5_comp); + if(tid6_comp) + H5Tclose(tid6_comp); + if(tid7_comp) + H5Tclose(tid7_comp); + if(tid8_comp) + H5Tclose(tid8_comp); + if(tid9_comp) + H5Tclose(tid9_comp); + if(did_comp) + H5Dclose(did_comp); + if(sid_comp) + H5Sclose(sid_comp); + + return status; +} + +/*------------------------------------------------------------------------- * Function: write_attr_in * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) diff --git a/tools/h5diff/testfiles/h5diff_530.txt b/tools/h5diff/testfiles/h5diff_530.txt new file mode 100644 index 0000000..bd2b435 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_530.txt @@ -0,0 +1,35 @@ + +file1 file2 +--------------------------------------- + x x / + x x /Compound_dset1 + x x /Compound_dset2 + x x /Compound_dset3 + x x /Compound_dset4 + x x /Compound_dset5 + x x /Compound_dset6 + x x /Compound_dset7 + x x /Compound_dset8 + x x /Compound_dset9 + +group : </> and </> +0 differences found +dataset: </Compound_dset1> and </Compound_dset1> +0 differences found +dataset: </Compound_dset2> and </Compound_dset2> +0 differences found +dataset: </Compound_dset3> and </Compound_dset3> +0 differences found +dataset: </Compound_dset4> and </Compound_dset4> +0 differences found +dataset: </Compound_dset5> and </Compound_dset5> +0 differences found +dataset: </Compound_dset6> and </Compound_dset6> +0 differences found +dataset: </Compound_dset7> and </Compound_dset7> +0 differences found +dataset: </Compound_dset8> and </Compound_dset8> +0 differences found +dataset: </Compound_dset9> and </Compound_dset9> +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 b/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 Binary files differnew file mode 100644 index 0000000..dac510f --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 2949f6a..f818738 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -68,6 +68,8 @@ EXCLUDE_FILE1_2=h5diff_exclude1-2.h5 # different structure and obj names EXCLUDE_FILE2_1=h5diff_exclude2-1.h5 EXCLUDE_FILE2_2=h5diff_exclude2-2.h5 +# compound type with multiple vlen string types +COMP_VL_STRS_FILE=h5diff_comp_vl_strs.h5 TESTNAME=h5diff EXIT_SUCCESS=0 @@ -176,6 +178,13 @@ STDOUT_FILTER() { # LA-MPI: *** Copyright 2001-2004, ACL, Los Alamos National Laboratory # 3. h5diff debug output: # Debug output all have prefix "h5diff debug: ". +# 4. AIX system prints messages like these when it is aborting: +# ERROR: 0031-300 Forcing all remote tasks to exit due to exit code 1 in task 0 +# ERROR: 0031-250 task 4: Terminated +# ERROR: 0031-250 task 3: Terminated +# ERROR: 0031-250 task 2: Terminated +# ERROR: 0031-250 task 1: Terminated + STDERR_FILTER() { result_file=$1 tmp_file=/tmp/h5test_tmp_$$ @@ -187,9 +196,10 @@ STDERR_FILTER() { fi # Filter LANL MPI messages # and LLNL srun messages + # and AIX error messages if test -n "$pmode"; then cp $result_file $tmp_file - sed -e '/^LA-MPI:/d' -e '/^srun:/d' \ + sed -e '/^LA-MPI:/d' -e '/^srun:/d' -e '/^ERROR:/d' \ < $tmp_file > $result_file fi # Filter h5diff debug output @@ -771,8 +781,12 @@ TOOLTEST h5diff_482.txt -v --exclude-path "/group1" --exclude-path "/dset1" $EXC TOOLTEST h5diff_483.txt -v --exclude-path "/group1" $EXCLUDE_FILE2_1 $EXCLUDE_FILE2_2 # Exclude from group compare -TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 /group1 +TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" $EXCLUDE_FILE1_1 $EXCLUDE_FILE1_2 /group1 +# ############################################################################## +# # diff various multiple vlen and fixed strings in a compound type dataset +# ############################################################################## +TOOLTEST h5diff_530.txt -v $COMP_VL_STRS_FILE $COMP_VL_STRS_FILE # ############################################################################## # # END diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 075a3b3..e8e88ad 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5dump executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c) -H5_NAMING (h5dump) -TARGET_WIN_PROPERTIES (h5dump) +H5_NAMING (h5dump ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5dump) @@ -29,8 +28,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - H5_NAMING (h5dumpgentest) - TARGET_WIN_PROPERTIES (h5dumpgentest) + H5_NAMING (h5dumpgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>) @@ -40,6 +38,7 @@ IF (BUILD_TESTING) # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_FILES + packedbits.ddl tall-1.ddl tall-2.ddl tall-2A.ddl @@ -84,6 +83,7 @@ IF (BUILD_TESTING) texternal.ddl textlinksrc.ddl textlinkfar.ddl + textlink.ddl tfamily.ddl tfill.ddl tfletcher32.ddl @@ -219,6 +219,7 @@ IF (BUILD_TESTING) tbin3.ddl tbin4.ddl out3.h5import + packedbits.h5 taindices.h5 tall.h5 tarray1.h5 @@ -243,6 +244,7 @@ IF (BUILD_TESTING) textlinkfar.h5 textlinksrc.h5 textlinktar.h5 + textlink.h5 tfamily00000.h5 tfamily00001.h5 tfamily00002.h5 @@ -473,6 +475,240 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + packedbits.out + packedbits.out.err + tall-1.out + tall-1.out.err + tall-2.out + tall-2.out.err + tall-2A.out + tall-2A.out.err + tall-2B.out + tall-2B.out.err + tall-3.out + tall-3.out.err + tall-4s.out + tall-4s.out.err + tall-5s.out + tall-5s.out.err + tallfilters.out + tallfilters.out.err + tarray1.out + tarray1.out.err + tarray2.out + tarray2.out.err + tarray3.out + tarray3.out.err + tarray4.out + tarray4.out.err + tarray5.out + tarray5.out.err + tarray6.out + tarray6.out.err + tarray7.out + tarray7.out.err + tarray8.out + tarray8.out.err + tattr-1.out + tattr-1.out.err + tattr-2.out + tattr-2.out.err + tattr-3.out + tattr-3.out.err + tattrreg.out + tattrreg.out.err + tattrregR.out + tattrregR.out.err + tbinregR.out + tbinregR.out.err + tbigdims.out + tbigdims.out.err + tboot1.out + tboot1.out.err + tboot2.out + tboot2.out.err + tchar1.out + tchar1.out.err + tchunked.out + tchunked.out.err + tcomp-1.out + tcomp-1.out.err + tcomp-2.out + tcomp-2.out.err + tcomp-3.out + tcomp-3.out.err + tcomp-4.out + tcomp-4.out.err + tcompact.out + tcompact.out.err + tcontents.out + tcontents.out.err + tcontiguos.out + tcontiguos.out.err + tdatareg.out + tdatareg.out.err + tdataregR.out + tdataregR.out.err + tdeflate.out + tdeflate.out.err + tdset-1.out + tdset-1.out.err + tdset-2.out + tdset-2.out.err + tdset-3s.out + tdset-3s.out.err + tempty.out + tempty.out.err + texternal.out + texternal.out.err + textlinksrc.out + textlinksrc.out.err + textlinkfar.out + textlinkfar.out.err + textlink.out + textlink.out.err + tfamily.out + tfamily.out.err + tfill.out + tfill.out.err + tfletcher32.out + tfletcher32.out.err + tfpformat.out + tfpformat.out.err + tgroup-1.out + tgroup-1.out.err + tgroup-2.out + tgroup-2.out.err + tgrp_comments.out + tgrp_comments.out.err + thlink-1.out + thlink-1.out.err + thlink-2.out + thlink-2.out.err + thlink-3.out + thlink-3.out.err + thlink-4.out + thlink-4.out.err + thlink-5.out + thlink-5.out.err + thyperslab.out + thyperslab.out.err + tindicesno.out + tindicesno.out.err + tindicessub1.out + tindicessub1.out.err + tindicessub2.out + tindicessub2.out.err + tindicessub3.out + tindicessub3.out.err + tindicessub4.out + tindicessub4.out.err + tindicesyes.out + tindicesyes.out.err + tlarge_objname.out + tlarge_objname.out.err + tldouble.out + tldouble.out.err + tlonglinks.out + tlonglinks.out.err + tloop-1.out + tloop-1.out.err + tmulti.out + tmulti.out.err + tnamed_dtype_attr.out + tnamed_dtype_attr.out.err + tnestcomp-1.out + tnestcomp-1.out.err + tnbit.out + tnbit.out.err + tnofilename.out + tnofilename.out.err + tnullspace.out + tnullspace.out.err + tordergr1.out + tordergr1.out.err + tordergr2.out + tordergr2.out.err + tordergr3.out + tordergr3.out.err + tordergr4.out + tordergr4.out.err + tordergr5.out + tordergr5.out.err + torderattr1.out + torderattr1.out.err + torderattr2.out + torderattr2.out.err + torderattr3.out + torderattr3.out.err + torderattr4.out + torderattr4.out.err + tperror.out + tperror.out.err + treference.out + treference.out.err + tsaf.out + tsaf.out.err + tscaleoffset.out + tscaleoffset.out.err + tshuffle.out + tshuffle.out.err + tslink-1.out + tslink-1.out.err + tslink-2.out + tslink-2.out.err + tsplit_file.out + tsplit_file.out.err + tstr-1.out + tstr-1.out.err + tstr-2.out + tstr-2.out.err + tstring.out + tstring.out.err + tstring2.out + tstring2.out.err + tstringe.out + tstringe.out.err + tszip.out + tszip.out.err + tudlink-1.out + tudlink-1.out.err + tudlink-2.out + tudlink-2.out.err + tuserfilter.out + tuserfilter.out.err + tvldtypes1.out + tvldtypes1.out.err + tvldtypes2.out + tvldtypes2.out.err + tvldtypes3.out + tvldtypes3.out.err + tvldtypes4.out + tvldtypes4.out.err + tvldtypes5.out + tvldtypes5.out.err + tvlstr.out + tvlstr.out.err + tvms.out + tvms.out.err + ) + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DUMP-tgroup COMMAND h5dump tgroup.h5) + ADD_TEST (NAME H5DUMP-tdset COMMAND h5dump tdset.h5) + ADD_TEST (NAME H5DUMP-tattr COMMAND h5dump tattr.h5) + ADD_TEST (NAME H5DUMP-tslink COMMAND h5dump tslink.h5) + ADD_TEST (NAME H5DUMP-thlink COMMAND h5dump thlink.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + + # test for signed/unsigned datasets + ADD_H5_TEST (packedbits 0 packedbits.h5) # test for displaying groups ADD_H5_TEST (tgroup-1 0 tgroup.h5) # test for displaying the selected groups @@ -583,11 +819,7 @@ IF (BUILD_TESTING) # test failure handling # Missing file name - IF (${USE_PACKED_BITS}) - ADD_H5_TEST (tnofilename-with-packed-bits 1) - ELSE (${USE_PACKED_BITS}) - ADD_H5_TEST (tnofilename 1) - ENDIF (${USE_PACKED_BITS}) + ADD_H5_TEST (tnofilename 1) # rev. 2004 @@ -774,15 +1006,171 @@ IF (BUILD_TESTING) ADD_H5_TEST (textlinksrc 0 textlinksrc.h5) ADD_H5_TEST (textlinkfar 0 textlinkfar.h5) - # test for dataset packed bits - SET (TESTTYPE "TEST") - IF (NOT ${USE_PACKED_BITS}) - SET (TESTTYPE "SKIP") - ENDIF (NOT ${USE_PACKED_BITS}) - ADD_SKIP_H5_TEST (tpackedbits 0 ${TESTTYPE} -d /dset1 -M 0,2 tdset.h5) - ADD_SKIP_H5_TEST (tpackedbits2 0 ${TESTTYPE} -d /dset1 -M 0,2,2,1 tdset.h5) + # test for dangling external links + ADD_H5_TEST (textlink 0 textlink.h5) + + ####### test for dataset packed bits ###### + IF (HDF5_USE_H5DUMP_PACKED_BITS) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP_PACKED_BITS-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tpackedbits.out + tpackedbits.out.err + tpackedbits2.out + tpackedbits2.out.err + ) + ADD_H5_TEST (tpackedbits 0 -d /dset1 -M 0,2 tdset.h5) + ADD_H5_TEST (tpackedbits2 0 -d /dset1 -M 0,2,2,1 tdset.h5) + ENDIF (HDF5_USE_H5DUMP_PACKED_BITS) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP-XML-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tall.h5.out + tall.h5.out.err + tall-2A.h5.out + tall-2A.h5.out.err + tarray1.h5.out + tarray1.h5.out.err + tarray2.h5.out + tarray2.h5.out.err + tarray3.h5.out + tarray3.h5.out.err + tarray6.h5.out + tarray6.h5.out.err + tarray7.h5.out + tarray7.h5.out.err + tattr.h5.out + tattr.h5.out.err + tbitfields.h5.out + tbitfields.h5.out.err + tcompound.h5.out + tcompound.h5.out.err + tcompound2.h5.out + tcompound2.h5.out.err + tcompound_complex.h5.out + tcompound_complex.h5.out.err + tdatareg.h5.out + tdatareg.h5.out.err + tdset.h5.out + tdset.h5.out.err + tdset2.h5.out + tdset2.h5.out.err + tempty-dtd-2.h5.out + tempty-dtd-2.h5.out.err + tempty-dtd-uri.h5.out + tempty-dtd-uri.h5.out.err + tempty-dtd.h5.out + tempty-dtd.h5.out.err + tempty-nons-2.h5.out + tempty-nons-2.h5.out.err + tempty-nons-uri.h5.out + tempty-nons-uri.h5.out.err + tempty-nons.h5.out + tempty-nons.h5.out.err + tempty-ns-2.h5.out + tempty-ns-2.h5.out.err + tempty-ns.h5.out + tempty-ns.h5.out.err + tempty.h5.out + tempty.h5.out.err + tenum.h5.out + tenum.h5.out.err + textlink.h5.out + textlink.h5.out.err + tfpformat.h5.out + tfpformat.h5.out.err + tgroup.h5.out + tgroup.h5.out.err + thlink.h5.out + thlink.h5.out.err + tloop.h5.out + tloop.h5.out.err + tloop2.h5.out + tloop2.h5.out.err + tmany.h5.out + tmany.h5.out.err + tname-amp.h5.out + tname-amp.h5.out.err + tname-apos.h5.out + tname-apos.h5.out.err + tname-gt.h5.out + tname-gt.h5.out.err + tname-lt.h5.out + tname-lt.h5.out.err + tname-quot.h5.out + tname-quot.h5.out.err + tname-sp.h5.out + tname-sp.h5.out.err + tnamed_dtype_attr.h5.out + tnamed_dtype_attr.h5.out.err + tnestedcomp.h5.out + tnestedcomp.h5.out.err + tnodata.h5.out + tnodata.h5.out.err + tnoname.h5.out + tnoname.h5.out.err + tobjref.h5.out + tobjref.h5.out.err + topaque.h5.out + topaque.h5.out.err + torderattr1.h5.out + torderattr1.h5.out.err + torderattr2.h5.out + torderattr2.h5.out.err + torderattr3.h5.out + torderattr3.h5.out.err + torderattr4.h5.out + torderattr4.h5.out.err + tref-escapes-at.h5.out + tref-escapes-at.h5.out.err + tref-escapes.h5.out + tref-escapes.h5.out.err + tref.h5.out + tref.h5.out.err + tsaf.h5.out + tsaf.h5.out.err + tslink.h5.out + tslink.h5.out.err + tstr.h5.out + tstr.h5.out.err + tstr2.h5.out + tstr2.h5.out.err + tstring.h5.out + tstring.h5.out.err + tstring-at.h5.out + tstring-at.h5.out.err + tudlink.h5.out + tudlink.h5.out.err + tvldtypes1.h5.out + tvldtypes1.h5.out.err + tvldtypes2.h5.out + tvldtypes2.h5.out.err + tvldtypes3.h5.out + tvldtypes3.h5.out.err + tvldtypes4.h5.out + tvldtypes4.h5.out.err + tvldtypes5.h5.out + tvldtypes5.h5.out.err + tvlstr.h5.out + tvlstr.h5.out.err + ) ########## test XML + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DUMP-XML-tgroup COMMAND h5dump --xml tgroup.h5) + ADD_TEST (NAME H5DUMP-XML-tdset COMMAND h5dump --xml tdset.h5) + ADD_TEST (NAME H5DUMP-XML-tattr COMMAND h5dump --xml tattr.h5) + ADD_TEST (NAME H5DUMP-XML-tslink COMMAND h5dump --xml tslink.h5) + ADD_TEST (NAME H5DUMP-XML-thlink COMMAND h5dump --xml thlink.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_XML_H5_TEST (tall.h5 0 tall.h5) ADD_XML_H5_TEST (tattr.h5 0 tattr.h5) ADD_XML_H5_TEST (tbitfields.h5 0 tbitfields.h5) diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 338e08c..40af398 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -151,6 +151,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -212,6 +213,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -268,6 +270,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 261fe15..6b1f576 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -132,7 +132,7 @@ static h5tool_format_t dataformat = { "", /*fmt_raw */ "%d", /*fmt_int */ "%u", /*fmt_uint */ - "%d", /*fmt_schar */ + "%hhd", /*fmt_schar */ "%u", /*fmt_uchar */ "%d", /*fmt_short */ "%u", /*fmt_ushort */ @@ -216,7 +216,7 @@ static h5tool_format_t xml_dataformat = { "", /*fmt_raw */ "%d", /*fmt_int */ "%u", /*fmt_uint */ - "%d", /*fmt_schar */ + "%hhd", /*fmt_schar */ "%u", /*fmt_uchar */ "%d", /*fmt_short */ "%u", /*fmt_ushort */ @@ -2211,7 +2211,6 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) unsigned attr_crt_order_flags; hid_t dcpl_id; /* dataset creation property list ID */ - if ((dcpl_id = H5Dget_create_plist(did)) < 0) { error_msg("error in getting creation property list ID\n"); @@ -2646,15 +2645,27 @@ dump_oid(hid_t oid) static void dump_comment(hid_t obj_id) { - char comment[50]; - - comment[0] = '\0'; - H5Oget_comment(obj_id, comment, sizeof(comment)); + size_t buf_size = 0; + char* comment = NULL; + ssize_t cmt_bufsize = -1; + + cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); + + /* call H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ + indentation(indent); + printf("COMMENT \"%s\"\n", comment); + } /* end if */ + HDfree(comment); + } + } - if(comment[0]) { - indentation(indent); - printf("COMMENT \"%s\"\n", comment); - } /* end if */ } /* end dump_comment() */ @@ -3988,7 +3999,7 @@ parse_start: leave(EXIT_SUCCESS); break; case 'w': - nCols = atoi(opt_arg); + nCols = HDatoi(opt_arg); last_was_dset = FALSE; break; case 'a': diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 95caa5e..8401000 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -95,6 +95,7 @@ /*#define FILE64 "tarray8.h5"*/ #define FILE65 "tattrreg.h5" #define FILE66 "file_space.h5" +#define FILE67 "packedbits.h5" @@ -253,6 +254,22 @@ typedef struct s1_t { #define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ #define THRESHOLD10 10 /* Free space section threshold */ +/* "FILE67" macros */ +#define F67_XDIM 8 +#define F67_DATASETU08 "DU08BITS" +#define F67_DATASETS08 "DS08BITS" +#define F67_YDIM8 8 +#define F67_DATASETU16 "DU16BITS" +#define F67_DATASETS16 "DS16BITS" +#define F67_YDIM16 16 +#define F67_DATASETU32 "DU32BITS" +#define F67_DATASETS32 "DS32BITS" +#define F67_YDIM32 32 +#define F67_DATASETU64 "DU64BITS" +#define F67_DATASETS64 "DS64BITS" +#define F67_YDIM64 64 +#define F67_DUMMYDBL "DummyDBL" + static void gent_group(void) { @@ -3383,6 +3400,11 @@ gent_group_comments(void) H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT); H5Gclose(group); + /* /glongcomment */ + group = H5Gcreate2(fid, "/glongcomment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Oset_comment_by_name(group, "/glongcomment", "Comment for group /glongcomment with a really, really, really long, long, long comment", H5P_DEFAULT); + H5Gclose(group); + H5Fclose(fid); } @@ -6775,6 +6797,196 @@ gent_fs_strategy_threshold(void) } /*------------------------------------------------------------------------- + * Function: gent_packedbits + * + * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Three datasets of 1, 2 and 4 bytes of unsigned int types are created. + * Three more datasets of 1, 2 and 4 bytes of signed int types are created. + * Fill them with raw data such that no bit will be all zero in a dataset. + * A dummy dataset of double type is created for failure test. + * Created: Albert Cheng, 2010/5/10. + * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes + *------------------------------------------------------------------------- + */ +static void +gent_packedbits(void) +{ + hid_t fid, dataset, space; + hsize_t dims[2]; + uint8_t dsetu8[F67_XDIM][F67_YDIM8], valu8bits; + uint16_t dsetu16[F67_XDIM][F67_YDIM16], valu16bits; + uint32_t dsetu32[F67_XDIM][F67_YDIM32], valu32bits; + uint64_t dsetu64[F67_XDIM][F67_YDIM64], valu64bits; + int8_t dset8[F67_XDIM][F67_YDIM8], val8bits; + int16_t dset16[F67_XDIM][F67_YDIM16], val16bits; + int32_t dset32[F67_XDIM][F67_YDIM32], val32bits; + int64_t dset64[F67_XDIM][F67_YDIM64], val64bits; + double dsetdbl[F67_XDIM][F67_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 8 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + } + valu8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + } + valu16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + } + valu32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + } + valu64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 8 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val8bits = (int8_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + } + val8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val16bits = (int16_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + } + val16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val32bits = (int32_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + } + val32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val64bits = (int64_t) ~0L; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + } + val64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); + H5Sclose(space); + H5Dclose(dataset); + + /* Double Dummy set for failure tests */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < dims[0]; i++) + for(j = 0; j < dims[1]; j++) + dsetdbl[i][j] = 0.0001 * j + i; + + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); + + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); +} + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -6847,6 +7059,7 @@ int main(void) gent_fpformat(); gent_extlinks(); gent_fs_strategy_threshold(); + gent_packedbits(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 50ff098..1d7a361 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -270,6 +270,8 @@ IMPORTTEST() ############################################################################## ############################################################################## +# test for signed/unsigned datasets +TOOLTEST packedbits.ddl packedbits.h5 # test for displaying groups TOOLTEST tgroup-1.ddl tgroup.h5 # test for displaying the selected groups @@ -574,6 +576,9 @@ TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5 TOOLTEST textlinksrc.ddl textlinksrc.h5 TOOLTEST textlinkfar.ddl textlinkfar.h5 +# test for dangling external links +TOOLTEST textlink.ddl textlink.h5 + # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index 00f6f1f..039af8e 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5import executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5import ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5import.c) -H5_NAMING (h5import) -TARGET_WIN_PROPERTIES (h5import) +H5_NAMING (h5import ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5import) @@ -28,8 +27,7 @@ IF (BUILD_TESTING) # Add the h5import executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c) - H5_NAMING (h5importtest) - TARGET_WIN_PROPERTIES (h5importtest) + H5_NAMING (h5importtest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ############################################################################## @@ -44,6 +42,22 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5IMPORT-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + binfp64.bin + binin8.bin + binin8w.bin + binin16.bin + binin32.bin + binuin16.bin + binuin32.bin + txtin16.txt + txtin32.txt + ) + ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>) ENDIF (BUILD_TESTING) diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 7c81903..b5a67b8 100755 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -146,6 +146,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -207,6 +208,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -263,6 +265,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index 69b3e75..215dbc8 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -11,23 +11,19 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5jam executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c) -H5_NAMING (h5jam) -TARGET_WIN_PROPERTIES (h5jam) +H5_NAMING (h5jam ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_EXECUTABLE (getub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/getub.c) -H5_NAMING (getub) -TARGET_WIN_PROPERTIES (getub) +H5_NAMING (getub ${LIB_TYPE}) TARGET_LINK_LIBRARIES (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_EXECUTABLE (tellub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/tellub.c) -H5_NAMING (tellub) -TARGET_WIN_PROPERTIES (tellub) +H5_NAMING (tellub ${LIB_TYPE}) TARGET_LINK_LIBRARIES (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_EXECUTABLE (h5unjam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5unjam.c) -H5_NAMING (h5unjam) -TARGET_WIN_PROPERTIES (h5unjam) +H5_NAMING (h5unjam ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES @@ -49,8 +45,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c) - H5_NAMING (h5jamgentest) - TARGET_WIN_PROPERTIES (h5jamgentest) + H5_NAMING (h5jamgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>) diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index aac8ece..4026510 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -160,6 +160,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -221,6 +222,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -277,6 +279,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index f6c1b4ce..7db6c7f 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5ls executable #----------------------------------------------------------------------------- ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c) -H5_NAMING (h5ls) -TARGET_WIN_PROPERTIES (h5ls) +H5_NAMING (h5ls ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES @@ -63,6 +62,7 @@ IF (BUILD_TESTING) tsoftlinks-5.ls textlinksrc-nodangle-1.ls textlinksrc-nodangle-2.ls + tgrp_comments.ls tsoftlinks-nodangle-1.ls thlinks-nodangle-1.ls tgroup.ls @@ -72,6 +72,9 @@ IF (BUILD_TESTING) thlink-1.ls tloop-1.ls tnestcomp-1.ls + tnestcomp-2.ls + tnestcomp-3.ls + tnestcomp-4.ls tsaf.ls tslink-1.ls tstr-1.ls @@ -92,6 +95,7 @@ IF (BUILD_TESTING) textlinksrc.h5 textlinktar.h5 tgroup.h5 + tgrp_comments.h5 thlink.h5 tloop.h5 tnestedcomp.h5 @@ -151,6 +155,126 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5LS-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + help-1.out + help-1.out.err + help-2.out + help-2.out.err + help-3.out + help-3.out.err + nosuchfile.out + nosuchfile.out.err + tall-1.out + tall-1.out.err + tall-2.out + tall-2.out.err + tarray1.out + tarray1.out.err + tattr2.out + tattr2.out.err + tcomp-1.out + tcomp-1.out.err + tdataregbe.out + tdataregbe.out.err + tdataregle.out + tdataregle.out.err + tdset-1.out + tdset-1.out.err + tempty.out + tempty.out.err + textlink-1.out + textlink-1.out.err + textlinksrc-1.out + textlinksrc-1.out.err + textlinksrc-2.out + textlinksrc-2.out.err + textlinksrc-3.out + textlinksrc-3.out.err + textlinksrc-4.out + textlinksrc-4.out.err + textlinksrc-5.out + textlinksrc-5.out.err + textlinksrc-6.out + textlinksrc-6.out.err + textlinksrc-7.out + textlinksrc-7.out.err + textlinksrc-1-old.out + textlinksrc-1-old.out.err + textlinksrc-2-old.out + textlinksrc-2-old.out.err + textlinksrc-3-old.out + textlinksrc-3-old.out.err + textlinksrc-6-old.out + textlinksrc-6-old.out.err + textlinksrc-7-old.out + textlinksrc-7-old.out.err + tgrp_comments.out + tgrp_comments.out.err + tsoftlinks-1.out + tsoftlinks-1.out.err + tsoftlinks-2.out + tsoftlinks-2.out.err + tsoftlinks-3.out + tsoftlinks-3.out.err + tsoftlinks-4.out + tsoftlinks-4.out.err + tsoftlinks-5.out + tsoftlinks-5.out.err + textlinksrc-nodangle-1.out + textlinksrc-nodangle-1.out.err + textlinksrc-nodangle-2.out + textlinksrc-nodangle-2.out.err + tsoftlinks-nodangle-1.out + tsoftlinks-nodangle-1.out.err + thlinks-nodangle-1.out + thlinks-nodangle-1.out.err + tgroup.out + tgroup.out.err + tgroup-1.out + tgroup-1.out.err + tgroup-2.out + tgroup-2.out.err + tgroup-3.out + tgroup-3.out.err + thlink-1.out + thlink-1.out.err + tloop-1.out + tloop-1.out.err + tnestcomp-1.out + tnestcomp-1.out.err + tnestcomp-2.out + tnestcomp-2.out.err + tnestcomp-3.out + tnestcomp-3.out.err + tnestcomp-4.out + tnestcomp-4.out.err + tsaf.out + tsaf.out.err + tslink-1.out + tslink-1.out.err + tstr-1.out + tstr-1.out.err + tudlink-1.out + tudlink-1.out.err + tvldtypes1.out + tvldtypes1.out.err + tvldtypes2le.out + tvldtypes2le.out.err + tvldtypes2be.out + tvldtypes2be.out.err + ) + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5LS-help COMMAND h5ls -w80 -h) + ADD_TEST (NAME H5LS-tall COMMAND h5ls -w80 tall.h5) + ADD_TEST (NAME H5LS-tsoftlinks COMMAND h5ls --follow-symlinks tsoftlinks.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + # test the help syntax ADD_H5_TEST (help-1 0 -w80 -h) ADD_H5_TEST (help-2 0 -w80 --help) @@ -168,6 +292,9 @@ IF (BUILD_TESTING) ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) + # test for files with groups that have long comments + ADD_H5_TEST (tgrp_comments 0 -w80 -v -g tgrp_comments.h5/glongcomment) + # test for displaying simple space datasets ADD_H5_TEST (tdset-1 0 -w80 -r -d tdset.h5) @@ -220,6 +347,12 @@ IF (BUILD_TESTING) #test for the nested compound type ADD_H5_TEST (tnestcomp-1 0 -w80 -r -d tnestedcomp.h5) + ADD_H5_TEST (tnestcomp-2 0 -w80 -r -d -S tnestedcomp.h5) + + ADD_H5_TEST (tnestcomp-3 0 -w80 -r -d -l tnestedcomp.h5) + + ADD_H5_TEST (tnestcomp-4 0 -w80 -r -d -l -S tnestedcomp.h5) + # test for loop detection ADD_H5_TEST (tloop-1 0 -w80 -r -d tloop.h5) diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 6c3a01a..3829704 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -140,6 +140,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -201,6 +202,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -257,6 +259,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index b1d9ee9..420ff3f 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1263,8 +1263,16 @@ dump_dataset_values(hid_t dset) info.arr_suf = ""; info.arr_sep = " "; - info.cmpd_pre = ""; - info.cmpd_suf = ""; + if (label_g) + { + info.cmpd_pre = "{"; + info.cmpd_suf = "}"; + } + else + { + info.cmpd_pre = ""; + info.cmpd_suf = ""; + } info.cmpd_sep = " "; if (label_g) info.cmpd_name = "%s="; @@ -1777,7 +1785,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Show detailed information about the object, beginning with information * which is common to all objects. */ if(verbose_g > 0) { - char comment[50]; + size_t buf_size = 0; + char* comment = NULL; + ssize_t cmt_bufsize = -1; /* Display attributes */ if(obj_type >= 0) @@ -1803,14 +1813,23 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* Object comment */ - comment[0] = '\0'; - H5Oget_comment(obj, comment, sizeof(comment)); - HDstrcpy(comment + sizeof(comment) - 4, "..."); - if(comment[0]) { - printf(" %-10s \"", "Comment:"); - display_string(stdout, comment, FALSE); - puts("\""); - } /* end if */ + cmt_bufsize = H5Oget_comment(obj, comment, buf_size); + + /* if the actual length of the comment is longer than cmt_bufsize, then call + * H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + printf(" %-10s \"", "Comment:"); + display_string(stdout, comment, FALSE); + puts("\""); + } /* end if */ + HDfree(comment); + } + } } /* end if */ /* Detailed list for object */ diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 642241f..3083028 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -135,6 +135,9 @@ TOOLTEST tgroup-3.ls 0 -w80 tgroup.h5/g1 TOOLTEST tgroup-1.ls 1 -w80 -r -g tgroup.h5 TOOLTEST tgroup-2.ls 0 -w80 -g tgroup.h5/g1 +# test for files with groups that have long comments +TOOLTEST tgrp_comments.ls 0 -w80 -v -g tgrp_comments.h5/glongcomment + # test for displaying simple space datasets TOOLTEST tdset-1.ls 0 -w80 -r -d tdset.h5 @@ -188,6 +191,12 @@ TOOLTEST tcomp-1.ls 0 -w80 -r -d tcompound.h5 #test for the nested compound type TOOLTEST tnestcomp-1.ls 0 -w80 -r -d tnestedcomp.h5 +TOOLTEST tnestcomp-2.ls 0 -w80 -r -d -S tnestedcomp.h5 + +TOOLTEST tnestcomp-3.ls 0 -w80 -r -d -l tnestedcomp.h5 + +TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5 + # test for loop detection TOOLTEST tloop-1.ls 0 -w80 -r -d tloop.h5 diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index b66020f..f24c7be 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -21,8 +21,7 @@ SET (REPACK_COMMON_SRCS ) ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c) -H5_NAMING (h5repack) -TARGET_WIN_PROPERTIES (h5repack) +H5_NAMING (h5repack ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5repack) @@ -38,8 +37,7 @@ IF (BUILD_TESTING) # Add h5Repack test executables # -------------------------------------------------------------------- ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) - H5_NAMING (testh5repack_detect_szip) - TARGET_WIN_PROPERTIES (testh5repack_detect_szip) + H5_NAMING (testh5repack_detect_szip ${LIB_TYPE}) TARGET_LINK_LIBRARIES (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>) @@ -57,11 +55,46 @@ IF (BUILD_TESTING) ENDIF (HDF5_ENABLE_SZIP_SUPPORT) ADD_EXECUTABLE (h5repacktest ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c) - H5_NAMING (h5repacktest) - TARGET_WIN_PROPERTIES (h5repacktest) + H5_NAMING (h5repacktest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>) + + IF (HDF5_TEST_VFD) + + SET (VFD_LIST + sec2 + stdio + core + split + multi + family + ) + + IF (DIRECT_VFD) + SET (VFD_LIST ${VFD_LIST} direct) + ENDIF (DIRECT_VFD) + + MACRO (ADD_VFD_TEST vfdname resultcode) + ADD_TEST ( + NAME VFD-${vfdname}-h5repacktest + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=h5repacktest" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + ) + ENDMACRO (ADD_VFD_TEST) + + # Run test with different Virtual File Driver + FOREACH (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) + ENDFOREACH (vfd ${VFD_LIST}) + + ENDIF (HDF5_TEST_VFD) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory @@ -225,6 +258,72 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5REPACK-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5repack_attr.h5.out + h5repack_attr.h5.out.err + h5repack_deflate.h5.out + h5repack_deflate.h5.out.err + h5repack_early.h5.out + h5repack_early.h5.out.err + h5repack_ext.h5.out + h5repack_ext.h5.out.err + h5repack_fill.h5.out + h5repack_fill.h5.out.err + h5repack_filters.h5.out + h5repack_filters.h5.out.err + h5repack_fletcher.h5.out + h5repack_fletcher.h5.out.err + h5repack_hlink.h5.out + h5repack_hlink.h5.out.err + h5repack_layout.h5.out + h5repack_layout.h5.out.err + h5repack_layout.h5-v.out + h5repack_layout.h5-v.out.err + h5repack_layouto.h5.out + h5repack_layouto.h5.out.err + h5repack_layout2.h5-v.out + h5repack_layout2.h5-v.out.err + h5repack_named_dtypes.h5.out + h5repack_named_dtypes.h5.out.err + h5repack_nbit.h5.out + h5repack_nbit.h5.out.err + h5repack_objs.h5.out + h5repack_objs.h5.out.err + h5repack_refs.h5.out + h5repack_refs.h5.out.err + h5repack_shuffle.h5.out + h5repack_shuffle.h5.out.err + h5repack_soffset.h5.out + h5repack_soffset.h5.out.err + h5repack_szip.h5.out + h5repack_szip.h5.out.err + h5repack_attr_out.h5 + h5repack_deflate_out.h5 + h5repack_early_out.h5 + h5repack_ext_out.h5 + h5repack_fill_out.h5 + h5repack_filters_out.h5 + h5repack_fletcher_out.h5 + h5repack_hlink_out.h5 + h5repack_layout_out.h5 + h5repack_layouto_out.h5 + h5repack_layout2_out.h5 + h5repack_named_dtypes_out.h5 + h5repack_nbit_out.h5 + h5repack_objs_out.h5 + h5repack_refs_out.h5 + h5repack_shuffle_out.h5 + h5repack_soffset_out.h5 + h5repack_szip_out.h5 + h5repack_ub.h5 + h5repack_ub_out.h5 + h5repack_attr_refs_out.h5 + ) + # -------------------------------------------------------------------- # test file names # -------------------------------------------------------------------- diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index b4e6b48..77b6734 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -160,6 +160,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -221,6 +222,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -277,6 +279,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index da1fbf3..8c46638 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -407,7 +407,7 @@ int copy_attr(hid_t loc_in, hid_t ftype_id=-1; /* file type ID */ hid_t wtype_id=-1; /* read/write type ID */ size_t msize; /* size of type */ - void *buf=NULL; /* data buffer */ + void *buf = NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ htri_t is_named; /* Whether the datatype is named */ @@ -424,28 +424,23 @@ int copy_attr(hid_t loc_in, * copy all attributes *------------------------------------------------------------------------- */ - - for ( u = 0; u < (unsigned)oinfo.num_attrs; u++) - { - buf=NULL; - + for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if (H5Aget_name( attr_id, (size_t)255, name ) < 0) + if(H5Aget_name(attr_id, (size_t)255, name) < 0) goto error; /* get the file datatype */ - if ((ftype_id = H5Aget_type( attr_id )) < 0 ) + if((ftype_id = H5Aget_type(attr_id)) < 0 ) goto error; /* Check if the datatype is committed */ if((is_named = H5Tcommitted(ftype_id)) < 0) goto error; - if(is_named) - { + if(is_named && travt) { hid_t fidout; /* Create out file id */ @@ -463,29 +458,27 @@ int copy_attr(hid_t loc_in, if(H5Fclose(fidout) < 0) goto error; } /* end if */ + else { + if(options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end else */ + /* get the dataspace handle */ - if ((space_id = H5Aget_space( attr_id )) < 0 ) + if((space_id = H5Aget_space(attr_id)) < 0) goto error; /* get dimensions */ - if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 ) + if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) goto error; - nelmts=1; - for (j=0; j<rank; j++) - nelmts*=dims[j]; - - /* wtype_id will have already been set if using a named dtype */ - if(!is_named) - { - if (options->use_native==1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end if */ + nelmts = 1; + for(j = 0; j < rank; j++) + nelmts *= dims[j]; - if ((msize=H5Tget_size(wtype_id))==0) + if((msize = H5Tget_size(wtype_id)) == 0) goto error; /*------------------------------------------------------------------------- @@ -496,23 +489,20 @@ int copy_attr(hid_t loc_in, *------------------------------------------------------------------------- */ - if (H5T_REFERENCE==H5Tget_class(wtype_id)) - { + if(H5T_REFERENCE == H5Tget_class(wtype_id)) { ; } - else - { + else { /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- */ buf = (void *)HDmalloc((size_t)(nelmts * msize)); - if(buf == NULL) - { + if(buf == NULL) { error_msg("h5repack", "cannot read into memory\n" ); goto error; - } + } /* end if */ if(H5Aread(attr_id, wtype_id, buf) < 0) goto error; @@ -530,10 +520,12 @@ int copy_attr(hid_t loc_in, if(H5Aclose(attr_out) < 0) goto error; - - if(buf) - free(buf); - + /* Check if we have VL data in the attribute's datatype that must + * be reclaimed */ + if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + HDfree(buf); + buf = NULL; } /*H5T_REFERENCE*/ @@ -545,28 +537,39 @@ int copy_attr(hid_t loc_in, *------------------------------------------------------------------------- */ - if (H5Tclose(ftype_id) < 0) goto error; - if (H5Tclose(wtype_id) < 0) goto error; - if (H5Sclose(space_id) < 0) goto error; - if (H5Aclose(attr_id) < 0) goto error; - + if(H5Tclose(ftype_id) < 0) + goto error; + if(H5Tclose(wtype_id) < 0) + goto error; + if(H5Sclose(space_id) < 0) + goto error; + if(H5Aclose(attr_id) < 0) + goto error; } /* u */ - return 0; error: H5E_BEGIN_TRY { + if(buf) { + /* Check if we have VL data in the attribute's datatype that must + * be reclaimed */ + if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + + /* Free buf */ + free(buf); + } /* end if */ + H5Tclose(ftype_id); H5Tclose(wtype_id); H5Sclose(space_id); H5Aclose(attr_id); H5Aclose(attr_out); - if (buf) - free(buf); } H5E_END_TRY; + return -1; -} +} /* end copy_attr() */ /*------------------------------------------------------------------------- * Function: check_options diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 6c47cfb..f849697 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -543,22 +543,23 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=-1; /* group ID */ - hid_t grp_out=-1; /* group ID */ - hid_t dset_in=-1; /* read dataset ID */ - hid_t dset_out=-1; /* write dataset ID */ - hid_t gcpl_in=-1; /* group creation property list */ - hid_t gcpl_out=-1; /* group creation property list */ - hid_t type_in=-1; /* named type ID */ - hid_t type_out=-1; /* named type ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t dcpl_out=-1; /* dataset creation property list ID */ - hid_t f_space_id=-1; /* file space ID */ - hid_t ftype_id=-1; /* file type ID */ - hid_t wtype_id=-1; /* read/write type ID */ - named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes copied */ + hid_t grp_in = -1; /* group ID */ + hid_t grp_out = -1; /* group ID */ + hid_t dset_in = -1; /* read dataset ID */ + hid_t dset_out = -1; /* write dataset ID */ + hid_t gcpl_in = -1; /* group creation property list */ + hid_t gcpl_out = -1; /* group creation property list */ + hid_t type_in = -1; /* named type ID */ + hid_t type_out = -1; /* named type ID */ + hid_t dcpl_id = -1; /* dataset creation property list ID */ + hid_t dcpl_out = -1; /* dataset creation property list ID */ + hid_t f_space_id = -1; /* file space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ + H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ hsize_t dsize_in; /* input dataset size before filter */ @@ -746,11 +747,13 @@ int do_copy_objects(hid_t fidin, HDmemset(dims, 0, sizeof dims); if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) goto error; + + if(H5Dget_space_status(dset_in, &space_status) < 0) + goto error; + nelmts = 1; - for ( j = 0; j < rank; j++) - { + for(j = 0; j < rank; j++) nelmts *= dims[j]; - } /* wtype_id will have already been set if using a named dtype */ if(!is_named) { @@ -834,20 +837,26 @@ int do_copy_objects(hid_t fidin, * read/write *------------------------------------------------------------------------- */ - if (nelmts) + if(nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) { - size_t need = (size_t)(nelmts*msize); /* bytes needed */ - if ( need < H5TOOLS_MALLOCSIZE ) + size_t need = (size_t)(nelmts * msize); /* bytes needed */ + + /* have to read the whole dataset if there is only one element in the dataset */ + if(need < H5TOOLS_MALLOCSIZE) buf = HDmalloc(need); - if (buf != NULL ) - { - if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) + if(buf != NULL) { + if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; - if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) + if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; - } + /* Check if we have VL data in the dataset's + * datatype that must be reclaimed */ + if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) + if(H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) + goto error; + } else /* possibly not enough memory, read/write by hyperslabs */ { size_t p_type_nbytes = msize; /*size of memory type */ @@ -949,7 +958,7 @@ int do_copy_objects(hid_t fidin, sm_buf=NULL; } } /* hyperslab read */ - }/*nelmts*/ + } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ /*------------------------------------------------------------------------- * amount of compression used @@ -1364,7 +1373,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) } /* end while */ /* Update size of userblock left to transfer */ - size -= nread; + size = size - (hsize_t)nread; } /* end while */ done: diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index d4a3479..c7d8b1e 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -14,7 +14,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" -#include "h5test.h" #include "h5tools.h" /* number of members in an array */ diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 34c5dd6..b0ab1d1 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -14,7 +14,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" -#include "h5test.h" #include "h5tools_utils.h" static int verify_layout(hid_t pid, pack_info_t *obj); diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index 69793ae..554b219 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5stat executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c) -H5_NAMING (h5stat) -TARGET_WIN_PROPERTIES (h5stat) +H5_NAMING (h5stat ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5stat) @@ -29,8 +28,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - H5_NAMING (h5stat_gentest) - TARGET_WIN_PROPERTIES (h5stat_gentest) + H5_NAMING (h5stat_gentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>) @@ -109,6 +107,47 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5STAT-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5stat_help1.out + h5stat_help1.out.err + h5stat_help2.out + h5stat_help2.out.err + h5stat_filters.out + h5stat_filters.out.err + h5stat_filters-file.out + h5stat_filters-file.out.err + h5stat_filters-F.out + h5stat_filters-F.out.err + h5stat_filters-d.out + h5stat_filters-d.out.err + h5stat_filters-g.out + h5stat_filters-g.out.err + h5stat_filters-dT.out + h5stat_filters-dT.out.err + h5stat_filters-UD.out + h5stat_filters-UD.out.err + h5stat_filters-UT.out + h5stat_filters-UT.out.err + h5stat_tsohm.out + h5stat_tsohm.out.err + h5stat_newgrat.out + h5stat_newgrat.out.err + h5stat_newgrat-UG.out + h5stat_newgrat-UG.out.err + h5stat_newgrat-UA.out + h5stat_newgrat-UA.out.err + ) + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5STAT-help COMMAND h5stat -h) + ADD_TEST (NAME H5STAT-filters COMMAND h5stat h5stat_filters.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + # Test for help flag ADD_H5_TEST (h5stat_help1 0 -h) ADD_H5_TEST (h5stat_help2 0 --help) diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 2fe9bc7..11615e6 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -169,6 +169,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -230,6 +231,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -286,6 +288,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl index c7ed5f4..6ee8aa8 100644 --- a/tools/h5stat/testfiles/h5stat_tsohm.ddl +++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl @@ -31,7 +31,7 @@ File space information for file metadata (in bytes): Shared Messages: Header: 38 B-tree/List: 550 - Heap: 1316 + Heap: 1279 Free-space managers: Header: 0 Amount of free space: 0 @@ -71,7 +71,7 @@ Dataset datatype information: # of unique datatypes used by datasets: 1 Dataset datatype #0: Count (total/named) = (3/0) - Size (desc./elmt) = (14/4) + Size (desc./elmt) = (14/8) Total dataset datatype count: 3 Small # of attributes: Total # of objects with small # of attributes: 0 @@ -85,8 +85,8 @@ Free-space section bins: Total # of sections: 0 File space management strategy: H5F_FILE_SPACE_ALL Summary of file space information: - File metadata: 3887 bytes + File metadata: 3850 bytes Raw data: 0 bytes Amount/Percent of tracked free space: 0 bytes/0.0% Unaccounted space: 0 bytes -Total space: 3887 bytes +Total space: 3850 bytes diff --git a/tools/h5stat/testfiles/h5stat_tsohm.h5 b/tools/h5stat/testfiles/h5stat_tsohm.h5 Binary files differindex 193c34f..e6c89f6 100644 --- a/tools/h5stat/testfiles/h5stat_tsohm.h5 +++ b/tools/h5stat/testfiles/h5stat_tsohm.h5 diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index 0ecb4ce..0d30b26 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -127,7 +127,7 @@ TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5 TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5 # # h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c -# as of release 1.8.0-alpha4 +# as of release 1.8.7-snap0 (on a 64-bit machine) TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5 # h5stat_newgrat.h5 is generated by h5stat_gentest.c TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5 diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 879e30e..c3662f6 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -31,7 +31,6 @@ SET (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h ) -#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS}) TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 5e8ac33..81f362f 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -139,6 +139,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -200,6 +201,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -256,6 +258,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index c89b9d3..7e4e016 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -172,6 +172,18 @@ int print_objname(diff_opt_t *options, hsize_t nfound); void do_print_objname (const char *OBJ, const char *path1, const char *path2); +/*------------------------------------------------------------------------- + * XCAO, 11/10/2010 + * added to improve performance for compound datasets + */ +typedef struct mcomp_t +{ + int n; /* number of members */ + hid_t *ids; /* member type id */ + unsigned char *flags; + size_t *offsets; + struct mcomp_t **m; /* members */ +}mcomp_t; hsize_t diff_datum(void *_mem1, void *_mem2, @@ -186,7 +198,8 @@ hsize_t diff_datum(void *_mem1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph); /*print header */ + int *ph, /*print header */ + mcomp_t *members); /*compound members */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index dc3c9fb..105462f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -182,6 +182,13 @@ typedef enum dtype_t static int my_isnan(dtype_t type, void *val); +/*------------------------------------------------------------------------- + * XCAO, 11/10/2010 + * added to improve performance for compound datasets + */ +static void set_comp_members(hid_t tid, mcomp_t *members); +static void free_comp_members(mcomp_t *members); + /*------------------------------------------------------------------------- @@ -220,10 +227,23 @@ hsize_t diff_array( void *_mem1, int ph=1; /* print header */ hsize_t i; int j; - + mcomp_t members; + H5T_class_t type_class; /* get the size. */ size = H5Tget_size( m_type ); + type_class = H5Tget_class(m_type); + + /* Fast comparison first for atomic type by memcmp(). + * It is OK not to list non-atomic type here because it will not be caught + * by the confition, but it gives more clarity for code planning + */ + if (type_class != H5T_REFERENCE && + type_class != H5T_COMPOUND && + type_class != H5T_STRING && + type_class != H5T_VLEN && + HDmemcmp(mem1, mem2, size*nelmts)==0) + return 0; if ( rank > 0 ) { @@ -237,13 +257,74 @@ hsize_t diff_array( void *_mem1, pos[j]=0; } - if(H5Tis_variable_str(m_type)) + switch (type_class) { + default: + assert(0); + break; + + /*------------------------------------------------------------------------- + * float and integer atomic types + *------------------------------------------------------------------------- + */ + + case H5T_FLOAT: + + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) + nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); +#endif + break; + + case H5T_INTEGER: + + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + nfound=diff_uchar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) + nfound=diff_short(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) + nfound=diff_ushort(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_INT)) + nfound=diff_int(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + nfound=diff_uint(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + nfound=diff_long(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + nfound=diff_ulong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + + break; + + /*------------------------------------------------------------------------- + * Other types than float and integer + *------------------------------------------------------------------------- + */ + + case H5T_COMPOUND: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + case H5T_VLEN: + case H5T_REFERENCE: + HDmemset(&members, 0, sizeof (mcomp_t)); + set_comp_members(m_type, &members); for ( i = 0; i < nelmts; i++) { nfound+=diff_datum( - ((unsigned char**)mem1)[(size_t)i], - ((unsigned char**)mem2)[(size_t)i], + mem1 + i * size, + mem2 + i * size, /* offset */ m_type, i, rank, @@ -255,98 +336,15 @@ hsize_t diff_array( void *_mem1, name2, container1_id, container2_id, - &ph); + &ph, &members); if (options->n && nfound>=options->count) + { + free_comp_members(&members); return nfound; + } } /* i */ - } - - else - { - switch (H5Tget_class(m_type)) - { - default: - assert(0); - break; - - /*------------------------------------------------------------------------- - * float and integer atomic types - *------------------------------------------------------------------------- - */ - - case H5T_FLOAT: - - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) - nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) - nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) - nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); -#endif - break; - - case H5T_INTEGER: - - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) - nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) - nfound=diff_uchar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) - nfound=diff_short(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) - nfound=diff_ushort(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_INT)) - nfound=diff_int(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) - nfound=diff_uint(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) - nfound=diff_long(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) - nfound=diff_ulong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) - nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) - nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - - break; - - /*------------------------------------------------------------------------- - * Other types than float and integer - *------------------------------------------------------------------------- - */ - - case H5T_COMPOUND: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - case H5T_VLEN: - case H5T_REFERENCE: - - for ( i = 0; i < nelmts; i++) - { - nfound+=diff_datum( - mem1 + i * size, - mem2 + i * size, /* offset */ - m_type, - i, - rank, - dims, - acc, - pos, - options, - name1, - name2, - container1_id, - container2_id, - &ph); - if (options->n && nfound>=options->count) - return nfound; - } /* i */ - } /* switch */ - } /* else */ + free_comp_members(&members); + } /* switch */ return nfound; } @@ -388,7 +386,6 @@ hsize_t diff_array( void *_mem1, * Dereference the object and compare the type (basic object type). *------------------------------------------------------------------------- */ - hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, @@ -402,13 +399,16 @@ hsize_t diff_datum(void *_mem1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph) /*print header */ + int *ph, /*print header */ + mcomp_t *members) /*compound members */ { unsigned char *mem1 = (unsigned char*)_mem1; unsigned char *mem2 = (unsigned char*)_mem2; unsigned u; hid_t memb_type; size_t type_size; + H5T_sign_t type_sign; + H5T_class_t type_class; size_t offset; int nmembs; int j; @@ -425,6 +425,18 @@ hsize_t diff_datum(void *_mem1, int both_zero; type_size = H5Tget_size( m_type ); + type_class = H5Tget_class(m_type); + + /* Fast comparison first for atomic type by memcmp(). + * It is OK not to list non-atomic type here because it will not be caught + * by the confition, but it gives more clarity for code planning + */ + if (type_class != H5T_REFERENCE && + type_class != H5T_COMPOUND && + type_class != H5T_STRING && + type_class != H5T_VLEN && + HDmemcmp(mem1, mem2, type_size)==0) + return 0; switch (H5Tget_class(m_type)) { @@ -441,12 +453,14 @@ hsize_t diff_datum(void *_mem1, */ case H5T_COMPOUND: - nmembs = H5Tget_nmembers(m_type); + nmembs = members->n; + for (j = 0; j < nmembs; j++) { - offset = H5Tget_member_offset(m_type, (unsigned)j); - memb_type = H5Tget_member_type(m_type, (unsigned)j); + offset = members->offsets[j]; + memb_type = members->ids[j]; + nfound+=diff_datum( mem1+offset, mem2+offset, @@ -461,8 +475,7 @@ hsize_t diff_datum(void *_mem1, obj2, container1_id, container2_id, - ph); - H5Tclose(memb_type); + ph, members->m[j]); } break; @@ -475,24 +488,61 @@ hsize_t diff_datum(void *_mem1, { H5T_str_t pad; char *s; + char *s1; + char *s2; + size_t size1; + size_t size2; + + /* if variable length string */ + if(H5Tis_variable_str(m_type)) + { + /* Get pointer to first string */ + s1 = *(char**) mem1; + size1 = HDstrlen(s1); + /* Get pointer to second string */ + s2 = *(char**) mem2; + size2 = HDstrlen(s2); + } + else + { + /* Get pointer to first string */ + s1 = mem1; + size1 = H5Tget_size(m_type); + /* Get pointer to second string */ + s2 = mem2; + size2 = H5Tget_size(m_type); + } - /* Get pointer to first string to compare */ - s = (char *)mem1; + /* + * compare for shorter string + * TODO: this code need to be improved to handle the difference + * of length of strings. + * For now mimic the previous way. + */ + if(size1 < size2) + { + size = size1; + s = s1; + } + else + { + size = size2; + s = s2; + } /* check for NULL pointer for string */ if(s!=NULL) { - if(H5Tis_variable_str(m_type)) - size = HDstrlen(s); - else - size = H5Tget_size(m_type); + /* try fast compare first */ + if (HDmemcmp(s1, s2, size)==0) + break; pad = H5Tget_strpad(m_type); for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) nfound+=character_compare( - mem1 + u, - mem2 + u, /* offset */ + s1 + u, + s2 + u, /* offset */ i, /* index position */ u, /* string character position */ rank, @@ -631,21 +681,23 @@ hsize_t diff_datum(void *_mem1, for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= adims[u]; for (u = 0; u < nelmts; u++) - nfound+=diff_datum( - mem1 + u * size, - mem2 + u * size, /* offset */ - memb_type, - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); + { + nfound+=diff_datum( + mem1 + u * size, + mem2 + u * size, /* offset */ + memb_type, + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph, NULL); + } H5Tclose(memb_type); } break; @@ -673,8 +725,7 @@ hsize_t diff_datum(void *_mem1, * Dataset region reference *------------------------------------------------------------------------- */ - - if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) + if (type_size==H5R_DSET_REG_REF_BUF_SIZE) { hid_t region1_id; hid_t region2_id; @@ -708,7 +759,7 @@ hsize_t diff_datum(void *_mem1, * Object references. get the type and OID of the referenced object *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) + else if (type_size == H5R_OBJ_REF_BUF_SIZE) { H5O_type_t obj1_type; H5O_type_t obj2_type; @@ -792,7 +843,7 @@ hsize_t diff_datum(void *_mem1, obj2, container1_id, container2_id, - ph); + ph, NULL); H5Tclose(memb_type); @@ -806,13 +857,13 @@ hsize_t diff_datum(void *_mem1, */ case H5T_INTEGER: - + type_sign = H5Tget_sign(m_type); /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + if (type_size==1 && type_sign!=H5T_SGN_NONE) { char temp1_char; char temp2_char; @@ -908,7 +959,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + else if (type_size==1 && type_sign==H5T_SGN_NONE) { unsigned char temp1_uchar; unsigned char temp2_uchar; @@ -1007,7 +1058,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) + else if (type_size==2 && type_sign!=H5T_SGN_NONE) { short temp1_short; short temp2_short; @@ -1106,7 +1157,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) + else if (type_size==2 && type_sign==H5T_SGN_NONE) { unsigned short temp1_ushort; unsigned short temp2_ushort; @@ -1206,7 +1257,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_INT)) + else if (type_size==4 && type_sign!=H5T_SGN_NONE) { int temp1_int; int temp2_int; @@ -1304,7 +1355,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + else if (type_size==4 && type_sign==H5T_SGN_NONE) { unsigned int temp1_uint; unsigned int temp2_uint; @@ -1402,7 +1453,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + else if (type_size==8 && type_sign!=H5T_SGN_NONE) { long temp1_long; long temp2_long; @@ -1502,7 +1553,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + else if (type_size==8 && type_sign==H5T_SGN_NONE) { unsigned long temp1_ulong; unsigned long temp2_ulong; @@ -1601,7 +1652,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + else if (type_size==8 && type_sign!=H5T_SGN_NONE) { long long temp1_llong; long long temp2_llong; @@ -1699,7 +1750,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + else if (type_size==8 && type_sign==H5T_SGN_NONE) { unsigned long long temp1_ullong; unsigned long long temp2_ullong; @@ -1816,7 +1867,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + if (type_size==4) { float temp1_float; float temp2_float; @@ -2029,7 +2080,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + else if (type_size==8) { double temp1_double; double temp2_double; @@ -2245,7 +2296,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) + else if (type_size==8) { long double temp1_double; long double temp2_double; @@ -6000,3 +6051,70 @@ static void h5diff_print_char(char ch) break; } } + + +/*------------------------------------------------------------------------- + * XCAO, 11/10/2010 + * added to improve performance for compound datasets + * set up compound datatype structures. + */ +static void set_comp_members(hid_t tid, mcomp_t *members) +{ + int i; + + if (tid <=0 || !members) + return; + + if (H5Tget_class(tid) != H5T_COMPOUND) + return; + + members->n = H5Tget_nmembers( tid ); + if (members->n <=0) + return; + + members->ids = HDcalloc(members->n, sizeof(hid_t)); + members->flags = HDcalloc(members->n, sizeof(unsigned char)); + members->offsets = HDcalloc(members->n, sizeof(size_t)); + members->m = HDcalloc(members->n, sizeof(mcomp_t *)); + + for (i=0; i< members->n; i++) + { + members->ids[i] = H5Tget_member_type( tid, i ); + members->flags[i] = H5Tis_variable_str( members->ids[i] ); + members->offsets[i] = H5Tget_member_offset( tid, i ); + if (H5Tget_class( members->ids[i])==H5T_COMPOUND) + { + members->m[i] = (mcomp_t *)HDmalloc(sizeof(mcomp_t)); + set_comp_members(members->ids[i], members->m[i]); + } + } +} + +/*------------------------------------------------------------------------- + * XCAO, 11/10/2010 + * added to improve performance for compound datasets + * clean and close compound members. + */ +static void free_comp_members(mcomp_t *members) +{ + int i; + + if (!members || members->n<=0 || !members->ids) + return; + + for (i=0; i<members->n; i++) + { + if (members->m[i]) + { + free_comp_members(members->m[i]); + HDfree(members->m[i]); + } + H5Tclose(members->ids[i]); + } + + HDfree (members->m); + HDfree (members->ids); + HDfree (members->flags); + HDfree (members->offsets); +} + diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 2cf6539..ad6f45b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -79,8 +79,7 @@ hsize_t diff_attr(hid_t loc1_id, if(oinfo1.num_attrs != oinfo2.num_attrs) return 1; - for( u = 0; u < (unsigned)oinfo1.num_attrs; u++) - { + for(u = 0; u < (unsigned)oinfo1.num_attrs; u++) { /* reset buffers for every attribute, we might goto out and call free */ buf1 = NULL; buf2 = NULL; @@ -104,29 +103,29 @@ hsize_t diff_attr(hid_t loc1_id, goto error; /* get the datatypes */ - if ((ftype1_id = H5Aget_type(attr1_id)) < 0) + if((ftype1_id = H5Aget_type(attr1_id)) < 0) goto error; - if ((ftype2_id = H5Aget_type(attr2_id)) < 0) + if((ftype2_id = H5Aget_type(attr2_id)) < 0) goto error; - if ((mtype1_id = h5tools_get_native_type(ftype1_id))<0) + if((mtype1_id = h5tools_get_native_type(ftype1_id))<0) goto error; - if ((mtype2_id = h5tools_get_native_type(ftype2_id))<0) + if((mtype2_id = h5tools_get_native_type(ftype2_id))<0) goto error; - if ((msize1 = H5Tget_size(mtype1_id))==0) + if((msize1 = H5Tget_size(mtype1_id))==0) goto error; - if ((msize2 = H5Tget_size(mtype2_id))==0) + if((msize2 = H5Tget_size(mtype2_id))==0) goto error; /* get the dataspace */ - if ((space1_id = H5Aget_space(attr1_id)) < 0) + if((space1_id = H5Aget_space(attr1_id)) < 0) goto error; - if ((space2_id = H5Aget_space(attr2_id)) < 0) + if((space2_id = H5Aget_space(attr2_id)) < 0) goto error; /* get dimensions */ - if ( (rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0 ) + if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) goto error; - if ( (rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0 ) + if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) goto error; @@ -135,43 +134,28 @@ hsize_t diff_attr(hid_t loc1_id, *---------------------------------------------------------------------- */ - if ( msize1 != msize2 - || - diff_can_type(ftype1_id, - ftype2_id, - rank1, - rank2, - dims1, - dims2, - NULL, - NULL, - name1, - name2, - options, - 0)!=1) + if(msize1 != msize2 || + diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, + dims2, NULL, NULL, name1, name2, options, 0) != 1) { - - - if (H5Tclose(ftype1_id)<0) + if(H5Tclose(ftype1_id) < 0) goto error; - if (H5Tclose(ftype2_id)<0) + if(H5Tclose(ftype2_id) < 0) goto error; - if (H5Sclose(space1_id)<0) + if(H5Sclose(space1_id) < 0) goto error; - if (H5Sclose(space2_id)<0) + if(H5Sclose(space2_id) < 0) goto error; - if (H5Aclose(attr1_id)<0) + if(H5Aclose(attr1_id) < 0) goto error; - if (H5Aclose(attr2_id)<0) + if(H5Aclose(attr2_id) < 0) goto error; - if (H5Tclose(mtype1_id)<0) + if(H5Tclose(mtype1_id) < 0) goto error; - if (H5Tclose(mtype2_id)<0) + if(H5Tclose(mtype2_id) < 0) goto error; continue; - - } @@ -179,19 +163,19 @@ hsize_t diff_attr(hid_t loc1_id, * read *---------------------------------------------------------------------- */ - nelmts1=1; - for (j=0; j<rank1; j++) - nelmts1*=dims1[j]; + nelmts1 = 1; + for(j = 0; j < rank1; j++) + nelmts1 *= dims1[j]; - buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1)); - buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2)); - if ( buf1==NULL || buf2==NULL){ + buf1 = (void *)HDmalloc((unsigned)(nelmts1 * msize1)); + buf2 = (void *)HDmalloc((unsigned)(nelmts1 * msize2)); + if(buf1 == NULL || buf2 == NULL) { parallel_print( "cannot read into memory\n" ); goto error; } - if (H5Aread(attr1_id,mtype1_id,buf1)<0) + if(H5Aread(attr1_id,mtype1_id,buf1) < 0) goto error; - if (H5Aread(attr2_id,mtype2_id,buf2)<0) + if(H5Aread(attr2_id,mtype2_id,buf2) < 0) goto error; /* format output string */ @@ -205,63 +189,29 @@ hsize_t diff_attr(hid_t loc1_id, /* always print name */ /* verbose (-v) and report (-r) mode */ - if(options->m_verbose || options->m_report) - { - do_print_objname ("attribute", np1, np2); - nfound = diff_array(buf1, - buf2, - nelmts1, - (hsize_t)0, - rank1, - dims1, - options, - np1, - np2, - mtype1_id, - attr1_id, - attr2_id); - print_found(nfound); + if(options->m_verbose || options->m_report) { + do_print_objname("attribute", np1, np2); + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1, + options, np1, np2, mtype1_id, attr1_id, attr2_id); + print_found(nfound); } /* quiet mode (-q), just count differences */ - else if(options->m_quiet) - { - nfound = diff_array(buf1, - buf2, - nelmts1, - (hsize_t)0, - rank1, - dims1, - options, - np1, - np2, - mtype1_id, - attr1_id, - attr2_id); + else if(options->m_quiet) { + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1, + options, np1, np2, mtype1_id, attr1_id, attr2_id); } /* the rest (-c, none, ...) */ - else - { - nfound = diff_array(buf1, - buf2, - nelmts1, - (hsize_t)0, - rank1, - dims1, - options, - np1, - np2, - mtype1_id, - attr1_id, - attr2_id); + else { + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1, + options, np1, np2, mtype1_id, attr1_id, attr2_id); /* not comparable, no display the different number */ - if (!options->not_cmp && nfound) - { - do_print_objname ("attribute", np1, np2); + if(!options->not_cmp && nfound) { + do_print_objname("attribute", np1, np2); print_found(nfound); - } - } + } /* end if */ + } /* end else */ /*---------------------------------------------------------------------- @@ -269,51 +219,61 @@ hsize_t diff_attr(hid_t loc1_id, *---------------------------------------------------------------------- */ - if (H5Tclose(ftype1_id)<0) + /* Free buf1 and buf2, being careful to reclaim any VL data first */ + if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN)) + H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); + HDfree(buf1); + buf1 = NULL; + if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN)) + H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); + HDfree(buf2); + buf2 = NULL; + + if(H5Tclose(ftype1_id) < 0) goto error; - if (H5Tclose(ftype2_id)<0) + if(H5Tclose(ftype2_id) < 0) goto error; - if (H5Sclose(space1_id)<0) + if(H5Sclose(space1_id) < 0) goto error; - if (H5Sclose(space2_id)<0) + if(H5Sclose(space2_id) < 0) goto error; - if (H5Aclose(attr1_id)<0) + if(H5Aclose(attr1_id) < 0) goto error; - if (H5Aclose(attr2_id)<0) + if(H5Aclose(attr2_id) < 0) goto error; - if (H5Tclose(mtype1_id)<0) + if(H5Tclose(mtype1_id) < 0) goto error; - if (H5Tclose(mtype2_id)<0) + if(H5Tclose(mtype2_id) < 0) goto error; - if (buf1) - HDfree(buf1); - if (buf2) - HDfree(buf2); - nfound_total += nfound; - } /* u */ + } /* u */ - return nfound_total; + return nfound_total; error: - H5E_BEGIN_TRY { - H5Tclose(ftype1_id); - H5Tclose(ftype2_id); - H5Tclose(mtype1_id); - H5Tclose(mtype2_id); - H5Sclose(space1_id); - H5Sclose(space2_id); - H5Aclose(attr1_id); - H5Aclose(attr2_id); - if (buf1) - HDfree(buf1); - if (buf2) - HDfree(buf2); - } H5E_END_TRY; - - options->err_stat=1; - return nfound_total; + H5E_BEGIN_TRY { + if(buf1) { + if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN)) + H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); + HDfree(buf1); + } /* end if */ + if(buf2) { + if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN)) + H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); + HDfree(buf2); + } /* end if */ + H5Tclose(ftype1_id); + H5Tclose(ftype2_id); + H5Tclose(mtype1_id); + H5Tclose(mtype2_id); + H5Sclose(space1_id); + H5Sclose(space2_id); + H5Aclose(attr1_id); + H5Aclose(attr2_id); + } H5E_END_TRY; + + options->err_stat = 1; + return nfound_total; } - diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 8e25b6d..0f482b6 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -329,100 +329,88 @@ hsize_t diff_datasetid( hid_t did1, * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (can_compare ) /* it is possible to compare */ + if(can_compare) /* it is possible to compare */ { + unsigned int vl_data = 0; /*contains VL datatypes */ /*------------------------------------------------------------------------- * get number of elements *------------------------------------------------------------------------- */ nelmts1 = 1; - for (i = 0; i < rank1; i++) - { + for(i = 0; i < rank1; i++) nelmts1 *= dims1[i]; - } nelmts2 = 1; - for (i = 0; i < rank2; i++) - { + for(i = 0; i < rank2; i++) nelmts2 *= dims2[i]; - } - assert(nelmts1==nelmts2); + HDassert(nelmts1 == nelmts2); /*------------------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ - if ( m_size1 != m_size2 ) - { - if ( m_size1 < m_size2 ) - { + if(m_size1 != m_size2) { + if(m_size1 < m_size2) { H5Tclose(m_tid1); - if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) + if((m_tid1 = h5tools_get_native_type(f_tid2)) < 0) goto error; - m_size1 = H5Tget_size( m_tid1 ); - } - else - { + m_size1 = H5Tget_size(m_tid1); + } /* end if */ + else { H5Tclose(m_tid2); - if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) + if((m_tid2 = h5tools_get_native_type(f_tid1)) < 0) goto error; - m_size2 = H5Tget_size( m_tid2 ); - } - } - assert(m_size1==m_size2); + m_size2 = H5Tget_size(m_tid2); + } /* end else */ + } /* end if */ + HDassert(m_size1 == m_size2); /* print names */ - if (obj1_name) { - name1=diff_basename(obj1_name); - } - if (obj2_name) { - name2=diff_basename(obj2_name); - } + if(obj1_name) + name1 = diff_basename(obj1_name); + if(obj2_name) + name2 = diff_basename(obj2_name); + /* check if we have VL data in the dataset's datatype */ + if(TRUE == H5Tdetect_class(m_tid1, H5T_VLEN)) + vl_data = TRUE; + /*------------------------------------------------------------------------- * read/compare *------------------------------------------------------------------------- */ - need = (size_t)(nelmts1*m_size1); /* bytes needed */ - if ( need < H5TOOLS_MALLOCSIZE) - { + need = (size_t)(nelmts1 * m_size1); /* bytes needed */ + if(need < H5TOOLS_MALLOCSIZE) { buf1 = HDmalloc(need); buf2 = HDmalloc(need); - } + } /* end if */ - if ( buf1!=NULL && buf2!=NULL) - { - if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) + if(buf1 != NULL && buf2 != NULL) { + if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) goto error; - if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) + if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) goto error; /* array diff */ - nfound = diff_array(buf1, - buf2, - nelmts1, - (hsize_t)0, - rank1, - dims1, - options, - name1, - name2, - m_tid1, - did1, - did2); - } - + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1, + options, name1, name2, m_tid1, did1, did2); + + /* reclaim any VL memory, if necessary */ + if(vl_data) { + H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); + H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); + } /* end if */ + } /* end if */ else /* possibly not enough memory, read/compare by hyperslabs */ - { size_t p_type_nbytes = m_size1; /*size of memory type */ hsize_t p_nelmts = nelmts1; /*total selected elmts */ @@ -442,25 +430,21 @@ hsize_t diff_datasetid( hid_t did1, hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ + /* + * determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ sm_nbytes = p_type_nbytes; - for (i = rank1; i > 0; --i) - { + for(i = rank1; i > 0; --i) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + + if(size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; sm_size[i - 1] = MIN(dims1[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); - } + } /* end for */ /* malloc return code should be verified. * If fail, need to handle the error. @@ -481,63 +465,43 @@ hsize_t diff_datasetid( hid_t did1, memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) - { + for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if (rank1 > 0) - { - for (i = 0, hs_nelmts = 1; i < rank1; i++) - { + if(rank1 > 0) { + for(i = 0, hs_nelmts = 1; i < rank1; i++) { hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); hs_nelmts *= hs_size[i]; - } - if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + } /* end for */ + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) goto error; - if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; - } + } /* end if */ else - { - H5Sselect_all(sid1); - H5Sselect_all(sid2); - H5Sselect_all(sm_space); hs_nelmts = 1; - } /* rank */ - if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) + if(H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0) goto error; - if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) + if(H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0) goto error; /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beggining for printing */ - nfound += diff_array(sm_buf1, - sm_buf2, - hs_nelmts, - elmtno, - rank1, - dims1, - options, - name1, - name2, - m_tid1, - did1, - did2); + nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1, + dims1, options, name1, name2, m_tid1, did1, did2); /* reclaim any VL memory, if necessary */ - if(vl_data) - { + if(vl_data) { H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - } + } /* end if */ /* calculate the next hyperslab offset */ - for (i = rank1, carry = 1; i > 0 && carry; --i) - { + for(i = rank1, carry = 1; i > 0 && carry; --i) { hs_offset[i - 1] += hs_size[i - 1]; - if (hs_offset[i - 1] == dims1[i - 1]) + if(hs_offset[i - 1] == dims1[i - 1]) hs_offset[i - 1] = 0; else carry = 0; @@ -545,60 +509,53 @@ hsize_t diff_datasetid( hid_t did1, } /* elmtno */ H5Sclose(sm_space); - } /* hyperslab read */ - }/*can_compare*/ - - /*------------------------------------------------------------------------- - * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- - */ - - if (obj1_name) - { - nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); - } + } /* hyperslab read */ + } /*can_compare*/ - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * compare attributes + * the if condition refers to cases when the dataset is a referenced object + *------------------------------------------------------------------------- + */ + if(obj1_name) + nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); - /* free */ - if (buf1!=NULL) - { - free(buf1); - buf1=NULL; - } - if (buf2!=NULL) - { - free(buf2); - buf2=NULL; - } - if (sm_buf1!=NULL) - { - free(sm_buf1); - sm_buf1=NULL; - } - if (sm_buf2!=NULL) - { - free(sm_buf2); - sm_buf2=NULL; - } + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + /* free */ + if(buf1 != NULL) { + free(buf1); + buf1 = NULL; + } /* end if */ + if(buf2 != NULL) { + free(buf2); + buf2 = NULL; + } /* end if */ + if(sm_buf1 != NULL) { + free(sm_buf1); + sm_buf1 = NULL; + } /* end if */ + if(sm_buf2 != NULL) { + free(sm_buf2); + sm_buf2 = NULL; + } /* end if */ - H5E_BEGIN_TRY { - H5Sclose(sid1); - H5Sclose(sid2); - H5Tclose(f_tid1); - H5Tclose(f_tid2); - H5Tclose(m_tid1); - H5Tclose(m_tid2); - } H5E_END_TRY; + H5E_BEGIN_TRY { + H5Sclose(sid1); + H5Sclose(sid2); + H5Tclose(f_tid1); + H5Tclose(f_tid2); + H5Tclose(m_tid1); + H5Tclose(m_tid2); + } H5E_END_TRY; - return nfound; + return nfound; error: - options->err_stat=1; + options->err_stat=1; /* free */ if (buf1!=NULL) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 3cfe56b..7aee7bc 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -49,7 +49,7 @@ static h5tool_format_t h5tools_dataformat = { "", /*fmt_raw */ "%d", /*fmt_int */ "%u", /*fmt_uint */ -"%d", /*fmt_schar */ +"%hhd", /*fmt_schar */ "%u", /*fmt_uchar */ "%d", /*fmt_short */ "%u", /*fmt_ushort */ @@ -1299,8 +1299,8 @@ static int h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, h5tools_str_t *buffer/*string into which to render */, size_t ncols, - int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { - HERR_INIT(int, SUCCEED) + int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t *start = NULL; @@ -1311,11 +1311,13 @@ h5tools_print_region_data_blocks(hid_t region_id, unsigned int region_flags; /* buffer extent flags */ hsize_t curr_pos; int jndx; + size_t indx; int type_size; hid_t mem_space = -1; void *region_buf = NULL; int blkndx; hid_t sid1 = -1; + int ret_value = SUCCEED; /* Get the dataspace of the dataset */ if((sid1 = H5Dget_space(region_id)) < 0) @@ -1371,8 +1373,8 @@ h5tools_print_region_data_blocks(hid_t region_id, HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /* assume entire data space to be printed */ - for (jndx = 0; jndx < (size_t) ctx.ndims; jndx++) - ctx.p_min_idx[jndx] = start[jndx]; + for (indx = 0; indx < (size_t) ctx.ndims; indx++) + ctx.p_min_idx[indx] = start[indx]; init_acc_pos(&ctx, total_size); /* print the data */ @@ -1380,8 +1382,8 @@ h5tools_print_region_data_blocks(hid_t region_id, if (blkndx == nblocks - 1) region_flags |= END_OF_DATA; - for (jndx = 0; jndx < ctx.ndims; jndx++) - ctx.p_max_idx[jndx] = dims1[jndx]; + for (indx = 0; indx < (size_t)ctx.ndims; indx++) + ctx.p_max_idx[indx] = dims1[indx]; curr_pos = 0; ctx.sm_pos = blkndx*2*ndims; @@ -1390,24 +1392,24 @@ h5tools_print_region_data_blocks(hid_t region_id, h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); elmtno = 0; - for (jndx = 0; jndx < numelem; jndx++, elmtno++, ctx.cur_elmt++) { + for (indx = 0; indx < numelem; indx++, elmtno++, ctx.cur_elmt++) { /* Render the region data element begin */ h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); + h5tools_str_append(buffer, "%s", indx ? OPTIONAL_LINE_BREAK "" : ""); h5tools_str_sprint(buffer, info, region_id, type_id, - ((char*)region_buf + jndx * type_size), &ctx); + ((char*)region_buf + indx * type_size), &ctx); - if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) + if (indx + 1 < numelem || (region_flags & END_OF_DATA) == 0) h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, jndx, elmtno); + ncols, ptdata, indx, elmtno); /* Render the region data element end */ if(FALSE == dimension_break) elmtno = 0; - } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ + } /* end for (indx = 0; indx < numelem; indx++, region_elmtno++, ctx.cur_elmt++) */ ctx.indent_level--; } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1423,7 +1425,6 @@ h5tools_print_region_data_blocks(hid_t region_id, if(H5Sclose(sid1) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); -CATCH return ret_value; } @@ -1457,7 +1458,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_t *buffer/*string into which to render */, hsize_t *curr_pos/*total data element position*/, size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter) { + hsize_t elmt_counter) +{ HERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; hssize_t nblocks; @@ -1643,17 +1645,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_t *buffer, size_t ncols, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) { - HERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t elmtno; /* elemnt index */ unsigned int region_flags; /* buffer extent flags */ hsize_t curr_pos; - int indx; + size_t indx; int jndx; int type_size; hid_t mem_space = -1; void *region_buf = NULL; + int ret_value = SUCCEED; if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); @@ -1717,7 +1719,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, 0, elmtno); + ncols, ptdata, (hsize_t)0, elmtno); /* Render the point element end */ ctx.indent_level--; @@ -1731,7 +1733,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); -CATCH + return ret_value; } @@ -1769,7 +1771,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hsize_t alloc_size; hsize_t *ptdata; int ndims; - int indx; + hssize_t indx; hid_t dtype; hid_t type_id; @@ -1796,7 +1798,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, alloc_size = npoints * ndims * sizeof(ptdata[0]); assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if((ptdata = malloc((size_t) alloc_size)) == NULL) + if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); @@ -1965,7 +1967,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c HERR_INIT(herr_t, SUCCEED) size_t i; /* counters */ size_t j; /* counters */ - hsize_t zero = 0; /* vector of zeros */ + hsize_t zero[1] = {0}; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ hsize_t elmtno; /* elemnt index */ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ @@ -2028,13 +2030,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c } assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ - if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL) + if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0) + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); /* read the data */ @@ -2129,7 +2131,6 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools hid_t dset, hid_t p_type, struct subset_t *sset, hid_t f_space, hsize_t *total_size) { - HERR_INIT(herr_t, SUCCEED) size_t i; /* counters */ hsize_t n; /* counters */ hsize_t count; /* hyperslab count */ @@ -2142,6 +2143,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */ hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */ int reset_dim; + herr_t ret_value = SUCCEED; if (ctx->ndims == 1) row_dim = 0; @@ -2230,7 +2232,6 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools } /* outer_count */ -CATCH return ret_value; } @@ -2440,7 +2441,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, } assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ - sm_buf = malloc((size_t)sm_nbytes); + sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -2516,7 +2517,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, H5Sclose(sm_space); H5Sclose(f_space); - free(sm_buf); + HDfree(sm_buf); return SUCCEED; } @@ -3333,9 +3334,9 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) dst_size = type_size; /* Get the names and raw values of all members */ - if((name = calloc(nmembs, sizeof(char *))) == NULL) + if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); - if((value = calloc(nmembs, MAX(type_size, dst_size))) == NULL) + if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); for (i = 0; i < nmembs; i++) { @@ -3914,7 +3915,6 @@ static int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { - HERR_INIT(int, SUCCEED) hsize_t *dims1 = NULL; hsize_t *start = NULL; hsize_t *count = NULL; @@ -3926,6 +3926,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, void *region_buf = NULL; int blkndx; hid_t sid1 = -1; + int ret_value = SUCCEED; /* Get the dataspace of the dataset */ if((sid1 = H5Dget_space(region_id)) < 0) @@ -3994,7 +3995,6 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, if(H5Sclose(sid1) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); -CATCH return ret_value; } @@ -4085,12 +4085,12 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) { - HERR_INIT(int, SUCCEED) hsize_t *dims1 = NULL; int jndx; int type_size; hid_t mem_space = -1; void *region_buf = NULL; + int ret_value = SUCCEED; if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); @@ -4122,7 +4122,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); -CATCH + return ret_value; } @@ -4160,7 +4160,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, alloc_size = npoints * ndims * sizeof(ptdata[0]); assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if((ptdata = malloc((size_t) alloc_size)) == NULL) + if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index c5f10b8..8c9960f 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -789,7 +789,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp); + h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), *cp_vp); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp); diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 7509365..e94d9dc 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -12,18 +12,15 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- #-- Misc Executables ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c) -H5_NAMING (h5debug) -TARGET_WIN_PROPERTIES (h5debug) +H5_NAMING (h5debug ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_EXECUTABLE (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c) -H5_NAMING (h5repart) -TARGET_WIN_PROPERTIES (h5repart) +H5_NAMING (h5repart ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_EXECUTABLE (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c) -H5_NAMING (h5mkgrp) -TARGET_WIN_PROPERTIES (h5mkgrp) +H5_NAMING (h5mkgrp ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES @@ -44,15 +41,13 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c) - H5_NAMING (h5repart_gentest) - TARGET_WIN_PROPERTIES (h5repart_gentest) + H5_NAMING (h5repart_gentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c) - H5_NAMING (h5repart_test) - TARGET_WIN_PROPERTIES (h5repart_test) + H5_NAMING (h5repart_test ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) # -------------------------------------------------------------------- @@ -89,6 +84,39 @@ IF (BUILD_TESTING) ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest} ) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + + SET (HDF5_MKGRP_TEST_FILES + #h5mkgrp_help + #h5mkgrp_version + h5mkgrp_single + h5mkgrp_single_latest + h5mkgrp_several + h5mkgrp_several_latest + h5mkgrp_nested + h5mkgrp_nested_latest + h5mkgrp_nested_mult + h5mkgrp_nested_mult_latest + ) + + FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/../testfiles") + FOREACH (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_mkgrp_file}") + #MESSAGE (STATUS " Copying ${h5_mkgrp_file}") + ADD_CUSTOM_COMMAND ( + TARGET h5mkgrp + POST_BUILD + COMMAND ${XLATE_UTILITY} + ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}.ls ${dest}.ls -l3 + ) + ENDFOREACH (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) + + ADD_CUSTOM_COMMAND ( + TARGET h5mkgrp + POST_BUILD + COMMAND ${XLATE_UTILITY} + ARGS ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/h5mkgrp_help.txt -l0 + ) + CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/h5mkgrp_version.txt @ONLY) ############################################################################## ############################################################################## @@ -96,16 +124,90 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + MACRO (ADD_H5_TEST resultfile resultcode resultoption) + ADD_TEST ( + NAME H5MKGRP-clear-${resultfile}${resultoption} + COMMAND ${CMAKE_COMMAND} + -E remove + ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 + ${PROJECT_BINARY_DIR}/${resultfile}.out + ${PROJECT_BINARY_DIR}/${resultfile}.out.err + ) + IF (NOT ${resultoption} STREQUAL " ") + ADD_TEST ( + NAME H5MKGRP-${resultfile}${resultoption} + COMMAND $<TARGET_FILE:h5mkgrp> ${resultoption} ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 ${ARGN} + ) + ELSE (NOT ${resultoption} STREQUAL " ") + ADD_TEST ( + NAME H5MKGRP-${resultfile}${resultoption} + COMMAND $<TARGET_FILE:h5mkgrp> ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 ${ARGN} + ) + ENDIF (NOT ${resultoption} STREQUAL " ") + ADD_TEST ( + NAME H5MKGRP-H5LS-${resultfile}${resultoption} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" + -D "TEST_ARGS:STRING=-v;-r;../testfiles/${resultfile}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_MASK_MOD=true" + -D "TEST_REFERENCE=${resultfile}.ls" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) + + MACRO (ADD_H5_CMP resultfile resultcode) + ADD_TEST ( + NAME H5MKGRP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + ENDMACRO (ADD_H5_CMP resultfile resultcode) + ############################################################################## ############################################################################## ### T H E T E S T S ### ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME h5repart_20K-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + fst_family00000.h5 + ) # repartition family member size to 20,000 bytes. ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME h5repart_5K-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + scd_family00000.h5 + scd_family00001.h5 + scd_family00002.h5 + scd_family00003.h5 + ) # repartition family member size to 5 KB. ADD_TEST (NAME h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME h5repart_sec2-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + family_to_sec2.h5 + ) # convert family file to sec2 file of 20,000 bytes ADD_TEST (NAME h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) @@ -115,6 +217,34 @@ IF (BUILD_TESTING) SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repart_test ) + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5MKGRP-help COMMAND h5mkgrp -h) + ADD_TEST (NAME H5MKGRP-version COMMAND h5mkgrp -V) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + + # Check that help & version is displayed properly + ADD_H5_CMP (h5mkgrp_help 0 "-h") + ADD_H5_CMP (h5mkgrp_version 0 "-V") + + # Create single group at root level + ADD_H5_TEST (h5mkgrp_single 0 " " single) + ADD_H5_TEST (h5mkgrp_single 0 "-v" single) + ADD_H5_TEST (h5mkgrp_single 0 "-p" single) + ADD_H5_TEST (h5mkgrp_single_latest 0 "-l" latest) + + # Create several groups at root level + ADD_H5_TEST (h5mkgrp_several 0 " " one two) + ADD_H5_TEST (h5mkgrp_several 0 "-v" one two) + ADD_H5_TEST (h5mkgrp_several 0 "-p" one two) + ADD_H5_TEST (h5mkgrp_several_latest 0 "-l" one two) + + # Create various nested groups + ADD_H5_TEST (h5mkgrp_nested 0 "-p" /one/two) + ADD_H5_TEST (h5mkgrp_nested_latest 0 "-lp" /one/two) + ADD_H5_TEST (h5mkgrp_nested_mult 0 "-p" /one/two /three/four) + ADD_H5_TEST (h5mkgrp_nested_mult_latest 0 "-lp" /one/two /three/four) ENDIF (BUILD_TESTING) ############################################################################## diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index b33d14d..cb770a1 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -194,6 +194,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -255,6 +256,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -311,6 +313,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index f7804fb..7b4215a 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -219,7 +219,7 @@ main(int argc, char *argv[]) { hid_t fid, fapl, dxpl; H5F_t *f; - haddr_t addr = 1, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; + haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; herr_t status = SUCCEED; diff --git a/tools/misc/testfiles/h5mkgrp_help.txt b/tools/misc/testfiles/h5mkgrp_help.txt new file mode 100644 index 0000000..ba130f6 --- /dev/null +++ b/tools/misc/testfiles/h5mkgrp_help.txt @@ -0,0 +1,7 @@ +usage: h5mkgrp [OPTIONS] FILE GROUP... + OPTIONS + -h, --help Print a usage message and exit + -l, --latest Use latest version of file format to create groups + -p, --parents No error if existing, make parent groups as needed + -v, --verbose Print information about OBJECTS and OPTIONS + -V, --version Print version number and exit diff --git a/tools/misc/testfiles/h5mkgrp_version.txt.in b/tools/misc/testfiles/h5mkgrp_version.txt.in new file mode 100644 index 0000000..75c13a5 --- /dev/null +++ b/tools/misc/testfiles/h5mkgrp_version.txt.in @@ -0,0 +1 @@ +h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@ diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh index e6cb96e..46264c2 100644 --- a/tools/misc/testh5mkgrp.sh +++ b/tools/misc/testh5mkgrp.sh @@ -158,12 +158,53 @@ echo "FILEOUT=" $FILEOUT fi } +# Single run of tool +# +# Assumed arguments: +# $1 is test expected output file +# $2 is h5mkgrp options +# $* are groups to create +CMPTEST() +{ + FILEOUT=$OUTDIR/$1 + expect="$srcdir/testfiles/`basename $1 .h5`.txt" + actual="$OUTDIR/`basename $1 .h5`.out" + actual_err="$OUTDIR/`basename $1 .h5`.err" + shift + + # Stderr is included in stdout so that the diff can detect + # any unexpected output from that stream too. + TESTING $H5MKGRP $@ + ( + $RUNSERIAL $H5MKGRP_BIN $@ + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.txt) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi +} + ############################################################################## ### T H E T E S T S ### ############################################################################## # Check that help & version is displayed properly -RUNTEST h5mkgrp_help.h5 "-h" +CMPTEST h5mkgrp_help.h5 "-h" RUNTEST h5mkgrp_version.h5 "-V" # Create single group at root level diff --git a/tools/testfiles/file_space.h5 b/tools/testfiles/file_space.h5 Binary files differindex de5837a..425d0c2 100644 --- a/tools/testfiles/file_space.h5 +++ b/tools/testfiles/file_space.h5 diff --git a/tools/testfiles/packedbits.ddl b/tools/testfiles/packedbits.ddl new file mode 100644 index 0000000..91bd63b --- /dev/null +++ b/tools/testfiles/packedbits.ddl @@ -0,0 +1,572 @@ +############################# +Expected output for 'h5dump packedbits.h5' +############################# +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, + (1,0): -2, -4, -8, -16, -32, -64, -128, 0, + (2,0): -4, -8, -16, -32, -64, -128, 0, 0, + (3,0): -8, -16, -32, -64, -128, 0, 0, 0, + (4,0): -16, -32, -64, -128, 0, 0, 0, 0, + (5,0): -32, -64, -128, 0, 0, 0, 0, 0, + (6,0): -64, -128, 0, 0, 0, 0, 0, 0, + (7,0): -128, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (0,12): -4096, -8192, -16384, -32768, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (1,11): -4096, -8192, -16384, -32768, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + (2,11): -8192, -16384, -32768, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (3,11): -16384, -32768, 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (4,10): -16384, -32768, 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (5,10): -32768, 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (6,9): -32768, 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + (7,10): 0, 0, 0, 0, 0, 0 + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (0,12): -4096, -8192, -16384, -32768, -65536, -131072, -262144, + (0,19): -524288, -1048576, -2097152, -4194304, -8388608, -16777216, + (0,25): -33554432, -67108864, -134217728, -268435456, -536870912, + (0,30): -1073741824, -2147483648, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (1,11): -4096, -8192, -16384, -32768, -65536, -131072, -262144, + (1,18): -524288, -1048576, -2097152, -4194304, -8388608, -16777216, + (1,24): -33554432, -67108864, -134217728, -268435456, -536870912, + (1,29): -1073741824, -2147483648, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + (2,11): -8192, -16384, -32768, -65536, -131072, -262144, -524288, + (2,18): -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, + (2,24): -67108864, -134217728, -268435456, -536870912, -1073741824, + (2,29): -2147483648, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (3,11): -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + (3,18): -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + (3,24): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (3,29): 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (4,10): -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + (4,17): -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + (4,23): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (4,28): 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (5,10): -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + (5,17): -4194304, -8388608, -16777216, -33554432, -67108864, + (5,22): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (5,27): 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (6,9): -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + (6,16): -4194304, -8388608, -16777216, -33554432, -67108864, + (6,21): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (6,26): 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + (7,9): -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + (7,16): -8388608, -16777216, -33554432, -67108864, -134217728, + (7,21): -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + (7,29): 0, 0, 0 + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (0,12): -4096, -8192, -16384, -32768, -65536, -131072, -262144, + (0,19): -524288, -1048576, -2097152, -4194304, -8388608, -16777216, + (0,25): -33554432, -67108864, -134217728, -268435456, -536870912, + (0,30): -1073741824, -2147483648, -4294967296, -8589934592, + (0,34): -17179869184, -34359738368, -68719476736, -137438953472, + (0,38): -274877906944, -549755813888, -1099511627776, -2199023255552, + (0,42): -4398046511104, -8796093022208, -17592186044416, + (0,45): -35184372088832, -70368744177664, -140737488355328, + (0,48): -281474976710656, -562949953421312, -1125899906842624, + (0,51): -2251799813685248, -4503599627370496, -9007199254740992, + (0,54): -18014398509481984, -36028797018963968, -72057594037927936, + (0,57): -144115188075855872, -288230376151711744, -576460752303423488, + (0,60): -1152921504606846976, -2305843009213693952, + (0,62): -4611686018427387904, -9223372036854775808, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, + (1,11): -4096, -8192, -16384, -32768, -65536, -131072, -262144, + (1,18): -524288, -1048576, -2097152, -4194304, -8388608, -16777216, + (1,24): -33554432, -67108864, -134217728, -268435456, -536870912, + (1,29): -1073741824, -2147483648, -4294967296, -8589934592, + (1,33): -17179869184, -34359738368, -68719476736, -137438953472, + (1,37): -274877906944, -549755813888, -1099511627776, -2199023255552, + (1,41): -4398046511104, -8796093022208, -17592186044416, + (1,44): -35184372088832, -70368744177664, -140737488355328, + (1,47): -281474976710656, -562949953421312, -1125899906842624, + (1,50): -2251799813685248, -4503599627370496, -9007199254740992, + (1,53): -18014398509481984, -36028797018963968, -72057594037927936, + (1,56): -144115188075855872, -288230376151711744, -576460752303423488, + (1,59): -1152921504606846976, -2305843009213693952, + (1,61): -4611686018427387904, -9223372036854775808, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + (2,11): -8192, -16384, -32768, -65536, -131072, -262144, -524288, + (2,18): -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, + (2,24): -67108864, -134217728, -268435456, -536870912, -1073741824, + (2,29): -2147483648, -4294967296, -8589934592, -17179869184, + (2,33): -34359738368, -68719476736, -137438953472, -274877906944, + (2,37): -549755813888, -1099511627776, -2199023255552, -4398046511104, + (2,41): -8796093022208, -17592186044416, -35184372088832, + (2,44): -70368744177664, -140737488355328, -281474976710656, + (2,47): -562949953421312, -1125899906842624, -2251799813685248, + (2,50): -4503599627370496, -9007199254740992, -18014398509481984, + (2,53): -36028797018963968, -72057594037927936, -144115188075855872, + (2,56): -288230376151711744, -576460752303423488, -1152921504606846976, + (2,59): -2305843009213693952, -4611686018427387904, + (2,61): -9223372036854775808, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (3,11): -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + (3,18): -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + (3,24): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (3,29): -4294967296, -8589934592, -17179869184, -34359738368, + (3,33): -68719476736, -137438953472, -274877906944, -549755813888, + (3,37): -1099511627776, -2199023255552, -4398046511104, -8796093022208, + (3,41): -17592186044416, -35184372088832, -70368744177664, + (3,44): -140737488355328, -281474976710656, -562949953421312, + (3,47): -1125899906842624, -2251799813685248, -4503599627370496, + (3,50): -9007199254740992, -18014398509481984, -36028797018963968, + (3,53): -72057594037927936, -144115188075855872, -288230376151711744, + (3,56): -576460752303423488, -1152921504606846976, + (3,58): -2305843009213693952, -4611686018427387904, + (3,60): -9223372036854775808, 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + (4,10): -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + (4,17): -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + (4,23): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (4,28): -4294967296, -8589934592, -17179869184, -34359738368, + (4,32): -68719476736, -137438953472, -274877906944, -549755813888, + (4,36): -1099511627776, -2199023255552, -4398046511104, -8796093022208, + (4,40): -17592186044416, -35184372088832, -70368744177664, + (4,43): -140737488355328, -281474976710656, -562949953421312, + (4,46): -1125899906842624, -2251799813685248, -4503599627370496, + (4,49): -9007199254740992, -18014398509481984, -36028797018963968, + (4,52): -72057594037927936, -144115188075855872, -288230376151711744, + (4,55): -576460752303423488, -1152921504606846976, + (4,57): -2305843009213693952, -4611686018427387904, + (4,59): -9223372036854775808, 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (5,10): -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + (5,17): -4194304, -8388608, -16777216, -33554432, -67108864, + (5,22): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (5,27): -4294967296, -8589934592, -17179869184, -34359738368, + (5,31): -68719476736, -137438953472, -274877906944, -549755813888, + (5,35): -1099511627776, -2199023255552, -4398046511104, -8796093022208, + (5,39): -17592186044416, -35184372088832, -70368744177664, + (5,42): -140737488355328, -281474976710656, -562949953421312, + (5,45): -1125899906842624, -2251799813685248, -4503599627370496, + (5,48): -9007199254740992, -18014398509481984, -36028797018963968, + (5,51): -72057594037927936, -144115188075855872, -288230376151711744, + (5,54): -576460752303423488, -1152921504606846976, + (5,56): -2305843009213693952, -4611686018427387904, + (5,58): -9223372036854775808, 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + (6,9): -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + (6,16): -4194304, -8388608, -16777216, -33554432, -67108864, + (6,21): -134217728, -268435456, -536870912, -1073741824, -2147483648, + (6,26): -4294967296, -8589934592, -17179869184, -34359738368, + (6,30): -68719476736, -137438953472, -274877906944, -549755813888, + (6,34): -1099511627776, -2199023255552, -4398046511104, -8796093022208, + (6,38): -17592186044416, -35184372088832, -70368744177664, + (6,41): -140737488355328, -281474976710656, -562949953421312, + (6,44): -1125899906842624, -2251799813685248, -4503599627370496, + (6,47): -9007199254740992, -18014398509481984, -36028797018963968, + (6,50): -72057594037927936, -144115188075855872, -288230376151711744, + (6,53): -576460752303423488, -1152921504606846976, + (6,55): -2305843009213693952, -4611686018427387904, + (6,57): -9223372036854775808, 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + (7,9): -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + (7,16): -8388608, -16777216, -33554432, -67108864, -134217728, + (7,21): -268435456, -536870912, -1073741824, -2147483648, -4294967296, + (7,26): -8589934592, -17179869184, -34359738368, -68719476736, + (7,30): -137438953472, -274877906944, -549755813888, -1099511627776, + (7,34): -2199023255552, -4398046511104, -8796093022208, + (7,37): -17592186044416, -35184372088832, -70368744177664, + (7,40): -140737488355328, -281474976710656, -562949953421312, + (7,43): -1125899906842624, -2251799813685248, -4503599627370496, + (7,46): -9007199254740992, -18014398509481984, -36028797018963968, + (7,49): -72057594037927936, -144115188075855872, -288230376151711744, + (7,52): -576460752303423488, -1152921504606846976, + (7,54): -2305843009213693952, -4611686018427387904, + (7,56): -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): 255, 254, 252, 248, 240, 224, 192, 128, + (1,0): 254, 252, 248, 240, 224, 192, 128, 0, + (2,0): 252, 248, 240, 224, 192, 128, 0, 0, + (3,0): 248, 240, 224, 192, 128, 0, 0, 0, + (4,0): 240, 224, 192, 128, 0, 0, 0, 0, + (5,0): 224, 192, 128, 0, 0, 0, 0, 0, + (6,0): 192, 128, 0, 0, 0, 0, 0, 0, + (7,0): 128, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, + (0,9): 65024, 64512, 63488, 61440, 57344, 49152, 32768, + (1,0): 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, + (1,9): 64512, 63488, 61440, 57344, 49152, 32768, 0, + (2,0): 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, + (2,9): 63488, 61440, 57344, 49152, 32768, 0, 0, + (3,0): 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, + (3,9): 61440, 57344, 49152, 32768, 0, 0, 0, + (4,0): 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, + (4,9): 57344, 49152, 32768, 0, 0, 0, 0, + (5,0): 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, + (5,9): 49152, 32768, 0, 0, 0, 0, 0, + (6,0): 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, + (6,9): 32768, 0, 0, 0, 0, 0, 0, + (7,0): 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + (7,9): 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + (0,0): 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, + (0,5): 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + (0,10): 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + (0,15): 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + (0,20): 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + (0,25): 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + (0,30): 3221225472, 2147483648, + (1,0): 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, + (1,5): 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + (1,10): 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + (1,15): 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + (1,20): 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + (1,25): 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + (1,30): 2147483648, 0, + (2,0): 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, + (2,5): 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + (2,10): 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + (2,15): 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + (2,20): 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + (2,25): 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, + (2,31): 0, + (3,0): 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, + (3,5): 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + (3,10): 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + (3,15): 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, + (3,20): 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, + (3,25): 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + (4,0): 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, + (4,5): 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, + (4,10): 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + (4,15): 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + (4,20): 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, + (4,25): 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + (5,0): 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + (5,5): 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + (5,10): 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + (5,15): 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + (5,20): 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + (5,25): 3221225472, 2147483648, 0, 0, 0, 0, 0, + (6,0): 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + (6,5): 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + (6,10): 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + (6,15): 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + (6,20): 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + (6,25): 2147483648, 0, 0, 0, 0, 0, 0, + (7,0): 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + (7,5): 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + (7,10): 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + (7,15): 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + (7,20): 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, + (7,26): 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + (0,0): 18446744073709551615, 18446744073709551614, + (0,2): 18446744073709551612, 18446744073709551608, + (0,4): 18446744073709551600, 18446744073709551584, + (0,6): 18446744073709551552, 18446744073709551488, + (0,8): 18446744073709551360, 18446744073709551104, + (0,10): 18446744073709550592, 18446744073709549568, + (0,12): 18446744073709547520, 18446744073709543424, + (0,14): 18446744073709535232, 18446744073709518848, + (0,16): 18446744073709486080, 18446744073709420544, + (0,18): 18446744073709289472, 18446744073709027328, + (0,20): 18446744073708503040, 18446744073707454464, + (0,22): 18446744073705357312, 18446744073701163008, + (0,24): 18446744073692774400, 18446744073675997184, + (0,26): 18446744073642442752, 18446744073575333888, + (0,28): 18446744073441116160, 18446744073172680704, + (0,30): 18446744072635809792, 18446744071562067968, + (0,32): 18446744069414584320, 18446744065119617024, + (0,34): 18446744056529682432, 18446744039349813248, + (0,36): 18446744004990074880, 18446743936270598144, + (0,38): 18446743798831644672, 18446743523953737728, + (0,40): 18446742974197923840, 18446741874686296064, + (0,42): 18446739675663040512, 18446735277616529408, + (0,44): 18446726481523507200, 18446708889337462784, + (0,46): 18446673704965373952, 18446603336221196288, + (0,48): 18446462598732840960, 18446181123756130304, + (0,50): 18445618173802708992, 18444492273895866368, + (0,52): 18442240474082181120, 18437736874454810624, + (0,54): 18428729675200069632, 18410715276690587648, + (0,56): 18374686479671623680, 18302628885633695744, + (0,58): 18158513697557839872, 17870283321406128128, + (0,60): 17293822569102704640, 16140901064495857664, + (0,62): 13835058055282163712, 9223372036854775808, + (1,0): 18446744073709551614, 18446744073709551612, + (1,2): 18446744073709551608, 18446744073709551600, + (1,4): 18446744073709551584, 18446744073709551552, + (1,6): 18446744073709551488, 18446744073709551360, + (1,8): 18446744073709551104, 18446744073709550592, + (1,10): 18446744073709549568, 18446744073709547520, + (1,12): 18446744073709543424, 18446744073709535232, + (1,14): 18446744073709518848, 18446744073709486080, + (1,16): 18446744073709420544, 18446744073709289472, + (1,18): 18446744073709027328, 18446744073708503040, + (1,20): 18446744073707454464, 18446744073705357312, + (1,22): 18446744073701163008, 18446744073692774400, + (1,24): 18446744073675997184, 18446744073642442752, + (1,26): 18446744073575333888, 18446744073441116160, + (1,28): 18446744073172680704, 18446744072635809792, + (1,30): 18446744071562067968, 18446744069414584320, + (1,32): 18446744065119617024, 18446744056529682432, + (1,34): 18446744039349813248, 18446744004990074880, + (1,36): 18446743936270598144, 18446743798831644672, + (1,38): 18446743523953737728, 18446742974197923840, + (1,40): 18446741874686296064, 18446739675663040512, + (1,42): 18446735277616529408, 18446726481523507200, + (1,44): 18446708889337462784, 18446673704965373952, + (1,46): 18446603336221196288, 18446462598732840960, + (1,48): 18446181123756130304, 18445618173802708992, + (1,50): 18444492273895866368, 18442240474082181120, + (1,52): 18437736874454810624, 18428729675200069632, + (1,54): 18410715276690587648, 18374686479671623680, + (1,56): 18302628885633695744, 18158513697557839872, + (1,58): 17870283321406128128, 17293822569102704640, + (1,60): 16140901064495857664, 13835058055282163712, + (1,62): 9223372036854775808, 0, + (2,0): 18446744073709551612, 18446744073709551608, + (2,2): 18446744073709551600, 18446744073709551584, + (2,4): 18446744073709551552, 18446744073709551488, + (2,6): 18446744073709551360, 18446744073709551104, + (2,8): 18446744073709550592, 18446744073709549568, + (2,10): 18446744073709547520, 18446744073709543424, + (2,12): 18446744073709535232, 18446744073709518848, + (2,14): 18446744073709486080, 18446744073709420544, + (2,16): 18446744073709289472, 18446744073709027328, + (2,18): 18446744073708503040, 18446744073707454464, + (2,20): 18446744073705357312, 18446744073701163008, + (2,22): 18446744073692774400, 18446744073675997184, + (2,24): 18446744073642442752, 18446744073575333888, + (2,26): 18446744073441116160, 18446744073172680704, + (2,28): 18446744072635809792, 18446744071562067968, + (2,30): 18446744069414584320, 18446744065119617024, + (2,32): 18446744056529682432, 18446744039349813248, + (2,34): 18446744004990074880, 18446743936270598144, + (2,36): 18446743798831644672, 18446743523953737728, + (2,38): 18446742974197923840, 18446741874686296064, + (2,40): 18446739675663040512, 18446735277616529408, + (2,42): 18446726481523507200, 18446708889337462784, + (2,44): 18446673704965373952, 18446603336221196288, + (2,46): 18446462598732840960, 18446181123756130304, + (2,48): 18445618173802708992, 18444492273895866368, + (2,50): 18442240474082181120, 18437736874454810624, + (2,52): 18428729675200069632, 18410715276690587648, + (2,54): 18374686479671623680, 18302628885633695744, + (2,56): 18158513697557839872, 17870283321406128128, + (2,58): 17293822569102704640, 16140901064495857664, + (2,60): 13835058055282163712, 9223372036854775808, 0, 0, + (3,0): 18446744073709551608, 18446744073709551600, + (3,2): 18446744073709551584, 18446744073709551552, + (3,4): 18446744073709551488, 18446744073709551360, + (3,6): 18446744073709551104, 18446744073709550592, + (3,8): 18446744073709549568, 18446744073709547520, + (3,10): 18446744073709543424, 18446744073709535232, + (3,12): 18446744073709518848, 18446744073709486080, + (3,14): 18446744073709420544, 18446744073709289472, + (3,16): 18446744073709027328, 18446744073708503040, + (3,18): 18446744073707454464, 18446744073705357312, + (3,20): 18446744073701163008, 18446744073692774400, + (3,22): 18446744073675997184, 18446744073642442752, + (3,24): 18446744073575333888, 18446744073441116160, + (3,26): 18446744073172680704, 18446744072635809792, + (3,28): 18446744071562067968, 18446744069414584320, + (3,30): 18446744065119617024, 18446744056529682432, + (3,32): 18446744039349813248, 18446744004990074880, + (3,34): 18446743936270598144, 18446743798831644672, + (3,36): 18446743523953737728, 18446742974197923840, + (3,38): 18446741874686296064, 18446739675663040512, + (3,40): 18446735277616529408, 18446726481523507200, + (3,42): 18446708889337462784, 18446673704965373952, + (3,44): 18446603336221196288, 18446462598732840960, + (3,46): 18446181123756130304, 18445618173802708992, + (3,48): 18444492273895866368, 18442240474082181120, + (3,50): 18437736874454810624, 18428729675200069632, + (3,52): 18410715276690587648, 18374686479671623680, + (3,54): 18302628885633695744, 18158513697557839872, + (3,56): 17870283321406128128, 17293822569102704640, + (3,58): 16140901064495857664, 13835058055282163712, + (3,60): 9223372036854775808, 0, 0, 0, + (4,0): 18446744073709551600, 18446744073709551584, + (4,2): 18446744073709551552, 18446744073709551488, + (4,4): 18446744073709551360, 18446744073709551104, + (4,6): 18446744073709550592, 18446744073709549568, + (4,8): 18446744073709547520, 18446744073709543424, + (4,10): 18446744073709535232, 18446744073709518848, + (4,12): 18446744073709486080, 18446744073709420544, + (4,14): 18446744073709289472, 18446744073709027328, + (4,16): 18446744073708503040, 18446744073707454464, + (4,18): 18446744073705357312, 18446744073701163008, + (4,20): 18446744073692774400, 18446744073675997184, + (4,22): 18446744073642442752, 18446744073575333888, + (4,24): 18446744073441116160, 18446744073172680704, + (4,26): 18446744072635809792, 18446744071562067968, + (4,28): 18446744069414584320, 18446744065119617024, + (4,30): 18446744056529682432, 18446744039349813248, + (4,32): 18446744004990074880, 18446743936270598144, + (4,34): 18446743798831644672, 18446743523953737728, + (4,36): 18446742974197923840, 18446741874686296064, + (4,38): 18446739675663040512, 18446735277616529408, + (4,40): 18446726481523507200, 18446708889337462784, + (4,42): 18446673704965373952, 18446603336221196288, + (4,44): 18446462598732840960, 18446181123756130304, + (4,46): 18445618173802708992, 18444492273895866368, + (4,48): 18442240474082181120, 18437736874454810624, + (4,50): 18428729675200069632, 18410715276690587648, + (4,52): 18374686479671623680, 18302628885633695744, + (4,54): 18158513697557839872, 17870283321406128128, + (4,56): 17293822569102704640, 16140901064495857664, + (4,58): 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, + (5,0): 18446744073709551584, 18446744073709551552, + (5,2): 18446744073709551488, 18446744073709551360, + (5,4): 18446744073709551104, 18446744073709550592, + (5,6): 18446744073709549568, 18446744073709547520, + (5,8): 18446744073709543424, 18446744073709535232, + (5,10): 18446744073709518848, 18446744073709486080, + (5,12): 18446744073709420544, 18446744073709289472, + (5,14): 18446744073709027328, 18446744073708503040, + (5,16): 18446744073707454464, 18446744073705357312, + (5,18): 18446744073701163008, 18446744073692774400, + (5,20): 18446744073675997184, 18446744073642442752, + (5,22): 18446744073575333888, 18446744073441116160, + (5,24): 18446744073172680704, 18446744072635809792, + (5,26): 18446744071562067968, 18446744069414584320, + (5,28): 18446744065119617024, 18446744056529682432, + (5,30): 18446744039349813248, 18446744004990074880, + (5,32): 18446743936270598144, 18446743798831644672, + (5,34): 18446743523953737728, 18446742974197923840, + (5,36): 18446741874686296064, 18446739675663040512, + (5,38): 18446735277616529408, 18446726481523507200, + (5,40): 18446708889337462784, 18446673704965373952, + (5,42): 18446603336221196288, 18446462598732840960, + (5,44): 18446181123756130304, 18445618173802708992, + (5,46): 18444492273895866368, 18442240474082181120, + (5,48): 18437736874454810624, 18428729675200069632, + (5,50): 18410715276690587648, 18374686479671623680, + (5,52): 18302628885633695744, 18158513697557839872, + (5,54): 17870283321406128128, 17293822569102704640, + (5,56): 16140901064495857664, 13835058055282163712, + (5,58): 9223372036854775808, 0, 0, 0, 0, 0, + (6,0): 18446744073709551552, 18446744073709551488, + (6,2): 18446744073709551360, 18446744073709551104, + (6,4): 18446744073709550592, 18446744073709549568, + (6,6): 18446744073709547520, 18446744073709543424, + (6,8): 18446744073709535232, 18446744073709518848, + (6,10): 18446744073709486080, 18446744073709420544, + (6,12): 18446744073709289472, 18446744073709027328, + (6,14): 18446744073708503040, 18446744073707454464, + (6,16): 18446744073705357312, 18446744073701163008, + (6,18): 18446744073692774400, 18446744073675997184, + (6,20): 18446744073642442752, 18446744073575333888, + (6,22): 18446744073441116160, 18446744073172680704, + (6,24): 18446744072635809792, 18446744071562067968, + (6,26): 18446744069414584320, 18446744065119617024, + (6,28): 18446744056529682432, 18446744039349813248, + (6,30): 18446744004990074880, 18446743936270598144, + (6,32): 18446743798831644672, 18446743523953737728, + (6,34): 18446742974197923840, 18446741874686296064, + (6,36): 18446739675663040512, 18446735277616529408, + (6,38): 18446726481523507200, 18446708889337462784, + (6,40): 18446673704965373952, 18446603336221196288, + (6,42): 18446462598732840960, 18446181123756130304, + (6,44): 18445618173802708992, 18444492273895866368, + (6,46): 18442240474082181120, 18437736874454810624, + (6,48): 18428729675200069632, 18410715276690587648, + (6,50): 18374686479671623680, 18302628885633695744, + (6,52): 18158513697557839872, 17870283321406128128, + (6,54): 17293822569102704640, 16140901064495857664, + (6,56): 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, 0, + (7,0): 18446744073709551488, 18446744073709551360, + (7,2): 18446744073709551104, 18446744073709550592, + (7,4): 18446744073709549568, 18446744073709547520, + (7,6): 18446744073709543424, 18446744073709535232, + (7,8): 18446744073709518848, 18446744073709486080, + (7,10): 18446744073709420544, 18446744073709289472, + (7,12): 18446744073709027328, 18446744073708503040, + (7,14): 18446744073707454464, 18446744073705357312, + (7,16): 18446744073701163008, 18446744073692774400, + (7,18): 18446744073675997184, 18446744073642442752, + (7,20): 18446744073575333888, 18446744073441116160, + (7,22): 18446744073172680704, 18446744072635809792, + (7,24): 18446744071562067968, 18446744069414584320, + (7,26): 18446744065119617024, 18446744056529682432, + (7,28): 18446744039349813248, 18446744004990074880, + (7,30): 18446743936270598144, 18446743798831644672, + (7,32): 18446743523953737728, 18446742974197923840, + (7,34): 18446741874686296064, 18446739675663040512, + (7,36): 18446735277616529408, 18446726481523507200, + (7,38): 18446708889337462784, 18446673704965373952, + (7,40): 18446603336221196288, 18446462598732840960, + (7,42): 18446181123756130304, 18445618173802708992, + (7,44): 18444492273895866368, 18442240474082181120, + (7,46): 18437736874454810624, 18428729675200069632, + (7,48): 18410715276690587648, 18374686479671623680, + (7,50): 18302628885633695744, 18158513697557839872, + (7,52): 17870283321406128128, 17293822569102704640, + (7,54): 16140901064495857664, 13835058055282163712, + (7,56): 9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + (1,0): 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + (2,0): 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + (3,0): 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + (4,0): 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + (5,0): 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + (6,0): 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + (7,0): 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 + } + } +} +} diff --git a/tools/testfiles/packedbits.h5 b/tools/testfiles/packedbits.h5 Binary files differnew file mode 100644 index 0000000..cbb73ab --- /dev/null +++ b/tools/testfiles/packedbits.h5 diff --git a/tools/testfiles/taindices.h5 b/tools/testfiles/taindices.h5 Binary files differindex f7e2c1a..b482a21 100644 --- a/tools/testfiles/taindices.h5 +++ b/tools/testfiles/taindices.h5 diff --git a/tools/testfiles/textlink.ddl b/tools/testfiles/textlink.ddl new file mode 100644 index 0000000..0a43c47 --- /dev/null +++ b/tools/testfiles/textlink.ddl @@ -0,0 +1,15 @@ +############################# +Expected output for 'h5dump textlink.h5' +############################# +HDF5 "textlink.h5" { +GROUP "/" { + EXTERNAL_LINK "extlink1" { + TARGETFILE "filename" + TARGETPATH "objname" + } + EXTERNAL_LINK "extlink2" { + TARGETFILE "anotherfile" + TARGETPATH "anotherobj" + } +} +} diff --git a/tools/testfiles/tgrp_comments.ddl b/tools/testfiles/tgrp_comments.ddl index 6321b36..460a9f0 100644 --- a/tools/testfiles/tgrp_comments.ddl +++ b/tools/testfiles/tgrp_comments.ddl @@ -42,5 +42,8 @@ GROUP "/" { COMMENT "Comment for group /g3/g3.4" } } + GROUP "glongcomment" { + COMMENT "Comment for group /glongcomment with a really, really, really long, long, long comment" + } } } diff --git a/tools/testfiles/tgrp_comments.h5 b/tools/testfiles/tgrp_comments.h5 Binary files differindex 70c7cce..ddd2eec 100644 --- a/tools/testfiles/tgrp_comments.h5 +++ b/tools/testfiles/tgrp_comments.h5 diff --git a/tools/testfiles/tgrp_comments.ls b/tools/testfiles/tgrp_comments.ls new file mode 100644 index 0000000..e4c7d42 --- /dev/null +++ b/tools/testfiles/tgrp_comments.ls @@ -0,0 +1,8 @@ +############################# + output for 'h5ls -w80 -v -g tgrp_comments.h5/glongcomment' +############################# +Opened "tgrp_comments.h5" with sec2 driver. +glongcomment Group + Location: 1:12424 + Links: 1 + Comment: "Comment for group /glongcomment with a really, really, really long, long, long comment" diff --git a/tools/testfiles/tnestcomp-2.ls b/tools/testfiles/tnestcomp-2.ls new file mode 100644 index 0000000..be60e8d --- /dev/null +++ b/tools/testfiles/tnestcomp-2.ls @@ -0,0 +1,16 @@ +############################# + output for 'h5ls -w80 -r -d -S tnestedcomp.h5' +############################# +/ Group +/ArrayOfStructures Dataset {10} + Data: + 0 0 1 "A" -100 100 + 1 1 0.5 "B" -100 100 + 2 4 0.333333333333333 "C" -100 100 + 3 9 0.25 "D" -100 100 + 4 16 0.2 "E" -100 100 + 5 25 0.166666666666667 "F" -100 100 + 6 36 0.142857142857143 "G" -100 100 + 7 49 0.125 "H" -100 100 + 8 64 0.111111111111111 "I" -100 100 + 9 81 0.1 "J" -100 100 diff --git a/tools/testfiles/tnestcomp-3.ls b/tools/testfiles/tnestcomp-3.ls new file mode 100644 index 0000000..98eca8e --- /dev/null +++ b/tools/testfiles/tnestcomp-3.ls @@ -0,0 +1,26 @@ +############################# + output for 'h5ls -w80 -r -d -l tnestedcomp.h5' +############################# +/ Group +/ArrayOfStructures Dataset {10} + Data: + (0) {a_name=0, b_name=0, c_name=1, d_name={char_name="A", + (0) array_name=[-100,100]}}, + (1) {a_name=1, b_name=1, c_name=0.5, d_name={char_name="B", + (1) array_name=[-100,100]}}, + (2) {a_name=2, b_name=4, c_name=0.333333333333333, + (2) d_name={char_name="C", array_name=[-100,100]}}, + (3) {a_name=3, b_name=9, c_name=0.25, d_name={char_name="D", + (3) array_name=[-100,100]}}, + (4) {a_name=4, b_name=16, c_name=0.2, d_name={char_name="E", + (4) array_name=[-100,100]}}, + (5) {a_name=5, b_name=25, c_name=0.166666666666667, + (5) d_name={char_name="F", array_name=[-100,100]}}, + (6) {a_name=6, b_name=36, c_name=0.142857142857143, + (6) d_name={char_name="G", array_name=[-100,100]}}, + (7) {a_name=7, b_name=49, c_name=0.125, d_name={char_name="H", + (7) array_name=[-100,100]}}, + (8) {a_name=8, b_name=64, c_name=0.111111111111111, + (8) d_name={char_name="I", array_name=[-100,100]}}, + (9) {a_name=9, b_name=81, c_name=0.1, d_name={char_name="J", + (9) array_name=[-100,100]}} diff --git a/tools/testfiles/tnestcomp-4.ls b/tools/testfiles/tnestcomp-4.ls new file mode 100644 index 0000000..6618597 --- /dev/null +++ b/tools/testfiles/tnestcomp-4.ls @@ -0,0 +1,16 @@ +############################# + output for 'h5ls -w80 -r -d -l -S tnestedcomp.h5' +############################# +/ Group +/ArrayOfStructures Dataset {10} + Data: + {a_name=0 b_name=0 c_name=1 d_name={char_name="A" array_name=-100 100}} + {a_name=1 b_name=1 c_name=0.5 d_name={char_name="B" array_name=-100 100}} + {a_name=2 b_name=4 c_name=0.333333333333333 d_name={char_name="C" array_name=-100 100}} + {a_name=3 b_name=9 c_name=0.25 d_name={char_name="D" array_name=-100 100}} + {a_name=4 b_name=16 c_name=0.2 d_name={char_name="E" array_name=-100 100}} + {a_name=5 b_name=25 c_name=0.166666666666667 d_name={char_name="F" array_name=-100 100}} + {a_name=6 b_name=36 c_name=0.142857142857143 d_name={char_name="G" array_name=-100 100}} + {a_name=7 b_name=49 c_name=0.125 d_name={char_name="H" array_name=-100 100}} + {a_name=8 b_name=64 c_name=0.111111111111111 d_name={char_name="I" array_name=-100 100}} + {a_name=9 b_name=81 c_name=0.1 d_name={char_name="J" array_name=-100 100}} diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 4dc1172..57650f8 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -489,13 +489,13 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.76" +#define H5_PACKAGE_STRING "HDF5 1.9.80" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.76" +#define H5_PACKAGE_VERSION "1.9.80" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -651,7 +651,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.76" +#define H5_VERSION "1.9.80" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/vms/src/make.com b/vms/src/make.com index 046ffad..48d5fae 100644 --- a/vms/src/make.com +++ b/vms/src/make.com @@ -24,7 +24,14 @@ $ type sys$input Running h5detect to create h5tinit.c $ define/user_mode sys$output h5tinit.c $ run h5detect -$ +$! +$ ccc h5make_libsettings.c +$ link h5make_libsettings +$ type sys$input + Running h5make_libsettings to create H5lib_settings.h +$ define/user_mode sys$output H5lib_settings.h +$ run h5make_libsettings +$! $ type sys$input Creating HDF5 library $! @@ -47,7 +54,7 @@ $ cobj= "H5, H5checksum, H5dbg, H5system, H5timer, H5trace,"+- "H5HG, H5HGcache, H5HGdbg, H5HL, H5HLcache, H5HLdbg, H5HLint, H5HP, H5I, H5Itest, H5L, H5Lexternal" $ cobj1= "H5MFaggr, H5MF, H5MFdbg, H5MFsection, H5MM,"+- "H5MP, H5MPtest, H5Oainfo, H5Oalloc, H5Oattr, H5Oattribute, H5Obogus, H5Obtreek,"+- - "H5O, H5Ocache, H5Ocont, H5Ocopy, H5Odbg, H5Odrvinfo, H5Odtype, H5Oefl, H5Ofill, H5Ofsinfo,"+- + "H5O, H5Ocache, H5Ochunk, H5Ocont, H5Ocopy, H5Odbg, H5Odrvinfo, H5Odtype, H5Oefl, H5Ofill, H5Ofsinfo,"+- "H5Oginfo, H5Olayout, H5Olinfo, H5Olink, H5Omessage, H5Omtime, H5Oname, H5Onull, H5Opline,"+- "H5Orefcount, H5Osdspace, H5Oshared, H5Oshmesg, H5Ostab, H5Otest, H5Ounknown,"+- "H5Pacpl, H5P, H5Pdapl, H5Pdcpl, H5Pdeprec, H5Pdxpl, H5Pfapl, H5Pfcpl, H5Pfmpl, H5Pgcpl, H5Pint,"+- diff --git a/vms/test/check.com b/vms/test/check.com index 1a833dc..af64d6f 100644 --- a/vms/test/check.com +++ b/vms/test/check.com @@ -26,6 +26,11 @@ $ run testhdf5 $ type sys$input $ type sys$input +------- Running accum ------- +$ run accum +$ type sys$input + +$ type sys$input ------- Running app_ref ------- $ run app_ref $ type sys$input @@ -56,6 +61,11 @@ $ run cache $ type sys$input $ type sys$input +------- Running cache_tagging ------- +$ run cache_tagging +$ type sys$input + +$ type sys$input ------- Running chunk_info ------- $ run chunk_info $ type sys$input @@ -126,6 +136,11 @@ $ run fillval $ type sys$input $ type sys$input +------- Running filter_fail ------- +$ run filter_fail +$ type sys$input + +$ type sys$input ------- Running flush1 ------- $ run flush1 $ type sys$input @@ -171,6 +186,11 @@ $ run links $ type sys$input $ type sys$input +------- Running links_env ------- +$ run links_env +$ type sys$input + +$ type sys$input ------- Running mf ------- $ run mf $ type sys$input @@ -216,11 +236,21 @@ $ run set_extent $ type sys$input $ type sys$input +------- Running space_overflow ------- +$ run space_overflow +$ type sys$input + +$ type sys$input ------- Running stab ------- $ run stab $ type sys$input $ type sys$input +------- Running testmeta ------- +$ run testmeta +$ type sys$input + +$ type sys$input ------- Running unlink ------- $ run unlink $ type sys$input diff --git a/vms/test/make.com b/vms/test/make.com index e4adac9..5e46479 100644 --- a/vms/test/make.com +++ b/vms/test/make.com @@ -26,8 +26,8 @@ $ ccc := cc 'ccopt /include=([-.src]) $ type sys$input Creating testhdf5 $! -$ cobj= "h5test.c, testframe.c, testhdf5.c, tarray.c, tattr.c, tchecksum.c, tconfig.c,"+- - "tcoords.c, tfile.c, tgenprop.c, th5o.c, th5s.c, theap.c, tid.c,"+- +$ cobj= "h5test.c, testframe.c, testhdf5.c, tarray.c, tattr.c, tcheck_version., tchecksum.c,"+- + "tconfig.c, tcoords.c, tfile.c, tgenprop.c, th5o.c, th5s.c, theap.c, tid.c,"+- "titerate.c, tmeta.c, tmisc.c, trefer.c, trefstr.c, tselect.c, tskiplist.c,"+- "tsohm.c, ttime.c, ttst.c, tunicode.c, tvlstr.c, tvltypes.c, cache_common.c" $! @@ -35,12 +35,19 @@ $ ccc 'cobj $ library/create/replace []libh5test h5test, testframe, cache_common $ type sys$input Creating libh5test -$ link testhdf5,tarray,tattr,tchecksum,tconfig, - +$ link testhdf5,tarray,tattr,tcheck_version,tchecksum,tconfig, - tcoords,tfile,tgenprop,th5o,th5s,theap,tid,titerate, - tmeta,tmisc,trefer,trefstr, - tselect,tskiplist,tsohm,ttime,ttst,tunicode,tvlstr,tvltypes, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $ +$! a new test +$ type sys$input + Creating accum test +$ ccc accum +$ link accum, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating app_ref test $ ccc app_ref @@ -83,6 +90,13 @@ $ ccc cache_common $ link cache_common, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! +$! a new test +$ type sys$input + Creating cache_tagging tests +$ ccc cache_tagging +$ link cache_tagging, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating chunk_info test $ ccc chunk_info @@ -179,6 +193,13 @@ $ ccc fillval $ link fillval, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! +$! a new test +$ type sys$input + Creating filter_fail test +$ ccc filter_fail +$ link filter_fail, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating flush1 test $ ccc flush1 @@ -233,6 +254,13 @@ $ ccc links $ link links, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! +$! a new test +$ type sys$input + Creating links_env test +$ ccc links_env +$ link links_env, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating mf test $ ccc mf @@ -287,12 +315,26 @@ $ ccc set_extent $ link set_extent, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! +$! a new test +$ type sys$input + Creating space_overflow test +$ ccc space_overflow +$ link space_overflow, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating stab test $ ccc stab $ link stab, - libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib $! +$! a new test +$ type sys$input + Creating testmeta test +$ ccc testmeta +$ link testmeta, - + libh5test.olb/lib,[-.src]hdf5.olb/lib,zlib_dir:libz.olb/lib +$! $ type sys$input Creating unlink test $ ccc unlink diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index edbdfa2..0a6ce30 100755 --- a/windows/src/H5pubconf.h +++ b/windows/src/H5pubconf.h @@ -478,13 +478,13 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.76" +#define H5_PACKAGE_STRING "HDF5 1.9.80" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.76" +#define H5_PACKAGE_VERSION "1.9.80" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "I64" @@ -641,7 +641,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.76" +#define H5_VERSION "1.9.80" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/tools/h5copy/testh5copy.bat b/windows/tools/h5copy/testh5copy.bat index 26f1b2c..495081c 100644 --- a/windows/tools/h5copy/testh5copy.bat +++ b/windows/tools/h5copy/testh5copy.bat @@ -84,7 +84,7 @@ rem for %%a in (%*) do (
if %%a neq PASSED (
if %%a neq *FAILED* (
- set verify_msg=!test_msg! %%~nxa
+ set verify_msg=!verify_msg! %%~nxa
) )
)
set verify_msg=%verify_msg%
@@ -100,7 +100,7 @@ rem for %%a in (%*) do (
if %%a neq PASSED (
if %%a neq *FAILED* (
- set verifyh5ls_msg=!test_msg! %%~nxa
+ set verifyh5ls_msg=!verifyh5ls_msg! %%~nxa
) )
)
set verifyh5ls_msg=%verifyh5ls_msg%
@@ -330,17 +330,17 @@ rem <none> call :tooltest -i %testfile% -o %fileout% -v -s /grp_dsets/simple -d /grp_dsets/simple_group
echo.Test copying ^& renaming group
- call :tooltest_fail -i %testfile% -o %fileout% -v -s grp_dsets -d grp_rename
+ call :tooltest -i %testfile% -o %fileout% -v -s grp_dsets -d grp_rename
echo.Test copying 'full' group hierarchy into group in destination file
- call :tooltest_fail -i %testfile% -o %fileout% -v -s grp_dsets -d /grp_rename/grp_dsets
+ call :tooltest -i %testfile% -o %fileout% -v -s grp_dsets -d /grp_rename/grp_dsets
echo.Test copying objects into group hier. that doesn't exist yet in destination file
call :tooltest -i %testfile% -o %fileout% -vp -s simple -d /A/B1/simple
call :tooltest -i %testfile% -o %fileout% -vp -s simple -d /A/B2/simple2
call :tooltest -i %testfile% -o %fileout% -vp -s /grp_dsets/simple -d /C/D/simple
- call :tooltest_fail -i %testfile% -o %fileout% -vp -s /grp_dsets -d /E/F/grp_dsets
- call :tooltest_fail -i %testfile% -o %fileout% -vp -s /grp_nested -d /G/H/grp_nested
+ call :tooltest -i %testfile% -o %fileout% -vp -s /grp_dsets -d /E/F/grp_dsets
+ call :tooltest -i %testfile% -o %fileout% -vp -s /grp_nested -d /G/H/grp_nested
rem Verify that the file created above is correct
call :h5lstest %fileout%
diff --git a/windows/tools/h5diff/testh5diff.bat b/windows/tools/h5diff/testh5diff.bat index 29be753..f745c42 100644 --- a/windows/tools/h5diff/testh5diff.bat +++ b/windows/tools/h5diff/testh5diff.bat @@ -58,6 +58,7 @@ set srcexclude1_1=h5diff_exclude1-1.h5 set srcexclude1_2=h5diff_exclude1-2.h5
set srcexclude2_1=h5diff_exclude2-1.h5
set srcexclude2_2=h5diff_exclude2-2.h5
+set src_comp_vl_strs=h5diff_comp_vl_strs.h5
set file1=%indir%\h5diff_basic1.h5
set file2=%indir%\h5diff_basic2.h5
@@ -89,6 +90,7 @@ set exclude1_1=%indir%\h5diff_exclude1-1.h5 set exclude1_2=%indir%\h5diff_exclude1-2.h5
set exclude2_1=%indir%\h5diff_exclude2-1.h5
set exclude2_2=%indir%\h5diff_exclude2-2.h5
+set comp_vl_strs=%indir%\h5diff_comp_vl_strs.h5
rem The tool name
@@ -853,6 +855,12 @@ rem ############################################################################ call :testing %h5diff% -v --exclude-path "/dset3" %srcexclude1_1% %srcexclude1_2% /group1
call :tooltest h5diff_484.txt -v --exclude-path "/dset3" %exclude1_1% %exclude1_2% /group1
+ rem ##############################################################################
+ rem # diff various multiple vlen and fixed strings in a compound type dataset
+ rem ##############################################################################
+ call :testing %h5diff% -v %src_comp_vl_strs% %src_comp_vl_strs%
+ call :tooltest h5diff_530.txt -v %comp_vl_strs% %comp_vl_strs%
+
rem #######################################################################
rem # END
diff --git a/windows/tools/h5dump/testh5dump.bat b/windows/tools/h5dump/testh5dump.bat index e776c07..e7edd1a 100644 --- a/windows/tools/h5dump/testh5dump.bat +++ b/windows/tools/h5dump/testh5dump.bat @@ -299,6 +299,9 @@ rem ############################################################################ rem ############################################################################
:main
+ rem test for signed/unsigned datasets
+ call :tooltest packedbits.ddl packedbits.h5
+
rem test for displaying groups
call :tooltest tgroup-1.ddl tgroup.h5
rem test for displaying the selected groups
@@ -607,6 +610,9 @@ rem ############################################################################ rem tests for traversal of external links call :tooltest textlinksrc.ddl textlinksrc.h5 call :tooltest textlinkfar.ddl textlinkfar.h5 + + rem test for dangling external links + call :tooltest textlink.ddl textlink.h5 diff --git a/windows/tools/h5ls/testh5ls.bat b/windows/tools/h5ls/testh5ls.bat index 953216d..f15274c 100644 --- a/windows/tools/h5ls/testh5ls.bat +++ b/windows/tools/h5ls/testh5ls.bat @@ -218,6 +218,9 @@ rem ############################################################################ rem test for the nested compound type
call :tooltest tnestcomp-1.ls 0 -w80 -r -d tnestedcomp.h5
+ call :tooltest tnestcomp-2.ls 0 -w80 -r -d -S tnestedcomp.h5
+ call :tooltest tnestcomp-3.ls 0 -w80 -r -d -l tnestedcomp.h5
+ call :tooltest tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5
rem test for loop detection
call :tooltest tloop-1.ls 0 -w80 -r -d tloop.h5
|