Salome HOME
69cc9df788800c31fc435616a3bf6bcd21404316
[tools/install.git] / config_files / checkFortran.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : checkFortran.sh
5 #  Created   : Mon Jun 25 17:09:00 2007
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2013 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 #  The script to check if the Fortran is installed.
14 #
15 ####################################################################################
16
17 find_compilers(){
18
19 # Known compilers:
20 #  f77/f90/f95       : generic compiler names
21 #  g77               : GNU Fortran 77 compiler
22 #  gfortran          : putative GNU Fortran 95+ compiler (in progress)
23 #  fort77            : native F77 compiler under HP-UX (and some older Crays)
24 #  frt               : Fujitsu F77 compiler
25 #  pgf77/pgf90/pgf95 : Portland Group F77/F90/F95 compilers
26 #  xlf/xlf90/xlf95   : IBM (AIX) F77/F90/F95 compilers
27 #  lf95              : Lahey-Fujitsu F95 compiler
28 #  fl32              : Microsoft Fortran 77 "PowerStation" compiler
29 #  af77              : Apogee F77 compiler for Intergraph hardware running CLIX
30 #  epcf90            : "Edinburgh Portable Compiler" F90
31 #  fort              : Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
32 #  ifc               : Intel Fortran 95 compiler for Linux/x86
33 #  efc               : Intel Fortran 95 compiler for IA64
34
35 # set path separator
36 IFS=:
37 FORT=""
38
39 for prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
40   do
41 #  echo "Checking for $prog"
42   for as_dir in $PATH; do
43       test -z "$as_dir" && as_dir=.
44       if test -f "$as_dir/$prog"; then
45           FORT="$prog"
46           echo "Found $as_dir/$prog"
47           break 2
48       fi
49   done
50 #  echo "Result: no"
51 done
52
53 if test -n "$FORT"; then
54     cat >${DIR}/ftest.f <<_ACEOF
55       program main
56
57       end
58 _ACEOF
59     $FORT -o ${DIR}/ftest.out ${DIR}/ftest.f > /dev/null
60     rm -f ${DIR}/ftest.*
61     exit $?
62 else
63     # Fortran compiler was not found
64     exit 1
65 fi
66 }
67
68 find_libraries(){
69     source ${DIR}/env_products.sh
70     ldd ${DIR}/*/lib/salome/*.so | grep not
71     if test $? -eq 0; then
72         exit 1
73     else
74         exit 0
75     fi
76 }
77
78 PROCEDURE=$1
79 DIR=$2
80
81 $PROCEDURE
82