| OLD | NEW | 
|---|
| 1 #!/bin/bash | 1 #!/bin/bash | 
| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 405     print_config_mk HAVE   "${1}" gnu_strip | 405     print_config_mk HAVE   "${1}" gnu_strip | 
| 406 | 406 | 
| 407     enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" | 407     enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" | 
| 408 | 408 | 
| 409 } | 409 } | 
| 410 | 410 | 
| 411 | 411 | 
| 412 write_common_target_config_h() { | 412 write_common_target_config_h() { | 
| 413     cat > ${TMP_H} << EOF | 413     cat > ${TMP_H} << EOF | 
| 414 /* This file automatically generated by configure. Do not edit! */ | 414 /* This file automatically generated by configure. Do not edit! */ | 
|  | 415 #ifndef VPX_CONFIG_H | 
|  | 416 #define VPX_CONFIG_H | 
| 415 #define RESTRICT    ${RESTRICT} | 417 #define RESTRICT    ${RESTRICT} | 
| 416 EOF | 418 EOF | 
| 417     print_config_h ARCH   "${TMP_H}" ${ARCH_LIST} | 419     print_config_h ARCH   "${TMP_H}" ${ARCH_LIST} | 
| 418     print_config_h HAVE   "${TMP_H}" ${HAVE_LIST} | 420     print_config_h HAVE   "${TMP_H}" ${HAVE_LIST} | 
| 419     print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} | 421     print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} | 
|  | 422     echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} | 
| 420     mkdir -p `dirname "$1"` | 423     mkdir -p `dirname "$1"` | 
| 421     cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" | 424     cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" | 
| 422 } | 425 } | 
| 423 | 426 | 
| 424 process_common_cmdline() { | 427 process_common_cmdline() { | 
| 425     for opt in "$@"; do | 428     for opt in "$@"; do | 
| 426         optval="${opt#*=}" | 429         optval="${opt#*=}" | 
| 427         case "$opt" in | 430         case "$opt" in | 
| 428         --child) enable child | 431         --child) enable child | 
| 429         ;; | 432         ;; | 
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 619             add_cflags  "-mmacosx-version-min=10.6" | 622             add_cflags  "-mmacosx-version-min=10.6" | 
| 620             add_ldflags "-isysroot /Developer/SDKs/MacOSX10.6.sdk" | 623             add_ldflags "-isysroot /Developer/SDKs/MacOSX10.6.sdk" | 
| 621             add_ldflags "-mmacosx-version-min=10.6" | 624             add_ldflags "-mmacosx-version-min=10.6" | 
| 622             ;; | 625             ;; | 
| 623     esac | 626     esac | 
| 624 | 627 | 
| 625     # Handle Solaris variants. Solaris 10 needs -lposix4 | 628     # Handle Solaris variants. Solaris 10 needs -lposix4 | 
| 626     case ${toolchain} in | 629     case ${toolchain} in | 
| 627         sparc-solaris-*) | 630         sparc-solaris-*) | 
| 628             add_extralibs -lposix4 | 631             add_extralibs -lposix4 | 
| 629             add_cflags "-DMUST_BE_ALIGNED" | 632             disable fast_unaligned | 
| 630             ;; | 633             ;; | 
| 631         *-solaris-*) | 634         *-solaris-*) | 
| 632             add_extralibs -lposix4 | 635             add_extralibs -lposix4 | 
| 633             ;; | 636             ;; | 
| 634     esac | 637     esac | 
| 635 | 638 | 
| 636     # Process ARM architecture variants | 639     # Process ARM architecture variants | 
| 637     case ${toolchain} in | 640     case ${toolchain} in | 
| 638     arm*|iwmmxt*) | 641     arm*|iwmmxt*) | 
| 639     # on arm, isa versions are supersets | 642     # on arm, isa versions are supersets | 
| 640     enabled armv7a && soft_enable armv7 ### DEBUG | 643     enabled armv7a && soft_enable armv7 ### DEBUG | 
| 641     enabled armv7 && soft_enable armv6 | 644     enabled armv7 && soft_enable armv6 | 
| 642     enabled armv6 && soft_enable armv5te | 645     enabled armv7 || enabled armv6 && soft_enable armv5te | 
| 643     enabled armv6 && soft_enable fast_unaligned | 646     enabled armv7 || enabled armv6 && soft_enable fast_unaligned | 
| 644     enabled iwmmxt2 && soft_enable iwmmxt | 647     enabled iwmmxt2 && soft_enable iwmmxt | 
| 645     enabled iwmmxt && soft_enable armv5te | 648     enabled iwmmxt && soft_enable armv5te | 
| 646 | 649 | 
| 647     asm_conversion_cmd="cat" | 650     asm_conversion_cmd="cat" | 
| 648 | 651 | 
| 649         case ${tgt_cc} in | 652         case ${tgt_cc} in | 
| 650         gcc) | 653         gcc) | 
| 651         if enabled iwmmxt || enabled iwmmxt2 | 654         if enabled iwmmxt || enabled iwmmxt2 | 
| 652             then | 655             then | 
| 653                 CROSS=${CROSS:-arm-iwmmxt-linux-gnueabi-} | 656                 CROSS=${CROSS:-arm-iwmmxt-linux-gnueabi-} | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 682             AS=armasm | 685             AS=armasm | 
| 683             LD=${source_path}/build/make/armlink_adapter.sh | 686             LD=${source_path}/build/make/armlink_adapter.sh | 
| 684             STRIP=arm-none-linux-gnueabi-strip | 687             STRIP=arm-none-linux-gnueabi-strip | 
| 685             NM=arm-none-linux-gnueabi-nm | 688             NM=arm-none-linux-gnueabi-nm | 
| 686             tune_cflags="--cpu=" | 689             tune_cflags="--cpu=" | 
| 687             tune_asflags="--cpu=" | 690             tune_asflags="--cpu=" | 
| 688             if [ -z "${tune_cpu}" ]; then | 691             if [ -z "${tune_cpu}" ]; then | 
| 689             if enabled armv7 | 692             if enabled armv7 | 
| 690                 then | 693                 then | 
| 691                     check_add_cflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3 | 694                     check_add_cflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3 | 
| 692                     check_add_asflags --cpu=Cortex-A8 --fpu=none | 695                     check_add_asflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3 | 
| 693                 else | 696                 else | 
| 694                     check_add_cflags --cpu=${tgt_isa##armv} | 697                     check_add_cflags --cpu=${tgt_isa##armv} | 
| 695                     check_add_asflags --cpu=${tgt_isa##armv} | 698                     check_add_asflags --cpu=${tgt_isa##armv} | 
| 696                 fi | 699                 fi | 
| 697             fi | 700             fi | 
| 698             arch_int=${tgt_isa##armv} | 701             arch_int=${tgt_isa##armv} | 
| 699             arch_int=${arch_int%%te} | 702             arch_int=${arch_int%%te} | 
| 700             check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" | 703             check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" | 
| 701             enabled debug && add_asflags -g | 704             enabled debug && add_asflags -g | 
| 702             add_cflags --gnu | 705             add_cflags --gnu | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 722             AS_SFX=.s | 725             AS_SFX=.s | 
| 723 | 726 | 
| 724             # ASFLAGS is written here instead of using check_add_asflags | 727             # ASFLAGS is written here instead of using check_add_asflags | 
| 725             # because we need to overwrite all of ASFLAGS and purge the | 728             # because we need to overwrite all of ASFLAGS and purge the | 
| 726             # options that were put in above | 729             # options that were put in above | 
| 727             ASFLAGS="-version -arch ${tgt_isa} -g" | 730             ASFLAGS="-version -arch ${tgt_isa} -g" | 
| 728 | 731 | 
| 729             add_cflags -arch ${tgt_isa} | 732             add_cflags -arch ${tgt_isa} | 
| 730             add_ldflags -arch_only ${tgt_isa} | 733             add_ldflags -arch_only ${tgt_isa} | 
| 731 | 734 | 
| 732             add_cflags  "-isysroot /Developer/Platforms/iPhoneOS.platform/Develo
      per/SDKs/iPhoneOS4.2.sdk" | 735             add_cflags  "-isysroot ${SDK_PATH}/SDKs/iPhoneOS4.3.sdk" | 
| 733 | 736 | 
| 734             # This should be overridable | 737             # This should be overridable | 
| 735             alt_libc=${SDK_PATH}/SDKs/iPhoneOS4.2.sdk | 738             alt_libc=${SDK_PATH}/SDKs/iPhoneOS4.3.sdk | 
| 736 | 739 | 
| 737             # Add the paths for the alternate libc | 740             # Add the paths for the alternate libc | 
| 738 #            for d in usr/include usr/include/gcc/darwin/4.0/; do | 741             for d in usr/include usr/include/gcc/darwin/4.2/ usr/lib/gcc/arm-app
      le-darwin10/4.2.1/include/; do | 
| 739             for d in usr/include usr/include/gcc/darwin/4.0/ usr/lib/gcc/arm-app
      le-darwin10/4.2.1/include/; do |  | 
| 740                 try_dir="${alt_libc}/${d}" | 742                 try_dir="${alt_libc}/${d}" | 
| 741                 [ -d "${try_dir}" ] && add_cflags -I"${try_dir}" | 743                 [ -d "${try_dir}" ] && add_cflags -I"${try_dir}" | 
| 742             done | 744             done | 
| 743 | 745 | 
| 744             for d in lib usr/lib; do | 746             for d in lib usr/lib usr/lib/system; do | 
| 745                 try_dir="${alt_libc}/${d}" | 747                 try_dir="${alt_libc}/${d}" | 
| 746                 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" | 748                 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" | 
| 747             done | 749             done | 
| 748 | 750 | 
| 749             asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" | 751             asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" | 
| 750          ;; | 752          ;; | 
| 751 | 753 | 
| 752         linux*) | 754         linux*) | 
| 753             enable linux | 755             enable linux | 
| 754             if enabled rvct; then | 756             if enabled rvct; then | 
| 755                 # Compiling with RVCT requires an alternate libc (glibc) when | 757                 # Check if we have CodeSourcery GCC in PATH. Needed for | 
| 756                 # targetting linux. | 758                 # libraries | 
| 757                 disabled builtin_libc \ | 759                 hash arm-none-linux-gnueabi-gcc 2>&- || \ | 
| 758                     || die "Must supply --libc when targetting *-linux-rvct" | 760                   die "Couldn't find CodeSourcery GCC from PATH" | 
| 759 | 761 | 
| 760                 # Set up compiler | 762                 # Use armcc as a linker to enable translation of | 
| 761                 add_cflags --library_interface=aeabi_glibc | 763                 # some gcc specific options such as -lm and -lpthread. | 
| 762                 add_cflags --no_hide_all | 764                 LD="armcc --translate_gcc" | 
| 763                 add_cflags --dwarf2 |  | 
| 764 | 765 | 
| 765                 # Set up linker | 766                 # create configuration file (uses path to CodeSourcery GCC) | 
| 766                 add_ldflags --sysv --no_startup --no_ref_cpp_init | 767                 armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cf
      g | 
| 767                 add_ldflags --entry=_start |  | 
| 768                 add_ldflags --keep '"*(.init)"' --keep '"*(.fini)"' |  | 
| 769                 add_ldflags --keep '"*(.init_array)"' --keep '"*(.fini_array)"' |  | 
| 770                 add_ldflags --dynamiclinker=/lib/ld-linux.so.3 |  | 
| 771                 add_extralibs libc.so.6 -lc_nonshared crt1.o crti.o crtn.o |  | 
| 772 | 768 | 
| 773                 # Add the paths for the alternate libc | 769                 add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.c
      fg | 
| 774                 for d in usr/include; do | 770                 add_asflags --no_hide_all --apcs=/interwork | 
| 775                     try_dir="${alt_libc}/${d}" | 771                 add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.
      cfg | 
| 776                     [ -d "${try_dir}" ] && add_cflags -J"${try_dir}" | 772                 enabled pic && add_cflags --apcs=/fpic | 
| 777                 done | 773                 enabled pic && add_asflags --apcs=/fpic | 
| 778                 add_cflags -J"${RVCT31INC}" | 774                 enabled shared && add_cflags --shared | 
| 779                 for d in lib usr/lib; do |  | 
| 780                     try_dir="${alt_libc}/${d}" |  | 
| 781                     [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" |  | 
| 782                 done |  | 
| 783 |  | 
| 784 |  | 
| 785                 # glibc has some struct members named __align, which is a |  | 
| 786                 # storage modifier in RVCT. If we need to use this modifier, |  | 
| 787                 # we'll have to #undef it in our code. Note that this must |  | 
| 788                 # happen AFTER all libc inclues. |  | 
| 789                 add_cflags -D__align=x_align_x |  | 
| 790             fi | 775             fi | 
| 791         ;; | 776         ;; | 
| 792 | 777 | 
| 793         symbian*) | 778         symbian*) | 
| 794             enable symbian | 779             enable symbian | 
| 795             # Add the paths for the alternate libc | 780             # Add the paths for the alternate libc | 
| 796             for d in include/libc; do | 781             for d in include/libc; do | 
| 797                 try_dir="${alt_libc}/${d}" | 782                 try_dir="${alt_libc}/${d}" | 
| 798                 [ -d "${try_dir}" ] && add_cflags -I"${try_dir}" | 783                 [ -d "${try_dir}" ] && add_cflags -I"${try_dir}" | 
| 799             done | 784             done | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 878                         tune_cflags="-march=" | 863                         tune_cflags="-march=" | 
| 879                     ;; | 864                     ;; | 
| 880                 esac | 865                 esac | 
| 881                 ;; | 866                 ;; | 
| 882             gcc*) | 867             gcc*) | 
| 883                 add_cflags  -m${bits} | 868                 add_cflags  -m${bits} | 
| 884                 add_ldflags -m${bits} | 869                 add_ldflags -m${bits} | 
| 885                 link_with_cc=gcc | 870                 link_with_cc=gcc | 
| 886                 tune_cflags="-march=" | 871                 tune_cflags="-march=" | 
| 887             setup_gnu_toolchain | 872             setup_gnu_toolchain | 
|  | 873                 #for 32 bit x86 builds, -O3 did not turn on this flag | 
|  | 874                 enabled optimizations && check_add_cflags -fomit-frame-pointer | 
| 888                 ;; | 875                 ;; | 
| 889         esac | 876         esac | 
| 890 | 877 | 
| 891         case "${AS}" in | 878         case "${AS}" in | 
| 892             auto|"") | 879             auto|"") | 
| 893                 which nasm >/dev/null 2>&1 && AS=nasm | 880                 which nasm >/dev/null 2>&1 && AS=nasm | 
| 894                 which yasm >/dev/null 2>&1 && AS=yasm | 881                 which yasm >/dev/null 2>&1 && AS=yasm | 
| 895                 [ "${AS}" = auto -o -z "${AS}" ] \ | 882                 [ "${AS}" = auto -o -z "${AS}" ] \ | 
| 896                     && die "Neither yasm nor nasm have been found" | 883                     && die "Neither yasm nor nasm have been found" | 
| 897                 ;; | 884                 ;; | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 945     if [ -z "${tune_cflags}${tune_asflags}" ]; then | 932     if [ -z "${tune_cflags}${tune_asflags}" ]; then | 
| 946             log_echo "Warning: CPU tuning not supported by this toolchain" | 933             log_echo "Warning: CPU tuning not supported by this toolchain" | 
| 947         fi | 934         fi | 
| 948     fi | 935     fi | 
| 949 | 936 | 
| 950     enabled debug && check_add_cflags -g && check_add_ldflags -g | 937     enabled debug && check_add_cflags -g && check_add_ldflags -g | 
| 951     enabled gprof && check_add_cflags -pg && check_add_ldflags -pg | 938     enabled gprof && check_add_cflags -pg && check_add_ldflags -pg | 
| 952     enabled gcov && | 939     enabled gcov && | 
| 953         check_add_cflags -fprofile-arcs -ftest-coverage && | 940         check_add_cflags -fprofile-arcs -ftest-coverage && | 
| 954         check_add_ldflags -fprofile-arcs -ftest-coverage | 941         check_add_ldflags -fprofile-arcs -ftest-coverage | 
|  | 942 | 
| 955     if enabled optimizations; then | 943     if enabled optimizations; then | 
| 956         enabled rvct && check_add_cflags -Otime | 944         if enabled rvct; then | 
| 957         enabled small && check_add_cflags -O2 || check_add_cflags -O3 | 945             enabled small && check_add_cflags -Ospace || check_add_cflags -Otime | 
|  | 946         else | 
|  | 947             enabled small && check_add_cflags -O2 ||  check_add_cflags -O3 | 
|  | 948         fi | 
| 958     fi | 949     fi | 
| 959 | 950 | 
| 960     # Position Independent Code (PIC) support, for building relocatable | 951     # Position Independent Code (PIC) support, for building relocatable | 
| 961     # shared objects | 952     # shared objects | 
| 962     enabled gcc && enabled pic && check_add_cflags -fPIC | 953     enabled gcc && enabled pic && check_add_cflags -fPIC | 
| 963 | 954 | 
|  | 955     # Work around longjmp interception on glibc >= 2.11, to improve binary | 
|  | 956     # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 | 
|  | 957     enabled linux && check_add_cflags -D_FORTIFY_SOURCE=0 | 
|  | 958 | 
| 964     # Check for strip utility variant | 959     # Check for strip utility variant | 
| 965     ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip | 960     ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip | 
| 966 | 961 | 
| 967     # Try to determine target endianness | 962     # Try to determine target endianness | 
| 968     check_cc <<EOF | 963     check_cc <<EOF | 
| 969     unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; | 964     unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; | 
| 970 EOF | 965 EOF | 
| 971     [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | | 966     [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | | 
| 972         grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian | 967         grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian | 
| 973 | 968 | 
| 974     # Almost every platform uses pthreads. | 969     # Almost every platform uses pthreads. | 
| 975     if enabled multithread; then | 970     if enabled multithread; then | 
| 976         case ${toolchain} in | 971         case ${toolchain} in | 
| 977             *-win*);; | 972             *-win*);; | 
| 978             *) check_header pthread.h && add_extralibs -lpthread | 973             *) check_header pthread.h && add_extralibs -lpthread | 
| 979         esac | 974         esac | 
| 980     fi | 975     fi | 
| 981 | 976 | 
|  | 977     # for sysconf(3) and friends. | 
|  | 978     check_header unistd.h | 
|  | 979 | 
| 982     # glibc needs these | 980     # glibc needs these | 
| 983     if enabled linux; then | 981     if enabled linux; then | 
| 984         add_cflags -D_LARGEFILE_SOURCE | 982         add_cflags -D_LARGEFILE_SOURCE | 
| 985         add_cflags -D_FILE_OFFSET_BITS=64 | 983         add_cflags -D_FILE_OFFSET_BITS=64 | 
| 986     fi | 984     fi | 
| 987 | 985 | 
| 988     # append any user defined extra cflags | 986     # append any user defined extra cflags | 
| 989     if [ -n "${extra_cflags}" ] ; then | 987     if [ -n "${extra_cflags}" ] ; then | 
| 990         check_add_cflags ${extra_cflags} || \ | 988         check_add_cflags ${extra_cflags} || \ | 
| 991         die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" | 989         die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1052     # Prepare the PWD for building. | 1050     # Prepare the PWD for building. | 
| 1053     for f in ${OOT_INSTALLS}; do | 1051     for f in ${OOT_INSTALLS}; do | 
| 1054             install -D ${source_path}/$f $f | 1052             install -D ${source_path}/$f $f | 
| 1055     done | 1053     done | 
| 1056     fi | 1054     fi | 
| 1057     cp ${source_path}/build/make/Makefile . | 1055     cp ${source_path}/build/make/Makefile . | 
| 1058 | 1056 | 
| 1059     clean_temp_files | 1057     clean_temp_files | 
| 1060     true | 1058     true | 
| 1061 } | 1059 } | 
| OLD | NEW | 
|---|