diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bac1aad30..a18b1f7bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -532,22 +532,15 @@ else() set(NETCDF_ENABLE_HDF4 OFF) endif() -# Option Logging, only valid for netcdf4. +# Option Logging, only valid for netcdf4 dispatchers. option(NETCDF_ENABLE_LOGGING "Enable Logging." OFF) if(NOT NETCDF_ENABLE_NETCDF4) -set(NETCDF_ENABLE_LOGGING OFF) -endif() -if(NETCDF_ENABLE_LOGGING) - target_compile_definitions(netcdf PRIVATE LOGGING NETCDF_ENABLE_SET_LOG_LEVEL) - set(LOGGING ON) - set(NETCDF_ENABLE_SET_LOG_LEVEL ON) -endif() -option(NETCDF_ENABLE_SET_LOG_LEVEL_FUNC "Enable definition of nc_set_log_level()." ON) -if(NETCDF_ENABLE_NETCDF4 AND NOT NETCDF_ENABLE_LOGGING AND NETCDF_ENABLE_SET_LOG_LEVEL_FUNC) - target_compile_definitions(netcdf PRIVATE -DNETCDF_ENABLE_SET_LOG_LEVEL) - set(NETCDF_ENABLE_SET_LOG_LEVEL ON) + set(NETCDF_ENABLE_LOGGING OFF) endif() +set(LOGGING ${NETCDF_ENABLE_LOGGING}) +set(NETCDF_ENABLE_SET_LOG_LEVEL ${NETCDF_ENABLE_LOGGING}) + # Option to allow for strict null file padding. # See https://github.com/Unidata/netcdf-c/issues/657 for more information option(NETCDF_ENABLE_STRICT_NULL_BYTE_HEADER_PADDING "Enable strict null byte header padding." OFF) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index be114b328d..623c0bc853 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,8 @@ This file contains a high-level description of this package's evolution. Release ## 4.9.3 - TBD +* Cleanup the option code for NETCDF_ENABLE_SET_LOG_LEVEL\[_FUNC\] See [Github #2931](https://github.com/Unidata/netcdf-c/issues/2931) for more information. +* Fix duplicate definition when using aws-sdk-cpp. See [Github #2928](https://github.com/Unidata/netcdf-c/issues/2928) for more information. * Cleanup various obsolete options and do some code refactoring. See [Github #2926](https://github.com/Unidata/netcdf-c/issues/2926) for more information. * Convert the Zarr-related ENABLE_XXX options to NETCDF_ENABLE_XXX options (part of the cmake overhaul). See [Github #2923](https://github.com/Unidata/netcdf-c/issues/2923) for more information. * Refactor macro `_FillValue` to `NC_FillValue` to avoid conflict with libc++ headers. See [Github #2858](https://github.com/Unidata/netcdf-c/issues/2858) for more information. diff --git a/config.h.cmake.in b/config.h.cmake.in index 759b13a852..a38749a920 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -475,10 +475,8 @@ with zip */ #cmakedefine LOGGING 1 /* If true, define nc_set_log_level. */ -#cmakedefine ENABLE_SET_LOG_LEVEL 1 - -/* If true, define nc_set_log_level_func */ -#cmakedefine NETCDF_ENABLE_SET_LOG_LEVEL_FUNC 1 +#cmakedefine NETCDF_ENABLE_LOGGING 1 +#cmakedefine NETCDF_ENABLE_SET_LOG_LEVEL 1 /* min blocksize for posixio. */ #cmakedefine NCIO_MINBLOCKSIZE ${NCIO_MINBLOCKSIZE} diff --git a/configure.ac b/configure.ac index 90def36716..61a4563901 100644 --- a/configure.ac +++ b/configure.ac @@ -450,17 +450,15 @@ AC_ARG_ENABLE([logging], Ignored if netCDF-4 is not enabled.])]) test "x$enable_logging" = xyes || enable_logging=no AC_MSG_RESULT([$enable_logging]) - -# Does the user want to turn off nc_set_log_level() function? (It will -# always be defined if --enable-logging is used.) -AC_MSG_CHECKING([whether nc_set_log_level() function is included (will do nothing unless enable-logging is also used)]) -AC_ARG_ENABLE([set_log_level_func], [AS_HELP_STRING([--disable-set-log-level-func], - [disable the nc_set_log_level function])]) -test "x$enable_set_log_level_func" = xno -a "x$enable_logging" = xno || enable_set_log_level_func=yes -if test "x$enable_set_log_level_func" = xyes -a "x$enable_hdf5" = xyes; then - AC_DEFINE([ENABLE_SET_LOG_LEVEL], 1, [If true, define nc_set_log_level.]) +if test "x$enable_logging" = xyes; then + enable_set_log_level_func=yes + enable_set_log_level=yes + AC_DEFINE([NETCDF_ENABLE_SET_LOG_LEVEL], 1, [If true, enable nc_set_log_level function.]) +else + enable_set_log_level_func=no + enable_set_log_level=no fi -AC_MSG_RESULT($enable_set_log_level_func) + # CURLOPT_USERNAME is not defined until curl version 7.19.1 # CURLOPT_PASSWORD is not defined until curl version 7.19.1 diff --git a/include/nc_logging.h b/include/nc_logging.h index 663e2c7b74..7d1f5f45e2 100644 --- a/include/nc_logging.h +++ b/include/nc_logging.h @@ -52,12 +52,10 @@ void nc_log(int severity, const char *fmt, ...); #define BAIL_QUIET BAIL -#ifdef USE_NETCDF4 -#ifndef ENABLE_SET_LOG_LEVEL +#ifndef NETCDF_ENABLE_SET_LOG_LEVEL /* Define away any calls to nc_set_log_level(), if its not enabled. */ #define nc_set_log_level(e) -#endif /* ENABLE_SET_LOG_LEVEL */ -#endif +#endif /* NETCDF_ENABLE_SET_LOG_LEVEL */ #endif /* LOGGING */ diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index fda731d003..f7f32c7ca8 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -1711,7 +1711,7 @@ nc4_normalize_name(const char *name, char *norm_name) return NC_NOERR; } -#ifdef ENABLE_SET_LOG_LEVEL +#ifdef NETCDF_ENABLE_SET_LOG_LEVEL /** * Initialize parallel I/O logging. For parallel I/O builds, open log @@ -1812,7 +1812,7 @@ nc_set_log_level(int new_level) return NC_NOERR; } -#endif /* ENABLE_SET_LOG_LEVEL */ +#endif /* NETCDF_ENABLE_SET_LOG_LEVEL */ #if LOGGING #define MAX_NESTS 10