1 | #!/bin/bash |
---|
2 | ## |
---|
3 | ## configure.sh |
---|
4 | ## |
---|
5 | ## This script is sourced by the main configure script and contains |
---|
6 | ## utility functions and other common bits that aren't strictly libvpx |
---|
7 | ## related. |
---|
8 | ## |
---|
9 | ## This build system is based in part on the FFmpeg configure script. |
---|
10 | ## |
---|
11 | |
---|
12 | |
---|
13 | # |
---|
14 | # Logging / Output Functions |
---|
15 | # |
---|
16 | die_unknown(){ |
---|
17 | echo "Unknown option \"$1\"." |
---|
18 | echo "See $0 --help for available options." |
---|
19 | clean_temp_files |
---|
20 | exit 1 |
---|
21 | } |
---|
22 | |
---|
23 | |
---|
24 | die() { |
---|
25 | echo "$@" |
---|
26 | echo |
---|
27 | echo "Configuration failed. This could reflect a misconfiguration of your" |
---|
28 | 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" |
---|
30 | echo "at the configure error log file ($logfile) to determine what" |
---|
31 | echo "configure was trying to do when it died." |
---|
32 | clean_temp_files |
---|
33 | exit 1 |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | log(){ |
---|
38 | echo "$@" >>$logfile |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | log_file(){ |
---|
43 | log BEGIN $1 |
---|
44 | pr -n -t $1 >>$logfile |
---|
45 | log END $1 |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | log_echo() { |
---|
50 | echo "$@" |
---|
51 | log "$@" |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | fwrite () { |
---|
56 | outfile=$1 |
---|
57 | shift |
---|
58 | echo "$@" >> ${outfile} |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | show_help_pre(){ |
---|
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] |
---|
74 | Options: |
---|
75 | |
---|
76 | Build options: |
---|
77 | --help print this message |
---|
78 | --log=yes|no|FILE file configure log is written to [config.err] |
---|
79 | --target=TARGET target platform tuple [generic-gnu] |
---|
80 | --cpu=CPU optimize for a specific cpu rather than a family |
---|
81 | --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] |
---|
82 | ${toggle_extra_warnings} emit harmless warnings (always non-fatal) |
---|
83 | ${toggle_werror} treat warnings as errors, if possible |
---|
84 | (not available with all compilers) |
---|
85 | ${toggle_optimizations} turn on/off compiler optimization flags |
---|
86 | ${toggle_pic} turn on/off Position Independent Code |
---|
87 | ${toggle_ccache} turn on/off compiler cache |
---|
88 | ${toggle_debug} enable/disable debug mode |
---|
89 | ${toggle_gprof} enable/disable gprof profiling instrumentation |
---|
90 | ${toggle_gcov} enable/disable gcov coverage instrumentation |
---|
91 | |
---|
92 | Install options: |
---|
93 | ${toggle_install_docs} control whether docs are installed |
---|
94 | ${toggle_install_bins} control whether binaries are installed |
---|
95 | ${toggle_install_libs} control whether libraries are installed |
---|
96 | ${toggle_install_srcs} control whether sources are installed |
---|
97 | |
---|
98 | |
---|
99 | EOF |
---|
100 | } |
---|
101 | |
---|
102 | |
---|
103 | show_help_post(){ |
---|
104 | cat <<EOF |
---|
105 | |
---|
106 | |
---|
107 | NOTES: |
---|
108 | Object files are built at the place where configure is launched. |
---|
109 | |
---|
110 | All boolean options can be negated. The default value is the opposite |
---|
111 | of that shown above. If the option --disable-foo is listed, then |
---|
112 | the default value for foo is enabled. |
---|
113 | |
---|
114 | Supported targets: |
---|
115 | EOF |
---|
116 | show_targets ${all_platforms} |
---|
117 | echo |
---|
118 | exit 1 |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | show_targets() { |
---|
123 | while [ -n "$*" ]; do |
---|
124 | if [ "${1%%-*}" = "${2%%-*}" ]; then |
---|
125 | if [ "${2%%-*}" = "${3%%-*}" ]; then |
---|
126 | printf " %-24s %-24s %-24s\n" "$1" "$2" "$3" |
---|
127 | shift; shift; shift |
---|
128 | else |
---|
129 | printf " %-24s %-24s\n" "$1" "$2" |
---|
130 | shift; shift |
---|
131 | fi |
---|
132 | else |
---|
133 | printf " %-24s\n" "$1" |
---|
134 | shift |
---|
135 | fi |
---|
136 | done |
---|
137 | } |
---|
138 | |
---|
139 | |
---|
140 | show_help() { |
---|
141 | show_help_pre |
---|
142 | show_help_post |
---|
143 | } |
---|
144 | |
---|
145 | # |
---|
146 | # List Processing Functions |
---|
147 | # |
---|
148 | set_all(){ |
---|
149 | value=$1 |
---|
150 | shift |
---|
151 | for var in $*; do |
---|
152 | eval $var=$value |
---|
153 | done |
---|
154 | } |
---|
155 | |
---|
156 | |
---|
157 | is_in(){ |
---|
158 | value=$1 |
---|
159 | shift |
---|
160 | for var in $*; do |
---|
161 | [ $var = $value ] && return 0 |
---|
162 | done |
---|
163 | return 1 |
---|
164 | } |
---|
165 | |
---|
166 | |
---|
167 | add_cflags() { |
---|
168 | CFLAGS="${CFLAGS} $@" |
---|
169 | } |
---|
170 | |
---|
171 | |
---|
172 | add_ldflags() { |
---|
173 | LDFLAGS="${LDFLAGS} $@" |
---|
174 | } |
---|
175 | |
---|
176 | |
---|
177 | add_asflags() { |
---|
178 | ASFLAGS="${ASFLAGS} $@" |
---|
179 | } |
---|
180 | |
---|
181 | |
---|
182 | add_extralibs() { |
---|
183 | extralibs="${extralibs} $@" |
---|
184 | } |
---|
185 | |
---|
186 | # |
---|
187 | # Boolean Manipulation Functions |
---|
188 | # |
---|
189 | enable(){ |
---|
190 | set_all yes $* |
---|
191 | } |
---|
192 | |
---|
193 | disable(){ |
---|
194 | set_all no $* |
---|
195 | } |
---|
196 | |
---|
197 | enabled(){ |
---|
198 | eval test "x\$$1" = "xyes" |
---|
199 | } |
---|
200 | |
---|
201 | disabled(){ |
---|
202 | eval test "x\$$1" = "xno" |
---|
203 | } |
---|
204 | |
---|
205 | |
---|
206 | soft_enable() { |
---|
207 | for var in $*; do |
---|
208 | if ! disabled $var; then |
---|
209 | log_echo " enabling $var" |
---|
210 | enable $var |
---|
211 | fi |
---|
212 | done |
---|
213 | } |
---|
214 | |
---|
215 | soft_disable() { |
---|
216 | for var in $*; do |
---|
217 | if ! enabled $var; then |
---|
218 | log_echo " disabling $var" |
---|
219 | disable $var |
---|
220 | fi |
---|
221 | done |
---|
222 | } |
---|
223 | |
---|
224 | |
---|
225 | # |
---|
226 | # Text Processing Functions |
---|
227 | # |
---|
228 | toupper(){ |
---|
229 | echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
---|
230 | } |
---|
231 | |
---|
232 | |
---|
233 | tolower(){ |
---|
234 | echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz |
---|
235 | } |
---|
236 | |
---|
237 | |
---|
238 | # |
---|
239 | # Temporary File Functions |
---|
240 | # |
---|
241 | source_path=${0%/*} |
---|
242 | enable source_path_used |
---|
243 | if test -z "$source_path" -o "$source_path" = "." ; then |
---|
244 | source_path="`pwd`" |
---|
245 | disable source_path_used |
---|
246 | fi |
---|
247 | |
---|
248 | if test ! -z "$TMPDIR" ; then |
---|
249 | TMPDIRx="${TMPDIR}" |
---|
250 | elif test ! -z "$TEMPDIR" ; then |
---|
251 | TMPDIRx="${TEMPDIR}" |
---|
252 | else |
---|
253 | TMPDIRx="/tmp" |
---|
254 | fi |
---|
255 | TMP_H="${TMPDIRx}/vpx-conf-$$-${RANDOM}.h" |
---|
256 | TMP_C="${TMPDIRx}/vpx-conf-$$-${RANDOM}.c" |
---|
257 | TMP_O="${TMPDIRx}/vpx-conf-$$-${RANDOM}.o" |
---|
258 | TMP_X="${TMPDIRx}/vpx-conf-$$-${RANDOM}.x" |
---|
259 | TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RANDOM}.asm" |
---|
260 | |
---|
261 | clean_temp_files() { |
---|
262 | rm -f ${TMP_C} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM} |
---|
263 | } |
---|
264 | |
---|
265 | # |
---|
266 | # Toolchain Check Functions |
---|
267 | # |
---|
268 | check_cmd() { |
---|
269 | log "$@" |
---|
270 | "$@" >>${logfile} 2>&1 |
---|
271 | } |
---|
272 | |
---|
273 | check_cc() { |
---|
274 | log check_cc "$@" |
---|
275 | cat >${TMP_C} |
---|
276 | log_file ${TMP_C} |
---|
277 | check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} |
---|
278 | } |
---|
279 | |
---|
280 | check_cpp() { |
---|
281 | log check_cpp "$@" |
---|
282 | cat > ${TMP_C} |
---|
283 | log_file ${TMP_C} |
---|
284 | check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C} |
---|
285 | } |
---|
286 | |
---|
287 | check_ld() { |
---|
288 | log check_ld "$@" |
---|
289 | check_cc $@ \ |
---|
290 | && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} |
---|
291 | } |
---|
292 | |
---|
293 | check_header(){ |
---|
294 | log check_header "$@" |
---|
295 | header=$1 |
---|
296 | shift |
---|
297 | var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
---|
298 | disable $var |
---|
299 | check_cpp "$@" <<EOF && enable $var |
---|
300 | #include "$header" |
---|
301 | int x; |
---|
302 | EOF |
---|
303 | } |
---|
304 | |
---|
305 | |
---|
306 | check_cflags() { |
---|
307 | log check_cflags "$@" |
---|
308 | check_cc "$@" <<EOF |
---|
309 | int x; |
---|
310 | EOF |
---|
311 | } |
---|
312 | |
---|
313 | check_add_cflags() { |
---|
314 | check_cflags "$@" && add_cflags "$@" |
---|
315 | } |
---|
316 | |
---|
317 | check_add_asflags() { |
---|
318 | log add_asflags "$@" |
---|
319 | add_asflags "$@" |
---|
320 | } |
---|
321 | |
---|
322 | check_add_ldflags() { |
---|
323 | log add_ldflags "$@" |
---|
324 | add_ldflags "$@" |
---|
325 | } |
---|
326 | |
---|
327 | check_asm_align() { |
---|
328 | log check_asm_align "$@" |
---|
329 | cat >${TMP_ASM} <<EOF |
---|
330 | section .rodata |
---|
331 | align 16 |
---|
332 | EOF |
---|
333 | log_file ${TMP_ASM} |
---|
334 | check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} |
---|
335 | readelf -WS ${TMP_O} >${TMP_X} |
---|
336 | log_file ${TMP_X} |
---|
337 | if ! grep -q '\.rodata .* 16$' ${TMP_X}; then |
---|
338 | die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" |
---|
339 | fi |
---|
340 | } |
---|
341 | |
---|
342 | write_common_config_banner() { |
---|
343 | print_webm_license config.mk "##" "" |
---|
344 | echo '# This file automatically generated by configure. Do not edit!' >> config.mk |
---|
345 | echo "TOOLCHAIN := ${toolchain}" >> config.mk |
---|
346 | |
---|
347 | case ${toolchain} in |
---|
348 | *-linux-rvct) |
---|
349 | echo "ALT_LIBC := ${alt_libc}" >> config.mk |
---|
350 | ;; |
---|
351 | esac |
---|
352 | } |
---|
353 | |
---|
354 | write_common_config_targets() { |
---|
355 | for t in ${all_targets}; do |
---|
356 | if enabled ${t}; then |
---|
357 | if enabled universal || enabled child; then |
---|
358 | fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" |
---|
359 | else |
---|
360 | fwrite config.mk "ALL_TARGETS += ${t}" |
---|
361 | fi |
---|
362 | fi |
---|
363 | true; |
---|
364 | done |
---|
365 | true |
---|
366 | } |
---|
367 | |
---|
368 | write_common_target_config_mk() { |
---|
369 | local CC=${CC} |
---|
370 | enabled ccache && CC="ccache ${CC}" |
---|
371 | print_webm_license $1 "##" "" |
---|
372 | |
---|
373 | cat >> $1 << EOF |
---|
374 | # This file automatically generated by configure. Do not edit! |
---|
375 | SRC_PATH="$source_path" |
---|
376 | SRC_PATH_BARE=$source_path |
---|
377 | BUILD_PFX=${BUILD_PFX} |
---|
378 | TOOLCHAIN=${toolchain} |
---|
379 | ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} |
---|
380 | |
---|
381 | CC=${CC} |
---|
382 | AR=${AR} |
---|
383 | LD=${LD} |
---|
384 | AS=${AS} |
---|
385 | STRIP=${STRIP} |
---|
386 | NM=${NM} |
---|
387 | |
---|
388 | CFLAGS = ${CFLAGS} |
---|
389 | ARFLAGS = -rus\$(if \$(quiet),c,v) |
---|
390 | LDFLAGS = ${LDFLAGS} |
---|
391 | ASFLAGS = ${ASFLAGS} |
---|
392 | extralibs = ${extralibs} |
---|
393 | AS_SFX = ${AS_SFX:-.asm} |
---|
394 | EOF |
---|
395 | |
---|
396 | if enabled rvct; then cat >> $1 << EOF |
---|
397 | fmt_deps = sed -e 's;^__image.axf\$\$;\$(dir \$@)\$(notdir \$<).o \$@;' #hide |
---|
398 | EOF |
---|
399 | else cat >> $1 << EOF |
---|
400 | fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o\$\$;\$(dir \$@)\1\$(suffix \$<).o \$@;' |
---|
401 | EOF |
---|
402 | fi |
---|
403 | |
---|
404 | print_config_mk ARCH "${1}" ${ARCH_LIST} |
---|
405 | print_config_mk HAVE "${1}" ${HAVE_LIST} |
---|
406 | print_config_mk CONFIG "${1}" ${CONFIG_LIST} |
---|
407 | print_config_mk HAVE "${1}" gnu_strip |
---|
408 | |
---|
409 | enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" |
---|
410 | |
---|
411 | } |
---|
412 | |
---|
413 | |
---|
414 | write_common_target_config_h() { |
---|
415 | print_webm_license ${TMP_H} "/*" " */" |
---|
416 | cat >> ${TMP_H} << EOF |
---|
417 | /* This file automatically generated by configure. Do not edit! */ |
---|
418 | #ifndef VPX_CONFIG_H |
---|
419 | #define VPX_CONFIG_H |
---|
420 | #define RESTRICT ${RESTRICT} |
---|
421 | EOF |
---|
422 | print_config_h ARCH "${TMP_H}" ${ARCH_LIST} |
---|
423 | print_config_h HAVE "${TMP_H}" ${HAVE_LIST} |
---|
424 | print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} |
---|
425 | echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} |
---|
426 | mkdir -p `dirname "$1"` |
---|
427 | cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" |
---|
428 | } |
---|
429 | |
---|
430 | process_common_cmdline() { |
---|
431 | for opt in "$@"; do |
---|
432 | optval="${opt#*=}" |
---|
433 | case "$opt" in |
---|
434 | --child) enable child |
---|
435 | ;; |
---|
436 | --log*) |
---|
437 | logging="$optval" |
---|
438 | if ! disabled logging ; then |
---|
439 | enabled logging || logfile="$logging" |
---|
440 | else |
---|
441 | logfile=/dev/null |
---|
442 | fi |
---|
443 | ;; |
---|
444 | --target=*) toolchain="${toolchain:-${optval}}" |
---|
445 | ;; |
---|
446 | --force-target=*) toolchain="${toolchain:-${optval}}"; enable force_toolchain |
---|
447 | ;; |
---|
448 | --cpu) |
---|
449 | ;; |
---|
450 | --cpu=*) tune_cpu="$optval" |
---|
451 | ;; |
---|
452 | --extra-cflags=*) |
---|
453 | extra_cflags="${optval}" |
---|
454 | ;; |
---|
455 | --enable-?*|--disable-?*) |
---|
456 | eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
---|
457 | echo "${CMDLINE_SELECT} ${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null || die_unknown $opt |
---|
458 | $action $option |
---|
459 | ;; |
---|
460 | --force-enable-?*|--force-disable-?*) |
---|
461 | eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` |
---|
462 | $action $option |
---|
463 | ;; |
---|
464 | --libc=*) |
---|
465 | [ -d "${optval}" ] || die "Not a directory: ${optval}" |
---|
466 | disable builtin_libc |
---|
467 | alt_libc="${optval}" |
---|
468 | ;; |
---|
469 | --as=*) |
---|
470 | [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \ |
---|
471 | || die "Must be yasm, nasm or auto: ${optval}" |
---|
472 | alt_as="${optval}" |
---|
473 | ;; |
---|
474 | --prefix=*) |
---|
475 | prefix="${optval}" |
---|
476 | ;; |
---|
477 | --libdir=*) |
---|
478 | libdir="${optval}" |
---|
479 | ;; |
---|
480 | --sdk-path=*) |
---|
481 | [ -d "${optval}" ] || die "Not a directory: ${optval}" |
---|
482 | sdk_path="${optval}" |
---|
483 | ;; |
---|
484 | --libc|--as|--prefix|--libdir|--sdk-path) |
---|
485 | die "Option ${opt} requires argument" |
---|
486 | ;; |
---|
487 | --help|-h) show_help |
---|
488 | ;; |
---|
489 | *) die_unknown $opt |
---|
490 | ;; |
---|
491 | esac |
---|
492 | done |
---|
493 | } |
---|
494 | |
---|
495 | process_cmdline() { |
---|
496 | for opt do |
---|
497 | optval="${opt#*=}" |
---|
498 | case "$opt" in |
---|
499 | *) process_common_cmdline $opt |
---|
500 | ;; |
---|
501 | esac |
---|
502 | done |
---|
503 | } |
---|
504 | |
---|
505 | |
---|
506 | post_process_common_cmdline() { |
---|
507 | prefix="${prefix:-/usr/local}" |
---|
508 | prefix="${prefix%/}" |
---|
509 | libdir="${libdir:-${prefix}/lib}" |
---|
510 | libdir="${libdir%/}" |
---|
511 | if [ "${libdir#${prefix}}" = "${libdir}" ]; then |
---|
512 | die "Libdir ${libdir} must be a subdirectory of ${prefix}" |
---|
513 | fi |
---|
514 | } |
---|
515 | |
---|
516 | |
---|
517 | post_process_cmdline() { |
---|
518 | true; |
---|
519 | } |
---|
520 | |
---|
521 | setup_gnu_toolchain() { |
---|
522 | CC=${CC:-${CROSS}gcc} |
---|
523 | AR=${AR:-${CROSS}ar} |
---|
524 | LD=${LD:-${CROSS}${link_with_cc:-ld}} |
---|
525 | AS=${AS:-${CROSS}as} |
---|
526 | STRIP=${STRIP:-${CROSS}strip} |
---|
527 | NM=${NM:-${CROSS}nm} |
---|
528 | AS_SFX=.s |
---|
529 | } |
---|
530 | |
---|
531 | process_common_toolchain() { |
---|
532 | if [ -z "$toolchain" ]; then |
---|
533 | gcctarget="$(gcc -dumpmachine 2> /dev/null)" |
---|
534 | |
---|
535 | # detect tgt_isa |
---|
536 | case "$gcctarget" in |
---|
537 | *x86_64*|*amd64*) |
---|
538 | tgt_isa=x86_64 |
---|
539 | ;; |
---|
540 | *i[3456]86*) |
---|
541 | tgt_isa=x86 |
---|
542 | ;; |
---|
543 | *powerpc64*) |
---|
544 | tgt_isa=ppc64 |
---|
545 | ;; |
---|
546 | *powerpc*) |
---|
547 | tgt_isa=ppc32 |
---|
548 | ;; |
---|
549 | *sparc*) |
---|
550 | tgt_isa=sparc |
---|
551 | ;; |
---|
552 | esac |
---|
553 | |
---|
554 | # detect tgt_os |
---|
555 | case "$gcctarget" in |
---|
556 | *darwin8*) |
---|
557 | tgt_isa=universal |
---|
558 | tgt_os=darwin8 |
---|
559 | ;; |
---|
560 | *darwin9*) |
---|
561 | tgt_isa=universal |
---|
562 | tgt_os=darwin9 |
---|
563 | ;; |
---|
564 | *darwin10*) |
---|
565 | tgt_isa=x86_64 |
---|
566 | tgt_os=darwin10 |
---|
567 | ;; |
---|
568 | *darwin11*) |
---|
569 | tgt_isa=x86_64 |
---|
570 | tgt_os=darwin11 |
---|
571 | ;; |
---|
572 | *mingw32*|*cygwin*) |
---|
573 | [ -z "$tgt_isa" ] && tgt_isa=x86 |
---|
574 | tgt_os=win32 |
---|
575 | ;; |
---|
576 | *linux*|*bsd*) |
---|
577 | tgt_os=linux |
---|
578 | ;; |
---|
579 | *solaris2.10) |
---|
580 | tgt_os=solaris |
---|
581 | ;; |
---|
582 | esac |
---|
583 | |
---|
584 | if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then |
---|
585 | toolchain=${tgt_isa}-${tgt_os}-gcc |
---|
586 | fi |
---|
587 | fi |
---|
588 | |
---|
589 | toolchain=${toolchain:-generic-gnu} |
---|
590 | |
---|
591 | is_in ${toolchain} ${all_platforms} || enabled force_toolchain \ |
---|
592 | || die "Unrecognized toolchain '${toolchain}'" |
---|
593 | |
---|
594 | enabled child || log_echo "Configuring for target '${toolchain}'" |
---|
595 | |
---|
596 | # |
---|
597 | # Set up toolchain variables |
---|
598 | # |
---|
599 | tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') |
---|
600 | tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') |
---|
601 | tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') |
---|
602 | |
---|
603 | # Mark the specific ISA requested as enabled |
---|
604 | soft_enable ${tgt_isa} |
---|
605 | enable ${tgt_os} |
---|
606 | enable ${tgt_cc} |
---|
607 | |
---|
608 | # Enable the architecture family |
---|
609 | case ${tgt_isa} in |
---|
610 | arm*) enable arm;; |
---|
611 | mips*) enable mips;; |
---|
612 | esac |
---|
613 | |
---|
614 | # PIC is probably what we want when building shared libs |
---|
615 | enabled shared && soft_enable pic |
---|
616 | |
---|
617 | # Handle darwin variants. Newer SDKs allow targeting older |
---|
618 | # platforms, so find the newest SDK available. |
---|
619 | if [ -d "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.4u.sdk" ]; then |
---|
620 | osx_sdk_dir="/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.4u.sdk" |
---|
621 | fi |
---|
622 | if [ -d "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk" ]; then |
---|
623 | osx_sdk_dir="/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk" |
---|
624 | fi |
---|
625 | if [ -d "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk" ]; then |
---|
626 | osx_sdk_dir="/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk" |
---|
627 | fi |
---|
628 | if [ -d "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" ]; then |
---|
629 | osx_sdk_dir="/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" |
---|
630 | fi |
---|
631 | |
---|
632 | case ${toolchain} in |
---|
633 | *-darwin8-*) |
---|
634 | add_cflags "-isysroot ${osx_sdk_dir}" |
---|
635 | add_cflags "-mmacosx-version-min=10.4" |
---|
636 | add_ldflags "-isysroot ${osx_sdk_dir}" |
---|
637 | add_ldflags "-mmacosx-version-min=10.4" |
---|
638 | ;; |
---|
639 | *-darwin9-*) |
---|
640 | add_cflags "-isysroot ${osx_sdk_dir}" |
---|
641 | add_cflags "-mmacosx-version-min=10.5" |
---|
642 | add_ldflags "-isysroot ${osx_sdk_dir}" |
---|
643 | add_ldflags "-mmacosx-version-min=10.5" |
---|
644 | ;; |
---|
645 | *-darwin10-*) |
---|
646 | add_cflags "-isysroot ${osx_sdk_dir}" |
---|
647 | add_cflags "-mmacosx-version-min=10.6" |
---|
648 | add_ldflags "-isysroot ${osx_sdk_dir}" |
---|
649 | add_ldflags "-mmacosx-version-min=10.6" |
---|
650 | ;; |
---|
651 | *-darwin11-*) |
---|
652 | add_cflags "-isysroot ${osx_sdk_dir}" |
---|
653 | add_cflags "-mmacosx-version-min=10.7" |
---|
654 | add_ldflags "-isysroot ${osx_sdk_dir}" |
---|
655 | add_ldflags "-mmacosx-version-min=10.7" |
---|
656 | ;; |
---|
657 | esac |
---|
658 | |
---|
659 | # Handle Solaris variants. Solaris 10 needs -lposix4 |
---|
660 | case ${toolchain} in |
---|
661 | sparc-solaris-*) |
---|
662 | add_extralibs -lposix4 |
---|
663 | disable fast_unaligned |
---|
664 | ;; |
---|
665 | *-solaris-*) |
---|
666 | add_extralibs -lposix4 |
---|
667 | ;; |
---|
668 | esac |
---|
669 | |
---|
670 | # Process ARM architecture variants |
---|
671 | case ${toolchain} in |
---|
672 | arm*) |
---|
673 | # on arm, isa versions are supersets |
---|
674 | enabled armv7a && soft_enable armv7 ### DEBUG |
---|
675 | enabled armv7 && soft_enable armv6 |
---|
676 | enabled armv7 || enabled armv6 && soft_enable armv5te |
---|
677 | enabled armv7 || enabled armv6 && soft_enable fast_unaligned |
---|
678 | |
---|
679 | asm_conversion_cmd="cat" |
---|
680 | |
---|
681 | case ${tgt_cc} in |
---|
682 | gcc) |
---|
683 | CROSS=${CROSS:-arm-none-linux-gnueabi-} |
---|
684 | link_with_cc=gcc |
---|
685 | setup_gnu_toolchain |
---|
686 | arch_int=${tgt_isa##armv} |
---|
687 | arch_int=${arch_int%%te} |
---|
688 | check_add_asflags --defsym ARCHITECTURE=${arch_int} |
---|
689 | tune_cflags="-mtune=" |
---|
690 | if enabled armv7 |
---|
691 | then |
---|
692 | check_add_cflags -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-ftree-vectorize |
---|
693 | check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-march=armv7-a |
---|
694 | else |
---|
695 | check_add_cflags -march=${tgt_isa} |
---|
696 | check_add_asflags -march=${tgt_isa} |
---|
697 | fi |
---|
698 | enabled debug && add_asflags -g |
---|
699 | asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" |
---|
700 | ;; |
---|
701 | rvct) |
---|
702 | CC=armcc |
---|
703 | AR=armar |
---|
704 | AS=armasm |
---|
705 | LD=${source_path}/build/make/armlink_adapter.sh |
---|
706 | STRIP=arm-none-linux-gnueabi-strip |
---|
707 | NM=arm-none-linux-gnueabi-nm |
---|
708 | tune_cflags="--cpu=" |
---|
709 | tune_asflags="--cpu=" |
---|
710 | if [ -z "${tune_cpu}" ]; then |
---|
711 | if enabled armv7 |
---|
712 | then |
---|
713 | check_add_cflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3 |
---|
714 | check_add_asflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3 |
---|
715 | else |
---|
716 | check_add_cflags --cpu=${tgt_isa##armv} |
---|
717 | check_add_asflags --cpu=${tgt_isa##armv} |
---|
718 | fi |
---|
719 | fi |
---|
720 | arch_int=${tgt_isa##armv} |
---|
721 | arch_int=${arch_int%%te} |
---|
722 | check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" |
---|
723 | enabled debug && add_asflags -g |
---|
724 | add_cflags --gnu |
---|
725 | add_cflags --enum_is_int |
---|
726 | add_cflags --wchar32 |
---|
727 | ;; |
---|
728 | esac |
---|
729 | |
---|
730 | case ${tgt_os} in |
---|
731 | none*) |
---|
732 | disable multithread |
---|
733 | disable os_support |
---|
734 | ;; |
---|
735 | |
---|
736 | android*) |
---|
737 | SDK_PATH=${sdk_path} |
---|
738 | COMPILER_LOCATION=`find "${SDK_PATH}" \ |
---|
739 | -name "arm-linux-androideabi-gcc*" -print -quit` |
---|
740 | TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- |
---|
741 | CC=${TOOLCHAIN_PATH}gcc |
---|
742 | AR=${TOOLCHAIN_PATH}ar |
---|
743 | LD=${TOOLCHAIN_PATH}gcc |
---|
744 | AS=${TOOLCHAIN_PATH}as |
---|
745 | STRIP=${TOOLCHAIN_PATH}strip |
---|
746 | NM=${TOOLCHAIN_PATH}nm |
---|
747 | |
---|
748 | if [ -z "${alt_libc}" ]; then |
---|
749 | alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \ |
---|
750 | awk '{n = split($0,a,"/"); \ |
---|
751 | split(a[n-1],b,"-"); \ |
---|
752 | print $0 " " b[2]}' | \ |
---|
753 | sort -g -k 2 | \ |
---|
754 | awk '{ print $1 }' | tail -1` |
---|
755 | fi |
---|
756 | |
---|
757 | add_cflags "--sysroot=${alt_libc}" |
---|
758 | add_ldflags "--sysroot=${alt_libc}" |
---|
759 | |
---|
760 | enable pic |
---|
761 | soft_enable realtime_only |
---|
762 | if enabled armv7 |
---|
763 | then |
---|
764 | enable runtime_cpu_detect |
---|
765 | fi |
---|
766 | ;; |
---|
767 | |
---|
768 | darwin*) |
---|
769 | if [ -z "${sdk_path}" ]; then |
---|
770 | SDK_PATH=/Developer/Platforms/iPhoneOS.platform/Developer |
---|
771 | else |
---|
772 | SDK_PATH=${sdk_path} |
---|
773 | fi |
---|
774 | TOOLCHAIN_PATH=${SDK_PATH}/usr/bin |
---|
775 | CC=${TOOLCHAIN_PATH}/gcc |
---|
776 | AR=${TOOLCHAIN_PATH}/ar |
---|
777 | LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-llvm-gcc-4.2 |
---|
778 | AS=${TOOLCHAIN_PATH}/as |
---|
779 | STRIP=${TOOLCHAIN_PATH}/strip |
---|
780 | NM=${TOOLCHAIN_PATH}/nm |
---|
781 | AS_SFX=.s |
---|
782 | |
---|
783 | # ASFLAGS is written here instead of using check_add_asflags |
---|
784 | # because we need to overwrite all of ASFLAGS and purge the |
---|
785 | # options that were put in above |
---|
786 | ASFLAGS="-version -arch ${tgt_isa} -g" |
---|
787 | |
---|
788 | add_cflags -arch ${tgt_isa} |
---|
789 | add_ldflags -arch_only ${tgt_isa} |
---|
790 | |
---|
791 | if [ -z "${alt_libc}" ]; then |
---|
792 | alt_libc=${SDK_PATH}/SDKs/iPhoneOS5.0.sdk |
---|
793 | fi |
---|
794 | |
---|
795 | add_cflags "-isysroot ${alt_libc}" |
---|
796 | |
---|
797 | # Add the paths for the alternate libc |
---|
798 | for d in usr/include; do |
---|
799 | try_dir="${alt_libc}/${d}" |
---|
800 | [ -d "${try_dir}" ] && add_cflags -I"${try_dir}" |
---|
801 | done |
---|
802 | |
---|
803 | for d in lib usr/lib usr/lib/system; do |
---|
804 | try_dir="${alt_libc}/${d}" |
---|
805 | [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" |
---|
806 | done |
---|
807 | |
---|
808 | asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" |
---|
809 | ;; |
---|
810 | |
---|
811 | linux*) |
---|
812 | enable linux |
---|
813 | if enabled rvct; then |
---|
814 | # Check if we have CodeSourcery GCC in PATH. Needed for |
---|
815 | # libraries |
---|
816 | hash arm-none-linux-gnueabi-gcc 2>&- || \ |
---|
817 | die "Couldn't find CodeSourcery GCC from PATH" |
---|
818 | |
---|
819 | # Use armcc as a linker to enable translation of |
---|
820 | # some gcc specific options such as -lm and -lpthread. |
---|
821 | LD="armcc --translate_gcc" |
---|
822 | |
---|
823 | # create configuration file (uses path to CodeSourcery GCC) |
---|
824 | armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg |
---|
825 | |
---|
826 | add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg |
---|
827 | add_asflags --no_hide_all --apcs=/interwork |
---|
828 | add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg |
---|
829 | enabled pic && add_cflags --apcs=/fpic |
---|
830 | enabled pic && add_asflags --apcs=/fpic |
---|
831 | enabled shared && add_cflags --shared |
---|
832 | fi |
---|
833 | ;; |
---|
834 | |
---|
835 | esac |
---|
836 | ;; |
---|
837 | mips*) |
---|
838 | CROSS=${CROSS:-mipsel-linux-uclibc-} |
---|
839 | link_with_cc=gcc |
---|
840 | setup_gnu_toolchain |
---|
841 | tune_cflags="-mtune=" |
---|
842 | check_add_cflags -march=${tgt_isa} |
---|
843 | check_add_asflags -march=${tgt_isa} |
---|
844 | check_add_asflags -KPIC |
---|
845 | ;; |
---|
846 | ppc*) |
---|
847 | enable ppc |
---|
848 | bits=${tgt_isa##ppc} |
---|
849 | link_with_cc=gcc |
---|
850 | setup_gnu_toolchain |
---|
851 | add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin" |
---|
852 | soft_enable altivec |
---|
853 | enabled altivec && add_cflags -maltivec |
---|
854 | |
---|
855 | case "$tgt_os" in |
---|
856 | linux*) |
---|
857 | add_asflags -maltivec -mregnames -I"\$(dir \$<)linux" |
---|
858 | ;; |
---|
859 | darwin*) |
---|
860 | darwin_arch="-arch ppc" |
---|
861 | enabled ppc64 && darwin_arch="${darwin_arch}64" |
---|
862 | add_cflags ${darwin_arch} -m${bits} -fasm-blocks |
---|
863 | add_asflags ${darwin_arch} -force_cpusubtype_ALL -I"\$(dir \$<)darwin" |
---|
864 | add_ldflags ${darwin_arch} -m${bits} |
---|
865 | enabled altivec && add_cflags -faltivec |
---|
866 | ;; |
---|
867 | esac |
---|
868 | ;; |
---|
869 | x86*) |
---|
870 | bits=32 |
---|
871 | enabled x86_64 && bits=64 |
---|
872 | soft_enable runtime_cpu_detect |
---|
873 | soft_enable mmx |
---|
874 | soft_enable sse |
---|
875 | soft_enable sse2 |
---|
876 | soft_enable sse3 |
---|
877 | soft_enable ssse3 |
---|
878 | soft_enable sse4_1 |
---|
879 | |
---|
880 | case ${tgt_os} in |
---|
881 | win*) |
---|
882 | enabled gcc && add_cflags -fno-common |
---|
883 | ;; |
---|
884 | solaris*) |
---|
885 | CC=${CC:-${CROSS}gcc} |
---|
886 | LD=${LD:-${CROSS}gcc} |
---|
887 | CROSS=${CROSS:-g} |
---|
888 | ;; |
---|
889 | esac |
---|
890 | |
---|
891 | AS="${alt_as:-${AS:-auto}}" |
---|
892 | case ${tgt_cc} in |
---|
893 | icc*) |
---|
894 | CC=${CC:-icc} |
---|
895 | LD=${LD:-icc} |
---|
896 | setup_gnu_toolchain |
---|
897 | add_cflags -use-msasm -use-asm |
---|
898 | add_ldflags -i-static |
---|
899 | enabled x86_64 && add_cflags -ipo -no-prec-div -static -xSSE2 -axSSE2 |
---|
900 | enabled x86_64 && AR=xiar |
---|
901 | case ${tune_cpu} in |
---|
902 | atom*) |
---|
903 | tune_cflags="-x" |
---|
904 | tune_cpu="SSE3_ATOM" |
---|
905 | ;; |
---|
906 | *) |
---|
907 | tune_cflags="-march=" |
---|
908 | ;; |
---|
909 | esac |
---|
910 | ;; |
---|
911 | gcc*) |
---|
912 | add_cflags -m${bits} |
---|
913 | add_ldflags -m${bits} |
---|
914 | link_with_cc=gcc |
---|
915 | tune_cflags="-march=" |
---|
916 | setup_gnu_toolchain |
---|
917 | #for 32 bit x86 builds, -O3 did not turn on this flag |
---|
918 | enabled optimizations && check_add_cflags -fomit-frame-pointer |
---|
919 | ;; |
---|
920 | esac |
---|
921 | |
---|
922 | case "${AS}" in |
---|
923 | auto|"") |
---|
924 | which nasm >/dev/null 2>&1 && AS=nasm |
---|
925 | which yasm >/dev/null 2>&1 && AS=yasm |
---|
926 | [ "${AS}" = auto -o -z "${AS}" ] \ |
---|
927 | && die "Neither yasm nor nasm have been found" |
---|
928 | ;; |
---|
929 | esac |
---|
930 | log_echo " using $AS" |
---|
931 | [ "${AS##*/}" = nasm ] && add_asflags -Ox |
---|
932 | AS_SFX=.asm |
---|
933 | case ${tgt_os} in |
---|
934 | win32) |
---|
935 | add_asflags -f win32 |
---|
936 | enabled debug && add_asflags -g cv8 |
---|
937 | ;; |
---|
938 | win64) |
---|
939 | add_asflags -f x64 |
---|
940 | enabled debug && add_asflags -g cv8 |
---|
941 | ;; |
---|
942 | linux*|solaris*) |
---|
943 | add_asflags -f elf${bits} |
---|
944 | enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 |
---|
945 | enabled debug && [ "${AS}" = nasm ] && add_asflags -g |
---|
946 | [ "${AS##*/}" = nasm ] && check_asm_align |
---|
947 | ;; |
---|
948 | darwin*) |
---|
949 | add_asflags -f macho${bits} |
---|
950 | enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64" |
---|
951 | add_cflags ${darwin_arch} |
---|
952 | add_ldflags ${darwin_arch} |
---|
953 | # -mdynamic-no-pic is still a bit of voodoo -- it was required at |
---|
954 | # one time, but does not seem to be now, and it breaks some of the |
---|
955 | # code that still relies on inline assembly. |
---|
956 | # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic |
---|
957 | enabled icc && ! enabled pic && add_cflags -fno-pic |
---|
958 | ;; |
---|
959 | *) log "Warning: Unknown os $tgt_os while setting up $AS flags" |
---|
960 | ;; |
---|
961 | esac |
---|
962 | ;; |
---|
963 | universal*|*-gcc|generic-gnu) |
---|
964 | link_with_cc=gcc |
---|
965 | enable gcc |
---|
966 | setup_gnu_toolchain |
---|
967 | ;; |
---|
968 | esac |
---|
969 | |
---|
970 | # Try to enable CPU specific tuning |
---|
971 | if [ -n "${tune_cpu}" ]; then |
---|
972 | if [ -n "${tune_cflags}" ]; then |
---|
973 | check_add_cflags ${tune_cflags}${tune_cpu} || \ |
---|
974 | die "Requested CPU '${tune_cpu}' not supported by compiler" |
---|
975 | fi |
---|
976 | if [ -n "${tune_asflags}" ]; then |
---|
977 | check_add_asflags ${tune_asflags}${tune_cpu} || \ |
---|
978 | die "Requested CPU '${tune_cpu}' not supported by assembler" |
---|
979 | fi |
---|
980 | if [ -z "${tune_cflags}${tune_asflags}" ]; then |
---|
981 | log_echo "Warning: CPU tuning not supported by this toolchain" |
---|
982 | fi |
---|
983 | fi |
---|
984 | |
---|
985 | enabled debug && check_add_cflags -g && check_add_ldflags -g |
---|
986 | enabled gprof && check_add_cflags -pg && check_add_ldflags -pg |
---|
987 | enabled gcov && |
---|
988 | check_add_cflags -fprofile-arcs -ftest-coverage && |
---|
989 | check_add_ldflags -fprofile-arcs -ftest-coverage |
---|
990 | |
---|
991 | if enabled optimizations; then |
---|
992 | if enabled rvct; then |
---|
993 | enabled small && check_add_cflags -Ospace || check_add_cflags -Otime |
---|
994 | else |
---|
995 | enabled small && check_add_cflags -O2 || check_add_cflags -O3 |
---|
996 | fi |
---|
997 | fi |
---|
998 | |
---|
999 | # Position Independent Code (PIC) support, for building relocatable |
---|
1000 | # shared objects |
---|
1001 | enabled gcc && enabled pic && check_add_cflags -fPIC |
---|
1002 | |
---|
1003 | # Work around longjmp interception on glibc >= 2.11, to improve binary |
---|
1004 | # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 |
---|
1005 | enabled linux && check_add_cflags -D_FORTIFY_SOURCE=0 |
---|
1006 | |
---|
1007 | # Check for strip utility variant |
---|
1008 | ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip |
---|
1009 | |
---|
1010 | # Try to determine target endianness |
---|
1011 | check_cc <<EOF |
---|
1012 | unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; |
---|
1013 | EOF |
---|
1014 | [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | |
---|
1015 | grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian |
---|
1016 | |
---|
1017 | # Almost every platform uses pthreads. |
---|
1018 | if enabled multithread; then |
---|
1019 | case ${toolchain} in |
---|
1020 | *-win*);; |
---|
1021 | *-android-gcc);; |
---|
1022 | *) check_header pthread.h && add_extralibs -lpthread |
---|
1023 | esac |
---|
1024 | fi |
---|
1025 | |
---|
1026 | # for sysconf(3) and friends. |
---|
1027 | check_header unistd.h |
---|
1028 | |
---|
1029 | # glibc needs these |
---|
1030 | if enabled linux; then |
---|
1031 | add_cflags -D_LARGEFILE_SOURCE |
---|
1032 | add_cflags -D_FILE_OFFSET_BITS=64 |
---|
1033 | fi |
---|
1034 | |
---|
1035 | # append any user defined extra cflags |
---|
1036 | if [ -n "${extra_cflags}" ] ; then |
---|
1037 | check_add_cflags ${extra_cflags} || \ |
---|
1038 | die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" |
---|
1039 | fi |
---|
1040 | } |
---|
1041 | |
---|
1042 | process_toolchain() { |
---|
1043 | process_common_toolchain |
---|
1044 | } |
---|
1045 | |
---|
1046 | print_config_mk() { |
---|
1047 | local prefix=$1 |
---|
1048 | local makefile=$2 |
---|
1049 | shift 2 |
---|
1050 | for cfg; do |
---|
1051 | upname="`toupper $cfg`" |
---|
1052 | if enabled $cfg; then |
---|
1053 | echo "${prefix}_${upname}=yes" >> $makefile |
---|
1054 | fi |
---|
1055 | done |
---|
1056 | } |
---|
1057 | |
---|
1058 | print_config_h() { |
---|
1059 | local prefix=$1 |
---|
1060 | local header=$2 |
---|
1061 | shift 2 |
---|
1062 | for cfg; do |
---|
1063 | upname="`toupper $cfg`" |
---|
1064 | if enabled $cfg; then |
---|
1065 | echo "#define ${prefix}_${upname} 1" >> $header |
---|
1066 | else |
---|
1067 | echo "#define ${prefix}_${upname} 0" >> $header |
---|
1068 | fi |
---|
1069 | done |
---|
1070 | } |
---|
1071 | |
---|
1072 | print_webm_license() { |
---|
1073 | local destination=$1 |
---|
1074 | local prefix=$2 |
---|
1075 | local suffix=$3 |
---|
1076 | shift 3 |
---|
1077 | cat <<EOF > ${destination} |
---|
1078 | ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suffix} |
---|
1079 | ${prefix} ${suffix} |
---|
1080 | ${prefix} Use of this source code is governed by a BSD-style license${suffix} |
---|
1081 | ${prefix} that can be found in the LICENSE file in the root of the source${suffix} |
---|
1082 | ${prefix} tree. An additional intellectual property rights grant can be found${suffix} |
---|
1083 | ${prefix} in the file PATENTS. All contributing project authors may${suffix} |
---|
1084 | ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} |
---|
1085 | EOF |
---|
1086 | } |
---|
1087 | |
---|
1088 | process_targets() { |
---|
1089 | true; |
---|
1090 | } |
---|
1091 | |
---|
1092 | process_detect() { |
---|
1093 | true; |
---|
1094 | } |
---|
1095 | |
---|
1096 | enable logging |
---|
1097 | logfile="config.err" |
---|
1098 | self=$0 |
---|
1099 | process() { |
---|
1100 | cmdline_args="$@" |
---|
1101 | process_cmdline "$@" |
---|
1102 | if enabled child; then |
---|
1103 | echo "# ${self} $@" >> ${logfile} |
---|
1104 | else |
---|
1105 | echo "# ${self} $@" > ${logfile} |
---|
1106 | fi |
---|
1107 | post_process_common_cmdline |
---|
1108 | post_process_cmdline |
---|
1109 | process_toolchain |
---|
1110 | process_detect |
---|
1111 | process_targets |
---|
1112 | |
---|
1113 | OOT_INSTALLS="${OOT_INSTALLS}" |
---|
1114 | if enabled source_path_used; then |
---|
1115 | # Prepare the PWD for building. |
---|
1116 | for f in ${OOT_INSTALLS}; do |
---|
1117 | install -D ${source_path}/$f $f |
---|
1118 | done |
---|
1119 | fi |
---|
1120 | cp ${source_path}/build/make/Makefile . |
---|
1121 | |
---|
1122 | clean_temp_files |
---|
1123 | true |
---|
1124 | } |
---|