mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-23 16:59:54 +08:00
Merge branch 'configure_error_out' of https://github.com/wkliao/netcdf-c into combined-pr.wif
This commit is contained in:
commit
5f29fe5eba
@ -1032,56 +1032,87 @@ IF(ENABLE_PNETCDF)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Options to enable use of fill values for elements causing NC_ERANGE
|
# Options to enable use of fill values for elements causing NC_ERANGE
|
||||||
SET(STATUS_ERANGE_FILL "OFF")
|
SET(ENABLE_ERANGE_FILL AUTO CACHE STRING "AUTO")
|
||||||
OPTION(ENABLE_ERANGE_FILL "Enable use of fill value when out-of-range type conversion causes NC_ERANGE error." OF)
|
OPTION(ENABLE_ERANGE_FILL "Enable use of fill value when out-of-range type conversion causes NC_ERANGE error." OFF)
|
||||||
IF(ENABLE_ERANGE_FILL)
|
IF(ENABLE_ERANGE_FILL) # enable or auto
|
||||||
SET(STATUS_ERANGE_FILL "ON")
|
STRING(TOUPPER ${ENABLE_ERANGE_FILL} ENABLE_ERANGE_FILL)
|
||||||
ADD_DEFINITIONS(-DERANGE_FILL)
|
IF(ENABLE_ERANGE_FILL AND NOT ENABLE_ERANGE_FILL STREQUAL "AUTO")
|
||||||
ENDIF()
|
# explicitly enabled
|
||||||
|
SET(ENABLE_ERANGE_FILL ON)
|
||||||
|
ELSE()
|
||||||
|
IF(NOT ENABLE_ERANGE_FILL STREQUAL "AUTO")
|
||||||
|
SET(ENABLE_ERANGE_FILL OFF)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF(ENABLE_ERANGE_FILL)
|
||||||
|
# Now ENABLE_ERANGE_FILL is either AUTO, ON, or OFF
|
||||||
|
|
||||||
# Options to use a more relaxed coordinate argument boundary check
|
# Options to use a more relaxed coordinate argument boundary check
|
||||||
SET(STATUS_RELAX_COORD_BOUND "OFF")
|
SET(ENABLE_ZERO_LENGTH_COORD_BOUND AUTO CACHE STRING "AUTO")
|
||||||
OPTION(ENABLE_ZERO_LENGTH_COORD_BOUND "Enable a more relaxed boundary error check NC_EINVALCOORDS to allow coordinate start argument equal to dimension size when argument count is zero." OFF)
|
OPTION(ENABLE_ZERO_LENGTH_COORD_BOUND "Enable a more relaxed boundary error check NC_EINVALCOORDS to allow coordinate start argument equal to dimension size when argument count is zero." OFF)
|
||||||
IF(ENABLE_ZERO_LENGTH_COORD_BOUND)
|
IF(ENABLE_ZERO_LENGTH_COORD_BOUND) # enable or auto
|
||||||
SET(STATUS_RELAX_COORD_BOUND "ON")
|
STRING(TOUPPER ${ENABLE_ZERO_LENGTH_COORD_BOUND} ENABLE_ZERO_LENGTH_COORD_BOUND)
|
||||||
ENDIF()
|
IF(ENABLE_ZERO_LENGTH_COORD_BOUND AND NOT ENABLE_ZERO_LENGTH_COORD_BOUND STREQUAL "AUTO")
|
||||||
|
# explicitly enabled
|
||||||
|
SET(ENABLE_ZERO_LENGTH_COORD_BOUND ON)
|
||||||
|
ELSE()
|
||||||
|
IF(NOT ENABLE_ZERO_LENGTH_COORD_BOUND STREQUAL "AUTO")
|
||||||
|
SET(ENABLE_ZERO_LENGTH_COORD_BOUND OFF)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF(ENABLE_ZERO_LENGTH_COORD_BOUND)
|
||||||
|
# Now ENABLE_ZERO_LENGTH_COORD_BOUND is either AUTO, ON, or OFF
|
||||||
|
|
||||||
# check and conform with PnetCDF settings on ERANGE_FILL and RELAX_COORD_BOUND
|
# check and conform with PnetCDF settings on ERANGE_FILL and RELAX_COORD_BOUND
|
||||||
IF(STATUS_PNETCDF)
|
IF(STATUS_PNETCDF)
|
||||||
file(STRINGS "${pnetcdf_h}" enable_erange_fill_pnetcdf REGEX "^#define PNETCDF_ERANGE_FILL")
|
file(STRINGS "${pnetcdf_h}" enable_erange_fill_pnetcdf REGEX "^#define PNETCDF_ERANGE_FILL")
|
||||||
string(REGEX REPLACE "[^0-9]" "" erange_fill_pnetcdf "${enable_erange_fill_pnetcdf}")
|
string(REGEX REPLACE "[^0-9]" "" erange_fill_pnetcdf "${enable_erange_fill_pnetcdf}")
|
||||||
IF("x${erange_fill_pnetcdf}" STREQUAL "x1")
|
IF("x${erange_fill_pnetcdf}" STREQUAL "x1")
|
||||||
IF(NOT STATUS_ERANGE_FILL)
|
SET(erange_fill_pnetcdf "ON")
|
||||||
MESSAGE(WARNING "Enable erange-fill to conform with PnetCDF setting")
|
|
||||||
SET(STATUS_ERANGE_FILL "ON")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
ELSE()
|
||||||
IF(STATUS_ERANGE_FILL)
|
SET(erange_fill_pnetcdf "OFF")
|
||||||
MESSAGE(WARNING "Disable erange-fill to conform with PnetCDF setting")
|
ENDIF()
|
||||||
SET(STATUS_ERANGE_FILL "OFF")
|
IF(ENABLE_ERANGE_FILL STREQUAL "AUTO") # not set on command line
|
||||||
|
SET(ENABLE_ERANGE_FILL "${erange_fill_pnetcdf}")
|
||||||
|
ELSE()
|
||||||
|
# user explicitly set this option on command line
|
||||||
|
IF(NOT ENABLE_ERANGE_FILL STREQUAL "${erange_fill_pnetcdf}")
|
||||||
|
IF(ENABLE_ERANGE_FILL)
|
||||||
|
MESSAGE(FATAL_ERROR "Enabling erange-fill conflicts with PnetCDF setting")
|
||||||
|
ELSE()
|
||||||
|
MESSAGE(FATAL_ERROR "Disabling erange-fill conflicts with PnetCDF setting")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
file(STRINGS "${pnetcdf_h}" relax_coord_bound_pnetcdf REGEX "^#define PNETCDF_RELAX_COORD_BOUND")
|
file(STRINGS "${pnetcdf_h}" relax_coord_bound_pnetcdf REGEX "^#define PNETCDF_RELAX_COORD_BOUND")
|
||||||
string(REGEX REPLACE "[^0-9]" "" relax_coord_bound "${relax_coord_bound_pnetcdf}")
|
string(REGEX REPLACE "[^0-9]" "" relax_coord_bound "${relax_coord_bound_pnetcdf}")
|
||||||
IF("x${relax_coord_bound}" STREQUAL "x1")
|
IF("x${relax_coord_bound}" STREQUAL "x1")
|
||||||
IF(NOT STATUS_RELAX_COORD_BOUND)
|
SET(relax_coord_bound_pnetcdf "ON")
|
||||||
MESSAGE(WARNING "Enable relax-coord-bound to conform with PnetCDF setting")
|
|
||||||
SET(STATUS_RELAX_COORD_BOUND "ON")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
ELSE()
|
||||||
IF(STATUS_RELAX_COORD_BOUND)
|
SET(relax_coord_bound_pnetcdf "OFF")
|
||||||
MESSAGE(WARNING "Disable relax-coord-bound to conform with PnetCDF setting")
|
ENDIF()
|
||||||
SET(STATUS_RELAX_COORD_BOUND "OFF")
|
IF(ENABLE_ZERO_LENGTH_COORD_BOUND STREQUAL "AUTO") # not set on command line
|
||||||
|
SET(ENABLE_ZERO_LENGTH_COORD_BOUND "${relax_coord_bound_pnetcdf}")
|
||||||
|
ELSE()
|
||||||
|
# user explicitly set this option on command line
|
||||||
|
IF(NOT ENABLE_ZERO_LENGTH_COORD_BOUND STREQUAL "${relax_coord_bound_pnetcdf}")
|
||||||
|
IF(ENABLE_ZERO_LENGTH_COORD_BOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "Enabling relax-coord-bound conflicts with PnetCDF setting")
|
||||||
|
ELSE()
|
||||||
|
MESSAGE(FATAL_ERROR "Disabling relax-coord-bound conflicts with PnetCDF setting")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(STATUS_ERANGE_FILL)
|
IF(ENABLE_ERANGE_FILL)
|
||||||
|
MESSAGE(STATUS "Enabling use of fill value when NC_ERANGE")
|
||||||
SET(M4FLAGS "-DERANGE_FILL" CACHE STRING "")
|
SET(M4FLAGS "-DERANGE_FILL" CACHE STRING "")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(STATUS_RELAX_COORD_BOUND)
|
IF(ENABLE_ZERO_LENGTH_COORD_BOUND)
|
||||||
MESSAGE(STATUS "Enabling a more relatexed check for NC_EINVALCOORDS")
|
MESSAGE(STATUS "Enabling a more relatexed check when NC_EINVALCOORDS")
|
||||||
ADD_DEFINITIONS(-DRELAX_COORD_BOUND)
|
ADD_DEFINITIONS(-DRELAX_COORD_BOUND)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -1887,7 +1918,7 @@ is_enabled(ENABLE_DAP4 HAS_DAP4)
|
|||||||
is_enabled(ENABLE_DISKLESS HAS_DISKLESS)
|
is_enabled(ENABLE_DISKLESS HAS_DISKLESS)
|
||||||
is_enabled(USE_MMAP HAS_MMAP)
|
is_enabled(USE_MMAP HAS_MMAP)
|
||||||
is_enabled(JNA HAS_JNA)
|
is_enabled(JNA HAS_JNA)
|
||||||
is_enabled(STATUS_RELAX_COORD_BOUND RELAX_COORD_BOUND)
|
is_enabled(ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND)
|
||||||
is_enabled(USE_CDF5 HAS_CDF5)
|
is_enabled(USE_CDF5 HAS_CDF5)
|
||||||
is_enabled(ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
|
is_enabled(ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
|
||||||
|
|
||||||
|
80
configure.ac
80
configure.ac
@ -1148,15 +1148,15 @@ AC_ARG_ENABLE([erange_fill],
|
|||||||
[AS_HELP_STRING([--enable-erange-fill],
|
[AS_HELP_STRING([--enable-erange-fill],
|
||||||
[Enable use of fill value when out-of-range type
|
[Enable use of fill value when out-of-range type
|
||||||
conversion causes NC_ERANGE error. @<:@default: disabled@:>@])],
|
conversion causes NC_ERANGE error. @<:@default: disabled@:>@])],
|
||||||
[enable_erange_fill=${enableval}], [enable_erange_fill=no]
|
[enable_erange_fill=${enableval}], [enable_erange_fill=auto]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE([zero-length-coord-bound],
|
AC_ARG_ENABLE([zero-length-coord-bound],
|
||||||
[AS_HELP_STRING([--enable-zero-length-coord-bound],
|
[AS_HELP_STRING([--disable-zero-length-coord-bound],
|
||||||
[Enable a more relaxed boundary error check NC_EINVALCOORDS
|
[Disable a more relaxed boundary error check NC_EINVALCOORDS
|
||||||
to allow coordinate start argument equal to dimension size
|
to allow coordinate start argument equal to dimension size
|
||||||
when argument count is zero. @<:@default: disabled@:>@])],
|
when argument count is zero. @<:@default: enabled@:>@])],
|
||||||
[enable_zero_length_coord_bound=${enableval}], [enable_zero_length_coord_bound=no]
|
[enable_zero_length_coord_bound=${enableval}], [enable_zero_length_coord_bound=auto]
|
||||||
)
|
)
|
||||||
|
|
||||||
# check PnetCDF's settings on enable_erange_fill and relax_coord_bound
|
# check PnetCDF's settings on enable_erange_fill and relax_coord_bound
|
||||||
@ -1164,48 +1164,46 @@ if test "x$enable_pnetcdf" = xyes; then
|
|||||||
UD_CHECK_HEADER_PATH([pnetcdf.h])
|
UD_CHECK_HEADER_PATH([pnetcdf.h])
|
||||||
|
|
||||||
AC_MSG_CHECKING([if erange-fill is enabled in PnetCDF])
|
AC_MSG_CHECKING([if erange-fill is enabled in PnetCDF])
|
||||||
erange_fill_pnetcdf=`grep PNETCDF_ERANGE_FILL ${ac_cv_header_path_pnetcdf_h}`
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
|
||||||
if test "x$erange_fill_pnetcdf" = x; then
|
#include <pnetcdf.h>
|
||||||
erange_fill_pnetcdf=no
|
#if !defined(PNETCDF_ERANGE_FILL) || PNETCDF_ERANGE_FILL == 0
|
||||||
else
|
choke me
|
||||||
erange_fill_pnetcdf=`echo ${erange_fill_pnetcdf} | cut -d' ' -f3`
|
#endif]])], [enable_erange_fill_pnetcdf=yes], [enable_erange_fill_pnetcdf=no])
|
||||||
if test "x$erange_fill_pnetcdf" = x0; then
|
|
||||||
enable_erange_fill_pnetcdf=no
|
|
||||||
else
|
|
||||||
enable_erange_fill_pnetcdf=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$enable_erange_fill_pnetcdf])
|
AC_MSG_RESULT([$enable_erange_fill_pnetcdf])
|
||||||
if test "$enable_erange_fill" != "$enable_erange_fill_pnetcdf"; then
|
if test "x$enable_erange_fill" = xauto ; then
|
||||||
if test "$enable_erange_fill_pnetcdf" = yes; then
|
|
||||||
AC_MSG_WARN([Enable erange-fill to conform with PnetCDF setting])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([Disable erange-fill to conform with PnetCDF setting])
|
|
||||||
fi
|
|
||||||
enable_erange_fill=$enable_erange_fill_pnetcdf
|
enable_erange_fill=$enable_erange_fill_pnetcdf
|
||||||
|
elif test "$enable_erange_fill" != "$enable_erange_fill_pnetcdf"; then
|
||||||
|
if test "$enable_erange_fill" = yes; then
|
||||||
|
AC_MSG_ERROR([Enabling erange-fill conflicts with PnetCDF setting])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([Disabling erange-fill conflicts with PnetCDF setting])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([if relax-coord-bound is enabled in PnetCDF])
|
AC_MSG_CHECKING([if relax-coord-bound is enabled in PnetCDF])
|
||||||
relax_coord_bound_pnetcdf=`grep PNETCDF_RELAX_COORD_BOUND ${ac_cv_header_path_pnetcdf_h}`
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
|
||||||
if test "x$relax_coord_bound_pnetcdf" = x; then
|
#include <pnetcdf.h>
|
||||||
elax_coord_bound_pnetcdf=no
|
#if !defined(PNETCDF_RELAX_COORD_BOUND) || PNETCDF_RELAX_COORD_BOUND == 0
|
||||||
else
|
choke me
|
||||||
coord_bound_pnetcdf=`echo ${relax_coord_bound_pnetcdf} | cut -d' ' -f3`
|
#endif]])], [relax_coord_bound_pnetcdf=yes], [relax_coord_bound_pnetcdf=no])
|
||||||
if test "x$coord_bound_pnetcdf" = x0; then
|
|
||||||
relax_coord_bound_pnetcdf=no
|
|
||||||
else
|
|
||||||
relax_coord_bound_pnetcdf=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$relax_coord_bound_pnetcdf])
|
AC_MSG_RESULT([$relax_coord_bound_pnetcdf])
|
||||||
if test "$enable_zero_length_coord_bound" != "$relax_coord_bound_pnetcdf"; then
|
if test "x$enable_zero_length_coord_bound" = xauto ; then
|
||||||
if test "$relax_coord_bound_pnetcdf" = yes; then
|
|
||||||
AC_MSG_WARN([Enable relax-coord-bound to conform with PnetCDF setting])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([Disable relax-coord-bound to conform with PnetCDF setting])
|
|
||||||
fi
|
|
||||||
enable_zero_length_coord_bound=$relax_coord_bound_pnetcdf
|
enable_zero_length_coord_bound=$relax_coord_bound_pnetcdf
|
||||||
|
elif test "$enable_zero_length_coord_bound" != "$relax_coord_bound_pnetcdf"; then
|
||||||
|
if test "$enable_zero_length_coord_bound" = yes; then
|
||||||
|
AC_MSG_ERROR([Enabling relax-coord-bound conflicts with PnetCDF setting])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([Disabling relax-coord-bound conflicts with PnetCDF setting])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# default setting
|
||||||
|
enable_erange_fill=no
|
||||||
|
enable_zero_length_coord_bound=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_zero_length_coord_bound" = xyes; then
|
||||||
|
AC_DEFINE([RELAX_COORD_BOUND], [1], [if true, NC_EINVALCOORDS check is more relaxed])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$enable_erange_fill" = xyes ; then
|
if test "x$enable_erange_fill" = xyes ; then
|
||||||
@ -1218,10 +1216,6 @@ if test "x$enable_erange_fill" = xyes ; then
|
|||||||
fi
|
fi
|
||||||
AC_SUBST(M4FLAGS)
|
AC_SUBST(M4FLAGS)
|
||||||
|
|
||||||
if test "x$enable_zero_length_coord_bound" = xyes; then
|
|
||||||
AC_DEFINE([RELAX_COORD_BOUND], [1], [if true, NC_EINVALCOORDS check is more relaxed])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for downloading/building fortran via postinstall script.
|
# Check for downloading/building fortran via postinstall script.
|
||||||
if test "x$enable_remote_fortran_bootstrap" = xyes; then
|
if test "x$enable_remote_fortran_bootstrap" = xyes; then
|
||||||
AC_DEFINE([BUILD_FORTRAN], 1, [If true, will attempt to download and build netcdf-fortran.])
|
AC_DEFINE([BUILD_FORTRAN], 1, [If true, will attempt to download and build netcdf-fortran.])
|
||||||
|
@ -36,3 +36,4 @@ MMap Support: @HAS_MMAP@
|
|||||||
JNA Support: @HAS_JNA@
|
JNA Support: @HAS_JNA@
|
||||||
CDF5 Support: @HAS_CDF5@
|
CDF5 Support: @HAS_CDF5@
|
||||||
ERANGE fill Support: @HAS_ERANGE_FILL@
|
ERANGE fill Support: @HAS_ERANGE_FILL@
|
||||||
|
relaxed boundary check: @RELAX_COORD_BOUND@
|
||||||
|
Loading…
Reference in New Issue
Block a user