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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_feature source_path_used | 254 enable_feature source_path_used |
255 if test -z "$source_path" -o "$source_path" = "." ; then | 255 if [ -z "$source_path" ] || [ "$source_path" = "." ]; then |
256 source_path="`pwd`" | 256 source_path="`pwd`" |
257 disable_feature 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" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} | 374 check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM} |
375 readelf -WS ${TMP_O} >${TMP_X} | 375 readelf -WS ${TMP_O} >${TMP_X} |
376 log_file ${TMP_X} | 376 log_file ${TMP_X} |
377 if ! grep -q '\.rodata .* 16$' ${TMP_X}; then | 377 if ! grep -q '\.rodata .* 16$' ${TMP_X}; then |
378 die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" | 378 die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" |
379 fi | 379 fi |
380 } | 380 } |
381 | 381 |
382 # tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. | 382 # tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. |
383 check_gcc_machine_option() { | 383 check_gcc_machine_option() { |
384 local opt="$1" | 384 opt="$1" |
385 local feature="$2" | 385 feature="$2" |
386 [ -n "$feature" ] || feature="$opt" | 386 [ -n "$feature" ] || feature="$opt" |
387 | 387 |
388 if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then | 388 if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then |
389 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " | 389 RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " |
390 else | 390 else |
391 soft_enable "$feature" | 391 soft_enable "$feature" |
392 fi | 392 fi |
393 } | 393 } |
394 | 394 |
395 write_common_config_banner() { | 395 write_common_config_banner() { |
(...skipping 16 matching lines...) Expand all Loading... |
412 else | 412 else |
413 fwrite config.mk "ALL_TARGETS += ${t}" | 413 fwrite config.mk "ALL_TARGETS += ${t}" |
414 fi | 414 fi |
415 fi | 415 fi |
416 true; | 416 true; |
417 done | 417 done |
418 true | 418 true |
419 } | 419 } |
420 | 420 |
421 write_common_target_config_mk() { | 421 write_common_target_config_mk() { |
422 local CC="${CC}" | 422 saved_CC="${CC}" |
423 local CXX="${CXX}" | 423 saved_CXX="${CXX}" |
424 enabled ccache && CC="ccache ${CC}" | 424 enabled ccache && CC="ccache ${CC}" |
425 enabled ccache && CXX="ccache ${CXX}" | 425 enabled ccache && CXX="ccache ${CXX}" |
426 print_webm_license $1 "##" "" | 426 print_webm_license $1 "##" "" |
427 | 427 |
428 cat >> $1 << EOF | 428 cat >> $1 << EOF |
429 # This file automatically generated by configure. Do not edit! | 429 # This file automatically generated by configure. Do not edit! |
430 SRC_PATH="$source_path" | 430 SRC_PATH="$source_path" |
431 SRC_PATH_BARE=$source_path | 431 SRC_PATH_BARE=$source_path |
432 BUILD_PFX=${BUILD_PFX} | 432 BUILD_PFX=${BUILD_PFX} |
433 TOOLCHAIN=${toolchain} | 433 TOOLCHAIN=${toolchain} |
(...skipping 29 matching lines...) Expand all Loading... |
463 EOF | 463 EOF |
464 fi | 464 fi |
465 | 465 |
466 print_config_mk ARCH "${1}" ${ARCH_LIST} | 466 print_config_mk ARCH "${1}" ${ARCH_LIST} |
467 print_config_mk HAVE "${1}" ${HAVE_LIST} | 467 print_config_mk HAVE "${1}" ${HAVE_LIST} |
468 print_config_mk CONFIG "${1}" ${CONFIG_LIST} | 468 print_config_mk CONFIG "${1}" ${CONFIG_LIST} |
469 print_config_mk HAVE "${1}" gnu_strip | 469 print_config_mk HAVE "${1}" gnu_strip |
470 | 470 |
471 enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" | 471 enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" |
472 | 472 |
| 473 CC="${saved_CC}" |
| 474 CXX="${saved_CXX}" |
473 } | 475 } |
474 | 476 |
475 | 477 |
476 write_common_target_config_h() { | 478 write_common_target_config_h() { |
477 print_webm_license ${TMP_H} "/*" " */" | 479 print_webm_license ${TMP_H} "/*" " */" |
478 cat >> ${TMP_H} << EOF | 480 cat >> ${TMP_H} << EOF |
479 /* This file automatically generated by configure. Do not edit! */ | 481 /* This file automatically generated by configure. Do not edit! */ |
480 #ifndef VPX_CONFIG_H | 482 #ifndef VPX_CONFIG_H |
481 #define VPX_CONFIG_H | 483 #define VPX_CONFIG_H |
482 #define RESTRICT ${RESTRICT} | 484 #define RESTRICT ${RESTRICT} |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 --force-enable-?*|--force-disable-?*) | 542 --force-enable-?*|--force-disable-?*) |
541 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` | 543 eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` |
542 ${action}_feature $option | 544 ${action}_feature $option |
543 ;; | 545 ;; |
544 --libc=*) | 546 --libc=*) |
545 [ -d "${optval}" ] || die "Not a directory: ${optval}" | 547 [ -d "${optval}" ] || die "Not a directory: ${optval}" |
546 disable_feature builtin_libc | 548 disable_feature builtin_libc |
547 alt_libc="${optval}" | 549 alt_libc="${optval}" |
548 ;; | 550 ;; |
549 --as=*) | 551 --as=*) |
550 [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \ | 552 [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \ |
| 553 || [ "${optval}" = auto ] \ |
551 || die "Must be yasm, nasm or auto: ${optval}" | 554 || die "Must be yasm, nasm or auto: ${optval}" |
552 alt_as="${optval}" | 555 alt_as="${optval}" |
553 ;; | 556 ;; |
554 --size-limit=*) | 557 --size-limit=*) |
555 w="${optval%%x*}" | 558 w="${optval%%x*}" |
556 h="${optval##*x}" | 559 h="${optval##*x}" |
557 VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" | 560 VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" |
558 [ ${w} -gt 0 -a ${h} -gt 0 ] || die "Invalid size-limit: too small." | 561 [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small." |
559 [ ${w} -lt 65536 -a ${h} -lt 65536 ] \ | 562 [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \ |
560 || die "Invalid size-limit: too big." | 563 || die "Invalid size-limit: too big." |
561 enable_feature size_limit | 564 enable_feature size_limit |
562 ;; | 565 ;; |
563 --prefix=*) | 566 --prefix=*) |
564 prefix="${optval}" | 567 prefix="${optval}" |
565 ;; | 568 ;; |
566 --libdir=*) | 569 --libdir=*) |
567 libdir="${optval}" | 570 libdir="${optval}" |
568 ;; | 571 ;; |
569 --sdk-path=*) | 572 --sdk-path=*) |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 check_gcc_machine_option sse3 | 1146 check_gcc_machine_option sse3 |
1144 check_gcc_machine_option ssse3 | 1147 check_gcc_machine_option ssse3 |
1145 check_gcc_machine_option sse4 sse4_1 | 1148 check_gcc_machine_option sse4 sse4_1 |
1146 check_gcc_machine_option avx | 1149 check_gcc_machine_option avx |
1147 check_gcc_machine_option avx2 | 1150 check_gcc_machine_option avx2 |
1148 | 1151 |
1149 case "${AS}" in | 1152 case "${AS}" in |
1150 auto|"") | 1153 auto|"") |
1151 which nasm >/dev/null 2>&1 && AS=nasm | 1154 which nasm >/dev/null 2>&1 && AS=nasm |
1152 which yasm >/dev/null 2>&1 && AS=yasm | 1155 which yasm >/dev/null 2>&1 && AS=yasm |
1153 [ "${AS}" = auto -o -z "${AS}" ] \ | 1156 [ "${AS}" = auto ] || [ -z "${AS}" ] \ |
1154 && die "Neither yasm nor nasm have been found" | 1157 && die "Neither yasm nor nasm have been found" |
1155 ;; | 1158 ;; |
1156 esac | 1159 esac |
1157 log_echo " using $AS" | 1160 log_echo " using $AS" |
1158 [ "${AS##*/}" = nasm ] && add_asflags -Ox | 1161 [ "${AS##*/}" = nasm ] && add_asflags -Ox |
1159 AS_SFX=.asm | 1162 AS_SFX=.asm |
1160 case ${tgt_os} in | 1163 case ${tgt_os} in |
1161 win32) | 1164 win32) |
1162 add_asflags -f win32 | 1165 add_asflags -f win32 |
1163 enabled debug && add_asflags -g cv8 | 1166 enabled debug && add_asflags -g cv8 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 check_add_cflags ${extra_cflags} || \ | 1310 check_add_cflags ${extra_cflags} || \ |
1308 die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" | 1311 die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler" |
1309 fi | 1312 fi |
1310 } | 1313 } |
1311 | 1314 |
1312 process_toolchain() { | 1315 process_toolchain() { |
1313 process_common_toolchain | 1316 process_common_toolchain |
1314 } | 1317 } |
1315 | 1318 |
1316 print_config_mk() { | 1319 print_config_mk() { |
1317 local prefix=$1 | 1320 saved_prefix="${prefix}" |
1318 local makefile=$2 | 1321 prefix=$1 |
| 1322 makefile=$2 |
1319 shift 2 | 1323 shift 2 |
1320 for cfg; do | 1324 for cfg; do |
1321 if enabled $cfg; then | 1325 if enabled $cfg; then |
1322 upname="`toupper $cfg`" | 1326 upname="`toupper $cfg`" |
1323 echo "${prefix}_${upname}=yes" >> $makefile | 1327 echo "${prefix}_${upname}=yes" >> $makefile |
1324 fi | 1328 fi |
1325 done | 1329 done |
| 1330 prefix="${saved_prefix}" |
1326 } | 1331 } |
1327 | 1332 |
1328 print_config_h() { | 1333 print_config_h() { |
1329 local prefix=$1 | 1334 saved_prefix="${prefix}" |
1330 local header=$2 | 1335 prefix=$1 |
| 1336 header=$2 |
1331 shift 2 | 1337 shift 2 |
1332 for cfg; do | 1338 for cfg; do |
1333 upname="`toupper $cfg`" | 1339 upname="`toupper $cfg`" |
1334 if enabled $cfg; then | 1340 if enabled $cfg; then |
1335 echo "#define ${prefix}_${upname} 1" >> $header | 1341 echo "#define ${prefix}_${upname} 1" >> $header |
1336 else | 1342 else |
1337 echo "#define ${prefix}_${upname} 0" >> $header | 1343 echo "#define ${prefix}_${upname} 0" >> $header |
1338 fi | 1344 fi |
1339 done | 1345 done |
| 1346 prefix="${saved_prefix}" |
1340 } | 1347 } |
1341 | 1348 |
1342 print_config_vars_h() { | 1349 print_config_vars_h() { |
1343 local header=$1 | 1350 header=$1 |
1344 shift | 1351 shift |
1345 while [ $# -gt 0 ]; do | 1352 while [ $# -gt 0 ]; do |
1346 upname="`toupper $1`" | 1353 upname="`toupper $1`" |
1347 echo "#define ${upname} $2" >> $header | 1354 echo "#define ${upname} $2" >> $header |
1348 shift 2 | 1355 shift 2 |
1349 done | 1356 done |
1350 } | 1357 } |
1351 | 1358 |
1352 print_webm_license() { | 1359 print_webm_license() { |
1353 local destination=$1 | 1360 saved_prefix="${prefix}" |
1354 local prefix="$2" | 1361 destination=$1 |
1355 local suffix="$3" | 1362 prefix="$2" |
| 1363 suffix="$3" |
1356 shift 3 | 1364 shift 3 |
1357 cat <<EOF > ${destination} | 1365 cat <<EOF > ${destination} |
1358 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} | 1366 ${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suf
fix} |
1359 ${prefix} ${suffix} | 1367 ${prefix} ${suffix} |
1360 ${prefix} Use of this source code is governed by a BSD-style license${suffix} | 1368 ${prefix} Use of this source code is governed by a BSD-style license${suffix} |
1361 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} | 1369 ${prefix} that can be found in the LICENSE file in the root of the source${suffi
x} |
1362 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} | 1370 ${prefix} tree. An additional intellectual property rights grant can be found${s
uffix} |
1363 ${prefix} in the file PATENTS. All contributing project authors may${suffix} | 1371 ${prefix} in the file PATENTS. All contributing project authors may${suffix} |
1364 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} | 1372 ${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} |
1365 EOF | 1373 EOF |
| 1374 prefix="${saved_prefix}" |
1366 } | 1375 } |
1367 | 1376 |
1368 process_targets() { | 1377 process_targets() { |
1369 true; | 1378 true; |
1370 } | 1379 } |
1371 | 1380 |
1372 process_detect() { | 1381 process_detect() { |
1373 true; | 1382 true; |
1374 } | 1383 } |
1375 | 1384 |
(...skipping 19 matching lines...) Expand all Loading... |
1395 # Prepare the PWD for building. | 1404 # Prepare the PWD for building. |
1396 for f in ${OOT_INSTALLS}; do | 1405 for f in ${OOT_INSTALLS}; do |
1397 install -D "${source_path}/$f" "$f" | 1406 install -D "${source_path}/$f" "$f" |
1398 done | 1407 done |
1399 fi | 1408 fi |
1400 cp "${source_path}/build/make/Makefile" . | 1409 cp "${source_path}/build/make/Makefile" . |
1401 | 1410 |
1402 clean_temp_files | 1411 clean_temp_files |
1403 true | 1412 true |
1404 } | 1413 } |
OLD | NEW |