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
|
dnl ----------------------------------------------------------
dnl configure.in for ircii, 2.3. copyright (c) matthew green, 1993,
dnl except those bits attributed otherwise.
dnl thanks to the screen 3.3 configure.in for giving me examples to
dnl work from and steal ;)
dnl
dnl @(#)$Id: configure.in,v 1.101 2014/04/09 17:51:06 jnelson Exp $
AC_REVISION([$Revision: 1.101 $])dnl
AC_INIT([source/irc.c])
AC_CONFIG_HEADER([include/defs.h])
unset GREP_OPTIONS
dnl ----------------------------------------------------------
dnl
dnl grok the version number - from source/irc.c
dnl
VERSION=`sed -n -e 's/";$//' -e '/const char irc_version.. = .EPIC.-/s///p' -e '/const char irc_version/q' < $srcdir/source/irc.c`
echo this is EPIC5 version $VERSION
echo
AC_SUBST([VERSION])
dnl ----------------------------------------------------------
dnl
dnl initial stuff
dnl
AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX
AC_AIX
dnl ----------------------------------------------------------
AC_MSG_CHECKING([for an extra library directory])
AC_ARG_WITH([localdir],
[ --with-localdir=/usr/local An extra directory to look for stuff.],[
if test "x$withval" = "x" ; then
if test -d /usr/local/lib ; then
withval="/usr/local"
elif test -d /usr/pkg/lib ; then
withval="/usr/pkg"
elif test -d /opt/lib ; then
withval="/opt"
else
with_extra_libdir="no"
fi
elif test -d "$withval" ; then
with_extra_libdir="yes"
else
with_extra_libdir="no"
fi
if test "x$withval" != "x" ; then
LIBS="-L$withval/lib $LIBS"
CFLAGS="-I$withval/include/ $CFLAGS"
localdir=$withdir
with_extra_libdir="yes"
else
with_extra_libdir="no"
fi
],[
if test "x$withval" = "x" ; then
if test -d /usr/local/lib ; then
withval="/usr/local"
elif test -d /usr/pkg/lib ; then
withval="/usr/pkg"
elif test -d /opt/lib ; then
withval="/opt"
else
with_extra_libdir="no"
fi
fi
if test "x$withval" != "x" ; then
LIBS="-L$withval/lib $LIBS"
CFLAGS="-I$withval/include/ $CFLAGS"
localdir=$withdir
with_extra_libdir="yes"
else
with_extra_libdir="no"
fi
])
AC_MSG_RESULT([$with_extra_libdir, $withval])
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl System specific checks
dnl
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl Checking for solaris cc
dnl
AC_MSG_CHECKING([for solaris cc])
( $CC -V 2>&1 | grep 'Sun C' > /dev/null ) && \
sun_compiler="yes" \
CFLAGS="$CFLAGS -erroff=E_ARG_INCOMPATIBLE_WITH_ARG,E_ASSIGNMENT_TYPE_MISMATCH"
AC_MSG_RESULT([ok])
dnl
dnl checking for svr4's /usr/ccs/lib
dnl
if test -d /usr/ccs/lib; then
LIBS="-L/usr/ccs/lib $LIBS"
fi
dnl
dnl Checking for HP-UX's porting kit (from twincest)
dnl
dnl <twincest> hop: please change configure to look for setenv in -lcext
dnl <twincest> and with -I/usr/include/ep
dnl <twincest> (that's where setenv from the hp-ux porting kit lives)
dnl <twincest> in fact, perhaps just check for /usr/include/ep and -lcext,
dnl +and use them unconditionally if present
dnl
dnl -- Do not use /usr/include/ep/.
dnl
dnl if test -d /usr/include/ep; then
dnl CFLAGS="-I/usr/include/ep $CFLAGS"
dnl fi
AC_CHECK_LIB([cext], [setenv], [LIBS="$LIBS -lcext"],)
dnl
dnl Checking for Macintosh OS X (Written by Zach)
dnl Please note -- MAC OS X perl support only works with macports!
dnl
AC_MSG_CHECKING([for Macintosh OS X])
( $CC --version 2>&1 | grep 'apple-darwin' > /dev/null ) && \
apple_compiler="yes" \
perl_arch_flags="$(perl -MExtUtils::Embed -e 'ccopts;print "\n"; ldopts' | grep -o -- '-arch [-_0-9a-zA-Z]*' | sort -u)" \
CFLAGS="$CFLAGS $perl_arch_flags"
AC_MSG_RESULT([ok])
dnl ----------------------------------------------------------
AC_MSG_CHECKING(if you want threaded stdout)
AC_ARG_WITH(threaded-stdout,
[ --with-threaded-stdout[=yes] Threaded stdout so the client doesn't block when gnu screen malfunctions.],[
if test "x$withval" = "x" ; then
with_threaded_stdout="no"
elif test "x$withval" = "xy" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xY" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xyes" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xYES" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
else
with_threaded_stdout="no"
fi
],[
with_threaded_stdout="no"
])
AC_MSG_RESULT($with_threaded_stdout)
if test "x$with_threaded_stdout" = "xyes" ; then
AC_DEFINE(WITH_THREADED_STDOUT)
threading=1
fi
dnl ----------------------------------------------------------
dnl Where does this belong?
AC_MSG_CHECKING(which multiplexer function to use)
AC_ARG_WITH(multiplex,
[ --with-multiplex[=TYPE] Multiplexer type (select,poll,freebsd-kqueue,pthread,solaris-ports)],[
if test "x$withval" = "x"; then
with_multiplex="select"
elif test "x$withval" = "xselect"; then
with_multiplex="select"
elif test "x$withval" = "xpoll"; then
with_multiplex="poll"
elif test "x$withval" = "xfreebsd-kqueue"; then
with_multiplex="kqueue"
elif test "x$withval" = "xsolaris-ports"; then
with_multiplex="port_create"
elif test "x$withval" = "xpthread"; then
with_multiplex="pthread_create"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
else
with_multiplex="select"
fi
],[
with_multiplex="select"
])
AC_MSG_RESULT($with_multiplex)
AC_CHECK_FUNC($with_multiplex, [
if test "x$with_multiplex" = "xselect" ; then
AC_DEFINE(USE_SELECT)
threading=0
elif test "x$with_multiplex" = "xpoll" ; then
AC_DEFINE(USE_POLL)
threading=0
elif test "x$with_multiplex" = "xkqueue" ; then
AC_DEFINE(USE_FREEBSD_KQUEUE)
threading=0
elif test "x$with_multiplex" = "xport_create" ; then
AC_DEFINE(USE_SOLARIS_PORTS)
threading=0
elif test "x$with_multiplex" = "xpthread_create" ; then
AC_DEFINE(USE_PTHREAD)
threading=1
fi
],[
AC_DEFINE(USE_SELECT)
threading=0
])
dnl ----------------------------------------------------------
dnl
dnl Check for libraries before we check for functions!
dnl
if test -z "$libsocket"; then
AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",)
fi
dnl Check to see if libarchive actually works
dnl XXX I don't understand why this is even necessary.
have_libarchive=""
orig_LIBS="$LIBS"
AC_CHECK_LIB(archive, archive_read_new, [LIBS="$LIBS -larchive"])
AC_MSG_CHECKING(whether libarchive works the way I expect)
AC_TRY_LINK([#include <archive.h>], [
struct archive *x;
const char *s = "bogus.zip";
x = archive_read_new();
archive_read_support_format_all(x);
archive_read_open_file(x, s, 10240);
], have_libarchive="yes")
if test "x$have_libarchive" = "x"; then
LIBS="$orig_LIBS"
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBARCHIVE)
fi
dnl -----
AC_ARG_WITH(ssl,
[ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).],[
if test -z "$withval"; then
with_ssl="yes"
fi
])
AC_MSG_CHECKING(whether to include SSL support)
if test "x$with_ssl" = "xno"; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([You cannot explicitly turn off OpenSSL support any more. This error is intentional. Please remove --without-ssl and try again.])
else
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
# First, let's see if the user overrode the openssl location
ssldir="$with_ssl"
if test "x$ssldir" != "x" -a "x$ssldir" != "xyes"; then
if test -f "$ssldir/include/openssl/ssl.h" &&
test -f "$ssldir/lib/libssl.a"; then
LIBS="$saved_LIBS -L$ssldir/lib -lssl -lcrypto"
CFLAGS="$saved_CFLAGS -I$ssldir/include"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_accept(0);], [have_ssl="yes"])
fi
if test "x$have_ssl" != "xyes"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([I could not find the OpenSSL installed at $with_ssl you asked me to use with --with-ssl=$with_ssl. Please ensure that directory contains the files 'include/openssl/ssl.h' and 'lib/libssl.a'. If you are unsure, remove --with-ssl and just let me auto-detect it.])
fi
fi
# Second, let's see if it just works by default
LIBS="$saved_LIBS -lssl -lcrypto"
CFLAGS="$saved_CFLAGS"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_accept(0);], [have_ssl="yes"])
# Otherwise, go hunting for it.
if test "x$have_ssl" = "x" ; then
for ssldir in $localdir/ssl $localdir/openssl; do
if test "x$have_ssl" != "x"; then
break;
fi
if test "x$ssldir" = "x"; then
continue;
fi
if test -f "$ssldir/include/openssl/ssl.h" &&
test -f "$ssldir/lib/libssl.a"; then
CFLAGS="$saved_CFLAGS -I$ssldir/include"
LIBS="$saved_LIBS -L$ssldir/lib -lssl -lcrypto"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_accept(0);], [have_ssl="yes"])
fi
done
fi
# If we found it somewhere, great! Otherwise, revert.
if test ! -n "$have_ssl"; then
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT([no])
if test "x$with_ssl" != "x"; then
AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])
fi
AC_MSG_ERROR([I was unable to find OpenSSL. If it is not installed, please install it. If it is installed, please help me find it using --with-ssl=/usr/local or similar.])
else
if test "x$threading" = "x1" ; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([whether your SSL is threading compatable])
AC_TRY_RUN([
#define OPENSSL_THREAD_DEFINES
#include <openssl/opensslconf.h>
main ()
{
#if defined(THREADS)
exit(0);
#else
exit(1);
#endif
}
],
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SSL]),
AC_MSG_RESULT([no. Your system can not do SSL with pthreads]),:)
else
AC_DEFINE([HAVE_SSL])
AC_MSG_RESULT([yes])
fi
fi
fi
dnl this is for isc. need the nsl_s library as well.
if test -z "$libinet"; then
AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",)
fi
if test -z "$libnsl"; then
AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",)
fi
AC_CHECK_LIB(sun, getpwnam, LIBS="$LIBS -lsun",)
AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",)
AC_CHECK_LIB(resolv, gethostbyname, LIBS="$LIBS -lresolv",)
AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt",)
AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm",)
AC_CHECK_LIB(rt, clock_gettime, LIBS="$LIBS -lrt",)
termcap=0;
warn_again=0;
AC_MSG_CHECKING(whether you want to use termcap)
AC_ARG_WITH(termcap,
[ --with-termcap Forcibly refuse to use terminfo/ncurses ],
[ AC_MSG_RESULT(yes)
AC_CHECK_LIB(termcap, tgetent, termcap=1;LIBS="-ltermcap $LIBS",
AC_CHECK_LIB(termlib, tgetent, termcap=1;LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(curses, tgetent, termcap=1;LIBS="-lcurses $LIBS",
AC_MSG_WARN(I cant find tgetent. Youll have to help me.))))],
[ AC_MSG_RESULT(no)
AC_CHECK_LIB(ncurses, setupterm, LIBS="-lncurses $LIBS",
AC_CHECK_LIB(tinfo, setupterm, LIBS="-ltinfo $LIBS",
AC_CHECK_LIB(curses, setupterm, LIBS="-lcurses $LIBS",
AC_CHECK_LIB(curses, tgetent, termcap=1;LIBS="-lcurses $LIBS",
AC_CHECK_LIB(termlib, tgetent, termcap=1;LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(termcap, tgetent, termcap=1;LIBS="-ltermcap $LIBS",
AC_MSG_WARN(I cant find tgetent. Youll have to help me.)
warn_again=1))))))])
dnl ----------------------------------------------------------
dnl
dnl Checking for headers, functions, and a type declarations
dnl
AC_CHECK_HEADERS(fcntl.h ieeefp.h inttypes.h math.h ndbm.h netdb.h regex.h stddef.h stdint.h sys/fcntl.h sys/file.h sys/filio.h sys/select.h sys/sysctl.h sys/syslimits.h sys/time.h sys/un.h sys/param.h termios.h sys/termios.h,)
if test $termcap -eq 0 ; then
AC_CHECK_HEADERS(term.h,)
else
AC_CHECK_HEADERS(termcap.h,)
fi
AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM),)
AC_CHECK_FUNC(clock_gettime, AC_DEFINE(HAVE_CLOCK_GETTIME),)
AC_CHECK_FUNC(fchdir, AC_DEFINE(HAVE_FCHDIR),)
AC_CHECK_FUNC(fpathconf, AC_DEFINE(HAVE_FPATHCONF),)
AC_CHECK_FUNC(getlogin, AC_DEFINE(HAVE_GETLOGIN),)
AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO),)
AC_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO),)
AC_CHECK_FUNC(getpass, AC_DEFINE(HAVE_GETPASS),)
AC_CHECK_FUNC(getpgid, AC_DEFINE(HAVE_GETPGID),)
AC_CHECK_FUNC(getpgrp, AC_FUNC_GETPGRP,)
AC_CHECK_FUNC(getservbyport, AC_DEFINE(HAVE_GETSERVBYPORT),)
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY),)
AC_CHECK_FUNC(killpg, AC_DEFINE(HAVE_KILLPG),)
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),)
AC_CHECK_FUNC(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),)
AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME),)
AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH),)
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),)
AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID),)
AC_CHECK_FUNC(tcsetpgrp, AC_DEFINE(HAVE_TCSETPGRP),)
if test $termcap -eq 0 ; then
AC_CHECK_FUNC(setupterm, AC_DEFINE(HAVE_TERMINFO),)
fi
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),)
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR),)
AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT),)
AC_CHECK_FUNC(strlcpy, AC_DEFINE(HAVE_STRLCPY),)
AC_CHECK_FUNC(strptime, AC_DEFINE(HAVE_STRPTIME),)
AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL),)
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME),)
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV),)
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF),)
AC_CHECK_FUNC(finite, AC_DEFINE(HAVE_FINITE),)
AC_MSG_CHECKING(for isfinite macro in math.h)
AC_EGREP_HEADER(isfinite, math.h,
AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_CHECK_FUNC(tparm, AC_DEFINE(HAVE_TPARM),)
dnl -- Oh why does this have to be so painful? --
AC_MSG_CHECKING(whether term.h works by itself)
AC_TRY_RUN([
#include <term.h>
main ()
{
exit(0);
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether term.h requires termio.h and curses.h)
AC_TRY_RUN([
#include <termio.h>
#include <curses.h>
#include <term.h>
main ()
{
exit(0);
}
],
AC_MSG_RESULT(yes)
AC_DEFINE(TERM_H_REQUIRES_CURSES_H),
AC_MSG_RESULT(no, ugh)
AC_DEFINE(DONT_USE_TERM_H), :), :)
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_TYPE_SIGNAL
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_FUNC_ALLOCA
dnl ----------------------------------------------------------
dnl Check to see if we can find intptr_t.
dnl
have_intptr_t=""
AC_MSG_CHECKING(for intptr_t in inttypes.h or stdint.h)
AC_TRY_LINK([#include <inttypes.h>],
[intptr_t x; x = 0;], AC_DEFINE(HAVE_INTPTR_T)
have_intptr_t="yes")
AC_TRY_LINK([#include <stdint.h>],
[intptr_t x; x = 0;], AC_DEFINE(HAVE_INTPTR_T)
have_intptr_t="yes")
if test "x$have_intptr_t" = "x"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
dnl ----------------------------------------------------------
dnl Check to see if we have socklen_t
dnl
AC_MSG_CHECKING(for socklen_t)
AC_EGREP_HEADER(socklen_t, sys/socket.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOCKLEN_T),
AC_MSG_RESULT(no))
dnl ----------------------------------------------------------
dnl
dnl Check to see if we have to include <sys/select.h>
dnl
dnl
AC_MSG_CHECKING(whether sys/types.h defines fd_set)
AC_EGREP_HEADER(fd_set, sys/types.h,
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether sys/select.h defines fd_set)
AC_EGREP_HEADER(fd_set, sys/select.h,
AC_MSG_RESULT(yes)
AC_DEFINE(NEED_SYS_SELECT_H),
AC_MSG_RESULT(no. ugh.)))
dnl ----------------------------------------------------------
dnl
dnl check for struct linger
dnl
AC_MSG_CHECKING(for struct linger)
AC_EGREP_HEADER([struct( | )*linger], sys/socket.h,
AC_MSG_RESULT(yes),
AC_DEFINE(NO_STRUCT_LINGER)
AC_MSG_RESULT(no. ugh.))
dnl ---------------------------------------------------------
dnl
dnl Check for a useful SO_SNDLOWAT.
dnl Some systems (eg, linux) can be bothered to #define SO_SNDLOWAT
dnl but can't be bothered to implement it, instead returning an error.
dnl How completely bogus. Don't #define it if you don't support it!
dnl
AC_MSG_CHECKING(for useful SO_SNDLOWAT)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
main ()
{
#ifndef SO_SNDLOWAT
exit(1);
#else
int d = socket(AF_INET, SOCK_STREAM, 0);
int size = 256;
if (setsockopt(d, SOL_SOCKET, SO_SNDLOWAT, &size, sizeof(size)) < 0)
exit(1);
exit (0);
#endif
}
],
AC_MSG_RESULT(yes, your SO_SNDLOWAT is useful)
AC_DEFINE(HAVE_SO_SNDLOWAT),
AC_MSG_RESULT(no, your SO_SNDLOWAT is broken and/or worthless), :)
dnl ----------------------------------------------------------
dnl
dnl Check for a realpath() that works.
dnl
AC_MSG_CHECKING(for useful realpath)
AC_TRY_RUN([
#include <sys/param.h>
#include <stdlib.h>
main ()
{
char resolved_path[PATH_MAX];
if (realpath("/etc/filethatdoesnotexist", resolved_path) == 0)
exit(1);
exit(0);
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no, your realpath is broken and/or worthless)
AC_DEFINE(HAVE_BROKEN_REALPATH), :)
dnl ----------------------------------------------------------
dnl
dnl Check for sys_siglist declaration
dnl
AC_MSG_CHECKING(for sys_siglist declaration)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/signal.h>
#include <signal.h>
#include <unistd.h>
main()
{
char *s = sys_siglist[0];
exit(0);
}
],
AC_MSG_RESULT(yes)
sys_siglist="1"
AC_DEFINE(SYS_SIGLIST_DECLARED),
AC_MSG_RESULT(no), :)
dnl ----------------------------------------------------------
dnl
dnl Generate signal list, from perl4
dnl
if test x$sys_siglist != x1
then
echo "generating a list of signal names..."
set X `cat /usr/include/signal.h /usr/include/sys/signal.h /usr/include/linux/signal.h 2>&1 | sed 's/^#[ ]*/#/' | awk '
$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
[sig[$3] = substr($2,4,20)]
if (max < $3 && $3 < 60) {
max = $3
}
}
END {
for (i=1; i<=max; i++) {
[if (sig[i] == "")]
printf "%d", i
else
[printf "%s", sig[i]]
if (i < max)
printf " "
}
printf "\n"
}
'`
shift
case $# in
0)
if test -f /bin/csh; then
set X `/bin/csh -cf 'kill -l'`
shift
case $* in
0)
set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
;;
esac
fi
;;
esac
sig_name="ZERO $*"
if test -f sig.inc; then
/bin/rm -f sig.inc
fi
[echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/static char *sys_siglist[] = { "/' >> sig.inc]
fi
dnl ---------------------------------------------------------
dnl Check for NSIG vs sys_nsig vs __sys_nsig
dnl
dnl ......
dnl ----------------------------------------------------------
dnl Check for 'intmax_t'
dnl
have_intmax_t=""
have_strtoimax_t=""
AC_MSG_CHECKING(for intmax_t in inttypes.h or stdint.h)
AC_TRY_LINK([#include <inttypes.h>],
[intmax_t x; x = 0;], have_intmax_t="yes")
AC_TRY_LINK([#include <stdint.h>],
[intmax_t x; x = 0;], have_intmax_t="yes")
if test "x$have_intmax_t" = "x"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_MSG_CHECKING(for strtoimax in inttypes.h or stdint.h)
AC_TRY_LINK([#include <inttypes.h>],
[char *ptr="1";strtoimax(ptr, &ptr, 10)],
have_strtoimax="yes")
AC_TRY_LINK([#include <stdint.h>],
[char *ptr="1";strtoimax(ptr, &ptr, 10)],
have_strtoimax="yes")
if test "x$have_strtoimax" = "x"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_MSG_CHECKING(whether I can use intmax_t for intmax_t)
dnl Can we use (intmax_t) for (intmax_t)?
if test "x$have_intmax_t" != "x" ; then
if test "x$have_strtoimax" != "x" ; then
AC_DEFINE(HAVE_STRTOIMAX)
AC_DEFINE(HAVE_INTMAX_NATIVE)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
dnl Can we use (long long) for (intmax_t) ?
AC_CHECK_SIZEOF([long long], 0)
if test "$ac_cv_sizeof_long_long" != 0; then
AC_DEFINE([HAVE_INTMAX_LONG_LONG])
AC_CHECK_FUNC([strtoll], AC_DEFINE([HAVE_STRTOLL]),
AC_DEFINE([NEED_STRTOLL]))
fi
dnl Can we use (quad_t) for (intmax_t) ?
AC_CHECK_SIZEOF([quad_t], 0)
if test "$ac_cv_sizeof_quad_t" != 0; then
AC_CHECK_FUNC([strtoq], AC_DEFINE([HAVE_STRTOQ])
AC_DEFINE([HAVE_INTMAX_QUADT]),)
fi
dnl Can we use (long) for (intmax_t)? (Yes. always, if we must)
AC_DEFINE([HAVE_INTMAX_LONG])
dnl ----------------------------------------------------------
dnl
dnl need this for dcc stuff
dnl
AC_CHECK_SIZEOF([unsigned int], 4)
if test "$ac_cv_sizeof_unsigned_int" = 4; then
AC_DEFINE([UNSIGNED_INT32])
else
AC_CHECK_SIZEOF([unsigned long], 4)
if test "$ac_cv_sizeof_unsigned_long" = 4; then
AC_DEFINE([UNSIGNED_LONG32])
else
AC_DEFINE([UNKNOWN_32INT])
fi
fi
dnl ----------------------------------------------------------
dnl
dnl It makes a big difference if your system's (struct sockaddr)
dnl structures look like this:
dnl
dnl struct sockaddr {
dnl u_char sa_len;
dnl u_char sa_family;
dnl char sa_data[14];
dnl };
dnl
dnl or this
dnl
dnl struct sockaddr {
dnl u_short sa_family;
dnl char sa_data[14];
dnl };
dnl
dnl so check for that here.
dnl
dnl -----------------------------------------------------------
AC_MSG_CHECKING([to see if your struct sockaddr includes a length field])
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
main()
{
struct sockaddr sa;
sa.sa_len = 0;
exit(0);
}
],
AC_DEFINE([HAVE_SA_LEN])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]), :)
dnl ----------------------------------------------------------
dnl
dnl checks for ipv6-related things
dnl
AC_MSG_CHECKING([whether to support ipv6])
AC_ARG_WITH(ipv6,
[ --with-ipv6 Include IPv6 support],[
if test "x$withval" = "xno" ; then
AC_MSG_RESULT([no])
AC_DEFINE([DO_NOT_USE_IPV6])
else
AC_MSG_RESULT([yes])
fi
],[AC_MSG_RESULT([yes])])
AC_MSG_CHECKING([for struct sockaddr_storage])
AC_EGREP_HEADER([struct( | )*sockaddr_storage], sys/socket.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE),
AC_MSG_RESULT(no))
AC_MSG_CHECKING([for struct sockaddr_in6])
AC_EGREP_HEADER([struct( | )*sockaddr_in6], netinet/in.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6),
AC_MSG_RESULT(no))
AC_MSG_CHECKING([for struct addrinfo])
AC_EGREP_HEADER([struct( | )*addrinfo], netdb.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_ADDRINFO),
AC_MSG_RESULT(no))
dnl ----------------------------------------------------------
dnl
dnl Some implementations of getaddrinfo (*cough*KAME*cough*) don't
dnl support the AF_UNIX protocol family. For these partially incomplete
dnl implementations, we must add our own support in a wrapper.
dnl
AC_MSG_CHECKING([to see if your getaddrinfo supports AF_UNIX])
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/un.h>
#include <stdlib.h>
main()
{
struct addrinfo hints;
struct addrinfo *results;
int retval;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;
hints.ai_family = AF_UNIX;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
retval = getaddrinfo(0, "/tmp/.ircd/6667", &hints, &results);
if (retval != 0)
exit(1);
else
exit(0);
}
],
AC_MSG_RESULT([yes]),
AC_DEFINE(GETADDRINFO_DOES_NOT_DO_AF_UNIX)
AC_MSG_RESULT([no. ugh]), :)
dnl ----------------------------------------------------------
dnl
dnl Socks4 or Socks5 or neither?
dnl
AC_MSG_CHECKING(whether to support SOCKS)
AC_ARG_WITH(socks,
[ --with-socks[=PATH] Compile with SOCKS firewall traversal support.],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "x$withval" != "xyes"; then
LIBS="$LIBS -L$withval"
fi
AC_MSG_RESULT(yes)
LIBS="$LIBS -lsocks"
AC_DEFINE(SOCKS)
AC_DEFINE(connect, Rconnect)
AC_DEFINE(getsockname, Rgetsockname)
AC_DEFINE(bind, Rbind)
AC_DEFINE(accept, Raccept)
AC_DEFINE(listen, Rlisten)
AC_DEFINE(select, Rselect)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(whether to support SOCKS5)
AC_ARG_WITH(socks5,
[ --with-socks5[=PATH] Compile with SOCKS5 firewall traversal support.],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "x$withval" != "xyes"; then
LIBS="$LIBS -L$withval"
CFLAGS="$CFLAGS -I$withval/../include/"
fi
AC_MSG_RESULT(yes)
LIBS="$LIBS -lsocks5"
AC_DEFINE(SOCKS)
AC_DEFINE(USE_SOCKS5)
;;
esac ],
AC_MSG_RESULT(no)
)
dnl ----------------------------------------------------------
dnl
dnl Iconv support?
dnl
AC_ARG_WITH(iconv,
[ --with-iconv[=PATH] Include iconv support (DIR is eg /usr/local).],[
if test -z "$withval"; then
with_iconv="/usr"
fi
])
AC_MSG_CHECKING(whether to include iconv support)
if test "x$with_iconv" = "xno"; then
AC_MSG_RESULT([Iconv support is required; I'm afraid I must insist.])
AC_MSG_CHECKING([whether to include iconv support])
with_iconv=yes
fi
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
dnl First try to see if it's in libc
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
dnl If it's not in libc, look in -liconv
if test "x$have_iconv" = "x"; then
LIBS="$saved_LIBS -liconv"
CFLAGS="$saved_CFLAGS"
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
fi
dnl whatever.
if test "x$with_iconv" = "xyes" ; then
unset with_iconv
fi
dnl Otherwise, go hunting for it.
if test "x$have_iconv" = "x"; then
for iconvdir in "$with_iconv" "$prefix" $localdir /usr/local /usr/pkg /opt /usr/opt; do
if test "x$have_iconv" != "x"; then
break
fi
if test "x$iconvdir" = "x"; then
continue
fi
dnl if test -f "$iconvdir/include/iconv.h" &&
dnl test -f "$iconvdir/lib/libiconv.a"; then
if test -f "$iconvdir/include/iconv.h" ; then
CFLAGS="$saved_CFLAGS -I$iconvdir/include"
LIBS="$saved_LIBS -L$iconvdir/lib -liconv"
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
fi
if test "x$with_iconv" != "x"; then
break
fi
done
fi
# If we found it somewhere, great! Otherwise, revert.
if test "x$have_iconv" = "x"; then
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT(looked but did not find it)
if test "x$with_iconv" != "x" ; then
AC_MSG_ERROR([You specified --with-iconv=$with_iconv but that directory did not contain files include/iconv.h and lib/iconv.a. Either specify a different directory or let me auto-detect it for you])
else
AC_MSG_ERROR([Iconv support is required. I could not find your system's iconv support. If you have iconv installed, please re-run configure with the --with-iconv=/path/to/dir option where include/iconv.h and lib/iconv.a exist.])
fi
else
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ICONV)
fi
dnl #sigh#
dnl AC_CHECK_FUNC(iconv_open, AC_DEFINE(HAVE_ICONV),)
dnl ----------------------------------------------------------
dnl
dnl Job Control / Wserv support?
dnl
AC_MSG_CHECKING(whether you have posix-like job control)
if test "x$ac_cv_func_tcsetpgrp" = "xyes" -a "x$ac_cv_func_setsid" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_DEFINE(NO_JOB_CONTROL)
no_job_control=1
fi
AC_MSG_CHECKING(whether to include wserv support)
include_wserv="yes"
AC_ARG_WITH(wserv,
[ --with-wserv Include Wserv support for multiple screens],[
if test -z "$withval"; then
include_wserv="yes"
else
include_wserv="$withval"
fi
])
if test "x$no_job_control" = "x1" ; then
include_wserv="no"
fi
AC_MSG_RESULT($include_wserv)
if test "x$include_wserv" = "xyes" ; then
WSERV_BIN="wserv4"
WSERV_INSTALL="installwserv4"
fi
dnl ----------------------------------------------------------
dnl
dnl Valgrind assistance support?
dnl
AC_MSG_CHECKING(whether to include Valgrind Memcheck support)
AC_ARG_WITH(valgrind,
[ --with-valgrind Include support for Valgrind Memcheck ],
[],
[with_valgrind=no])
if test "x$with_valgrind" != "xno"; then
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS([valgrind/memcheck.h])
else
AC_MSG_RESULT(no)
fi
dnl ----------------------------------------------------------
dnl
dnl Perl support?
dnl
AC_ARG_WITH(perl,
[ --with-perl[=PATH_TO_PERL_EXE] Compile with perl support.],
[
perlexe=$withval
],
perlexe=yes
)
if test "x$perlexe" = "xyes"; then
perlexe=perl
fi
if test "x$perlexe" = "xno"; then
AC_MSG_CHECKING(whether to support Perl)
AC_MSG_RESULT(no)
else
AC_CHECK_PROG(PERLPROG, $perlexe, "yes", "no")
AC_MSG_CHECKING(whether to support Perl)
if test $PERLPROG != "yes" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
PERLCFLAGS=`$perlexe -MExtUtils::Embed -e ccopts`
PERLLDFLAGS=`$perlexe -MExtUtils::Embed -e ldopts`
AC_MSG_CHECKING(whether embedded perl works the way I expect)
have_embedded_perl="no"
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $PERLCFLAGS"
LDFLAGS="$LDFLAGS $PERLLDFLAGS"
AC_TRY_RUN([
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
int dummy_retval = -1;
/* I "borrowed" this from the perlembed(1) man page */
PerlInterpreter *my_perl;
int startup_perl(int argc, char **argv, char **env)
{
char *embedding[] = {"", "-e", "0" };
my_perl = perl_alloc();
perl_construct(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_parse(my_perl, NULL, 3, embedding, NULL);
if (SvTRUE(ERRSV))
(void)SvPV_nolen(ERRSV);
perl_run(my_perl);
if (SvTRUE(ERRSV))
(void)SvPV_nolen(ERRSV);
perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();
dummy_retval = 0;
return 0;
}
int main (int argc, char **argv, char **environ)
{
startup_perl(argc, argv, environ);
exit(dummy_retval);
}
],
have_embedded_perl="yes",
have_embedded_perl="no",:)
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
if test $have_embedded_perl = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PERL)
AC_DEFINE(PERLCFLAGS)
AC_DEFINE(PERLLDFLAGS)
PERLDOTOH="perl.o"
else
PERLCFLAGS=""
PERLLDFLAGS=""
AC_MSG_RESULT(no, sorry)
PERLCFLAGS=""
PERLLDFLAGS=""
fi
fi
fi
dnl ----------------------------------------------------------
dnl
dnl Tcl support?
dnl
AC_ARG_WITH(tcl,
[ --with-tcl[=PATH_TO_tclConfig.sh] Compile with tcl support.],
[
tclconfig=$withval
],
tclconfig="yes"
)
if test "x$tclconfig" = "xyes" ; then
for i in /usr/lib $localdir/lib $localdir/lib/tcl8.4 ; do
if test -r $i/tclConfig.sh ; then
tclconfig=$i/tclConfig.sh
break;
fi
done
fi
AC_MSG_CHECKING(whether to support TCL)
if test "x$tclconfig" = "xno"; then
AC_MSG_RESULT(no)
else
if test ! -r $tclconfig ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
TCLCFLAGS=`(. $tclconfig && echo $TCL_INCLUDE_SPEC)`
TCLLDFLAGS1=`(. $tclconfig && echo $TCL_LIB_SPEC)`
TCLLDFLAGS2=`(. $tclconfig && echo $TCL_LIBS)`
TCLLDFLAGS=$(eval echo "$TCLLDFLAGS1 $TCLLDFLAGS2")
TCLDOTOH="tcl.o"
AC_MSG_CHECKING(whether embedded tcl works the way I expect)
have_embedded_tcl="no"
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $TCLCFLAGS"
LDFLAGS="$LDFLAGS $TCLLDFLAGS"
AC_TRY_LINK([
#include <tcl.h>
Tcl_Interp *my_tcl;
int Tcl_echoCmd (ClientData clientData, Tcl_Interp *interp, int objc, const char **objv)
{
return TCL_OK;
}
], [
my_tcl = Tcl_CreateInterp();
Tcl_Init(my_tcl);
Tcl_CreateCommand(my_tcl, "echo", Tcl_echoCmd,
(ClientData)NULL, (void (*)()) NULL);
Tcl_DeleteInterp(my_tcl);
], have_embedded_tcl="yes")
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
if test $have_embedded_tcl = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TCL)
AC_DEFINE(TCLCFLAGS)
AC_DEFINE(TCLLDFLAGS)
else
AC_MSG_RESULT(no, sorry)
fi
fi
fi
dnl ----------------------------------------------------------
dnl
dnl Ruby support?
dnl
AC_ARG_WITH(ruby,
[ --with-ruby[=PATH_TO_RUBY_EXE] Compile with ruby support.],
[
rubyexe=$withval
],
rubyexe=yes
)
if test "x$rubyexe" = "xyes"; then
for i in ruby ruby20 ruby19 ruby18 ruby2.0 ruby1.9.1 ruby1.9 ruby1.8; do
$i -h 2>&1 >/dev/null && rubyexe=$i && break
done
if test "x$rubyexe" = "xyes"; then
rubyexe=no
fi
fi
if test "x$rubyexe" = "xno"; then
AC_MSG_CHECKING(whether to support Ruby)
AC_MSG_RESULT(no)
else
AC_CHECK_PROG(RUBYPROG, $rubyexe, "yes", "no")
AC_MSG_CHECKING(whether to support Ruby)
if test $RUBYPROG != "yes" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
dnl ----
dnl Look first for Ruby 1.9
incdir=`$rubyexe -rrbconfig -e 'puts RbConfig::CONFIG[["rubyhdrdir"]]'`
dnl -- Ruby 1.8
if test "x$incdir" = "xnil" ; then
incdir=`$rubyexe -rrbconfig -e 'puts RbConfig::CONFIG[["archdir"]]'`
RUBYCFLAGS="-I$incdir"
dnl -- Ruby 1.9 and 2.0
else
arch=`$rubyexe -rrbconfig -e 'puts RbConfig::CONFIG[["arch"]]'`
RUBYCFLAGS="-I$incdir -I$incdir/$arch/"
fi
rubylibs=`$rubyexe -rrbconfig -e 'puts RbConfig::CONFIG[["LIBRUBYARG"]]'`
extralibs=`$rubyexe -rrbconfig -e 'puts RbConfig::CONFIG[["LIBS"]]'`
RUBYLDFLAGS="$rubylibs $extralibs"
RUBYDOTOH="ruby.o"
AC_MSG_CHECKING(whether embedded ruby works the way I expect)
have_embedded_ruby="no"
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $RUBYCFLAGS"
LDFLAGS="$LDFLAGS $RUBYLDFLAGS"
AC_TRY_LINK([
#include <ruby.h>
VALUE epic_echo (VALUE module, VALUE string)
{
VALUE x;
char *my_string;
x = rb_obj_as_string(string);
my_string = StringValuePtr(x);
return Qnil;
}
], [
VALUE rubyclass;
ruby_init();
ruby_init_loadpath();
rubyclass = rb_define_class("EPIC", rb_cObject);
rb_define_singleton_method(rubyclass, "echo", epic_echo, 1);
rb_gc_register_address(&rubyclass);
], have_embedded_ruby="yes")
if ! test $have_embedded_ruby = "yes" ; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether ruby requires -pthread to link)
RUBYCFLAGS="$RUBYCFLAGS -pthread"
RUBYLDFLAGS="$RUBYLDFLAGS -pthread"
CFLAGS="$CFLAGS $RUBYCFLAGS"
LDFLAGS="$LDFLAGS $RUBYLDFLAGS"
AC_TRY_LINK([
#include <ruby.h>
VALUE epic_echo (VALUE module, VALUE string)
{
VALUE x;
char *my_string;
x = rb_obj_as_string(string);
my_string = STR2CSTR(x);
return Qnil;
}
], [
VALUE rubyclass;
ruby_init();
ruby_init_loadpath();
rubyclass = rb_define_class("EPIC", rb_cObject);
rb_define_singleton_method(rubyclass, "echo", epic_echo, 1);
rb_gc_register_address(&rubyclass);
], have_embedded_ruby="yes")
fi
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
if test $have_embedded_ruby = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RUBY)
AC_DEFINE(RUBYCFLAGS)
AC_DEFINE(RUBYLDFLAGS)
else
RUBYDOTOH=""
HAVE_RUBY=""
RUBYCFLAGS=""
RUBYLDFLAGS=""
AC_MSG_RESULT(no, sorry)
fi
fi
fi
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl closing stuff
dnl
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl set some last minute sanity defaults
dnl
if test -z "$CFLAGS"; then CFLAGS="-g -O"; fi
if test -z "$LDFLAGS"; then LDFLAGS= ; fi
if test -z "$PERLDOTOH"; then PERLDOTOH= ; fi
if test -z "$TCLDOTOH"; then TCLDOTOH= ; fi
if test -z "$RUBYDOTOH"; then RUBYDOTOH= ; fi
if test -z "$WSERV_BIN"; then WSERV_BIN= ; fi
if test -z "$WSERV_INSTALL"; then WSERV_INSTALL= ; fi
if test -z "$bindir"; then bindir=\${prefix}/bin; fi
if test -z "$libdir"; then libdir=\${prefix}/lib; fi
if test -z "$irclibdir"; then irclibdir=\${libdir}/irc; fi
if test -z "$libexecdir"; then libexecdir=\${prefix}/libexec; fi
epic5=`echo "epic5" | sed -e "$program_transform_name"`
if test "$program_prefix" = "NONE" ; then
program_prefix=
fi
AC_MSG_CHECKING(whether to support bounds checking gcc)
AC_ARG_WITH(bc,
[ --with-bc[=PATH_TO_GCC] You have bounds checking gcc and want to use it.],
[ case "$withval" in
no)
AC_MSG_RESULT(no);
;;
*)
if test "x$withval" != "xyes" ; then
CC="$withval"
fi
CFLAGS="$CFLAGS -Wall -fbounds-checking"
LDFLAGS="$LDFLAGS -static"
AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(whether to turn on FreeBSD WARNS-like compiler warnings)
AC_ARG_WITH(warns,
[ --with-warns You wish to use FreeBSD WARNS-like compiler warnings.],
[ case "$withval" in
no)
AC_MSG_RESULT(no);
;;
*)
if test "x$withval" != "xyes" ; then
CFLAGS="$CFLAGS $withval"
fi
CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wuninitialized -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wformat-extra-args -Wno-unused -ansi -fno-builtin"
AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(whether your compiler supports -Wno-pointer-sign)
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_TRY_COMPILE(, [exit(0);],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
CFLAGS="$old_cflags"
)
AC_MSG_CHECKING(whether your compiler supports -fno-strict-aliasing)
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_TRY_COMPILE(, [exit(0);],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
CFLAGS="$old_cflags"
)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(RUBYDOTOH)
AC_SUBST(RUBYCFLAGS)
AC_SUBST(RUBYLDFLAGS)
AC_SUBST(TCLDOTOH)
AC_SUBST(TCLCFLAGS)
AC_SUBST(TCLLDFLAGS)
AC_SUBST(PERLDOTOH)
AC_SUBST(PERLCFLAGS)
AC_SUBST(PERLLDFLAGS)
AC_SUBST(WSERV_BIN)
AC_SUBST(WSERV_INSTALL)
AC_SUBST(bindir)
AC_SUBST(irclibdir)
AC_SUBST(libexecdir)
AC_SUBST(srcdir)
AC_SUBST(includedir)
AC_SUBST(epic5)
AC_SUBST(program_transform_name)
AC_SUBST(program_prefix)
AC_SUBST(mandir)
AC_OUTPUT(Makefile source/Makefile source/info.c.sh)
dnl ---- BLAH BLAH BLAH ---
if test -f sig.inc ; then
mv sig.inc include/
fi
dnl ----------------------------------------------------------
dnl
dnl Commencement
dnl
echo
echo "There you go. Look at include/config.h for any options that "
echo "you might want to change before you 'make'. Don't forget to "
echo "do a 'make install' before you're done."
echo
if test "x$warn_again" != "x0" ; then
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
echo '@@@ IMPORTANT WARNING! @@@'
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
echo ''
echo 'I was unable to find tgetent() which means the build will fail.'
echo 'If you are using linux, you _MUST_ install the ncurses-dev'
echo 'or ncurses-devel package and then "make distclean" and '
echo 'then run configure again.'
echo ''
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
echo '@@@ IMPORTANT WARNING! @@@'
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
fi
|