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