diff --git a/src/Makefile.in b/src/Makefile.in
index 234a5d46f45d3ac46d56f25594a163057b0e4ff5..be115a80ebafb926b136c7920686d5963e4ee8e5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -941,8 +941,8 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@ENABLE_CDI_LIB_FALSE@install-exec-local:
 @ENABLE_CDI_LIB_FALSE@uninstall-local:
+@ENABLE_CDI_LIB_FALSE@install-exec-local:
 clean: clean-am
 
 clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
diff --git a/src/cdf_int.c b/src/cdf_int.c
index e9d1fbbd4ac904199ac726aa2384257f189f8bd9..65f83e865d847802a783d5542c132f78f23438b5 100644
--- a/src/cdf_int.c
+++ b/src/cdf_int.c
@@ -690,6 +690,19 @@ void cdf_get_att_int(int ncid, int varid, const char *name, int *ip)
 }
 
 
+void cdf_get_att_long(int ncid, int varid, const char *name, long *ip)
+{
+#if  defined  (HAVE_NETCDF4)
+  int status = nc_get_att_long(ncid, varid, name, ip);
+
+  if ( CDF_Debug || status != NC_NOERR )
+    Message("ncid = %d varid = %d att = %s val = %ld", ncid, varid, name, *ip);
+
+  if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
+#endif
+}
+
+
 void cdf_get_att_double(int ncid, int varid, const char *name, double *dp)
 {
   int status;
diff --git a/src/cdf_int.h b/src/cdf_int.h
index 223091eb27f86bdf97fd5a91bde5efc6cfcdc84f..91de788839a602f394a646214c11729857d63304 100644
--- a/src/cdf_int.h
+++ b/src/cdf_int.h
@@ -76,6 +76,7 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, si
 void cdf_get_att_string(int ncid, int varid, const char *name, char **tp);
 void cdf_get_att_text  (int ncid, int varid, const char *name, char *tp);
 void cdf_get_att_int   (int ncid, int varid, const char *name, int *ip);
+void cdf_get_att_long  (int ncid, int varid, const char *name, long *ip);
 void cdf_get_att_double(int ncid, int varid, const char *name, double *dp);
 
 void cdf_inq_att    (int ncid, int varid, const char *name, nc_type * xtypep, size_t * lenp);
diff --git a/src/stream_cdf_i.c b/src/stream_cdf_i.c
index bfb44cdf0889f059ccc4e28f67fccb9a719eabc3..d08d7975fb4b8c5b05e029fbaf877149798827a5 100644
--- a/src/stream_cdf_i.c
+++ b/src/stream_cdf_i.c
@@ -7,6 +7,7 @@
 //#define TEST_GROUPS 1
 
 #include <ctype.h>
+#include <limits.h>
 
 #include "dmemory.h"
 #include "gaussgrid.h"
@@ -293,6 +294,32 @@ void cdfGetAttInt(int fileID, int ncvarid, const char *attname, int attlen, int
     }
 }
 
+static
+void cdfGetAttLong(int fileID, int ncvarid, const char *attname, int attlen, long *attint)
+{
+  nc_type atttype;
+  size_t nc_attlen;
+
+  *attint = 0;
+
+  cdf_inq_atttype(fileID, ncvarid, attname, &atttype);
+  cdf_inq_attlen(fileID, ncvarid, attname, &nc_attlen);
+
+  if ( atttype != NC_CHAR )
+    {
+      long *pintatt = (int)nc_attlen > attlen
+        ? (long *)(Malloc(nc_attlen * sizeof (long))) : attint;
+
+      cdf_get_att_long(fileID, ncvarid, attname, pintatt);
+
+      if ( (int)nc_attlen > attlen )
+        {
+          memcpy(attint, pintatt, (size_t)attlen * sizeof (long));
+          Free(pintatt);
+        }
+    }
+}
+
 static
 void cdfGetAttDouble(int fileID, int ncvarid, char *attname, int attlen, double *attdouble)
 {
@@ -428,6 +455,18 @@ bool xtypeIsInt(nc_type xtype)
   return isInt;
 }
 
+static
+bool xtypeIsInt64(nc_type xtype)
+{
+#if  defined  (HAVE_NETCDF4)
+  bool isInt = xtype == NC_INT64 || xtype == NC_UINT64;
+#else
+  bool isInt = false;
+#endif
+
+  return isInt;
+}
+
 static
 int cdfInqDatatype(int xtype, bool lunsigned)
 {
@@ -873,7 +912,6 @@ void cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID)
   cdf_inq_attname(ncid, ncvarid, attnum, attname);
   cdf_inq_attlen(ncid, ncvarid, attname, &attlen);
   cdf_inq_atttype(ncid, ncvarid, attname, &atttype);
-
   if ( xtypeIsInt(atttype) )
     {
       int attint[attlen];
@@ -888,6 +926,24 @@ void cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID)
                      CDI_DATATYPE_INT32;
       cdiDefAttInt(cdiID, varID, attname, datatype, (int)attlen, attint);
     }
+  /*
+#if  defined  (HAVE_NETCDF4)
+  else if ( xtypeIsInt64(atttype) )
+    {
+      long attlong[attlen];
+      int attint[attlen];
+      cdfGetAttLong(ncid, ncvarid, attname, (int)attlen, attlong);
+      int datatype =  (atttype == NC_UINT64) ? CDI_DATATYPE_UINT32 : CDI_DATATYPE_INT32;
+      if ( datatype == CDI_DATATYPE_UINT32 )
+        {
+          size_t i;
+          for ( i = 0; i < attlen; ++i )
+            if ( attlong[i] < 0 || attlong[i] > INT_MAX ) break;
+          if ( i = attlen ) cdiDefAttInt(cdiID, varID, attname, datatype, (int)attlen, attint);
+        }
+    }
+#endif
+  */
   else if ( xtypeIsFloat(atttype) )
     {
       double attflt[attlen];