Index: BOL/script_install/install.sh
===================================================================
--- BOL/script_install/install.sh	(revision 1911)
+++ BOL/script_install/install.sh	(revision 2030)
@@ -32,4 +32,5 @@
 ###########################################################################
 
+echo install.sh DEBUT `date`
 set -e
 
@@ -66,5 +67,12 @@
 #####################################################################
 # Test for old gfortran compilers
+# If the compiler is too old (older than 4.3.x) we test if the
+# temporary gfortran44 patch is available on the computer in which
+# case the compiler is changed from gfortran to gfortran44
+# Must be aware than parallelism can not be activated in this case
+#####################################################################
+
 if [ $compilo = gfortran ] ; then
+   gfortran=gfortran
    gfortranv=`gfortran --version | \
    head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } '`
@@ -74,6 +82,11 @@
        echo compilo=xxx
        echo in the install.sh script and rerun it
-       exit
+       if [ `which gfortran44 | wc -w` -ne 0 ] ; then
+          gfortran=gfortran44
+       else
+          echo gfotran trop vieux ; exit
+       fi
    fi
+   compilo=$gfortran
 fi
 #####################################################################
@@ -93,5 +106,5 @@
    if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
    OPTIM='-i4 -O3'
-elif [ $compilo = gfortran ] ; then
+elif [ $compilo = $gfortran ] ; then
    if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi
    OPTIM='-O3'
@@ -173,5 +186,5 @@
 if [ $pclinux = 1 ] ; then
 cd $MODEL
-cat <<eod> tt.f90
+cat <<eod > tt.f90
 print*,'coucou'
 end
@@ -189,4 +202,5 @@
 
 
+
 if [ $getlmdzor = 1 ] ; then
 echo '##########################################################'
@@ -195,4 +209,5 @@
 cd $MODEL
 wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/modipsl.$version.tar.gz
+echo install.sh wget_OK `date`
 gunzip modipsl.$version.tar.gz
 tar xvf modipsl.$version.tar
@@ -230,7 +245,7 @@
    export CC=gcc
    export CXX=g++
-elif [ $compilo = gfortran ] ; then
-   export FC=gfortran
-   export F90=gfortran
+elif [ $compilo = $gfortran ] ; then
+   export FC=$gfortran
+   export F90=$gfortran
    export F90FLAGS=" -ffree-form $OPTIMNC"
    export FFLAGS=" $OPTIMNC"
@@ -262,9 +277,13 @@
 fi
 
+sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
 localdir=`pwd -P`
 ./configure --prefix=$localdir
+sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile
 make check
 make install
+echo install.sh netcdf_OK `date`
 fi # of if [ $netcdf = 1 ]
+
 
 #=======================================================================================
@@ -283,6 +302,5 @@
 if [ $ioipsl = 1 ] ; then
   cd $MODEL/modipsl
-  rm -rf lib/*
-
+  \rm -rf lib/*
   cd util
 
@@ -297,5 +315,5 @@
   fi
   cp AA_make.gdef AA_make.orig
-  F_C="$compilo -c " ; if [ $compilo = gfortran ] ; then F_C="$compilo -c -cpp " ; fi
+  F_C="$compilo -c " ; if [ $compilo = $gfortran ] ; then F_C="$compilo -c -cpp " ; fi
   sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp
   sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $F_C": \
@@ -339,5 +357,5 @@
     make clean
     make
-    if [ $compilo = gfortran ] ; then # copy module files to lib
+    if [ $compilo = $gfortran ] ; then # copy module files to lib
       cp -f *.mod ../../../lib
     fi
@@ -386,5 +404,7 @@
 
   fi # of if [ ${hostname:0:5} = ada33 ]
+  echo install.sh ioipsl_OK `date`
 fi # of if [ $ioipsl = 1 ]
+
 
 #============================================================================
@@ -413,8 +433,10 @@
       if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi
       cd $src_d ; \rm -f *.mod make ; make clean
-      make ; if [ $compilo = gfortran ] ; then cp -f *.mod ../../../lib ; fi
+      make ; if [ $compilo = $gfortran ] ; then cp -f *.mod ../../../lib ; fi
       cd ..
   done
+  echo install.sh orchidee_OK `date`
 fi # of if [ "$veget" = 1 ]
+
 
 #============================================================================
@@ -436,61 +458,4 @@
 sed -e "$nl s/      PROGRA/PROGRA/" create_make_gcm.orig >| create_make_gcm
 
-#mv -f tmp crea
-if [ "$pclinux" = 1 ] ; then
-  if [ $compilo = gfortran ] ; then
-sed \
--e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
--e 's/g95/gfortran/g' \
--e 's/-fmod=/-I/g' \
--e 's/-fno-second-underscore//' -e 's/-fstatic//' \
--e 's/-lparallel//' \
--e 's/-lnetcdff//g' \
--e 's/-lorglob//' \
--e 's/-ffixed-form//' -e 's/-ffree-form//' \
--e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
-  elif [ $compilo = ifort ] ; then
-sed \
--e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
--e 's/g95/ifort/g' \
--e 's/-fmod=/-module /g' \
--e 's/-fno-second-underscore//' -e 's/-fstatic//' \
--e 's/-lparallel//' \
--e 's/-lnetcdff//g' \
--e 's/-lorglob//' \
--e 's/-ffixed-form//' -e 's/-ffree-form//' \
--e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
-  else # g95 or pgf90
-sed \
--e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
--e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
--e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
--e 's/-fno-second-underscore//' -e 's/-fstatic//' \
--e 's/-lparallel//' \
--e 's/-lnetcdff//g' \
--e 's/-lorglob//' \
--e 's/-ffixed-form//' -e 's/-ffree-form//' \
--e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
-  fi
-else
-sed \
--e 's/-lparallel//' \
--e 's/-lorglob//' \
--e 's/-lsxorglob//' \
--e 's/-lsxparallel//' \
--e 's/-lsxioipsl/-lioipsl/g' \
-makegcm.orig >| makegcm
-fi
-
-chmod +x makegcm
 
 ###########################################################
@@ -523,7 +488,7 @@
      mv -f arch-local.fcm.new arch-local.fcm
    fi
-elif [ $compilo = gfortran ] ; then
-sed -e s:"%COMPILER            pgf95":"%COMPILER            gfortran":1 \
-    -e s:"%LINK                pgf95":"%LINK                gfortran":1 \
+elif [ $compilo = $gfortran ] ; then
+sed -e s:"%COMPILER            pgf95":"%COMPILER            $gfortran":1 \
+    -e s:"%LINK                pgf95":"%LINK                $gfortran":1 \
     -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
     -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -Wall -fbounds-check":1 \
@@ -576,4 +541,5 @@
 # Compile LMDZ
 ##################################################################
+echo install.sh avant_compilation `date`
 #ok_veget=false
 #if [ "$veget" = 1 ] ; then ok_veget=true ; fi
@@ -585,4 +551,6 @@
     ./$makelmdz -d ${grid_resolution} -arch X64_ADA -v $veget_version gcm
 fi
+echo install.sh apres_compilation `date`
+
 
 if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then
@@ -606,7 +574,9 @@
 echo '##########################################################'
 
-rm -rf BENCH${grid_resolution}
+\rm -rf BENCH${grid_resolution}
 bench=bench_lmdz_${grid_resolution}
+echo install.sh avant_chargement_bench  `date`
 wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/$bench.tar.gz
+echo install.sh apres_chargement_bench  `date`
 gunzip $bench.tar.gz
 tar xvf $bench.tar
@@ -623,7 +593,9 @@
 fi
 
+
 cd BENCH${grid_resolution}
 ./bench.sh > bench.out  2>&1
 
+
 echo '##########################################################'
 echo ' Bench results '
@@ -631,4 +603,5 @@
 
 cat ./bench.out
+echo install.sh FIN_du_BENCH  `date`
 
 echo '##########################################################'
@@ -637,2 +610,9 @@
 echo 'or ./bench.sh'
 echo '##########################################################'
+
+if [ $gfortran = gfortran44 ] ; then
+    echo Your gfortran compiler was too old so that the model was automatically
+    echo compiled with gfortran44 instead. It can not be used in parallel mode.
+    echo You can change the compiler at the begining of the install.sh
+    echo script and reinstall.
+fi
