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