Binary files orig/ncdf4/src/.Makevars.ucrt.swp and patched/ncdf4/src/.Makevars.ucrt.swp differ
diff -Nru orig/ncdf4/src/Makevars.ucrt patched/ncdf4/src/Makevars.ucrt
--- orig/ncdf4/src/Makevars.ucrt	2023-03-01 16:46:35.000000000 +0100
+++ patched/ncdf4/src/Makevars.ucrt	2024-02-21 19:39:08.599390100 +0100
@@ -1,6 +1,12 @@
-
-PKG_LIBS = \
--lnetcdf -lxml2 -llzma -lmfhdf -lhdf5_hl -lportablexdr -ldf -lhdf5 -lsz -lcurl -lbcrypt -lrtmp -lssl -lssh2 -lidn2 -lunistring -liconv -lgcrypt -lcrypto -lgpg-error -lwsock32 -lws2_32 -ljpeg -lz -lcfitsio -lzstd -lsbml-static -lcrypt32 -lwldap32
+ifeq (,$(shell pkg-config --version 2>/dev/null))
+  LIBPSL = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libpsl.a),-lpsl),)
+  LIBBROTLI = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libbrotlidec.a),-lbrotlidec -lbrotlicommon),)
+  PKG_LIBS = \
+-lnetcdf -lxml2 -llzma -lmfhdf -lhdf5_hl -lportablexdr -ldf -lhdf5 -lsz -lcurl $(LIBPSL) $(LIBBROTLI) -lbcrypt -lrtmp -lssl -lssh2 -lidn2 -lunistring -liconv -lgcrypt -lcrypto -lgpg-error -lwsock32 -lws2_32 -ljpeg -lz -lcfitsio -lzstd -lsbml-static -lcrypt32 -lwldap32
+else
+  PKG_LIBS = $(shell pkg-config --libs netcdf libcurl)
+  PKG_CPPFLAGS = $(shell pkg-config --cflags netcdf libcurl)
+endif
 
 all: clean 
 
