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
|
# -*- 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 C 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 `gcc'.
if test -z "$CC"; then
CC=gcc
CC_BASENAME=gcc
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
# Figure out NVHPC C compiler flags
. $srcdir/config/nvidia-flags
# Use default Fortran compiler according to what C compiler is used.
if test "X-$F77" = "X-"; then
F77=gfortran
F77_BASENAME=gfortran
else
case $F77 in
# The PGI and Intel compilers are automatically detected below
f95*|pgf90*)
;;
*)
# 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
F77_BASENAME=f95
fi
if( grep -s 'g95' $tmpfile > /dev/null) then
F77_BASENAME=g95
fi
if( grep -s 'pgf90' $tmpfile > /dev/null) then
F77_BASENAME=pgf90
fi
fi
$RM $tmpfile
;;
esac
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/'`
;;
*nvc*)
cc_version_info=`$CC $CFLAGS $H4_CFLAGS -V 2>&1 | grep 'nvc'`
;;
*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/'`
;;
*icc*)
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*)
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
# Overriding Configure Tests
# --------------------------
#
# Values for overriding configuration tests when cross compiling.
# Set this to `yes' or `no' depending on whether the target is big
# endian or little endian.
#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
|