Mercurial > hg > nginx-quic
annotate auto/cc/gcc @ 3956:f9e9f96e3407 stable-0.7
release-0.7.69 tag
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 19 Jul 2011 14:20:33 +0000 |
parents | fe084c435dc3 |
children |
rev | line source |
---|---|
455 | 1 |
2 # Copyright (C) Igor Sysoev | |
3 | |
4 | |
501 | 5 # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2 |
497 | 6 # 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2 |
521 | 7 # 4.0.0, 4.0.1, 4.1.0 |
501 | 8 |
9 | |
10 NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \ | |
11 | sed -e 's/^.* version \(.*\)/\1/'` | |
12 | |
13 echo " + gcc version: $NGX_GCC_VER" | |
455 | 14 |
557 | 15 have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define |
16 | |
455 | 17 |
18 # Solaris 7's /usr/ccs/bin/as does not support "-pipe" | |
19 | |
20 CC_TEST_FLAGS="-pipe" | |
21 | |
577 | 22 ngx_feature="gcc -pipe switch" |
455 | 23 ngx_feature_name= |
24 ngx_feature_run=no | |
25 ngx_feature_incs= | |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
743
diff
changeset
|
26 ngx_feature_path= |
455 | 27 ngx_feature_libs= |
28 ngx_feature_test= | |
29 . auto/feature | |
30 | |
31 CC_TEST_FLAGS= | |
32 | |
33 if [ $ngx_found = yes ]; then | |
34 PIPE="-pipe" | |
35 fi | |
36 | |
561 | 37 |
581 | 38 case "$NGX_MACHINE" in |
561 | 39 |
743 | 40 sun4u | sun4v | sparc | sparc64 ) |
563 | 41 # "-mcpu=v9" enables the "casa" assembler instruction |
561 | 42 CFLAGS="$CFLAGS -mcpu=v9" |
43 ;; | |
44 | |
45 esac | |
46 | |
47 | |
455 | 48 # optimizations |
49 | |
487 | 50 #NGX_GCC_OPT="-O2" |
51 #NGX_GCC_OPT="-Os" | |
52 NGX_GCC_OPT="-O" | |
53 | |
54 #CFLAGS="$CFLAGS -fomit-frame-pointer" | |
455 | 55 |
56 case $CPU in | |
57 pentium) | |
58 # optimize for Pentium and Athlon | |
59 CPU_OPT="-march=pentium" | |
589 | 60 NGX_CPU_CACHE_LINE=32 |
455 | 61 ;; |
62 | |
561 | 63 pentiumpro | pentium3) |
455 | 64 # optimize for Pentium Pro, Pentium II and Pentium III |
65 CPU_OPT="-march=pentiumpro" | |
589 | 66 NGX_CPU_CACHE_LINE=32 |
455 | 67 ;; |
68 | |
69 pentium4) | |
70 # optimize for Pentium 4, gcc 3.x | |
71 CPU_OPT="-march=pentium4" | |
589 | 72 NGX_CPU_CACHE_LINE=128 |
455 | 73 ;; |
74 | |
521 | 75 athlon) |
76 # optimize for Athlon, gcc 3.x | |
77 CPU_OPT="-march=athlon" | |
589 | 78 NGX_CPU_CACHE_LINE=64 |
521 | 79 ;; |
80 | |
509 | 81 opteron) |
82 # optimize for Opteron, gcc 3.x | |
83 CPU_OPT="-march=opteron" | |
589 | 84 NGX_CPU_CACHE_LINE=64 |
509 | 85 ;; |
86 | |
581 | 87 sparc32) |
88 # build 32-bit UltraSparc binary | |
89 CPU_OPT="-m32" | |
90 CORE_LINK="$CORE_LINK -m32" | |
91 CC_AUX_FLAGS="$CC_AUX_FLAGS -m32" | |
589 | 92 NGX_CPU_CACHE_LINE=64 |
581 | 93 ;; |
94 | |
455 | 95 sparc64) |
96 # build 64-bit UltraSparc binary | |
97 CPU_OPT="-m64" | |
98 CORE_LINK="$CORE_LINK -m64" | |
99 CC_AUX_FLAGS="$CC_AUX_FLAGS -m64" | |
589 | 100 NGX_CPU_CACHE_LINE=64 |
455 | 101 ;; |
102 | |
613 | 103 ppc64) |
104 # build 64-bit PowerPC binary | |
105 CPU_OPT="-m64" | |
106 CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32" | |
107 CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32" | |
108 CORE_LINK="$CORE_LINK -m64" | |
109 CC_AUX_FLAGS="$CC_AUX_FLAGS -m64" | |
110 NGX_CPU_CACHE_LINE=128 | |
111 ;; | |
112 | |
455 | 113 esac |
114 | |
115 | |
501 | 116 case "$NGX_GCC_VER" in |
117 2.7*) | |
118 # batch build | |
119 CPU_OPT= | |
120 ;; | |
121 esac | |
455 | 122 |
123 | |
124 CFLAGS="$CFLAGS $PIPE $CPU_OPT" | |
125 | |
126 if [ ".$PCRE_OPT" = "." ]; then | |
127 PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
128 else | |
129 PCRE_OPT="$PCRE_OPT $PIPE" | |
130 fi | |
131 | |
132 if [ ".$MD5_OPT" = "." ]; then | |
133 MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
134 else | |
135 MD5_OPT="$MD5_OPT $PIPE" | |
136 fi | |
137 | |
138 if [ ".$ZLIB_OPT" = "." ]; then | |
139 ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
140 else | |
141 ZLIB_OPT="$ZLIB_OPT $PIPE" | |
142 fi | |
143 | |
144 | |
145 # warnings | |
146 | |
487 | 147 # -W requires at least -O |
1010 | 148 CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W" |
487 | 149 |
455 | 150 CFLAGS="$CFLAGS -Wall -Wpointer-arith" |
577 | 151 #CFLAGS="$CFLAGS -Wconversion" |
455 | 152 #CFLAGS="$CFLAGS -Winline" |
153 | |
501 | 154 |
155 case "$NGX_GCC_VER" in | |
156 3.* | 4.* ) | |
157 # we have a lot of the unused function arguments | |
158 CFLAGS="$CFLAGS -Wno-unused-parameter" | |
2751 | 159 CFLAGS="$CFLAGS -Wunused-function" |
563 | 160 CFLAGS="$CFLAGS -Wunused-variable" |
161 CFLAGS="$CFLAGS -Wunused-value" | |
2751 | 162 # 4.2.1 shows the warning in wrong places |
501 | 163 #CFLAGS="$CFLAGS -Wunreachable-code" |
164 ;; | |
165 | |
166 *) | |
167 # we have a lot of the unused function arguments | |
168 CFLAGS="$CFLAGS -Wno-unused" | |
169 ;; | |
170 esac | |
171 | |
455 | 172 |
173 # stop on warning | |
174 CFLAGS="$CFLAGS -Werror" | |
175 | |
176 # debug | |
177 CFLAGS="$CFLAGS -g" | |
178 | |
179 # DragonFly's gcc3 generates DWARF | |
180 #CFLAGS="$CFLAGS -g -gstabs" | |
181 | |
182 if [ ".$CPP" = "." ]; then | |
183 CPP="$CC -E" | |
184 fi |