1
+
#                           -*- shell-script -*-
 
2
+
#
 
3
+
# Copyright by The HDF Group.
 
4
+
# Copyright by the Board of Trustees of the University of Illinois.
 
5
+
# All rights reserved.
 
6
+
#
 
7
+
# This file is part of HDF5.  The full HDF5 copyright notice, including
 
8
+
# terms governing use, modification, and redistribution, is contained in
 
9
+
# the COPYING file, which can be found at the root of the source code
 
10
+
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
 
11
+
# If you do not have access to either file, you may request a copy from
 
12
+
# help@hdfgroup.org.
 
13
+
 
14
+
 
15
+
# This file should be sourced into configure if the compiler is the
 
16
+
# Intel icc compiler or a derivative.  It is careful not to do anything
 
17
+
# if the compiler is not Intel; otherwise `cc_flags_set' is set to `yes'
 
18
+
#
 
19
+
 
20
+
# Get the compiler version in a way that works for icc
 
21
+
# icc unless a compiler version is already known
 
22
+
#
 
23
+
#   cc_vendor:    The compiler name: icc
 
24
+
#   cc_version:   Version number: 8.0
 
25
+
#
 
26
+
if test X = "X$cc_flags_set"; then
 
27
+
    cc_version="`$CC $CFLAGS $H5_CFLAGS -V 2>&1 |grep 'Version'`"
 
28
+
    if test X != "X$cc_version"; then
 
29
+
        cc_vendor=icc
 
30
+
        cc_version=`echo $cc_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'`
 
31
+
        echo "compiler '$CC' is Intel $cc_vendor-$cc_version"
 
32
+
 
33
+
        # Some version numbers
 
34
+
        # Intel version numbers are of the form: "major.minor"
 
35
+
        cc_vers_major=`echo $cc_version | cut -f1 -d.`
 
36
+
        cc_vers_minor=`echo $cc_version | cut -f2 -d.`
 
37
+
        #cc_vers_patch=`echo $cc_version | cut -f2 -d.`
 
38
+
        test -n "$cc_vers_major" || cc_vers_major=0
 
39
+
        test -n "$cc_vers_minor" || cc_vers_minor=0
 
40
+
        test -n "$cc_vers_patch" || cc_vers_patch=0
 
41
+
        cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
 
42
+
    fi
 
43
+
fi
 
44
+
 
45
+
# Common Intel flags for various situations
 
46
+
if test "X-icc" = "X-$cc_vendor"; then
 
47
+
    # Insert section about version specific problems from compiler flags here,
 
48
+
    # if necessary.
 
49
+
 
50
+
    arch=
 
51
+
    # Architecture-specific flags
 
52
+
    # Nothing currently. (Uncomment code below and modify to add any)
 
53
+
    #case "$host_os-$host_cpu" in
 
54
+
    #    *-i686)
 
55
+
    #        arch="-march=i686"
 
56
+
    #        ;;
 
57
+
    #esac
 
58
+
 
59
+
    # Host-specific flags
 
60
+
    # Nothing currently. (Uncomment code below and modify to add any)
 
61
+
    #case "`hostname`" in
 
62
+
    #    sleipnir.ncsa.uiuc.edu)
 
63
+
    #        arch="$arch -pipe"
 
64
+
    #        ;;
 
65
+
    #esac
 
66
+
 
67
+
    # General
 
68
+
    # Default to C99 standard.
 
69
+
    H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -Wcheck -Wall"
 
70
+
 
71
+
    # Production
 
72
+
    PROD_CFLAGS=
 
73
+
 
74
+
    # Debug
 
75
+
    # NDEBUG is handled explicitly in configure
 
76
+
    DEBUG_CFLAGS=
 
77
+
 
78
+
    # Symbols
 
79
+
    SYMBOLS_CFLAGS="-g"
 
80
+
    NO_SYMBOLS_CFLAGS="-Wl,-s"
 
81
+
 
82
+
    # Profiling
 
83
+
    # Use this for profiling with gprof
 
84
+
    PROFILE_CFLAGS="-p"
 
85
+
 
86
+
    # Optimization
 
87
+
    HIGH_OPT_CFLAGS="-O3"
 
88
+
    DEBUG_OPT_CFLAGS="-O0"
 
89
+
    NO_OPT_CFLAGS="-O0"
 
90
+
 
91
+
    # Flags are set
 
92
+
    cc_flags_set=yes
 
93
+
 
94
+
fi
 
95
+
 
96
+
# Version specific ICC flags
 
97
+
#
 
98
+
# Please follow the pattern below by adding new versions at the top, copying
 
99
+
# the information from the previous version and adding modifications to that.
 
100
+
# The default at the bottom will apply if no earlier version matches.
 
101
+
case "$cc_vendor-$cc_version" in
 
102
+
    icc-1[5-6]*)
 
103
+
        H5_CFLAGS="$H5_CFLAGS -Wcomment -Wdeprecated -Wextra-tokens -Wformat -Wformat-security -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-variable -Wwrite-strings"
 
104
+
        ;;
 
105
+
    icc-10*)
 
106
+
        HIGH_OPT_CFLAGS="-O1"
 
107
+
        ;;
 
108
+
    icc-8.0*)
 
109
+
        # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2.
 
110
+
        HIGH_OPT_CFLAGS="-O2"
 
111
+
        ;;
 
112
+
    icc-*)
 
113
+
        ;;
 
114
+
esac
 
115
+
 
116
+
# Clear cc info if no flags set
 
117
+
if test "X-$cc_flags_set" = "X-"; then
 
118
+
    cc_vendor=
 
119
+
    cc_version=
 
120
+
fi