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