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 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606
|
# ********** **********
# ********** Autoconf, configure internals **********
# ********** **********
AC_REVISION(norev)
AC_PREREQ(2.53)
AC_INIT(Makefile.config.in)
AC_CONFIG_HEADER(config.h)
CONFIGURE_RUN=yes
CONFIGURE_ARGUMENTS=$ac_configure_args
echo "Arguments to configure: $CONFIGURE_ARGUMENTS"
cd ..
SOURCE_DIR=`pwd`
cd config
# ********** **********
# ********** MLDonkey version **********
# ********** **********
MAJOR_VERSION=2
MINOR_VERSION=8
SUB_VERSION=1 # range 0-7 due to eMule limitations
# ********** **********
# ********** check for C compiler **********
# ********** **********
AC_PROG_CC
CC_VERSION=`$CC -dumpversion`
AC_EXEEXT
AC_PROG_CPP
# ********** **********
# ********** System checks **********
# ********** **********
AC_CANONICAL_HOST
OS_FILES=unix
OS_FILES2=unix
SYSTEM=unknown
FIX_BROKEN_CPP=
case $host in
*mingw*)
SYSTEM=mingw
OS_FILES=mingw
OS_FILES2=mingw
PTHREAD_LIBS="-lpthreadGC2 -lwsock32"
PTHREAD_CFLAGS="-DPTW32_STATIC_LIB"
AC_MSG_CHECKING(for mingw-runtime version)
cat >mingw_rt_ver.c <<'END'
#include <stdio.h>
#include <_mingw.h>
main(int argc, char *argv[[]]) {
int required_runtime_major=3; /********** change required mingw-runtime **********/
int required_runtime_minor=10; /********** version here **********/
#ifdef __MINGW32_MAJOR_VERSION
# ifdef __MINGW32_MINOR_VERSION
switch(argv[[1]][[0]]) {
case 'x':
printf("%d.%d", __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION);
break;
case 'y':
if ((__MINGW32_MAJOR_VERSION == required_runtime_major && __MINGW32_MINOR_VERSION < required_runtime_minor) ||
(__MINGW32_MAJOR_VERSION < required_runtime_major)) {
printf("no");
break; }
else {
printf("yes");
break; }
case 'z':
printf("%d.%d", required_runtime_major, required_runtime_minor);
break;
}
return 0;
# else
printf("__MINGW32_MINOR_VERSION not defined in _mingw.h");
return 0;
# endif
#else
printf("__MINGW32_MAJOR_VERSION not defined in _mingw.h");
return 0;
#endif
}
END
$CC -o mingw_rt_ver ./mingw_rt_ver.c
MINGW_RT_VER="`./mingw_rt_ver x`"
MINGW_RT_VER_OK="`./mingw_rt_ver y`"
MINGW_RT_VER_REQ="`./mingw_rt_ver z`"
rm -f mingw_rt_ver mingw_rt_ver.*
AC_MSG_RESULT($MINGW_RT_VER)
if test "$MINGW_RT_VER_OK" = "no"; then
echo "******** mingw-runtime version $MINGW_RT_VER_REQ is required *********" 1>&2;
exit 1
fi
;;
*cygwin*)
SYSTEM=cygwin
OS_FILES2=cygwin
;;
*freebsd*|*dragonfly*)
SYSTEM=freebsd
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
;;
*openbsd*)
SYSTEM=openbsd
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
;;
*netbsd*)
SYSTEM=netbsd
;;
*linux*)
SYSTEM=linux
;;
*solaris*)
SYSTEM=solaris
;;
*morphos*|*amigaos*)
SYSTEM=morphos
;;
*aix*)
SYSTEM=aix
;;
*beos*)
SYSTEM=beos
;;
*osf*)
SYSTEM=osf
;;
*irix*)
SYSTEM=irix
;;
*hppa*|*hpux*)
SYSTEM=hpux
;;
*darwin*|*rhapsody*|*macosx*)
SYSTEM=macosx
AC_CHECK_PROG(SED, sed, sed)
if test "$ac_cv_prog_SED" = "sed"; then
FIX_BROKEN_CPP="| sed -n '/^\#pragma/!p'"
else
AC_CHECK_PROG(GREP, grep, grep)
if test "$ac_cv_prog_GREP" = "grep"; then
FIX_BROKEN_CPP="| grep -v '^\#pragma'"
fi
fi
if test "xFIX_BROKEN_CPP" = "x"; then
echo "Apple cpp produces broken files, your system lacks sed or grep to fix it"
exit 1
fi
;;
esac
if test "x$SYSTEM" = "xunknown"; then
echo "Unknown build system, please report to the MLDonkey development team at http://mldonkey.sourceforge.net/forums/"
exit 1
fi
case "$host" in
alpha*-*-osf*) arch=alpha; system=digital;;
alpha*-*-linux*) arch=alpha; system=linux;;
alpha*-*-freebsd*) arch=alpha; system=freebsd;;
alpha*-*-netbsd*) arch=alpha; system=netbsd;;
alpha*-*-openbsd*) arch=alpha; system=openbsd;;
sparc-*-sunos4.*) arch=sparc; system=sunos;;
sparc-*-solaris2.*) arch=sparc; system=solaris;;
sparc-*-*bsd*) arch=sparc; system=bsd;;
sparc-*-linux*) arch=sparc; system=linux;;
i?86-*-linux*) arch=i386; system=linux;;
i386-*-*bsd*) arch=i386; system=bsd;;
i486-*-*bsd*) arch=i486; system=bsd;;
i586-*-*bsd*) arch=i586; system=bsd;;
i686-*-*bsd*) arch=i686; system=bsd;;
i?86-*-nextstep*) arch=i386; system=nextstep;;
i?86-*-solaris*) arch=i386; system=solaris;;
i?86-*-beos*) arch=i386; system=beos;;
i?86-*-cygwin*) arch=i386; system=cygwin;;
mips-*-irix6*) arch=mips; system=irix;;
hppa1.1-*-hpux*) arch=hppa; system=hpux;;
hppa1.1-*-nextstep*) arch=hppa; system=nextstep;;
rs6000-*-aix*) arch=power; model=rs6000; system=aix;;
powerpc-*-aix*) arch=power; model=ppc; system=aix;;
powerpc-*-linux*) arch=power; model=ppc; system=elf;;
powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
powerpc-*-darwin*) arch=power; model=ppc; system=rhapsody;;
arm*-*-linux*) arch=arm; system=linux;;
ia64-*-linux*) arch=ia64; system=linux;;
esac
MD4ARCH=$arch
case $host in
i386-pc-linux*|i386-*-*bsd*) MD4COMP=as; MD4ARCH=i386;;
i486-pc-linux*|i486-*-*bsd*) MD4COMP=as; MD4ARCH=i486;;
i586-pc-linux*|i586-*-*bsd*) MD4COMP=as; MD4ARCH=i586;;
i686-pc-linux*|i686-*-*bsd*) MD4COMP=as; MD4ARCH=i686;;
i386-pc-mingw32*) MD4COMP=cc; MD4ARCH=i386;;
i486-pc-mingw32*) MD4COMP=cc; MD4ARCH=i486;;
i586-pc-mingw32*) MD4COMP=cc; MD4ARCH=i586;;
i686-pc-mingw32*) MD4COMP=cc; MD4ARCH=i686;;
*) MD4COMP=cc;;
esac
ARCH=$arch
# ********** **********
# ********** Parse checkout date (CVS) or revision (SVN) if available **********
# ********** **********
if test -d .svn; then
AC_MSG_NOTICE(checking SVN revision)
AC_CHECK_PROG(SVNVERSION,svnversion,svnversion)
if test "$ac_cv_prog_SVNVERSION" = "svnversion"; then
SUB_VERSION3="SVN"
SCM_VERSION=`svnversion -n .`
else AC_MSG_NOTICE(cannot checking SVN revision... no SVNVERSION)
SCM_VERSION="cannot find out SVN revision (no SVNVERSION)"
fi
fi
if test -f ./CVS/Entries ; then
AC_MSG_NOTICE(checking CVS checkout date)
AC_CHECK_PROGS(STAT, stat gstat, stat)
if [ test "$ac_cv_prog_STAT" = "stat" ] || [ test "$ac_cv_prog_STAT" = "gstat" ]; then
AC_CHECK_PROG(SED, sed, sed)
if test "$ac_cv_prog_SED" = "sed"; then
AC_CHECK_PROG(CUT, cut, cut)
if test "$ac_cv_prog_CUT" = "cut"; then
SUB_VERSION3="CVS"
if [ test "$SYSTEM" = "freebsd"] || [ test "$SYSTEM" = "netbsd"] || ( [ test "$SYSTEM" = "macosx" ] && [ test "$ac_cv_prog_STAT" != "gstat" ] ); then
SCM_VERSION=`$STAT -f "%Sm" ./CVS/Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\4-\1-\2 \3/'`
else
if [ test "$SYSTEM" = "openbsd"]; then
AC_CHECK_PROG(GREP, grep, grep)
if test "$ac_cv_prog_GREP" = "grep"; then
SCM_VERSION=`$STAT -f %a ./CVS/Entries | $GREP -v Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\1-\2-\4 \3/'`
fi
else
if [ test "$SYSTEM" = "mingw"] || [ test "$SYSTEM" = "cygwin"]; then
AC_CHECK_PROG(GREP, grep, grep)
if test "$ac_cv_prog_GREP" = "grep"; then
SCM_VERSION=`$STAT ./CVS/Entries | $GREP Modify | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\5-\2-\3 \4/'`
fi
else
SCM_VERSION=`$STAT -Lc %y ./CVS/Entries | $SED -e 's#\.[0-9]*##' | $CUT -c 1-19`
fi #if [ test "$SYSTEM" = "mingw"] || ...
fi #if [ test "$SYSTEM" = "openbsd"]
fi #if [ test "$SYSTEM" = "freebsd"] || ...
else
AC_MSG_NOTICE(cannot checking CVS checkout date... no CUT)
SCM_VERSION="cannot find out SCM Version (no CUT)"
fi
else
AC_MSG_NOTICE(cannot checking CVS checkout date... no SED)
SCM_VERSION="cannot find out SCM Version (no SED)"
fi
else
AC_MSG_NOTICE(cannot checking CVS checkout date... no STAT)
SCM_VERSION="cannot find out SCM Version (no STAT)"
fi
fi
# ********** **********
# ********** build MLDonkey version, Required Ocaml and LablGTK versions **********
# ********** **********
MLDONKEY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$SUB_VERSION
if test -f ./subrelease; then
MLDONKEY_VERSION=$MLDONKEY_VERSION`cat ./subrelease`
fi
if test ! -z "$SUB_VERSION3"; then
MLDONKEY_VERSION=$MLDONKEY_VERSION.$SUB_VERSION3
fi
REQUIRED_OCAML=3.09.2
DOWNLOAD_OCAML_MAJOR=3.09
DOWNLOAD_OCAML=3.09.2
REQUIRED_LABLGTK=1.2.7
touch install-sh
LABLGTK_NAME=lablgtk
# ********** **********
# ********** Network and Feature configure switch variables **********
# ********** **********
# ********** currently not working Networks, can't be enabled
SOULSEEK=no
OPEN_NAPSTER=no
OPENFT=no
DIRECT_CONNECT=no
# ********** working Networks, enabled by default
DONKEY=yes
BITTORRENT=yes
GNUTELLA=yes
GNUTELLA2=yes
FASTTRACK=yes
FILETP=yes
# ********** predefined configure variations
MULTINET=yes
MINIMUM=no
# ********** Features, enabled by default
DONKEY_SUI=yes
DONKEY_SUI_FILE=DonkeySui2
GD=yes
BZIP2=yes
MAGIC=yes
ICONV=yes
USE_PTHREAD=yes
# **********
BATCH=no
FORCE_OCAML=no
FORCE_MINGW=no
PROFILE=no
DEBUG=no
GUI=no
CHECKBOUNDS=false
# ********** **********
# ********** Network and Feature configure switches and dependency **********
# ********** **********
AC_ARG_ENABLE(multinet, [ --disable-multinet allows you to only compile support for eDonkey (incl. Overnet and Kademlia)], [MULTINET="$enableval"])
AC_ARG_ENABLE(minimum, [ --enable-minimum compile MLDonkey with minimum features and Networks (eDonkey, iconv and thread enabled)], [MINIMUM="$enableval"])
AC_ARG_ENABLE(minimum, [ --enable-minimum=all disable all optional features and Networks excepting eDonkey], [MINIMUM="$enableval"])
if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
GNUTELLA=no
GNUTELLA2=no
FASTTRACK=no
FILETP=no
BITTORRENT=no
fi
if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
DONKEY_SUI=no
GD=no
BZIP2=no
MAGIC=no
fi
if [ test "$MINIMUM" = "all" ]; then
USE_PTHREAD=no
ICONV=no
fi
#AC_ARG_ENABLE(soulseek, [ --disable-soulseek allows you to remove support for SoulSeek], [SOULSEEK="$enableval"])
#AC_ARG_ENABLE(opennap, [ --disable-opennap allows you to remove support for Open Napster], [OPEN_NAPSTER="$enableval"])
#AC_ARG_ENABLE(directconnect, [ --disable-directconnect allows you to remove support for Direct Connect], [DIRECT_CONNECT="$enableval"])
#AC_ARG_ENABLE(openft, [ --disable-openft allows you to remove support for OpenFT], [OPENFT="$enableval"])
AC_ARG_ENABLE(donkey, [ --disable-donkey allows you to remove support for eDonkey], [DONKEY="$enableval"])
AC_ARG_ENABLE(donkeysui, [ --disable-donkeysui allows you to remove support for eMule SecureUserIdent], [DONKEY_SUI="$enableval"])
AC_ARG_ENABLE(bittorrent, [ --disable-bittorrent allows you to remove support for Bittorent], [BITTORRENT="$enableval"])
AC_ARG_ENABLE(filetp, [ --disable-filetp allows you to remove support for fileTP], [FILETP="$enableval"])
AC_ARG_ENABLE(gnutella, [ --disable-gnutella allows you to remove support for Gnutella], [GNUTELLA="$enableval"])
AC_ARG_ENABLE(gnutella2, [ --disable-gnutella2 allows you to remove support for Gnutella2], [GNUTELLA2="$enableval"])
AC_ARG_ENABLE(fasttrack, [ --disable-fasttrack allows you to remove support for FastTrack], [FASTTRACK="$enableval"])
AC_ARG_ENABLE(batch, [ --enable-batch reply YES to all queries in this script], [BATCH="$enableval"])
AC_ARG_ENABLE(force-ocaml, [ --enable-force-ocaml force usage of self-compiled Ocaml], [FORCE_OCAML="$enableval"])
AC_ARG_ENABLE(ocamlver, [ --enable-ocamlver=VER force usage of specific Ocaml version (3.08.1|CVS), ], [REQUIRED_OCAML="$enableval"])
AC_ARG_ENABLE(mingw, [ --enable-mingw forces compilation with MINGW on Cygwin], [FORCE_MINGW="$enableval"])
AC_ARG_ENABLE(checks, [ --enable-checks force mldonkey to perform bound checks on array/string access], [CHECKBOUNDS="$enableval"])
if test "$CHECKBOUNDS" = "yes"; then
CHECKBOUNDS=true
fi
AC_ARG_ENABLE(profile, [ --enable-profile allows you to profile mlnet using gprof], [PROFILE="$enableval"])
AC_ARG_ENABLE(debug, [ --enable-debug allows you to compile mlnet with debug symbols], [DEBUG="$enableval"])
AC_ARG_ENABLE(gui, [ --disable-gui allows you to disable GUI build (default)], [GUI="$enableval"])
AC_ARG_ENABLE(gui, [ --enable-gui=oldgui|newgui1|newgui2
allows you to choose a GUI (default: newgui2 - is a GTK2 GUI, other GUIs use GTK1)], [GUI="$enableval"])
if test "$GUI" = "yes"; then
GUI=newgui2
fi
if test ! "$GUI" = "newgui2"; then
if test ! "$GUI" = "newgui1"; then
if test ! "$GUI" = "oldgui"; then
GUI=no
fi
fi
fi
AC_ARG_ENABLE(pthread, [ --disable-pthread allows you to disable pthread support in mldonkey, hurts performance!], [USE_PTHREAD="$enableval"])
AC_ARG_ENABLE(pthread-lib, [ --enable-pthread-lib legacy option], [USE_PTHREAD="$enableval"])
AC_ARG_ENABLE(iconv, [ --disable-iconv disable the use of iconv], [ICONV="$enableval"])
AC_ARG_ENABLE(gd, [ --disable-gd disable the use of gd], [GD="$enableval"])
AC_ARG_ENABLE(bzip2, [ --disable-bzip2 disable the use of bzip2], [BZIP2="$enableval"])
AC_ARG_ENABLE(magic, [ --disable-magic disable the use of libmagic (GNU file)], [MAGIC="$enableval"])
if test "$FORCE_MINGW" = "yes"; then
CC="$CC -mno-cygwin"
CPP="$CPP -mno-cygwin"
OS_FILES=mingw
OS_FILES2=mingw
SYSTEM=mingw
fi
OCAML_PATH=
echo -e "\n--------------------------------"
echo " Checking system tools."
echo "--------------------------------"
AC_PROG_RANLIB
AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
AC_CHECK_PROG(GNU_MAKE, make, make)
if test "x$GNU_MAKE" != "x"; then
AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
$GNU_MAKE --version > /dev/null 2>&1
if test "$?" != "0"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR(GNU make not found)
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_ERROR(GNU make not found)
fi
AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
AC_CHECK_PROG(COMPRESS, gzip, gzip)
if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
COMPRESS_EXT=bz2
else
COMPRESS_EXT=gz
fi
AC_PATH_PROG(PERL, perl, perl)
AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
AC_CHECK_PROG(RPMBUILD,rpm,rpm)
AC_CHECK_PROG(WGET, wget, wget)
if test -z "$ac_cv_prog_WGET"; then
$CC -o wget wget.c || echo "Cannot compile wget.c"
AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
ac_cv_prog_WGET="$ac_cv_path_WGET"
fi
WGET="$ac_cv_prog_WGET"
echo "----------------------------------------"
echo " Checking system tools finished."
echo -e "----------------------------------------\n"
echo "--------------------------------"
echo " Checking Ocaml compiler."
echo "--------------------------------"
CONFIG_DIR=$SOURCE_DIR/config
PATCH_DIR=$SOURCE_DIR/patches
LOCAL_DIR=$PATCH_DIR/local
BUILD_DIR=$PATCH_DIR/build
AC_ARG_ENABLE(local-prefix, [ --enable-local-prefix=DIR allows you to specify where you want temporary tools to be installed (DIR must be absolute)], [LOCAL_DIR="$enableval"])
LOCAL=$LOCAL_DIR
LOCAL_OCAML=$LOCAL_DIR/bin
AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
BUILD_OCAML=no
if [ test -z "$OCAMLC" ] || [ test "$REQUIRED_OCAML" = "CVS" ]; then
BUILD_OCAML=yes
else
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
case "$OCAMLVERSION" in
"$REQUIRED_OCAML"*) ;;
3.09.0*) ;;
3.09.1*) ;;
3.09.3*) ;;
3.08.4*) ;;
3.08.3*) ;;
*)
echo "Need build"
BUILD_OCAML=yes
;;
esac
fi
if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
if [ test "$SYSTEM" = "mingw" ]; then
echo "******** Objective-Caml $REQUIRED_OCAML is required *********" 1>&2;
echo "******** no valid Ocaml compiler found on your system *********" 1>&2;
echo "******** on MinGW there is no possibility to let configure *********" 1>&2;
echo "******** build the Ocaml compiler with the included script *********" 1>&2;
echo "******** check http://mldonkey.sourceforge.net/Windows *********" 1>&2;
echo "******** for instuctions how to compile Ocaml under MinGW *********" 1>&2;
exit 1
else
echo "******** Objective-Caml $REQUIRED_OCAML is required *********" 1>&2;
if [ test "$WGET" = "" ] && [ test "$REQUIRED_OCAML" != "CVS" ]; then
echo "******** wget is missing *********" 1>&2;
echo "******** cannot download Ocaml *********" 1>&2;
exit 1
fi
echo "******* Check http://caml.inria.fr/ ********" 1>&2;
echo "Do you want this script to try to download and install ocaml"
echo "LOCALLY in mldonkey directory ?"
if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
case "$i" in
y* | Y*)
cd $PATCH_DIR
if [ test "$REQUIRED_OCAML" = "CVS" ]; then
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cvs -d:pserver:anoncvs:""@camlcvs.inria.fr:/caml login
cvs -z3 -d:pserver:anoncvs@camlcvs.inria.fr:/caml co -P ocaml
cd ocaml
else
if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
echo Downloading ...
$WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/ocaml-"$REQUIRED_OCAML".tar.gz
fi
if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
$WGET http://caml.inria.fr/pub/distrib/ocaml-3.08/ocaml-"$REQUIRED_OCAML".tar.gz
fi
if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
echo "******** download Ocaml $REQUIRED_OCAML not successful, try do download it manually *********" 1>&2;
echo "******** from http://caml.inria.fr/pub/distrib/ *********" 1>&2;
echo "******** and copy the tar.gz into $PATCH_DIR *********" 1>&2;
exit 1
fi
echo Uncompressing ...
mkdir -p $BUILD_DIR
cd $BUILD_DIR
rm -rf ocaml-"$REQUIRED_OCAML"
gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
cd ocaml-"$REQUIRED_OCAML"
if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
echo Patching ...
patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
fi
fi
echo Configuring ...
./configure -prefix $LOCAL_DIR -host $host -cc $CC
cd config
cp -f Makefile Makefile.old
sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
cd ..
cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
echo Compiling ...
$GNU_MAKE world opt opt.opt
echo Installing ...
$GNU_MAKE install
if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
ln -s vmthreads $LOCAL_DIR/lib/ocaml/threads
fi
fi
cd $BUILD_DIR
if [ test "$REQUIRED_OCAML" = "CVS" ]; then
rm -rf ocaml
else
rm -rf ocaml-"$REQUIRED_OCAML"
fi
cd $CONFIG_DIR
echo Ocaml locally installed for mldonkey
if test -f "$LOCAL_OCAML"/ocamlc.opt; then
OCAMLC=$LOCAL_OCAML/ocamlc.opt
ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
else
if test -f "$LOCAL_OCAML"/ocamlc; then
OCAMLC=$LOCAL_OCAML/ocamlc
ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
else
echo "Ocaml installation failed"; exit 1
fi
fi
;;
*) exit 1;;
esac
fi
fi
if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
OCAML_PATH="$LOCAL_OCAML"/
OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
OCAMLDOC=$LOCAL_OCAML/ocamldoc
OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
OCAMLDEP=$LOCAL_OCAML/ocamldep
OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
OCAMLYACC=$LOCAL_OCAML/ocamlyacc
CAMLP4=$LOCAL_OCAML/camlp4
else
if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
OCAML_PATH="$LOCAL_OCAML"/
if test -f "$LOCAL_OCAML/ocamlopt"; then
OCAMLOPT=$LOCAL_OCAML/ocamlopt
else
OCAMLOPT=no
fi
OCAMLDOC=$LOCAL_OCAML/ocamldoc
OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
OCAMLDEP=$LOCAL_OCAML/ocamldep
OCAMLLEX=$LOCAL_OCAML/ocamllex
OCAMLYACC=$LOCAL_OCAML/ocamlyacc
CAMLP4=$LOCAL_OCAML/camlp4
else
AC_CHECK_PROG(OCAMLOPT, ocamlopt.opt, ocamlopt.opt)
AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt, no)
AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
AC_CHECK_PROG(OCAMLLEX, ocamllex.opt, ocamllex.opt)
AC_CHECK_PROG(OCAMLLEX, ocamllex, ocamllex)
AC_CHECK_PROG(OCAMLYACC, ocamlyacc, ocamlyacc)
AC_CHECK_PROG(OCAMLDOC, ocamldoc, ocamldoc)
AC_CHECK_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop)
AC_CHECK_PROG(CAMLP4, camlp4, camlp4)
fi
fi
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
OCAMLLIB=`$OCAMLC -where`
REBUILD_OCAML=no
case "$OCAMLVERSION" in
"$REQUIRED_OCAML"*) ;;
3.09.0*) ;;
3.09.1*) ;;
3.09.3*) ;;
3.08.4*) ;;
3.08.3*) ;;
*)
if [ test "$REQUIRED_OCAML" != "CVS" ]; then
REBUILD_OCAML=yes
fi
;;
esac
if test "$REBUILD_OCAML" = "yes"; then
echo "******** Version $REQUIRED_OCAML of Objective-Caml is required *********" 1>&2;
echo "******* Check http://caml.inria.fr/ ********" 1>&2;
exit 1;
fi
if test "$OCAMLOPT" = "no"; then
TARGET_TYPE=byte
OCAMLLIB_EXT=cma
else
TARGET_TYPE=opt
OCAMLLIB_EXT=cmxa
OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
echo "******** Version $REQUIRED_OCAML of ocamlopt is required *********" 1>&2;
echo "******* Check http://caml.inria.fr/ ********" 1>&2;
exit 1; }
fi
echo "-------------------------------------------"
echo " Checking Ocaml $OCAMLVERSION finished."
echo "-------------------------------------------"
if test "$PROFILE" = "yes"; then
OCAMLOPT="$OCAMLOPT -p"
CFLAGS="$CFLAGS -pg"
fi
if test "$FORCE_MINGW" = "yes"; then
OCAMLC="$OCAMLC -ccopt -mno-cygwin"
OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
fi
if test "$DEBUG" = "yes"; then
OCAMLC="$OCAMLC -g"
fi
echo -e "\n----------------------------------"
echo " Checking system headers."
echo "----------------------------------"
ifelse(AC_ACVERSION, [2.13], [],
[dnl Large file enabled
AC_SYS_LARGEFILE
])
# Sizes of various common basic types
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror)
AC_CHECK_HEADERS(byteswap.h,,)
# various header files
AC_CHECK_HEADERS([sys/utsname.h])
AC_CHECK_HEADERS(arpa/inet.h,,)
AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
])
# poll if possible
AC_CHECK_HEADERS(sys/poll.h,,)
AC_CHECK_FUNCS(poll,,)
AC_CHECK_HEADERS(sys/vfs.h,,)
AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
[#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
echo "-------------------------------------------"
echo " Checking system headers finished."
echo -e "-------------------------------------------\n"
echo "-----------------------------------"
echo " Checking system libraries."
echo "-----------------------------------"
echo "----- checking zlib (required)"
AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
if test "$BZIP2" != "no"; then
echo "----- checking bzlib (optional)"
AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
fi
if test "$BZIP2" = "yes"; then
AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
else
AC_MSG_NOTICE(bzlib not available)
fi
if test "$MAGIC" != "no"; then
echo "----- checking libmagic (GNU file) (optional)"
AC_CHECK_HEADERS(magic.h,
[AC_CHECK_LIB(magic,magic_file,
[AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
[MAGIC=no])],
[MAGIC=no])
fi
if test "$MAGIC" = "yes"; then
MAGICLIB=Magic_magic
else
MAGICLIB=Magic_nomagic
AC_MSG_NOTICE(libmagic not available)
fi
GD_JPG=no
GD_PNG=no
if test "$GD" != "no"; then
echo "----- checking gd (optional)"
GD=no
LIBGD=no
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
SAVE_LDFLAGS=$LDFLAGS
AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
GD_LIBS=`$GDLIBCONFIG --libs`
GD_LIBS2="$LIBS -lgd $GD_LIBS"
LIBS=$GD_LIBS2
GD_CFLAGS=`$GDLIBCONFIG --cflags`
CFLAGS="$CFLAGS $GD_CFLAGS"
GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
LDFLAGS="$LDFLAGS $GD_LDFLAGS"
AC_MSG_CHECKING(for libgd > 2.0.14)
GDVERSION=`$GDLIBCONFIG --version`
GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
GDMINORVERSION=`$GDLIBCONFIG --minorversion`
GDREVISION=`$GDLIBCONFIG --revision`
if [ [ $GDMAJORVERSION = 2 ] && [ $GDMINORVERSION = 0 ] && [ $GDREVISION -gt 14 ]]; then
AC_MSG_RESULT($GDVERSION)
LIBGD=yes
else
AC_MSG_RESULT(no (found $GDVERSION))
LIBGD=no
fi
else
LIBGD=yes
fi
if test "$LIBGD" = "yes"; then
AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
fi
if test "$LIBGD" = "yes"; then
AC_MSG_CHECKING(for gdImageCreate in -lgd)
AC_TRY_LINK([#include <gd.h>],
[gdImageCreate (0,0);],
[LIBGD=yes], [LIBGD=no])
AC_MSG_RESULT($LIBGD)
LIBS=$SAVE_LIBS
if test "$LIBGD" = "no"; then
AC_MSG_NOTICE([not found, trying another method])
AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
fi
fi
if test "$LIBGD" = "yes"; then
LIBPNG=no
# saving current variables
SAVE_LIBS_PNG=$LIBS
SAVE_CFLAGS_PNG=$CFLAGS
SAVE_LDFLAGS_PNG=$LDFLAGS
AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
# check libpng-config contents and update system variables
PNG_LIBS=`$PNGLIBCONFIG --libs`
LIBS="$LIBS $PNG_LIBS"
PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
CFLAGS="$CFLAGS $PNG_CFLAGS"
PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
fi
AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
# restore variables
LIBS=$SAVE_LIBS_PNG
CFLAGS=$SAVE_CFLAGS_PNG
LDFLAGS=$SAVE_LDFLAGS_PNG
if test "$LIBPNG" = "no"; then
AC_MSG_NOTICE(png support not available)
else
LIBGD_PNG=no
LIBS=$GD_LIBS2
AC_MSG_CHECKING(for gdImagePng in -lgd)
AC_TRY_LINK([#include <gd.h>],
[gdImagePng (0,0);],
[LIBGD_PNG=yes], [LIBGD_PNG=no])
AC_MSG_RESULT($LIBGD_PNG)
LIBS=$SAVE_LIBS
if test "$LIBGD_PNG" = "no"; then
AC_MSG_NOTICE([not found, trying another method])
AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
fi
AC_MSG_CHECKING(for png support in libgd)
if test "$LIBGD_PNG" = "yes"; then
GD=yes
GD_PNG=yes
AC_MSG_RESULT(yes)
AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
else
AC_MSG_RESULT(no)
fi
fi
LIBJPEG=no
AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
if test "$LIBJPEG" = "no"; then
AC_MSG_NOTICE(jpeg support not available)
else
LIBGD_JPG=no
LIBS=$GD_LIBS2
AC_MSG_CHECKING(for gdImageJpeg in -lgd)
AC_TRY_LINK([#include <gd.h>],
[gdImageJpeg (0,0,0);],
[LIBGD_JPG=yes], [LIBGD_JPG=no])
AC_MSG_RESULT($LIBGD_JPG)
LIBS=$SAVE_LIBS
if test "$LIBGD_JPG" = "no"; then
AC_MSG_NOTICE([not found, trying another method])
AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
fi
AC_MSG_CHECKING(for jpeg support in libgd)
if test "$LIBGD_JPG" = "yes"; then
GD=yes
GD_JPG=yes
AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
else
AC_MSG_NOTICE(libgd not available)
fi
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
LDFLAGS=$SAVE_LDFLAGS
fi
if test "$GD" != "no"; then
GDGRAPHICS=DriverGraphics_gd
else
GDGRAPHICS=DriverGraphics_nogd
fi
if test "$ICONV" = "yes"; then
echo "----- checking iconv (optional)"
AM_ICONV
if test "$am_cv_func_iconv" != "yes"; then
AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
ICONV=no
else
LIBS="$LIBS $LIBICONV"
AC_CHECK_FUNCS([locale_charset],,
AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
AC_MSG_NOTICE(found nl_langinfo(CODESET)),
[echo "Your iconv implementation is incomplete"; exit 1]))
AC_CHECK_LIB(charset,locale_charset)
AC_CHECK_HEADERS([libcharset.h])
AC_CHECK_HEADERS([langinfo.h])
AC_CHECK_HEADERS([locale.h])
fi
else
AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
ICONV=no
fi
if test "$USE_PTHREAD" = "no"; then
PTHREAD_LIBS=""
echo "You disabled thread support, this will hurt MLDonkey performance!"
else
echo "----- checking thread support (optional, strongly advised)"
ACX_PTHREAD
fi
# On linux plaforms, we will have to check that includes from kernel are
# available. glibc version test was shamelessly taken from
# http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
GLIBC_VERSION=""
case $host in
*linux*)
echo "----- GNU C Library version"
AC_CHECK_HEADERS(linux/limits.h,, [
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-I /usr/src/linux/include"
AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
CPPFLAGS=$OLD_CPPFLAGS]
)
AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
cat >try.c <<'EOCP'
/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
alone are insufficient to distinguish different versions, such as
2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
libc version 2.1.0. A. Dougherty, June 3, 2002.
*/
#include <stdio.h>
int main(void)
{
#ifdef __GLIBC__
# ifdef __GLIBC_MINOR__
# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
# include <gnu/libc-version.h>
printf("%s\n", gnu_get_libc_version());
# else
printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
# endif
# else
printf("%d\n", __GLIBC__);
# endif
return 0;
#else
return 1;
#endif
}
EOCP
$CC -o try ./try.c
GLIBC_VERSION="`./try`"
AC_MSG_RESULT($GLIBC_VERSION)
rm -f try try.*],)
;;
*) ;;
esac
echo "---------------------------------------------"
echo " Checking system libraries finished."
echo -e "---------------------------------------------\n"
CXX_VERSION=
CRYPTOPPFLAGS=
echo "--------------------------------------"
echo " Checking activated networks."
echo "--------------------------------------"
if test "$DONKEY" = "yes"; then
AC_MSG_CHECKING(eDonkey)
if test -d ../src/networks/donkey; then
AC_MSG_RESULT(yes)
if test "$DONKEY_SUI" = "yes"; then
AC_PROG_CXX
AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
AC_MSG_CHECKING(eMule SUI)
if test x"$NEWCXX" = x"no"
then
AC_MSG_RESULT(no)
CXX=
DONKEY_SUI=no
else
AC_MSG_RESULT(yes)
ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,no_omit_frame_pointer, CRYPTOPPFLAGS="-fno-omit-frame-pointer")
ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
CXX=$NEWCXX
CXX_VERSION=`$CXX -dumpversion`
DONKEY_SUI_FILE=DonkeySui1
AC_DEFINE(HAVE_CRYPTOPP, 1,)
fi
fi
# AC_MSG_CHECKING(eDonkey server)
# if test -d ../src/networks/server; then
# AC_MSG_RESULT(no)
# DONKEY_SERVER=no
# else
# AC_MSG_RESULT(no)
# DONKEY_SERVER=no
# fi
else
DONKEY=no
DONKEY_SUI=no
AC_MSG_RESULT(no)
fi
else
DONKEY_SUI=no
fi
if test "$BITTORRENT" = "yes"; then
AC_MSG_CHECKING(BitTorrent)
if test -d ../src/networks/bittorrent; then
AC_MSG_RESULT(yes)
else
BITTORRENT=no
AC_MSG_RESULT(no)
fi
fi
if test "$FILETP" = "yes"; then
AC_MSG_CHECKING(FileTP)
if test -d ../src/networks/fileTP; then
AC_MSG_RESULT(yes)
else
FILETP=no
AC_MSG_RESULT(no)
fi
fi
if test "$GNUTELLA" = "yes"; then
AC_MSG_CHECKING(Gnutella)
if test -d ../src/networks/gnutella; then
AC_MSG_RESULT(yes)
else
GNUTELLA=no
AC_MSG_RESULT(no)
fi
fi
if test "$GNUTELLA2" = "yes"; then
AC_MSG_CHECKING(G2)
if test -d ../src/networks/gnutella2; then
AC_MSG_RESULT(yes)
else
GNUTELLA2=no
AC_MSG_RESULT(no)
fi
fi
if test "$FASTTRACK" = "yes"; then
AC_MSG_CHECKING(Fasttrack)
if test -d ../src/networks/fasttrack; then
AC_MSG_RESULT(yes)
else
FASTTRACK=no
AC_MSG_RESULT(no)
fi
fi
if test "$DIRECT_CONNECT" = "yes"; then
AC_MSG_CHECKING(DirectConnect)
if test -d ../src/networks/direct_connect; then
AC_MSG_RESULT(yes)
else
DIRECT_CONNECT=no
AC_MSG_RESULT(no)
fi
fi
if test "$SOULSEEK" = "yes"; then
AC_MSG_CHECKING(Soulseek)
if test -d ../src/networks/soulseek; then
AC_MSG_RESULT(yes)
else
SOULSEEK=no
AC_MSG_RESULT(no)
fi
fi
if test "$OPEN_NAPSTER" = "yes"; then
AC_MSG_CHECKING(OpenNapster)
if test -d ../src/networks/opennap; then
AC_MSG_RESULT(yes)
else
OPEN_NAPSTER=no
AC_MSG_RESULT(no)
fi
fi
if test "$OPENFT" = "yes"; then
AC_MSG_CHECKING(OpenFT)
if test -d ../src/networks/openFT; then
AC_MSG_RESULT(yes)
else
OPENFT=no
AC_MSG_RESULT(no)
fi
fi
echo "-----------------------------------------------"
echo " Checking activated networks finished."
echo "-----------------------------------------------"
OCAMLLIB=`$OCAMLC -where`
if test -f $OCAMLLIB/lablgl.cma; then
LABLGL_CMA=lablgl.cma
fi
if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
fi
# Check for GTK only if we want to build the GUI
if test ! "$GUI" = "no"; then
echo "---------------------------------------------------------"
echo "Checking the libraries required to build the GTK GUI."
echo "---------------------------------------------------------"
if test "$GUI" = "newgui2"; then
REQUIRED_GTK=2.4.0
PKG_GTK=gtk+-2.0
AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
AC_MSG_RESULT(yes)
REQUIRED_RSVG=2.4.0
PKG_RSVG=librsvg-2.0
AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
REQUIRED_LABLGTK=2.6.0
LABLGTK_NAME=lablgtk2
AC_MSG_RESULT(yes)
else
GTK_CONFIG=no
AC_MSG_RESULT(no)
fi
else
GTK_CONFIG=no
AC_MSG_RESULT(no)
fi
else
if test "$OS_FILES2" = "mingw"; then
REQUIRED_GTK=1.3.0
PKG_GTK=gtk+-1.3-win32-production
AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
GTK_CONFIG="pkg-config $PKG_GTK"
AC_MSG_RESULT(yes)
else
GTK_CONFIG=no
AC_MSG_RESULT(no)
fi
else
AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
if test "$GTK_CONFIG" = "no"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
fi
fi
else
GTK_CONFIG=no
fi
if test "$GTK_CONFIG" = "no"; then
LABLGTK_CONFIG=no
else
AC_MSG_CHECKING(for native code $LABLGTK_NAME)
if test -f `$OCAMLC -where`/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
if test "$GUI" = "newgui2"; then
if test -f `$OCAMLC -where`/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
AC_MSG_RESULT(yes)
LABLGTK_CONFIG=yes
else
AC_MSG_RESULT(no)
LABLGTK_CONFIG=no
if test -f `$OCAMLC -where`/$LABLGTK_NAME/lablrsvg.cma; then
echo "---------------------------------------------------------"
echo "lablrsvg is not installed properly. See the INSTALL.txt"
echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
echo "probably forgot to call 'make opt' before 'make install'."
echo "---------------------------------------------------------"
else
echo "---------------------------------------------------------"
echo "lablrsvg is not installed. See the INSTALL.txt file of"
echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
echo "may not be installed when you compiled $LABLGTK_NAME."
echo "---------------------------------------------------------"
fi
fi
else
AC_MSG_RESULT(yes)
LABLGTK_CONFIG=yes
fi
else
AC_MSG_RESULT(no)
LABLGTK_CONFIG=no
if test -f `$OCAMLC -where`/$LABLGTK_NAME/lablgtk.cma; then
echo "-------------------------------------------------------------"
echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
echo "probably forgot to call 'make opt' before 'make install'."
echo "-------------------------------------------------------------"
else
echo "Do you want this script to try to download and install $LABLGTK_NAME"
echo "LOCALLY in mldonkey directory ?"
if test "$BATCH" = "no"; then read i; else i=yes; fi
case "$i" in
y* | Y*)
cd $PATCH_DIR
rm -rf lablgtk-"$REQUIRED_LABLGTK"
if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
echo Downloading ...
$WGET http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
fi
if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
mkdir -p $BUILD_DIR
cd $BUILD_DIR
echo Uncompressing ...
gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
(cd lablgtk-"$REQUIRED_LABLGTK"
PATH=$OCAML_PATH:$PATH
export PATH
echo $PATH
if test "$GUI" = "newgui2"; then
./configure --prefix=$LOCAL_DIR
$GNU_MAKE world
$GNU_MAKE install
else
$GNU_MAKE configure
$GNU_MAKE
$GNU_MAKE opt
$GNU_MAKE install
fi
cd ..
rm -rf lablgtk-"$REQUIRED_LABLGTK"
)
cd $CONFIG_DIR
if test -f `$OCAMLC -where`/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
LABLGTK_CONFIG=yes
else
echo "Installation of $LABLGTK_NAME failed"
LABLGTK_CONFIG=no
fi
;;
*);;
esac
fi
fi
fi
if test "$GUI" = "newgui2" ; then
GUIS="mldonkey_gui\$(EXE)"
GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0`"
else
GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
fi
if test "$LABLGTK_CONFIG" = "no"; then
GUI="no"
else
MORE_TARGETS="$MORE_TARGETS $GUIS"
AC_MSG_CHECKING(GToolbox.popup_menu args)
OCAML_LIB_DIR="`$OCAMLC -where`"
GTOOLBOX="$OCAML_LIB_DIR/$LABLGTK_NAME/gToolbox.mli"
grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
if test "$GTOOLBOX_ARGS" = "new"; then
GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
AC_MSG_RESULT(new)
else
GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
AC_MSG_RESULT(old)
fi
echo "---------------------------------------------------------"
echo "End of GTK GUI configuration."
echo "---------------------------------------------------------"
fi
case "$OCAMLVERSION" in
3.06* | 3.07* | 3.08* ) TYPE_FORMAT="";;
*) TYPE_FORMAT="type ('a,'b,'c) ml_format = ('a,'b, 'c,'c) format4 type ('a,'b,'c) format = ('a,'b, 'c) ml_format";;
esac
if test "$OS_FILES" = "mingw"; then
OCAMLDEP_OPTIONS="-slash"
fi
TMK=no
AC_SUBST(LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(CC)
AC_SUBST(CPP)
AC_SUBST(CXX)
AC_SUBST(FIX_BROKEN_CPP)
AC_SUBST(CONFIG_INCLUDES)
AC_SUBST(TYPE_FORMAT)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLDEP_OPTIONS)
AC_SUBST(CAMLP4)
AC_SUBST(PERL)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLMKTOP)
AC_SUBST(SYSTEM)
AC_SUBST(MORE_TARGETS)
AC_SUBST(MORE_SUBDIRS)
AC_SUBST(LABLGL_CMA)
AC_SUBST(LABLGL_CMXA)
AC_SUBST(MD4ARCH)
AC_SUBST(MD4COMP)
AC_SUBST(ICONV)
AC_SUBST(OPEN_NAPSTER)
AC_SUBST(DIRECT_CONNECT)
AC_SUBST(GNUTELLA)
AC_SUBST(GNUTELLA2)
AC_SUBST(BITTORRENT)
AC_SUBST(FILETP)
AC_SUBST(SOULSEEK)
AC_SUBST(OPENFT)
AC_SUBST(FASTTRACK)
AC_SUBST(DONKEY)
AC_SUBST(DONKEY_SUI)
AC_SUBST(CRYPTOPPFLAGS)
AC_SUBST(DONKEY_SUI_FILE)
AC_SUBST(DONKEY_SERVER)
AC_SUBST(GUI)
AC_SUBST(REQUIRED_OCAML)
AC_SUBST(REQUIRED_LABLGTK)
AC_SUBST(ARCH)
AC_SUBST(COMPRESS)
AC_SUBST(COMPRESS_EXT)
AC_SUBST(CHECKBOUNDS)
AC_SUBST(MLDONKEY_VERSION)
AC_SUBST(SCM_VERSION)
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(SUB_VERSION)
AC_SUBST(GTOOLBOX_POPUPMENU)
AC_SUBST(OS_FILES)
AC_SUBST(OS_FILES2)
AC_SUBST(TARGET_TYPE)
AC_SUBST(RPMBUILD)
AC_SUBST(TMK)
AC_SUBST(GTKCFLAGS)
AC_SUBST(GTKLLIBS)
AC_SUBST(GTKLFLAGS)
AC_SUBST(GD)
AC_SUBST(GD_JPG)
AC_SUBST(GD_PNG)
AC_SUBST(GDGRAPHICS)
AC_SUBST(GD_LIBS)
AC_SUBST(GD_CFLAGS)
AC_SUBST(GD_LDFLAGS)
AC_SUBST(BZIP2)
AC_SUBST(MAGIC)
AC_SUBST(MAGICLIB)
BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
AC_SUBST(BUILD_SYSTEM)
AC_SUBST(GLIBC_VERSION)
AC_SUBST(CC_VERSION)
AC_SUBST(CXX_VERSION)
AC_SUBST(CONFIGURE_ARGUMENTS)
AC_SUBST(CONFIGURE_RUN)
AUTOCONF=../src/utils/lib/autoconf.ml
GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
AC_OUTPUT(\
Makefile.config \
mldonkey.rc \
$AUTOCONF.new $GTK_AUTOCONF.new \
../src/utils/lib/magic.ml \
../src/networks/donkey/donkeySui.ml \
../src/daemon/driver/driverGraphics.ml \
../packages/rpm/mldonkey.spec \
../packages/rpm/Makefile \
../packages/slackware/mldonkey.options)
diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
cd ..
echo -e "\nBuilding dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
$GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
echo -e -n "\nConfiguring MLDonkey" $MLDONKEY_VERSION
if test ! -z "$SCM_VERSION"; then
echo -n " - SCM: $SCM_VERSION"
fi
echo " completed."
echo -e "\nNetwork modules:"
echo -n " - eDonkey "
if test "$DONKEY" = "yes"; then
if test "$DONKEY_SUI" = "yes"; then
echo "enabled (eMule SUI enabled)"
else
echo "enabled (eMule SUI disabled)"
fi
else
echo " disabled"
fi
echo -n " - BitTorrent "
if test "$BITTORRENT" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - FileTP (aka wget) "
if test "$FILETP" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - Fasttrack "
if test "$FASTTRACK" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - Gnutella "
if test "$GNUTELLA" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - Gnutella2 "
if test "$GNUTELLA2" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - Open Napster "
if test "$OPEN_NAPSTER" = "yes"; then
echo "enabled - currently not usable"
else
echo " disabled - currently not usable"
fi
echo -n " - Direct Connect "
if test "$DIRECT_CONNECT" = "yes"; then
echo "enabled - currently not usable"
else
echo " disabled - currently not usable"
fi
echo -n " - Soulseek "
if test "$SOULSEEK" = "yes"; then
echo "enabled - currently not usable"
else
echo " disabled - currently not usable"
fi
echo -n " - OpenFT "
if test "$OPENFT" = "yes"; then
echo "enabled - currently not usable"
else
echo " disabled - currently not usable"
fi
echo -e "\nCore features:"
echo " - zlib (required) enabled"
echo -n " - threads "
if test "$USE_PTHREAD" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - bzip2 "
if test "$BZIP2" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - iconv "
if test "$ICONV" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - libmagic "
if test "$MAGIC" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - graphical stats "
if test "$GD" = "yes"; then
echo "enabled"
echo -n " - png support "
if test "$GD_PNG" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
echo -n " - jpg support "
if test "$GD_JPG" = "yes"; then
echo "enabled"
else
echo " disabled"
fi
else
echo " disabled"
fi
if test "$LABLGTK_CONFIG" = "yes"; then
echo -n -e "\n - GUI support "
if test "$GUI" = "newgui1"; then
echo "GTK1 newgui"
else
if test "$GUI" = "newgui2"; then
echo "GTK2 GUI"
else
echo "GTK1 oldgui"
fi
fi
fi
echo -e "\nCompilers:"
echo -e " - Ocaml version $OCAMLVERSION"
echo -e " - $CC version $CC_VERSION"
if test "x$CXX" != "x"; then
echo -e " - $CXX version $CXX_VERSION"
fi
echo -e "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
echo -e "\nTo compile a static code execute: $GNU_MAKE mlnet.static"
echo "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
echo "To clean the build directory execute: $GNU_MAKE maintainerclean"
if test "$DONKEY_SUI" = "yes"; then
echo -e "\nCompiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."
fi
|