diff --git a/src/cdo_features.cc b/src/cdo_features.cc
index 37d8aa6a70f5b869c13d2671adcb2683975e14a5..aaa1e9da89b3bd50f3ac97144ea0bb6c44131f3d 100644
--- a/src/cdo_features.cc
+++ b/src/cdo_features.cc
@@ -82,12 +82,6 @@ constexpr bool have_hdf5 = true;
 constexpr bool have_hdf5 = false;
 #endif
 
-#ifdef HAVE_LIBCGRIBEX
-constexpr bool have_cgribex = true;
-#else
-constexpr bool have_cgribex = false;
-#endif
-
 #ifdef HAVE_LIBCMOR
 constexpr bool have_cmor = true;
 #else
@@ -144,7 +138,7 @@ static std::map<std::string, std::pair<std::string, bool>> configMap
         { "has-nc5", { "NetCDF 5", cdiHaveFiletype(CDI_FILETYPE_NC5) } },
         { "has-nczarr", { "NetCDF 4 zarr", cdiHaveFiletype(CDI_FILETYPE_NCZARR) } },
         { "has-hdf5", { "HDF5", have_hdf5 } },
-        { "has-cgribex", { "CGRIBEX", have_cgribex } },
+        { "has-cgribex", { "CGRIBEX", cdi_has_cgribex() } },
         { "has-cmor", { "CMOR", have_cmor } },
         { "has-magics", { "MAGICS", have_magics } },
         { "has-openmp", { "OPENMP", have_openmp } },
@@ -379,14 +373,14 @@ print_config(std::string const &option)
 
   if ("all-json" == option || "all" == option)
     {
-      std::cout << "{";
+      std::cout << "{\n";
       int i = 0;
       for (auto const &entry : configMap)
         {
-          if (i++) fprintf(stdout, ",");
+          if (i++) fprintf(stdout, ",\n");
           std::cout << "\"" << entry.first << "\":\"" << (entry.second.second ? "yes" : "no") << "\"";
         }
-      std::cout << "}\n";
+      std::cout << "\n}\n";
     }
   else
     {