OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 ## | 2 ## |
3 ## configure.sh | 3 ## configure.sh |
4 ## | 4 ## |
5 ## This script is sourced by the main configure script and contains | 5 ## This script is sourced by the main configure script and contains |
6 ## utility functions and other common bits that aren't strictly libvpx | 6 ## utility functions and other common bits that aren't strictly libvpx |
7 ## related. | 7 ## related. |
8 ## | 8 ## |
9 ## This build system is based in part on the FFmpeg configure script. | 9 ## This build system is based in part on the FFmpeg configure script. |
10 ## | 10 ## |
11 | 11 |
12 | 12 |
13 # | 13 # |
14 # Logging / Output Functions | 14 # Logging / Output Functions |
15 # | 15 # |
16 die_unknown(){ | 16 die_unknown(){ |
17 echo "Unknown option \"$1\"." | 17 echo "Unknown option \"$1\"." |
18 echo "See $0 --help for available options." | 18 echo "See $0 --help for available options." |
19 clean_temp_files | 19 clean_temp_files |
20 exit 1 | 20 exit 1 |
21 } | 21 } |
22 | 22 |
23 | |
24 die() { | 23 die() { |
25 echo "$@" | 24 echo "$@" |
26 echo | 25 echo |
27 echo "Configuration failed. This could reflect a misconfiguration of your" | 26 echo "Configuration failed. This could reflect a misconfiguration of your" |
28 echo "toolchains, improper options selected, or another problem. If you" | 27 echo "toolchains, improper options selected, or another problem. If you" |
29 echo "don't see any useful error messages above, the next step is to look" | 28 echo "don't see any useful error messages above, the next step is to look" |
30 echo "at the configure error log file ($logfile) to determine what" | 29 echo "at the configure error log file ($logfile) to determine what" |
31 echo "configure was trying to do when it died." | 30 echo "configure was trying to do when it died." |
32 clean_temp_files | 31 clean_temp_files |
33 exit 1 | 32 exit 1 |
34 } | 33 } |
35 | 34 |
36 | |
37 log(){ | 35 log(){ |
38 echo "$@" >>$logfile | 36 echo "$@" >>$logfile |
39 } | 37 } |
40 | 38 |
41 | |
42 log_file(){ | 39 log_file(){ |
43 log BEGIN $1 | 40 log BEGIN $1 |
44 cat -n $1 >>$logfile | 41 cat -n $1 >>$logfile |
45 log END $1 | 42 log END $1 |
46 } | 43 } |
47 | 44 |
48 | |
49 log_echo() { | 45 log_echo() { |
50 echo "$@" | 46 echo "$@" |
51 log "$@" | 47 log "$@" |
52 } | 48 } |
53 | 49 |
54 | |
55 fwrite () { | 50 fwrite () { |
56 outfile=$1 | 51 outfile=$1 |
57 shift | 52 shift |
58 echo "$@" >> ${outfile} | 53 echo "$@" >> ${outfile} |
59 } | 54 } |
60 | 55 |
| 56 show_help_pre(){ |
| 57 for opt in ${CMDLINE_SELECT}; do |
| 58 opt2=`echo $opt | sed -e 's;_;-;g'` |
| 59 if enabled $opt; then |
| 60 eval "toggle_${opt}=\"--disable-${opt2}\"" |
| 61 else |
| 62 eval "toggle_${opt}=\"--enable-${opt2} \"" |
| 63 fi |
| 64 done |
61 | 65 |
62 show_help_pre(){ | 66 cat <<EOF |
63 for opt in ${CMDLINE_SELECT}; do | |
64 opt2=`echo $opt | sed -e 's;_;-;g'` | |
65 if enabled $opt; then | |
66 eval "toggle_${opt}=\"--disable-${opt2}\"" | |
67 else | |
68 eval "toggle_${opt}=\"--enable-${opt2} \"" | |
69 fi | |
70 done | |
71 | |
72 cat <<EOF | |
73 Usage: configure [options] | 67 Usage: configure [options] |
74 Options: | 68 Options: |
75 | 69 |
76 Build options: | 70 Build options: |
77 --help print this message | 71 --help print this message |
78 --log=yes|no|FILE file configure log is written to [config.log] | 72 --log=yes|no|FILE file configure log is written to [config.log] |
79 --target=TARGET target platform tuple [generic-gnu] | 73 --target=TARGET target platform tuple [generic-gnu] |
80 --cpu=CPU optimize for a specific cpu rather than a family | 74 --cpu=CPU optimize for a specific cpu rather than a family |
81 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] | 75 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] |
82 ${toggle_extra_warnings} emit harmless warnings (always non-fatal) | 76 ${toggle_extra_warnings} emit harmless warnings (always non-fatal) |
(...skipping 10 matching lines...) Expand all Loading... |
93 Install options: | 87 Install options: |
94 ${toggle_install_docs} control whether docs are installed | 88 ${toggle_install_docs} control whether docs are installed |
95 ${toggle_install_bins} control whether binaries are installed | 89 ${toggle_install_bins} control whether binaries are installed |
96 ${toggle_install_libs} control whether libraries are installed | 90 ${toggle_install_libs} control whether libraries are installed |
97 ${toggle_install_srcs} control whether sources are installed | 91 ${toggle_install_srcs} control whether sources are installed |
98 | 92 |
99 | 93 |
100 EOF | 94 EOF |
101 } | 95 } |
102 | 96 |
103 | |
104 show_help_post(){ | 97 show_help_post(){ |
105 cat <<EOF | 98 cat <<EOF |
106 | 99 |
107 | 100 |
108 NOTES: | 101 NOTES: |
109 Object files are built at the place where configure is launched. | 102 Object files are built at the place where configure is launched. |
110 | 103 |
111 All boolean options can be negated. The default value is the opposite | 104 All boolean options can be negated. The default value is the opposite |
112 of that shown above. If the option --disable-foo is listed, then | 105 of that shown above. If the option --disable-foo is listed, then |
113 the default value for foo is enabled. | 106 the default value for foo is enabled. |
114 | 107 |
115 Supported targets: | 108 Supported targets: |
116 EOF | 109 EOF |
117 show_targets ${all_platforms} | 110 show_targets ${all_platforms} |
118 echo | 111 echo |
119 exit 1 | 112 exit 1 |
120 } | 113 } |
121 | 114 |
122 | |
123 show_targets() { | 115 show_targets() { |
124 while [ -n "$*" ]; do | 116 while [ -n "$*" ]; do |
125 if [ "${1%%-*}" = "${2%%-*}" ]; then | 117 if [ "${1%%-*}" = "${2%%-*}" ]; then |
126 if [ "${2%%-*}" = "${3%%-*}" ]; then | 118 if [ "${2%%-*}" = "${3%%-*}" ]; then |
127 printf " %-24s %-24s %-24s\n" "$1" "$2" "$3" | 119 printf " %-24s %-24s %-24s\n" "$1" "$2" "$3" |
128 shift; shift; shift | 120 shift; shift; shift |
129 else | 121 else |
130 printf " %-24s %-24s\n" "$1" "$2" | 122 printf " %-24s %-24s\n" "$1" "$2" |
131 shift; shift | 123 shift; shift |
132 fi | 124 fi |
133 else | 125 else |
134 printf " %-24s\n" "$1" | 126 printf " %-24s\n" "$1" |
135 shift | 127 shift |
136 fi | 128 fi |
137 done | 129 done |
138 } | 130 } |
139 | 131 |
140 | |
141 show_help() { | 132 show_help() { |
142 show_help_pre | 133 show_help_pre |
143 show_help_post | 134 show_help_post |
144 } | 135 } |
145 | 136 |
146 # | 137 # |
147 # List Processing Functions | 138 # List Processing Functions |
148 # | 139 # |
149 set_all(){ | 140 set_all(){ |
150 value=$1 | 141 value=$1 |
151 shift | 142 shift |
152 for var in $*; do | 143 for var in $*; do |
153 eval $var=$value | 144 eval $var=$value |
154 done | 145 done |
155 } | 146 } |
156 | 147 |
157 | |
158 is_in(){ | 148 is_in(){ |
159 value=$1 | 149 value=$1 |
160 shift | 150 shift |
161 for var in $*; do | 151 for var in $*; do |
162 [ $var = $value ] && return 0 | 152 [ $var = $value ] && return 0 |
163 done | 153 done |
164 return 1 | 154 return 1 |
165 } | 155 } |
166 | 156 |
167 | |
168 add_cflags() { | 157 add_cflags() { |
169 CFLAGS="${CFLAGS} $@" | 158 CFLAGS="${CFLAGS} $@" |
170 CXXFLAGS="${CXXFLAGS} $@" | 159 CXXFLAGS="${CXXFLAGS} $@" |
171 } | 160 } |
172 | 161 |
173 | |
174 add_cflags_only() { | 162 add_cflags_only() { |
175 CFLAGS="${CFLAGS} $@" | 163 CFLAGS="${CFLAGS} $@" |
176 } | 164 } |
177 | 165 |
178 | |
179 add_cxxflags_only() { | 166 add_cxxflags_only() { |
180 CXXFLAGS="${CXXFLAGS} $@" | 167 CXXFLAGS="${CXXFLAGS} $@" |
181 } | 168 } |
182 | 169 |
183 | |
184 add_ldflags() { | 170 add_ldflags() { |
185 LDFLAGS="${LDFLAGS} $@" | 171 LDFLAGS="${LDFLAGS} $@" |
186 } | 172 } |
187 | 173 |
188 | |
189 add_asflags() { | 174 add_asflags() { |
190 ASFLAGS="${ASFLAGS} $@" | 175 ASFLAGS="${ASFLAGS} $@" |
191 } | 176 } |
192 | 177 |
193 | |
194 add_extralibs() { | 178 add_extralibs() { |
195 extralibs="${extralibs} $@" | 179 extralibs="${extralibs} $@" |
196 } | 180 } |
197 | 181 |
198 # | 182 # |
199 # Boolean Manipulation Functions | 183 # Boolean Manipulation Functions |
200 # | 184 # |
201 enable_feature(){ | 185 enable_feature(){ |
202 set_all yes $* | 186 set_all yes $* |
203 } | 187 } |
204 | 188 |
205 disable_feature(){ | 189 disable_feature(){ |
206 set_all no $* | 190 set_all no $* |
207 } | 191 } |
208 | 192 |
209 enabled(){ | 193 enabled(){ |
210 eval test "x\$$1" = "xyes" | 194 eval test "x\$$1" = "xyes" |
211 } | 195 } |
212 | 196 |
213 disabled(){ | 197 disabled(){ |
214 eval test "x\$$1" = "xno" | 198 eval test "x\$$1" = "xno" |
215 } | 199 } |
216 | 200 |
217 | |
218 soft_enable() { | 201 soft_enable() { |
219 for var in $*; do | 202 for var in $*; do |
220 if ! disabled $var; then | 203 if ! disabled $var; then |
221 log_echo " enabling $var" | 204 log_echo " enabling $var" |
222 enable_feature $var | 205 enable_feature $var |
223 fi | 206 fi |
224 done | 207 done |
225 } | 208 } |
226 | 209 |
227 soft_disable() { | 210 soft_disable() { |
228 for var in $*; do | 211 for var in $*; do |
229 if ! enabled $var; then | 212 if ! enabled $var; then |
230 log_echo " disabling $var" | 213 log_echo " disabling $var" |
231 disable_feature $var | 214 disable_feature $var |
232 fi | 215 fi |
233 done | 216 done |
234 } | 217 } |
235 | 218 |
236 | |
237 # | 219 # |
238 # Text Processing Functions | 220 # Text Processing Functions |
239 # | 221 # |
240 toupper(){ | 222 toupper(){ |
241 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | 223 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
242 } | 224 } |
243 | 225 |
244 | |
245 tolower(){ | 226 tolower(){ |
246 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | 227 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz |
247 } | 228 } |
248 | 229 |
249 | |
250 # | 230 # |
251 # Temporary File Functions | 231 # Temporary File Functions |
252 # | 232 # |
253 source_path=${0%/*} | 233 source_path=${0%/*} |
254 enable_feature source_path_used | 234 enable_feature source_path_used |
255 if [ -z "$source_path" ] || [ "$source_path" = "." ]; then | 235 if [ -z "$source_path" ] || [ "$source_path" = "." ]; then |
256 source_path="`pwd`" | 236 source_path="`pwd`" |
257 disable_feature source_path_used | 237 disable_feature source_path_used |
258 fi | 238 fi |
259 | 239 |
260 if test ! -z "$TMPDIR" ; then | 240 if test ! -z "$TMPDIR" ; then |
261 TMPDIRx="${TMPDIR}" | 241 TMPDIRx="${TMPDIR}" |
262 elif test ! -z "$TEMPDIR" ; then | 242 elif test ! -z "$TEMPDIR" ; then |
263 TMPDIRx="${TEMPDIR}" | 243 TMPDIRx="${TEMPDIR}" |
264 else | 244 else |
265 TMPDIRx="/tmp" | 245 TMPDIRx="/tmp" |
266 fi | 246 fi |
267 RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}') | 247 RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}') |
268 TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h" | 248 TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h" |
269 TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c" | 249 TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c" |
270 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc" | 250 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc" |
271 TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o" | 251 TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o" |
272 TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x" | 252 TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x" |
273 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" | 253 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" |
274 | 254 |
275 clean_temp_files() { | 255 clean_temp_files() { |
276 rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM} | 256 rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM} |
277 enabled gcov && rm -f ${TMP_C%.c}.gcno ${TMP_CC%.cc}.gcno | 257 enabled gcov && rm -f ${TMP_C%.c}.gcno ${TMP_CC%.cc}.gcno |
278 } | 258 } |
279 | 259 |
280 # | 260 # |
281 # Toolchain Check Functions | 261 # Toolchain Check Functions |
282 # | 262 # |
283 check_cmd() { | 263 check_cmd() { |
284 enabled external_build && return | 264 enabled external_build && return |
285 log "$@" | 265 log "$@" |
286 "$@" >>${logfile} 2>&1 | 266 "$@" >>${logfile} 2>&1 |
287 } | 267 } |
288 | 268 |
289 check_cc() { | 269 check_cc() { |
290 log check_cc "$@" | 270 log check_cc "$@" |
291 cat >${TMP_C} | 271 cat >${TMP_C} |
292 log_file ${TMP_C} | 272 log_file ${TMP_C} |
293 check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} | 273 check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} |
294 } | 274 } |
295 | 275 |
296 check_cxx() { | 276 check_cxx() { |
297 log check_cxx "$@" | 277 log check_cxx "$@" |
298 cat >${TMP_CC} | 278 cat >${TMP_CC} |
299 log_file ${TMP_CC} | 279 log_file ${TMP_CC} |
300 check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC} | 280 check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC} |
301 } | 281 } |
302 | 282 |
303 check_cpp() { | 283 check_cpp() { |
304 log check_cpp "$@" | 284 log check_cpp "$@" |
305 cat > ${TMP_C} | 285 cat > ${TMP_C} |
306 log_file ${TMP_C} | 286 log_file ${TMP_C} |
307 check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C} | 287 check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C} |
308 } | 288 } |
309 | 289 |
310 check_ld() { | 290 check_ld() { |
311 log check_ld "$@" | 291 log check_ld "$@" |
312 check_cc $@ \ | 292 check_cc $@ \ |
313 && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} | 293 && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} |
314 } | 294 } |
315 | 295 |
316 check_header(){ | 296 check_header(){ |
317 log check_header "$@" | 297 log check_header "$@" |
318 header=$1 | 298 header=$1 |
319 shift | 299 shift |
320 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` | 300 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
321 disable_feature $var | 301 disable_feature $var |
322 check_cpp "$@" <<EOF && enable_feature $var | 302 check_cpp "$@" <<EOF && enable_feature $var |
323 #include "$header" | 303 #include "$header" |
324 int x; | 304 int x; |
325 EOF | 305 EOF |
326 } | 306 } |
327 | 307 |
328 | |
329 check_cflags() { | 308 check_cflags() { |
330 log check_cflags "$@" | 309 log check_cflags "$@" |
331 check_cc -Werror "$@" <<EOF | 310 check_cc -Werror "$@" <<EOF |
332 int x; | 311 int x; |
333 EOF | 312 EOF |
334 } | 313 } |
335 | 314 |
336 check_cxxflags() { | 315 check_cxxflags() { |
337 log check_cxxflags "$@" | 316 log check_cxxflags "$@" |
338 | 317 |
339 # Catch CFLAGS that trigger CXX warnings | 318 # Catch CFLAGS that trigger CXX warnings |
340 case "$CXX" in | 319 case "$CXX" in |
341 *c++-analyzer|*clang++|*g++*) check_cxx -Werror "$@" <<EOF | 320 *c++-analyzer|*clang++|*g++*) |
| 321 check_cxx -Werror "$@" <<EOF |
342 int x; | 322 int x; |
343 EOF | 323 EOF |
344 ;; | 324 ;; |
345 *) check_cxx -Werror "$@" <<EOF | 325 *) |
| 326 check_cxx -Werror "$@" <<EOF |
346 int x; | 327 int x; |
347 EOF | 328 EOF |
348 ;; | 329 ;; |
349 esac | 330 esac |
350 } | 331 } |
351 | 332 |
352 check_add_cflags() { | 333 check_add_cflags() { |
353 check_cxxflags "$@" && add_cxxflags_only "$@" | 334 check_cxxflags "$@" && add_cxxflags_only "$@" |
354 check_cflags "$@" && add_cflags_only "$@" | 335 check_cflags "$@" && add_cflags_only "$@" |
355 } | 336 } |
356 | 337 |
357 check_add_asflags() { | 338 check_add_asflags() { |
358 log add_asflags "$@" | 339 log add_asflags "$@" |
359 add_asflags "$@" | 340 add_asflags "$@" |
360 } | 341 } |
361 | 342 |
362 check_add_ldflags() { | 343 check_add_ldflags() { |
363 log add_ldflags "$@" | 344 log add_ldflags "$@" |
364 add_ldflags "$@" | 345 add_ldflags "$@" |
365 } | 346 } |
366 | 347 |
367 check_asm_align() { | 348 check_asm_align() { |
368 log check_asm_align "$@" | 349 log check_asm_align "$@" |
369 cat >${TMP_ASM} <<EOF | 350 cat >${TMP_ASM} <<EOF |
370 section .rodata | 351 section .rodata |
371 align 16 | 352 align 16 |
372 EOF | 353 EOF |
373 log_file ${TMP_ASM} | 354 log_file ${TMP_ASM} |
374 check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} | 355 check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} |
375 readelf -WS ${TMP_O} >${TMP_X} | 356 readelf -WS ${TMP_O} >${TMP_X} |
376 log_file ${TMP_X} | 357 log_file ${TMP_X} |
377 if ! grep -q '\.rodata .* 16$' ${TMP_X}; then | 358 if ! grep -q '\.rodata .* 16$' ${TMP_X}; then |
378 die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" | 359 die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" |
379 fi | 360 fi |
380 } | 361 } |
381 | 362 |
382 # tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. | 363 # tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. |
383 check_gcc_machine_option() { | 364 check_gcc_machine_option() { |
384 opt="$1" | 365 opt="$1" |
385 feature="$2" | 366 feature="$2" |
386 [ -n "$feature" ] || feature="$opt" | 367 [ -n "$feature" ] || feature="$opt" |
387 | 368 |
388 if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then | 369 if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then |
389 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " | 370 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " |
390 else | 371 else |
391 soft_enable "$feature" | 372 soft_enable "$feature" |
392 fi | 373 fi |
393 } | 374 } |
394 | 375 |
395 write_common_config_banner() { | 376 write_common_config_banner() { |
396 print_webm_license config.mk "##" "" | 377 print_webm_license config.mk "##" "" |
397 echo '# This file automatically generated by configure. Do not edit!' >> con
fig.mk | 378 echo '# This file automatically generated by configure. Do not edit!' >> confi
g.mk |
398 echo "TOOLCHAIN := ${toolchain}" >> config.mk | 379 echo "TOOLCHAIN := ${toolchain}" >> config.mk |
399 | 380 |
400 case ${toolchain} in | 381 case ${toolchain} in |
401 *-linux-rvct) | 382 *-linux-rvct) |
402 echo "ALT_LIBC := ${alt_libc}" >> config.mk | 383 echo "ALT_LIBC := ${alt_libc}" >> config.mk |
403 ;; | 384 ;; |
404 esac | 385 esac |
405 } | 386 } |
406 | 387 |
407 write_common_config_targets() { | 388 write_common_config_targets() { |
408 for t in ${all_targets}; do | 389 for t in ${all_targets}; do |
409 if enabled ${t}; then | 390 if enabled ${t}; then |
410 if enabled universal || enabled child; then | 391 if enabled universal || enabled child; then |
411 fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" | 392 fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" |
412 else | 393 else |
413 fwrite config.mk "ALL_TARGETS += ${t}" | 394 fwrite config.mk "ALL_TARGETS += ${t}" |
414 fi | 395 fi |
415 fi | 396 fi |
416 true; | 397 true; |
417 done | 398 done |
418 true | 399 true |
419 } | 400 } |
420 | 401 |
421 write_common_target_config_mk() { | 402 write_common_target_config_mk() { |
422 saved_CC="${CC}" | 403 saved_CC="${CC}" |
423 saved_CXX="${CXX}" | 404 saved_CXX="${CXX}" |
424 enabled ccache && CC="ccache ${CC}" | 405 enabled ccache && CC="ccache ${CC}" |
425 enabled ccache && CXX="ccache ${CXX}" | 406 enabled ccache && CXX="ccache ${CXX}" |
426 print_webm_license $1 "##" "" | 407 print_webm_license $1 "##" "" |
427 | 408 |
428 cat >> $1 << EOF | 409 cat >> $1 << EOF |
429 # This file automatically generated by configure. Do not edit! | 410 # This file automatically generated by configure. Do not edit! |
430 SRC_PATH="$source_path" | 411 SRC_PATH="$source_path" |
431 SRC_PATH_BARE=$source_path | 412 SRC_PATH_BARE=$source_path |
432 BUILD_PFX=${BUILD_PFX} | 413 BUILD_PFX=${BUILD_PFX} |
433 TOOLCHAIN=${toolchain} | 414 TOOLCHAIN=${toolchain} |
434 ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} | 415 ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} |
435 GEN_VCPROJ=${gen_vcproj_cmd} | 416 GEN_VCPROJ=${gen_vcproj_cmd} |
436 MSVS_ARCH_DIR=${msvs_arch_dir} | 417 MSVS_ARCH_DIR=${msvs_arch_dir} |
437 | 418 |
438 CC=${CC} | 419 CC=${CC} |
439 CXX=${CXX} | 420 CXX=${CXX} |
440 AR=${AR} | 421 AR=${AR} |
441 LD=${LD} | 422 LD=${LD} |
442 AS=${AS} | 423 AS=${AS} |
443 STRIP=${STRIP} | 424 STRIP=${STRIP} |
444 NM=${NM} | 425 NM=${NM} |
445 | 426 |
446 CFLAGS = ${CFLAGS} | 427 CFLAGS = ${CFLAGS} |
447 CXXFLAGS = ${CXXFLAGS} | 428 CXXFLAGS = ${CXXFLAGS} |
448 ARFLAGS = -rus\$(if \$(quiet),c,v) | 429 ARFLAGS = -rus\$(if \$(quiet),c,v) |
449 LDFLAGS = ${LDFLAGS} | 430 LDFLAGS = ${LDFLAGS} |
450 ASFLAGS = ${ASFLAGS} | 431 ASFLAGS = ${ASFLAGS} |
451 extralibs = ${extralibs} | 432 extralibs = ${extralibs} |
452 AS_SFX = ${AS_SFX:-.asm} | 433 AS_SFX = ${AS_SFX:-.asm} |
453 EXE_SFX = ${EXE_SFX} | 434 EXE_SFX = ${EXE_SFX} |
454 VCPROJ_SFX = ${VCPROJ_SFX} | 435 VCPROJ_SFX = ${VCPROJ_SFX} |
455 RTCD_OPTIONS = ${RTCD_OPTIONS} | 436 RTCD_OPTIONS = ${RTCD_OPTIONS} |
456 EOF | 437 EOF |
457 | 438 |
458 if enabled rvct; then cat >> $1 << EOF | 439 if enabled rvct; then cat >> $1 << EOF |
459 fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide | 440 fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide |
460 EOF | 441 EOF |
461 else cat >> $1 << EOF | 442 else cat >> $1 << EOF |
462 fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;' | 443 fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;' |
463 EOF | 444 EOF |
464 fi | 445 fi |
465 | 446 |
466 print_config_mk ARCH "${1}" ${ARCH_LIST} | 447 print_config_mk ARCH "${1}" ${ARCH_LIST} |
467 print_config_mk HAVE "${1}" ${HAVE_LIST} | 448 print_config_mk HAVE "${1}" ${HAVE_LIST} |
468 print_config_mk CONFIG "${1}" ${CONFIG_LIST} | 449 print_config_mk CONFIG "${1}" ${CONFIG_LIST} |
469 print_config_mk HAVE "${1}" gnu_strip | 450 print_config_mk HAVE "${1}" gnu_strip |
470 | 451 |
471 enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" | 452 enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" |
472 | 453 |
473 CC="${saved_CC}" | 454 CC="${saved_CC}" |
474 CXX="${saved_CXX}" | 455 CXX="${saved_CXX}" |
475 } | 456 } |
476 | 457 |
477 | |
478 write_common_target_config_h() { | 458 write_common_target_config_h() { |
479 print_webm_license ${TMP_H} "/*" " */" | 459 print_webm_license ${TMP_H} "/*" " */" |
480 cat >> ${TMP_H} << EOF | 460 cat >> ${TMP_H} << EOF |
481 /* This file automatically generated by configure. Do not edit! */ | 461 /* This file automatically generated by configure. Do not edit! */ |
482 #ifndef VPX_CONFIG_H | 462 #ifndef VPX_CONFIG_H |
483 #define VPX_CONFIG_H | 463 #define VPX_CONFIG_H |
484 #define RESTRICT ${RESTRICT} | 464 #define RESTRICT ${RESTRICT} |
485 #define INLINE ${INLINE} | 465 #define INLINE ${INLINE} |
486 EOF | 466 EOF |
487 print_config_h ARCH "${TMP_H}" ${ARCH_LIST} | 467 print_config_h ARCH "${TMP_H}" ${ARCH_LIST} |
488 print_config_h HAVE "${TMP_H}" ${HAVE_LIST} | 468 print_config_h HAVE "${TMP_H}" ${HAVE_LIST} |
489 print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} | 469 print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} |
490 print_config_vars_h "${TMP_H}" ${VAR_LIST} | 470 print_config_vars_h "${TMP_H}" ${VAR_LIST} |
491 echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} | 471 echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} |
492 mkdir -p `dirname "$1"` | 472 mkdir -p `dirname "$1"` |
493 cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" | 473 cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" |
494 } | 474 } |
495 | 475 |
496 process_common_cmdline() { | 476 process_common_cmdline() { |
497 for opt in "$@"; do | 477 for opt in "$@"; do |
498 optval="${opt#*=}" | 478 optval="${opt#*=}" |
499 case "$opt" in | 479 case "$opt" in |
500 --child) enable_feature child | 480 --child) |
| 481 enable_feature child |
501 ;; | 482 ;; |
502 --log*) | 483 --log*) |
503 logging="$optval" | 484 logging="$optval" |
504 if ! disabled logging ; then | 485 if ! disabled logging ; then |
505 enabled logging || logfile="$logging" | 486 enabled logging || logfile="$logging" |
506 else | 487 else |
507 logfile=/dev/null | 488 logfile=/dev/null |
508 fi | 489 fi |
509 ;; | 490 ;; |
510 --target=*) toolchain="${toolchain:-${optval}}" | 491 --target=*) |
| 492 toolchain="${toolchain:-${optval}}" |
511 ;; | 493 ;; |
512 --force-target=*) toolchain="${toolchain:-${optval}}"; enable_feature fo
rce_toolchain | 494 --force-target=*) |
| 495 toolchain="${toolchain:-${optval}}" |
| 496 enable_feature force_toolchain |
513 ;; | 497 ;; |
514 --cpu) | 498 --cpu) |
515 ;; | 499 ;; |
516 --cpu=*) tune_cpu="$optval" | 500 --cpu=*) |
| 501 tune_cpu="$optval" |
517 ;; | 502 ;; |
518 --extra-cflags=*) | 503 --extra-cflags=*) |
519 extra_cflags="${optval}" | 504 extra_cflags="${optval}" |
520 ;; | 505 ;; |
521 --enable-?*|--disable-?*) | 506 --enable-?*|--disable-?*) |
522 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | 507 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
523 if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then | 508 if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then |
524 [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${
option} " | 509 [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${op
tion} " |
525 elif [ $action = "disable" ] && ! disabled $option ; then | 510 elif [ $action = "disable" ] && ! disabled $option ; then |
526 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || | 511 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || |
527 die_unknown $opt | 512 die_unknown $opt |
528 elif [ $action = "enable" ] && ! enabled $option ; then | 513 elif [ $action = "enable" ] && ! enabled $option ; then |
529 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || | 514 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || |
530 die_unknown $opt | 515 die_unknown $opt |
531 fi | 516 fi |
532 ${action}_feature $option | 517 ${action}_feature $option |
533 ;; | 518 ;; |
534 --require-?*) | 519 --require-?*) |
535 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | 520 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
536 if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then | 521 if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then |
537 RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " | 522 RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " |
538 else | 523 else |
539 die_unknown $opt | 524 die_unknown $opt |
540 fi | 525 fi |
541 ;; | 526 ;; |
542 --force-enable-?*|--force-disable-?*) | 527 --force-enable-?*|--force-disable-?*) |
543 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` | 528 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` |
544 ${action}_feature $option | 529 ${action}_feature $option |
545 ;; | 530 ;; |
546 --libc=*) | 531 --libc=*) |
547 [ -d "${optval}" ] || die "Not a directory: ${optval}" | 532 [ -d "${optval}" ] || die "Not a directory: ${optval}" |
548 disable_feature builtin_libc | 533 disable_feature builtin_libc |
549 alt_libc="${optval}" | 534 alt_libc="${optval}" |
550 ;; | 535 ;; |
551 --as=*) | 536 --as=*) |
552 [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \ | 537 [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \ |
553 || [ "${optval}" = auto ] \ | 538 || [ "${optval}" = auto ] \ |
554 || die "Must be yasm, nasm or auto: ${optval}" | 539 || die "Must be yasm, nasm or auto: ${optval}" |
555 alt_as="${optval}" | 540 alt_as="${optval}" |
556 ;; | 541 ;; |
557 --size-limit=*) | 542 --size-limit=*) |
558 w="${optval%%x*}" | 543 w="${optval%%x*}" |
559 h="${optval##*x}" | 544 h="${optval##*x}" |
560 VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" | 545 VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" |
561 [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small." | 546 [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small." |
562 [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \ | 547 [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \ |
563 || die "Invalid size-limit: too big." | 548 || die "Invalid size-limit: too big." |
564 enable_feature size_limit | 549 enable_feature size_limit |
565 ;; | 550 ;; |
566 --prefix=*) | 551 --prefix=*) |
567 prefix="${optval}" | 552 prefix="${optval}" |
568 ;; | 553 ;; |
569 --libdir=*) | 554 --libdir=*) |
570 libdir="${optval}" | 555 libdir="${optval}" |
571 ;; | 556 ;; |
572 --sdk-path=*) | 557 --sdk-path=*) |
573 [ -d "${optval}" ] || die "Not a directory: ${optval}" | 558 [ -d "${optval}" ] || die "Not a directory: ${optval}" |
574 sdk_path="${optval}" | 559 sdk_path="${optval}" |
575 ;; | 560 ;; |
576 --libc|--as|--prefix|--libdir|--sdk-path) | 561 --libc|--as|--prefix|--libdir|--sdk-path) |
577 die "Option ${opt} requires argument" | 562 die "Option ${opt} requires argument" |
578 ;; | 563 ;; |
579 --help|-h) show_help | 564 --help|-h) |
580 ;; | 565 show_help |
581 *) die_unknown $opt | 566 ;; |
582 ;; | 567 *) |
583 esac | 568 die_unknown $opt |
584 done | 569 ;; |
| 570 esac |
| 571 done |
585 } | 572 } |
586 | 573 |
587 process_cmdline() { | 574 process_cmdline() { |
588 for opt do | 575 for opt do |
589 optval="${opt#*=}" | 576 optval="${opt#*=}" |
590 case "$opt" in | 577 case "$opt" in |
591 *) process_common_cmdline $opt | 578 *) |
592 ;; | 579 process_common_cmdline $opt |
593 esac | 580 ;; |
594 done | 581 esac |
| 582 done |
595 } | 583 } |
596 | 584 |
597 | |
598 post_process_common_cmdline() { | 585 post_process_common_cmdline() { |
599 prefix="${prefix:-/usr/local}" | 586 prefix="${prefix:-/usr/local}" |
600 prefix="${prefix%/}" | 587 prefix="${prefix%/}" |
601 libdir="${libdir:-${prefix}/lib}" | 588 libdir="${libdir:-${prefix}/lib}" |
602 libdir="${libdir%/}" | 589 libdir="${libdir%/}" |
603 if [ "${libdir#${prefix}}" = "${libdir}" ]; then | 590 if [ "${libdir#${prefix}}" = "${libdir}" ]; then |
604 die "Libdir ${libdir} must be a subdirectory of ${prefix}" | 591 die "Libdir ${libdir} must be a subdirectory of ${prefix}" |
| 592 fi |
| 593 } |
| 594 |
| 595 post_process_cmdline() { |
| 596 true; |
| 597 } |
| 598 |
| 599 setup_gnu_toolchain() { |
| 600 CC=${CC:-${CROSS}gcc} |
| 601 CXX=${CXX:-${CROSS}g++} |
| 602 AR=${AR:-${CROSS}ar} |
| 603 LD=${LD:-${CROSS}${link_with_cc:-ld}} |
| 604 AS=${AS:-${CROSS}as} |
| 605 STRIP=${STRIP:-${CROSS}strip} |
| 606 NM=${NM:-${CROSS}nm} |
| 607 AS_SFX=.s |
| 608 EXE_SFX= |
| 609 } |
| 610 |
| 611 process_common_toolchain() { |
| 612 if [ -z "$toolchain" ]; then |
| 613 gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}" |
| 614 |
| 615 # detect tgt_isa |
| 616 case "$gcctarget" in |
| 617 armv6*) |
| 618 tgt_isa=armv6 |
| 619 ;; |
| 620 armv7*-hardfloat*) |
| 621 tgt_isa=armv7 |
| 622 float_abi=hard |
| 623 ;; |
| 624 armv7*) |
| 625 tgt_isa=armv7 |
| 626 float_abi=softfp |
| 627 ;; |
| 628 *x86_64*|*amd64*) |
| 629 tgt_isa=x86_64 |
| 630 ;; |
| 631 *i[3456]86*) |
| 632 tgt_isa=x86 |
| 633 ;; |
| 634 *powerpc64*) |
| 635 tgt_isa=ppc64 |
| 636 ;; |
| 637 *powerpc*) |
| 638 tgt_isa=ppc32 |
| 639 ;; |
| 640 *sparc*) |
| 641 tgt_isa=sparc |
| 642 ;; |
| 643 esac |
| 644 |
| 645 # detect tgt_os |
| 646 case "$gcctarget" in |
| 647 *darwin8*) |
| 648 tgt_isa=universal |
| 649 tgt_os=darwin8 |
| 650 ;; |
| 651 *darwin9*) |
| 652 tgt_isa=universal |
| 653 tgt_os=darwin9 |
| 654 ;; |
| 655 *darwin10*) |
| 656 tgt_isa=x86_64 |
| 657 tgt_os=darwin10 |
| 658 ;; |
| 659 *darwin11*) |
| 660 tgt_isa=x86_64 |
| 661 tgt_os=darwin11 |
| 662 ;; |
| 663 *darwin12*) |
| 664 tgt_isa=x86_64 |
| 665 tgt_os=darwin12 |
| 666 ;; |
| 667 *darwin13*) |
| 668 tgt_isa=x86_64 |
| 669 tgt_os=darwin13 |
| 670 ;; |
| 671 x86_64*mingw32*) |
| 672 tgt_os=win64 |
| 673 ;; |
| 674 *mingw32*|*cygwin*) |
| 675 [ -z "$tgt_isa" ] && tgt_isa=x86 |
| 676 tgt_os=win32 |
| 677 ;; |
| 678 *linux*|*bsd*) |
| 679 tgt_os=linux |
| 680 ;; |
| 681 *solaris2.10) |
| 682 tgt_os=solaris |
| 683 ;; |
| 684 *os2*) |
| 685 tgt_os=os2 |
| 686 ;; |
| 687 esac |
| 688 |
| 689 if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then |
| 690 toolchain=${tgt_isa}-${tgt_os}-gcc |
605 fi | 691 fi |
606 } | 692 fi |
607 | 693 |
608 | 694 toolchain=${toolchain:-generic-gnu} |
609 post_process_cmdline() { | 695 |
610 true; | 696 is_in ${toolchain} ${all_platforms} || enabled force_toolchain \ |
611 } | 697 || die "Unrecognized toolchain '${toolchain}'" |
612 | 698 |
613 setup_gnu_toolchain() { | 699 enabled child || log_echo "Configuring for target '${toolchain}'" |
614 CC=${CC:-${CROSS}gcc} | 700 |
615 CXX=${CXX:-${CROSS}g++} | 701 # |
616 AR=${AR:-${CROSS}ar} | 702 # Set up toolchain variables |
617 LD=${LD:-${CROSS}${link_with_cc:-ld}} | 703 # |
618 AS=${AS:-${CROSS}as} | 704 tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') |
619 STRIP=${STRIP:-${CROSS}strip} | 705 tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') |
620 NM=${NM:-${CROSS}nm} | 706 tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') |
621 AS_SFX=.s | 707 |
622 EXE_SFX= | 708 # Mark the specific ISA requested as enabled |
623 } | 709 soft_enable ${tgt_isa} |
624 | 710 enable_feature ${tgt_os} |
625 process_common_toolchain() { | 711 enable_feature ${tgt_cc} |
626 if [ -z "$toolchain" ]; then | 712 |
627 gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}" | 713 # Enable the architecture family |
628 | 714 case ${tgt_isa} in |
629 # detect tgt_isa | |
630 case "$gcctarget" in | |
631 armv6*) | |
632 tgt_isa=armv6 | |
633 ;; | |
634 armv7*-hardfloat*) | |
635 tgt_isa=armv7 | |
636 float_abi=hard | |
637 ;; | |
638 armv7*) | |
639 tgt_isa=armv7 | |
640 float_abi=softfp | |
641 ;; | |
642 armv5te*) | |
643 tgt_isa=armv5te | |
644 ;; | |
645 *x86_64*|*amd64*) | |
646 tgt_isa=x86_64 | |
647 ;; | |
648 *i[3456]86*) | |
649 tgt_isa=x86 | |
650 ;; | |
651 *powerpc64*) | |
652 tgt_isa=ppc64 | |
653 ;; | |
654 *powerpc*) | |
655 tgt_isa=ppc32 | |
656 ;; | |
657 *sparc*) | |
658 tgt_isa=sparc | |
659 ;; | |
660 esac | |
661 | |
662 # detect tgt_os | |
663 case "$gcctarget" in | |
664 *darwin8*) | |
665 tgt_isa=universal | |
666 tgt_os=darwin8 | |
667 ;; | |
668 *darwin9*) | |
669 tgt_isa=universal | |
670 tgt_os=darwin9 | |
671 ;; | |
672 *darwin10*) | |
673 tgt_isa=x86_64 | |
674 tgt_os=darwin10 | |
675 ;; | |
676 *darwin11*) | |
677 tgt_isa=x86_64 | |
678 tgt_os=darwin11 | |
679 ;; | |
680 *darwin12*) | |
681 tgt_isa=x86_64 | |
682 tgt_os=darwin12 | |
683 ;; | |
684 *darwin13*) | |
685 tgt_isa=x86_64 | |
686 tgt_os=darwin13 | |
687 ;; | |
688 x86_64*mingw32*) | |
689 tgt_os=win64 | |
690 ;; | |
691 *mingw32*|*cygwin*) | |
692 [ -z "$tgt_isa" ] && tgt_isa=x86 | |
693 tgt_os=win32 | |
694 ;; | |
695 *linux*|*bsd*) | |
696 tgt_os=linux | |
697 ;; | |
698 *solaris2.10) | |
699 tgt_os=solaris | |
700 ;; | |
701 *os2*) | |
702 tgt_os=os2 | |
703 ;; | |
704 esac | |
705 | |
706 if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then | |
707 toolchain=${tgt_isa}-${tgt_os}-gcc | |
708 fi | |
709 fi | |
710 | |
711 toolchain=${toolchain:-generic-gnu} | |
712 | |
713 is_in ${toolchain} ${all_platforms} || enabled force_toolchain \ | |
714 || die "Unrecognized toolchain '${toolchain}'" | |
715 | |
716 enabled child || log_echo "Configuring for target '${toolchain}'" | |
717 | |
718 # | |
719 # Set up toolchain variables | |
720 # | |
721 tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') | |
722 tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') | |
723 tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') | |
724 | |
725 # Mark the specific ISA requested as enabled | |
726 soft_enable ${tgt_isa} | |
727 enable_feature ${tgt_os} | |
728 enable_feature ${tgt_cc} | |
729 | |
730 # Enable the architecture family | |
731 case ${tgt_isa} in | |
732 arm*) enable_feature arm;; | |
733 mips*) enable_feature mips;; | |
734 esac | |
735 | |
736 # PIC is probably what we want when building shared libs | |
737 enabled shared && soft_enable pic | |
738 | |
739 # Minimum iOS version for all target platforms (darwin and iphonesimulator). | |
740 IOS_VERSION_MIN="6.0" | |
741 | |
742 # Handle darwin variants. Newer SDKs allow targeting older | |
743 # platforms, so find the newest SDK available. | |
744 case ${toolchain} in | |
745 *-darwin*) | |
746 if [ -z "${DEVELOPER_DIR}" ]; then | |
747 DEVELOPER_DIR=`xcode-select -print-path 2> /dev/null` | |
748 [ $? -ne 0 ] && OSX_SKIP_DIR_CHECK=1 | |
749 fi | |
750 if [ -z "${OSX_SKIP_DIR_CHECK}" ]; then | |
751 OSX_SDK_ROOTS="${DEVELOPER_DIR}/SDKs" | |
752 OSX_SDK_VERSIONS="MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk" | |
753 OSX_SDK_VERSIONS="${OSX_SDK_VERSIONS} MacOSX10.7.sdk" | |
754 for v in ${OSX_SDK_VERSIONS}; do | |
755 if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then | |
756 osx_sdk_dir="${OSX_SDK_ROOTS}/${v}" | |
757 fi | |
758 done | |
759 fi | |
760 ;; | |
761 esac | |
762 | |
763 if [ -d "${osx_sdk_dir}" ]; then | |
764 add_cflags "-isysroot ${osx_sdk_dir}" | |
765 add_ldflags "-isysroot ${osx_sdk_dir}" | |
766 fi | |
767 | |
768 case ${toolchain} in | |
769 *-darwin8-*) | |
770 add_cflags "-mmacosx-version-min=10.4" | |
771 add_ldflags "-mmacosx-version-min=10.4" | |
772 ;; | |
773 *-darwin9-*) | |
774 add_cflags "-mmacosx-version-min=10.5" | |
775 add_ldflags "-mmacosx-version-min=10.5" | |
776 ;; | |
777 *-darwin10-*) | |
778 add_cflags "-mmacosx-version-min=10.6" | |
779 add_ldflags "-mmacosx-version-min=10.6" | |
780 ;; | |
781 *-darwin11-*) | |
782 add_cflags "-mmacosx-version-min=10.7" | |
783 add_ldflags "-mmacosx-version-min=10.7" | |
784 ;; | |
785 *-darwin12-*) | |
786 add_cflags "-mmacosx-version-min=10.8" | |
787 add_ldflags "-mmacosx-version-min=10.8" | |
788 ;; | |
789 *-darwin13-*) | |
790 add_cflags "-mmacosx-version-min=10.9" | |
791 add_ldflags "-mmacosx-version-min=10.9" | |
792 ;; | |
793 *-iphonesimulator-*) | |
794 add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" | |
795 add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}" | |
796 osx_sdk_dir="$(xcrun --sdk iphonesimulator --show-sdk-path)" | |
797 add_cflags "-isysroot ${osx_sdk_dir}" | |
798 add_ldflags "-isysroot ${osx_sdk_dir}" | |
799 ;; | |
800 esac | |
801 | |
802 # Handle Solaris variants. Solaris 10 needs -lposix4 | |
803 case ${toolchain} in | |
804 sparc-solaris-*) | |
805 add_extralibs -lposix4 | |
806 disable_feature fast_unaligned | |
807 ;; | |
808 *-solaris-*) | |
809 add_extralibs -lposix4 | |
810 ;; | |
811 esac | |
812 | |
813 # Process ARM architecture variants | |
814 case ${toolchain} in | |
815 arm*) | 715 arm*) |
816 # on arm, isa versions are supersets | 716 enable_feature arm |
817 case ${tgt_isa} in | 717 ;; |
| 718 mips*) |
| 719 enable_feature mips |
| 720 ;; |
| 721 esac |
| 722 |
| 723 # PIC is probably what we want when building shared libs |
| 724 enabled shared && soft_enable pic |
| 725 |
| 726 # Minimum iOS version for all target platforms (darwin and iphonesimulator). |
| 727 IOS_VERSION_MIN="6.0" |
| 728 |
| 729 # Handle darwin variants. Newer SDKs allow targeting older |
| 730 # platforms, so find the newest SDK available. |
| 731 case ${toolchain} in |
| 732 *-darwin*) |
| 733 if [ -z "${DEVELOPER_DIR}" ]; then |
| 734 DEVELOPER_DIR=`xcode-select -print-path 2> /dev/null` |
| 735 [ $? -ne 0 ] && OSX_SKIP_DIR_CHECK=1 |
| 736 fi |
| 737 if [ -z "${OSX_SKIP_DIR_CHECK}" ]; then |
| 738 OSX_SDK_ROOTS="${DEVELOPER_DIR}/SDKs" |
| 739 OSX_SDK_VERSIONS="MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk" |
| 740 OSX_SDK_VERSIONS="${OSX_SDK_VERSIONS} MacOSX10.7.sdk" |
| 741 for v in ${OSX_SDK_VERSIONS}; do |
| 742 if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then |
| 743 osx_sdk_dir="${OSX_SDK_ROOTS}/${v}" |
| 744 fi |
| 745 done |
| 746 fi |
| 747 ;; |
| 748 esac |
| 749 |
| 750 if [ -d "${osx_sdk_dir}" ]; then |
| 751 add_cflags "-isysroot ${osx_sdk_dir}" |
| 752 add_ldflags "-isysroot ${osx_sdk_dir}" |
| 753 fi |
| 754 |
| 755 case ${toolchain} in |
| 756 *-darwin8-*) |
| 757 add_cflags "-mmacosx-version-min=10.4" |
| 758 add_ldflags "-mmacosx-version-min=10.4" |
| 759 ;; |
| 760 *-darwin9-*) |
| 761 add_cflags "-mmacosx-version-min=10.5" |
| 762 add_ldflags "-mmacosx-version-min=10.5" |
| 763 ;; |
| 764 *-darwin10-*) |
| 765 add_cflags "-mmacosx-version-min=10.6" |
| 766 add_ldflags "-mmacosx-version-min=10.6" |
| 767 ;; |
| 768 *-darwin11-*) |
| 769 add_cflags "-mmacosx-version-min=10.7" |
| 770 add_ldflags "-mmacosx-version-min=10.7" |
| 771 ;; |
| 772 *-darwin12-*) |
| 773 add_cflags "-mmacosx-version-min=10.8" |
| 774 add_ldflags "-mmacosx-version-min=10.8" |
| 775 ;; |
| 776 *-darwin13-*) |
| 777 add_cflags "-mmacosx-version-min=10.9" |
| 778 add_ldflags "-mmacosx-version-min=10.9" |
| 779 ;; |
| 780 *-iphonesimulator-*) |
| 781 add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" |
| 782 add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}" |
| 783 osx_sdk_dir="$(xcrun --sdk iphonesimulator --show-sdk-path)" |
| 784 add_cflags "-isysroot ${osx_sdk_dir}" |
| 785 add_ldflags "-isysroot ${osx_sdk_dir}" |
| 786 ;; |
| 787 esac |
| 788 |
| 789 # Handle Solaris variants. Solaris 10 needs -lposix4 |
| 790 case ${toolchain} in |
| 791 sparc-solaris-*) |
| 792 add_extralibs -lposix4 |
| 793 disable_feature fast_unaligned |
| 794 ;; |
| 795 *-solaris-*) |
| 796 add_extralibs -lposix4 |
| 797 ;; |
| 798 esac |
| 799 |
| 800 # Process ARM architecture variants |
| 801 case ${toolchain} in |
| 802 arm*) |
| 803 # on arm, isa versions are supersets |
| 804 case ${tgt_isa} in |
818 arm64|armv8) | 805 arm64|armv8) |
819 soft_enable neon | 806 soft_enable neon |
820 ;; | 807 ;; |
821 armv7|armv7s) | 808 armv7|armv7s) |
822 soft_enable neon | 809 soft_enable neon |
823 soft_enable neon_asm | 810 soft_enable neon_asm |
824 soft_enable media | 811 soft_enable media |
825 soft_enable edsp | 812 soft_enable fast_unaligned |
826 soft_enable fast_unaligned | 813 ;; |
827 ;; | |
828 armv6) | 814 armv6) |
829 soft_enable media | 815 soft_enable media |
830 soft_enable edsp | 816 soft_enable fast_unaligned |
831 soft_enable fast_unaligned | 817 ;; |
832 ;; | 818 esac |
833 armv5te) | 819 |
834 soft_enable edsp | 820 asm_conversion_cmd="cat" |
835 disable_feature fast_unaligned | 821 |
836 ;; | 822 case ${tgt_cc} in |
837 esac | |
838 | |
839 asm_conversion_cmd="cat" | |
840 | |
841 case ${tgt_cc} in | |
842 gcc) | 823 gcc) |
843 CROSS=${CROSS:-arm-none-linux-gnueabi-} | 824 CROSS=${CROSS:-arm-none-linux-gnueabi-} |
844 link_with_cc=gcc | 825 link_with_cc=gcc |
845 setup_gnu_toolchain | 826 setup_gnu_toolchain |
846 arch_int=${tgt_isa##armv} | 827 arch_int=${tgt_isa##armv} |
847 arch_int=${arch_int%%te} | 828 arch_int=${arch_int%%te} |
848 check_add_asflags --defsym ARCHITECTURE=${arch_int} | 829 check_add_asflags --defsym ARCHITECTURE=${arch_int} |
849 tune_cflags="-mtune=" | 830 tune_cflags="-mtune=" |
850 if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then | 831 if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then |
851 if [ -z "${float_abi}" ]; then | 832 if [ -z "${float_abi}" ]; then |
852 check_cpp <<EOF && float_abi=hard || float_abi=softfp | 833 check_cpp <<EOF && float_abi=hard || float_abi=softfp |
853 #ifndef __ARM_PCS_VFP | 834 #ifndef __ARM_PCS_VFP |
854 #error "not hardfp" | 835 #error "not hardfp" |
855 #endif | 836 #endif |
856 EOF | 837 EOF |
857 fi | 838 fi |
858 check_add_cflags -march=armv7-a -mfloat-abi=${float_abi} | 839 check_add_cflags -march=armv7-a -mfloat-abi=${float_abi} |
859 check_add_asflags -march=armv7-a -mfloat-abi=${float_abi} | 840 check_add_asflags -march=armv7-a -mfloat-abi=${float_abi} |
860 | 841 |
861 if enabled neon || enabled neon_asm | 842 if enabled neon || enabled neon_asm; then |
862 then | 843 check_add_cflags -mfpu=neon #-ftree-vectorize |
863 check_add_cflags -mfpu=neon #-ftree-vectorize | 844 check_add_asflags -mfpu=neon |
864 check_add_asflags -mfpu=neon | 845 fi |
865 fi | 846 |
866 | 847 if [ -z "${tune_cpu}" ]; then |
867 if [ -z "${tune_cpu}" ]; then | 848 tune_cpu=cortex-a8 |
868 tune_cpu=cortex-a8 | 849 fi |
869 fi | 850 else |
| 851 check_add_cflags -march=${tgt_isa} |
| 852 check_add_asflags -march=${tgt_isa} |
| 853 fi |
| 854 |
| 855 enabled debug && add_asflags -g |
| 856 asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" |
| 857 if enabled thumb; then |
| 858 asm_conversion_cmd="$asm_conversion_cmd -thumb" |
| 859 check_add_cflags -mthumb |
| 860 check_add_asflags -mthumb -mimplicit-it=always |
| 861 fi |
| 862 ;; |
| 863 vs*) |
| 864 asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" |
| 865 AS_SFX=.s |
| 866 msvs_arch_dir=arm-msvs |
| 867 disable_feature multithread |
| 868 disable_feature unit_tests |
| 869 vs_version=${tgt_cc##vs} |
| 870 if [ $vs_version -ge 12 ]; then |
| 871 # MSVC 2013 doesn't allow doing plain .exe projects for ARM, |
| 872 # only "AppContainerApplication" which requires an AppxManifest. |
| 873 # Therefore disable the examples, just build the library. |
| 874 disable_feature examples |
| 875 fi |
| 876 ;; |
| 877 rvct) |
| 878 CC=armcc |
| 879 AR=armar |
| 880 AS=armasm |
| 881 LD="${source_path}/build/make/armlink_adapter.sh" |
| 882 STRIP=arm-none-linux-gnueabi-strip |
| 883 NM=arm-none-linux-gnueabi-nm |
| 884 tune_cflags="--cpu=" |
| 885 tune_asflags="--cpu=" |
| 886 if [ -z "${tune_cpu}" ]; then |
| 887 if [ ${tgt_isa} = "armv7" ]; then |
| 888 if enabled neon || enabled neon_asm |
| 889 then |
| 890 check_add_cflags --fpu=softvfp+vfpv3 |
| 891 check_add_asflags --fpu=softvfp+vfpv3 |
| 892 fi |
| 893 check_add_cflags --cpu=Cortex-A8 |
| 894 check_add_asflags --cpu=Cortex-A8 |
870 else | 895 else |
871 check_add_cflags -march=${tgt_isa} | 896 check_add_cflags --cpu=${tgt_isa##armv} |
872 check_add_asflags -march=${tgt_isa} | 897 check_add_asflags --cpu=${tgt_isa##armv} |
873 fi | 898 fi |
874 | 899 fi |
875 enabled debug && add_asflags -g | 900 arch_int=${tgt_isa##armv} |
876 asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" | 901 arch_int=${arch_int%%te} |
877 if enabled thumb; then | 902 check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" |
878 asm_conversion_cmd="$asm_conversion_cmd -thumb" | 903 enabled debug && add_asflags -g |
879 check_add_cflags -mthumb | 904 add_cflags --gnu |
880 check_add_asflags -mthumb -mimplicit-it=always | 905 add_cflags --enum_is_int |
881 fi | 906 add_cflags --wchar32 |
882 ;; | 907 ;; |
| 908 esac |
| 909 |
| 910 case ${tgt_os} in |
| 911 none*) |
| 912 disable_feature multithread |
| 913 disable_feature os_support |
| 914 ;; |
| 915 |
| 916 android*) |
| 917 SDK_PATH=${sdk_path} |
| 918 COMPILER_LOCATION=`find "${SDK_PATH}" \ |
| 919 -name "arm-linux-androideabi-gcc*" -print -quit` |
| 920 TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- |
| 921 CC=${TOOLCHAIN_PATH}gcc |
| 922 CXX=${TOOLCHAIN_PATH}g++ |
| 923 AR=${TOOLCHAIN_PATH}ar |
| 924 LD=${TOOLCHAIN_PATH}gcc |
| 925 AS=${TOOLCHAIN_PATH}as |
| 926 STRIP=${TOOLCHAIN_PATH}strip |
| 927 NM=${TOOLCHAIN_PATH}nm |
| 928 |
| 929 if [ -z "${alt_libc}" ]; then |
| 930 alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \ |
| 931 awk '{n = split($0,a,"/"); \ |
| 932 split(a[n-1],b,"-"); \ |
| 933 print $0 " " b[2]}' | \ |
| 934 sort -g -k 2 | \ |
| 935 awk '{ print $1 }' | tail -1` |
| 936 fi |
| 937 |
| 938 add_cflags "--sysroot=${alt_libc}" |
| 939 add_ldflags "--sysroot=${alt_libc}" |
| 940 |
| 941 # linker flag that routes around a CPU bug in some |
| 942 # Cortex-A8 implementations (NDK Dev Guide) |
| 943 add_ldflags "-Wl,--fix-cortex-a8" |
| 944 |
| 945 enable_feature pic |
| 946 soft_enable realtime_only |
| 947 if [ ${tgt_isa} = "armv7" ]; then |
| 948 soft_enable runtime_cpu_detect |
| 949 fi |
| 950 if enabled runtime_cpu_detect; then |
| 951 add_cflags "-I${SDK_PATH}/sources/android/cpufeatures" |
| 952 fi |
| 953 ;; |
| 954 |
| 955 darwin*) |
| 956 XCRUN_FIND="xcrun --sdk iphoneos -find" |
| 957 CXX="$(${XCRUN_FIND} clang++)" |
| 958 CC="$(${XCRUN_FIND} clang)" |
| 959 AR="$(${XCRUN_FIND} ar)" |
| 960 AS="$(${XCRUN_FIND} as)" |
| 961 STRIP="$(${XCRUN_FIND} strip)" |
| 962 NM="$(${XCRUN_FIND} nm)" |
| 963 RANLIB="$(${XCRUN_FIND} ranlib)" |
| 964 AS_SFX=.s |
| 965 |
| 966 # Special handling of ld for armv6 because libclang_rt.ios.a does |
| 967 # not contain armv6 support in Apple's clang package: |
| 968 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn). |
| 969 # TODO(tomfinegan): Remove this. Our minimum iOS version (6.0) |
| 970 # renders support for armv6 unnecessary because the 3GS and up |
| 971 # support neon. |
| 972 if [ "${tgt_isa}" = "armv6" ]; then |
| 973 LD="$(${XCRUN_FIND} ld)" |
| 974 else |
| 975 LD="${CXX:-$(${XCRUN_FIND} ld)}" |
| 976 fi |
| 977 |
| 978 # ASFLAGS is written here instead of using check_add_asflags |
| 979 # because we need to overwrite all of ASFLAGS and purge the |
| 980 # options that were put in above |
| 981 ASFLAGS="-arch ${tgt_isa} -g" |
| 982 |
| 983 alt_libc="$(xcrun --sdk iphoneos --show-sdk-path)" |
| 984 add_cflags -arch ${tgt_isa} -isysroot ${alt_libc} |
| 985 add_ldflags -arch ${tgt_isa} |
| 986 |
| 987 if [ "${LD}" = "${CXX}" ]; then |
| 988 add_ldflags -miphoneos-version-min="${IOS_VERSION_MIN}" |
| 989 else |
| 990 add_ldflags -ios_version_min "${IOS_VERSION_MIN}" |
| 991 fi |
| 992 |
| 993 for d in lib usr/lib usr/lib/system; do |
| 994 try_dir="${alt_libc}/${d}" |
| 995 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" |
| 996 done |
| 997 |
| 998 asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" |
| 999 ;; |
| 1000 |
| 1001 linux*) |
| 1002 enable_feature linux |
| 1003 if enabled rvct; then |
| 1004 # Check if we have CodeSourcery GCC in PATH. Needed for |
| 1005 # libraries |
| 1006 hash arm-none-linux-gnueabi-gcc 2>&- || \ |
| 1007 die "Couldn't find CodeSourcery GCC from PATH" |
| 1008 |
| 1009 # Use armcc as a linker to enable translation of |
| 1010 # some gcc specific options such as -lm and -lpthread. |
| 1011 LD="armcc --translate_gcc" |
| 1012 |
| 1013 # create configuration file (uses path to CodeSourcery GCC) |
| 1014 armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg |
| 1015 |
| 1016 add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg |
| 1017 add_asflags --no_hide_all --apcs=/interwork |
| 1018 add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg |
| 1019 enabled pic && add_cflags --apcs=/fpic |
| 1020 enabled pic && add_asflags --apcs=/fpic |
| 1021 enabled shared && add_cflags --shared |
| 1022 fi |
| 1023 ;; |
| 1024 esac |
| 1025 ;; |
| 1026 mips*) |
| 1027 link_with_cc=gcc |
| 1028 setup_gnu_toolchain |
| 1029 tune_cflags="-mtune=" |
| 1030 if enabled dspr2; then |
| 1031 check_add_cflags -mips32r2 -mdspr2 |
| 1032 disable_feature fast_unaligned |
| 1033 fi |
| 1034 check_add_cflags -march=${tgt_isa} |
| 1035 check_add_asflags -march=${tgt_isa} |
| 1036 check_add_asflags -KPIC |
| 1037 ;; |
| 1038 ppc*) |
| 1039 enable_feature ppc |
| 1040 bits=${tgt_isa##ppc} |
| 1041 link_with_cc=gcc |
| 1042 setup_gnu_toolchain |
| 1043 add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin" |
| 1044 soft_enable altivec |
| 1045 enabled altivec && add_cflags -maltivec |
| 1046 |
| 1047 case "$tgt_os" in |
| 1048 linux*) |
| 1049 add_asflags -maltivec -mregnames -I"\$(dir \$<)linux" |
| 1050 ;; |
| 1051 darwin*) |
| 1052 darwin_arch="-arch ppc" |
| 1053 enabled ppc64 && darwin_arch="${darwin_arch}64" |
| 1054 add_cflags ${darwin_arch} -m${bits} -fasm-blocks |
| 1055 add_asflags ${darwin_arch} -force_cpusubtype_ALL -I"\$(dir \$<)darwin" |
| 1056 add_ldflags ${darwin_arch} -m${bits} |
| 1057 enabled altivec && add_cflags -faltivec |
| 1058 ;; |
| 1059 esac |
| 1060 ;; |
| 1061 x86*) |
| 1062 case ${tgt_os} in |
| 1063 win*) |
| 1064 enabled gcc && add_cflags -fno-common |
| 1065 ;; |
| 1066 solaris*) |
| 1067 CC=${CC:-${CROSS}gcc} |
| 1068 CXX=${CXX:-${CROSS}g++} |
| 1069 LD=${LD:-${CROSS}gcc} |
| 1070 CROSS=${CROSS:-g} |
| 1071 ;; |
| 1072 os2) |
| 1073 AS=${AS:-nasm} |
| 1074 ;; |
| 1075 esac |
| 1076 |
| 1077 AS="${alt_as:-${AS:-auto}}" |
| 1078 case ${tgt_cc} in |
| 1079 icc*) |
| 1080 CC=${CC:-icc} |
| 1081 LD=${LD:-icc} |
| 1082 setup_gnu_toolchain |
| 1083 add_cflags -use-msasm # remove -use-msasm too? |
| 1084 # add -no-intel-extensions to suppress warning #10237 |
| 1085 # refer to http://software.intel.com/en-us/forums/topic/280199 |
| 1086 add_ldflags -i-static -no-intel-extensions |
| 1087 enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div |
| 1088 enabled x86_64 && AR=xiar |
| 1089 case ${tune_cpu} in |
| 1090 atom*) |
| 1091 tune_cflags="-x" |
| 1092 tune_cpu="SSE3_ATOM" |
| 1093 ;; |
| 1094 *) |
| 1095 tune_cflags="-march=" |
| 1096 ;; |
| 1097 esac |
| 1098 ;; |
| 1099 gcc*) |
| 1100 link_with_cc=gcc |
| 1101 tune_cflags="-march=" |
| 1102 setup_gnu_toolchain |
| 1103 #for 32 bit x86 builds, -O3 did not turn on this flag |
| 1104 enabled optimizations && disabled gprof && check_add_cflags -fomit-fra
me-pointer |
| 1105 ;; |
883 vs*) | 1106 vs*) |
884 asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" | 1107 # When building with Microsoft Visual Studio the assembler is |
885 AS_SFX=.s | 1108 # invoked directly. Checking at configure time is unnecessary. |
886 msvs_arch_dir=arm-msvs | 1109 # Skip the check by setting AS arbitrarily |
887 disable_feature multithread | 1110 AS=msvs |
888 disable_feature unit_tests | 1111 msvs_arch_dir=x86-msvs |
889 vs_version=${tgt_cc##vs} | 1112 vc_version=${tgt_cc##vs} |
890 if [ $vs_version -ge 12 ]; then | 1113 case $vc_version in |
891 # MSVC 2013 doesn't allow doing plain .exe projects for ARM, | 1114 7|8|9|10) |
892 # only "AppContainerApplication" which requires an AppxManifest. | 1115 echo "${tgt_cc} does not support avx/avx2, disabling....." |
893 # Therefore disable the examples, just build the library. | 1116 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-avx2 " |
894 disable_feature examples | 1117 soft_disable avx |
895 fi | 1118 soft_disable avx2 |
896 ;; | 1119 ;; |
897 rvct) | 1120 esac |
898 CC=armcc | 1121 ;; |
899 AR=armar | 1122 esac |
900 AS=armasm | 1123 |
901 LD="${source_path}/build/make/armlink_adapter.sh" | 1124 bits=32 |
902 STRIP=arm-none-linux-gnueabi-strip | 1125 enabled x86_64 && bits=64 |
903 NM=arm-none-linux-gnueabi-nm | 1126 check_cpp <<EOF && bits=x32 |
904 tune_cflags="--cpu=" | |
905 tune_asflags="--cpu=" | |
906 if [ -z "${tune_cpu}" ]; then | |
907 if [ ${tgt_isa} = "armv7" ]; then | |
908 if enabled neon || enabled neon_asm | |
909 then | |
910 check_add_cflags --fpu=softvfp+vfpv3 | |
911 check_add_asflags --fpu=softvfp+vfpv3 | |
912 fi | |
913 check_add_cflags --cpu=Cortex-A8 | |
914 check_add_asflags --cpu=Cortex-A8 | |
915 else | |
916 check_add_cflags --cpu=${tgt_isa##armv} | |
917 check_add_asflags --cpu=${tgt_isa##armv} | |
918 fi | |
919 fi | |
920 arch_int=${tgt_isa##armv} | |
921 arch_int=${arch_int%%te} | |
922 check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" | |
923 enabled debug && add_asflags -g | |
924 add_cflags --gnu | |
925 add_cflags --enum_is_int | |
926 add_cflags --wchar32 | |
927 ;; | |
928 esac | |
929 | |
930 case ${tgt_os} in | |
931 none*) | |
932 disable_feature multithread | |
933 disable_feature os_support | |
934 ;; | |
935 | |
936 android*) | |
937 SDK_PATH=${sdk_path} | |
938 COMPILER_LOCATION=`find "${SDK_PATH}" \ | |
939 -name "arm-linux-androideabi-gcc*" -print -quit` | |
940 TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- | |
941 CC=${TOOLCHAIN_PATH}gcc | |
942 CXX=${TOOLCHAIN_PATH}g++ | |
943 AR=${TOOLCHAIN_PATH}ar | |
944 LD=${TOOLCHAIN_PATH}gcc | |
945 AS=${TOOLCHAIN_PATH}as | |
946 STRIP=${TOOLCHAIN_PATH}strip | |
947 NM=${TOOLCHAIN_PATH}nm | |
948 | |
949 if [ -z "${alt_libc}" ]; then | |
950 alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \ | |
951 awk '{n = split($0,a,"/"); \ | |
952 split(a[n-1],b,"-"); \ | |
953 print $0 " " b[2]}' | \ | |
954 sort -g -k 2 | \ | |
955 awk '{ print $1 }' | tail -1` | |
956 fi | |
957 | |
958 add_cflags "--sysroot=${alt_libc}" | |
959 add_ldflags "--sysroot=${alt_libc}" | |
960 | |
961 # linker flag that routes around a CPU bug in some | |
962 # Cortex-A8 implementations (NDK Dev Guide) | |
963 add_ldflags "-Wl,--fix-cortex-a8" | |
964 | |
965 enable_feature pic | |
966 soft_enable realtime_only | |
967 if [ ${tgt_isa} = "armv7" ]; then | |
968 soft_enable runtime_cpu_detect | |
969 fi | |
970 if enabled runtime_cpu_detect; then | |
971 add_cflags "-I${SDK_PATH}/sources/android/cpufeatures" | |
972 fi | |
973 ;; | |
974 | |
975 darwin*) | |
976 XCRUN_FIND="xcrun --sdk iphoneos -find" | |
977 CXX="$(${XCRUN_FIND} clang++)" | |
978 CC="$(${XCRUN_FIND} clang)" | |
979 AR="$(${XCRUN_FIND} ar)" | |
980 AS="$(${XCRUN_FIND} as)" | |
981 STRIP="$(${XCRUN_FIND} strip)" | |
982 NM="$(${XCRUN_FIND} nm)" | |
983 RANLIB="$(${XCRUN_FIND} ranlib)" | |
984 AS_SFX=.s | |
985 | |
986 # Special handling of ld for armv6 because libclang_rt.ios.a does | |
987 # not contain armv6 support in Apple's clang package: | |
988 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn). | |
989 # TODO(tomfinegan): Remove this. Our minimum iOS version (6.0) | |
990 # renders support for armv6 unnecessary because the 3GS and up | |
991 # support neon. | |
992 if [ "${tgt_isa}" = "armv6" ]; then | |
993 LD="$(${XCRUN_FIND} ld)" | |
994 else | |
995 LD="${CXX:-$(${XCRUN_FIND} ld)}" | |
996 fi | |
997 | |
998 # ASFLAGS is written here instead of using check_add_asflags | |
999 # because we need to overwrite all of ASFLAGS and purge the | |
1000 # options that were put in above | |
1001 ASFLAGS="-arch ${tgt_isa} -g" | |
1002 | |
1003 alt_libc="$(xcrun --sdk iphoneos --show-sdk-path)" | |
1004 add_cflags -arch ${tgt_isa} -isysroot ${alt_libc} | |
1005 add_ldflags -arch ${tgt_isa} | |
1006 | |
1007 if [ "${LD}" = "${CXX}" ]; then | |
1008 add_ldflags -miphoneos-version-min="${IOS_VERSION_MIN}" | |
1009 else | |
1010 add_ldflags -ios_version_min "${IOS_VERSION_MIN}" | |
1011 fi | |
1012 | |
1013 for d in lib usr/lib usr/lib/system; do | |
1014 try_dir="${alt_libc}/${d}" | |
1015 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" | |
1016 done | |
1017 | |
1018 asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" | |
1019 ;; | |
1020 | |
1021 linux*) | |
1022 enable_feature linux | |
1023 if enabled rvct; then | |
1024 # Check if we have CodeSourcery GCC in PATH. Needed for | |
1025 # libraries | |
1026 hash arm-none-linux-gnueabi-gcc 2>&- || \ | |
1027 die "Couldn't find CodeSourcery GCC from PATH" | |
1028 | |
1029 # Use armcc as a linker to enable translation of | |
1030 # some gcc specific options such as -lm and -lpthread. | |
1031 LD="armcc --translate_gcc" | |
1032 | |
1033 # create configuration file (uses path to CodeSourcery GCC) | |
1034 armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cf
g | |
1035 | |
1036 add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.c
fg | |
1037 add_asflags --no_hide_all --apcs=/interwork | |
1038 add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.
cfg | |
1039 enabled pic && add_cflags --apcs=/fpic | |
1040 enabled pic && add_asflags --apcs=/fpic | |
1041 enabled shared && add_cflags --shared | |
1042 fi | |
1043 ;; | |
1044 | |
1045 esac | |
1046 ;; | |
1047 mips*) | |
1048 link_with_cc=gcc | |
1049 setup_gnu_toolchain | |
1050 tune_cflags="-mtune=" | |
1051 if enabled dspr2; then | |
1052 check_add_cflags -mips32r2 -mdspr2 | |
1053 disable_feature fast_unaligned | |
1054 fi | |
1055 check_add_cflags -march=${tgt_isa} | |
1056 check_add_asflags -march=${tgt_isa} | |
1057 check_add_asflags -KPIC | |
1058 ;; | |
1059 ppc*) | |
1060 enable_feature ppc | |
1061 bits=${tgt_isa##ppc} | |
1062 link_with_cc=gcc | |
1063 setup_gnu_toolchain | |
1064 add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin" | |
1065 soft_enable altivec | |
1066 enabled altivec && add_cflags -maltivec | |
1067 | |
1068 case "$tgt_os" in | |
1069 linux*) | |
1070 add_asflags -maltivec -mregnames -I"\$(dir \$<)linux" | |
1071 ;; | |
1072 darwin*) | |
1073 darwin_arch="-arch ppc" | |
1074 enabled ppc64 && darwin_arch="${darwin_arch}64" | |
1075 add_cflags ${darwin_arch} -m${bits} -fasm-blocks | |
1076 add_asflags ${darwin_arch} -force_cpusubtype_ALL -I"\$(dir \$<)darwi
n" | |
1077 add_ldflags ${darwin_arch} -m${bits} | |
1078 enabled altivec && add_cflags -faltivec | |
1079 ;; | |
1080 esac | |
1081 ;; | |
1082 x86*) | |
1083 case ${tgt_os} in | |
1084 win*) | |
1085 enabled gcc && add_cflags -fno-common | |
1086 ;; | |
1087 solaris*) | |
1088 CC=${CC:-${CROSS}gcc} | |
1089 CXX=${CXX:-${CROSS}g++} | |
1090 LD=${LD:-${CROSS}gcc} | |
1091 CROSS=${CROSS:-g} | |
1092 ;; | |
1093 os2) | |
1094 AS=${AS:-nasm} | |
1095 ;; | |
1096 esac | |
1097 | |
1098 AS="${alt_as:-${AS:-auto}}" | |
1099 case ${tgt_cc} in | |
1100 icc*) | |
1101 CC=${CC:-icc} | |
1102 LD=${LD:-icc} | |
1103 setup_gnu_toolchain | |
1104 add_cflags -use-msasm # remove -use-msasm too? | |
1105 # add -no-intel-extensions to suppress warning #10237 | |
1106 # refer to http://software.intel.com/en-us/forums/topic/280199 | |
1107 add_ldflags -i-static -no-intel-extensions | |
1108 enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div | |
1109 enabled x86_64 && AR=xiar | |
1110 case ${tune_cpu} in | |
1111 atom*) | |
1112 tune_cflags="-x" | |
1113 tune_cpu="SSE3_ATOM" | |
1114 ;; | |
1115 *) | |
1116 tune_cflags="-march=" | |
1117 ;; | |
1118 esac | |
1119 ;; | |
1120 gcc*) | |
1121 link_with_cc=gcc | |
1122 tune_cflags="-march=" | |
1123 setup_gnu_toolchain | |
1124 #for 32 bit x86 builds, -O3 did not turn on this flag | |
1125 enabled optimizations && disabled gprof && check_add_cflags -fom
it-frame-pointer | |
1126 ;; | |
1127 vs*) | |
1128 # When building with Microsoft Visual Studio the assembler is | |
1129 # invoked directly. Checking at configure time is unnecessary. | |
1130 # Skip the check by setting AS arbitrarily | |
1131 AS=msvs | |
1132 msvs_arch_dir=x86-msvs | |
1133 vc_version=${tgt_cc##vs} | |
1134 case $vc_version in | |
1135 7|8|9|10) | |
1136 echo "${tgt_cc} does not support avx/avx2, disabling...
.." | |
1137 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-av
x2 " | |
1138 soft_disable avx | |
1139 soft_disable avx2 | |
1140 ;; | |
1141 esac | |
1142 ;; | |
1143 esac | |
1144 | |
1145 bits=32 | |
1146 enabled x86_64 && bits=64 | |
1147 check_cpp <<EOF && bits=x32 | |
1148 #ifndef __ILP32__ | 1127 #ifndef __ILP32__ |
1149 #error "not x32" | 1128 #error "not x32" |
1150 #endif | 1129 #endif |
1151 EOF | 1130 EOF |
1152 case ${tgt_cc} in | 1131 case ${tgt_cc} in |
1153 gcc*) | 1132 gcc*) |
1154 add_cflags -m${bits} | 1133 add_cflags -m${bits} |
1155 add_ldflags -m${bits} | 1134 add_ldflags -m${bits} |
1156 ;; | 1135 ;; |
1157 esac | 1136 esac |
1158 | 1137 |
1159 soft_enable runtime_cpu_detect | 1138 soft_enable runtime_cpu_detect |
1160 # We can't use 'check_cflags' until the compiler is configured and CC is | 1139 # We can't use 'check_cflags' until the compiler is configured and CC is |
1161 # populated. | 1140 # populated. |
1162 check_gcc_machine_option mmx | 1141 check_gcc_machine_option mmx |
1163 check_gcc_machine_option sse | 1142 check_gcc_machine_option sse |
1164 check_gcc_machine_option sse2 | 1143 check_gcc_machine_option sse2 |
1165 check_gcc_machine_option sse3 | 1144 check_gcc_machine_option sse3 |
1166 check_gcc_machine_option ssse3 | 1145 check_gcc_machine_option ssse3 |
1167 check_gcc_machine_option sse4 sse4_1 | 1146 check_gcc_machine_option sse4 sse4_1 |
1168 check_gcc_machine_option avx | 1147 check_gcc_machine_option avx |
1169 check_gcc_machine_option avx2 | 1148 check_gcc_machine_option avx2 |
1170 | 1149 |
1171 case "${AS}" in | 1150 case "${AS}" in |
1172 auto|"") | 1151 auto|"") |
1173 which nasm >/dev/null 2>&1 && AS=nasm | 1152 which nasm >/dev/null 2>&1 && AS=nasm |
1174 which yasm >/dev/null 2>&1 && AS=yasm | 1153 which yasm >/dev/null 2>&1 && AS=yasm |
1175 [ "${AS}" = auto ] || [ -z "${AS}" ] \ | 1154 [ "${AS}" = auto ] || [ -z "${AS}" ] \ |
1176 && die "Neither yasm nor nasm have been found" | 1155 && die "Neither yasm nor nasm have been found" |
1177 ;; | 1156 ;; |
1178 esac | 1157 esac |
1179 log_echo " using $AS" | 1158 log_echo " using $AS" |
1180 [ "${AS##*/}" = nasm ] && add_asflags -Ox | 1159 [ "${AS##*/}" = nasm ] && add_asflags -Ox |
1181 AS_SFX=.asm | 1160 AS_SFX=.asm |
1182 case ${tgt_os} in | 1161 case ${tgt_os} in |
1183 win32) | 1162 win32) |
1184 add_asflags -f win32 | 1163 add_asflags -f win32 |
1185 enabled debug && add_asflags -g cv8 | 1164 enabled debug && add_asflags -g cv8 |
1186 EXE_SFX=.exe | 1165 EXE_SFX=.exe |
1187 ;; | 1166 ;; |
1188 win64) | 1167 win64) |
1189 add_asflags -f x64 | 1168 add_asflags -f x64 |
1190 enabled debug && add_asflags -g cv8 | 1169 enabled debug && add_asflags -g cv8 |
1191 EXE_SFX=.exe | 1170 EXE_SFX=.exe |
1192 ;; | 1171 ;; |
1193 linux*|solaris*|android*) | 1172 linux*|solaris*|android*) |
1194 add_asflags -f elf${bits} | 1173 add_asflags -f elf${bits} |
1195 enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 | 1174 enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 |
1196 enabled debug && [ "${AS}" = nasm ] && add_asflags -g | 1175 enabled debug && [ "${AS}" = nasm ] && add_asflags -g |
1197 [ "${AS##*/}" = nasm ] && check_asm_align | 1176 [ "${AS##*/}" = nasm ] && check_asm_align |
1198 ;; | 1177 ;; |
1199 darwin*) | 1178 darwin*) |
1200 add_asflags -f macho${bits} | 1179 add_asflags -f macho${bits} |
1201 enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x8
6_64" | 1180 enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64" |
1202 add_cflags ${darwin_arch} | 1181 add_cflags ${darwin_arch} |
1203 add_ldflags ${darwin_arch} | 1182 add_ldflags ${darwin_arch} |
1204 # -mdynamic-no-pic is still a bit of voodoo -- it was required a
t | 1183 # -mdynamic-no-pic is still a bit of voodoo -- it was required at |
1205 # one time, but does not seem to be now, and it breaks some of t
he | 1184 # one time, but does not seem to be now, and it breaks some of the |
1206 # code that still relies on inline assembly. | 1185 # code that still relies on inline assembly. |
1207 # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-
no-pic | 1186 # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic |
1208 enabled icc && ! enabled pic && add_cflags -fno-pic | 1187 enabled icc && ! enabled pic && add_cflags -fno-pic |
1209 ;; | 1188 ;; |
1210 iphonesimulator) | 1189 iphonesimulator) |
1211 add_asflags -f macho${bits} | 1190 add_asflags -f macho${bits} |
1212 enabled x86 && sim_arch="-arch i386" || sim_arch="-arch x86_64" | 1191 enabled x86 && sim_arch="-arch i386" || sim_arch="-arch x86_64" |
1213 add_cflags ${sim_arch} | 1192 add_cflags ${sim_arch} |
1214 add_ldflags ${sim_arch} | 1193 add_ldflags ${sim_arch} |
1215 ;; | 1194 ;; |
1216 os2) | 1195 os2) |
1217 add_asflags -f aout | 1196 add_asflags -f aout |
1218 enabled debug && add_asflags -g | 1197 enabled debug && add_asflags -g |
1219 EXE_SFX=.exe | 1198 EXE_SFX=.exe |
1220 ;; | 1199 ;; |
1221 *) log "Warning: Unknown os $tgt_os while setting up $AS flags" | 1200 *) |
1222 ;; | 1201 log "Warning: Unknown os $tgt_os while setting up $AS flags" |
1223 esac | 1202 ;; |
1224 ;; | 1203 esac |
| 1204 ;; |
1225 universal*|*-gcc|generic-gnu) | 1205 universal*|*-gcc|generic-gnu) |
1226 link_with_cc=gcc | 1206 link_with_cc=gcc |
1227 enable_feature gcc | 1207 enable_feature gcc |
1228 setup_gnu_toolchain | 1208 setup_gnu_toolchain |
1229 ;; | 1209 ;; |
1230 esac | 1210 esac |
1231 | 1211 |
1232 # Try to enable CPU specific tuning | 1212 # Try to enable CPU specific tuning |
1233 if [ -n "${tune_cpu}" ]; then | 1213 if [ -n "${tune_cpu}" ]; then |
1234 if [ -n "${tune_cflags}" ]; then | 1214 if [ -n "${tune_cflags}" ]; then |
1235 check_add_cflags ${tune_cflags}${tune_cpu} || \ | 1215 check_add_cflags ${tune_cflags}${tune_cpu} || \ |
1236 die "Requested CPU '${tune_cpu}' not supported by compiler" | 1216 die "Requested CPU '${tune_cpu}' not supported by compiler" |
1237 fi | 1217 fi |
1238 if [ -n "${tune_asflags}" ]; then | 1218 if [ -n "${tune_asflags}" ]; then |
1239 check_add_asflags ${tune_asflags}${tune_cpu} || \ | 1219 check_add_asflags ${tune_asflags}${tune_cpu} || \ |
1240 die "Requested CPU '${tune_cpu}' not supported by assembler" | 1220 die "Requested CPU '${tune_cpu}' not supported by assembler" |
1241 fi | 1221 fi |
1242 if [ -z "${tune_cflags}${tune_asflags}" ]; then | 1222 if [ -z "${tune_cflags}${tune_asflags}" ]; then |
1243 log_echo "Warning: CPU tuning not supported by this toolchain" | 1223 log_echo "Warning: CPU tuning not supported by this toolchain" |
1244 fi | |
1245 fi | 1224 fi |
1246 | 1225 fi |
1247 if enabled debug; then | 1226 |
1248 check_add_cflags -g && check_add_ldflags -g | 1227 if enabled debug; then |
| 1228 check_add_cflags -g && check_add_ldflags -g |
| 1229 else |
| 1230 check_add_cflags -DNDEBUG |
| 1231 fi |
| 1232 |
| 1233 enabled gprof && check_add_cflags -pg && check_add_ldflags -pg |
| 1234 enabled gcov && |
| 1235 check_add_cflags -fprofile-arcs -ftest-coverage && |
| 1236 check_add_ldflags -fprofile-arcs -ftest-coverage |
| 1237 |
| 1238 if enabled optimizations; then |
| 1239 if enabled rvct; then |
| 1240 enabled small && check_add_cflags -Ospace || check_add_cflags -Otime |
1249 else | 1241 else |
1250 check_add_cflags -DNDEBUG | 1242 enabled small && check_add_cflags -O2 || check_add_cflags -O3 |
1251 fi | 1243 fi |
1252 | 1244 fi |
1253 enabled gprof && check_add_cflags -pg && check_add_ldflags -pg | 1245 |
1254 enabled gcov && | 1246 tgt_os_no_version=$(echo "${tgt_os}" | tr -d "[0-9]") |
1255 check_add_cflags -fprofile-arcs -ftest-coverage && | 1247 # Default use_x86inc to yes when we are 64 bit, non-pic, or on any |
1256 check_add_ldflags -fprofile-arcs -ftest-coverage | 1248 # non-Darwin target. |
1257 | 1249 if [ "${tgt_isa}" = "x86_64" ] || [ "${pic}" != "yes" ] || \ |
1258 if enabled optimizations; then | 1250 [ "${tgt_os_no_version}" != "darwin" ]; then |
1259 if enabled rvct; then | 1251 soft_enable use_x86inc |
1260 enabled small && check_add_cflags -Ospace || check_add_cflags -Otime | 1252 fi |
1261 else | 1253 |
1262 enabled small && check_add_cflags -O2 || check_add_cflags -O3 | 1254 # Position Independent Code (PIC) support, for building relocatable |
1263 fi | 1255 # shared objects |
1264 fi | 1256 enabled gcc && enabled pic && check_add_cflags -fPIC |
1265 | 1257 |
1266 tgt_os_no_version=$(echo "${tgt_os}" | tr -d "[0-9]") | 1258 # Work around longjmp interception on glibc >= 2.11, to improve binary |
1267 # Default use_x86inc to yes when we are 64 bit, non-pic, or on any | 1259 # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 |
1268 # non-Darwin target. | 1260 enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
1269 if [ "${tgt_isa}" = "x86_64" ] || [ "${pic}" != "yes" ] || \ | 1261 |
1270 [ "${tgt_os_no_version}" != "darwin" ]; then | 1262 # Check for strip utility variant |
1271 soft_enable use_x86inc | 1263 ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip |
1272 fi | 1264 |
1273 | 1265 # Try to determine target endianness |
1274 # Position Independent Code (PIC) support, for building relocatable | 1266 check_cc <<EOF |
1275 # shared objects | 1267 unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; |
1276 enabled gcc && enabled pic && check_add_cflags -fPIC | |
1277 | |
1278 # Work around longjmp interception on glibc >= 2.11, to improve binary | |
1279 # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 | |
1280 enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 | |
1281 | |
1282 # Check for strip utility variant | |
1283 ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip | |
1284 | |
1285 # Try to determine target endianness | |
1286 check_cc <<EOF | |
1287 unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; | |
1288 EOF | 1268 EOF |
1289 [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | | 1269 [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | |
1290 grep '4f *32 *42 *45' >/dev/null 2>&1 && enable_feature big_endian | 1270 grep '4f *32 *42 *45' >/dev/null 2>&1 && enable_feature big_endian |
1291 | 1271 |
1292 # Try to find which inline keywords are supported | 1272 # Try to find which inline keywords are supported |
1293 check_cc <<EOF && INLINE="inline" | 1273 check_cc <<EOF && INLINE="inline" |
1294 static inline function() {} | 1274 static inline function() {} |
1295 EOF | 1275 EOF |
1296 check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))" | 1276 check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))" |
1297 static __attribute__((always_inline)) function() {} | 1277 static __attribute__((always_inline)) function() {} |
1298 EOF | 1278 EOF |
1299 | 1279 |
1300 # Almost every platform uses pthreads. | 1280 # Almost every platform uses pthreads. |
1301 if enabled multithread; then | 1281 if enabled multithread; then |
1302 case ${toolchain} in | |
1303 *-win*-vs*);; | |
1304 *-android-gcc);; | |
1305 *) check_header pthread.h && add_extralibs -lpthread | |
1306 esac | |
1307 fi | |
1308 | |
1309 # only for MIPS platforms | |
1310 case ${toolchain} in | 1282 case ${toolchain} in |
1311 mips*) | 1283 *-win*-vs*) |
1312 if enabled dspr2; then | 1284 ;; |
1313 if enabled big_endian; then | 1285 *-android-gcc) |
1314 echo "dspr2 optimizations are available only for little endi
an platforms" | 1286 ;; |
1315 disable_feature dspr2 | 1287 *) |
1316 fi | 1288 check_header pthread.h && add_extralibs -lpthread |
1317 fi | |
1318 ;; | 1289 ;; |
1319 esac | 1290 esac |
| 1291 fi |
1320 | 1292 |
1321 # glibc needs these | 1293 # only for MIPS platforms |
1322 if enabled linux; then | 1294 case ${toolchain} in |
1323 add_cflags -D_LARGEFILE_SOURCE | 1295 mips*) |
1324 add_cflags -D_FILE_OFFSET_BITS=64 | 1296 if enabled dspr2; then |
1325 fi | 1297 if enabled big_endian; then |
| 1298 echo "dspr2 optimizations are available only for little endian platfor
ms" |
| 1299 disable_feature dspr2 |
| 1300 fi |
| 1301 fi |
| 1302 ;; |
| 1303 esac |
1326 | 1304 |
1327 # append any user defined extra cflags | 1305 # glibc needs these |
1328 if [ -n "${extra_cflags}" ] ; then | 1306 if enabled linux; then |
1329 check_add_cflags ${extra_cflags} || \ | 1307 add_cflags -D_LARGEFILE_SOURCE |
1330 die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" | 1308 add_cflags -D_FILE_OFFSET_BITS=64 |
1331 fi | 1309 fi |
| 1310 |
| 1311 # append any user defined extra cflags |
| 1312 if [ -n "${extra_cflags}" ] ; then |
| 1313 check_add_cflags ${extra_cflags} || \ |
| 1314 die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" |
| 1315 fi |
1332 } | 1316 } |
1333 | 1317 |
1334 process_toolchain() { | 1318 process_toolchain() { |
1335 process_common_toolchain | 1319 process_common_toolchain |
1336 } | 1320 } |
1337 | 1321 |
1338 print_config_mk() { | 1322 print_config_mk() { |
1339 saved_prefix="${prefix}" | 1323 saved_prefix="${prefix}" |
1340 prefix=$1 | 1324 prefix=$1 |
1341 makefile=$2 | 1325 makefile=$2 |
1342 shift 2 | 1326 shift 2 |
1343 for cfg; do | 1327 for cfg; do |
1344 if enabled $cfg; then | 1328 if enabled $cfg; then |
1345 upname="`toupper $cfg`" | 1329 upname="`toupper $cfg`" |
1346 echo "${prefix}_${upname}=yes" >> $makefile | 1330 echo "${prefix}_${upname}=yes" >> $makefile |
1347 fi | 1331 fi |
1348 done | 1332 done |
1349 prefix="${saved_prefix}" | 1333 prefix="${saved_prefix}" |
1350 } | 1334 } |
1351 | 1335 |
1352 print_config_h() { | 1336 print_config_h() { |
1353 saved_prefix="${prefix}" | 1337 saved_prefix="${prefix}" |
1354 prefix=$1 | 1338 prefix=$1 |
1355 header=$2 | 1339 header=$2 |
1356 shift 2 | 1340 shift 2 |
1357 for cfg; do | 1341 for cfg; do |
1358 upname="`toupper $cfg`" | 1342 upname="`toupper $cfg`" |
1359 if enabled $cfg; then | 1343 if enabled $cfg; then |
1360 echo "#define ${prefix}_${upname} 1" >> $header | 1344 echo "#define ${prefix}_${upname} 1" >> $header |
1361 else | 1345 else |
1362 echo "#define ${prefix}_${upname} 0" >> $header | 1346 echo "#define ${prefix}_${upname} 0" >> $header |
1363 fi | 1347 fi |
1364 done | 1348 done |
1365 prefix="${saved_prefix}" | 1349 prefix="${saved_prefix}" |
1366 } | 1350 } |
1367 | 1351 |
1368 print_config_vars_h() { | 1352 print_config_vars_h() { |
1369 header=$1 | 1353 header=$1 |
1370 shift | 1354 shift |
1371 while [ $# -gt 0 ]; do | 1355 while [ $# -gt 0 ]; do |
1372 upname="`toupper $1`" | 1356 upname="`toupper $1`" |
1373 echo "#define ${upname} $2" >> $header | 1357 echo "#define ${upname} $2" >> $header |
1374 shift 2 | 1358 shift 2 |
1375 done | 1359 done |
1376 } | 1360 } |
1377 | 1361 |
1378 print_webm_license() { | 1362 print_webm_license() { |
1379 saved_prefix="${prefix}" | 1363 saved_prefix="${prefix}" |
1380 destination=$1 | 1364 destination=$1 |
1381 prefix="$2" | 1365 prefix="$2" |
1382 suffix="$3" | 1366 suffix="$3" |
1383 shift 3 | 1367 shift 3 |
1384 cat <<EOF > ${destination} | 1368 cat <<EOF > ${destination} |
1385 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} | 1369 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} |
1386 ${prefix} ${suffix} | 1370 ${prefix} ${suffix} |
1387 ${prefix} Use of this source code is governed by a BSD-style license${suffix} | 1371 ${prefix} Use of this source code is governed by a BSD-style license${suffix} |
1388 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} | 1372 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} |
1389 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} | 1373 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} |
1390 ${prefix} in the file PATENTS. All contributing project authors may${suffix} | 1374 ${prefix} in the file PATENTS. All contributing project authors may${suffix} |
1391 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} | 1375 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} |
1392 EOF | 1376 EOF |
1393 prefix="${saved_prefix}" | 1377 prefix="${saved_prefix}" |
1394 } | 1378 } |
1395 | 1379 |
1396 process_targets() { | 1380 process_targets() { |
1397 true; | 1381 true; |
1398 } | 1382 } |
1399 | 1383 |
1400 process_detect() { | 1384 process_detect() { |
1401 true; | 1385 true; |
1402 } | 1386 } |
1403 | 1387 |
1404 enable_feature logging | 1388 enable_feature logging |
1405 logfile="config.log" | 1389 logfile="config.log" |
1406 self=$0 | 1390 self=$0 |
1407 process() { | 1391 process() { |
1408 cmdline_args="$@" | 1392 cmdline_args="$@" |
1409 process_cmdline "$@" | 1393 process_cmdline "$@" |
1410 if enabled child; then | 1394 if enabled child; then |
1411 echo "# ${self} $@" >> ${logfile} | 1395 echo "# ${self} $@" >> ${logfile} |
1412 else | 1396 else |
1413 echo "# ${self} $@" > ${logfile} | 1397 echo "# ${self} $@" > ${logfile} |
1414 fi | 1398 fi |
1415 post_process_common_cmdline | 1399 post_process_common_cmdline |
1416 post_process_cmdline | 1400 post_process_cmdline |
1417 process_toolchain | 1401 process_toolchain |
1418 process_detect | 1402 process_detect |
1419 process_targets | 1403 process_targets |
1420 | 1404 |
1421 OOT_INSTALLS="${OOT_INSTALLS}" | 1405 OOT_INSTALLS="${OOT_INSTALLS}" |
1422 if enabled source_path_used; then | 1406 if enabled source_path_used; then |
1423 # Prepare the PWD for building. | 1407 # Prepare the PWD for building. |
1424 for f in ${OOT_INSTALLS}; do | 1408 for f in ${OOT_INSTALLS}; do |
1425 install -D "${source_path}/$f" "$f" | 1409 install -D "${source_path}/$f" "$f" |
1426 done | 1410 done |
1427 fi | 1411 fi |
1428 cp "${source_path}/build/make/Makefile" . | 1412 cp "${source_path}/build/make/Makefile" . |
1429 | 1413 |
1430 clean_temp_files | 1414 clean_temp_files |
1431 true | 1415 true |
1432 } | 1416 } |
OLD | NEW |