Index: codes/icosagcm/devel/Python/env/OSX.env
===================================================================
--- codes/icosagcm/devel/Python/env/OSX.env	(revision 622)
+++ 	(revision )
@@ -1,38 +1,0 @@
-BASEDIR=$(dirname ${BASH_SOURCE[0]})
-export BASEDIR=$(cd $BASEDIR/../.. ; pwd)
-export PYTHONPATH="$BASEDIR"
-export XIOS_ROOT="$BASEDIR/MODELS/XIOS"
-
-export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin
-export LD_LIBRARY_PATH="$BASEDIR/kernels/lib"
-
-export PYTHON=/opt/local/bin/python
-export PYTHON_ROOT=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/
-
-export C99=/usr/bin/clang
-export C99FLAGS="-std=c99 -I /opt/local/include/openmpi-gcc48 -I /opt/local/include $CLFAGS"
-
-export F90=gfortran
-export FFLAGS_BASE="-I $XIOS_ROOT/inc -fPIC -g -openmp"
-export FFLAGS_PROD="-O3"
-export FFLAGS_DBG="-O3 -fcheck=bounds"
-export FFLAGS="$FFLAGS_BASE $FFLAGS_PROD"
-
-export LINK=mpicxx
-export LDFLAGS="-fopenmp"
-export SOFLAGS="-dynamiclib -undefined dynamic_lookup -Wl,-headerpad_max_install_names"
-export LIBS="-L /opt/local/lib/openmpi-gcc48/ -L /opt/local/lib -L/opt/local/lib/gcc48 /opt/local/lib/gcc48/libgfortran.a -lgcc_ext.10.5 -lmpi -lparmetis"
-
-export MPIRUN=mpirun-openmpi-gcc48
-
-export WHOLE_ARCHIVE='-Wl,-all_load'
-export NOWHOLE_ARCHIVE=''
-
-export NETCDF_LDFLAGS="-L/opt/local/lib -lnetcdff -lnetcdf -lstdc++"
-export LDD="otool -L"
-
-# for the record
-#export CC=/usr/bin/clang
-#export CFLAGS="-fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7"
-
-export CODEGEN_ENV_SET=yes
Index: codes/icosagcm/devel/Python/env/X64_OSX.env
===================================================================
--- codes/icosagcm/devel/Python/env/X64_OSX.env	(revision 623)
+++ codes/icosagcm/devel/Python/env/X64_OSX.env	(revision 623)
@@ -0,0 +1,43 @@
+export CODEGEN_ENV_SET=yes
+
+#----------- Useful directories ---------
+
+BASEDIR=$(dirname ${BASH_SOURCE[0]})
+export BASEDIR=$(cd $BASEDIR/../.. ; pwd)
+
+#--------- To create shared libraries -------
+
+export F90=mpif90
+export LINK=mpicxx
+export SOFLAGS="-dynamiclib -undefined dynamic_lookup -Wl,-headerpad_max_install_names -lgfortran -lparmetis $NETCDF_LIBDIR"
+export WHOLE_ARCHIVE='-Wl,-all_load'
+export NOWHOLE_ARCHIVE=''
+export LDD="otool -L"
+
+#----------- To compile kernels ------------
+
+export C99=/usr/bin/clang
+export CFLAGS="-fPIC $PARMETIS_CFLAGS"
+export C99FLAGS="-std=c99 -I /opt/local/include/openmpi-gcc48 -I /opt/local/include $CLFAGS"
+export FFLAGS_BASE="-I $XIOS_ROOT/inc -fPIC -g -openmp"
+export FFLAGS_PROD="-O3"
+export FFLAGS_DBG="-O3 -fcheck=bounds"
+export FFLAGS="$FFLAGS_BASE $FFLAGS_PROD"
+export LDFLAGS="-fopenmp -lxios"
+
+#---------------- To execute ----------------
+
+# Python will look for modules (*.py) and extensions (*.so) in PYTHONPATH
+# Shared libs they depend on should be in a standard place or a path included in LD_LIBRARY_PATH
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DYNAMICO_ROOT/lib"
+export PYTHONPATH="$DYNAMICO_ROOT/lib"
+export PYTHON=$(which python)
+
+#----------------- Garbage kept for the record -------------
+# export PYTHON_ROOT=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/
+
+# export LIBS="-L /opt/local/lib/openmpi-gcc48/ -L /opt/local/lib -L/opt/local/lib/gcc48 /opt/local/lib/gcc48/libgfortran.a -lgcc_ext.10.5 -lmpi -lparmetis"
+# export MPIRUN=mpirun-openmpi-gcc48
+# export NETCDF_LDFLAGS="-L/opt/local/lib -lnetcdff -lnetcdf -lstdc++"
+#export CC=/usr/bin/clang
+#export CFLAGS="-fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7"
Index: codes/icosagcm/devel/arch/arch-X64_OSX.env
===================================================================
--- codes/icosagcm/devel/arch/arch-X64_OSX.env	(revision 623)
+++ codes/icosagcm/devel/arch/arch-X64_OSX.env	(revision 623)
@@ -0,0 +1,36 @@
+# Environment based on the assumption that we use MacPorts-installed libraries and packages
+# Known to work with the following MacPorts environment :
+#
+# port installed
+#   gcc48 @4.8.5_0
+#   openmpi-gcc48 @1.10.3_0+fortran
+#   atlas @3.10.2_2 
+#   vtk5 @5.10.1_3+python27+tcltk+x11
+#   hdf5 @1.10.0-patch1_0+cxx+gcc48+hl+openmpi
+#   netcdf-fortran @4.4.4_0+gcc48+openmpi
+#   python27 @2.7.14_0
+#   py27-mpi4py @2.0.0+gcc48+openmpi
+#   py27-netcdf4 @1.2.4_1+gcc48+openmpi
+#   py27-jinja2 @2.8_0
+#
+# port select --summary
+#   gcc        mp-gcc48
+#   python     python27
+#
+# The variants (the +XXX in the package names above) are crucial to ensure consistency across packages. Not all combinations of versions of python, gcc or MPI are possible. 
+# To make your choice :
+#         "port search PACKAGE" tells you about available packages (examples : port search gcc / port search netcdf) 
+#         "port info PACKAGE"   tells you about available variants like +gcc48 and +openmpi
+# Once you have found a combination of python, gcc and MPI for which all other packages exist :
+#         "sudo port install PACKAGE +VARIANT1 +VARIANT2 .." to install
+# This will also install dependent packages, possibly many of them.
+# MacPorts can install several versions/variants of a package simultaneously. Only one is "active" at a time.
+# To make sure that the packages you just installed are indeed active :
+#         "port select --summary" tells you about executables/libraries for which several versions coexist and one must be activated
+#         "port select GROUP" tells which choices are available within group GROUP (gcc, python ...)
+#         "sudo port select GROUP CHOICE" tells MacPorts to activate CHOICE among the various possibilites in GROUP
+
+export CURRENT_ARCH=X64_OSX
+
+# Minimal PATH to make sure we use the MacPorts python & mpif90
+export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin
Index: codes/icosagcm/devel/arch/arch-X64_OSX.fcm
===================================================================
--- codes/icosagcm/devel/arch/arch-X64_OSX.fcm	(revision 622)
+++ codes/icosagcm/devel/arch/arch-X64_OSX.fcm	(revision 623)
@@ -1,16 +1,16 @@
-%COMPILER            gfortran
-%LINK                gfortran
+%COMPILER            mpif90
+%LINK                mpif90
 %AR                  ar
 %MAKE                gmake
-%FPP                 gfortran -E
-%FPP_FLAGS           -P -traditional
+%FPP                 cpp
+%FPP_FLAGS           -std=c89 -P
 %FPP_DEF             KEY_NONE CPP_NETCDF4
-%BASE_FFLAGS         -I /opt/local/include -fdefault-real-8 -ffree-line-length-none
-%PROD_FFLAGS         -O3 
+%BASE_FFLAGS         -I /opt/local/include -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none
+%PROD_FFLAGS         -O3 -fcheck=array-temps
 %DEV_FFLAGS          -p -g -O 
-%DEBUG_FFLAGS        -p -g  -fbacktrace -fbounds-check
+%DEBUG_FFLAGS        -p -g  -fbacktrace -fcheck=all
 %MPI_FFLAGS
 %OMP_FFLAGS          
-%BASE_LD             -p -L/opt/local/lib  -lnetcdff -lnetcdf
+%BASE_LD             -p -llapack -lcblas -lf77blas -latlas
 %OMP_LD              
 %OMP_LD              
Index: codes/icosagcm/devel/arch/arch-X64_OSX.path
===================================================================
--- codes/icosagcm/devel/arch/arch-X64_OSX.path	(revision 622)
+++ codes/icosagcm/devel/arch/arch-X64_OSX.path	(revision 623)
@@ -1,11 +1,18 @@
-NETCDF_LIBDIR=
-NETCDF_INCDIR=
-IOIPSL_INCDIR=$LMDGCM/../IOIPSL/src/
-IOIPSL_LIBDIR=$LMDGCM/../IOIPSL/src/
-ORCH_INCDIR=/work/cont003/p86yann/ORCHIDEE_1_9_2_OMP_MEM/lib_cpl
-ORCH_LIBDIR=/work/cont003/p86yann/ORCHIDEE_1_9_2_OMP_MEM/lib_cpl
-OASIS_INCDIR=$LMDGCM/../../prism/IA64/build/lib/psmile.$couple
-OASIS_LIBDIR=$LMDGCM/../../prism/IA64/lib
-INCA_LIBDIR=$LMDGCM/../INCA3/config/lib
-INCA_INCDIR=$LMDGCM/../INCA3/config/lib
+NETCDF_INCDIR=$(nf-config --fflags)
+NETCDF_LIBDIR=$(nf-config --flibs)
+NETCDF_LIB=""
+MPI_INCDIR=""
+MPI_LIBDIR=""
+MPI_LIB=""
+HDF5_INCDIR=""
+HDF5_LIBDIR=""
+HDF5_LIB=""
 
+XIOS_ROOTDIR=$(cd -P ../XIOS ; pwd)
+XIOS_INCDIR="-I${XIOS_ROOTDIR}/inc"
+XIOS_LIBDIR="-L${XIOS_ROOTDIR}/lib"
+XIOS_LIB="-lxios -lstdc++"
+
+IOIPSL_INCDIR="-I $PWD/../IOIPSL/inc"
+IOIPSL_LIBDIR="-L $PWD/../IOIPSL/lib"
+IOIPSL_LIB="-lioipsl"
