Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1From b819b3616b96352d23cdf0840df9e6674437948c Mon Sep 17 00:00:00 2001
2From: Orion Poplawski <orion@nwra.com>
3Date: Mon, 17 Feb 2025 15:17:28 -0700
4Subject: [PATCH] Use HAVE_NC_SET_LOG_LEVEL to determine usage of
5 nc_set_log_level (fixes #161)
6
7---
8 cxx4/test_filter.cpp | 2 ++
9 examples/pres_temp_4D_plugin_wr.cpp | 4 ++++
10 2 files changed, 6 insertions(+)
11
12diff --git a/cxx4/test_filter.cpp b/cxx4/test_filter.cpp
13index 879ba71..f442c64 100644
14--- a/cxx4/test_filter.cpp
15+++ b/cxx4/test_filter.cpp
16@@ -30,7 +30,9 @@ int main()
17 try
18 {
19 NcFile test("pres_temp_plugin_4D.nc", NcFile::replace);
20+#ifdef HAVE_NC_SET_LOG_LEVEL
21 nc_set_log_level(5);
22+#endif
23 // Define the dimensions. NetCDF will hand back an ncDim object for
24 // each.
25 NcDim latDim = test.addDim(LAT_NAME, NLAT);
26diff --git a/examples/pres_temp_4D_plugin_wr.cpp b/examples/pres_temp_4D_plugin_wr.cpp
27index 832d2a6..584e8be 100644
28--- a/examples/pres_temp_4D_plugin_wr.cpp
29+++ b/examples/pres_temp_4D_plugin_wr.cpp
30@@ -71,7 +71,9 @@ string LON_UNITS = "degrees_east";
31
32 int main()
33 {
34+#ifdef HAVE_NC_SET_LOG_LEVEL
35 nc_set_log_level(5);
36+#endif
37 // We will write latitude and longitude fields.
38 float lats[NLAT],lons[NLON];
39
40@@ -103,7 +105,9 @@ int main()
41
42 // Create the file.
43 NcFile test(FILE_NAME, NcFile::replace);
44+#ifdef HAVE_NC_SET_LOG_LEVEL
45 nc_set_log_level(5);
46+#endif
47 // Define the dimensions. NetCDF will hand back an ncDim object for
48 // each.
49 NcDim lvlDim = test.addDim(LVL_NAME, NLVL);