| 1 |
# -*- shell-script -*- |
| 2 |
# |
| 3 |
# This file is part of the HDF4 build script. It is processed shortly |
| 4 |
# after configure starts and defines, among other things, flags for |
| 5 |
# the various compilation modes. |
| 6 |
|
| 7 |
# |
| 8 |
# Prepend `$srcdir/config/intel-warnings/` to the filename suffix(es) given as |
| 9 |
# subroutine argument(s), remove comments starting with # and ending |
| 10 |
# at EOL, replace spans of whitespace (including newlines) with spaces, |
| 11 |
# and re-emit the file(s) thus filtered on the standard output stream. |
| 12 |
# |
| 13 |
load_intel_arguments() |
| 14 |
{ |
| 15 |
set -- $(for arg; do |
| 16 |
sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg} |
| 17 |
done) |
| 18 |
IFS=' ' echo "$*" |
| 19 |
} |
| 20 |
|
| 21 |
# Get the compiler version in a way that works for icc |
| 22 |
# icc unless a compiler version is already known |
| 23 |
# |
| 24 |
# cc_vendor: The compiler name: icc |
| 25 |
# cc_version: Version number: 8.0 |
| 26 |
# |
| 27 |
if test X = "X$cc_flags_set"; then |
| 28 |
cc_version="`$CC $CFLAGS -V 2>&1 |grep 'Version'`" |
| 29 |
if test X != "X$cc_version"; then |
| 30 |
cc_vendor=icc |
| 31 |
cc_version=`echo $cc_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'` |
| 32 |
echo "compiler '$CC' is Intel $cc_vendor-$cc_version" |
| 33 |
|
| 34 |
# Some version numbers |
| 35 |
# Intel version numbers are of the form: "major.minor" |
| 36 |
cc_vers_major=`echo $cc_version | cut -f1 -d.` |
| 37 |
cc_vers_minor=`echo $cc_version | cut -f2 -d.` |
| 38 |
#cc_vers_patch=`echo $cc_version | cut -f2 -d.` |
| 39 |
test -n "$cc_vers_major" || cc_vers_major=0 |
| 40 |
test -n "$cc_vers_minor" || cc_vers_minor=0 |
| 41 |
test -n "$cc_vers_patch" || cc_vers_patch=0 |
| 42 |
cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` |
| 43 |
fi |
| 44 |
fi |
| 45 |
|
| 46 |
# Common Intel flags for various situations |
| 47 |
if test "X-icc" = "X-$cc_vendor"; then |
| 48 |
|
| 49 |
# -diag-disable=10441 disables the icc deprecation message |
| 50 |
CFLAGS="$CFLAGS -std=c99 -Wall -diag-disable=10441" |
| 51 |
CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration" |
| 52 |
|
| 53 |
DEBUG_CFLAGS="-g" |
| 54 |
DEBUG_CPPFLAGS= |
| 55 |
PROD_CFLAGS="-O3" |
| 56 |
PROD_CPPFLAGS= |
| 57 |
PROFILE_CFLAGS="-pg" |
| 58 |
PROFILE_CPPFLAGS= |
| 59 |
|
| 60 |
# Add various general warning flags in intel-warnings. |
| 61 |
CFLAGS="$CFLAGS $(load_intel_arguments classic/general)" |
| 62 |
|
| 63 |
############################# |
| 64 |
# Version-specific warnings # |
| 65 |
############################# |
| 66 |
|
| 67 |
# intel >= 15 |
| 68 |
if test $cc_vers_major -ge 15; then |
| 69 |
CFLAGS="$CFLAGS $(load_intel_arguments classic/15)" |
| 70 |
fi |
| 71 |
|
| 72 |
# intel >= 18 |
| 73 |
if test $cc_vers_major -ge 18; then |
| 74 |
CFLAGS="$CFLAGS $(load_intel_arguments classic/18)" |
| 75 |
fi |
| 76 |
|
| 77 |
################# |
| 78 |
# Flags are set # |
| 79 |
################# |
| 80 |
cc_flags_set=yes |
| 81 |
fi |
| 82 |
|
| 83 |
# Clear cc info if no flags set |
| 84 |
if test "X-$cc_flags_set" = "X-"; then |
| 85 |
cc_vendor= |
| 86 |
cc_version= |
| 87 |
fi |