| OLD | NEW | 
|---|
| 1 #!/bin/sh | 1 #!/bin/sh | 
| 2 ## | 2 ## | 
| 3 ##  configure.sh | 3 ##  configure.sh | 
| 4 ## | 4 ## | 
| 5 ##  This script is sourced by the main configure script and contains | 5 ##  This script is sourced by the main configure script and contains | 
| 6 ##  utility functions and other common bits that aren't strictly libvpx | 6 ##  utility functions and other common bits that aren't strictly libvpx | 
| 7 ##  related. | 7 ##  related. | 
| 8 ## | 8 ## | 
| 9 ##  This build system is based in part on the FFmpeg configure script. | 9 ##  This build system is based in part on the FFmpeg configure script. | 
| 10 ## | 10 ## | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 34 } | 34 } | 
| 35 | 35 | 
| 36 | 36 | 
| 37 log(){ | 37 log(){ | 
| 38     echo "$@" >>$logfile | 38     echo "$@" >>$logfile | 
| 39 } | 39 } | 
| 40 | 40 | 
| 41 | 41 | 
| 42 log_file(){ | 42 log_file(){ | 
| 43     log BEGIN $1 | 43     log BEGIN $1 | 
| 44     pr -n -t $1 >>$logfile | 44     cat -n $1 >>$logfile | 
| 45     log END $1 | 45     log END $1 | 
| 46 } | 46 } | 
| 47 | 47 | 
| 48 | 48 | 
| 49 log_echo() { | 49 log_echo() { | 
| 50     echo "$@" | 50     echo "$@" | 
| 51     log "$@" | 51     log "$@" | 
| 52 } | 52 } | 
| 53 | 53 | 
| 54 | 54 | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 267 RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}') | 267 RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}') | 
| 268 TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h" | 268 TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h" | 
| 269 TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c" | 269 TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c" | 
| 270 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc" | 270 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc" | 
| 271 TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o" | 271 TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o" | 
| 272 TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x" | 272 TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x" | 
| 273 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" | 273 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" | 
| 274 | 274 | 
| 275 clean_temp_files() { | 275 clean_temp_files() { | 
| 276     rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM} | 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 | 
| 277 } | 278 } | 
| 278 | 279 | 
| 279 # | 280 # | 
| 280 # Toolchain Check Functions | 281 # Toolchain Check Functions | 
| 281 # | 282 # | 
| 282 check_cmd() { | 283 check_cmd() { | 
| 283     enabled external_build && return | 284     enabled external_build && return | 
| 284     log "$@" | 285     log "$@" | 
| 285     "$@" >>${logfile} 2>&1 | 286     "$@" >>${logfile} 2>&1 | 
| 286 } | 287 } | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 320     disable_feature $var | 321     disable_feature $var | 
| 321     check_cpp "$@" <<EOF && enable_feature $var | 322     check_cpp "$@" <<EOF && enable_feature $var | 
| 322 #include "$header" | 323 #include "$header" | 
| 323 int x; | 324 int x; | 
| 324 EOF | 325 EOF | 
| 325 } | 326 } | 
| 326 | 327 | 
| 327 | 328 | 
| 328 check_cflags() { | 329 check_cflags() { | 
| 329     log check_cflags "$@" | 330     log check_cflags "$@" | 
| 330     check_cc "$@" <<EOF | 331     check_cc -Werror "$@" <<EOF | 
| 331 int x; | 332 int x; | 
| 332 EOF | 333 EOF | 
| 333 } | 334 } | 
| 334 | 335 | 
| 335 check_cxxflags() { | 336 check_cxxflags() { | 
| 336     log check_cxxflags "$@" | 337     log check_cxxflags "$@" | 
| 337 | 338 | 
| 338     # Catch CFLAGS that trigger CXX warnings | 339     # Catch CFLAGS that trigger CXX warnings | 
| 339     case "$CXX" in | 340     case "$CXX" in | 
| 340       *c++-analyzer|*clang++|*g++*) check_cxx -Werror "$@" <<EOF | 341       *c++-analyzer|*clang++|*g++*) check_cxx -Werror "$@" <<EOF | 
| 341 int x; | 342 int x; | 
| 342 EOF | 343 EOF | 
| 343       ;; | 344       ;; | 
| 344       *) check_cxx "$@" <<EOF | 345       *) check_cxx -Werror "$@" <<EOF | 
| 345 int x; | 346 int x; | 
| 346 EOF | 347 EOF | 
| 347       ;; | 348       ;; | 
| 348     esac | 349     esac | 
| 349 } | 350 } | 
| 350 | 351 | 
| 351 check_add_cflags() { | 352 check_add_cflags() { | 
| 352     check_cxxflags "$@" && add_cxxflags_only "$@" | 353     check_cxxflags "$@" && add_cxxflags_only "$@" | 
| 353     check_cflags "$@" && add_cflags_only "$@" | 354     check_cflags "$@" && add_cflags_only "$@" | 
| 354 } | 355 } | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 371 EOF | 372 EOF | 
| 372     log_file ${TMP_ASM} | 373     log_file ${TMP_ASM} | 
| 373     check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} | 374     check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} | 
| 374     readelf -WS ${TMP_O} >${TMP_X} | 375     readelf -WS ${TMP_O} >${TMP_X} | 
| 375     log_file ${TMP_X} | 376     log_file ${TMP_X} | 
| 376     if ! grep -q '\.rodata .* 16$' ${TMP_X}; then | 377     if ! grep -q '\.rodata .* 16$' ${TMP_X}; then | 
| 377         die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" | 378         die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" | 
| 378     fi | 379     fi | 
| 379 } | 380 } | 
| 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 | 
| 381 write_common_config_banner() { | 395 write_common_config_banner() { | 
| 382     print_webm_license config.mk "##" "" | 396     print_webm_license config.mk "##" "" | 
| 383     echo '# This file automatically generated by configure. Do not edit!' >> con
      fig.mk | 397     echo '# This file automatically generated by configure. Do not edit!' >> con
      fig.mk | 
| 384     echo "TOOLCHAIN := ${toolchain}" >> config.mk | 398     echo "TOOLCHAIN := ${toolchain}" >> config.mk | 
| 385 | 399 | 
| 386     case ${toolchain} in | 400     case ${toolchain} in | 
| 387         *-linux-rvct) | 401         *-linux-rvct) | 
| 388             echo "ALT_LIBC := ${alt_libc}" >> config.mk | 402             echo "ALT_LIBC := ${alt_libc}" >> config.mk | 
| 389             ;; | 403             ;; | 
| 390     esac | 404     esac | 
| 391 } | 405 } | 
| 392 | 406 | 
| 393 write_common_config_targets() { | 407 write_common_config_targets() { | 
| 394     for t in ${all_targets}; do | 408     for t in ${all_targets}; do | 
| 395         if enabled ${t}; then | 409         if enabled ${t}; then | 
| 396             if enabled universal || enabled child; then | 410             if enabled universal || enabled child; then | 
| 397                 fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" | 411                 fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" | 
| 398             else | 412             else | 
| 399                 fwrite config.mk "ALL_TARGETS += ${t}" | 413                 fwrite config.mk "ALL_TARGETS += ${t}" | 
| 400             fi | 414             fi | 
| 401         fi | 415         fi | 
| 402     true; | 416     true; | 
| 403     done | 417     done | 
| 404 true | 418 true | 
| 405 } | 419 } | 
| 406 | 420 | 
| 407 write_common_target_config_mk() { | 421 write_common_target_config_mk() { | 
| 408     local CC=${CC} | 422     local CC="${CC}" | 
| 409     local CXX=${CXX} | 423     local CXX="${CXX}" | 
| 410     enabled ccache && CC="ccache ${CC}" | 424     enabled ccache && CC="ccache ${CC}" | 
| 411     enabled ccache && CXX="ccache ${CXX}" | 425     enabled ccache && CXX="ccache ${CXX}" | 
| 412     print_webm_license $1 "##" "" | 426     print_webm_license $1 "##" "" | 
| 413 | 427 | 
| 414     cat >> $1 << EOF | 428     cat >> $1 << EOF | 
| 415 # This file automatically generated by configure. Do not edit! | 429 # This file automatically generated by configure. Do not edit! | 
| 416 SRC_PATH="$source_path" | 430 SRC_PATH="$source_path" | 
| 417 SRC_PATH_BARE=$source_path | 431 SRC_PATH_BARE=$source_path | 
| 418 BUILD_PFX=${BUILD_PFX} | 432 BUILD_PFX=${BUILD_PFX} | 
| 419 TOOLCHAIN=${toolchain} | 433 TOOLCHAIN=${toolchain} | 
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1082                          echo "${tgt_cc} does not support avx/avx2, disabling...
      .." | 1096                          echo "${tgt_cc} does not support avx/avx2, disabling...
      .." | 
| 1083                          RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-av
      x2 " | 1097                          RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-av
      x2 " | 
| 1084                          soft_disable avx | 1098                          soft_disable avx | 
| 1085                          soft_disable avx2 | 1099                          soft_disable avx2 | 
| 1086                     ;; | 1100                     ;; | 
| 1087                 esac | 1101                 esac | 
| 1088             ;; | 1102             ;; | 
| 1089         esac | 1103         esac | 
| 1090 | 1104 | 
| 1091         soft_enable runtime_cpu_detect | 1105         soft_enable runtime_cpu_detect | 
| 1092         soft_enable mmx |  | 
| 1093         soft_enable sse |  | 
| 1094         soft_enable sse2 |  | 
| 1095         soft_enable sse3 |  | 
| 1096         soft_enable ssse3 |  | 
| 1097         # We can't use 'check_cflags' until the compiler is configured and CC is | 1106         # We can't use 'check_cflags' until the compiler is configured and CC is | 
| 1098         # populated. | 1107         # populated. | 
| 1099         if enabled gcc && ! disabled sse4_1 && ! check_cflags -msse4; then | 1108         check_gcc_machine_option mmx | 
| 1100             RTCD_OPTIONS="${RTCD_OPTIONS}--disable-sse4_1 " | 1109         check_gcc_machine_option sse | 
| 1101         else | 1110         check_gcc_machine_option sse2 | 
| 1102             soft_enable sse4_1 | 1111         check_gcc_machine_option sse3 | 
| 1103         fi | 1112         check_gcc_machine_option ssse3 | 
| 1104 | 1113         check_gcc_machine_option sse4 sse4_1 | 
| 1105         if enabled gcc && ! disabled avx && ! check_cflags -mavx; then | 1114         check_gcc_machine_option avx | 
| 1106             RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx " | 1115         check_gcc_machine_option avx2 | 
| 1107         else |  | 
| 1108             soft_enable avx |  | 
| 1109         fi |  | 
| 1110 |  | 
| 1111         if enabled gcc && ! disabled avx2 && ! check_cflags -mavx2; then |  | 
| 1112             RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx2 " |  | 
| 1113         else |  | 
| 1114             soft_enable avx2 |  | 
| 1115         fi |  | 
| 1116 | 1116 | 
| 1117         case "${AS}" in | 1117         case "${AS}" in | 
| 1118             auto|"") | 1118             auto|"") | 
| 1119                 which nasm >/dev/null 2>&1 && AS=nasm | 1119                 which nasm >/dev/null 2>&1 && AS=nasm | 
| 1120                 which yasm >/dev/null 2>&1 && AS=yasm | 1120                 which yasm >/dev/null 2>&1 && AS=yasm | 
| 1121                 [ "${AS}" = auto -o -z "${AS}" ] \ | 1121                 [ "${AS}" = auto -o -z "${AS}" ] \ | 
| 1122                     && die "Neither yasm nor nasm have been found" | 1122                     && die "Neither yasm nor nasm have been found" | 
| 1123             ;; | 1123             ;; | 
| 1124         esac | 1124         esac | 
| 1125         log_echo "  using $AS" | 1125         log_echo "  using $AS" | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1340     # Prepare the PWD for building. | 1340     # Prepare the PWD for building. | 
| 1341     for f in ${OOT_INSTALLS}; do | 1341     for f in ${OOT_INSTALLS}; do | 
| 1342             install -D ${source_path}/$f $f | 1342             install -D ${source_path}/$f $f | 
| 1343     done | 1343     done | 
| 1344     fi | 1344     fi | 
| 1345     cp ${source_path}/build/make/Makefile . | 1345     cp ${source_path}/build/make/Makefile . | 
| 1346 | 1346 | 
| 1347     clean_temp_files | 1347     clean_temp_files | 
| 1348     true | 1348     true | 
| 1349 } | 1349 } | 
| OLD | NEW | 
|---|