1629 lines · 43.8 KB · Shell
RawDownload
#!/bin/sh####  configure.sh####  This script is sourced by the main configure script and contains##  utility functions and other common bits that aren't strictly libvpx##  related.####  This build system is based in part on the FFmpeg configure script.##  ## Logging / Output Functions#die_unknown(){  echo "Unknown option \"$1\"."  echo "See $0 --help for available options."  clean_temp_files  exit 1} die() {  echo "$@"  echo  echo "Configuration failed. This could reflect a misconfiguration of your"  echo "toolchains, improper options selected, or another problem. If you"  echo "don't see any useful error messages above, the next step is to look"  echo "at the configure error log file ($logfile) to determine what"  echo "configure was trying to do when it died."  clean_temp_files  exit 1} log(){  echo "$@" >>$logfile} log_file(){  log BEGIN $1  cat -n $1 >>$logfile  log END $1} log_echo() {  echo "$@"  log "$@"} fwrite () {  outfile=$1  shift  echo "$@" >> ${outfile}} show_help_pre(){  for opt in ${CMDLINE_SELECT}; do    opt2=`echo $opt | sed -e 's;_;-;g'`    if enabled $opt; then      eval "toggle_${opt}=\"--disable-${opt2}\""    else      eval "toggle_${opt}=\"--enable-${opt2} \""    fi  done   cat <<EOFUsage: configure [options]Options: Build options:  --help                      print this message  --log=yes|no|FILE           file configure log is written to [config.log]  --target=TARGET             target platform tuple [generic-gnu]  --cpu=CPU                   optimize for a specific cpu rather than a family  --extra-cflags=ECFLAGS      add ECFLAGS to CFLAGS [$CFLAGS]  --extra-cxxflags=ECXXFLAGS  add ECXXFLAGS to CXXFLAGS [$CXXFLAGS]  ${toggle_extra_warnings}    emit harmless warnings (always non-fatal)  ${toggle_werror}            treat warnings as errors, if possible                              (not available with all compilers)  ${toggle_optimizations}     turn on/off compiler optimization flags  ${toggle_pic}               turn on/off Position Independent Code  ${toggle_ccache}            turn on/off compiler cache  ${toggle_debug}             enable/disable debug mode  ${toggle_gprof}             enable/disable gprof profiling instrumentation  ${toggle_gcov}              enable/disable gcov coverage instrumentation  ${toggle_thumb}             enable/disable building arm assembly in thumb mode  ${toggle_dependency_tracking}                              disable to speed up one-time build Install options:  ${toggle_install_docs}      control whether docs are installed  ${toggle_install_bins}      control whether binaries are installed  ${toggle_install_libs}      control whether libraries are installed  ${toggle_install_srcs}      control whether sources are installed  EOF} show_help_post(){  cat <<EOF  NOTES:    Object files are built at the place where configure is launched.     All boolean options can be negated. The default value is the opposite    of that shown above. If the option --disable-foo is listed, then    the default value for foo is enabled. Supported targets:EOF  show_targets ${all_platforms}  echo  exit 1} show_targets() {  while [ -n "$*" ]; do    if [ "${1%%-*}" = "${2%%-*}" ]; then      if [ "${2%%-*}" = "${3%%-*}" ]; then        printf "    %-24s %-24s %-24s\n" "$1" "$2" "$3"        shift; shift; shift      else        printf "    %-24s %-24s\n" "$1" "$2"        shift; shift      fi    else      printf "    %-24s\n" "$1"      shift    fi  done} show_help() {  show_help_pre  show_help_post} ## List Processing Functions#set_all(){  value=$1  shift  for var in $*; do    eval $var=$value  done} is_in(){  value=$1  shift  for var in $*; do    [ $var = $value ] && return 0  done  return 1} add_cflags() {  CFLAGS="${CFLAGS} $@"  CXXFLAGS="${CXXFLAGS} $@"} add_cflags_only() {  CFLAGS="${CFLAGS} $@"} add_cxxflags_only() {  CXXFLAGS="${CXXFLAGS} $@"} add_ldflags() {  LDFLAGS="${LDFLAGS} $@"} add_asflags() {  ASFLAGS="${ASFLAGS} $@"} add_extralibs() {  extralibs="${extralibs} $@"} ## Boolean Manipulation Functions# enable_feature(){  set_all yes $*} disable_feature(){  set_all no $*} enabled(){  eval test "x\$$1" = "xyes"} disabled(){  eval test "x\$$1" = "xno"} enable_codec(){  enabled "${1}" || echo "  enabling ${1}"  enable_feature "${1}"   is_in "${1}" vp8 vp9 && enable_feature "${1}_encoder" "${1}_decoder"} disable_codec(){  disabled "${1}" || echo "  disabling ${1}"  disable_feature "${1}"   is_in "${1}" vp8 vp9 && disable_feature "${1}_encoder" "${1}_decoder"} # Iterates through positional parameters, checks to confirm the parameter has# not been explicitly (force) disabled, and enables the setting controlled by# the parameter when the setting is not disabled.# Note: Does NOT alter RTCD generation options ($RTCD_OPTIONS).soft_enable() {  for var in $*; do    if ! disabled $var; then      enabled $var || log_echo "  enabling $var"      enable_feature $var    fi  done} # Iterates through positional parameters, checks to confirm the parameter has# not been explicitly (force) enabled, and disables the setting controlled by# the parameter when the setting is not enabled.# Note: Does NOT alter RTCD generation options ($RTCD_OPTIONS).soft_disable() {  for var in $*; do    if ! enabled $var; then      disabled $var || log_echo "  disabling $var"      disable_feature $var    fi  done} ## Text Processing Functions#toupper(){  echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ} tolower(){  echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz} ## Temporary File Functions#source_path=${0%/*}enable_feature source_path_usedif [ -z "$source_path" ] || [ "$source_path" = "." ]; then  source_path="`pwd`"  disable_feature source_path_usedfi# Makefiles greedily process the '#' character as a comment, even if it is# inside quotes. So, this character must be escaped in all paths in Makefiles.source_path_mk=$(echo $source_path | sed -e 's;\#;\\\#;g') if test ! -z "$TMPDIR" ; then  TMPDIRx="${TMPDIR}"elif test ! -z "$TEMPDIR" ; then  TMPDIRx="${TEMPDIR}"else  TMPDIRx="/tmp"fiRAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}')TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h"TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c"TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc"TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o"TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x"TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" clean_temp_files() {  rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM}  enabled gcov && rm -f ${TMP_C%.c}.gcno ${TMP_CC%.cc}.gcno} ## Toolchain Check Functions#check_cmd() {  enabled external_build && return  log "$@"  "$@" >>${logfile} 2>&1} check_cc() {  log check_cc "$@"  cat >${TMP_C}  log_file ${TMP_C}  check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}} check_cxx() {  log check_cxx "$@"  cat >${TMP_CC}  log_file ${TMP_CC}  check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}} check_cpp() {  log check_cpp "$@"  cat > ${TMP_C}  log_file ${TMP_C}  check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C}} check_ld() {  log check_ld "$@"  check_cc $@ \    && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}} check_lib() {  log check_lib "$@"  check_cc $@ \    && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs}} check_header(){  log check_header "$@"  header=$1  shift  var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`  disable_feature $var  check_cpp "$@" <<EOF && enable_feature $var#include "$header"int x;EOF} check_cflags() { log check_cflags "$@" check_cc -Werror "$@" <<EOFint x;EOF} check_cxxflags() {  log check_cxxflags "$@"   # Catch CFLAGS that trigger CXX warnings  case "$CXX" in    *c++-analyzer|*clang++|*g++*)      check_cxx -Werror "$@" <<EOFint x;EOF      ;;    *)      check_cxx -Werror "$@" <<EOFint x;EOF      ;;    esac} check_add_cflags() {  check_cxxflags "$@" && add_cxxflags_only "$@"  check_cflags "$@" && add_cflags_only "$@"} check_add_cxxflags() {  check_cxxflags "$@" && add_cxxflags_only "$@"} check_add_asflags() {  log add_asflags "$@"  add_asflags "$@"} check_add_ldflags() {  log add_ldflags "$@"  add_ldflags "$@"} check_asm_align() {  log check_asm_align "$@"  cat >${TMP_ASM} <<EOFsection .rodataalign 16EOF  log_file ${TMP_ASM}  check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM}  readelf -WS ${TMP_O} >${TMP_X}  log_file ${TMP_X}  if ! grep -q '\.rodata .* 16$' ${TMP_X}; then    die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)"  fi} # tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used.check_gcc_machine_option() {  opt="$1"  feature="$2"  [ -n "$feature" ] || feature="$opt"   if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then    RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature "  else    soft_enable "$feature"  fi} # tests for -m$2, -m$3, -m$4... toggling the feature given in $1.check_gcc_machine_options() {  feature="$1"  shift  flags="-m$1"  shift  for opt in $*; do    flags="$flags -m$opt"  done   if enabled gcc && ! disabled "$feature" && ! check_cflags $flags; then    RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature "  else    soft_enable "$feature"  fi} check_gcc_avx512_compiles() {  if disabled gcc; then    return  fi   check_cc -mavx512f <<EOF#include <immintrin.h>void f(void) {  __m512i x = _mm512_set1_epi16(0);  (void)x;}EOF  compile_result=$?  if [ ${compile_result} -ne 0 ]; then    log_echo "    disabling avx512: not supported by compiler"    disable_feature avx512    RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "  fi} write_common_config_banner() {  print_webm_license config.mk "##" ""  echo '# This file automatically generated by configure. Do not edit!' >> config.mk  echo "TOOLCHAIN := ${toolchain}" >> config.mk   case ${toolchain} in    *-linux-rvct)      echo "ALT_LIBC := ${alt_libc}" >> config.mk      ;;  esac} write_common_config_targets() {  for t in ${all_targets}; do    if enabled ${t}; then      if enabled child; then        fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}"      else        fwrite config.mk "ALL_TARGETS += ${t}"      fi    fi    true;  done  true} write_common_target_config_mk() {  saved_CC="${CC}"  saved_CXX="${CXX}"  enabled ccache && CC="ccache ${CC}"  enabled ccache && CXX="ccache ${CXX}"  print_webm_license $1 "##" ""   cat >> $1 << EOF# This file automatically generated by configure. Do not edit!SRC_PATH="$source_path_mk"SRC_PATH_BARE=$source_path_mkBUILD_PFX=${BUILD_PFX}TOOLCHAIN=${toolchain}ASM_CONVERSION=${asm_conversion_cmd:-${source_path_mk}/build/make/ads2gas.pl}GEN_VCPROJ=${gen_vcproj_cmd}MSVS_ARCH_DIR=${msvs_arch_dir} CC=${CC}CXX=${CXX}AR=${AR}LD=${LD}AS=${AS}STRIP=${STRIP}

Lines 1–500 of 1629.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t