upstream nginx-0.7.31
[nginx.git] / nginx / auto / cc / icc
1
2 # Copyright (C) Igor Sysoev
3
4
5 # Intel C++ compiler 7.1, 8.0, 8.1, 9.0
6
7 NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \
8                          | sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'`
9
10 echo " + icc version: $NGX_ICC_VER"
11
12 have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . auto/define
13
14
15 # optimizations
16
17 CFLAGS="$CFLAGS -O"
18 # inline the functions declared with __inline
19 #CFLAGS="$CFLAGS -Ob1"
20 # inline any function, at the compiler's discretion
21 CFLAGS="$CFLAGS -Ob2"
22
23 # multi-file IP optimizations
24 case "$NGX_ICC_VER" in
25     9.*)
26         IPO="-ipo"
27     ;;
28
29     # 8.1.38 under FreeBSD can not link -ipo
30     8.1)
31         IPO="-ip"
32     ;;
33
34     *)
35         IPO="-ipo -ipo_obj"
36     ;;
37 esac
38
39 # single-file IP optimizations
40 #IPO="-ip"
41
42 CFLAGS="$CFLAGS $IPO"
43 CORE_LINK="$CORE_LINK $IPO"
44 CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
45
46
47 case $CPU in
48     pentium)
49         # optimize for Pentium and Athlon
50         CPU_OPT="-march=pentium"
51     ;;
52
53     pentiumpro)
54         # optimize for Pentium Pro, Pentium II and Pentium III
55         CPU_OPT="-mcpu=pentiumpro -march=pentiumpro"
56     ;;
57
58     pentium4)
59         # optimize for Pentium 4, default
60         CPU_OPT="-march=pentium4"
61     ;;
62 esac
63
64 CFLAGS="$CFLAGS $CPU_OPT"
65
66 if [ ".$PCRE_OPT" = "." ]; then
67     PCRE_OPT="-O $IPO $CPU_OPT"
68 fi
69
70 if [ ".$MD5_OPT" = "." ]; then
71     MD5_OPT="-O $IPO $CPU_OPT"
72 fi
73
74 if [ ".$ZLIB_OPT" = "." ]; then
75     ZLIB_OPT="-O $IPO $CPU_OPT"
76 fi
77
78
79 # warnings
80
81 CFLAGS="$CFLAGS -w2"
82
83 # disable some warnings
84
85 # invalid type conversion: "int" to "char *"
86 CFLAGS="$CFLAGS -wd171"
87 # argument is incompatible with corresponding format string conversion
88 CFLAGS="$CFLAGS -wd181"
89 # zero used for undefined preprocessing identifier
90 CFLAGS="$CFLAGS -wd193"
91 # the format string ends before this argument
92 CFLAGS="$CFLAGS -wd268"
93 # invalid format string conversion
94 CFLAGS="$CFLAGS -wd269"
95 # conversion from "long long" to "size_t" may lose significant bits
96 CFLAGS="$CFLAGS -wd810"
97 # parameter was never referenced
98 CFLAGS="$CFLAGS -wd869"
99 # attribute "unused" is only allowed in a function definition, warning on pTHX_
100 CFLAGS="$CFLAGS -wd1301"
101
102 # STUB
103 # enumerated type mixed with another type
104 CFLAGS="$CFLAGS -wd188"
105 # controlling expression is constant
106 CFLAGS="$CFLAGS -wd279"
107 # operands are evaluated in unspecified order
108 CFLAGS="$CFLAGS -wd981"
109 # external definition with no prior declaration
110 CFLAGS="$CFLAGS -wd1418"
111 # external declaration in primary source file
112 CFLAGS="$CFLAGS -wd1419"
113
114 case "$NGX_ICC_VER" in
115     9.*)
116         # "cc" clobber ignored, warnings for Liunx's htonl()/htons()
117         CFLAGS="$CFLAGS -wd1469"
118         # explicit conversion of a 64-bit integral type to a smaller
119         # integral type
120         CFLAGS="$CFLAGS -wd1683"
121         # conversion from pointer to same-sized integral type,
122         # warning on offsetof()
123         CFLAGS="$CFLAGS -wd1684"
124         # floating-point equality and inequality comparisons are unreliable,
125         # warning on SvTRUE()
126         CFLAGS="$CFLAGS -wd1572"
127     ;;
128
129     8.*)
130         # "cc" clobber ignored, warnings for Liunx's htonl()/htons()
131         CFLAGS="$CFLAGS -wd1469"
132         # floating-point equality and inequality comparisons are unreliable,
133         # warning on SvTRUE()
134         CFLAGS="$CFLAGS -wd1572"
135     ;;
136
137     *)
138     ;;
139 esac
140
141 # stop on warning
142 CFLAGS="$CFLAGS -Werror"
143
144 # debug
145 CFLAGS="$CFLAGS -g"