forked from cea-trust-platform/trust-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·765 lines (673 loc) · 31.1 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
#!/bin/bash
[ ! -f ./configure ] && echo "`basename $0` must be run where it is located." && exit -1
# Unset TRUST variables from the previous source if available
for variable in "project_directory `env | grep -Ev 'PATH|OLDPWD|PWD' | grep TRUST | cut -d'=' -f 1`" ; do unset $variable ; done
TRUST_ROOT_SA=$TRUST_ROOT
[ "`id -u 2>/dev/null`" = 0 ] && echo "It is not recommended to configure and install TRUST as root." && exit
[ -f NON_INSTALLED ] && rm -f NON_INSTALLED
##########################
# Testing basic commands #
##########################
[ "`uname 1>/dev/null 2>&1;echo $?`" != 0 ] && echo " uname" >> NON_INSTALLED
multiple_choices=0 # if =1, it tells the user that he can install a command among those belonging to the same line
if [ "`whence ls 1>/dev/null 2>&1;echo $?`" != 0 ] && [ "`whereis -b whereis 1>/dev/null 2>&1;echo $?`" != 0 ] && [ "`type type 1>/dev/null 2>&1;echo $?`" != 0 ]
then
echo " whence type whereis (*)" >> NON_INSTALLED
multiple_choices=1
fi
############################
# Check if a command exists
whence2_()
{
a=`whence ls 2>/dev/null`
err=$?
[ "`uname -s`" = OSF1 ] && err=1
if [ $err = 0 ]; then
whence $1 > .toto
cat .toto
else
a=`type $1 2>/dev/null`
if [ $? = 0 ] ; then
echo $a
else
whereis -b $1 > .toto
cat .toto
fi
fi
}
############################
cmds="pwd whoami find cut wc ln tar gunzip"
for com in $cmds ; do
[ "`whence2_ $com`" = "$com:" ] && [ "`whence2_ $com`" != "" ] && echo " $com" >> NON_INSTALLED
done
if [ -f NON_INSTALLED ] ; then
echo "Fatal error: command(s)"
cat NON_INSTALLED
echo "is (are) not accessible... host misconfigured."
[ "$multiple_choices" = 1 ] && echo "(*) Only one command is needed but none has been found"
exit
fi
#######################################################################################################
# Checking if compilers exist. User can still force the use of a specific compiler
# If user forces a compiler, we do not check if it really exists. This is still done by configurer_env
#######################################################################################################
c_compiler_found=0
CC_compiler_found=0
f77_compiler_found=0
list_c_found=""
list_CC_found=""
# This list is token from the env_src/configurer_env script
list_of_c_compilers="cc"
list_of_f77_compilers="f90 f77 g77"
arch=`uname -s`
case $arch in
HP-UX) list_of_CC_compilers="aCC CC g++"
;;
IRIX*) list_of_CC_compilers="CC g++"
;;
SunOS) list_of_CC_compilers="g++ CC"
;;
AIX) list_of_CC_compilers="mpCC_r xlC g++"
list_of_f77_compilers="f90 f77 g77 mpxlf_r xlf xlf90"
list_of_c_compilers="mpcc_r cc"
;;
OSF1) list_of_CC_compilers="cxx g++"
;;
Linux) list_of_CC_compilers="g++ icpc icc ecc pgCC"
list_of_c_compilers="gcc icc ecc pgcc cc"
list_of_f77_compilers="f90 f77 g77 gfortran ifort ifc efc pgf90 pgf77"
;;
CYGWIN*) list_of_CC_compilers="g++ icpc icc ecc pgCC"
list_of_f77_compilers="f90 f77 g77 gfortran ifort ifc efc pgf90 pgf77"
list_of_c_compilers="gcc icc ecc pgcc cc"
;;
Darwin) list_of_CC_compilers="g++ gcc"
list_of_c_compilers="gcc cc"
;;
cobea) list_of_CC_compilers="CC g++"
list_of_f77_compilers="fort77 g77 f90"
;;
UNIX_System_V) list_of_CC_compilers="CC g++"
list_of_f77_compilers="frt f77 f90"
;;
*) list_of_CC_compilers="g++ CC"
list_of_f77_compilers="f90 f77 g77 fort77"
list_of_c_compilers="gcc cc"
;;
esac
if [ "`echo $@ | grep 'cc='`" = "" ] ; then # C compiler has not been forced
for comp in $list_of_c_compilers ; do
[ "`whence2_ $comp`" != "$comp:" ] && [ "`whence2_ $comp`" != "" ] && c_compiler_found=1 && list_c_found=$list_c_found" "$comp
done
else
c_compiler_found=2
fi
if [ "`echo $@ | grep 'c++='`" = "" ] ; then # C++ compiler has not been forced
for comp in $list_of_CC_compilers ; do
[ "`whence2_ $comp`" != "$comp:" ] && [ "`whence2_ $comp`" != "" ] && CC_compiler_found=1 && list_CC_found=$list_CC_found" "$comp
done
else
CC_compiler_found=2
fi
if [ "`echo $@ | grep 'fc='`" = "" ] ; then # F77 compiler has not been forced
for comp in $list_of_f77_compilers ; do
[ "`whence2_ $comp`" != "$comp:" ] && [ "`whence2_ $comp`" != "" ] && f77_compiler_found=1
done
else
f77_compiler_found=2
fi
[ "$list_c_found" = " gcc" ] && [ "`eval gcc --version 1>/dev/null 2>&1;echo $?`" != 0 ] && c_compiler_found=0 && list_c_found=""
[ "$c_compiler_found" = 0 ] && multiple_choices=1 && echo " C compiler: $list_of_c_compilers (*)" >> NON_INSTALLED
[ "$CC_compiler_found" = 0 ] && multiple_choices=1 && echo " C++ compiler: $list_of_CC_compilers (*)" >> NON_INSTALLED
[ "$f77_compiler_found" = 0 ] && multiple_choices=1 && echo " Fortran compiler: $list_of_f77_compilers (*)" >> NON_INSTALLED
######################
# Checking prerequis #
######################
for file in /etc/os-release /etc/system-release /etc/release /etc/issue.net /etc/issue
do
[ -f $file ] && OSfile=$file && break
done
if [ "`grep 'Ubuntu ' $OSfile 2>/dev/null`" != "" ] || [ "`grep 'Debian ' $OSfile 2>/dev/null`" != "" ]
then
[ `eval dpkg-query -W libx11-dev 1>/dev/null 2>&1;echo $?` != 0 ] && echo "libx11-dev" >> NON_INSTALLED
elif [ "`grep 'Fedora ' $OSfile 2>/dev/null`" != "" ] || [ "`grep 'CentOS ' $OSfile 2>/dev/null`" != "" ] || [ "`grep 'Red Hat' $OSfile 2>/dev/null`" != "" ]
then
[ `eval rpm -qa | grep -i libX11-devel 1>/dev/null 2>&1;echo $?` != 0 ] && echo "libX11-devel" >> NON_INSTALLED
#elif [ "`grep 'CentOS ' $OSfile 2>/dev/null`" != "" ] || [ "`grep 'Red Hat' $OSfile 2>/dev/null`" != "" ]
#then
# [ `eval yum list installed libX11-devel 1>/dev/null 2>&1;echo $?` != 0 ] && echo "libX11-devel" >> NON_INSTALLED
else
echo "If an error with hwloc occurs, install libX11-dev on your OS"
fi
########################
# Testing make command #
########################
if [ "`eval make --version 1>/dev/null 2>&1;echo $?`" != 0 ] ; then
echo ""
echo "Fatal error:"
echo "------------"
echo " make command not found."
if [ -f NON_INSTALLED ] ; then
echo ""
echo "These packages are also missing:"
echo "--------------------------------"
cat NON_INSTALLED
[ "$multiple_choices" = 1 ] && echo "(*) Only one command is needed but none has been found."
fi
echo "Contact your system administrator to install it."
exit
fi
###################
# Debut du script #
###################
export TRUST_ROOT=`pwd`
first=1
[ "$TRUST_ROOT" = "$TRUST_ROOT_SA" ] && [ "$TRUST_ENV" != "" ] && first=0
[ -f configure.log ] && first=0
mkdir -p lib exec env
( cd env; ln -sf ../env_src/* .)
###################
# Check prerequis #
###################
bin/Installer_TRUST -check_prerequis || exit -1
export PATH=$PATH:$TRUST_ROOT/exec/utils/bin
#[ -d $TRUST_ROOT/exec/utils/bin ] && export PATH=$PATH:$TRUST_ROOT/exec/utils/bin
#[ -d $TRUST_ROOT/bin/bin ] && export PATH=$PATH:$TRUST_ROOT/bin/bin
###############################
# Clean old directories (<v169)
###############################
#reps="ALE EF Front_tracking_discontinu Kernel MAIN P1NCP1B Phase_field Rayonnement Rayonnement_semi_transp ThHyd ThSol UtilitairesAssemblages VDF VEF Zoom"
#reps="EF Kernel MAIN P1NCP1B ThHyd ThSol VDF VEF"
#for rep in $reps
#do
# [ -d $rep ] && rm -r -f $rep
#done
#########################################
# Creation des liens avec les autres VOBS
#########################################
#reps="../Tests_TRUST/tests ../Doc_TRUST/doc ../Pre_Post_TRUST/Outils"
#reps=""
#for rep in $reps
#do
# # Eventuelle substitution pour les VOBs en Noyau et non TRUST
# # Attention TRUST_Awk n'est pas encore defini...
# [ ! -d $rep ] && rep=`echo $rep | awk '{sub("TRUST","Noyau",$0);print $0}'`
# if [ -d $rep ]
# then
# r=`basename $rep`
# [ ! -d $r ] && ln -sf $rep $r && echo "Link created: $rep ->" $r
# fi
#done
if [ "$1" != "-disable-optionals" ] && [ "$1" != "-for_appli_salome" ] && [ "$1" != "-disable-tools" ]
then
echo "----------------------------------------------------------------------------------------------------------------------------"
echo "Usage: `basename $0` "
echo "[-help] Print help of the different configure options."
echo "[-disable-optionals] Disable all optionals librairies and tools."
echo "[-disable-tools] Disable all tools to build only a binary."
echo "[-add_search=<dir>] Add a directory to the defaults path to search a tool."
echo "[-c++=<prog>] Force the use of a specified C++ compiler."
echo "[-cc=<prog>] Force the use of a specified C compiler."
echo "[-fc=<prog>] Force the use of a specified Fortran compiler."
echo "[-cxxflags=<flags>] Add C++ compiler options."
echo "[-cflags=<flags>] Add C compiler options."
echo "[-fflags=<flags>] Add Fortran compiler options."
echo "[-native] Add compiler optimizations relative to native architecture. Warning: binary is not portable and segfault are possible..."
echo "[-force_provided_mpich] Use the provided MPICH `awk -F= '/default_version=/ {print $2}' ThirdPart/src/LIBMPI/Installer_mpich` version (default if a native and valid MPI is not found)."
echo "[-force_latest_mpich] Download and use the MPICH `awk -F= '/latest_version=/ {print $2}' ThirdPart/src/LIBMPI/Installer_mpich` version."
echo "[-force_provided_openmpi] Use the provided OpenMPI `awk -F= '/default_version=/ {print $2}' ThirdPart/src/LIBMPI/Installer_openmpi` version."
echo "[-force_old_openmpi] Download and use the OpenMPI `awk -F= '/old_version=/ {print $2}' ThirdPart/src/LIBMPI/Installer_openmpi` version (valgrind free)."
echo "[-force_latest_openmpi] Download and use the OpenMPI `awk -F= '/latest_version=/ {print $2}' ThirdPart/src/LIBMPI/Installer_openmpi` version."
echo "[-force_even_unsupported] Force the configure even the compiler/OS is not supported."
echo "[-cuda] Activate the CUDA support into several libraries for GPU computing (experimental). It activates OpenMP support."
echo "[-openmp] Enable OpenMP support (use of threaded BLAS like Mkl or OpenBlas and build PETSc with OpenMP support."
echo "[-disable-petsc] Disable PETSc library installation."
echo "[-enable-petsc-debug] Enable PETSc library debug only with \$exec_debug of TRUST."
echo "[-with-med=dir] Force Using external MED library"
echo "[-with-hdf=dir] Force Using external HDF library"
echo "[-with-medcoupling=dir] Force Using external MEDCoupling library"
echo "[-with-64-bit-indices] Build with 64 bits integer indices"
echo "[-disable-metis] Disable metis library installation."
echo "[-disable-mpi] Disable MPI library detection/installation and build a non-parallel version of the application."
echo "[-disable-mpi4py] Disable mpi4py installation."
echo "[-disable-ccache] Disable ccache detection/installation."
echo "[-disable-valgrind] Disable valgrind installation and build."
echo "[-disable-gnuplot] Disable gnuplot installation and build."
echo "[-disable-tcl_tk] Disable Tcl/Tk detection/installation."
echo "[-disable-gmsh] Disable Gmsh installation and build."
echo "[-disable-plot2d] Disable PLOT2D and WIZZARD installation and build."
echo "[-disable-mpiio] Disable MPI-IO mode for writing of .xyz binary output file."
echo "[-disable-check_sources] No check sources before compiling."
echo "[-disable-checks] Disable checks for external packages, sources, disk space and speed."
echo "[-without-host_file] Do not load the environnement variables specified in an env_src/HOST_`hostname | awk -F. '{print $1}'`.sh file."
echo "[-without-doc] Do not build the documentation."
echo "[-without-pdflatex] Do not build the pdf documentation."
echo "[-without-visit] Do not install VisIt."
echo "[-download-visit] Download a version of VisIt rather trying to build a version."
#echo "[-download-salome] Download the Salome `awk -F= '/version_salome=/ {print $2}' env_src/configurer_env` version in the TRUST environment."
echo "[-for_appli_salome] Force the configuration for TRUST application in Salome platform."
echo "[-clean] Clean the packages installed by configure."
echo "----------------------------------------------------------------------------------------------------------------------------"
fi
CC=""
cc=""
F77=""
clean=""
LIST_THIRD_PARTY="PETSC MED MPI METIS MEDCOUPLING CCACHE GMSH VALGRIND GNUPLOT TCL_TK PLOT2D"
#[ -f configure.log ] && sed "s/^/# /" -i configure.log
[ -f configure.log ] && sed "s/# //" -i configure.log && sed "s/^/# /" -i configure.log
echo $0 $* "\$"* >> configure.log
if [ "$1" = "-for_appli_salome" ]
then
shift
export TRUST_ROOT=$TRUST_ROOT_SA
$0 -disable-ccache -disable-gnuplot -disable-tcl_tk -disable-valgrind -without-visit -disable-gmsh -disable-checks -disable-check_sources -with-med=$MEDFILE_ROOT_DIR -with-hdf=$HDF5_ROOT_DIR $*
# pas encore pas ICoCoMEDField -with-medcoupling=$MEDCOUPLING_ROOT_DIR $*
exit $?
fi
if [ "$1" = "-disable-optionals" ]
then
shift
export TRUST_ROOT=$TRUST_ROOT_SA
$0 -disable-ccache -disable-petsc -disable-gnuplot -disable-tcl_tk -disable-valgrind -disable-mpi -disable-metis -without-visit -disable-gmsh -disable-plot2d -without-doc -disable-checks -disable-check_sources $*
exit $?
fi
if [ "$1" = "-disable-tools" ]
then
shift
export TRUST_ROOT=$TRUST_ROOT_SA
$0 -disable-ccache -disable-gnuplot -disable-tcl_tk -disable-valgrind -disable-metis -without-visit -disable-gmsh -disable-plot2d -without-doc -without-pdflatex -disable-checks -disable-check_sources $*
exit $?
fi
for THIRD_PARTY in $LIST_THIRD_PARTY
do
command=TRUST_DISABLE_$THIRD_PARTY=0
eval $command
done
export TRUST_ENABLE_PETSC_DEBUG=0
export TRUST_DISABLE_MPIIO=0
export TRUST_DISABLE_CHECK_SRC=0
export TRUST_DISABLE_CHECKS=0
export TRUST_INT64=0
export TRUST_DISABLE_MPI4PY=0
export TRUST_WITHOUT_DOC=0
export TRUST_WITHOUT_PDFLATEX=0
export TRUST_WITHOUT_VISIT=0
export TRUST_DOWNLOAD_VISIT=0
export TRUST_DOWNLOAD_SALOME=0
export TRUST_WITHOUT_HOST=0
unset TRUST_USE_EXTERNAL_HDF
unset TRUST_USE_EXTERNAL_MED
unset TRUST_USE_EXTERNAL_MEDCOUPLING
var=env/configure.env && rm -f $var
echo "$0 called with options: $*"
if [ "`echo $* | grep '\-disable\-petsc'`" != "" ] && [ "`echo $* | grep '\-enable\-petsc\-debug'`" != "" ]
then
echo ""
echo "Configure error:"
echo "----------------"
echo "You cannot configure TRUST with both options: -enable-petsc-debug -disable-petsc."
echo "Re-configure it only with one of these options."
exit -1
fi
while [ "$1" != "" ]
do
if [ "${1%-help}" != "$1" ]
then
exit
elif [ "${1#-c++=}" != "$1" ]
then
export TRUST_FORCE_CC=${1#-c++=}
elif [ "${1#-cc=}" != "$1" ]
then
export TRUST_FORCE_cc=${1#-cc=}
elif [ "${1#-cxxflags=}" != "$1" ]
then
export TRUST_ADD_CXXFLAGS=${1#-cxxflags=}
elif [ "${1#-cflags=}" != "$1" ]
then
export TRUST_ADD_CFLAGS=${1#-cflags=}
elif [ "${1#-fflags=}" != "$1" ]
then
export TRUST_ADD_FFLAGS=${1#-fflags=}
elif [ "${1#-native}" != "$1" ]
then
export TRUST_ADD_NATIVE_FLAGS=1
elif [ "${1#-fc=}" != "$1" ]
then
export TRUST_FORCE_F77=${1#-fc=}
elif [ "${1#-add_search=}" != "$1" ]
then
export TRUST_FORCE_SEARCH=$TRUST_FORCE_SEARCH" "${1#-add_search=}
elif [ "${1#-with-medcoupling=}" != "$1" ]
then
export TRUST_USE_EXTERNAL_MEDCOUPLING=${1#-with-medcoupling=}
elif [ "${1#-with-med=}" != "$1" ]
then
export TRUST_USE_EXTERNAL_MED=${1#-with-med=}
elif [ "${1#-with-hdf=}" != "$1" ]
then
export TRUST_USE_EXTERNAL_HDF=${1#-with-hdf=}
elif [ "${1#-force_even_unsupported}" != "$1" ]
then
export TRUST_FORCE_SUPPORTED=1
elif [ "${1#-force_provided_openmpi}" != "$1" ]
then
export TRUST_FORCE_PROVIDED_OPENMPI=1
elif [ "${1#-force_old_openmpi}" != "$1" ]
then
export TRUST_FORCE_OLD_OPENMPI=1
elif [ "${1#-force_latest_mpich}" != "$1" ]
then
export TRUST_FORCE_LATEST_MPICH=1
elif [ "${1#-force_latest_openmpi}" != "$1" ]
then
export TRUST_FORCE_LATEST_OPENMPI=1
elif [ "${1#-force_provided_mpich}" != "$1" ]
then
export TRUST_FORCE_PROVIDED_MPICH=1
elif [ "${1#-enable-petsc-debug}" != "$1" ]
then
export TRUST_ENABLE_PETSC_DEBUG=1
elif [ "${1#-cuda}" != "$1" ]
then
export TRUST_USE_CUDA=1
export TRUST_OPENMP=1
elif [ "${1#-with-64-bit-indices}" != "$1" ]
then
export TRUST_INT64=1
elif [ "${1#-disable-mpi4py}" != "$1" ]
then
export TRUST_DISABLE_MPI4PY=1
elif [ "${1#-openmp}" != "$1" ]
then
export TRUST_OPENMP=1
elif [ "${1#-without-doc}" != "$1" ]
then
export TRUST_WITHOUT_DOC=1
# if no pdflatex installed, disable pdf doc build
[ "`eval pdflatex --version 1>/dev/null 2>&1;echo $?`" != 0 ] && export TRUST_WITHOUT_PDFLATEX=1
THIRD_PARTY="DOC"
REP_THIRD_PARTY=$TRUST_ROOT/doc
([ -d $REP_THIRD_PARTY ] && [ $first -eq 0 ] && cd $REP_THIRD_PARTY && echo "Disabling $THIRD_PARTY, so make clean:" && make clean)
elif [ "${1#-without-pdflatex}" != "$1" ]
then
export TRUST_WITHOUT_PDFLATEX=1
elif [ "${1#-without-visit}" != "$1" ]
then
export TRUST_WITHOUT_VISIT=1
THIRD_PARTY="VISIT"
REP_THIRD_PARTY=$TRUST_ROOT/Outils/VisIt
([ -d $REP_THIRD_PARTY ] && [ $first -eq 0 ] && cd $REP_THIRD_PARTY && echo "Disabling $THIRD_PARTY, so make clean:" && make clean)
elif [ "${1#-download-visit}" != "$1" ]
then
export TRUST_DOWNLOAD_VISIT=1
elif [ "${1#-download-salome}" != "$1" ]
then
export TRUST_DOWNLOAD_SALOME=1
elif [ "${1#-clean}" != "$1" ]
then
export clean="clean"
elif [ "${1#-disable-mpiio}" != "$1" ]
then
export TRUST_DISABLE_MPIIO=1
elif [ "${1#-disable-check_sources}" != "$1" ]
then
export TRUST_DISABLE_CHECK_SRC=1
elif [ "${1#-disable-checks}" != "$1" ]
then
export TRUST_DISABLE_CHECKS=1
export TRUST_DISABLE_CHECK_SRC=1
elif [ "${1#-disable-}" != "$1" ]
then
THIRD_PARTY=`echo ${1#-disable-} | awk '{print toupper($1)}'`
REP_THIRD_PARTY=$TRUST_ROOT/ThirdPart/src/LIB$THIRD_PARTY
[ "$THIRD_PARTY" = "GMSH" ] && REP_THIRD_PARTY=$TRUST_ROOT/Outils/Gmsh
[ "$THIRD_PARTY" = "CCACHE" ] && REP_THIRD_PARTY=$TRUST_ROOT/env/ccache
[ "$THIRD_PARTY" = "VALGRIND" ] && REP_THIRD_PARTY=$TRUST_ROOT/Outils/valgrind
[ "$THIRD_PARTY" = "GNUPLOT" ] && REP_THIRD_PARTY=$TRUST_ROOT/Outils/gnuplot
[ "$THIRD_PARTY" = "TCL_TK" ] && REP_THIRD_PARTY=$TRUST_ROOT/Outils/tcl_tk
[ "$THIRD_PARTY" = "PLOT2D" ] && REP_THIRD_PARTY=$TRUST_ROOT/Outils/IHM
if [ ! -d $REP_THIRD_PARTY ]
then
echo "$1 option not available cause $REP_THIRD_PARTY is not installed."
exit -1
fi
testv="echo \$TRUST_DISABLE_$THIRD_PARTY"
res=`eval $testv`
if [ "$res" = "" ]
then
echo "$1 option not available cause $THIRD_PARTY is not in list"
exit -1
fi
(cd $REP_THIRD_PARTY && [ $first -eq 0 ] && echo "Disabling $THIRD_PARTY, so make clean:" && make clean)
command=TRUST_DISABLE_$THIRD_PARTY=1
eval $command
elif [ "${1#-without-host_file}" != $1 ]
then
export TRUST_WITHOUT_HOST=1
else
echo "Unknown option $1."
exit -1
fi
shift
done
export TRUST_ROOT_VERSION=`awk '/version/ && /Release notes/ {print $4;exit}' $TRUST_ROOT/RELEASE_NOTES | sed "s/_beta//"`
if [ "$clean" != "clean" ]
then
[ ! -d externalpackages ] && [ ! -L externalpackages ] && echo "You need to download externalpackages before configuring" && echo "wget http://downloads.sourceforge.net/project/trust-platform/$TRUST_ROOT_VERSION/externalpackages-$TRUST_ROOT_VERSION.tar" && exit -1
if [ "$TRUST_DISABLE_CHECKS" = 0 ]
then
# Gestion externalpackages
echo "Verify externalpackages..."
cd $TRUST_ROOT/bin/gestion_externalpackages
export LC_ALL=C && ./Verify_externalpackages.sh
[ $? != 0 ] && echo "" && echo "Error: You need to update externalpackages directory to $TRUST_ROOT_VERSION version" && exit -1
cd $TRUST_ROOT
else
echo "Disabling CHECKS, so externalpackages will not be verified."
fi
fi
for THIRD_PARTY in $LIST_THIRD_PARTY
do
VAR=TRUST_DISABLE_$THIRD_PARTY
echo "$VAR=${!VAR} && export $VAR # Disable/enable $THIRD_PARTY" >> $var
done
echo "TRUST_DISABLE_MPIIO=$TRUST_DISABLE_MPIIO && export TRUST_DISABLE_MPIIO # Disable/enable MPI-IO mode for writing of binary output file" >> $var
echo "TRUST_ENABLE_PETSC_DEBUG=$TRUST_ENABLE_PETSC_DEBUG && export TRUST_ENABLE_PETSC_DEBUG # Disable/enable PETSc debug" >> $var
echo "TRUST_DISABLE_CHECK_SRC=$TRUST_DISABLE_CHECK_SRC && export TRUST_DISABLE_CHECK_SRC # No check sources before compiling" >> $var
echo "TRUST_DISABLE_CHECKS=$TRUST_DISABLE_CHECKS && export TRUST_DISABLE_CHECKS # Disable/enable checks for external packages, sources, disk space and speed" >> $var
echo "TRUST_INT64=$TRUST_INT64 && export TRUST_INT64 # Build in 64 bits integer indices." >> $var
echo "TRUST_DISABLE_MPI4PY=$TRUST_DISABLE_MPI4PY && export TRUST_DISABLE_MPI4PY # disable mpi4py build." >> $var
echo "TRUST_WITHOUT_DOC=$TRUST_WITHOUT_DOC && export TRUST_WITHOUT_DOC # Disable/enable Documentation" >> $var
echo "TRUST_WITHOUT_PDFLATEX=$TRUST_WITHOUT_PDFLATEX && export TRUST_WITHOUT_PDFLATEX # Disable/enable pdf Documentation build only" >> $var
echo "TRUST_WITHOUT_VISIT=$TRUST_WITHOUT_VISIT && export TRUST_WITHOUT_VISIT # Disable/enable VisIt" >> $var
echo "TRUST_DOWNLOAD_VISIT=$TRUST_DOWNLOAD_VISIT && export TRUST_DOWNLOAD_VISIT # Download or build VisIt" >> $var
echo "TRUST_DOWNLOAD_SALOME=$TRUST_DOWNLOAD_SALOME && export TRUST_DOWNLOAD_SALOME # Download Salome" >> $var
if [ "$TRUST_USE_EXTERNAL_MEDCOUPLING" != "" ]
then
echo "export TRUST_USE_EXTERNAL_MEDCOUPLING=1" >> $var
echo "export MEDCOUPLING_ROOT_DIR=$TRUST_USE_EXTERNAL_MEDCOUPLING" >> $var
else
echo "unset TRUST_USE_EXTERNAL_MEDCOUPLING" >> $var
# echo "unset MEDFILE_ROOT_DIR" >> $var
fi
if [ "$TRUST_USE_EXTERNAL_MED" != "" ]
then
echo "export TRUST_USE_EXTERNAL_MED=1" >> $var
echo "export MEDFILE_ROOT_DIR=$TRUST_USE_EXTERNAL_MED" >> $var
else
echo "unset TRUST_USE_EXTERNAL_MED" >> $var
# echo "unset MEDFILE_ROOT_DIR" >> $var
fi
if [ "$TRUST_USE_EXTERNAL_HDF" != "" ]
then
echo "export TRUST_USE_EXTERNAL_HDF=1" >> $var
echo "export HDF5_ROOT_DIR=$TRUST_USE_EXTERNAL_HDF" >> $var
else
echo "unset TRUST_USE_EXTERNAL_HDF" >> $var
#echo "unset HDF5_ROOT_DIR" >> $var
fi
# IF HDF5 tools are not installed, detect h5dump version mismatch
if [ "`h5dump -help 1>/dev/null 2>&1;echo $?`" = 0 ]; then
h5versionOK=`h5dump --version 2>/dev/null | awk '/h5dump/ {split($3,a,".");v=a[1]*1000+a[2]*10+a[3];print (v<=1103?1:0)}'`
[ "$h5versionOK" != 1 ] && echo "export HDF5_DISABLE_VERSION_CHECK=2 # to ignore warnings about hdf5 version" >> $var
fi
echo "# TRUST_ROOT=$TRUST_ROOT # Path of the install" >> $var
##########################################################
# Check if trust has already been built in 64bits #
# We prevent a 32bits build after having sed int by long #
##########################################################
# before commenting this part, ensure you sed long by int in trust sources
if [ "$clean" != "clean" ] && [ "$TRUST_INT64" = "0" ] && [ -f .build64 ]
then
echo "Sources are in 64 bits while you're trying to build a 32 bits version. "
echo "Ensure you download a version which can be built in 32 bits"
echo "Contact support at trust@cea.fr"
exit -1
fi
################################
# Check options for some hosts #
################################
HOST=`hostname`
####################################################
# Configuration et initialisation de l'environnement
####################################################
rm -f env_TRUST.sh env/env_TRUST.sh
sed "s?TRUST_ROOT=path_to_trio?TRUST_ROOT=$TRUST_ROOT?" env_src/env_TRUST.sh.in > env/env_TRUST.sh
chmod gou+x env/env_TRUST.sh
ln -sf env/env_TRUST.sh .
cd bin
ln -sf trust triou
cd ..
cd env
./configurer_env $clean || exit -1
[ "$clean" != "" ] && exit 0
cd ..
exiterror=0
[ -f $TRUST_ROOT/NON_INSTALLED ] && [ "`grep 'Error while installing' $TRUST_ROOT/NON_INSTALLED`" != "" ] && exiterror=1
source ./env_TRUST.sh 1>/dev/null 2>&1
if [ "$TRUST_WITHOUT_DOC" != 1 ] && [ "$TRUST_WITHOUT_PDFLATEX" != 1 ]
then
texerror=0
if [ "`eval pdflatex --version 1>/dev/null 2>&1;echo $?`" != 0 ]
then
echo "pdflatex is missing..." >> NON_INSTALLED
texerror=1
elif [ "`echo | makeindex -i 1>/dev/null 2>&1;echo $?`" != 0 ]
then
echo "makeindex is missing..." >> NON_INSTALLED # Ajoute pour Outils/TRIOXDATA
texerror=1
else
dest2=$TRUST_TMP/tmp_tex
[ -d $dest2 ] && rm -r $dest2
mkdir $dest2
cd $dest2
cp -r $TRUST_ROOT/Outils/TexFiles/* .
make 1>LOG_FILE 2>&1
if [ $? != 0 ]
then
echo "Some latex packages are missing... see $dest2/LOG" >> $TRUST_ROOT/NON_INSTALLED
texerror=1
else
cd fiche_prm_test
Run_fiche -not_run 1>/dev/null 2>&1
[ ! -f build/rapport.pdf ] && cp Run.log $TRUST_TMP && texerror=2
rm -r $dest2
fi
cd $TRUST_ROOT
fi
if [ $texerror = 1 ]
then
echo "You cannot generate the PDF documentation of TRUST and its sub-projects unless you install metapackages equivalent to:" >> NON_INSTALLED
echo " 1. texlive-latex-base " >> NON_INSTALLED
echo " 2. texlive-latex-recommended" >> NON_INSTALLED
echo " 3. texlive-fonts-recommended" >> NON_INSTALLED
echo " 4. texlive-latex-extra" >> NON_INSTALLED
echo " NOTE1: The names of these packages may differ if your OS is not one of Debian/Ubuntu/Mint" >> NON_INSTALLED
echo " For instance on Fedora, you can try: sudo dnf install texlive-scheme-full" >> NON_INSTALLED
echo " NOTE2: In the case you DO NOT WANT to install it, run: " >> NON_INSTALLED
Num_opts_configure=`tail -1 configure.log | awk '{print NF-1}'`
opts_configure=`tail -1 configure.log | cut -d ' ' -f 1-$Num_opts_configure`
echo " $opts_configure -without-pdflatex" >> NON_INSTALLED
exiterror=1
fi
if [ $texerror = 2 ]
then
echo "Something strange... PDF documentation can be generated, not rapport.pdf from prm file." >> NON_INSTALLED
echo "see $TRUST_TMP/Run.log " >> NON_INSTALLED
fi
fi
if [ -f $TRUST_ROOT/NON_INSTALLED ]
then
echo ""
echo "========================================================================="
echo "Some packages needed by TRUST code were not found/correctly installed:"
echo "----------------------------------------------------------------"
cat $TRUST_ROOT/NON_INSTALLED
[ "$multiple_choices" = 1 ] && echo "(*) Only one command is needed but none has been found!"
echo $ECHO_OPTS "See previous messages for further details or contact support at trust@cea.fr"
echo "========================================================================="
[ "$exiterror" = 1 ] && exit -1
fi
###############################################
# Verification des performances de TRUST_TMP #
###############################################
if [ "$TRUST_DISABLE_CHECKS" = 0 ]
then
dd.ksh -speed $TRUST_TMP -silent
if [ $? != 0 ]
then
echo "TRUST_TMP=$TRUST_TMP"
echo "Please, specify a directory for the TRUST_TMP variable in the $perso file"
echo "in order to have good performances for TRUST."
fi
fi
##########################################
# Creation d'un Makefile sous $TRUST_ROOT
##########################################
cd $TRUST_ROOT
if [ "$clean" = "" ]
then
Build=$TRUST_ROOT/build
[ ! -d ${Build} ] && echo Creating ${Build} directory && mkdir -p ${Build}
# echo $ECHO_OPTS "all:\n\tcompile" > $TRUST_ROOT/Makefile
echo $ECHO_OPTS "SHELL=/bin/bash" > $TRUST_ROOT/Makefile
echo $ECHO_OPTS "all:\n\t(source ./env_TRUST.sh && env cibles=\"micro_kernel_opt numeric_kernel_opt standard_kernel_opt opt micro_kernel_debug numeric_kernel_debug standard_kernel_debug debug\" monodir)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "tools:\n\t(source ./env_TRUST.sh && compile tools)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "optim:\t opt" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "semi_optim:\t semi_opt" >> $TRUST_ROOT/Makefile
for cible in opt debug prof gcov opt_avx semi_opt custom
do
echo $ECHO_OPTS "${cible}:\n\t(source ./env_TRUST.sh && env cibles=\"micro_kernel_${cible} numeric_kernel_${cible} standard_kernel_${cible} ${cible}\" monodir)" >> $TRUST_ROOT/Makefile
done
echo $ECHO_OPTS "clean:\n\t(source ./env_TRUST.sh && compile clean)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "depend:\n\t#fait_makefile" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "doxygen:\n\t(source ./env_TRUST.sh && make_Doxyfile)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "validation:\n\t(source ./env_TRUST.sh && cd Validation/Rapports_automatiques && ./lance_tout)" >> $TRUST_ROOT/Makefile
#echo $ECHO_OPTS "init:\n\tsource ./env_TRUST.sh" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "check:\n\t(source ./env_TRUST.sh && echo 0 | lance_test \${exec_opt} \${TRUST_ROOT}/build )" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "check_optim:\tcheck" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "check_semi_opt:\n\t(source ./env_TRUST.sh && echo 0 | lance_test \${exec_semi_opt} \${TRUST_ROOT}/build )" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "check_debug:\n\t(source ./env_TRUST.sh && echo 0 | lance_test \${exec_debug} \${TRUST_ROOT}/build )" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "ctest_debug:\n\t(source ./env_TRUST.sh && cd MonoDir$COMM/src && ctest -j$TRUST_NB_PHYSICAL_CORES)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "ctest_optim:\n\t(source ./env_TRUST.sh && cd MonoDir$COMM"_opt"/src && ctest -j$TRUST_NB_PHYSICAL_CORES)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "ctest_semi_opt:\n\t(source ./env_TRUST.sh && cd MonoDir$COMM"_semi_opt"/src && ctest -j$TRUST_NB_PHYSICAL_CORES)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "gui:\n\t(source ./env_TRUST.sh && cd Outils/TRIOXDATA && ./Install_all)" >> $TRUST_ROOT/Makefile
echo $ECHO_OPTS "check_gui:\n\t(source ./env_TRUST.sh && cd Outils/TRIOXDATA && ./check_jdd)" >> $TRUST_ROOT/Makefile
[ "${#ECHO_OPTS}" = 0 ] && echo "Error: Check "$TRUST_ROOT"/Makefile !!! (ECHO_OPTS="$ECHO_OPTS")" && exit -1
##################################
# Desormais on recree les makefile
##################################
#make depend
echo $ECHO_OPTS "File Makefile created."
echo $ECHO_OPTS "File configure.log created."
echo
echo $ECHO_OPTS "# To initialize the TRUST environment, run:"
echo $ECHO_OPTS "source env_TRUST.sh"
echo $ECHO_OPTS "# To build TRUST, run:"
echo $ECHO_OPTS "make"
echo $ECHO_OPTS "# To check TRUST, run:"
echo $ECHO_OPTS "make check"
fi
exit 0