1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381
|
#!/bin/sh
#
# libvalhalla configure script - (c) 2009 Mathieu Schroeter
#
# Fully inspired from :
# libdlna configure script - (c) 2007-2008 Benjamin Zores
# libplayer configure script - (c) 2006 Benjamin Zores
# FFmpeg configure script, thanks to Fabrice Bellard
#
# make sure we are running under a compatible shell
unset foo
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
if test "$?" != 0; then
if test "x$VALHALLA_CONFIGURE_EXEC" = x; then
VALHALLA_CONFIGURE_EXEC=1
export VALHALLA_CONFIGURE_EXEC
exec bash "$0" "$@"
exec ksh "$0" "$@"
exec /usr/xpg4/bin/sh "$0" "$@"
fi
echo "No compatible shell script interpreter found."
exit 1
fi
show_help(){
echo "Usage: configure [options]"
echo "Options: [defaults in brackets after descriptions]"
echo
echo "Standard options:"
echo " --help print this message"
echo " --log[=FILE|yes|no] log tests and output to FILE [config.log]"
echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
echo " --bindir=DIR install bins in DIR [PREFIX/bin]"
echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
echo " --includedir=DIR install includes in DIR [PREFIX/include]"
echo " --docdir=DIR install docs in DIR [PREFIX/share/doc]"
echo " --enable-static build static libraries [default=yes]"
echo " --disable-static do not build static libraries [default=no]"
echo " --enable-shared build shared libraries [default=yes]"
echo " --disable-shared do not build shared libraries [default=no]"
echo ""
echo "Grabbers options:"
echo " --enable-grabbers build all grabbers (dummy excepted) [default=no]"
echo " --enable-grabber-dummy build dummy grabber (for debugging) [default=no]"
echo " --enable-grabber-allocine build Allocine grabber [default=yes]"
echo " --enable-grabber-amazon build Amazon grabber [default=yes]"
echo " --enable-grabber-exif build EXIF grabber [default=yes]"
echo " --enable-grabber-ffmpeg build FFmpeg grabber [default=no]"
echo " --enable-grabber-imdb build ImDB grabber [default=yes]"
echo " --enable-grabber-lastfm build Last.fm grabber [default=yes]"
echo " --enable-grabber-local build localfiles grabber [default=yes]"
echo " --enable-grabber-lyricsfly build LyricsFly.com grabber [default=no]"
echo " --enable-grabber-lyricwiki build LyricWiki.org grabber [default=yes]"
echo " --enable-grabber-nfo build NFO grabber [default=yes]"
echo " --enable-grabber-tvdb build TheTVDB.com grabber [default=yes]"
echo " --enable-grabber-tmdb build TheMovieDB.org grabber [default=yes]"
echo " --enable-grabber-tvrage build TVRage.com grabber [default=yes]"
echo ""
echo "Search paths:"
echo " --with-lavf=PATH specify prefix directory for libavformat package."
echo " Equivalent to --with-lavf-inc=PATH/include"
echo " plus --with-lavf-lib=PATH/lib"
echo " --with-lavf-inc=PATH specify directory for libavformat include files"
echo " --with-lavf-lib=PATH specify directory for libavformat library"
echo " --with-lavc=PATH specify prefix directory for libavcodec package."
echo " Equivalent to --with-lavc-inc=PATH/include"
echo " plus --with-lavc-lib=PATH/lib"
echo " --with-lavc-inc=PATH specify directory for libavcodec include files"
echo " --with-lavc-lib=PATH specify directory for libavcodec library"
echo " --with-lavu=PATH specify prefix directory for libavutil package."
echo " Equivalent to --with-lavu-inc=PATH/include"
echo " plus --with-lavu-lib=PATH/lib"
echo " --with-lavu-inc=PATH specify directory for libavutil include files"
echo " --with-lavu-lib=PATH specify directory for libavutil library"
echo " --with-sqlite3-dir=DIR check for SQLite installed in DIR"
echo " --with-curl-dir=DIR check for libcurl installed in DIR"
echo " --with-xml2-dir=DIR check for libxml-2.0 installed in DIR"
echo " --with-exif-dir=DIR check for libexif installed in DIR"
echo " --with-nfo-dir=DIR check for libnfo installed in DIR"
echo " --with-gcrypt-dir=DIR check for libgcrypt installed in DIR"
echo ""
echo "Advanced options (experts only):"
echo " --arch=ARCH force architecture"
echo " --cpu=CPU force CPU optimization"
echo " --disable-debug disable debugging symbols"
echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
echo " --disable-strip disable stripping of executables at installation"
echo " --disable-optimize disable compiler optimization"
echo " --enable-small optimize for size instead of speed"
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
echo " --cross-compile assume a cross-compiler is used"
echo " --enable-pic build position-independent code"
echo ""
echo "Miscellaneous:"
echo " --disable-logcolor disable colorful console output on terminals"
echo " --enable-doc build Doxygen documentation"
exit 1
}
log(){
echo "$@" >>$logfile
}
log_file(){
log BEGIN $1
cat -n $1 >>$logfile
log END $1
}
echolog(){
log "$@"
echo "$@"
}
echologn(){
log "$@"
echo -n "$@"
}
clean(){
rm -f $TMPC $TMPO $TMPE $TMPS
}
die(){
echolog "$@"
if enabled logging; then
echo "See file \"$logfile\" produced by configure for more details."
else
echo "Rerun configure with logging enabled (do not use --log=no) for more details."
fi
clean
exit 1
}
set_all(){
value=$1
shift
for var in $*; do
eval $var=$value
done
}
enable(){
set_all yes $*
}
enabled(){
eval test "x\$$1" = "xyes"
}
disabled(){
eval test "x\$$1" = "xno"
}
flags_saved(){
(: ${SAVE_CFLAGS?}) 2>/dev/null
}
save_flags(){
flags_saved && return
SAVE_CFLAGS="$CFLAGS"
SAVE_CPPFLAGS="$CPPFLAGS"
SAVE_HOST_CFLAGS="$HOST_CFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
SAVE_extralibs="$extralibs"
}
restore_flags(){
CFLAGS="$SAVE_CFLAGS"
CPPFLAGS="$SAVE_CPPFLAGS"
HOST_CFLAGS="$SAVE_HOST_CFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
extralibs="$SAVE_extralibs"
unset SAVE_CFLAGS
unset SAVE_CPPFLAGS
unset SAVE_HOST_CFLAGS
unset SAVE_LDFLAGS
unset SAVE_extralibs
}
temp_cflags(){
temp_append CFLAGS "$@"
}
temp_cppflags(){
temp_append CPPFLAGS "$@"
}
temp_host_cflags(){
temp_append HOST_CFLAGS "$@"
}
temp_ldflags(){
temp_append LDFLAGS "$@"
}
temp_extralibs(){
temp_append extralibs "$@"
}
temp_append(){
local var
var=$1
shift
save_flags
append_var "$var" "$@"
}
append_var(){
local var f
var=$1
shift
for f in $@; do
if eval echo \$$var | grep -qv -e "$f"; then
test -n "$(eval echo \$$var)" && eval "$var=\"\$$var $f\"" || eval "$var=\"$f\""
fi
done
}
append(){
local var
var=$1
shift
flags_saved && append_var "SAVE_$var" "$@"
append_var "$var" "$@"
}
add_cflags(){
append CFLAGS "$@"
}
add_cppflags(){
append CPPFLAGS "$@"
}
add_ldflags(){
append LDFLAGS "$@"
}
add_extralibs(){
append extralibs "$@"
}
add_pkgconfig_requires(){
append pkgconfig_requires "$@"
}
check_cmd(){
log "$@"
"$@" >>$logfile 2>&1
}
check_cc(){
log check_cc "$@"
cat >$TMPC
log_file $TMPC
check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
}
check_host_cc(){
log check_host_cc "$@"
cat >$TMPC
log_file $TMPC
check_cmd $host_cc $HOST_CFLAGS "$@" -c -o $TMPO $TMPC
}
check_cpp(){
log check_cpp "$@"
cat >$TMPC
log_file $TMPC
check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
}
check_ld(){
log check_ld "$@"
check_cc || return
check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
}
check_host_ld(){
log check_host_ld "$@"
check_host_cc || return
check_cmd $host_cc $HOST_LDFLAGS "$@" -o $TMPE $TMPO
}
check_exec(){
check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
}
check_cppflags(){
log check_cppflags "$@"
check_cc "$@" <<EOF && append CPPFLAGS "$@"
int x;
EOF
}
check_cflags(){
log check_cflags "$@"
check_cc "$@" <<EOF && add_cflags "$@"
int x;
EOF
}
check_ldflags(){
log check_ldflags "$@"
check_ld "$@" <<EOF && add_ldflags "$@"
int main(){
return 0;
}
EOF
}
check_header(){
local header
log check_header "$@"
header=$1
shift
check_cpp "$@" <<EOF
#include <$header>
int x;
EOF
}
check_func(){
local func
log check_func "$@"
func=$1
shift
check_ld "$@" <<EOF
extern int $func();
int main(){
$func();
return 0;
}
EOF
}
check_lib(){
local header func err
log check_lib "$@"
header="$1"
func="$2"
shift 2
temp_extralibs "$@"
check_header $header && check_func $func && add_extralibs "$@"
err=$?
restore_flags
return $err
}
check_libconfig(){
local config func ccflags clibs err
log check_libconfig "$@"
config="$1"
func="$2"
ccflags="${3:---cflags}"
clibs="${4:---libs}"
err=1
if `which "$config" 1>/dev/null 2>&1`; then
cflags=`$config $ccflags`
[ -n "$cflags" ] && check_cflags "$cflags"
libs=`$config $clibs`
if [ -n "$libs" ]; then
temp_extralibs "$libs"
check_func $func && add_extralibs "$libs"
err=$?
restore_flags
fi
fi
return $err
}
check_lib_version() {
local min_ver toobig_ver
min_ver="$2"
toobig_ver="$3"
check_cmd pkg-config --print-errors --exists "$1 >= $min_ver $1 < $toobig_ver" 2>>$logfile
err=$?
return $err
}
append_config(){
echo "$@" >> $CONFIGFILE
}
pkgconfig_generate(){
name=$1
comment=$2
version=$3
libs=$4
libs_private=$5
cflags=$6
requires=$7
requires_private=$8
cat <<EOF >$name.pc
PREFIX=$PREFIX
libdir=$libdir
includedir=$includedir
Name: $name
Description: $comment
Version: $version
Requires: $requires
Requires.private: $requires_private
Conflicts:
Libs: -L\${libdir} $libs
Libs.private: $libs_private
Cflags: -I\${includedir} $cflags
EOF
}
add_pkgconfig_deps() {
if `which pkg-config 1>/dev/null 2>&1`; then
add_cflags `pkg-config "$1" --cflags 2>>$logfile`
add_extralibs `pkg-config "$1" --libs 2>>$logfile`
fi
}
# set temporary file name
if test ! -z "$TMPDIR" ; then
TMPDIR1="${TMPDIR}"
elif test ! -z "$TEMPDIR" ; then
TMPDIR1="${TEMPDIR}"
else
TMPDIR1="/tmp"
fi
TMPC="${TMPDIR1}/libvalhalla-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/libvalhalla-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/libvalhalla-${RANDOM}-$$-${RANDOM}"
TMPS="${TMPDIR1}/libvalhalla-${RANDOM}-$$-${RANDOM}.S"
CONFIGFILE="config.mak"
#################################################
# set default parameters
#################################################
logging="yes"
logfile="config.log"
PREFIX="/usr/local"
bindir='${PREFIX}/bin'
libdir='${PREFIX}/lib'
includedir='${PREFIX}/include'
docdir='${PREFIX}/share/doc'
static="yes"
shared="yes"
cc="gcc"
host_cc="gcc"
ar="ar"
ranlib="ranlib"
make="make"
strip="strip"
arch=`uname -m`
cpu="generic"
optimize="yes"
small="no"
debug="yes"
dostrip="yes"
extralibs=""
installstrip="-s"
cross_compile="no"
pic="no"
INSTALL="install"
VERSION=""
pkgconfig_requires=""
grabber_all="auto"
grabber_dummy="no"
grabber_allocine="auto"
grabber_amazon="auto"
grabber_exif="auto"
grabber_ffmpeg="auto"
grabber_imdb="auto"
grabber_lastfm="auto"
grabber_local="auto"
grabber_lyricsfly="no"
grabber_lyricwiki="auto"
grabber_nfo="auto"
grabber_tmdb="auto"
grabber_tvdb="auto"
grabber_tvrage="auto"
logcolor="yes"
doc="no"
#################################################
# check options
#################################################
for opt do
optval="${opt#*=}"
case "$opt" in
--log)
;;
--log=*) logging="$optval"
;;
--prefix=*) PREFIX="$optval"; force_prefix=yes
;;
--bindir=*) bindir="$optval"
;;
--libdir=*) libdir="$optval"; force_libdir=yes
;;
--includedir=*) includedir="$optval"
;;
--docdir=*) docdir="$optval"; force_docdir=yes
;;
--enable-static) static="yes"
;;
--disable-static) static="no"
;;
--enable-shared) shared="yes"
;;
--disable-shared) shared="no"
;;
--enable-debug=*) debug="yes"; debuglevel="$optval"
;;
--disable-debug) debug="no"
;;
--enable-strip) dostrip="yes"
;;
--disable-strip) dostrip="no"
;;
--enable-optimize) optimize="yes"
;;
--disable-optimize) optimize="no"
;;
--enable-small) small="yes"
;;
--disable-small) small="no"
;;
--cross-prefix=*) cross_prefix="$optval"
;;
--cross-compile) cross_compile="yes"
;;
--with-lavf=*) lavfdir="$optval";
;;
--with-lavf-inc=*) lavfincdir="$optval";
;;
--with-lavf-lib=*) lavflibdir="$optval";
;;
--with-lavc=*) lavcdir="$optval";
;;
--with-lavc-inc=*) lavcincdir="$optval";
;;
--with-lavc-lib=*) lavclibdir="$optval";
;;
--with-lavu=*) lavudir="$optval";
;;
--with-lavu-inc=*) lavuincdir="$optval";
;;
--with-lavu-lib=*) lavulibdir="$optval";
;;
--with-sqlite3-dir=*) sqlite3dir="$optval";
;;
--with-curl-dir=*) curldir="$optval";
;;
--with-xml2-dir=*) xml2dir="$optval";
;;
--with-exif-dir=*) exifdir="$optval";
;;
--with-nfo-dir=*) nfodir="$optval";
;;
--with-gcrypt-dir=*) gcryptdir="$optval";
;;
--enable-grabbers) grabber_all="yes";
;;
--disable-grabbers) grabber_all="no";
;;
--enable-grabber-dummy) grabber_dummy="yes";
;;
--disable-grabber-dummy) grabber_dummy="no";
;;
--enable-grabber-allocine) grabber_allocine="yes";
;;
--disable-grabber-allocine) grabber_allocine="no";
;;
--enable-grabber-amazon) grabber_amazon="yes";
;;
--disable-grabber-amazon) grabber_amazon="no";
;;
--enable-grabber-exif) grabber_exif="yes";
;;
--disable-grabber-exif) grabber_exif="no";
;;
--enable-grabber-ffmpeg) grabber_ffmpeg="yes";
;;
--disable-grabber-ffmpeg) grabber_ffmpeg="no";
;;
--enable-grabber-imdb) grabber_imdb="yes";
;;
--disable-grabber-imdb) grabber_imdb="no";
;;
--enable-grabber-lastfm) grabber_lastfm="yes";
;;
--disable-grabber-lastfm) grabber_lastfm="no";
;;
--enable-grabber-local) grabber_local="yes";
;;
--disable-grabber-local) grabber_local="no";
;;
--enable-grabber-lyricsfly) grabber_lyricsfly="yes";
;;
--disable-grabber-lyricsfly) grabber_lyricsfly="no";
;;
--enable-grabber-lyricwiki) grabber_lyricwiki="yes";
;;
--disable-grabber-lyricwiki) grabber_lyricwiki="no";
;;
--enable-grabber-nfo) grabber_nfo="yes";
;;
--disable-grabber-nfo) grabber_nfo="no";
;;
--enable-grabber-tmdb) grabber_tmdb="yes";
;;
--disable-grabber-tmdb) grabber_tmdb="no";
;;
--enable-grabber-tvdb) grabber_tvdb="yes";
;;
--disable-grabber-tvdb) grabber_tvdb="no";
;;
--enable-grabber-tvrage) grabber_tvrage="yes";
;;
--disable-grabber-tvrage) grabber_tvrage="no";
;;
--enable-pic) pic="yes";
;;
--disable-pic) pic="no";
;;
--enable-logcolor) logcolor="yes";
;;
--disable-logcolor) logcolor="no";
;;
--enable-doc) doc="yes";
;;
--disable-doc) doc="no";
;;
--help) show_help
;;
*)
echo "Unknown option \"$opt\"."
echo "See $0 --help for available options."
exit 1
;;
esac
done
# Check for conflictual build options
if [ "$shared" = no -a "$static" = no ]; then
echo "At least one library type must be built."
echo "Specify --enable-static to build the static libraries or"
echo "--enable-shared to build the shared libraries as well."
exit 1
fi
if [ -n "$cross_prefix" ]; then
cross_compile="yes"
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"
else
[ -n "$CC" ] && cc="$CC"
[ -n "$AR" ] && ar="$AR"
[ -n "$RANLIB" ] && ranlib="$RANLIB"
[ -n "$STRIP" ] && strip="$STRIP"
fi
[ -n "$MAKE" ] && make="$MAKE"
[ -n "$HOST_CC" ] && HOST_CC="$HOST_CC"
[ -n "$HOST_CFLAGS" ] && HOST_CFLAGS="$HOST_CFLAGS"
[ -n "$HOST_LDFLAGS" ] && HOST_LDFLAGS="$HOST_LDFLAGS"
#################################################
# set arch variable and specific cpu flags
#################################################
if enabled cross_compile; then
arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
fi
case "$arch" in
i386|i486|i586|i686|i86pc|BePC)
arch="x86_32"
;;
x86_64|amd64)
arch="x86_32"
canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
arch="x86_64"
fi
fi
spic=$shared
;;
# armv4l is a subset of armv5tel
arm|armv4l|armv5tel)
arch="armv4l"
;;
alpha)
arch="alpha"
spic=$shared
;;
"Power Macintosh"|ppc|ppc64|powerpc)
arch="powerpc"
;;
mips|mipsel|IP*)
arch="mips"
spic=$shared
;;
mips64)
arch="mips64"
spic=$shared
;;
sun4u|sparc64)
arch="sparc64"
spic=$shared
;;
sparc)
arch="sparc"
spic=$shared
;;
sh4)
arch="sh4"
;;
parisc|parisc64)
arch="parisc"
spic=$shared
;;
s390|s390x)
arch="s390"
;;
m68k)
arch="m68k"
;;
ia64)
arch="ia64"
spic=$shared
;;
bfin)
arch="bfin"
;;
*)
arch="unknown"
;;
esac
# Add processor-specific flags
if test $cpu != "generic"; then
case $cpu in
601|ppc601|PowerPC601)
add_cflags "-mcpu=601"
;;
603*|ppc603*|PowerPC603*)
add_cflags "-mcpu=603"
;;
604*|ppc604*|PowerPC604*)
add_cflags "-mcpu=604"
;;
G3|g3|75*|ppc75*|PowerPC75*)
add_cflags "-mcpu=750 -mpowerpc-gfxopt"
;;
G4|g4|745*|ppc745*|PowerPC745*)
add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
;;
74*|ppc74*|PowerPC74*)
add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
;;
G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
;;
Cell|CELL|cell)
add_cflags "-mcpu=cell"
;;
i[3456]86|pentium|pentium-mmx|pentiumpro|pentium[23]|pentium-m|k6|k6-[23]|winchip-c6|winchip2|c3|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|pentium4|pentium4m|prescott|nocona)
add_cflags "-march=$cpu"
;;
sparc64)
add_cflags "-mcpu=v9"
;;
arm*|cortex*)
add_cflags "-mcpu=$cpu"
;;
*)
die "WARNING: Unknown CPU \"$cpu\", ignored."
;;
esac
fi
enable_pic(){
enable pic
add_cppflags -DPIC
add_cflags -fPIC
}
enabled spic && enable pic
enabled pic && enable_pic
#################################################
# create logging file
#################################################
if test "$logging" != no; then
enabled logging || logfile="$logging"
echo "# $0 $@" >$logfile
set >>$logfile
else
logfile=/dev/null
fi
#################################################
# compiler sanity check
#################################################
echolog "Checking for compiler available..."
check_exec <<EOF
int main(){
return 0;
}
EOF
if test "$?" != 0; then
echo "$cc is unable to create an executable file."
if test -z "$cross_prefix" -a "$cross_compile" = no; then
echo "If $cc is a cross-compiler, use the --cross-compile option."
fi
die "C compiler test failed."
fi
if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
dylib="yes"
else
dylib="no"
fi
#################################################
# check for target specific flags
#################################################
# check for SIMD availability
# mmi only available on mips
if [ "$mmi" = "default" ]; then
if [ "$arch" = "mips" ]; then
mmi="yes"
else
mmi="no"
fi
fi
# check if our compiler supports mmi
enabled mmi && check_cc <<EOF || mmi="no"
int main(void) {
__asm__ ("lq \$2, 0(\$2)");
return 0;
}
EOF
# test gcc version to see if vector builtins can be used
# currently only used on i386 for MMX builtins
check_cc -msse <<EOF && builtin_vector=yes || builtin_vector=no
#include <xmmintrin.h>
int main(void) {
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
return 0;
#else
#error no vector builtins
#endif
}
EOF
# test for mm3dnow.h
test "$arch" = "x86_64" && march=k8 || march=athlon
check_cc -march=$march <<EOF && mm3dnow=yes || mm3dnow=no
#include <mm3dnow.h>
int main(void) {
__m64 b1;
b1 = _m_pswapd(b1);
_m_femms();
return 0;
}
EOF
# ---
# big/little-endian test
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
# add some useful compiler flags if supported
check_cflags -W
check_cflags -Wall
check_cppflags -D_LARGEFILE_SOURCE
check_cppflags -D_FILE_OFFSET_BITS=64
check_cppflags -D_REENTRANT
# default extralibs
add_extralibs -lpthread
add_extralibs -lrt
#################################################
# check for debug symbols
#################################################
enabled debug && add_cflags -g"$debuglevel" && add_cppflags -DHAVE_DEBUG
if enabled small; then
check_cflags -Os
elif enabled optimize; then
if test -n "`$cc -v 2>&1 | grep xlc`"; then
add_cflags "-O5"
add_ldflags "-O5"
else
add_cflags "-O2"
fi
fi
#################################################
# check for FFmpeg libavformat
#################################################
if [ -n "$lavfdir" ]; then
check_cppflags -I${lavfdir}/include
check_ldflags -L${lavfdir}/lib
fi
if [ -n "$lavfincdir" ]; then
check_cppflags -I${lavfincdir}
fi
if [ -n "$lavflibdir" ]; then
check_ldflags -L${lavflibdir}
fi
if [ -z "$lavfdir" -a -z "$lavfincdir" -a -z "$lavflibdir" ]; then
add_pkgconfig_deps libavformat
fi
echolog "Checking for libavformat ..."
check_lib libavformat/avformat.h av_metadata_conv -lavformat || die "Error, can't find libavformat !"
#################################################
# check for SQLite sqlite3
#################################################
if [ -n "$sqlite3dir" ]; then
check_cppflags -I$sqlite3dir
check_ldflags -L$sqlite3dir
fi
if [ -z "$sqlite3dir" ]; then
add_pkgconfig_deps sqlite3
fi
echolog "Checking for sqlite3 ..."
check_lib sqlite3.h sqlite3_version -lsqlite3 || die "Error, can't find sqlite3 !"
#################################################
# Grabber
#################################################
grabber_enabled(){
local grabup value
for grab in $@; do
grabup=`echo $grab | tr "[:lower:]" "[:upper:]"`
eval value=\$grabber_$grab
if test "$value" = "auto" -o "$value" = "yes"; then
add_cppflags -DHAVE_GRABBER_$grabup
grabber="yes"
eval grabber_$grab="yes"
fi
done
}
grabber_forced(){
local value
for grab in $@; do
eval value=\$grabber_$grab
[ "$value" = "yes" ] && return 1
done
return 0
}
grabber_set_no(){
for grab in $@; do
eval grabber_$grab="no"
done
}
grabber_set_yes(){
for grab in $@; do
eval grabber_$grab="yes"
done
}
grabber_enable_dep(){
local value list dep
eval list=\$$1
dep=`echo $1 | sed "s/\([a-z]*\)_.*/\\1/"`
eval $dep="no"
for grab in $list; do
eval value=\$grabber_$grab
if test "$value" = "auto" -o "$value" = "yes"; then
eval $dep="yes"
break
fi
done
}
grabber="no"
grabbers="allocine amazon exif ffmpeg imdb lastfm local lyricsfly lyricwiki nfo tmdb tvdb tvrage"
if [ "$grabber_all" != "auto" ]; then
eval grabber_set_$grabber_all \$grabbers
fi
avcodec_dep_grabber="ffmpeg"
grabber_enable_dep avcodec_dep_grabber
avutil_dep_grabber="amazon lastfm tmdb tvdb"
grabber_enable_dep avutil_dep_grabber
exif_dep_grabber="exif"
grabber_enable_dep exif_dep_grabber
gcrypt_dep_grabber="amazon"
grabber_enable_dep gcrypt_dep_grabber
nfo_dep_grabber="nfo"
grabber_enable_dep nfo_dep_grabber
xml_dep_grabber="allocine amazon imdb lastfm lyricsfly lyricwiki tmdb tvdb tvrage"
grabber_enable_dep xml_dep_grabber
if enabled xml; then
###############################################
# check for libxml2
###############################################
if [ -n "$xml2dir" ]; then
check_cppflags -I$xml2dir
check_ldflags -L$xml2dir
fi
if [ -z "$xmldir" ]; then
add_pkgconfig_deps libxml-2.0
fi
echologn "Checking for libxml2 ... "
check_lib libxml/parser.h xmlReadMemory -lxml2
if [ "$?" = 0 ]; then
echolog "(yes)"
add_cppflags -DUSE_XML
else
echolog "(no)"
grabber_forced $xml_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libxml2 !"
xml="no"
grabber_set_no $xml_dep_grabber
fi
fi
if enabled avutil; then
###############################################
# check for FFmpeg libavutil
###############################################
if [ -n "$lavudir" ]; then
check_cppflags -I${lavudir}/include
check_ldflags -L${lavudir}/lib
fi
if [ -n "$lavuincdir" ]; then
check_cppflags -I${lavuincdir}
fi
if [ -n "$lavulibdir" ]; then
check_ldflags -L${lavulibdir}
fi
if [ -z "$lavudir" -a -z "$lavuincdir" -a -z "$lavulibdir" ]; then
add_pkgconfig_deps libavutil
fi
echologn "Checking for libavutil ... "
check_lib libavutil/md5.h av_md5_sum -lavutil
if [ "$?" = 0 ]; then
echolog "(yes)"
else
echolog "(no)"
grabber_forced $avutil_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libavutil !"
avutil="no"
grabber_set_no $avutil_dep_grabber
fi
fi
if enabled gcrypt; then
###############################################
# check for libgcrypt
###############################################
if [ -n "$gcryptdir" ]; then
check_cppflags -I$gcryptdir
check_ldflags -L$gcryptdir
fi
if [ -z "$gcryptdir" ]; then
if `which libgcrypt-config 1>/dev/null 2>&1`; then
add_cflags `libgcrypt-config --cflags`
add_extralibs `libgcrypt-config --libs`
fi
fi
echologn "Checking for libgcrypt ... "
check_lib gcrypt.h gcry_md_open -lgcrypt
if [ "$?" = 0 ]; then
echolog "(yes)"
else
echolog "(no)"
grabber_forced $gcrypt_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libgcrypt !"
gcrypt="no"
grabber_set_no $gcrypt_dep_grabber
fi
fi
if enabled exif; then
###############################################
# check for libexif
###############################################
if [ -n "$exifdir" ]; then
check_cppflags -I$exifdir
check_ldflags -L$exifdir
fi
if [ -z "$exifdir" ]; then
add_pkgconfig_deps libexif
fi
echologn "Checking for libexif ... "
check_lib libexif/exif-data.h exif_entry_get_value -lexif
if [ "$?" = 0 ]; then
echolog "(yes)"
else
echolog "(no)"
grabber_forced $exif_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libexif !"
exif="no"
grabber_set_no $exif_dep_grabber
fi
fi
if enabled avcodec; then
###############################################
# check for FFmpeg libavcodec
###############################################
if [ -n "$lavcdir" ]; then
check_cppflags -I${lavcdir}/include
check_ldflags -L${lavcdir}/lib
fi
if [ -n "$lavcincdir" ]; then
check_cflags -I${lavcincdir}
fi
if [ -n "$lavclibdir" ]; then
check_ldflags -L${lavclibdir}
fi
if [ -z "$lavcdir" -a -z "$lavcincdir" -a -z "$lavclibdir" ]; then
add_pkgconfig_deps libavcodec
fi
echologn "Checking for libavcodec ... "
check_lib libavcodec/avcodec.h av_lockmgr_register -lavcodec
if [ "$?" = 0 ]; then
echolog "(yes)"
add_cppflags -DUSE_LAVC
else
echolog "(no)"
grabber_forced $avcodec_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libavcodec !"
avcodec="no"
grabber_set_no $avcodec_dep_grabber
fi
fi
if enabled nfo; then
###############################################
# check for libnfo
###############################################
if [ -n "$nfodir" ]; then
check_cppflags -I$nfodir
check_ldflags -L$nfodir
fi
if [ -z "$nfodir" ]; then
add_pkgconfig_deps libnfo
fi
echologn "Checking for libnfo ... "
check_lib_version libnfo "1.0.0" "2.0.0"
if [ "$?" = 0 ]; then
check_lib nfo.h nfo_init -lnfo
[ "$?" != 0 ] && die "Error, libnfo available but the compilation failed !"
echolog "(yes)"
else
echolog "(no)"
grabber_forced $nfo_dep_grabber
[ "$?" != 0 ] && die "Error, can't find libnfo or bad version !"
nfo="no"
grabber_set_no $nfo_dep_grabber
fi
fi
grabber_enabled dummy $grabbers
if enabled grabber; then
###############################################
# check for libcurl
###############################################
if [ -n "$curldir" ]; then
check_cppflags -I$curldir
check_ldflags -L$curldir
fi
if [ -z "$curldir" ]; then
add_pkgconfig_deps libcurl
fi
echologn "Checking for libcurl ... "
check_lib curl/curl.h curl_global_init -lcurl
if [ "$?" = 0 ]; then
echolog "(yes)"
add_cppflags -DUSE_GRABBER
else
echolog "(no)"
if enabled grabber_all; then
die "Error, can't find libcurl (mandatory for the grabbers) !"
fi
grabber="no"
grabber_set_no dummy $grabbers
fi
fi
#################################################
# version
#################################################
temp_host_cflags "-Isrc"
check_host_ld <<EOF
#include <stdio.h>
#include <valhalla.h>
int main(){
printf("LIBVALHALLA_VERSION:"LIBVALHALLA_VERSION_STR);
printf("\n");
return 0;
}
EOF
VERSION=`strings $TMPE | sed -n -e 's,LIBVALHALLA_VERSION:,,p'`
restore_flags
#################################################
# Miscellaneous
#################################################
if enabled logcolor; then
add_cppflags -DUSE_LOGCOLOR
fi
# Doxygen
if enabled doc; then
doc="no"
which doxygen 2>&1 > /dev/null
[ "$?" = 0 ] && doc="yes"
fi
#################################################
# logging result
#################################################
echolog ""
echolog "libvalhalla: configure is OK"
echolog " version $VERSION"
echolog "configuration:"
echolog " install prefix $PREFIX"
echolog " C compiler $cc"
echolog " AR $ar"
echolog " RANLIB $ranlib"
echolog " STRIP $strip"
echolog " make $make"
echolog " Architecture $arch ($cpu)"
echolog " big-endian ${bigendian-no}"
echolog " debug symbols $debug"
echolog " strip symbols $dostrip"
echolog " optimize $optimize"
echolog " static ${static}"
echolog " shared ${shared}"
echolog ""
echolog " CFLAGS $CFLAGS $CPPFLAGS"
echolog " LDFLAGS $LDFLAGS"
echolog " extralibs $extralibs"
echolog ""
echolog " Grabbers support: $grabber"
echolog " Dummy $grabber_dummy"
echolog " Allocine $grabber_allocine"
echolog " Amazon $grabber_amazon"
echolog " EXIF $grabber_exif"
echolog " FFmpeg $grabber_ffmpeg"
echolog " ImDB $grabber_imdb"
echolog " Last.fm $grabber_lastfm"
echolog " Local Files $grabber_local"
echolog " LyricsFly $grabber_lyricsfly"
echolog " LyricWiki $grabber_lyricwiki"
echolog " NFO $grabber_nfo"
echolog " TheMovieDB $grabber_tmdb"
echolog " TheTVDB $grabber_tvdb"
echolog " TVRage $grabber_tvrage"
echolog ""
echolog "Miscellaneous:"
echolog " Documentation: $doc"
echolog ""
#################################################
# save configs attributes
#################################################
echolog "Creating config.mak ..."
echo "# Automatically generated by configure - do not modify!" > $CONFIGFILE
append_config "PREFIX=$PREFIX"
append_config "prefix=\$(DESTDIR)\$(PREFIX)"
append_config "bindir=\$(DESTDIR)$bindir"
append_config "libdir=\$(DESTDIR)$libdir"
append_config "includedir=\$(DESTDIR)$includedir"
append_config "docdir=\$(DESTDIR)$docdir"
append_config "MAKE=$make"
append_config "CC=$cc"
append_config "AR=$ar"
append_config "RANLIB=$ranlib"
append_config "LN=ln"
append_config "BUILD_STATIC=$static"
append_config "BUILD_SHARED=$shared"
append_config "BUILD_DYLIB=$dylib"
append_config "VERSION=$VERSION"
if enabled dostrip; then
append_config "STRIP=$strip"
append_config "INSTALLSTRIP=$installstrip"
else
append_config "STRIP=echo ignoring strip"
append_config "INSTALLSTRIP="
fi
append_config "EXTRALIBS=$extralibs"
append_config "CPPFLAGS=$CPPFLAGS"
append_config "OPTFLAGS=$CFLAGS"
append_config "LDFLAGS=$LDFLAGS"
append_config "INSTALL=$INSTALL"
if enabled bigendian; then
append_config "WORDS_BIGENDIAN=yes"
fi
append_config "XML=$xml"
append_config "EXIF=$exif"
append_config "NFO=$nfo"
append_config "MD5=$avutil"
append_config "HMAC_SHA256=$gcrypt"
append_config "GRABBER=$grabber"
append_config "GRABBER_DUMMY=$grabber_dummy"
append_config "GRABBER_ALLOCINE=$grabber_allocine"
append_config "GRABBER_AMAZON=$grabber_amazon"
append_config "GRABBER_EXIF=$grabber_exif"
append_config "GRABBER_FFMPEG=$grabber_ffmpeg"
append_config "GRABBER_IMDB=$grabber_imdb"
append_config "GRABBER_LASTFM=$grabber_lastfm"
append_config "GRABBER_LOCAL=$grabber_local"
append_config "GRABBER_LYRICSFLY=$grabber_lyricsfly"
append_config "GRABBER_LYRICWIKI=$grabber_lyricwiki"
append_config "GRABBER_NFO=$grabber_nfo"
append_config "GRABBER_TMDB=$grabber_tmdb"
append_config "GRABBER_TVDB=$grabber_tvdb"
append_config "GRABBER_TVRAGE=$grabber_tvrage"
append_config "DEBUG=$debug"
append_config "DOC=$doc"
#################################################
# make pkg-config files
#################################################
echolog "Creating libvalhalla.pc ..."
pkgconfig_generate libvalhalla \
"A tiny media scanner library" \
"$VERSION" \
"-lvalhalla" \
"$extralibs" \
"" \
"" \
"$pkgconfig_requires"
clean
exit 0
|