Skip to content

Commit

Permalink
Merge branch 'HDFGroup:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoklee authored Mar 14, 2024
2 parents 108359f + c3714b9 commit 24edbcc
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 191 deletions.
1 change: 1 addition & 0 deletions bin/cmakehdf5
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
echo "Deprecated: This will be removed in a future release"
# Build and Test HDF5 using cmake.

# Copyright: The HDF Group, 2012-14
Expand Down
42 changes: 21 additions & 21 deletions bin/h5cc.in
Original file line number Diff line number Diff line change
Expand Up @@ -327,27 +327,27 @@ if test "x$do_link" = "xyes"; then
fi
link_args="$link_args -L${libdir}"

case "$kind" in
gcc|linux*)
# MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags.
# It appears to want none of them specified.
case "$host_os" in
darwin*) flag="" ;;
*) flag="-Wl,-rpath -Wl," ;;
esac
;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi

if test "x$USE_SHARED_LIB" != "xyes"; then
if test "x$USE_SHARED_LIB" = "xyes"; then
case "$kind" in
gcc|linux*)
# MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags.
# It appears to want none of them specified.
case "$host_os" in
darwin*) flag="" ;;
*) flag="-Wl,-rpath -Wl," ;;
esac
;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi
else
# The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static
# compile though, so change it to the static version (.a) of the library.
new_libraries=""
Expand Down
42 changes: 21 additions & 21 deletions c++/src/h5c++.in
Original file line number Diff line number Diff line change
Expand Up @@ -314,27 +314,27 @@ if test "x$do_link" = "xyes"; then
fi
link_args="$link_args -L${libdir}"

case "$kind" in
gcc|linux*)
# MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags.
# It appears to want none of them specified.
case "$host_os" in
darwin*) flag="" ;;
*) flag="-Wl,-rpath -Wl," ;;
esac
;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi

if test "x$USE_SHARED_LIB" != "xyes"; then
if test "x$USE_SHARED_LIB" = "xyes"; then
case "$kind" in
gcc|linux*)
# MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags.
# It appears to want none of them specified.
case "$host_os" in
darwin*) flag="" ;;
*) flag="-Wl,-rpath -Wl," ;;
esac
;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi
else
# The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static
# compile though, so change it to the static version (.a) of the library.
new_libraries=""
Expand Down
115 changes: 39 additions & 76 deletions config/cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -212,87 +212,54 @@ macro (HDF_FUNCTION_TEST OTHER_TEST)
endmacro ()

#-----------------------------------------------------------------------------
# Check for large file support
# Platform-specific flags
#-----------------------------------------------------------------------------

# The linux-lfs option is deprecated.
set (LINUX_LFS 0)

set (HDF_EXTRA_C_FLAGS)
set (HDF_EXTRA_FLAGS)
if (MINGW OR NOT WINDOWS)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
# Linux Specific flags
# This was originally defined as _POSIX_SOURCE which was updated to
# _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
# functionality so clock_gettime and CLOCK_MONOTONIC are defined
# correctly. This was later updated to 200112L so that
# posix_memalign() is visible for the direct VFD code on Linux
# systems.
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)

# Need to add this so that O_DIRECT is visible for the direct
# VFD on Linux systems.
set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE)

option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
mark_as_advanced (HDF_ENABLE_LARGE_FILE)
if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN)
set (msg "Performing TEST_LFS_WORKS")
try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_DIR}/HDFTests.c
COMPILE_DEFINITIONS "-DTEST_LFS_WORKS"
)

# The LARGEFILE definitions were from the transition period
# and are probably no longer needed. The FILE_OFFSET_BITS
# check should be generalized for all POSIX systems as it
# is in the Autotools.
if (TEST_LFS_WORKS_COMPILE)
if (TEST_LFS_WORKS_RUN MATCHES 0)
set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
set (LARGEFILE 1)
set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
message (VERBOSE "${msg}... yes")
else ()
set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n"
)
endif ()
else ()
set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Test TEST_LFS_WORKS Compile failed\n"
)
endif ()
endif ()
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
endif ()
endif ()
# Linux-specific flags
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
# This was originally defined as _POSIX_SOURCE which was updated to
# _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
# functionality so clock_gettime and CLOCK_MONOTONIC are defined
# correctly. This was later updated to 200112L so that
# posix_memalign() is visible for the direct VFD code on Linux
# systems. Even later, this was changed to 200809L to support
# pread/pwrite in VFDs.
#
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)

#-----------------------------------------------------------------------------
# Check for HAVE_OFF64_T functionality
#-----------------------------------------------------------------------------
if (MINGW OR NOT WINDOWS)
HDF_FUNCTION_TEST (HAVE_OFF64_T)
if (${HDF_PREFIX}_HAVE_OFF64_T)
CHECK_FUNCTION_EXISTS (lseek64 ${HDF_PREFIX}_HAVE_LSEEK64)
endif ()
# Need to add this so that O_DIRECT is visible for the direct
# VFD on Linux systems.
set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE)

CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO)
# Set up large file support. This is only necessary on 32-bit systems
# but is used on all Linux systems. It has no effect on 64-bit systems
# so it's not worth hacking up a 32/64-bit test to selectively include it.
#
# The library currently does not use any of the 64-flavored API calls
# or types
set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_LARGEFILE_SOURCE)
set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_FILE_OFFSET_BITS=64)

CHECK_STRUCT_HAS_MEMBER("struct stat64" st_blocks "sys/types.h;sys/stat.h" HAVE_STAT64_STRUCT)
if (HAVE_STAT64_STRUCT)
CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64)
endif ()
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_C_FLAGS})
endif ()

# As of 2024, both AIX and Solaris are uncommon, but still exist! The default
# compiler options are also often set to -m32, which produces 32-bit binaries.

# 32-bit AIX compiles might require _LARGE_FILES, but we don't have a system on
# which to test this (yet).
#
# https://www.ibm.com/docs/en/aix/7.1?topic=volumes-writing-programs-that-access-large-files

# 32-bit Solaris probably needs _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64,
# as in Linux, above.
#
# https://docs.oracle.com/cd/E23824_01/html/821-1474/lfcompile-5.html

#-----------------------------------------------------------------------------
# Check the size in bytes of all the int and float types
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -358,10 +325,6 @@ if (MINGW OR NOT WINDOWS)
endif ()

HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T)
HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T)
if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
set (${HDF_PREFIX}_SIZEOF_OFF64_T 0)
endif ()
HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T)

#-----------------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions config/cmake/H5pubconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,6 @@
#define H5_SIZEOF_LONG_LONG 8
#endif

/* The size of `off64_t', as computed by sizeof. */
#cmakedefine H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@

/* The size of `off_t', as computed by sizeof. */
#cmakedefine H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@

Expand Down
48 changes: 0 additions & 48 deletions config/cmake/HDFTests.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ int main ()

#endif /* DEV_T_IS_SCALAR */

#ifdef HAVE_OFF64_T

#include <sys/types.h>

int main(void)
{
off64_t n = 0;
return (int)n;
}
#endif

#ifdef TEST_DIRECT_VFD_WORKS

#include <sys/types.h>
Expand Down Expand Up @@ -138,43 +127,6 @@ main(void)
}
#endif

#ifdef TEST_LFS_WORKS

/* Return 0 when LFS is available and 1 otherwise. */

#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _LARGE_FILES
#define _FILE_OFFSET_BITS 64

#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <stdio.h>

#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))

int main(int argc, char **argv)
{

/* Check that off_t can hold 2^63 - 1 and perform basic operations... */
if (OFF_T_64 % 2147483647 != 1)
return 1;

/* stat breaks on SCO OpenServer */
struct stat buf;
stat(argv[0], &buf);
if (!S_ISREG(buf.st_mode))
return 2;

FILE *file = fopen(argv[0], "r");
off_t offset = ftello(file);
fseek(file, offset, SEEK_CUR);
fclose(file);
return 0;
}
#endif

#ifdef HAVE_IOEO

#include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/LIBAEC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ endif ()
# Compiler specific flags : Shouldn't there be compiler tests for these
#-----------------------------------------------------------------------------
if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
endif ()

#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/ZLIB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-strict-prototypes")
endif ()
if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype -Wno-implicit-function-declaration")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
endif ()

#-----------------------------------------------------------------------------
Expand Down
28 changes: 14 additions & 14 deletions fortran/src/h5fc.in
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,20 @@ if test "x$do_link" = "xyes"; then
fi
link_args="$link_args -L${libdir}"

case "$host_os" in
linux*) flag="@fortran_linux_linker_option@-rpath -Wl," ;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi

if test "x$USE_SHARED_LIB" != "xyes"; then
if test "x$USE_SHARED_LIB" = "xyes"; then
case "$host_os" in
linux*) flag="@fortran_linux_linker_option@-rpath -Wl," ;;
hpux*) flag="-Wl,+b -Wl," ;;
freebsd*|solaris*) flag="-R" ;;
rs6000*|aix*) flag="-L" ;;
sgi) flag="-rpath " ;;
*) flag="" ;;
esac

if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi
else
# The hdf5 library "-l" flags are in here already. This is a static
# compile though, so change it to the static versions (.a) of the libraries.
new_libraries=""
Expand Down
Loading

0 comments on commit 24edbcc

Please sign in to comment.