| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/sh |
| 2 ## | 2 ## |
| 3 ## configure | 3 ## configure |
| 4 ## | 4 ## |
| 5 ## This script is the front-end to the build system. It provides a similar | 5 ## This script is the front-end to the build system. It provides a similar |
| 6 ## interface to standard configure scripts with some extra bits for dealing | 6 ## interface to standard configure scripts with some extra bits for dealing |
| 7 ## with toolchains that differ from the standard POSIX interface and | 7 ## with toolchains that differ from the standard POSIX interface and |
| 8 ## for extracting subsets of the source tree. In theory, reusable parts | 8 ## for extracting subsets of the source tree. In theory, reusable parts |
| 9 ## of this script were intended to live in build/make/configure.sh, | 9 ## of this script were intended to live in build/make/configure.sh, |
| 10 ## but in practice, the line is pretty blurry. | 10 ## but in practice, the line is pretty blurry. |
| 11 ## | 11 ## |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 all_platforms="${all_platforms} universal-darwin12-gcc" | 146 all_platforms="${all_platforms} universal-darwin12-gcc" |
| 147 all_platforms="${all_platforms} universal-darwin13-gcc" | 147 all_platforms="${all_platforms} universal-darwin13-gcc" |
| 148 all_platforms="${all_platforms} generic-gnu" | 148 all_platforms="${all_platforms} generic-gnu" |
| 149 | 149 |
| 150 # all_targets is a list of all targets that can be configured | 150 # all_targets is a list of all targets that can be configured |
| 151 # note that these should be in dependency order for now. | 151 # note that these should be in dependency order for now. |
| 152 all_targets="libs examples docs" | 152 all_targets="libs examples docs" |
| 153 | 153 |
| 154 # all targets available are enabled, by default. | 154 # all targets available are enabled, by default. |
| 155 for t in ${all_targets}; do | 155 for t in ${all_targets}; do |
| 156 [ -f ${source_path}/${t}.mk ] && enable ${t} | 156 [ -f ${source_path}/${t}.mk ] && enable_feature ${t} |
| 157 done | 157 done |
| 158 | 158 |
| 159 # check installed doxygen version | 159 # check installed doxygen version |
| 160 doxy_version=$(doxygen --version 2>/dev/null) | 160 doxy_version=$(doxygen --version 2>/dev/null) |
| 161 doxy_major=${doxy_version%%.*} | 161 doxy_major=${doxy_version%%.*} |
| 162 if [ ${doxy_major:-0} -ge 1 ]; then | 162 if [ ${doxy_major:-0} -ge 1 ]; then |
| 163 doxy_version=${doxy_version#*.} | 163 doxy_version=${doxy_version#*.} |
| 164 doxy_minor=${doxy_version%%.*} | 164 doxy_minor=${doxy_version%%.*} |
| 165 doxy_patch=${doxy_version##*.} | 165 doxy_patch=${doxy_version##*.} |
| 166 | 166 |
| 167 [ $doxy_major -gt 1 ] && enable doxygen | 167 [ $doxy_major -gt 1 ] && enable_feature doxygen |
| 168 [ $doxy_minor -gt 5 ] && enable doxygen | 168 [ $doxy_minor -gt 5 ] && enable_feature doxygen |
| 169 [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen | 169 [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen |
| 170 fi | 170 fi |
| 171 | 171 |
| 172 # install everything except the sources, by default. sources will have | 172 # install everything except the sources, by default. sources will have |
| 173 # to be enabled when doing dist builds, since that's no longer a common | 173 # to be enabled when doing dist builds, since that's no longer a common |
| 174 # case. | 174 # case. |
| 175 enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs | 175 enabled doxygen && php -v >/dev/null 2>&1 && enable_feature install_docs |
| 176 enable install_bins | 176 enable_feature install_bins |
| 177 enable install_libs | 177 enable_feature install_libs |
| 178 | 178 |
| 179 enable static | 179 enable_feature static |
| 180 enable optimizations | 180 enable_feature optimizations |
| 181 enable fast_unaligned #allow unaligned accesses, if supported by hw | 181 enable_feature fast_unaligned #allow unaligned accesses, if supported by hw |
| 182 enable md5 | 182 enable_feature md5 |
| 183 enable spatial_resampling | 183 enable_feature spatial_resampling |
| 184 enable multithread | 184 enable_feature multithread |
| 185 enable os_support | 185 enable_feature os_support |
| 186 enable temporal_denoising | 186 enable_feature temporal_denoising |
| 187 | 187 |
| 188 [ -d ${source_path}/../include ] && enable alt_tree_layout | 188 [ -d ${source_path}/../include ] && enable_feature alt_tree_layout |
| 189 for d in vp8 vp9; do | 189 for d in vp8 vp9; do |
| 190 [ -d ${source_path}/${d} ] && disable alt_tree_layout; | 190 [ -d ${source_path}/${d} ] && disable_feature alt_tree_layout; |
| 191 done | 191 done |
| 192 | 192 |
| 193 if ! enabled alt_tree_layout; then | 193 if ! enabled alt_tree_layout; then |
| 194 # development environment | 194 # development environment |
| 195 [ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder" | 195 [ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder" |
| 196 [ -d ${source_path}/vp9 ] && CODECS="${CODECS} vp9_encoder vp9_decoder" | 196 [ -d ${source_path}/vp9 ] && CODECS="${CODECS} vp9_encoder vp9_decoder" |
| 197 else | 197 else |
| 198 # customer environment | 198 # customer environment |
| 199 [ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder" | 199 [ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder" |
| 200 [ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder" | 200 [ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder" |
| 201 [ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder" | 201 [ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder" |
| 202 [ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder" | 202 [ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder" |
| 203 [ -f ${source_path}/../include/vpx/vp8cx.h ] || disable vp8_encoder | 203 [ -f ${source_path}/../include/vpx/vp8cx.h ] || disable_feature vp8_encoder |
| 204 [ -f ${source_path}/../include/vpx/vp8dx.h ] || disable vp8_decoder | 204 [ -f ${source_path}/../include/vpx/vp8dx.h ] || disable_feature vp8_decoder |
| 205 [ -f ${source_path}/../include/vpx/vp9cx.h ] || disable vp9_encoder | 205 [ -f ${source_path}/../include/vpx/vp9cx.h ] || disable_feature vp9_encoder |
| 206 [ -f ${source_path}/../include/vpx/vp9dx.h ] || disable vp9_decoder | 206 [ -f ${source_path}/../include/vpx/vp9dx.h ] || disable_feature vp9_decoder |
| 207 | 207 |
| 208 [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt | 208 [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt |
| 209 fi | 209 fi |
| 210 | 210 |
| 211 CODECS="$(echo ${CODECS} | tr ' ' '\n')" | 211 CODECS="$(echo ${CODECS} | tr ' ' '\n')" |
| 212 CODEC_FAMILIES="$(for c in ${CODECS}; do echo ${c%_*}; done | sort | uniq)" | 212 CODEC_FAMILIES="$(for c in ${CODECS}; do echo ${c%_*}; done | sort | uniq)" |
| 213 | 213 |
| 214 ARCH_LIST=" | 214 ARCH_LIST=" |
| 215 arm | 215 arm |
| 216 mips | 216 mips |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 multiple_arf | 250 multiple_arf |
| 251 non420 | 251 non420 |
| 252 alpha | 252 alpha |
| 253 " | 253 " |
| 254 CONFIG_LIST=" | 254 CONFIG_LIST=" |
| 255 external_build | 255 external_build |
| 256 install_docs | 256 install_docs |
| 257 install_bins | 257 install_bins |
| 258 install_libs | 258 install_libs |
| 259 install_srcs | 259 install_srcs |
| 260 use_x86inc |
| 260 debug | 261 debug |
| 261 gprof | 262 gprof |
| 262 gcov | 263 gcov |
| 263 rvct | 264 rvct |
| 264 gcc | 265 gcc |
| 265 msvs | 266 msvs |
| 266 pic | 267 pic |
| 267 big_endian | 268 big_endian |
| 268 | 269 |
| 269 codec_srcs | 270 codec_srcs |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 extra_warnings | 307 extra_warnings |
| 307 werror | 308 werror |
| 308 install_docs | 309 install_docs |
| 309 install_bins | 310 install_bins |
| 310 install_libs | 311 install_libs |
| 311 install_srcs | 312 install_srcs |
| 312 debug | 313 debug |
| 313 gprof | 314 gprof |
| 314 gcov | 315 gcov |
| 315 pic | 316 pic |
| 317 use_x86inc |
| 316 optimizations | 318 optimizations |
| 317 ccache | 319 ccache |
| 318 runtime_cpu_detect | 320 runtime_cpu_detect |
| 319 thumb | 321 thumb |
| 320 | 322 |
| 321 libs | 323 libs |
| 322 examples | 324 examples |
| 323 docs | 325 docs |
| 324 libc | 326 libc |
| 325 as | 327 as |
| (...skipping 23 matching lines...) Expand all Loading... |
| 349 multi_res_encoding | 351 multi_res_encoding |
| 350 temporal_denoising | 352 temporal_denoising |
| 351 experimental | 353 experimental |
| 352 decrypt | 354 decrypt |
| 353 " | 355 " |
| 354 | 356 |
| 355 process_cmdline() { | 357 process_cmdline() { |
| 356 for opt do | 358 for opt do |
| 357 optval="${opt#*=}" | 359 optval="${opt#*=}" |
| 358 case "$opt" in | 360 case "$opt" in |
| 359 --disable-codecs) for c in ${CODECS}; do disable $c; done ;; | 361 --disable-codecs) for c in ${CODECS}; do disable_feature $c; done ;; |
| 360 --enable-?*|--disable-?*) | 362 --enable-?*|--disable-?*) |
| 361 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | 363 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
| 362 if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then | 364 if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then |
| 363 if enabled experimental; then | 365 if enabled experimental; then |
| 364 $action $option | 366 ${action}_feature $option |
| 365 else | 367 else |
| 366 log_echo "Ignoring $opt -- not in experimental mode." | 368 log_echo "Ignoring $opt -- not in experimental mode." |
| 367 fi | 369 fi |
| 368 else | 370 else |
| 369 process_common_cmdline $opt | 371 process_common_cmdline $opt |
| 370 fi | 372 fi |
| 371 ;; | 373 ;; |
| 372 *) process_common_cmdline "$opt" | 374 *) process_common_cmdline "$opt" |
| 373 ;; | 375 ;; |
| 374 esac | 376 esac |
| 375 done | 377 done |
| 376 } | 378 } |
| 377 | 379 |
| 378 post_process_cmdline() { | 380 post_process_cmdline() { |
| 379 local c | 381 local c |
| 380 | 382 |
| 381 # If the codec family is disabled, disable all components of that family. | 383 # If the codec family is disabled, disable all components of that family. |
| 382 # If the codec family is enabled, enable all components of that family. | 384 # If the codec family is enabled, enable all components of that family. |
| 383 log_echo "Configuring selected codecs" | 385 log_echo "Configuring selected codecs" |
| 384 for c in ${CODECS}; do | 386 for c in ${CODECS}; do |
| 385 disabled ${c%%_*} && disable ${c} | 387 disabled ${c%%_*} && disable_feature ${c} |
| 386 enabled ${c%%_*} && enable ${c} | 388 enabled ${c%%_*} && enable_feature ${c} |
| 387 done | 389 done |
| 388 | 390 |
| 389 # Enable all detected codecs, if they haven't been disabled | 391 # Enable all detected codecs, if they haven't been disabled |
| 390 for c in ${CODECS}; do soft_enable $c; done | 392 for c in ${CODECS}; do soft_enable $c; done |
| 391 | 393 |
| 392 # Enable the codec family if any component of that family is enabled | 394 # Enable the codec family if any component of that family is enabled |
| 393 for c in ${CODECS}; do | 395 for c in ${CODECS}; do |
| 394 enabled $c && enable ${c%_*} | 396 enabled $c && enable_feature ${c%_*} |
| 395 done | 397 done |
| 396 | 398 |
| 397 # Set the {en,de}coders variable if any algorithm in that class is enabled | 399 # Set the {en,de}coders variable if any algorithm in that class is enabled |
| 398 for c in ${CODECS}; do | 400 for c in ${CODECS}; do |
| 399 enabled ${c} && enable ${c##*_}s | 401 enabled ${c} && enable_feature ${c##*_}s |
| 400 done | 402 done |
| 401 } | 403 } |
| 402 | 404 |
| 403 | 405 |
| 404 process_targets() { | 406 process_targets() { |
| 405 enabled child || write_common_config_banner | 407 enabled child || write_common_config_banner |
| 406 enabled universal || write_common_target_config_h ${BUILD_PFX}vpx_config.h | 408 enabled universal || write_common_target_config_h ${BUILD_PFX}vpx_config.h |
| 407 | 409 |
| 408 # TODO: add host tools target (obj_int_extract, etc) | 410 # TODO: add host tools target (obj_int_extract, etc) |
| 409 | 411 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if ! enabled linux; then | 501 if ! enabled linux; then |
| 500 if enabled gnu; then | 502 if enabled gnu; then |
| 501 echo "--enable-shared is only supported on ELF; assuming this is
OK" | 503 echo "--enable-shared is only supported on ELF; assuming this is
OK" |
| 502 else | 504 else |
| 503 die "--enable-shared only supported on ELF for now" | 505 die "--enable-shared only supported on ELF for now" |
| 504 fi | 506 fi |
| 505 fi | 507 fi |
| 506 fi | 508 fi |
| 507 if [ -z "$CC" ] || enabled external_build; then | 509 if [ -z "$CC" ] || enabled external_build; then |
| 508 echo "Bypassing toolchain for environment detection." | 510 echo "Bypassing toolchain for environment detection." |
| 509 enable external_build | 511 enable_feature external_build |
| 510 check_header() { | 512 check_header() { |
| 511 log fake_check_header "$@" | 513 log fake_check_header "$@" |
| 512 header=$1 | 514 header=$1 |
| 513 shift | 515 shift |
| 514 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` | 516 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
| 515 disable $var | 517 disable_feature $var |
| 516 # Headers common to all environments | 518 # Headers common to all environments |
| 517 case $header in | 519 case $header in |
| 518 stdio.h) | 520 stdio.h) |
| 519 true; | 521 true; |
| 520 ;; | 522 ;; |
| 521 *) | 523 *) |
| 522 local result=false | 524 local result=false |
| 523 for d in "$@"; do | 525 for d in "$@"; do |
| 524 [ -f "${d##-I}/$header" ] && result=true && break | 526 [ -f "${d##-I}/$header" ] && result=true && break |
| 525 done | 527 done |
| 526 ${result:-true} | 528 ${result:-true} |
| 527 esac && enable $var | 529 esac && enable_feature $var |
| 528 | 530 |
| 529 # Specialize windows and POSIX environments. | 531 # Specialize windows and POSIX environments. |
| 530 case $toolchain in | 532 case $toolchain in |
| 531 *-win*-*) | 533 *-win*-*) |
| 532 case $header-$toolchain in | 534 case $header-$toolchain in |
| 533 stdint*-gcc) true;; | 535 stdint*-gcc) true;; |
| 534 *) false;; | 536 *) false;; |
| 535 esac && enable $var | 537 esac && enable_feature $var |
| 536 ;; | 538 ;; |
| 537 *) | 539 *) |
| 538 case $header in | 540 case $header in |
| 539 stdint.h) true;; | 541 stdint.h) true;; |
| 540 pthread.h) true;; | 542 pthread.h) true;; |
| 541 sys/mman.h) true;; | 543 sys/mman.h) true;; |
| 542 unistd.h) true;; | 544 unistd.h) true;; |
| 543 *) false;; | 545 *) false;; |
| 544 esac && enable $var | 546 esac && enable_feature $var |
| 545 esac | 547 esac |
| 546 enabled $var | 548 enabled $var |
| 547 } | 549 } |
| 548 check_ld() { | 550 check_ld() { |
| 549 true | 551 true |
| 550 } | 552 } |
| 551 fi | 553 fi |
| 552 check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}" | 554 check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}" |
| 553 check_ld <<EOF || die "Toolchain is unable to link executables" | 555 check_ld <<EOF || die "Toolchain is unable to link executables" |
| 554 int main(void) {return 0;} | 556 int main(void) {return 0;} |
| 555 EOF | 557 EOF |
| 556 # check system headers | 558 # check system headers |
| 557 check_header stdint.h | 559 check_header stdint.h |
| 558 check_header pthread.h | 560 check_header pthread.h |
| 559 check_header sys/mman.h | 561 check_header sys/mman.h |
| 560 check_header unistd.h # for sysconf(3) and friends. | 562 check_header unistd.h # for sysconf(3) and friends. |
| 561 | 563 |
| 562 check_header vpx/vpx_integer.h -I${source_path} && enable vpx_ports | 564 check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports |
| 563 } | 565 } |
| 564 | 566 |
| 565 process_toolchain() { | 567 process_toolchain() { |
| 566 process_common_toolchain | 568 process_common_toolchain |
| 567 | 569 |
| 568 # Handle universal binaries for this architecture | 570 # Handle universal binaries for this architecture |
| 569 case $toolchain in | 571 case $toolchain in |
| 570 universal-darwin*) | 572 universal-darwin*) |
| 571 local darwin_ver=${tgt_os##darwin} | 573 local darwin_ver=${tgt_os##darwin} |
| 572 | 574 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 if enabled extra_warnings; then | 636 if enabled extra_warnings; then |
| 635 for w in ${EXTRA_WARNINGS}; do | 637 for w in ${EXTRA_WARNINGS}; do |
| 636 check_add_cflags ${w} | 638 check_add_cflags ${w} |
| 637 enabled gcc && enabled werror && check_add_cflags -Wno-error=${w} | 639 enabled gcc && enabled werror && check_add_cflags -Wno-error=${w} |
| 638 done | 640 done |
| 639 fi | 641 fi |
| 640 | 642 |
| 641 # ccache only really works on gcc toolchains | 643 # ccache only really works on gcc toolchains |
| 642 enabled gcc || soft_disable ccache | 644 enabled gcc || soft_disable ccache |
| 643 if enabled mips; then | 645 if enabled mips; then |
| 644 enable dequant_tokens | 646 enable_feature dequant_tokens |
| 645 enable dc_recon | 647 enable_feature dc_recon |
| 646 fi | 648 fi |
| 647 | 649 |
| 648 # Enable the postbuild target if building for visual studio. | 650 # Enable the postbuild target if building for visual studio. |
| 649 case "$tgt_cc" in | 651 case "$tgt_cc" in |
| 650 vs*) enable msvs | 652 vs*) enable_feature msvs |
| 651 enable solution | 653 enable_feature solution |
| 652 vs_version=${tgt_cc##vs} | 654 vs_version=${tgt_cc##vs} |
| 653 case $vs_version in | 655 case $vs_version in |
| 654 [789]) | 656 [789]) |
| 655 VCPROJ_SFX=vcproj | 657 VCPROJ_SFX=vcproj |
| 656 gen_vcproj_cmd=${source_path}/build/make/gen_msvs_proj.sh | 658 gen_vcproj_cmd=${source_path}/build/make/gen_msvs_proj.sh |
| 657 ;; | 659 ;; |
| 658 10|11) | 660 10|11) |
| 659 VCPROJ_SFX=vcxproj | 661 VCPROJ_SFX=vcxproj |
| 660 gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh | 662 gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh |
| 661 ;; | 663 ;; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 ## | 706 ## |
| 705 ## END APPLICATION SPECIFIC CONFIGURATION | 707 ## END APPLICATION SPECIFIC CONFIGURATION |
| 706 ## | 708 ## |
| 707 CONFIGURE_ARGS="$@" | 709 CONFIGURE_ARGS="$@" |
| 708 process "$@" | 710 process "$@" |
| 709 print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */" | 711 print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */" |
| 710 cat <<EOF >> ${BUILD_PFX}vpx_config.c | 712 cat <<EOF >> ${BUILD_PFX}vpx_config.c |
| 711 static const char* const cfg = "$CONFIGURE_ARGS"; | 713 static const char* const cfg = "$CONFIGURE_ARGS"; |
| 712 const char *vpx_codec_build_config(void) {return cfg;} | 714 const char *vpx_codec_build_config(void) {return cfg;} |
| 713 EOF | 715 EOF |
| OLD | NEW |