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
|
# -*- shell-script -*-
#
# This file is part of the HDF4 build script. It is processed shortly
# after configure starts and defines, among other things, flags for
# the various compilation modes.
# Choosing and Fortran Compilers
# --------------------------------------
#
# The user should be able to specify the compiler by setting the CC
# and F77 environment variables to the name of the compiler and any
# switches it requires for proper operation. If CC is unset then this
# script may set it. If CC is unset by time this script completes then
# configure will try `gcc' and `cc' in that order (perhaps some others
# too).
#
# Note: Code later in this file may depend on the value of $CC_BASENAME
# in order to distinguish between different compilers when
# deciding which compiler command-line switches to use. This
# variable is set based on the incoming value of $CC and is only
# used within this file.
# The default compiler is `clang'.
if test "X-$CC" = "X-"; then
CC=clang
CC_BASENAME=clang
fi
# Figure out GNU C compiler flags
. $srcdir/config/gnu-flags
# Figure out Intel oneAPI C compiler flags
. $srcdir/config/oneapi-flags
# Figure out Intel classic C compiler flags
. $srcdir/config/intel-flags
# Figure out Clang C compiler flags
. $srcdir/config/clang-flags
# Use gfortran as the default F77 compiler.
if test "X-$F77" = "X-"; then
F77=gfortran
F77_BASENAME=gfortran
fi
# Figure out GNU FC compiler flags
. $srcdir/config/gnu-fflags
# compiler version strings
# check if the compiler_version_info is already set
if test -z "$cc_version_info"; then
case $CC in
# whatever matches *pgcc* will also match *gcc*, so this one must come first
*pgcc*)
cc_version_info=`$CC $CFLAGS $H4_CFLAGS -V 2>&1 | grep 'pgcc'`
;;
*gcc*)
cc_version_info=`$CC $CFLAGS $H4_CFLAGS --version 2>&1 | grep -v 'PathScale' |\
grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
;;
*icc*|*icx*)
cc_version_info=`$CC $CCFLAGS $H4_CCFLAGS -V 2>&1 | grep 'Version' |\
sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'`
;;
*clang*)
cc_version_info="`$CC $CFLAGS $H4_CFLAGS --version 2>&1 |\
grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`"
;;
*)
echo "No match to get cc_version_info for $CC"
;;
esac
fi
# get fortran version info
case $F77 in
*gfortran*)
fc_version_info=`$F77 $FFLAGS --version 2>&1 |\
grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
fc_version="`$F77 $FFLAGS -v 2>&1 |grep 'gcc version' |\
sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"
if test X != "X$fc_version"; then
fc_version=`echo $fc_version |sed 's/[-a-z]//g'`
fi
;;
*ifc*|*ifort*|*ifx*)
fc_version_info=`$F77 $FFLAGS -V 2>&1 | grep 'Version' |\
sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'`
fc_version="`$F77 $FFLAGS -V 2>&1 |grep '^Intel'`"
if test X != "X$fc_version"; then
fc_version="`echo $fc_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'`"
fi
;;
*f95*)
# Figure out which compiler we are using: pgf90 or Absoft f95
RM='rm -f'
tmpfile=/tmp/cmpver.$$
$F77 -V >$tmpfile
if test -s "$tmpfile"; then
if( grep -s 'Absoft' $tmpfile > /dev/null) then
FC_BASENAME=f95
fi
fi
$RM $tmpfile
fc_version_info=`$F77 -V | grep Absoft`
;;
*g95*|*g77*)
fc_version_info=`$F77 $FFLAGS --version 2>&1 |\
grep 'GCC'`
;;
*pgf90*)
fc_version_info=`$F77 $FFLAGS -V 2>&1 | grep 'pgf90'`
fc_version="`$F77 $FFLAGS -V 2>&1 |grep '^pgf90 '`"
if test X != "X$fc_version"; then
fc_version=`echo $fc_version |sed 's/pgf90 \([-a-z0-9\.\-]*\).*/\1/'`
fi
;;
*)
echo "No match to get fc_version_info for $F77"
;;
esac
if test X != "X$fc_version"; then
# Get the compiler version numbers
fc_vers_major=`echo $fc_version | cut -f1 -d.`
fi
|