Index: /LMDZ6/branches/Optimisation_LMDZ/libf/misc/wxios.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/misc/wxios.F90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/misc/wxios.F90	(revision 3754)
@@ -673,3 +673,12 @@
      END SUBROUTINE wxios_close
 END MODULE wxios
+#else
+MODULE wxios
+    REAL :: missing_val = 0
+contains
+    SUBROUTINE wxios_set_context()
+    END SUBROUTINE wxios_set_context
+    SUBROUTINE wxios_closedef()
+    END SUBROUTINE wxios_closedef
+END MODULE wxios   
 #endif
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/iophy_xios.f90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/iophy_xios.f90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/iophy_xios.f90	(revision 3754)
@@ -2,5 +2,5 @@
 ! ok_all_xml must be true
 MODULE iophy_xios
-  use iophy, only: npstn, nptabij, check_dim
+  use iophy, only: check_dim
   implicit none
 
@@ -21,5 +21,5 @@
     USE mod_phys_lmdz_para, ONLY: is_master
     USE phys_output_var_mod, ONLY: ctrl_out
-    USE xios, ONLY: xios_field_is_active
+    USE xios_interface, ONLY: xios_field_is_active
     USE print_control_mod, ONLY: lunout
     IMPLICIT NONE
@@ -47,5 +47,5 @@
     USE phys_output_var_mod, ONLY: ctrl_out
     USE print_control_mod, ONLY: lunout
-    USE xios, ONLY: xios_field_is_active
+    USE xios_interface, ONLY: xios_field_is_active
     IMPLICIT NONE
     INCLUDE 'clesphys.h'
@@ -74,5 +74,5 @@
                                   jj_nb, klon_mpi, is_master
     USE mod_grid_phy_lmdz, ONLY: nbp_lon, grid_type, unstructured, regular_lonlat
-    USE xios, ONLY: xios_send_field
+    USE xios_interface, ONLY: xios_send_field
     USE print_control_mod, ONLY: lunout
 
@@ -120,5 +120,5 @@
     USE mod_phys_lmdz_para, ONLY: gather_omp, grid1Dto2D_mpi, &
                                   jj_nb, klon_mpi, is_master
-    USE xios, ONLY: xios_send_field
+    USE xios_interface, ONLY: xios_send_field
     USE mod_grid_phy_lmdz, ONLY: nbp_lon, grid_type, regular_lonlat, unstructured
     USE print_control_mod, ONLY: lunout
@@ -167,5 +167,5 @@
 
   SUBROUTINE histwrite0d_xios(field_name, field)
-    USE xios, ONLY: xios_send_field
+    USE xios_interface, ONLY: xios_send_field
     USE mod_phys_lmdz_para, ONLY: is_master
     USE print_control_mod, ONLY: lunout
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_interface_mod.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_interface_mod.F90	(revision 3754)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_interface_mod.F90	(revision 3754)
@@ -0,0 +1,8 @@
+module phys_output_write_interface_mod
+#ifdef CPP_XIOS
+    USE phys_output_write_xios_mod, only : phys_output_write_xios
+#else 
+    USE phys_output_write_mod, only : phys_output_write_xios => phys_output_write
+#endif
+    USE phys_output_write_mod, only : phys_output_write
+end module
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_mod.F90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_mod.F90	(revision 3754)
@@ -460,4 +460,5 @@
  !      iinitend = 1
  !   ENDIF
+   if( ok_all_xml ) call abort_physic("phys_output_write", "Support of this IO backend with ok_all_xml=.true. is deprecated : use phys_output_write_xios instead", 1)
 
 #ifdef CPP_XIOS
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_mod.f90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_mod.f90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_mod.f90	(revision 3754)
@@ -326,5 +326,5 @@
     USE print_control_mod, ONLY: prt_level, lunout
 
-    USE xios
+    USE xios_interface, ONLY : CPP_XIOS_defined, xios_fieldgroup, xios_field, xios_get_handle, xios_add_child, xios_set_attr, xios_update_calendar
     USE wxios, ONLY: wxios_closedef, missing_val, wxios_set_context
     USE vertical_layers_mod, ONLY: presnivs
@@ -382,4 +382,5 @@
     REAL, DIMENSION(klon)      :: zrho, zt
 
+    if( .not. CPP_XIOS_defined ) call abort_physic("phys_output_write_xios", "This io backend can only be used when LMDZ is compiled with XIOS support",1 )
     if( .not. ok_all_xml ) call abort_physic("phys_output_write_xios", "This io backend only supports ok_all_xml = .true.", 1)
 
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_preprocess.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_preprocess.F90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_preprocess.F90	(revision 3754)
@@ -1,9 +1,2 @@
-#ifndef CPP_XIOS
-#error "CPP_XIOS must be defined to compile this file"
-#endif
-#ifndef CPP_IOIPSL_NO_OUTPUT
-#error "CPP_IOIPSL_NO_OUTPUT is not mandatory to compile this file"
-#endif
-
 MODULE phys_output_write_xios_preprocess
 
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/physiq_mod.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/physiq_mod.F90	(revision 3753)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/physiq_mod.F90	(revision 3754)
@@ -223,5 +223,5 @@
 #endif
 
-    USE phys_output_write_xios_mod
+    USE phys_output_write_interface_mod, only : phys_output_write, phys_output_write_xios
     USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
     USE phys_output_mod
@@ -1694,5 +1694,6 @@
         ENDIF
 
-       CALL phys_output_write_xios(itap, pdtphys, paprs, pphis,                    &
+      if( ok_all_xml ) then
+         CALL phys_output_write_xios(itap, pdtphys, paprs, pphis,                    &
                               pplay, lmax_th, aerosol_couple,                 &
                               ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync,&
@@ -1700,4 +1701,12 @@
                               ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
                               flag_aerosol, flag_aerosol_strat, ok_cdnc)
+      else
+         CALL phys_output_write(itap, pdtphys, paprs, pphis,                    &
+                              pplay, lmax_th, aerosol_couple,                 &
+                              ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync,&
+                              ptconv, read_climoz, clevSTD,                   &
+                              ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
+                              flag_aerosol, flag_aerosol_strat, ok_cdnc)
+      endif 
 
 #ifdef CPP_XIOS
@@ -5111,10 +5120,19 @@
        flag_aerosol, flag_aerosol_strat, ok_cdnc)
 #else
-    CALL phys_output_write_xios(itap, pdtphys, paprs, pphis,  &
-         pplay, lmax_th, aerosol_couple,                 &
-         ok_ade, ok_aie, ok_volcan, ivap, iliq, isol,    & 
-         ok_sync, ptconv, read_climoz, clevSTD,          &
-         ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
-         flag_aerosol, flag_aerosol_strat, ok_cdnc)
+   if( ok_all_xml ) then
+      CALL phys_output_write_xios(itap, pdtphys, paprs, pphis,                    &
+                             pplay, lmax_th, aerosol_couple,                 &
+                             ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync,&
+                             ptconv, read_climoz, clevSTD,                   &
+                             ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
+                             flag_aerosol, flag_aerosol_strat, ok_cdnc)
+   else
+      CALL phys_output_write(itap, pdtphys, paprs, pphis,                    &
+                           pplay, lmax_th, aerosol_couple,                 &
+                           ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync,&
+                           ptconv, read_climoz, clevSTD,                   &
+                           ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
+                           flag_aerosol, flag_aerosol_strat, ok_cdnc)
+   endif 
 #endif
 
Index: /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/xios_interface.F90
===================================================================
--- /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/xios_interface.F90	(revision 3754)
+++ /LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/xios_interface.F90	(revision 3754)
@@ -0,0 +1,63 @@
+MODULE xios_interface
+  ! This module provides a minimal empty xios implementation for phy_output_write_xios
+  ! when LMDZ is compiled without xios
+#ifdef CPP_XIOS
+  use xios, ONLY : xios_field_is_active, xios_send_field, xios_fieldgroup, xios_field, &
+                   xios_get_handle, xios_add_child, xios_set_attr, xios_update_calendar
+  logical :: CPP_XIOS_defined = .true.
+#else
+  logical :: CPP_XIOS_defined = .false.
+
+  type xios_field
+  end type
+  type xios_fieldgroup
+  end type
+
+  interface xios_send_field
+    subroutine xios_send_field_r0(name, buffer)
+      character(*) :: name
+      real :: buffer
+    end subroutine
+    subroutine xios_send_field_r1(name, buffer)
+      character(*) :: name
+      real :: buffer(:)
+    end subroutine
+    subroutine xios_send_field_r2(name, buffer)
+      character(*) :: name
+      real :: buffer(:,:)
+    end subroutine
+    subroutine xios_send_field_r3(name, buffer)
+      character(*) :: name
+      real :: buffer(:,:,:)
+    end subroutine
+  end interface
+
+  contains
+  function xios_field_is_active(name, at_current_timestep_arg)
+    character(*) :: name
+    logical :: at_current_timestep_arg
+    logical :: xios_field_is_active
+    xios_field_is_active = .false.
+  end function
+
+  subroutine xios_set_attr(hdl, name, unit)
+    TYPE(xios_field) :: hdl
+    character(*) :: name, unit
+  end subroutine
+
+  subroutine xios_get_handle(name, hdl)
+    character(*) :: name
+    TYPE(xios_fieldgroup) :: hdl
+  end subroutine 
+
+  subroutine xios_add_child(ghdl, hdl, name)
+    TYPE(xios_fieldgroup) :: ghdl
+    TYPE(xios_field) :: hdl
+    character(*) :: name    
+  end subroutine 
+
+  subroutine xios_update_calendar(i)
+    integer :: i
+  end subroutine   
+#endif
+end module
