OLD | NEW |
1 #!/bin/bash | 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 ## |
11 | 11 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 | 192 |
193 | 193 |
194 add_extralibs() { | 194 add_extralibs() { |
195 extralibs="${extralibs} $@" | 195 extralibs="${extralibs} $@" |
196 } | 196 } |
197 | 197 |
198 # | 198 # |
199 # Boolean Manipulation Functions | 199 # Boolean Manipulation Functions |
200 # | 200 # |
201 enable(){ | 201 enable_feature(){ |
202 set_all yes $* | 202 set_all yes $* |
203 } | 203 } |
204 | 204 |
205 disable(){ | 205 disable_feature(){ |
206 set_all no $* | 206 set_all no $* |
207 } | 207 } |
208 | 208 |
209 enabled(){ | 209 enabled(){ |
210 eval test "x\$$1" = "xyes" | 210 eval test "x\$$1" = "xyes" |
211 } | 211 } |
212 | 212 |
213 disabled(){ | 213 disabled(){ |
214 eval test "x\$$1" = "xno" | 214 eval test "x\$$1" = "xno" |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 soft_enable() { | 218 soft_enable() { |
219 for var in $*; do | 219 for var in $*; do |
220 if ! disabled $var; then | 220 if ! disabled $var; then |
221 log_echo " enabling $var" | 221 log_echo " enabling $var" |
222 enable $var | 222 enable_feature $var |
223 fi | 223 fi |
224 done | 224 done |
225 } | 225 } |
226 | 226 |
227 soft_disable() { | 227 soft_disable() { |
228 for var in $*; do | 228 for var in $*; do |
229 if ! enabled $var; then | 229 if ! enabled $var; then |
230 log_echo " disabling $var" | 230 log_echo " disabling $var" |
231 disable $var | 231 disable_feature $var |
232 fi | 232 fi |
233 done | 233 done |
234 } | 234 } |
235 | 235 |
236 | 236 |
237 # | 237 # |
238 # Text Processing Functions | 238 # Text Processing Functions |
239 # | 239 # |
240 toupper(){ | 240 toupper(){ |
241 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | 241 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 tolower(){ | 245 tolower(){ |
246 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | 246 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 # | 250 # |
251 # Temporary File Functions | 251 # Temporary File Functions |
252 # | 252 # |
253 source_path=${0%/*} | 253 source_path=${0%/*} |
254 enable source_path_used | 254 enable_feature source_path_used |
255 if test -z "$source_path" -o "$source_path" = "." ; then | 255 if test -z "$source_path" -o "$source_path" = "." ; then |
256 source_path="`pwd`" | 256 source_path="`pwd`" |
257 disable source_path_used | 257 disable_feature source_path_used |
258 fi | 258 fi |
259 | 259 |
260 if test ! -z "$TMPDIR" ; then | 260 if test ! -z "$TMPDIR" ; then |
261 TMPDIRx="${TMPDIR}" | 261 TMPDIRx="${TMPDIR}" |
262 elif test ! -z "$TEMPDIR" ; then | 262 elif test ! -z "$TEMPDIR" ; then |
263 TMPDIRx="${TEMPDIR}" | 263 TMPDIRx="${TEMPDIR}" |
264 else | 264 else |
265 TMPDIRx="/tmp" | 265 TMPDIRx="/tmp" |
266 fi | 266 fi |
267 TMP_H="${TMPDIRx}/vpx-conf-$$-${RANDOM}.h" | 267 RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}') |
268 TMP_C="${TMPDIRx}/vpx-conf-$$-${RANDOM}.c" | 268 TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h" |
269 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RANDOM}.cc" | 269 TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c" |
270 TMP_O="${TMPDIRx}/vpx-conf-$$-${RANDOM}.o" | 270 TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc" |
271 TMP_X="${TMPDIRx}/vpx-conf-$$-${RANDOM}.x" | 271 TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o" |
272 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RANDOM}.asm" | 272 TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x" |
| 273 TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm" |
273 | 274 |
274 clean_temp_files() { | 275 clean_temp_files() { |
275 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} |
276 } | 277 } |
277 | 278 |
278 # | 279 # |
279 # Toolchain Check Functions | 280 # Toolchain Check Functions |
280 # | 281 # |
281 check_cmd() { | 282 check_cmd() { |
282 enabled external_build && return | 283 enabled external_build && return |
(...skipping 26 matching lines...) Expand all Loading... |
309 log check_ld "$@" | 310 log check_ld "$@" |
310 check_cc $@ \ | 311 check_cc $@ \ |
311 && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} | 312 && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} |
312 } | 313 } |
313 | 314 |
314 check_header(){ | 315 check_header(){ |
315 log check_header "$@" | 316 log check_header "$@" |
316 header=$1 | 317 header=$1 |
317 shift | 318 shift |
318 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` | 319 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
319 disable $var | 320 disable_feature $var |
320 check_cpp "$@" <<EOF && enable $var | 321 check_cpp "$@" <<EOF && enable_feature $var |
321 #include "$header" | 322 #include "$header" |
322 int x; | 323 int x; |
323 EOF | 324 EOF |
324 } | 325 } |
325 | 326 |
326 | 327 |
327 check_cflags() { | 328 check_cflags() { |
328 log check_cflags "$@" | 329 log check_cflags "$@" |
329 check_cc "$@" <<EOF | 330 check_cc "$@" <<EOF |
330 int x; | 331 int x; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} | 473 print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} |
473 echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} | 474 echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} |
474 mkdir -p `dirname "$1"` | 475 mkdir -p `dirname "$1"` |
475 cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" | 476 cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" |
476 } | 477 } |
477 | 478 |
478 process_common_cmdline() { | 479 process_common_cmdline() { |
479 for opt in "$@"; do | 480 for opt in "$@"; do |
480 optval="${opt#*=}" | 481 optval="${opt#*=}" |
481 case "$opt" in | 482 case "$opt" in |
482 --child) enable child | 483 --child) enable_feature child |
483 ;; | 484 ;; |
484 --log*) | 485 --log*) |
485 logging="$optval" | 486 logging="$optval" |
486 if ! disabled logging ; then | 487 if ! disabled logging ; then |
487 enabled logging || logfile="$logging" | 488 enabled logging || logfile="$logging" |
488 else | 489 else |
489 logfile=/dev/null | 490 logfile=/dev/null |
490 fi | 491 fi |
491 ;; | 492 ;; |
492 --target=*) toolchain="${toolchain:-${optval}}" | 493 --target=*) toolchain="${toolchain:-${optval}}" |
493 ;; | 494 ;; |
494 --force-target=*) toolchain="${toolchain:-${optval}}"; enable force_tool
chain | 495 --force-target=*) toolchain="${toolchain:-${optval}}"; enable_feature fo
rce_toolchain |
495 ;; | 496 ;; |
496 --cpu) | 497 --cpu) |
497 ;; | 498 ;; |
498 --cpu=*) tune_cpu="$optval" | 499 --cpu=*) tune_cpu="$optval" |
499 ;; | 500 ;; |
500 --extra-cflags=*) | 501 --extra-cflags=*) |
501 extra_cflags="${optval}" | 502 extra_cflags="${optval}" |
502 ;; | 503 ;; |
503 --enable-?*|--disable-?*) | 504 --enable-?*|--disable-?*) |
504 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | 505 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
505 if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then | 506 if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then |
506 [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " | 507 [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " |
507 elif [ $action = "disable" ] && ! disabled $option ; then | 508 elif [ $action = "disable" ] && ! disabled $option ; then |
508 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || | 509 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || |
509 die_unknown $opt | 510 die_unknown $opt |
510 elif [ $action = "enable" ] && ! enabled $option ; then | 511 elif [ $action = "enable" ] && ! enabled $option ; then |
511 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || | 512 echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null || |
512 die_unknown $opt | 513 die_unknown $opt |
513 fi | 514 fi |
514 $action $option | 515 ${action}_feature $option |
515 ;; | 516 ;; |
516 --require-?*) | 517 --require-?*) |
517 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | 518 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` |
518 if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then | 519 if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then |
519 RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " | 520 RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " |
520 else | 521 else |
521 die_unknown $opt | 522 die_unknown $opt |
522 fi | 523 fi |
523 ;; | 524 ;; |
524 --force-enable-?*|--force-disable-?*) | 525 --force-enable-?*|--force-disable-?*) |
525 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` | 526 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` |
526 $action $option | 527 ${action}_feature $option |
527 ;; | 528 ;; |
528 --libc=*) | 529 --libc=*) |
529 [ -d "${optval}" ] || die "Not a directory: ${optval}" | 530 [ -d "${optval}" ] || die "Not a directory: ${optval}" |
530 disable builtin_libc | 531 disable_feature builtin_libc |
531 alt_libc="${optval}" | 532 alt_libc="${optval}" |
532 ;; | 533 ;; |
533 --as=*) | 534 --as=*) |
534 [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \ | 535 [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \ |
535 || die "Must be yasm, nasm or auto: ${optval}" | 536 || die "Must be yasm, nasm or auto: ${optval}" |
536 alt_as="${optval}" | 537 alt_as="${optval}" |
537 ;; | 538 ;; |
538 --prefix=*) | 539 --prefix=*) |
539 prefix="${optval}" | 540 prefix="${optval}" |
540 ;; | 541 ;; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 690 |
690 # | 691 # |
691 # Set up toolchain variables | 692 # Set up toolchain variables |
692 # | 693 # |
693 tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') | 694 tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') |
694 tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') | 695 tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') |
695 tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') | 696 tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') |
696 | 697 |
697 # Mark the specific ISA requested as enabled | 698 # Mark the specific ISA requested as enabled |
698 soft_enable ${tgt_isa} | 699 soft_enable ${tgt_isa} |
699 enable ${tgt_os} | 700 enable_feature ${tgt_os} |
700 enable ${tgt_cc} | 701 enable_feature ${tgt_cc} |
701 | 702 |
702 # Enable the architecture family | 703 # Enable the architecture family |
703 case ${tgt_isa} in | 704 case ${tgt_isa} in |
704 arm*) enable arm;; | 705 arm*) enable_feature arm;; |
705 mips*) enable mips;; | 706 mips*) enable_feature mips;; |
706 esac | 707 esac |
707 | 708 |
708 # PIC is probably what we want when building shared libs | 709 # PIC is probably what we want when building shared libs |
709 enabled shared && soft_enable pic | 710 enabled shared && soft_enable pic |
710 | 711 |
711 # Handle darwin variants. Newer SDKs allow targeting older | 712 # Handle darwin variants. Newer SDKs allow targeting older |
712 # platforms, so find the newest SDK available. | 713 # platforms, so find the newest SDK available. |
713 case ${toolchain} in | 714 case ${toolchain} in |
714 *-darwin*) | 715 *-darwin*) |
715 if [ -z "${DEVELOPER_DIR}" ]; then | 716 if [ -z "${DEVELOPER_DIR}" ]; then |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 *-darwin13-*) | 759 *-darwin13-*) |
759 add_cflags "-mmacosx-version-min=10.9" | 760 add_cflags "-mmacosx-version-min=10.9" |
760 add_ldflags "-mmacosx-version-min=10.9" | 761 add_ldflags "-mmacosx-version-min=10.9" |
761 ;; | 762 ;; |
762 esac | 763 esac |
763 | 764 |
764 # Handle Solaris variants. Solaris 10 needs -lposix4 | 765 # Handle Solaris variants. Solaris 10 needs -lposix4 |
765 case ${toolchain} in | 766 case ${toolchain} in |
766 sparc-solaris-*) | 767 sparc-solaris-*) |
767 add_extralibs -lposix4 | 768 add_extralibs -lposix4 |
768 disable fast_unaligned | 769 disable_feature fast_unaligned |
769 ;; | 770 ;; |
770 *-solaris-*) | 771 *-solaris-*) |
771 add_extralibs -lposix4 | 772 add_extralibs -lposix4 |
772 ;; | 773 ;; |
773 esac | 774 esac |
774 | 775 |
775 # Process ARM architecture variants | 776 # Process ARM architecture variants |
776 case ${toolchain} in | 777 case ${toolchain} in |
777 arm*) | 778 arm*) |
778 # on arm, isa versions are supersets | 779 # on arm, isa versions are supersets |
779 case ${tgt_isa} in | 780 case ${tgt_isa} in |
780 armv7) | 781 armv7) |
781 soft_enable neon | 782 soft_enable neon |
782 soft_enable media | 783 soft_enable media |
783 soft_enable edsp | 784 soft_enable edsp |
784 soft_enable fast_unaligned | 785 soft_enable fast_unaligned |
785 ;; | 786 ;; |
786 armv6) | 787 armv6) |
787 soft_enable media | 788 soft_enable media |
788 soft_enable edsp | 789 soft_enable edsp |
789 soft_enable fast_unaligned | 790 soft_enable fast_unaligned |
790 ;; | 791 ;; |
791 armv5te) | 792 armv5te) |
792 soft_enable edsp | 793 soft_enable edsp |
793 disable fast_unaligned | 794 disable_feature fast_unaligned |
794 ;; | 795 ;; |
795 esac | 796 esac |
796 | 797 |
797 asm_conversion_cmd="cat" | 798 asm_conversion_cmd="cat" |
798 | 799 |
799 case ${tgt_cc} in | 800 case ${tgt_cc} in |
800 gcc) | 801 gcc) |
801 CROSS=${CROSS:-arm-none-linux-gnueabi-} | 802 CROSS=${CROSS:-arm-none-linux-gnueabi-} |
802 link_with_cc=gcc | 803 link_with_cc=gcc |
803 setup_gnu_toolchain | 804 setup_gnu_toolchain |
804 arch_int=${tgt_isa##armv} | 805 arch_int=${tgt_isa##armv} |
805 arch_int=${arch_int%%te} | 806 arch_int=${arch_int%%te} |
806 check_add_asflags --defsym ARCHITECTURE=${arch_int} | 807 check_add_asflags --defsym ARCHITECTURE=${arch_int} |
807 tune_cflags="-mtune=" | 808 tune_cflags="-mtune=" |
808 if [ ${tgt_isa} == "armv7" ]; then | 809 if [ ${tgt_isa} = "armv7" ]; then |
809 if [ -z "${float_abi}" ]; then | 810 if [ -z "${float_abi}" ]; then |
810 check_cpp <<EOF && float_abi=hard || float_abi=softfp | 811 check_cpp <<EOF && float_abi=hard || float_abi=softfp |
811 #ifndef __ARM_PCS_VFP | 812 #ifndef __ARM_PCS_VFP |
812 #error "not hardfp" | 813 #error "not hardfp" |
813 #endif | 814 #endif |
814 EOF | 815 EOF |
815 fi | 816 fi |
816 check_add_cflags -march=armv7-a -mfloat-abi=${float_abi} | 817 check_add_cflags -march=armv7-a -mfloat-abi=${float_abi} |
817 check_add_asflags -march=armv7-a -mfloat-abi=${float_abi} | 818 check_add_asflags -march=armv7-a -mfloat-abi=${float_abi} |
818 | 819 |
(...skipping 16 matching lines...) Expand all Loading... |
835 if enabled thumb; then | 836 if enabled thumb; then |
836 asm_conversion_cmd="$asm_conversion_cmd -thumb" | 837 asm_conversion_cmd="$asm_conversion_cmd -thumb" |
837 check_add_cflags -mthumb | 838 check_add_cflags -mthumb |
838 check_add_asflags -mthumb -mimplicit-it=always | 839 check_add_asflags -mthumb -mimplicit-it=always |
839 fi | 840 fi |
840 ;; | 841 ;; |
841 vs*) | 842 vs*) |
842 asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" | 843 asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" |
843 AS_SFX=.s | 844 AS_SFX=.s |
844 msvs_arch_dir=arm-msvs | 845 msvs_arch_dir=arm-msvs |
845 disable multithread | 846 disable_feature multithread |
846 disable unit_tests | 847 disable_feature unit_tests |
847 ;; | 848 ;; |
848 rvct) | 849 rvct) |
849 CC=armcc | 850 CC=armcc |
850 AR=armar | 851 AR=armar |
851 AS=armasm | 852 AS=armasm |
852 LD=${source_path}/build/make/armlink_adapter.sh | 853 LD=${source_path}/build/make/armlink_adapter.sh |
853 STRIP=arm-none-linux-gnueabi-strip | 854 STRIP=arm-none-linux-gnueabi-strip |
854 NM=arm-none-linux-gnueabi-nm | 855 NM=arm-none-linux-gnueabi-nm |
855 tune_cflags="--cpu=" | 856 tune_cflags="--cpu=" |
856 tune_asflags="--cpu=" | 857 tune_asflags="--cpu=" |
857 if [ -z "${tune_cpu}" ]; then | 858 if [ -z "${tune_cpu}" ]; then |
858 if [ ${tgt_isa} == "armv7" ]; then | 859 if [ ${tgt_isa} = "armv7" ]; then |
859 if enabled neon | 860 if enabled neon |
860 then | 861 then |
861 check_add_cflags --fpu=softvfp+vfpv3 | 862 check_add_cflags --fpu=softvfp+vfpv3 |
862 check_add_asflags --fpu=softvfp+vfpv3 | 863 check_add_asflags --fpu=softvfp+vfpv3 |
863 fi | 864 fi |
864 check_add_cflags --cpu=Cortex-A8 | 865 check_add_cflags --cpu=Cortex-A8 |
865 check_add_asflags --cpu=Cortex-A8 | 866 check_add_asflags --cpu=Cortex-A8 |
866 else | 867 else |
867 check_add_cflags --cpu=${tgt_isa##armv} | 868 check_add_cflags --cpu=${tgt_isa##armv} |
868 check_add_asflags --cpu=${tgt_isa##armv} | 869 check_add_asflags --cpu=${tgt_isa##armv} |
869 fi | 870 fi |
870 fi | 871 fi |
871 arch_int=${tgt_isa##armv} | 872 arch_int=${tgt_isa##armv} |
872 arch_int=${arch_int%%te} | 873 arch_int=${arch_int%%te} |
873 check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" | 874 check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" |
874 enabled debug && add_asflags -g | 875 enabled debug && add_asflags -g |
875 add_cflags --gnu | 876 add_cflags --gnu |
876 add_cflags --enum_is_int | 877 add_cflags --enum_is_int |
877 add_cflags --wchar32 | 878 add_cflags --wchar32 |
878 ;; | 879 ;; |
879 esac | 880 esac |
880 | 881 |
881 case ${tgt_os} in | 882 case ${tgt_os} in |
882 none*) | 883 none*) |
883 disable multithread | 884 disable_feature multithread |
884 disable os_support | 885 disable_feature os_support |
885 ;; | 886 ;; |
886 | 887 |
887 android*) | 888 android*) |
888 SDK_PATH=${sdk_path} | 889 SDK_PATH=${sdk_path} |
889 COMPILER_LOCATION=`find "${SDK_PATH}" \ | 890 COMPILER_LOCATION=`find "${SDK_PATH}" \ |
890 -name "arm-linux-androideabi-gcc*" -print -quit` | 891 -name "arm-linux-androideabi-gcc*" -print -quit` |
891 TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- | 892 TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- |
892 CC=${TOOLCHAIN_PATH}gcc | 893 CC=${TOOLCHAIN_PATH}gcc |
893 CXX=${TOOLCHAIN_PATH}g++ | 894 CXX=${TOOLCHAIN_PATH}g++ |
894 AR=${TOOLCHAIN_PATH}ar | 895 AR=${TOOLCHAIN_PATH}ar |
(...skipping 11 matching lines...) Expand all Loading... |
906 awk '{ print $1 }' | tail -1` | 907 awk '{ print $1 }' | tail -1` |
907 fi | 908 fi |
908 | 909 |
909 add_cflags "--sysroot=${alt_libc}" | 910 add_cflags "--sysroot=${alt_libc}" |
910 add_ldflags "--sysroot=${alt_libc}" | 911 add_ldflags "--sysroot=${alt_libc}" |
911 | 912 |
912 # linker flag that routes around a CPU bug in some | 913 # linker flag that routes around a CPU bug in some |
913 # Cortex-A8 implementations (NDK Dev Guide) | 914 # Cortex-A8 implementations (NDK Dev Guide) |
914 add_ldflags "-Wl,--fix-cortex-a8" | 915 add_ldflags "-Wl,--fix-cortex-a8" |
915 | 916 |
916 enable pic | 917 enable_feature pic |
917 soft_enable realtime_only | 918 soft_enable realtime_only |
918 if [ ${tgt_isa} == "armv7" ]; then | 919 if [ ${tgt_isa} = "armv7" ]; then |
919 soft_enable runtime_cpu_detect | 920 soft_enable runtime_cpu_detect |
920 fi | 921 fi |
921 if enabled runtime_cpu_detect; then | 922 if enabled runtime_cpu_detect; then |
922 add_cflags "-I${SDK_PATH}/sources/android/cpufeatures" | 923 add_cflags "-I${SDK_PATH}/sources/android/cpufeatures" |
923 fi | 924 fi |
924 ;; | 925 ;; |
925 | 926 |
926 darwin*) | 927 darwin*) |
927 if [ -z "${sdk_path}" ]; then | 928 if [ -z "${sdk_path}" ]; then |
928 SDK_PATH=`xcode-select -print-path 2> /dev/null` | 929 SDK_PATH=`xcode-select -print-path 2> /dev/null` |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 963 |
963 for d in lib usr/lib usr/lib/system; do | 964 for d in lib usr/lib usr/lib/system; do |
964 try_dir="${alt_libc}/${d}" | 965 try_dir="${alt_libc}/${d}" |
965 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" | 966 [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" |
966 done | 967 done |
967 | 968 |
968 asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" | 969 asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" |
969 ;; | 970 ;; |
970 | 971 |
971 linux*) | 972 linux*) |
972 enable linux | 973 enable_feature linux |
973 if enabled rvct; then | 974 if enabled rvct; then |
974 # Check if we have CodeSourcery GCC in PATH. Needed for | 975 # Check if we have CodeSourcery GCC in PATH. Needed for |
975 # libraries | 976 # libraries |
976 hash arm-none-linux-gnueabi-gcc 2>&- || \ | 977 hash arm-none-linux-gnueabi-gcc 2>&- || \ |
977 die "Couldn't find CodeSourcery GCC from PATH" | 978 die "Couldn't find CodeSourcery GCC from PATH" |
978 | 979 |
979 # Use armcc as a linker to enable translation of | 980 # Use armcc as a linker to enable translation of |
980 # some gcc specific options such as -lm and -lpthread. | 981 # some gcc specific options such as -lm and -lpthread. |
981 LD="armcc --translate_gcc" | 982 LD="armcc --translate_gcc" |
982 | 983 |
(...skipping 10 matching lines...) Expand all Loading... |
993 ;; | 994 ;; |
994 | 995 |
995 esac | 996 esac |
996 ;; | 997 ;; |
997 mips*) | 998 mips*) |
998 link_with_cc=gcc | 999 link_with_cc=gcc |
999 setup_gnu_toolchain | 1000 setup_gnu_toolchain |
1000 tune_cflags="-mtune=" | 1001 tune_cflags="-mtune=" |
1001 if enabled dspr2; then | 1002 if enabled dspr2; then |
1002 check_add_cflags -mips32r2 -mdspr2 | 1003 check_add_cflags -mips32r2 -mdspr2 |
1003 disable fast_unaligned | 1004 disable_feature fast_unaligned |
1004 fi | 1005 fi |
1005 check_add_cflags -march=${tgt_isa} | 1006 check_add_cflags -march=${tgt_isa} |
1006 check_add_asflags -march=${tgt_isa} | 1007 check_add_asflags -march=${tgt_isa} |
1007 check_add_asflags -KPIC | 1008 check_add_asflags -KPIC |
1008 ;; | 1009 ;; |
1009 ppc*) | 1010 ppc*) |
1010 enable ppc | 1011 enable_feature ppc |
1011 bits=${tgt_isa##ppc} | 1012 bits=${tgt_isa##ppc} |
1012 link_with_cc=gcc | 1013 link_with_cc=gcc |
1013 setup_gnu_toolchain | 1014 setup_gnu_toolchain |
1014 add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin" | 1015 add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin" |
1015 soft_enable altivec | 1016 soft_enable altivec |
1016 enabled altivec && add_cflags -maltivec | 1017 enabled altivec && add_cflags -maltivec |
1017 | 1018 |
1018 case "$tgt_os" in | 1019 case "$tgt_os" in |
1019 linux*) | 1020 linux*) |
1020 add_asflags -maltivec -mregnames -I"\$(dir \$<)linux" | 1021 add_asflags -maltivec -mregnames -I"\$(dir \$<)linux" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 add_asflags -f aout | 1149 add_asflags -f aout |
1149 enabled debug && add_asflags -g | 1150 enabled debug && add_asflags -g |
1150 EXE_SFX=.exe | 1151 EXE_SFX=.exe |
1151 ;; | 1152 ;; |
1152 *) log "Warning: Unknown os $tgt_os while setting up $AS flags" | 1153 *) log "Warning: Unknown os $tgt_os while setting up $AS flags" |
1153 ;; | 1154 ;; |
1154 esac | 1155 esac |
1155 ;; | 1156 ;; |
1156 universal*|*-gcc|generic-gnu) | 1157 universal*|*-gcc|generic-gnu) |
1157 link_with_cc=gcc | 1158 link_with_cc=gcc |
1158 enable gcc | 1159 enable_feature gcc |
1159 setup_gnu_toolchain | 1160 setup_gnu_toolchain |
1160 ;; | 1161 ;; |
1161 esac | 1162 esac |
1162 | 1163 |
1163 # Try to enable CPU specific tuning | 1164 # Try to enable CPU specific tuning |
1164 if [ -n "${tune_cpu}" ]; then | 1165 if [ -n "${tune_cpu}" ]; then |
1165 if [ -n "${tune_cflags}" ]; then | 1166 if [ -n "${tune_cflags}" ]; then |
1166 check_add_cflags ${tune_cflags}${tune_cpu} || \ | 1167 check_add_cflags ${tune_cflags}${tune_cpu} || \ |
1167 die "Requested CPU '${tune_cpu}' not supported by compiler" | 1168 die "Requested CPU '${tune_cpu}' not supported by compiler" |
1168 fi | 1169 fi |
(...skipping 13 matching lines...) Expand all Loading... |
1182 check_add_ldflags -fprofile-arcs -ftest-coverage | 1183 check_add_ldflags -fprofile-arcs -ftest-coverage |
1183 | 1184 |
1184 if enabled optimizations; then | 1185 if enabled optimizations; then |
1185 if enabled rvct; then | 1186 if enabled rvct; then |
1186 enabled small && check_add_cflags -Ospace || check_add_cflags -Otime | 1187 enabled small && check_add_cflags -Ospace || check_add_cflags -Otime |
1187 else | 1188 else |
1188 enabled small && check_add_cflags -O2 || check_add_cflags -O3 | 1189 enabled small && check_add_cflags -O2 || check_add_cflags -O3 |
1189 fi | 1190 fi |
1190 fi | 1191 fi |
1191 | 1192 |
| 1193 # default use_x86inc to yes if pic is no or 64bit or we are not on darwin |
| 1194 echo " checking here for x86inc \"${tgt_isa}\" \"$pic\" " |
| 1195 if [ ${tgt_isa} = x86_64 -o ! "$pic" = "yes" -o "${tgt_os#darwin}" = "${tgt_
os}" ]; then |
| 1196 soft_enable use_x86inc |
| 1197 fi |
| 1198 |
1192 # Position Independent Code (PIC) support, for building relocatable | 1199 # Position Independent Code (PIC) support, for building relocatable |
1193 # shared objects | 1200 # shared objects |
1194 enabled gcc && enabled pic && check_add_cflags -fPIC | 1201 enabled gcc && enabled pic && check_add_cflags -fPIC |
1195 | 1202 |
1196 # Work around longjmp interception on glibc >= 2.11, to improve binary | 1203 # Work around longjmp interception on glibc >= 2.11, to improve binary |
1197 # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 | 1204 # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 |
1198 enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 | 1205 enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
1199 | 1206 |
1200 # Check for strip utility variant | 1207 # Check for strip utility variant |
1201 ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip | 1208 ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip |
1202 | 1209 |
1203 # Try to determine target endianness | 1210 # Try to determine target endianness |
1204 check_cc <<EOF | 1211 check_cc <<EOF |
1205 unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; | 1212 unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E'; |
1206 EOF | 1213 EOF |
1207 [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | | 1214 [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' | |
1208 grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian | 1215 grep '4f *32 *42 *45' >/dev/null 2>&1 && enable_feature big_endian |
1209 | 1216 |
1210 # Try to find which inline keywords are supported | 1217 # Try to find which inline keywords are supported |
1211 check_cc <<EOF && INLINE="inline" | 1218 check_cc <<EOF && INLINE="inline" |
1212 static inline function() {} | 1219 static inline function() {} |
1213 EOF | 1220 EOF |
1214 check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))" | 1221 check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))" |
1215 static __attribute__((always_inline)) function() {} | 1222 static __attribute__((always_inline)) function() {} |
1216 EOF | 1223 EOF |
1217 | 1224 |
1218 # Almost every platform uses pthreads. | 1225 # Almost every platform uses pthreads. |
1219 if enabled multithread; then | 1226 if enabled multithread; then |
1220 case ${toolchain} in | 1227 case ${toolchain} in |
1221 *-win*-vs*);; | 1228 *-win*-vs*);; |
1222 *-android-gcc);; | 1229 *-android-gcc);; |
1223 *) check_header pthread.h && add_extralibs -lpthread | 1230 *) check_header pthread.h && add_extralibs -lpthread |
1224 esac | 1231 esac |
1225 fi | 1232 fi |
1226 | 1233 |
1227 # only for MIPS platforms | 1234 # only for MIPS platforms |
1228 case ${toolchain} in | 1235 case ${toolchain} in |
1229 mips*) | 1236 mips*) |
1230 if enabled dspr2; then | 1237 if enabled dspr2; then |
1231 if enabled big_endian; then | 1238 if enabled big_endian; then |
1232 echo "dspr2 optimizations are available only for little endi
an platforms" | 1239 echo "dspr2 optimizations are available only for little endi
an platforms" |
1233 disable dspr2 | 1240 disable_feature dspr2 |
1234 fi | 1241 fi |
1235 fi | 1242 fi |
1236 ;; | 1243 ;; |
1237 esac | 1244 esac |
1238 | 1245 |
1239 # glibc needs these | 1246 # glibc needs these |
1240 if enabled linux; then | 1247 if enabled linux; then |
1241 add_cflags -D_LARGEFILE_SOURCE | 1248 add_cflags -D_LARGEFILE_SOURCE |
1242 add_cflags -D_FILE_OFFSET_BITS=64 | 1249 add_cflags -D_FILE_OFFSET_BITS=64 |
1243 fi | 1250 fi |
(...skipping 30 matching lines...) Expand all Loading... |
1274 if enabled $cfg; then | 1281 if enabled $cfg; then |
1275 echo "#define ${prefix}_${upname} 1" >> $header | 1282 echo "#define ${prefix}_${upname} 1" >> $header |
1276 else | 1283 else |
1277 echo "#define ${prefix}_${upname} 0" >> $header | 1284 echo "#define ${prefix}_${upname} 0" >> $header |
1278 fi | 1285 fi |
1279 done | 1286 done |
1280 } | 1287 } |
1281 | 1288 |
1282 print_webm_license() { | 1289 print_webm_license() { |
1283 local destination=$1 | 1290 local destination=$1 |
1284 local prefix=$2 | 1291 local prefix="$2" |
1285 local suffix=$3 | 1292 local suffix="$3" |
1286 shift 3 | 1293 shift 3 |
1287 cat <<EOF > ${destination} | 1294 cat <<EOF > ${destination} |
1288 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} | 1295 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} |
1289 ${prefix} ${suffix} | 1296 ${prefix} ${suffix} |
1290 ${prefix} Use of this source code is governed by a BSD-style license${suffix} | 1297 ${prefix} Use of this source code is governed by a BSD-style license${suffix} |
1291 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} | 1298 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} |
1292 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} | 1299 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} |
1293 ${prefix} in the file PATENTS. All contributing project authors may${suffix} | 1300 ${prefix} in the file PATENTS. All contributing project authors may${suffix} |
1294 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} | 1301 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} |
1295 EOF | 1302 EOF |
1296 } | 1303 } |
1297 | 1304 |
1298 process_targets() { | 1305 process_targets() { |
1299 true; | 1306 true; |
1300 } | 1307 } |
1301 | 1308 |
1302 process_detect() { | 1309 process_detect() { |
1303 true; | 1310 true; |
1304 } | 1311 } |
1305 | 1312 |
1306 enable logging | 1313 enable_feature logging |
1307 logfile="config.log" | 1314 logfile="config.log" |
1308 self=$0 | 1315 self=$0 |
1309 process() { | 1316 process() { |
1310 cmdline_args="$@" | 1317 cmdline_args="$@" |
1311 process_cmdline "$@" | 1318 process_cmdline "$@" |
1312 if enabled child; then | 1319 if enabled child; then |
1313 echo "# ${self} $@" >> ${logfile} | 1320 echo "# ${self} $@" >> ${logfile} |
1314 else | 1321 else |
1315 echo "# ${self} $@" > ${logfile} | 1322 echo "# ${self} $@" > ${logfile} |
1316 fi | 1323 fi |
1317 post_process_common_cmdline | 1324 post_process_common_cmdline |
1318 post_process_cmdline | 1325 post_process_cmdline |
1319 process_toolchain | 1326 process_toolchain |
1320 process_detect | 1327 process_detect |
1321 process_targets | 1328 process_targets |
1322 | 1329 |
1323 OOT_INSTALLS="${OOT_INSTALLS}" | 1330 OOT_INSTALLS="${OOT_INSTALLS}" |
1324 if enabled source_path_used; then | 1331 if enabled source_path_used; then |
1325 # Prepare the PWD for building. | 1332 # Prepare the PWD for building. |
1326 for f in ${OOT_INSTALLS}; do | 1333 for f in ${OOT_INSTALLS}; do |
1327 install -D ${source_path}/$f $f | 1334 install -D ${source_path}/$f $f |
1328 done | 1335 done |
1329 fi | 1336 fi |
1330 cp ${source_path}/build/make/Makefile . | 1337 cp ${source_path}/build/make/Makefile . |
1331 | 1338 |
1332 clean_temp_files | 1339 clean_temp_files |
1333 true | 1340 true |
1334 } | 1341 } |
OLD | NEW |