Mercurial > hg > nginx-quic
annotate auto/cc/gcc @ 2765:6d358aeaa989
ngx_log_errno()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 27 Apr 2009 13:17:33 +0000 |
parents | 3b9b67bc0cdc |
children | b57a4a704f3c fe084c435dc3 |
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 $NGX_GCC_OPT" | |
55 | |
56 #CFLAGS="$CFLAGS -fomit-frame-pointer" | |
455 | 57 |
58 case $CPU in | |
59 pentium) | |
60 # optimize for Pentium and Athlon | |
61 CPU_OPT="-march=pentium" | |
589 | 62 NGX_CPU_CACHE_LINE=32 |
455 | 63 ;; |
64 | |
561 | 65 pentiumpro | pentium3) |
455 | 66 # optimize for Pentium Pro, Pentium II and Pentium III |
67 CPU_OPT="-march=pentiumpro" | |
589 | 68 NGX_CPU_CACHE_LINE=32 |
455 | 69 ;; |
70 | |
71 pentium4) | |
72 # optimize for Pentium 4, gcc 3.x | |
73 CPU_OPT="-march=pentium4" | |
589 | 74 NGX_CPU_CACHE_LINE=128 |
455 | 75 ;; |
76 | |
521 | 77 athlon) |
78 # optimize for Athlon, gcc 3.x | |
79 CPU_OPT="-march=athlon" | |
589 | 80 NGX_CPU_CACHE_LINE=64 |
521 | 81 ;; |
82 | |
509 | 83 opteron) |
84 # optimize for Opteron, gcc 3.x | |
85 CPU_OPT="-march=opteron" | |
589 | 86 NGX_CPU_CACHE_LINE=64 |
509 | 87 ;; |
88 | |
581 | 89 sparc32) |
90 # build 32-bit UltraSparc binary | |
91 CPU_OPT="-m32" | |
92 CORE_LINK="$CORE_LINK -m32" | |
93 CC_AUX_FLAGS="$CC_AUX_FLAGS -m32" | |
589 | 94 NGX_CPU_CACHE_LINE=64 |
581 | 95 ;; |
96 | |
455 | 97 sparc64) |
98 # build 64-bit UltraSparc binary | |
99 CPU_OPT="-m64" | |
100 CORE_LINK="$CORE_LINK -m64" | |
101 CC_AUX_FLAGS="$CC_AUX_FLAGS -m64" | |
589 | 102 NGX_CPU_CACHE_LINE=64 |
455 | 103 ;; |
104 | |
613 | 105 ppc64) |
106 # build 64-bit PowerPC binary | |
107 CPU_OPT="-m64" | |
108 CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32" | |
109 CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32" | |
110 CORE_LINK="$CORE_LINK -m64" | |
111 CC_AUX_FLAGS="$CC_AUX_FLAGS -m64" | |
112 NGX_CPU_CACHE_LINE=128 | |
113 ;; | |
114 | |
455 | 115 esac |
116 | |
117 | |
501 | 118 case "$NGX_GCC_VER" in |
119 2.7*) | |
120 # batch build | |
121 CPU_OPT= | |
122 ;; | |
123 esac | |
455 | 124 |
125 | |
126 CFLAGS="$CFLAGS $PIPE $CPU_OPT" | |
127 | |
128 if [ ".$PCRE_OPT" = "." ]; then | |
129 PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
130 else | |
131 PCRE_OPT="$PCRE_OPT $PIPE" | |
132 fi | |
133 | |
134 if [ ".$MD5_OPT" = "." ]; then | |
135 MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
136 else | |
137 MD5_OPT="$MD5_OPT $PIPE" | |
138 fi | |
139 | |
140 if [ ".$ZLIB_OPT" = "." ]; then | |
141 ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" | |
142 else | |
143 ZLIB_OPT="$ZLIB_OPT $PIPE" | |
144 fi | |
145 | |
146 | |
147 # warnings | |
148 | |
487 | 149 # -W requires at least -O |
1010 | 150 CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W" |
487 | 151 |
455 | 152 CFLAGS="$CFLAGS -Wall -Wpointer-arith" |
577 | 153 #CFLAGS="$CFLAGS -Wconversion" |
455 | 154 #CFLAGS="$CFLAGS -Winline" |
155 | |
501 | 156 |
157 case "$NGX_GCC_VER" in | |
158 3.* | 4.* ) | |
159 # we have a lot of the unused function arguments | |
160 CFLAGS="$CFLAGS -Wno-unused-parameter" | |
2751 | 161 CFLAGS="$CFLAGS -Wunused-function" |
563 | 162 CFLAGS="$CFLAGS -Wunused-variable" |
163 CFLAGS="$CFLAGS -Wunused-value" | |
2751 | 164 # 4.2.1 shows the warning in wrong places |
501 | 165 #CFLAGS="$CFLAGS -Wunreachable-code" |
166 ;; | |
167 | |
168 *) | |
169 # we have a lot of the unused function arguments | |
170 CFLAGS="$CFLAGS -Wno-unused" | |
171 ;; | |
172 esac | |
173 | |
455 | 174 |
175 # stop on warning | |
176 CFLAGS="$CFLAGS -Werror" | |
177 | |
178 # debug | |
179 CFLAGS="$CFLAGS -g" | |
180 | |
181 # DragonFly's gcc3 generates DWARF | |
182 #CFLAGS="$CFLAGS -g -gstabs" | |
183 | |
184 if [ ".$CPP" = "." ]; then | |
185 CPP="$CC -E" | |
186 fi |