Skip to content

Commit

Permalink
Replace ENABLE_S3 with NETCDF_ENABLE_S3
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Mar 18, 2024
1 parent 78fb3dc commit 8fd6dcb
Show file tree
Hide file tree
Showing 31 changed files with 108 additions and 108 deletions.
58 changes: 29 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,13 @@ if(NOT WIN32)
endif()

# Options for S3 Support
option(ENABLE_S3 "Enable S3 support." OFF)
option(ENABLE_S3_INTERNAL "Enable S3 Internal support." OFF)
option(NETCDF_ENABLE_NCZARR_S3 "Enable NCZarr S3 support; Deprecated in favor of ENABLE_S3" OFF)
option(NETCDF_ENABLE_S3 "Enable S3 support." OFF)
option(NETCDF_ENABLE_S3_INTERNAL "Enable S3 Internal support." OFF)
option(NETCDF_ENABLE_NCZARR_S3 "Enable NCZarr S3 support; Deprecated in favor of NETCDF_ENABLE_S3" OFF)

if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
set(ENABLE_S3 OFF CACHE BOOL "" FORCE)
set(ENABLE_S3_INTERNAL OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_S3 OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_S3_INTERNAL OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_NCZARR_S3 OFF CACHE BOOL "" FORCE)
endif()

Expand All @@ -703,34 +703,34 @@ if(WITH_S3_TESTING)
message(WARNING "**** DO NOT USE WITH_S3_TESTING=ON UNLESS YOU HAVE ACCESS TO THE UNIDATA S3 BUCKET! ***")
endif()

# NETCDF_ENABLE_NCZARR_S3 is now an alias for ENABLE_S3 (but...)
if (NOT ENABLE_S3 AND NETCDF_ENABLE_NCZARR_S3)
set(ENABLE_S3 ON CACHE BOOL "NCARR S3" FORCE) # For back compatibility
# NETCDF_ENABLE_NCZARR_S3 is now an alias for NETCDF_ENABLE_S3 (but...)
if (NOT NETCDF_ENABLE_S3 AND NETCDF_ENABLE_NCZARR_S3)
set(NETCDF_ENABLE_S3 ON CACHE BOOL "NCARR S3" FORCE) # For back compatibility
endif()
unset(NETCDF_ENABLE_NCZARR_S3)

if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => disable all s3 functionality")
set(ENABLE_S3 OFF CACHE BOOL "" FORCE)
set(ENABLE_S3_INTERNAL OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_S3 OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_S3_INTERNAL OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_NCZARR_S3 OFF CACHE BOOL "" FORCE)
set(NETCDF_ENABLE_HDF5_ROS3 OFF CACHE BOOL "Use ROS3" FORCE)
set(WITH_S3_TESTING OFF CACHE STRING "" FORCE)
endif()


if(ENABLE_S3)
if(NOT ENABLE_S3_AWS AND NOT ENABLE_S3_INTERNAL)
message(FATAL_ERROR "S3 support library not found; please specify option -DENABLE_S3=NO")
set(ENABLE_S3 OFF CACHE BOOL "S3 support" FORCE)
if(NETCDF_ENABLE_S3)
if(NOT NETCDF_ENABLE_S3_AWS AND NOT NETCDF_ENABLE_S3_INTERNAL)
message(FATAL_ERROR "S3 support library not found; please specify option -DNETCDF_ENABLE_S3=NO")
set(NETCDF_ENABLE_S3 OFF CACHE BOOL "S3 support" FORCE)
endif()
if(ENABLE_S3_AWS AND ENABLE_S3_INTERNAL)
if(NETCDF_ENABLE_S3_AWS AND NETCDF_ENABLE_S3_INTERNAL)
message(WARNING "Both aws-sdk-cpp and s3-internal enabled => use s3-internal")
set(ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
set(NETCDF_ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
endif()
endif()

if(NOT ENABLE_S3)
if(NOT NETCDF_ENABLE_S3)
if(WITH_S3_TESTING STREQUAL "PUBLIC" OR WITH_S3_TESTING)
message(WARNING "S3 support is disabled => WITH_S3_TESTING=OFF")
set(WITH_S3_TESTING OFF CACHE STRING "" FORCE)
Expand Down Expand Up @@ -1399,7 +1399,7 @@ if(NETCDF_ENABLE_DAP4)
add_subdirectory(libdap4)
add_subdirectory(libncxml)
else()
if(ENABLE_S3_INTERNAL)
if(NETCDF_ENABLE_S3_INTERNAL)
add_subdirectory(libncxml)
endif()
endif()
Expand Down Expand Up @@ -1639,9 +1639,9 @@ is_enabled(ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND)
is_enabled(USE_CDF5 HAS_CDF5)
is_enabled(NETCDF_ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
is_enabled(HDF5_HAS_PAR_FILTERS HAS_PAR_FILTERS)
is_enabled(ENABLE_S3 HAS_S3)
is_enabled(ENABLE_S3_AWS HAS_S3_AWS)
is_enabled(ENABLE_S3_INTERNAL HAS_S3_INTERNAL)
is_enabled(NETCDF_ENABLE_S3 HAS_S3)
is_enabled(NETCDF_ENABLE_S3_AWS HAS_S3_AWS)
is_enabled(NETCDF_ENABLE_S3_INTERNAL HAS_S3_INTERNAL)
is_enabled(HAS_HDF5_ROS3 HAS_HDF5_ROS3)
is_enabled(NETCDF_ENABLE_NCZARR HAS_NCZARR)
is_enabled(NETCDF_ENABLE_NCZARR_ZIP HAS_NCZARR_ZIP)
Expand All @@ -1656,10 +1656,10 @@ is_enabled(HAVE_BLOSC HAS_BLOSC)
is_enabled(HAVE_BZ2 HAS_BZ2)
is_enabled(NETCDF_ENABLE_REMOTE_FUNCTIONALITY DO_REMOTE_FUNCTIONALITY)

if(ENABLE_S3_INTERNAL)
if(NETCDF_ENABLE_S3_INTERNAL)
set(WHICH_S3_SDK "internal")
set(NC_WHICH_S3_SDK "internal")
elseif(ENABLE_S3_AWS)
elseif(NETCDF_ENABLE_S3_AWS)
set(WHICH_S3_SDK "aws-sdk-cpp")
set(NC_WHICH_S3_SDK "aws-sdk-cpp")
else()
Expand All @@ -1668,14 +1668,14 @@ else()
endif()

if(WITH_S3_TESTING STREQUAL PUBLIC)
set(ENABLE_S3_TESTING "public")
set(NETCDF_ENABLE_S3_TESTING "public")
elseif(WITH_S3_TESTING)
set(ENABLE_S3_TESTING "yes")
set(ENABLE_S3_TESTALL "yes")
set(NETCDF_ENABLE_S3_TESTING "yes")
set(NETCDF_ENABLE_S3_TESTALL "yes")
elseif(NOT WITH_S3_TESTING)
set(ENABLE_S3_TESTING "no")
set(NETCDF_ENABLE_S3_TESTING "no")
else()
set(ENABLE_S3_TESTING "no")
set(NETCDF_ENABLE_S3_TESTING "no")
endif()

# The Unidata testing S3 bucket
Expand All @@ -1687,7 +1687,7 @@ set(S3TESTBUCKET "unidata-zarr-test-data" CACHE STRING "S3 test bucket")
set(S3TESTSUBTREE "netcdf-c" CACHE STRING "Working S3 path.")
# Build a unique id based on the date
string(TIMESTAMP TESTUID "%s")
if(ENABLE_S3_TESTING)
if(NETCDF_ENABLE_S3_TESTING)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/s3cleanup_${PLATFORMUID}.uids" "${TESTUID}\n")
endif()

Expand Down
8 changes: 4 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ NCDAP4TESTDIR = dap4_test
XML = libncxml
endif #DAP4

if ENABLE_S3_INTERNAL
if NETCDF_ENABLE_S3_INTERNAL
XML = libncxml # Internal S3 requires XML
endif #ENABLE_S3_INTERNAL
endif #NETCDF_ENABLE_S3_INTERNAL

# Build PnetCDF
if USE_PNETCDF
Expand Down Expand Up @@ -210,15 +210,15 @@ install-data-hook:
# Also track the S3 cleanup id
all-local: liblib/libnetcdf.la
echo ${PACKAGE_VERSION} > VERSION
if ENABLE_S3_TESTALL
if NETCDF_ENABLE_S3_TESTALL
rm -f ${abs_top_builddir}/tmp_@[email protected]
echo "@TESTUID@" >> ${abs_top_builddir}/s3cleanup_@[email protected]
cat ${abs_top_builddir}/s3cleanup_@[email protected] | sort | uniq > ${abs_top_builddir}/tmp_@[email protected]
rm -f ${abs_top_builddir}/s3cleanup_@[email protected]
mv ${abs_top_builddir}/tmp_@[email protected] ${abs_top_builddir}/s3cleanup_@[email protected]
endif

if ENABLE_S3_TESTALL
if NETCDF_ENABLE_S3_TESTALL
distclean-local:
rm -f ${abs_top_builddir}/s3cleanup_@[email protected]
endif
Expand Down
14 changes: 7 additions & 7 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -395,20 +395,20 @@ endif ()
# Note we check for the library after checking for enable_s3
# because for some reason this screws up if we unconditionally test for sdk
# and it is not available. Fix someday
if(ENABLE_S3)
if(NOT ENABLE_S3_INTERNAL)
if(NETCDF_ENABLE_S3)
if(NOT NETCDF_ENABLE_S3_INTERNAL)
# See if aws-s3-sdk is available
find_package(AWSSDK REQUIRED COMPONENTS s3;transfer)
if(AWSSDK_FOUND)
set(ENABLE_S3_AWS ON CACHE BOOL "S3 AWS" FORCE)
set(NETCDF_ENABLE_S3_AWS ON CACHE BOOL "S3 AWS" FORCE)
target_include_directories(netcdf
PRIVATE
${AWSSDK_INCLUDE_DIR}
)
else(AWSSDK_FOUND)
set(ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
set(NETCDF_ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
endif(AWSSDK_FOUND)
else(NOT ENABLE_S3_INTERNAL)
else(NOT NETCDF_ENABLE_S3_INTERNAL)
# Find crypto libraries required with testing with the internal s3 api.
#find_library(SSL_LIB NAMES ssl openssl)
find_package(OpenSSL REQUIRED)
Expand All @@ -421,9 +421,9 @@ if(ENABLE_S3)
# message(FATAL_ERROR "Can't find a crypto library, required by S3_INTERNAL")
#endif(NOT CRYPTO_LIB)

endif(NOT ENABLE_S3_INTERNAL)
endif(NOT NETCDF_ENABLE_S3_INTERNAL)
else()
set(ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
set(NETCDF_ENABLE_S3_AWS OFF CACHE BOOL "S3 AWS" FORCE)
endif()

################################
Expand Down
6 changes: 3 additions & 3 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ are set when opening a binary file on Windows. */
#cmakedefine NETCDF_ENABLE_PLUGINS 1

/* if true, enable S3 support */
#cmakedefine ENABLE_S3 1
#cmakedefine NETCDF_ENABLE_S3 1

/* if true, AWS S3 SDK is available */
#cmakedefine ENABLE_S3_AWS 1
#cmakedefine NETCDF_ENABLE_S3_AWS 1

/* if true, Force use of S3 internal library */
#cmakedefine ENABLE_S3_INTERNAL 1
#cmakedefine NETCDF_ENABLE_S3_INTERNAL 1

/* if true, enable S3 testing*/
#cmakedefine WITH_S3_TESTING "PUBLIC"
Expand Down
20 changes: 10 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -969,23 +969,23 @@ else
fi

if test "x$enable_s3" = xyes ; then
AC_DEFINE([ENABLE_S3], [1], [if true, build netcdf-c with S3 support enabled])
AC_DEFINE([NETCDF_ENABLE_S3], [1], [if true, build netcdf-c with S3 support enabled])
fi

if test "x$enable_s3_aws" = xyes ; then
LIBS="$LIBS$S3LIBS"
AC_DEFINE([ENABLE_S3_AWS], [1], [If true, then use aws S3 library])
AC_DEFINE([NETCDF_ENABLE_S3_AWS], [1], [If true, then use aws S3 library])
fi

if test "x$enable_s3_internal" = xyes ; then
AC_DEFINE([ENABLE_S3_INTERNAL], [1], [If true, then use internal S3 library])
AC_DEFINE([NETCDF_ENABLE_S3_INTERNAL], [1], [If true, then use internal S3 library])
fi

AC_DEFINE_UNQUOTED([WITH_S3_TESTING], [$with_s3_testing], [control S3 testing.])

if test "x$with_s3_testing" = xyes ; then
AC_MSG_WARN([*** DO NOT SPECIFY WITH_S3_TESTING=YES UNLESS YOU HAVE ACCESS TO THE UNIDATA S3 BUCKET! ***])
AC_DEFINE([ENABLE_S3_TESTALL], [yes], [control S3 testing.])
AC_DEFINE([NETCDF_ENABLE_S3_TESTALL], [yes], [control S3 testing.])
fi
fi

Expand Down Expand Up @@ -1930,12 +1930,12 @@ AM_CONDITIONAL(NETCDF_ENABLE_BYTERANGE, [test "x$enable_byterange" = xyes])
AM_CONDITIONAL(RELAX_COORD_BOUND, [test "xyes" = xyes])
AM_CONDITIONAL(HAS_PAR_FILTERS, [test x$hdf5_supports_par_filters = xyes ])
# We need to simplify the set of S3 and Zarr flag combinations
AM_CONDITIONAL(ENABLE_S3, [test "x$enable_s3" = xyes])
AM_CONDITIONAL(ENABLE_S3_AWS, [test "x$enable_s3_aws" = xyes])
AM_CONDITIONAL(ENABLE_S3_INTERNAL, [test "x$enable_s3_internal" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_S3, [test "x$enable_s3" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_S3_AWS, [test "x$enable_s3_aws" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_S3_INTERNAL, [test "x$enable_s3_internal" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_NCZARR, [test "x$enable_nczarr" = xyes])
AM_CONDITIONAL(ENABLE_S3_TESTPUB, [test "x$with_s3_testing" != xno]) # all => public
AM_CONDITIONAL(ENABLE_S3_TESTALL, [test "x$with_s3_testing" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_S3_TESTPUB, [test "x$with_s3_testing" != xno]) # all => public
AM_CONDITIONAL(NETCDF_ENABLE_S3_TESTALL, [test "x$with_s3_testing" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_NCZARR_ZIP, [test "x$enable_nczarr_zip" = xyes])
AM_CONDITIONAL(HAVE_DEFLATE, [test "x$have_deflate" = xyes])
AM_CONDITIONAL(HAVE_SZ, [test "x$have_sz" = xyes])
Expand Down Expand Up @@ -2045,7 +2045,7 @@ AC_SUBST(HAS_S3_AWS,[$enable_s3_aws])
AC_SUBST(HAS_S3_INTERNAL,[$enable_s3_internal])
AC_SUBST(HAS_HDF5_ROS3,[$has_hdf5_ros3])
AC_SUBST(HAS_NCZARR,[$enable_nczarr])
AC_SUBST(ENABLE_S3_TESTING,[$with_s3_testing])
AC_SUBST(NETCDF_ENABLE_S3_TESTING,[$with_s3_testing])
AC_SUBST(HAS_NCZARR_ZIP,[$enable_nczarr_zip])
AC_SUBST(DO_NCZARR_ZIP_TESTS,[$enable_nczarr_zip])
AC_SUBST(HAS_QUANTIZE,[$enable_quantize])
Expand Down
6 changes: 3 additions & 3 deletions docs/cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ Note also that if S3 support is enabled, then you need to have a C++ compiler in

The necessary CMake flags are as follows (with defaults)

1. *-DENABLE_S3* -- Controll S3 support
2. *-DENABLE_S3_INTERNAL* -- Force use of the *nch5s3comms* SDK instead of the *aws-cpp-sdk*.
1. *-DNETCDF_ENABLE_S3* -- Controll S3 support
2. *-DNETCDF_ENABLE_S3_INTERNAL* -- Force use of the *nch5s3comms* SDK instead of the *aws-cpp-sdk*.
3. *-DWITH-S3-TESTING_=ON|OFF|PUBLIC -- "ON" means do all S3 tests, "OFF" means do no S3 testing, "PUBLIC" means do only those tests that involve publically accessible S3 data.

Note that unlike Automake, CMake can properly locate C++ libraries, so it should not be necessary to specify _-laws-cpp-sdk-s3_ assuming that the aws s3 libraries are installed in the default location.
Expand Down Expand Up @@ -267,7 +267,7 @@ This is an experimental SDK provided internally in the netcdf-c library.

### Build Options

In order to enable this SDK, the Automake option *--enable-s3-internal* or the CMake option *-DENABLE_S3_INTERNAL=ON* must be specified.
In order to enable this SDK, the Automake option *--enable-s3-internal* or the CMake option *-DNETCDF_ENABLE_S3_INTERNAL=ON* must be specified.

### Testing S3 Support {#nccloud_testing_S3_support}

Expand Down
4 changes: 2 additions & 2 deletions docs/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ and specific script files.
The actual cleanup requires different approaches for cmake and for automake.
In cmake, the CTestCustom.cmake mechanism is used and contains the following command:
````
IF(ENABLE_S3_TESTING)
IF(NETCDF_ENABLE_S3_TESTING)
# Assume run in top-level CMAKE_BINARY_DIR
set(CTEST_CUSTOM_POST_TEST "bash -x ${CMAKE_BINARY_DIR}/s3cleanup.sh")
ENDIF()
Expand All @@ -722,7 +722,7 @@ because it is invoked after all tests are run in the nczarr_test
directory. So nczarr_test/Makefile.am contains the following
equivalent code:
````
if ENABLE_S3_TESTALL
if NETCDF_ENABLE_S3_TESTALL
check-local:
bash -x ${top_srcdir}/s3cleanup.sh
endif
Expand Down
2 changes: 1 addition & 1 deletion docs/nczarr.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ also test S3 support with this option.
Enabling S3 support is controlled by this cmake option:
````
-DENABLE_S3=ON
-DNETCDF_ENABLE_S3=ON
````
However, to find the aws sdk libraries,
the following environment variables must be set:
Expand Down
2 changes: 1 addition & 1 deletion include/hdf5internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef struct NC_HDF5_FILE_INFO {
#if defined(NETCDF_ENABLE_BYTERANGE)
int byterange;
#endif
#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
struct NCauth* auth;
#endif
} NC_HDF5_FILE_INFO_T;
Expand Down
2 changes: 1 addition & 1 deletion include/nchttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct NC_HTTP_STATE {
struct NCURI* url; /* parsed url */
long httpcode;
char* errmsg; /* do not free if format is HTTPCURL */
#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
struct NC_HTTP_S3 {
void* s3client;
struct NCS3INFO* info;
Expand Down
2 changes: 1 addition & 1 deletion lib_flags.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if NETCDF_ENABLE_NCZARR
AM_CPPFLAGS += -I${top_srcdir}/libnczarr
endif

if ENABLE_S3_AWS
if NETCDF_ENABLE_S3_AWS
AM_LDFLAGS += -lstdc++
endif

Expand Down
8 changes: 4 additions & 4 deletions libdispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ if(NETCDF_ENABLE_BYTERANGE)
)
ENDIF(NETCDF_ENABLE_BYTERANGE)

IF(ENABLE_S3)
if(ENABLE_S3_INTERNAL)
IF(NETCDF_ENABLE_S3)
if(NETCDF_ENABLE_S3_INTERNAL)
target_sources(dispatch
PRIVATE
ncs3sdk_h5.c nch5s3comms.c nch5s3comms.h nccurl_sha256.c nccurl_sha256.h nccurl_hmac.c nccurl_hmac.h nccurl_setup.h
Expand Down Expand Up @@ -88,8 +88,8 @@ IF(NETCDF_ENABLE_NCZARR)
target_include_directories(dispatch PUBLIC ../libnczarr)
endif(NETCDF_ENABLE_NCZARR)

if(ENABLE_S3)
if(ENABLE_S3_AWS)
if(NETCDF_ENABLE_S3)
if(NETCDF_ENABLE_S3_AWS)
target_include_directories(dispatch PUBLIC ${AWSSDK_INCLUDE_DIRS})
if(NOT MSVC)
target_compile_features(dispatch PUBLIC cxx_std_11)
Expand Down
4 changes: 2 additions & 2 deletions libdispatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if NETCDF_ENABLE_BYTERANGE
libdispatch_la_SOURCES += dhttp.c
endif # NETCDF_ENABLE_BYTERANGE

if ENABLE_S3
if ENABLE_S3_INTERNAL
if NETCDF_ENABLE_S3
if NETCDF_ENABLE_S3_INTERNAL
# Renamed to avoid conflicts with the HDF5 files
libdispatch_la_SOURCES += ncs3sdk_h5.c nch5s3comms.c nch5s3comms.h ncutil.h nccurl_setup.h \
nccurl_sha256.c nccurl_sha256.h nccurl_hmac.c nccurl_hmac.h
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/ddispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ See LICENSE.txt for license information.
#include <curl/curl.h>
#endif

#ifdef ENABLE_S3
#ifdef NETCDF_ENABLE_S3
#include "ncs3sdk.h"
#endif

Expand Down
Loading

0 comments on commit 8fd6dcb

Please sign in to comment.