Add configure options for disabling extension features (#4277)

Add configure option to enable or disable extension features in general

Add configure option to enable or disable _Float16 support

Add new config options to various settings files
This commit is contained in:
jhendersonHDF 2024-03-31 22:45:50 -05:00 committed by GitHub
parent ce53bc020d
commit dc69e39f65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 263 additions and 155 deletions

View File

@ -871,13 +871,28 @@ H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT TRUE "Checking IF corr
#-----------------------------------------------------------------------------
H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV FALSE "Checking IF the cpu is power9 and cannot correctly converting long double values")
#-----------------------------------------------------------------------------
# Options for enabling/disabling support for non-standard features, datatypes,
# etc. These features should still be checked for at configure time, but these
# options allow disabling of support for these features when compiler support
# is incomplete or broken. In this case, configure time checks may not be
# enough to properly enable/disable a feature and can cause library build
# problems.
#-----------------------------------------------------------------------------
# Option to enable or disable all non-standard features. Specific features can
# be enabled or disabled with their respective options below
option (HDF5_ENABLE_NONSTANDARD_FEATURES "Enable support for non-standard programming language features" ON)
# Options for enabling or disabling individual features
option (HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16 "Enable support for _Float16 C datatype" ${HDF5_ENABLE_NONSTANDARD_FEATURES})
#-----------------------------------------------------------------------------
# Check if _Float16 type is available
#-----------------------------------------------------------------------------
message (STATUS "Checking if _Float16 support is available")
set (${HDF_PREFIX}_HAVE__FLOAT16 0)
HDF_CHECK_TYPE_SIZE (_Float16 ${HDF_PREFIX}_SIZEOF__FLOAT16)
if (${HDF_PREFIX}_SIZEOF__FLOAT16)
if (HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16)
message (STATUS "Checking if _Float16 support is available")
HDF_CHECK_TYPE_SIZE (_Float16 ${HDF_PREFIX}_SIZEOF__FLOAT16)
if (${HDF_PREFIX}_SIZEOF__FLOAT16)
# Request _Float16 support
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} "-D__STDC_WANT_IEC_60559_TYPES_EXT__")
@ -959,6 +974,11 @@ if (${HDF_PREFIX}_SIZEOF__FLOAT16)
else ()
message (STATUS "_Float16 support has been disabled since the required macros (FLT16_MAX, FLT16_EPSILON, etc. were not found)")
endif ()
else ()
else ()
message (STATUS "_Float16 support has been disabled since the _Float16 type was not found")
endif ()
else ()
set (${HDF_PREFIX}_SIZEOF__FLOAT16 0 CACHE INTERNAL "SizeOf for ${HDF_PREFIX}_SIZEOF__FLOAT16")
unset (${HDF_PREFIX}_HAVE__FLOAT16 CACHE)
unset (${HDF_PREFIX}_LDOUBLE_TO_FLOAT16_CORRECT CACHE)
endif ()

View File

@ -54,6 +54,8 @@ set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
set (${HDF5_PACKAGE_NAME}_BUILD_HL_GIF_TOOLS @HDF5_BUILD_HL_GIF_TOOLS@)
set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_TOOLS @HDF5_BUILD_STATIC_TOOLS@)
#-----------------------------------------------------------------------------
set (${HDF5_PACKAGE_NAME}_ENABLE_NONSTANDARD_FEATURE_FLOAT16 @HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16@)
#-----------------------------------------------------------------------------
set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@)
set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@)
set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@)

View File

@ -78,6 +78,7 @@ Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@
Default API mapping: @DEFAULT_API_VERSION@
With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
_Float16 support: @HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16@
Map (H5M) API: @H5_HAVE_MAP_API@
Direct VFD: @HDF5_ENABLE_DIRECT_VFD@
Mirror VFD: @H5_HAVE_MIRROR_VFD@

View File

@ -574,13 +574,62 @@ AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
#-----------------------------------------------------------------------------
# Option for enabling/disabling support for non-standard features, datatypes,
# etc. These features should still be checked for at configure time, but these
# options allow disabling of support for these features when compiler support
# is incomplete or broken. In this case, configure time checks may not be
# enough to properly enable/disable a feature and can cause library build
# problems.
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([if non-standard feature support is enabled])
AC_ARG_ENABLE([nonstandard-features],
[AS_HELP_STRING([--enable-nonstandard-features],
[Enable support for non-standard programming language features [default=yes]])],
[NONSTANDARD_FEATURES=$enableval])
## Set default
if test "X-$NONSTANDARD_FEATURES" = X- ; then
NONSTANDARD_FEATURES=yes
fi
case "X-$NONSTANDARD_FEATURES" in
X-yes|X-no)
AC_MSG_RESULT([$NONSTANDARD_FEATURES])
;;
*)
AC_MSG_ERROR([Unrecognized value: $NONSTANDARD_FEATURES])
;;
esac
## ----------------------------------------------------------------------
## Check if _Float16 support is available
##
AC_MSG_NOTICE([checking if _Float16 support is available])
AC_MSG_CHECKING([if _Float16 support is enabled])
AC_ARG_ENABLE([nonstandard-feature-float16],
[AS_HELP_STRING([--enable-nonstandard-feature-float16],
[Enable support for _Float16 C datatype [default=yes]])],
[ENABLE_FLOAT16=$enableval])
## Set default
if test "X-$ENABLE_FLOAT16" = X- ; then
ENABLE_FLOAT16=$NONSTANDARD_FEATURES
fi
case "X-$ENABLE_FLOAT16" in
X-yes|X-no)
AC_MSG_RESULT([$ENABLE_FLOAT16])
;;
*)
AC_MSG_ERROR([Unrecognized value: $ENABLE_FLOAT16])
;;
esac
HAVE__FLOAT16="no"
AC_CHECK_SIZEOF([_Float16])
if test "$ac_cv_sizeof__Float16" != 0; then
if test "X$ENABLE_FLOAT16" = "Xyes"; then
AC_MSG_NOTICE([checking if _Float16 support is available])
AC_CHECK_SIZEOF([_Float16])
if test "$ac_cv_sizeof__Float16" != 0; then
# Some compilers expose the _Float16 datatype, but not the macros and
# functions used with the datatype. We need the macros for proper
# datatype conversion support. Check for these here.
@ -672,6 +721,9 @@ if test "$ac_cv_sizeof__Float16" != 0; then
AC_MSG_CHECKING([if _Float16 support is enabled])
AC_MSG_RESULT([$HAVE__FLOAT16])
fi
else
AC_DEFINE([SIZEOF__FLOAT16], [0])
fi
# Define HAVE__FLOAT16 value to substitute into other files for conditional testing

View File

@ -47,6 +47,36 @@ New Features
Configuration:
-------------
- Added configure options for enabling/disabling non-standard programming
language features
* Added a new configuration option that allows enabling or disabling of
support for features that are extensions to programming languages, such
as support for the _Float16 datatype:
CMake: HDF5_ENABLE_NONSTANDARD_FEATURES (ON/OFF) (Default: ON)
Autotools: --enable-nonstandard-features (yes/no) (Default: yes)
When this option is enabled, configure time checks are still performed
to ensure that a feature can be used properly, but these checks may not
be sufficient when compiler support for a feature is incomplete or broken,
resulting in library build failures. When set to OFF/no, this option
provides a way to disable support for all non-standard features to avoid
these issues. Individual features can still be re-enabled with their
respective configuration options.
* Added a new configuration option that allows enabling or disabling of
support for the _Float16 C datatype:
CMake: HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16 (ON/OFF) (Default: ON)
Autotools: --enable-nonstandard-feature-float16 (yes/no) (Default: yes)
While support for the _Float16 C datatype can generally be detected and
used properly, some compilers have incomplete support for the datatype
and will pass configure time checks while still failing to build HDF5.
This option provides a way to disable support for the _Float16 datatype
when the compiler doesn't have the proper support for it.
- Deprecate bin/cmakehdf5 script
With the improvements made in CMake since version 3.23 and the addition

View File

@ -99,6 +99,7 @@ const char H5build_settings[]=
" Default API mapping: @DEFAULT_API_VERSION@\n"
" With deprecated public symbols: @DEPRECATED_SYMBOLS@\n"
" I/O filters (external): @EXTERNAL_FILTERS@\n"
" _Float16 support: @HAVE__FLOAT16@\n"
" Map (H5M) API: @MAP_API@\n"
" Direct VFD: @DIRECT_VFD@\n"
" Mirror VFD: @MIRROR_VFD@\n"

View File

@ -98,6 +98,7 @@ const char H5build_settings[]=
" Default API mapping: @DEFAULT_API_VERSION@\n"
" With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@\n"
" I/O filters (external): @EXTERNAL_FILTERS@\n"
" _Float16 support: @HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16@\n"
" Map (H5M) API: @H5_HAVE_MAP_API@\n"
" Direct VFD: @H5_HAVE_DIRECT@\n"
" Mirror VFD: @H5_HAVE_MIRROR_VFD@\n"

View File

@ -80,6 +80,7 @@ Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@
Default API mapping: @DEFAULT_API_VERSION@
With deprecated public symbols: @DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
_Float16 support: @HAVE__FLOAT16@
Map (H5M) API: @MAP_API@
Direct VFD: @DIRECT_VFD@
Mirror VFD: @MIRROR_VFD@