Index: /branches/nemo_v3_3_beta/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2367)
+++ /branches/nemo_v3_3_beta/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2368)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_iomput key_nproci=1 key_nprocj=1
+ bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_iomput key_nproci=1 key_nprocj=1 key_netcdf4
Index: /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/histcom.f90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/histcom.f90	(revision 2367)
+++ /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/histcom.f90	(revision 2368)
@@ -7,5 +7,5 @@
 !-
   USE netcdf
-  USE nc4dummy ! needed to allow compilation with netcdf3 libraries
+  USE nc4interface ! needed to allow compilation with netcdf3 libraries
 !-
   USE stringop, ONLY : nocomma,cmpblank,findpos,find_str,strlowercase
@@ -36,13 +36,4 @@
 !- to describe the grid, just two vectors.
 !---------------------------------------------------------------------
-!-
-  TYPE, PUBLIC :: snc4_ctl    !: netcdf4 chunking control structure 
-                              !: (optional on histbeg and histend calls)
-     SEQUENCE
-     INTEGER :: ni
-     INTEGER :: nj
-     INTEGER :: nk
-     LOGICAL :: luse
-  END TYPE snc4_ctl
 !-
   INTERFACE histbeg
@@ -428,5 +419,5 @@
 !-
   IF (PRESENT(snc4chunks)) THEN
-    IF (snc4chunks%luse) m_c = NF90_HDF5  ! will conflict if compiling with netcdf4 libraries without "key_netcdf4"
+    IF (snc4chunks%luse) CALL get_nf90_symbol("NF90_HDF5", m_c)
   ENDIF
 !-
@@ -1564,8 +1555,6 @@
            ichunksz(3) = MIN(ichunksz(3), MAX((ichunksz(3)-1)/snc4chunks%nk + 1, 1))
            ! Always use a chunk size of 1 for the unlimited dimension
-           iret = NF90_DEF_VAR_CHUNKING(nfid, nvid, ichunkalg, ichunksz) ! will conflict if compiling with netcdf4 libraries without "key_netcdf4"
-
-           iret = NF90_DEF_VAR_DEFLATE(nfid, nvid, ishuffle, ideflate, ideflate_level) ! will conflict if compiling with netcdf4 libraries without "key_netcdf4"
-
+           iret = SET_NF90_DEF_VAR_CHUNKING(nfid, nvid, ichunkalg, ichunksz)
+           iret = SET_NF90_DEF_VAR_DEFLATE(nfid, nvid, ishuffle, ideflate, ideflate_level)
           ENDIF
         ENDIF
Index: anches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/nc4dummy.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/nc4dummy.F90	(revision 2367)
+++ 	(revision )
@@ -1,45 +1,0 @@
-MODULE nc4dummy
-!-
-!-
-! This software is governed by the CeCILL license
-! See IOIPSL/IOIPSL_License_CeCILL.txt
-!---------------------------------------------------------------------
-#if ! defined key_netcdf4
-      !!--------------------------------------------------------------------
-      !! NOT 'key_netcdf4' Defines dummy routines for netcdf4
-      !!                   calls when compiling without netcdf4 libraries
-      !!--------------------------------------------------------------------
-     INTEGER, PUBLIC :: NF90_HDF5
-CONTAINS
-!===
-   INTEGER FUNCTION NF90_DEF_VAR_CHUNKING(idum1, idum2, idum3, iarr1)
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE NF90_DEF_VAR_CHUNKING  ***
-      !!
-      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
-      !!--------------------------------------------------------------------
-      INTEGER,               INTENT(in) :: idum1, idum2, idum3
-      INTEGER, DIMENSION(4), INTENT(in) :: iarr1
-      IF(lwp) WRITE(numout,*) 'Warning: Attempt to chunk output variable without NetCDF4 support'
-      NF90_DEF_VAR_CHUNKING = -1
-   END FUNCTION NF90_DEF_VAR_CHUNKING
-
-   INTEGER FUNCTION NF90_DEF_VAR_DEFLATE(idum1, idum2, idum3, idum4, idum5)
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE NF90_DEF_VAR_DEFLATE  ***
-      !!
-      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
-      !!--------------------------------------------------------------------
-      INTEGER,               INTENT(in) :: idum1, idum2, idum3, idum4, idum5
-      IF(lwp) WRITE(numout,*) 'Warning: Attempt to compress output variable without NetCDF4 support'
-      NF90_DEF_VAR_DEFLATE = -1
-   END FUNCTION NF90_DEF_VAR_DEFLATE
-#else
-      !!--------------------------------------------------------------------
-      !! 'key_netcdf4' Dummy module (usually defines dummy routines for netcdf4
-      !!               calls when compiling without netcdf4 libraries
-      !!--------------------------------------------------------------------
-#endif
-
-!------------------
-END MODULE nc4dummy
Index: /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/nc4interface.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/nc4interface.F90	(revision 2368)
+++ /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/nc4interface.F90	(revision 2368)
@@ -0,0 +1,122 @@
+MODULE nc4interface
+!-
+!-
+! This software is governed by the CeCILL license
+! See IOIPSL/IOIPSL_License_CeCILL.txt
+!---------------------------------------------------------------------
+#if ! defined key_netcdf4
+      !!--------------------------------------------------------------------
+      !! NOT 'key_netcdf4' Defines dummy routines for netcdf4
+      !!                   calls when compiling without netcdf4 libraries
+      !!--------------------------------------------------------------------
+  !- netcdf4 chunking control structure
+  !- (optional on histbeg and histend calls)
+  TYPE, PUBLIC :: snc4_ctl
+     SEQUENCE
+     INTEGER :: ni
+     INTEGER :: nj
+     INTEGER :: nk
+     LOGICAL :: luse
+  END TYPE snc4_ctl
+
+CONTAINS
+!===
+   SUBROUTINE GET_NF90_SYMBOL(sym_name, ivalue)
+      CHARACTER(len=*),      INTENT(in)  :: sym_name
+      INTEGER,               INTENT(out) :: ivalue
+      ivalue = -999
+   END SUBROUTINE GET_NF90_SYMBOL
+   INTEGER FUNCTION SET_NF90_DEF_VAR_CHUNKING(idum1, idum2, idum3, iarr1)
+      !!--------------------------------------------------------------------
+      !!                   ***  SUBROUTINE NF90_DEF_VAR_CHUNKING  ***
+      !!
+      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
+      !!--------------------------------------------------------------------
+      INTEGER,               INTENT(in) :: idum1, idum2, idum3
+      INTEGER, DIMENSION(4), INTENT(in) :: iarr1
+      WRITE(*,*) 'Warning: Attempt to chunk output variable without NetCDF4 support'
+      SET_NF90_DEF_VAR_CHUNKING = -1
+   END FUNCTION SET_NF90_DEF_VAR_CHUNKING
+
+   INTEGER FUNCTION SET_NF90_DEF_VAR_DEFLATE(idum1, idum2, idum3, idum4, idum5)
+      !!--------------------------------------------------------------------
+      !!                   ***  SUBROUTINE NF90_DEF_VAR_DEFLATE  ***
+      !!
+      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
+      !!--------------------------------------------------------------------
+      INTEGER,               INTENT(in) :: idum1, idum2, idum3, idum4, idum5
+      WRITE(*,*) 'Warning: Attempt to compress output variable without NetCDF4 support'
+      SET_NF90_DEF_VAR_DEFLATE = -1
+   END FUNCTION SET_NF90_DEF_VAR_DEFLATE
+#else
+      !!--------------------------------------------------------------------
+      !! 'key_netcdf4' Dummy module (usually defines dummy routines for netcdf4
+      !!               calls when compiling without netcdf4 libraries
+      !!--------------------------------------------------------------------
+
+   USE netcdf
+
+   !- netcdf4 chunking control structure
+   !- (optional on histbeg and histend calls)
+!$AGRIF_DO_NOT_TREAT
+   TYPE, PUBLIC :: snc4_ctl
+      SEQUENCE
+      INTEGER :: ni
+      INTEGER :: nj
+      INTEGER :: nk
+      LOGICAL :: luse
+   END TYPE snc4_ctl
+!$AGRIF_END_DO_NOT_TREAT
+
+CONTAINS
+   INTEGER FUNCTION SET_NF90_DEF_VAR_CHUNKING(nfid, nvid, ichunkalg, ichunksz)
+      !!--------------------------------------------------------------------
+      !!                   ***  SUBROUTINE NF90_DEF_VAR_CHUNKING  ***
+      !!
+      !! ** Purpose :   Interface NetCDF4 routine to enable compiling with NetCDF4 libraries
+      !!                but no key_netcdf4
+      !!--------------------------------------------------------------------
+      INTEGER,               INTENT(in) :: nfid
+      INTEGER,               INTENT(in) :: nvid
+      INTEGER,               INTENT(in) :: ichunkalg
+      INTEGER, DIMENSION(:), INTENT(in) :: ichunksz
+      !!
+      INTEGER                           :: iret
+      !!
+      iret = NF90_DEF_VAR_CHUNKING(nfid, nvid, ichunkalg, ichunksz)
+      SET_NF90_DEF_VAR_CHUNKING = iret
+   END FUNCTION SET_NF90_DEF_VAR_CHUNKING
+
+   INTEGER FUNCTION SET_NF90_DEF_VAR_DEFLATE(nfid, nvid, ishuffle, ideflate, ideflate_level)
+      !!--------------------------------------------------------------------
+      !!                   ***  SUBROUTINE NF90_DEF_VAR_DEFLATE  ***
+      !!
+      !! ** Purpose :   Interface NetCDF4 routine to enable compiling with NetCDF4 libraries
+      !!                but no key_netcdf4
+      !!--------------------------------------------------------------------
+      INTEGER,               INTENT(in) :: nfid
+      INTEGER,               INTENT(in) :: nvid
+      INTEGER,               INTENT(in) :: ishuffle
+      INTEGER,               INTENT(in) :: ideflate
+      INTEGER,               INTENT(in) :: ideflate_level
+      !!
+      INTEGER                           :: iret
+      !!
+      iret = NF90_DEF_VAR_DEFLATE(nfid, nvid, ishuffle, ideflate, ideflate_level)
+      SET_NF90_DEF_VAR_DEFLATE = iret
+   END FUNCTION SET_NF90_DEF_VAR_DEFLATE
+
+   SUBROUTINE GET_NF90_SYMBOL(sym_name, ivalue)
+      CHARACTER(len=*),      INTENT(in)  :: sym_name
+      INTEGER,               INTENT(out) :: ivalue
+      SELECT CASE (sym_name)
+         CASE ("NF90_HDF5")
+            ivalue = NF90_HDF5
+         CASE DEFAULT
+            WRITE(*,*) "Warning: unknown case in GET_NF90_SYMBOL"
+      END SELECT
+   END SUBROUTINE GET_NF90_SYMBOL
+#endif
+
+!------------------
+END MODULE nc4interface
Index: /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_ioserver_namelist.f90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_ioserver_namelist.f90	(revision 2367)
+++ /branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/XMLIO_SERVER/src/IOSERVER/mod_ioserver_namelist.f90	(revision 2368)
@@ -1,4 +1,5 @@
 MODULE mod_ioserver_namelist
 
+  USE nc4interface
   LOGICAL,SAVE :: using_server
   LOGICAL,SAVE :: using_oasis
@@ -11,12 +12,4 @@
 
   INTEGER,PARAMETER,PRIVATE :: starting_unit=356
-  TYPE, PUBLIC :: snc4_ctl    !: netcdf4 chunking control structure
-                              !: (optional on histbeg and histend calls)
-     SEQUENCE
-     INTEGER :: ni
-     INTEGER :: nj
-     INTEGER :: nk
-     LOGICAL :: luse
-  END TYPE snc4_ctl
   TYPE(snc4_ctl), SAVE :: snc4ioset
   INTEGER :: nn_nchunks_i, nn_nchunks_j, nn_nchunks_k
Index: /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 2367)
+++ /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 2368)
@@ -19,4 +19,5 @@
    USE par_oce         ! ocean parameter
    USE lib_print       ! formated print library
+   USE nc4interface
 
    IMPLICIT NONE
@@ -62,15 +63,5 @@
 #endif
 
-!$AGRIF_DO_NOT_TREAT
-   TYPE, PUBLIC :: snc4_ctl                            !: netcdf4 chunking control structure (always needed for decision making)
-      SEQUENCE
-      INTEGER :: ni
-      INTEGER :: nj
-      INTEGER :: nk
-      LOGICAL :: luse
-   END TYPE snc4_ctl
-
-   TYPE(snc4_ctl) :: snc4set                          !: netcdf4 chunking control structure (always needed for decision making)
-!$AGRIF_END_DO_NOT_TREAT
+   TYPE(snc4_ctl)     :: snc4set                       !: netcdf4 chunking control structure (always needed for decision making)
 
 
Index: /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 2367)
+++ /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 2368)
@@ -40,12 +40,4 @@
    END INTERFACE
 
-#if ! defined key_netcdf4
-   !!--------------------------------------------------------------------
-   !! NOT 'key_netcdf4' Defines dummy routines for netcdf4
-   !!                   calls when compiling without netcdf4 libraries
-   !!--------------------------------------------------------------------
-   PUBLIC NF90_DEF_VAR_CHUNKING, NF90_DEF_VAR_DEFLATE ! contained below
-   INTEGER :: NF90_HDF5
-#endif
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
@@ -77,4 +69,5 @@
       INTEGER            ::   ichunk           ! temporary storage of nn_chunksz
       INTEGER            ::   imode            ! creation mode flag: NF90_CLOBBER or NF90_NOCLOBBER or NF90_HDF5
+      INTEGER            ::   ihdf5            ! local variable for retrieval of value for NF90_HDF5
       LOGICAL            ::   llclobber        ! local definition of ln_clobber
       !---------------------------------------------------------------------
@@ -116,6 +109,7 @@
             IF( snc4set%luse ) THEN
                IF(lwp) WRITE(numout,*) TRIM(clinfo)//' creating file: '//TRIM(cdname)//' in hdf5 (netcdf4) mode'
-               IF( llclobber ) THEN   ;   imode = IOR(NF90_HDF5, NF90_CLOBBER)
-               ELSE                   ;   imode = IOR(NF90_HDF5, NF90_NOCLOBBER)
+               CALL GET_NF90_SYMBOL("NF90_HDF5", ihdf5)
+               IF( llclobber ) THEN   ;   imode = IOR(ihdf5, NF90_CLOBBER)
+               ELSE                   ;   imode = IOR(ihdf5, NF90_NOCLOBBER)
                ENDIF
                CALL iom_nf90_check(NF90_CREATE( TRIM(cdname), imode, if90id ), clinfo)
@@ -496,6 +490,6 @@
             ichunksz(4) = 1                                                            ! Do not allow chunks to span the
                                                                                        ! unlimited dimension
-            CALL iom_nf90_check(NF90_DEF_VAR_CHUNKING(if90id, idvar, ichunkalg, ichunksz), clinfo)
-            CALL iom_nf90_check(NF90_DEF_VAR_DEFLATE(if90id, idvar, ishuffle, ideflate, ideflate_level), clinfo)
+            CALL iom_nf90_check(SET_NF90_DEF_VAR_CHUNKING(if90id, idvar, ichunkalg, ichunksz), clinfo)
+            CALL iom_nf90_check(SET_NF90_DEF_VAR_DEFLATE(if90id, idvar, ishuffle, ideflate, ideflate_level), clinfo)
             IF(lwp) WRITE(numout,*) TRIM(clinfo)//' chunked ok. Chunks sizes: ', ichunksz
          ENDIF
@@ -579,35 +573,4 @@
    END SUBROUTINE iom_nf90_check
 
-#if ! defined key_netcdf4
-
-      !!--------------------------------------------------------------------
-      !! NOT 'key_netcdf4' Defines dummy routines for netcdf4
-      !!                   calls when compiling without netcdf4 libraries
-      !!--------------------------------------------------------------------
-
-   INTEGER FUNCTION NF90_DEF_VAR_CHUNKING(idum1, idum2, idum3, iarr1)
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE NF90_DEF_VAR_CHUNKING  ***
-      !!
-      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
-      !!--------------------------------------------------------------------
-      INTEGER,               INTENT(in) :: idum1, idum2, idum3
-      INTEGER, DIMENSION(4), INTENT(in) :: iarr1
-      IF(lwp) WRITE(numout,*) 'Warning: Attempt to chunk output variable without NetCDF4 support'
-      NF90_DEF_VAR_CHUNKING = -1
-   END FUNCTION NF90_DEF_VAR_CHUNKING
-
-   INTEGER FUNCTION NF90_DEF_VAR_DEFLATE(idum1, idum2, idum3, idum4, idum5)
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE NF90_DEF_VAR_DEFLATE  ***
-      !!
-      !! ** Purpose :   Dummy NetCDF4 routine to enable compiling with NetCDF3 libraries
-      !!--------------------------------------------------------------------
-      INTEGER,               INTENT(in) :: idum1, idum2, idum3, idum4, idum5
-      IF(lwp) WRITE(numout,*) 'Warning: Attempt to compress output variable without NetCDF4 support'
-      NF90_DEF_VAR_DEFLATE = -1
-   END FUNCTION NF90_DEF_VAR_DEFLATE
-#endif
-
    !!======================================================================
 END MODULE iom_nf90
