blob: 076b664e6b34a1e8bcc2e7b2de010f837e4b6c9a [file] [log] [blame]
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00001
2# Copyright (C) Igor Sysoev
Maxim Konovalovf8d59e32012-01-18 15:07:43 +00003# Copyright (C) Nginx, Inc.
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00004
5
Maxim Konovalovf08ba922011-12-29 15:36:07 +00006# Intel C++ compiler 7.1, 8.0, 8.1, 9.0, 11.1
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00007
Igor Sysoev7b190b42005-06-07 15:56:31 +00008NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \
Igor Sysoevdb390ac2007-04-19 17:48:49 +00009 | sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'`
Igor Sysoev7b190b42005-06-07 15:56:31 +000010
11echo " + icc version: $NGX_ICC_VER"
12
Piotr Sikora7d3be9a2015-12-01 00:00:10 -080013have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . $NGX_AUTO/define
Igor Sysoev208eed22005-10-07 13:30:52 +000014
Igor Sysoev7b190b42005-06-07 15:56:31 +000015
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000016# optimizations
17
18CFLAGS="$CFLAGS -O"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000019
Igor Sysoevf6906042004-11-25 16:17:31 +000020CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000021
Igor Sysoev09c684b2005-11-09 17:25:55 +000022
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000023case $CPU in
24 pentium)
25 # optimize for Pentium and Athlon
26 CPU_OPT="-march=pentium"
27 ;;
28
29 pentiumpro)
30 # optimize for Pentium Pro, Pentium II and Pentium III
31 CPU_OPT="-mcpu=pentiumpro -march=pentiumpro"
32 ;;
33
34 pentium4)
35 # optimize for Pentium 4, default
36 CPU_OPT="-march=pentium4"
37 ;;
38esac
39
40CFLAGS="$CFLAGS $CPU_OPT"
41
42if [ ".$PCRE_OPT" = "." ]; then
Maxim Konovalovf08ba922011-12-29 15:36:07 +000043 PCRE_OPT="-O $CPU_OPT"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000044fi
45
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000046if [ ".$ZLIB_OPT" = "." ]; then
Maxim Konovalovf08ba922011-12-29 15:36:07 +000047 ZLIB_OPT="-O $CPU_OPT"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000048fi
49
50
51# warnings
52
Igor Sysoevc1571722005-03-19 12:38:37 +000053CFLAGS="$CFLAGS -w2"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000054
Igor Sysoevc1571722005-03-19 12:38:37 +000055# disable some warnings
56
57# invalid type conversion: "int" to "char *"
58CFLAGS="$CFLAGS -wd171"
59# argument is incompatible with corresponding format string conversion
60CFLAGS="$CFLAGS -wd181"
61# zero used for undefined preprocessing identifier
62CFLAGS="$CFLAGS -wd193"
Igor Sysoevc2068d02005-10-19 12:33:58 +000063# the format string ends before this argument
Igor Sysoev403d2442005-05-26 18:12:40 +000064CFLAGS="$CFLAGS -wd268"
Igor Sysoevc1571722005-03-19 12:38:37 +000065# invalid format string conversion
66CFLAGS="$CFLAGS -wd269"
67# conversion from "long long" to "size_t" may lose significant bits
68CFLAGS="$CFLAGS -wd810"
69# parameter was never referenced
70CFLAGS="$CFLAGS -wd869"
Igor Sysoevda173ab2006-08-30 10:39:17 +000071# attribute "unused" is only allowed in a function definition, warning on pTHX_
72CFLAGS="$CFLAGS -wd1301"
Igor Sysoevc1571722005-03-19 12:38:37 +000073
74# STUB
75# enumerated type mixed with another type
76CFLAGS="$CFLAGS -wd188"
77# controlling expression is constant
78CFLAGS="$CFLAGS -wd279"
79# operands are evaluated in unspecified order
80CFLAGS="$CFLAGS -wd981"
81# external definition with no prior declaration
82CFLAGS="$CFLAGS -wd1418"
83# external declaration in primary source file
84CFLAGS="$CFLAGS -wd1419"
Igor Sysoev7b190b42005-06-07 15:56:31 +000085
86case "$NGX_ICC_VER" in
Igor Sysoev09c684b2005-11-09 17:25:55 +000087 9.*)
Josh Sorefb4b9ee52016-04-07 11:50:13 +030088 # "cc" clobber ignored, warnings for Linux's htonl()/htons()
Igor Sysoev7b190b42005-06-07 15:56:31 +000089 CFLAGS="$CFLAGS -wd1469"
Igor Sysoevc2068d02005-10-19 12:33:58 +000090 # explicit conversion of a 64-bit integral type to a smaller
91 # integral type
92 CFLAGS="$CFLAGS -wd1683"
93 # conversion from pointer to same-sized integral type,
94 # warning on offsetof()
95 CFLAGS="$CFLAGS -wd1684"
Igor Sysoev3ca233e2005-12-28 14:23:52 +000096 # floating-point equality and inequality comparisons are unreliable,
97 # warning on SvTRUE()
98 CFLAGS="$CFLAGS -wd1572"
Igor Sysoev7b190b42005-06-07 15:56:31 +000099 ;;
100
Igor Sysoev09c684b2005-11-09 17:25:55 +0000101 8.*)
Josh Sorefb4b9ee52016-04-07 11:50:13 +0300102 # "cc" clobber ignored, warnings for Linux's htonl()/htons()
Igor Sysoev09c684b2005-11-09 17:25:55 +0000103 CFLAGS="$CFLAGS -wd1469"
Igor Sysoev3ca233e2005-12-28 14:23:52 +0000104 # floating-point equality and inequality comparisons are unreliable,
105 # warning on SvTRUE()
106 CFLAGS="$CFLAGS -wd1572"
Igor Sysoev09c684b2005-11-09 17:25:55 +0000107 ;;
108
Igor Sysoev7b190b42005-06-07 15:56:31 +0000109 *)
110 ;;
111esac
Igor Sysoev02025fd2005-01-18 13:03:58 +0000112
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000113# stop on warning
114CFLAGS="$CFLAGS -Werror"
115
116# debug
117CFLAGS="$CFLAGS -g"