Philippe 25/11/2016: force compiler version for Ada
[MNH-git_open_source-lfs.git] / src / configure
1 #!/bin/bash
2 #MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
3 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
4 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
5 #MNH_LIC for details. version 1.
6 #set -x
7 #set -e
8 if [ "x$XYZ" = "x" ]
9 then
10
11 export VERSION_MASTER=${VERSION_MASTER:-MNH-V5-2}
12 export VERSION_BUG=${VERSION_BUG:-2}
13 export VERSION_XYZ=${VERSION_XYZ:-${VERSION_MASTER}-${VERSION_BUG}}
14 export VERSION_DATE=${VERSION_DATE:-"02/05/2016"}
15 export VERSION_CDF=${VERSION_CDF:-"4.1.3"}
16 export VERSION_HDF=${VERSION_HDF:-"1.8.9"}
17 export VERSION_GRIBAPI=${VERSION_GRIBAPI:-"1.13.1"}
18 export MNH_INT=${MNH_INT:-"4"}
19 export LFI_INT=${LFI_INT:-8}
20 export MNH_IOCDF4=${MNH_IOCDF4:-1}
21 #
22 export NEED_TOOLS=YES
23 #
24 export LOCAL=${PWD%/src}
25 RACINE=$(basename $LOCAL )
26 #
27 cd ${LOCAL}/conf
28 #
29 TARG=$(uname -s -n)
30 #
31 case "$TARG" in
32 'Linux service'*)
33                 export     ARCH=${ARCH:-LXifort}
34                 export  VER_MPI=${VER_MPI:-MPIICE}
35                 export NEED_NCARG=${NEED_NCARG:-YES}
36                 export MVWORK=${MVWORK:-NO}
37                 domain=$(grep .fr /etc/hosts | head -1 )
38                 case "${domain}" in
39 *cines*) # jade
40                 export OPTLEVEL=${OPTLEVEL:-O2}
41                 export MVWORK=${MVWORK:-NO}
42                 export VER_CDF=${VER_CDF:-CDFICE}
43                 export NEED_NCARG=${NEED_NCARG:-YES}
44                 export MNHENV=${MNHENV:-"
45 module rm netcdf ; module load netcdf/4.0
46 module rm MPT    ; module load MPT/2.02
47 module rm intel  ; module load intel/12.0.13
48 export MPI_DSM_CPULIST=0-7:allhosts
49 "}
50 ;;
51 *cict*)  # hyperion
52                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
53                 export VER_CDF=${VER_CDF:-CDFAUTO}
54                 export MNHENV=${MNHENV:-"
55 . /usr/share/modules/init/bash
56 module purge
57 module load intel-fc-10/10.1.017
58 module load sgi-mpt/1.26
59 export MPI_DSM_CPULIST=0-7:allhosts
60 "}
61               ;;
62                 esac
63               ;;
64 'Linux platine'*|'Linux titane'*|'Linux curie'*)
65                 export     ARCH=${ARCH:-LXifort}
66                 export  VER_MPI=${VER_MPI:-MPIAUTO}
67                 export OPTLEVEL=${OPTLEVEL:-O2}
68                 export MVWORK=${MVWORK:-NO}
69                 export VER_CDF=${VER_CDF:-CDFAUTO}
70               ;;
71 'Linux beaufix'*|'Linux compute'*)
72                 export     ARCH=${ARCH:-LXifort}
73                 export  VER_MPI=${VER_MPI:-MPIINTEL}
74                 export OPTLEVEL=${OPTLEVEL:-O3}
75                 export MVWORK=${MVWORK:-NO}
76                 export VER_CDF=${VER_CDF:-CDFBFIX}
77                 export NEED_TOOLS=NO
78                 export MNHENV=${MNHENV:-"
79 module rm intel    ; module load intel/13.1.4.183 ;
80 module rm intelmpi ; module load intelmpi/4.1.1.036 ;
81 module rm netcdf ; module load netcdf/4.3.0 ;
82 module rm grib_api ; module load grib_api/1.13.0_netcdf ;
83 export GRIBAPI_PATH=/opt/softs/libraries/ICC13.1.4.183/grib_api-1.13.0_netcdf
84 "}
85               ;;
86 'Linux prolix'*)
87                 export     ARCH=${ARCH:-LXifort}
88                 export  VER_MPI=${VER_MPI:-MPIINTEL}
89                 export OPTLEVEL=${OPTLEVEL:-O3}
90                 export MVWORK=${MVWORK:-NO}
91                 export VER_CDF=${VER_CDF:-CDFBFIX}
92                 export MNHENV=${MNHENV:-"
93 module rm intel    ; module load intel/13.1.4.183 ;
94 module rm intelmpi ; module load intelmpi/5.1.2.150 ;
95 module rm netcdf ; module load netcdf/4.3.0 ;
96 module rm grib_api ; module load grib_api/1.13.0_netcdf ;
97 export GRIBAPI_PATH=/opt/softs/libraries/ICC13.1.4.183/grib_api-1.13.0_netcdf
98 "}
99               ;;
100 'Linux login0'*|'Linux compute'*)
101                 export     ARCH=${ARCH:-LXifort}
102                 export  VER_MPI=${VER_MPI:-MPIAUTO}
103                 export OPTLEVEL=${OPTLEVEL:-O3}
104                 export MVWORK=${MVWORK:-NO}
105                 export VER_CDF=${VER_CDF:-CDFBULL}
106                 export MNHENV=${MNHENV:-"
107 module rm intel    ; module load intel/13.0.1.117 ;
108 module rm intelmpi ; module load intelmpi/4.1.0 ;
109 module rm intel-itac ; module load intel-itac/8.0.3
110 "}
111               ;;
112 'Linux brodie'*|'Linux mercure'*)
113                 export     ARCH=${ARCH:-SX8}
114                 export  VER_MPI=${VER_MPI:-MPIAUTO}
115                 export OPTLEVEL=${OPTLEVEL:-O4}
116                 export MVWORK=${MVWORK:-YES}
117                 export VER_CDF=${VER_CDF:-CDFSX}
118                 export MNHENV=${MNHENV:-"
119 module rm sxf90  ; module load sxf90/400 ;
120 module rm sxmpi  ; module load sxmpi/8.0.10 ;
121 module rm netcdf ; module load netcdf/3.6.3
122 "}
123               ;;
124 'Linux babel'*)
125                 export     ARCH=${ARCH:-BGQ}
126                 export  VER_MPI=${VER_MPI:-MPIAUTO}
127                 export OPTLEVEL=${OPTLEVEL:-O2}
128                 export MVWORK=${MVWORK:-YES}
129                 export MNHENV=${MNHENV:-"
130 module load netcdf/3.6.3
131 "}
132                ;;
133 'Linux turing'*)
134                 export     ARCH=${ARCH:-BGQ}
135                 export  VER_MPI=${VER_MPI:-MPIAUTO}
136                 export OPTLEVEL=${OPTLEVEL:-O2NAN}
137                 export MVWORK=${MVWORK:-YES}
138                 export VER_CDF=${VER_CDF:-CDFBGQ}
139                 export MNHENV=${MNHENV:-"
140 source /bglocal/fe/pub/Modules/default/init/bash
141 export MODULEPATH=/bghome/rech/mnh/rmnh007/my_modules:\$MODULEPATH
142 module purge
143 #module load ibmcmp/V1R2M2/14.01.0000.0011/gcc.legacy
144 module load mpi/gcc.legacy
145 export VER_GA=ga-mpi-5-0-3-v1r2m2-gcc-legacy
146 module load ga/\${VER_GA}
147 "}
148               ;;
149 'Linux ada'*)
150                 export     ARCH=${ARCH:-LXifort}
151                 export  VER_MPI=${VER_MPI:-MPIINTEL}
152                 export OPTLEVEL=${OPTLEVEL:-O2}
153                 export MVWORK=${MVWORK:-YES}
154                 export MNHENV=${MNHENV:-"
155 #export OBJDIR_PATH=$WORKDIR/DIR_OBJ_ADA
156 export MP_MPILIB=pempi
157 module purge
158 module load intel/2013.1
159 module load netcdf/seq/4.1.3
160 "}
161               ;;
162 AIX*)
163                 export MNH_ARCH=`echo $ARCH | grep AIX`
164                 export     ARCH=${MNH_ARCH:-AIX64}
165                 export  VER_MPI=${VER_MPI:-MPIAUTO}
166                 export OPTLEVEL=${OPTLEVEL:-O2}
167                 export MVWORK=${MVWORK:-NO}
168                 export VER_CDF=${VER_CDF:-CDFAIX}
169                 case "$(hostname)" in
170                       vargas*)
171                       export MNHENV=${MNHENV:-"
172 module rm fortran ; module load fortran/13.1.0.7
173 module rm netcdf  ; module load netcdf/3.6.3
174 "}
175                       ;;
176                       c1a*)
177                       export VERSION_GRIBAPI="1.9.9"
178                       export MNHENV=${MNHENV:-"
179 . /usr/local/apps/module/init/sh.in
180 module rm fortran ; module load fortran/xlf/13.1.0.7
181 module rm netcdf  ; module load netcdf/3.6.3
182 export CDF_PATH=/usr/local/apps/netcdf/3.6.3/LP64
183 export GRIBAPI_PATH=/usr/local/lib/metaps/lib/grib_api/${VERSION_GRIBAPI}
184 export LIB_GRIBAPI='${GRIB_API_LIB}'
185 "}
186                       ;;
187                       c2a*)
188                       export VERSION_GRIBAPI="2.0.0"
189                       export MNHENV=${MNHENV:-"
190 . /usr/local/apps/module/init/sh.in
191 module rm fortran ; module load fortran/xlf/13.1.0.9
192 module rm netcdf  ; module load netcdf/3.6.3
193 export CDF_PATH=/usr/local/apps/netcdf/3.6.3/LP64
194 export GRIBAPI_PATH=/usr/local/lib/metaps/lib/grib_api/${VERSION_GRIBAPI}
195 export LIB_GRIBAPI='${GRIB_API_LIB}'
196 "}
197                       ;;
198                  esac
199               ;;
200 'Linux cc'*) # ECMWF Cray plateforme
201                 export MNH_ARCH=`echo $ARCH | grep LX`
202                 export     ARCH=${MNH_ARCH:-LXcray}
203                 export  VER_MPI=${VER_MPI:-MPICRAY}
204                 export OPTLEVEL=${OPTLEVEL:-O2}
205                 export MVWORK=${MVWORK:-NO}
206                 export VER_CDF=${VER_CDF:-CDFAUTO}
207                 if [ "${ARCH}" == "LXcray" ] 
208                 then
209                 export MNHENV=${MNHENV:-"
210 . /opt/modules/default/init/bash
211 module rm grib_api
212 "}
213                 else
214                 if [ "${ARCH}" == "LXifort" ]
215                 then
216                 export MNHENV=${MNHENV:-"
217 . /opt/modules/default/init/bash
218 module switch PrgEnv-cray PrgEnv-intel
219 module rm grib_api
220 "}
221                 fi
222                 fi
223 ;;
224 'Linux sxmnh1') #CNRM ifort sur sxmnh1 (diff mandriva)
225                 export    OMPI_FC=ifort
226                 export       ARCH=${ARCH:-LXifort}
227                 export    VER_MPI=${VER_MPI:-MPIAUTO}
228                 export   OPTLEVEL=${OPTLEVEL:-DEBUG}
229                 export     MVWORK=${MVWORK:-NO}
230                 export    VER_CDF=${VER_CDF:-CDFCTI}
231                 export NEED_NCARG=${NEED_NCARG:-NO}
232                 export NEED_TOOLS=NO
233               ;;
234 'Linux lx'*|'Linux sx'*|'Linux px'*) #CNRM
235                 export MNH_ARCH=`echo $ARCH | grep LX`
236                 export     ARCH=${MNH_ARCH:-LXgfortran}
237                 export  VER_MPI=${VER_MPI:-MPIAUTO}
238                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
239                 export MVWORK=${MVWORK:-NO}
240                 export VER_CDF=${VER_CDF:-CDFCTI}
241                 export NEED_NCARG=${NEED_NCARG:-NO}
242                 export NEED_TOOLS=NO
243               ;;
244 'Linux nuwa'*)
245                 export     ARCH=${ARCH:-LXifort}
246                 export  VER_MPI=${VER_MPI:-MPIAUTO}
247                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
248                 export MVWORK=${MVWORK:-NO}
249                 export VER_CDF=${VER_CDF:-CDFAUTO}
250                 export NEED_NCARG=${NEED_NCARG:-YES}
251                       export MNHENV=${MNHENV:-"
252 . /opt/intel/fce/10.1.021/bin/ifortvars.sh
253 export MPI_ROOT=/usr/local/OpenMPI/1.6.3/ifort10.1.021
254 export PATH=\$MPI_ROOT/bin:\$PATH
255 export LD_LIBRARY_PATH=\$MPI_ROOT/lib64:\$LD_LIBRARY_PATH
256 export MANPATH=\$MPI_ROOT/share/man:\$MANPATH
257 "}
258               ;;
259 'Linux eos'*)
260                 export     ARCH=${ARCH:-LXifort}
261                 export  VER_MPI=${VER_MPI:-MPIINTEL}
262                 export OPTLEVEL=${OPTLEVEL:-O2}
263                 export VER_CDF=${VER_CDF:-CDFAUTO}
264                 export   MNHENV=${MNHENV:-"
265 export SLURM_CPU_BIND=none
266 export I_MPI_PIN_PROCESSOR_LIST=all:map=spread
267 "}
268               ;;
269
270 'Linux occigen'*)
271                 export     ARCH=${ARCH:-LXifort}
272                 export  VER_MPI=${VER_MPI:-MPIINTEL}
273                 export OPTLEVEL=${OPTLEVEL:-O2}
274                 export VER_CDF=${VER_CDF:-CDFAUTO}
275                 export   MNHENV=${MNHENV:-"
276 ulimit -s unlimited
277 module load intel/15.0.3.187
278 module load intelmpi/5.0.1.035
279 export SLURM_CPU_BIND=none
280 export I_MPI_PIN_PROCESSOR_LIST=all:map=spread
281 "}
282               ;;
283
284 Linux*)
285                 export     ARCH=${ARCH:-LXgfortran}
286                 export  VER_MPI=${VER_MPI:-MPIVIDE}
287                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
288                 export MVWORK=${MVWORK:-NO}
289                 #export VER_CDF=${VER_CDF:-CDFGFOR}
290                 export VER_CDF=${VER_CDF:-CDFAUTO}
291                 export NEED_NCARG=${NEED_NCARG:-YES}
292               ;;
293 *)
294                 echo "WARNING ; system not yet tested "
295                 echo "WARNING ; edit profile_mesonh & set correct variables ARCH , VER_MPI & OPTLEVEL "
296
297                 export     ARCH=${ARCH}
298                 export  VER_MPI=${VER_MPI:-MPIVIDE}
299                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
300               ;;
301 esac
302 ##
303 ## Environnement for scandollar
304 ##
305
306 if [ "x${CONF_DOLLAR}" = "x" ] ; then
307 # set default value for CONF_DOLLAR file
308 case "$(hostname)" in
309   tori*|yuki*)
310         export POSTCONF=confdollar_dsinec_default
311         ;;
312
313   lx*|px*|sx*)
314         export POSTCONF=confdollar_cnrmpc_default
315         ;;
316
317   aeropc*)
318         export POSTCONF=confdollar_aeropc_default
319
320         ;;
321
322   brodie*)
323         export POSTCONF=confdollar_brodie_default
324
325         ;;
326
327   vargas*)
328         export POSTCONF=confdollar_vargas_default
329         ;;
330
331   c1a*)
332         export POSTCONF=confdollar_c1a_default
333         ;;
334
335   service*)
336         export POSTCONF=confdollar_jade_default
337         ;;
338
339   babel*)
340         export POSTCONF=confdollar_babel_default
341         ;;
342   turing*)
343         export POSTCONF=confdollar_turing_default
344         ;;
345  titane*|curie*)
346         export POSTCONF=confdollar_titane_default
347         ;;
348
349   eos*)
350         export POSTCONF=confdollar_eos_default
351         ;;
352
353   occigen*)
354         export POSTCONF=confdollar_occigen_default
355         ;;
356
357   *)
358         export POSTCONF=confdollar_aeropc_default
359         ;;
360 esac
361
362 export CONF_DOLLAR=${LOCAL}/conf/post/${POSTCONF}
363
364 fi
365
366 #
367 #  Install 32/64 mesonh tools
368 #
369 if [ "x${NEED_TOOLS}" == "xYES" ] ; then
370   case "$(uname -m)" in
371   'x86_64')
372           export BIN_TOOLS=${BIN_TOOLS:-X86_64}
373            ;;
374   'x86'|'i'*'86')
375           export BIN_TOOLS=${BIN_TOOLS:-X86}
376            ;;
377   esac
378 fi
379
380 #
381 # Generate profile_mesonh
382 #
383 ${LOCAL}/bin/eval_dollar  profile_mesonh.ihm > profile_mesonh
384 chmod +x profile_mesonh
385 XYZ=${ARCH}${MNH_REAL}I${MNH_INT}-${VERSION_XYZ}${VER_USER:+-${VER_USER}}-${VER_MPI}-${OPTLEVEL}
386 cp profile_mesonh profile_mesonh-${XYZ}
387 #
388 #  Do some post-install stuff
389 #
390 if [ "x${MVWORK}" == "xYES" ] ; then
391    if [ "x${WORKDIR}" == "x" ] ; then
392      echo "ATTENTION :: configure !!!!!"
393      echo
394      echo '  ---> vous n avez pas initialiser la variable $WORKDIR '
395      echo '  ---> ou seront stoké les binaires et cas tests '
396      echo '  ---> initialisez la et relance "./configure"'
397      exit 1
398    fi
399    if [ -d $WORKDIR ] && [ ${LOCAL} == ${LOCAL##/work} ] ; then
400 #  if we are not allready in the workdir --> move stuff
401       WORK=$WORKDIR/${RACINE}_WORKDIR
402       mkdir -p ${WORK}
403       for dir in MY_RUN exe pub
404       do
405          [ -d $LOCAL/${dir} ] && [ ! -L $LOCAL/${dir} ] \
406           && mv $LOCAL/${dir} ${WORK}/. \
407           && ln -s ${WORK}/${dir} $LOCAL/.
408       done
409    fi
410 fi
411 if [ "x${NEED_NCARG}" != "xNO" ] ; then
412 ( cd $LOCAL/pub ; [ ! -d ncl_ncarg-5.2.1.Linux_x86_64 ] && tar xvfz ncl_ncarg-5.2.1.Linux_x86_64.tar.gz )
413 fi
414
415 #
416 #  Install CDF if VER_CDF=CDFAUTO
417 #
418 if [ "x${VER_CDF}" == "xCDFAUTO" ] ;then
419 ( cd $LOCAL/src/LIB ; [ ! -d netcdf-${VERSION_CDF} ] && tar xvfz netcdf-${VERSION_CDF}.tar.gz )
420 ( cd $LOCAL/src/LIB ; [ ! -d hdf5-${VERSION_HDF} ] && tar xvfz hdf5-${VERSION_HDF}.tar.gz )
421 fi
422 #
423 #  Install GRIBAPI
424 #
425 cd $LOCAL/src/LIB ; [ ! -d grib_api-${VERSION_GRIBAPI} ] && [ -f grib_api-${VERSION_GRIBAPI}.tar.gz ] && gunzip -c grib_api-${VERSION_GRIBAPI}.tar.gz |tar -xvf -
426 ##########################################################
427 #                                                        #
428 #      RESUME                                            #
429 #                                                        #
430 ##########################################################
431
432 echo  ARCH=${ARCH}
433 echo  VER_MPI=${VER_MPI}
434 echo  VER_USER=${VER_USER-" pas de version user ..."}
435 echo  OPTLEVEL=${OPTLEVEL}
436 echo  CONF_DOLLAR=${CONF_DOLLAR}
437 echo  VER_CDF=${VER_CDF}
438 echo  BIN_TOOLS=${BIN_TOOLS}
439 echo
440 echo  "---> XYZ=${XYZ}"
441 echo
442 echo "création du fichier -->  ../conf/profile_mesonh-${XYZ}"
443 echo
444 ##########################################################
445 #                                                        #
446 # ENVIRONEMENT MESONH ALLREADY SET                       #
447 #                                                        #
448 ##########################################################
449 else
450 clear
451 echo
452 echo "ATTENTION :: configure !!!!!"
453 echo
454 echo '  ---> vous avez déjà initialisé votre environnement MESONH sur cette version'
455 echo '  ---> $XYZ="'$XYZ'"'
456 echo
457 echo "Vérifiez votre fichier '.profile'" ou "'.bashrc'"  !!!
458 echo
459 echo "  ---> mettez en commentaire la ligne '. ../profile_mesonh...' "
460 echo "  ---> relogger vous sur une autre session et relancer ./configure "
461 echo
462 echo "Fichier 'profile_mesonh' non modifié !!! "
463 echo
464 exit 1
465 fi