Repository: Unidata/netcdf-c
Pull request #2508 (2022-09-17 01:04:42)

Cleanup built test sources in nczarr_test
re: https://github.com/conda-forge/libnetcdf-feedstock/pull/140

Some tests are BUILTSOURCE in nczarr_test. But apparently
I did not do it correctly. So try to cleanup their construction.




Patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 62a518a81..2f5420a10 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -20,7 +20,6 @@ This file contains a high-level description of this package's evolution. Release
 * [Bug Fix] Fix quantize with CLASSIC_MODEL files. See [Github #2405](https://github.com/Unidata/netcdf-c/pull/2445).
 * [Enhancement] Add `--disable-quantize` option to `configure`.
 * [Bug Fix] Fix CMakeLists.txt to handle all acceptable boolean values for -DPLUGIN_INSTALL_DIR. See [Github #2430](https://github.com/Unidata/netcdf-c/pull/2430).
-* [Bug Fix] Fix tst_vars3.c to use the proper szip flag. See [Github #2421](https://github.com/Unidata/netcdf-c/pull/2421).
 * [Enhancement] Provide a simple API to allow user access to the internal .rc file table: supports get/set/overwrite of entries of the form "key=value". See [Github #2408](https://github.com/Unidata/netcdf-c/pull/2408).
 * [Bug Fix] Use env variable USERPROFILE instead of HOME for windows and mingw. See [Github #2405](https://github.com/Unidata/netcdf-c/pull/2405).
 * [Bug Fix] Fix the nc_def_var_fletcher32 code in hdf5 to properly test value of the fletcher32 argument. See [Github #2403](https://github.com/Unidata/netcdf-c/pull/2403).
@@ -60,6 +59,7 @@ for domain specific info such as used by GDAL/Zarr. See [Github #2278](https://g
 * [Bug Fix] Ensure that internal Fortran APIs are always defined. See [Github #2098](https://github.com/Unidata/netcdf-c/pull/2098).
 * [Enhancement] Support filters for NCZarr. See [Github #2101](https://github.com/Unidata/netcdf-c/pull/2101)
 * [Bug Fix] Make PR 2075 long file name be idempotent. See [Github #2094](https://github.com/Unidata/netcdf-c/pull/2094).
+
 ## 4.8.1 - August 18, 2021
 
 * [Bug Fix] Fix multiple bugs in libnczarr. See [Github #2066](https://github.com/Unidata/netcdf-c/pull/2066).
diff --git a/configure.ac b/configure.ac
index e84c17ca8..31322216a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -718,24 +718,10 @@ AC_CHECK_LIB([zstd],[ZSTD_compress],[have_zstd=yes],[have_zstd=no])
 if test "x$have_zstd" = "xyes" ; then
    AC_SEARCH_LIBS([ZSTD_compress],[zstd zstd.dll cygzstd.dll], [], [])
    AC_DEFINE([HAVE_ZSTD], [1], [if true, zstd library is available])
-
 fi
 AC_MSG_CHECKING([whether libzstd library is available])
 AC_MSG_RESULT([${have_zstd}])
 
-##
-# Ensure that the zstd.h dev files are also available.
-##
-if test "x$have_zstd" = "xyes" ; then
-   AC_CHECK_HEADERS([zstd.h], [], [nc_zstd_h_missing=yes])
-   if test "x$nc_zstd_h_missing" = xyes; then
-         AC_MSG_WARN([zstd library detected, but zstd.h development file not found. Ensure that the zstd development files are installed in order to build zstd support.])
-         AC_DEFINE([HAVE_ZSTD], [0], [if true, zstd library is available])
-         have_zstd=no
-   fi
-fi
-
-
 # See if we have libbz2
 AC_CHECK_LIB([bz2],[BZ2_bzCompress],[have_bz2=yes],[have_bz2=no])
 if test "x$have_bz2" = "xyes" ; then
@@ -1186,7 +1172,7 @@ AC_CHECK_HEADERS([sys/param.h])
 AC_CHECK_HEADERS([libgen.h])
 #AC_CHECK_HEADERS([locale.h])
 AC_HEADER_STDC
-AC_CHECK_HEADERS([locale.h stdio.h stdarg.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/types.h time.h dirent.h stdint.h])
+AC_CHECK_HEADERS([locale.h stdio.h stdarg.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/types.h time.h dirent.h])
 
 # Do sys/resource.h separately
 #AC_CHECK_HEADERS([sys/resource.h],[havesysresource=1],[havesysresource=0])
@@ -1935,10 +1921,16 @@ AC_SUBST(HAS_ZSTD,[$have_zstd])
 
 # Always available
 std_filters="deflate bz2"
-
 if test "x$enable_szlib" = xyes ; then
 std_filters="${std_filters} szip"
 fi
+# We need to include szip iff HDF5 && HDF5_HAS_SZIP || !HDF5 && NCZARR && libsz
+if test "x$enable_hdf5" = xyes && test "x$enable_hdf5_szip" = xyes ; then
+  std_filters="${std_filters} szip"
+fi
+if test "x$enable_hdf5" = xno && test "x$have_sz" = xyes ; then
+std_filters="${std_filters} szip"
+fi
 if test "x$have_blosc" = xyes ; then
 std_filters="${std_filters} blosc"
 fi
diff --git a/include/netcdf_meta.h.in b/include/netcdf_meta.h.in
index 019db6ba9..d9f90ebee 100644
--- a/include/netcdf_meta.h.in
+++ b/include/netcdf_meta.h.in
@@ -43,8 +43,8 @@
 #define NC_HAS_NC4       @NC_HAS_NC4@ /*!< API version 4 support. */
 #define NC_HAS_HDF4      @NC_HAS_HDF4@ /*!< HDF4 support. */
 #define NC_HAS_HDF5      @NC_HAS_HDF5@ /*!< HDF5 support. */
-#define NC_HAS_SZIP      @NC_HAS_SZIP@ /*!< szip support */
-#define NC_HAS_SZIP_WRITE @NC_HAS_SZIP@ /*!< szip write support */
+#define NC_HAS_SZIP      @NC_HAS_SZIP@ /*!< szip support (HDF5 only) */
+#define NC_HAS_SZIP_WRITE @NC_HAS_SZIP@ /*!< szip write support (HDF5 only) */
 #define NC_HAS_DAP2      @NC_HAS_DAP2@ /*!< DAP2 support. */
 #define NC_HAS_DAP4      @NC_HAS_DAP4@ /*!< DAP4 support. */
 #define NC_HAS_BYTERANGE @NC_HAS_BYTERANGE@ /*!< Byterange support. */


Test patch:
diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am
index 6c237d778..1798455aa 100644
--- a/nczarr_test/Makefile.am
+++ b/nczarr_test/Makefile.am
@@ -129,7 +129,7 @@ EXTRA_DIST = CMakeLists.txt \
 run_ut_map.sh run_ut_mapapi.sh run_ut_misc.sh run_ut_chunk.sh run_ncgen4.sh \
 run_nccopyz.sh run_fillonlyz.sh run_chunkcases.sh test_nczarr.sh run_perf_chunks1.sh run_s3_cleanup.sh \
 run_purezarr.sh run_interop.sh run_misc.sh \
-run_filter.sh run_specific_filters.sh \
+run_filter.sh \
 run_newformat.sh run_nczarr_fill.sh run_quantize.sh \
 run_jsonconvention.sh run_nczfilter.sh run_unknown.sh \
 run_scalar.sh run_strings.sh run_nulls.sh
@@ -161,7 +161,7 @@ EXTRA_DIST += ref_power_901_constants_orig.zip ref_power_901_constants.cdl ref_q
 
 CLEANFILES = ut_*.txt ut*.cdl tmp*.nc tmp*.cdl tmp*.txt tmp*.dmp tmp*.zip tmp*.nc tmp*.dump tmp*.tmp tmp_ngc.c ref_zarr_test_data.cdl tst_*.nc.zip ref_quotes.zip ref_power_901_constants.zip
 
-BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh
+BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh run_unknown.sh
 test_quantize.c: $(top_srcdir)/nc_test4/tst_quantize.c
 	rm -f $@
 	echo "#define TESTNCZARR" > $@