1dnl ---------------------------------------------------------- 2dnl configure.in for ircii, 2.3. copyright (c) matthew green, 1993, 3dnl except those bits attributed otherwise. 4dnl thanks to the screen 3.3 configure.in for giving me examples to 5dnl work from and steal ;) 6dnl 7dnl @(#)$Id: configure.in,v 1.46 2008/03/20 04:20:49 jnelson Exp $ 8 9AC_REVISION($Revision: 1.46 $)dnl 10AC_INIT(source/irc.c) 11AC_CONFIG_HEADER(include/defs.h) 12 13dnl ---------------------------------------------------------- 14dnl 15dnl grok the version number - from source/irc.c 16dnl 17 18VERSION=`sed -n -e 's/";$//' -e '/const char irc_version.. = "/s///p' -e '/const char irc_version/q' < $srcdir/source/irc.c` 19echo this is ircii version $VERSION 20echo 21AC_SUBST(VERSION) 22 23 24 25 26dnl ---------------------------------------------------------- 27dnl 28dnl initial stuff 29dnl 30 31AC_PROG_CC 32AC_PROG_CPP 33AC_ISC_POSIX 34AC_AIX 35 36 37dnl ---------------------------------------------------------- 38dnl ---------------------------------------------------------- 39dnl 40dnl System specific checks 41dnl 42dnl ---------------------------------------------------------- 43dnl ---------------------------------------------------------- 44 45 46dnl 47dnl get these once. check them later 48dnl 49unamer=`uname -r 2> /dev/null` 50unames=`uname -s 2> /dev/null` 51 52 53dnl ---------------------------------------------------------- 54dnl 55dnl Checking for qnx 56dnl 57 58AC_MSG_CHECKING(for qnx) 59case "$unames" in 60 QNX*) 61 AC_MSG_RESULT(yes) 62 LDFLAGS=-N64k dnl 64k of stack 63 CFLAGS="-w4 -O -g -fi=unix.h" dnl better compile options 64 ;; 65 *) 66 AC_MSG_RESULT(no) 67esac 68 69 70 71dnl 72dnl checking for svr4's /usr/ccs/lib 73dnl 74if test -d /usr/ccs/lib; then 75 LIBS="-L/usr/ccs/lib $LIBS" 76fi 77 78 79 80dnl ---------------------------------------------------------- 81dnl 82dnl Check for libraries before we check for functions! 83dnl 84 85if test -z "$libsocket"; then 86 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",) 87fi 88 89AC_ARG_WITH(ssl, 90[ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).], 91[ test -z "$withval" && with_ssl="yes" ], 92[ with_ssl="maybe" ]) 93 94AC_MSG_CHECKING(whether to include SSL support) 95if test "x$with_ssl" = "xno"; then 96 AC_MSG_RESULT(no) 97else 98 saved_LIBS="$LIBS" 99 saved_CFLAGS="$CFLAGS" 100 101 if test "x$with_ssl" != "xyes" -a "x$with_ssl" != "xmaybe"; then 102 # The user gave us a specific OpenSSL install dir, so just try that and stop. 103 104 CFLAGS="$saved_CFLAGS -I$with_ssl/include" 105 LIBS="$saved_LIBS -L$with_ssl/lib -lssl -lcrypto" 106 AC_TRY_LINK([#include <openssl/ssl.h>], 107 [SSL_accept(NULL);], [ have_ssl="yes" ]) 108 else 109 # First just try to see if it exists in the default location 110 111 CFLAGS="$saved_CFLAGS" 112 LIBS="$saved_LIBS -lssl -lcrypto" 113 AC_TRY_LINK([#include <openssl/ssl.h>], 114 [SSL_accept(NULL);], [ have_ssl="yes" ]) 115 116 # Otherwise, go hunting for it. 117 for ssldir in "/usr/local /usr/local/ssl /usr/local/openssl"; do 118 test -n "$have_ssl" && break 119 120 CFLAGS="$saved_CFLAGS -I$ssldir/include" 121 LIBS="$saved_LIBS -L$ssldir/lib -lssl -lcrypto" 122 AC_TRY_LINK([#include <openssl/ssl.h>], 123 [SSL_accept(NULL);], [ have_ssl="yes" ]) 124 done 125 fi 126 127 # If we found it somewhere, great! Otherwise, revert. 128 if test -n "$have_ssl"; then 129 AC_DEFINE(HAVE_SSL) 130 AC_MSG_RESULT(yes) 131 else 132 LIBS="$saved_LIBS" 133 CFLAGS="$saved_CFLAGS" 134 AC_MSG_RESULT(no) 135 if test "x$with_ssl" != "xmaybe"; then 136 AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL.]) 137 fi 138 fi 139fi 140 141dnl this is for isc. need the nsl_s library as well. 142if test -z "$libinet"; then 143 AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",) 144fi 145 146if test -z "$libnsl"; then 147 AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",) 148fi 149 150AC_CHECK_LIB(sun, getpwnam, LIBS="$LIBS -lsun",) 151AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",) 152AC_CHECK_LIB(resolv, gethostbyname, LIBS="$LIBS -lresolv",) 153AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt",) 154AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm",) 155 156termcap=0; 157AC_MSG_CHECKING(whether you want to use termcap) 158AC_ARG_WITH(termcap, 159[ --with-termcap Forcibly refuse to use terminfo/ncurses ], 160[ AC_MSG_RESULT(yes) 161 AC_CHECK_LIB(termcap, tgetent, termcap=1;LIBS="-ltermcap $LIBS", 162 AC_CHECK_LIB(termlib, tgetent, termcap=1;LIBS="-ltermlib $LIBS", 163 AC_CHECK_LIB(curses, tgetent, termcap=1;LIBS="-lcurses $LIBS", 164 AC_MSG_WARN(I cant find tgetent. Youll have to help me.))))], 165[ AC_MSG_RESULT(no) 166 AC_CHECK_LIB(ncurses, setupterm, LIBS="-lncurses $LIBS", 167 AC_CHECK_LIB(tinfo, setupterm, LIBS="-ltinfo $LIBS", 168 AC_CHECK_LIB(curses, setupterm, LIBS="-lcurses $LIBS", 169 AC_CHECK_LIB(curses, tgetent, LIBS="-lcurses $LIBS", 170 AC_CHECK_LIB(termlib, tgetent, LIBS="-ltermlib $LIBS", 171 AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS", 172 AC_MSG_WARN(I cant find tgetent. Youll have to help me.)))))))]) 173 174dnl ---------------------------------------------------------- 175dnl 176dnl Checking for headers, functions, and a type declarations 177dnl 178 179AC_CHECK_HEADERS(fcntl.h netdb.h regex.h sys/fcntl.h sys/file.h sys/select.h sys/syslimits.h sys/un.h sys/time.h termcap.h sys/filio.h sys/sysctl.h inttypes.h stdint.h term.h) 180 181if test $termcap -eq 0 ; then 182 AC_CHECK_FUNC(setupterm, AC_DEFINE(HAVE_TERMINFO),) 183fi 184AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME),) 185AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),) 186AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV),) 187AC_CHECK_FUNC(killpg, AC_DEFINE(HAVE_KILLPG),) 188AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY),) 189AC_CHECK_FUNC(getpass, AC_DEFINE(HAVE_GETPASS),) 190AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL),) 191AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF),) 192AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),) 193AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),) 194AC_CHECK_FUNC(fpathconf, AC_DEFINE(HAVE_FPATHCONF),) 195AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR),) 196AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),) 197AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID),) 198AC_CHECK_FUNC(getlogin, AC_DEFINE(HAVE_GETLOGIN),) 199AC_CHECK_FUNC(fchdir, AC_DEFINE(HAVE_FCHDIR),) 200AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH),) 201AC_CHECK_FUNC(hstrerror, AC_DEFINE(HAVE_HSTRERROR),) 202AC_CHECK_FUNC(strlcpy, AC_DEFINE(HAVE_STRLCPY),) 203AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT),) 204AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME),) 205AC_CHECK_FUNC(getservbyport, AC_DEFINE(HAVE_GETSERVBYPORT),) 206AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO),) 207AC_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO),) 208AC_CHECK_FUNC(clock_gettime, AC_DEFINE(HAVE_CLOCK_GETTIME),) 209AC_CHECK_FUNC(atoll, AC_DEFINE(HAVE_ATOLL),) 210AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL),) 211AC_CHECK_FUNC(atoq, AC_DEFINE(HAVE_ATOQ),) 212AC_CHECK_FUNC(finite, AC_DEFINE(HAVE_FINITE),) 213AC_CHECK_FUNC(isfinite, AC_DEFINE(HAVE_ISFINITE),) 214AC_CHECK_FUNC(tparm, AC_DEFINE(HAVE_TPARM),) 215 216dnl -- Oh why does this have to be so painful? -- 217AC_MSG_CHECKING(whether term.h works by itself) 218AC_TRY_RUN([ 219#include <term.h> 220 221main () 222{ 223 exit(0); 224} 225], 226 AC_MSG_RESULT(yes), 227 AC_MSG_RESULT(no) 228 AC_MSG_CHECKING(whether term.h requires termio.h and curses.h) 229 AC_TRY_RUN([ 230#include <termio.h> 231#include <curses.h> 232#include <term.h> 233 234main () 235{ 236 exit(0); 237} 238 ], 239 AC_MSG_RESULT(yes) 240 AC_DEFINE(TERM_H_REQUIRES_CURSES_H), 241 AC_MSG_RESULT(no, ugh) 242 AC_DEFINE(DONT_USE_TERM_H), :), :) 243 244AC_HEADER_STDC 245AC_HEADER_TIME 246AC_HEADER_DIRENT 247AC_TYPE_SIGNAL 248AC_TYPE_MODE_T 249AC_TYPE_PID_T 250AC_TYPE_SIZE_T 251AC_TYPE_UID_T 252AC_FUNC_ALLOCA 253 254dnl ---------------------------------------------------------- 255dnl Check to see if we can find intptr_t. 256dnl 257have_intptr_t="" 258AC_MSG_CHECKING(for intptr_t in inttypes.h or stdint.h) 259AC_EGREP_HEADER(intptr_t, inttypes.h, AC_DEFINE(HAVE_INTPTR_T) 260 have_intptr_t=yes) 261AC_EGREP_HEADER(intptr_t, stdint.h, AC_DEFINE(HAVE_INTPTR_T) 262 have_intptr_t=yes) 263if test "x$have_intptr_t" = "x"; then 264 AC_MSG_RESULT(no) 265else 266 AC_MSG_RESULT(yes) 267fi 268 269dnl ---------------------------------------------------------- 270dnl Check to see if we have socklen_t 271dnl 272AC_MSG_CHECKING(for socklen_t) 273AC_EGREP_HEADER(socklen_t, sys/socket.h, 274 AC_MSG_RESULT(yes) 275 AC_DEFINE(HAVE_SOCKLEN_T), 276 AC_MSG_RESULT(no)) 277 278dnl ---------------------------------------------------------- 279dnl 280dnl Check to see if we have to include <sys/select.h> 281dnl 282dnl 283AC_MSG_CHECKING(whether sys/types.h defines fd_set) 284AC_EGREP_HEADER(fd_set, sys/types.h, 285 AC_MSG_RESULT(yes), 286 AC_MSG_RESULT(no) 287 AC_MSG_CHECKING(whether sys/select.h defines fd_set) 288 AC_EGREP_HEADER(fd_set, sys/select.h, 289 AC_MSG_RESULT(yes) 290 AC_DEFINE(NEED_SYS_SELECT_H), 291 AC_MSG_RESULT(no. ugh.))) 292 293 294dnl ---------------------------------------------------------- 295dnl 296dnl check for struct linger 297dnl 298 299AC_MSG_CHECKING(for struct linger) 300AC_EGREP_HEADER([struct( | )*linger], sys/socket.h, 301 AC_MSG_RESULT(yes), 302 AC_DEFINE(NO_STRUCT_LINGER) 303 AC_MSG_RESULT(no. ugh.)) 304 305 306 307dnl ---------------------------------------------------------- 308dnl 309dnl svr3's getpgrp() didnt take arguments. BSD's did. 310dnl POSIX said that there wasnt any usefulness to giving arguments 311dnl to getpgrp(), so that was forbidden. So svr4 made a new syscall 312dnl getpgid() to fill in this functionality gap (grrrr). BSD still 313dnl doesnt have any way to do it, even though they were the ones that 314dnl originally wanted to have it around, but svr3 insisted not so. (grrr) 315dnl 316 317AC_CHECK_FUNC(getpgid, AC_DEFINE(HAVE_GETPGID),) 318AC_CHECK_FUNC(getpgrp, AC_FUNC_GETPGRP,) 319 320dnl --------------------------------------------------------- 321dnl 322dnl Check for a useful SO_SNDLOWAT. 323dnl Some systems (eg, linux) can be bothered to #define SO_SNDLOWAT 324dnl but can't be bothered to implement it, instead returning an error. 325dnl How completely bogus. Don't #define it if you don't support it! 326dnl 327AC_MSG_CHECKING(for useful SO_SNDLOWAT) 328AC_TRY_RUN([ 329#include <sys/types.h> 330#include <sys/socket.h> 331main () 332{ 333#ifndef SO_SNDLOWAT 334 exit(1); 335#else 336 int d = socket(AF_INET, SOCK_STREAM, 0); 337 int size = 256; 338 if (setsockopt(d, SOL_SOCKET, SO_SNDLOWAT, &size, sizeof(size)) < 0) 339 exit(1); 340 exit (0); 341#endif 342} 343], 344 AC_MSG_RESULT(yes, your SO_SNDLOWAT is useful) 345 AC_DEFINE(HAVE_SO_SNDLOWAT), 346 AC_MSG_RESULT(no, your SO_SNDLOWAT is broken and/or worthless), :) 347 348dnl ---------------------------------------------------------- 349dnl 350dnl Check for a realpath() that works. 351dnl 352AC_MSG_CHECKING(for useful realpath) 353AC_TRY_RUN([ 354#include <sys/param.h> 355#include <stdlib.h> 356main () 357{ 358 char resolved_path[MAXPATHLEN]; 359 360 if (realpath("/etc/filethatdoesnotexist", resolved_path) == NULL) 361 exit(1); 362 exit(0); 363} 364], 365 AC_MSG_RESULT(yes), 366 AC_MSG_RESULT(no, your realpath is broken and/or worthless) 367 AC_DEFINE(HAVE_BROKEN_REALPATH), :) 368 369dnl ---------------------------------------------------------- 370dnl 371dnl Check for sys_siglist declaration 372dnl 373 374AC_MSG_CHECKING(for sys_siglist declaration) 375AC_TRY_RUN([ 376#include <sys/types.h> 377#include <sys/signal.h> 378#include <signal.h> 379#include <unistd.h> 380main() 381{ 382 char *s = sys_siglist[0]; 383 exit(0); 384} 385], 386 AC_MSG_RESULT(yes) 387 sys_siglist="1" 388 AC_DEFINE(SYS_SIGLIST_DECLARED), 389 AC_MSG_RESULT(no), :) 390 391dnl ---------------------------------------------------------- 392dnl 393dnl Generate signal list, from perl4 394dnl 395if test x$sys_siglist != x1 396then 397echo "generating a list of signal names..." 398set X `cat /usr/include/signal.h /usr/include/sys/signal.h /usr/include/linux/signal.h 2>&1 | sed 's/^#[ ]*/#/' | awk ' 399$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { 400 [sig[$3] = substr($2,4,20)] 401 if (max < $3 && $3 < 60) { 402 max = $3 403 } 404} 405 406END { 407 for (i=1; i<=max; i++) { 408 [if (sig[i] == "")] 409 printf "%d", i 410 else 411 [printf "%s", sig[i]] 412 if (i < max) 413 printf " " 414 } 415 printf "\n" 416} 417'` 418shift 419case $# in 4200) 421 if test -f /bin/csh; then 422 set X `/bin/csh -cf 'kill -l'` 423 shift 424 case $* in 425 0) 426 set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM 427 ;; 428 esac 429 fi 430 ;; 431esac 432 433sig_name="ZERO $*" 434if test -f sig.inc; then 435 /bin/rm -f sig.inc 436fi 437[echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/static char *sys_siglist[] = { "/' >> sig.inc] 438fi 439 440dnl ---------------------------------------------------------- 441dnl 442dnl Check for 'long long' 443dnl 444 445AC_CHECK_SIZEOF(long long, 0) 446if test "$ac_cv_sizeof_long_long" != 0; then 447 AC_DEFINE(HAVE_LONG_LONG) 448fi 449 450dnl ---------------------------------------------------------- 451dnl 452dnl need this for dcc stuff 453dnl 454 455AC_CHECK_SIZEOF(unsigned int, 4) 456if test "$ac_cv_sizeof_unsigned_int" = 4; then 457 AC_DEFINE(UNSIGNED_INT32) 458else 459 AC_CHECK_SIZEOF(unsigned long, 4) 460 if test "$ac_cv_sizeof_unsigned_long" = 4; then 461 AC_DEFINE(UNSIGNED_LONG32) 462 else 463 AC_DEFINE(UNKNOWN_32INT) 464 fi 465fi 466 467dnl ---------------------------------------------------------- 468dnl 469dnl It makes a big difference if your system's (struct sockaddr) 470dnl structures look like this: 471dnl 472dnl struct sockaddr { 473dnl u_char sa_len; 474dnl u_char sa_family; 475dnl char sa_data[14]; 476dnl }; 477dnl 478dnl or this 479dnl 480dnl struct sockaddr { 481dnl u_short sa_family; 482dnl char sa_data[14]; 483dnl }; 484dnl 485dnl so check for that here. 486dnl 487dnl ----------------------------------------------------------- 488 489AC_MSG_CHECKING(to see if your struct sockaddr includes a length field) 490AC_TRY_RUN([ 491#include <sys/types.h> 492#include <sys/socket.h> 493main() 494{ 495 struct sockaddr sa; 496 sa.sa_len = 0; 497 exit(0); 498} 499], 500 AC_DEFINE(HAVE_SA_LEN) 501 AC_MSG_RESULT(yes), 502 AC_MSG_RESULT(no), :) 503 504dnl ---------------------------------------------------------- 505dnl 506dnl checks for ipv6-related things 507dnl 508 509AC_MSG_CHECKING(whether to support ipv6) 510AC_ARG_WITH(ipv6, 511[ --with-ipv6 Include IPv6 support],[ 512 if test "x$withval" = "xno" ; then 513 AC_MSG_RESULT(no) 514 AC_DEFINE(DO_NOT_USE_IPV6) 515 else 516 AC_MSG_RESULT(yes) 517 fi 518],[AC_MSG_RESULT(yes)]) 519 520AC_MSG_CHECKING(for struct sockaddr_storage) 521AC_EGREP_HEADER([struct( | )*sockaddr_storage], sys/socket.h, 522 AC_MSG_RESULT(yes) 523 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE), 524 AC_MSG_RESULT(no)) 525 526AC_MSG_CHECKING(for struct sockaddr_in6) 527AC_EGREP_HEADER([struct( | )*sockaddr_in6], netinet/in.h, 528 AC_MSG_RESULT(yes) 529 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6), 530 AC_MSG_RESULT(no)) 531 532AC_MSG_CHECKING(for struct addrinfo) 533AC_EGREP_HEADER([struct( | )*addrinfo], netdb.h, 534 AC_MSG_RESULT(yes) 535 AC_DEFINE(HAVE_STRUCT_ADDRINFO), 536 AC_MSG_RESULT(no)) 537 538dnl ---------------------------------------------------------- 539dnl 540dnl Some implementations of getaddrinfo (*cough*KAME*cough*) don't 541dnl support the AF_UNIX protocol family. For these partially incomplete 542dnl implementations, we must add our own support in a wrapper. 543dnl 544 545AC_MSG_CHECKING(to see if your getaddrinfo supports AF_UNIX) 546AC_TRY_RUN([ 547#include <sys/types.h> 548#include <sys/socket.h> 549#include <netdb.h> 550#include <sys/un.h> 551#include <stdlib.h> 552 553main() 554{ 555 struct addrinfo hints; 556 struct addrinfo *results; 557 int retval; 558 559 memset(&hints, 0, sizeof(hints)); 560 hints.ai_flags = 0; 561 hints.ai_family = AF_UNIX; 562 hints.ai_socktype = SOCK_STREAM; 563 hints.ai_protocol = 0; 564 565 retval = getaddrinfo(0, "/tmp/.ircd/6667", &hints, &results); 566 if (retval != 0) 567 exit(1); 568 else 569 exit(0); 570} 571], 572 AC_MSG_RESULT(yes), 573 AC_DEFINE(GETADDRINFO_DOES_NOT_DO_AF_UNIX) 574 AC_MSG_RESULT(no. ugh), :) 575 576dnl ---------------------------------------------------------- 577dnl 578dnl Socks4 or Socks5 or neither? 579dnl 580 581AC_MSG_CHECKING(whether to support SOCKS) 582AC_ARG_WITH(socks, 583[ --with-socks[=PATH] Compile with SOCKS firewall traversal support.], 584[ case "$withval" in 585 no) 586 AC_MSG_RESULT(no) 587 ;; 588 *) 589 if test "x$withval" != "xyes"; then 590 LIBS="$LIBS -L$withval" 591 fi 592 593 AC_MSG_RESULT(yes) 594 LIBS="$LIBS -lsocks" 595 AC_DEFINE(SOCKS) 596 AC_DEFINE(connect, Rconnect) 597 AC_DEFINE(getsockname, Rgetsockname) 598 AC_DEFINE(bind, Rbind) 599 AC_DEFINE(accept, Raccept) 600 AC_DEFINE(listen, Rlisten) 601 AC_DEFINE(select, Rselect) 602 ;; 603 esac ], 604 AC_MSG_RESULT(no) 605) 606 607AC_MSG_CHECKING(whether to support SOCKS5) 608AC_ARG_WITH(socks5, 609[ --with-socks5[=PATH] Compile with SOCKS5 firewall traversal support.], 610[ case "$withval" in 611 no) 612 AC_MSG_RESULT(no) 613 ;; 614 *) 615 if test "x$withval" != "xyes"; then 616 LIBS="$LIBS -L$withval" 617 CFLAGS="$CFLAGS -I$withval/../include/" 618 fi 619 620 AC_MSG_RESULT(yes) 621 LIBS="$LIBS -lsocks5" 622 AC_DEFINE(SOCKS) 623 AC_DEFINE(USE_SOCKS5) 624 ;; 625 esac ], 626 AC_MSG_RESULT(no) 627) 628 629dnl ---------------------------------------------------------- 630dnl 631dnl Perl support? 632dnl 633 634AC_PATH_PROG(PERL, perl) 635AC_MSG_CHECKING(whether to support Perl) 636AC_ARG_WITH(perl, 637[ --with-perl Compile with perl support.], 638[], 639[ with_perl="maybe" ] ) 640if test "xno" != "x$withval"; then 641 642 if test ! -z "$PERL"; then 643 saved_LIBS="$LIBS" 644 saved_CFLAGS="$CFLAGS" 645 646 PERL_CFLAGS="`$PERL -MExtUtils::Embed -e ccopts`" 647 CFLAGS="$CFLAGS $PERL_CFLAGS" 648 LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`" 649 AC_TRY_LINK([ 650 #include <EXTERN.h> 651 #include <perl.h> 652 ], [perl_alloc();], 653 [ have_perl="yes" ], [ LIBS="$saved_LIBS" ]) 654 CFLAGS="$saved_CFLAGS" 655 fi 656fi 657if test -n "$have_perl"; then 658 AC_MSG_RESULT(yes) 659 PERLDOTOH="perl.o" 660 AC_DEFINE(PERL) 661 AC_SUBST(PERL_CFLAGS) 662else 663 AC_MSG_RESULT(no) 664 if test "x$with_perl" != "xno" -a "x$with_perl" != "xmaybe"; then 665 AC_MSG_ERROR([--with-perl requested, but I could not find Perl]) 666 fi 667fi 668withval='' 669 670dnl ---------------------------------------------------------- 671dnl 672dnl Tcl support? 673dnl 674 675AC_MSG_CHECKING(whether to support Tcl) 676AC_ARG_WITH(tcl, 677[ --with-tcl[=PATH] Compile with tcl support.], 678[ test -z "$withval" && withval=yes ], 679[ withval=maybe ]) 680if test "x$withval" != "xyes" -a "x$withval" != "xmaybe"; then 681 tcl_base_search="$withval" 682else 683 tcl_base_search="/usr/local /usr" 684fi 685test "xno" != "x$withval" && for base in $tcl_base_search 686do 687 tcl_bin_dir="$base" 688 test -r "$tcl_bin_dir/tclConfig.sh" && break 689 690 tcl_bin_dir="$base/lib" 691 test -r "$tcl_bin_dir/tclConfig.sh" && break 692 693 for ver in 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 694 do 695 tcl_bin_dir="$base/lib/tcl$ver" 696 test -r "$tcl_bin_dir/tclConfig.sh" && break 2 697 done 698done 699if test ! -z "$tcl_bin_dir" -a -r "$tcl_bin_dir/tclConfig.sh"; then 700 . "$tcl_bin_dir/tclConfig.sh" 701 AC_MSG_RESULT([yes ($TCL_VERSION)]) 702 CFLAGS="$CFLAGS $TCL_INCLUDE_SPEC" 703 LIBS="$TCL_LIB_SPEC $LIBS" 704 TCLDOTOH="tcl.o" 705 AC_DEFINE(TCL) 706else 707 AC_MSG_RESULT(no) 708 if test "x$withval" != "xno" -a "x$withval" != "xmaybe"; then 709 AC_MSG_ERROR([--with-tcl requested, but I could not find TCL]) 710 fi 711fi 712 713dnl ---------------------------------------------------------- 714dnl ---------------------------------------------------------- 715dnl 716dnl closing stuff 717dnl 718dnl ---------------------------------------------------------- 719dnl ---------------------------------------------------------- 720 721 722dnl ---------------------------------------------------------- 723dnl 724dnl set some last minute sanity defaults 725dnl 726 727if test -z "$CFLAGS"; then CFLAGS="-g -O"; fi 728if test -z "$LDFLAGS"; then LDFLAGS= ; fi 729if test -z "$PERLDOTOH"; then PERLDOTOH= ; fi 730if test -z "$TCLDOTOH"; then TCLDOTOH= ; fi 731if test -z "$bindir"; then bindir=\${prefix}/bin; fi 732if test -z "$libdir"; then libdir=\${prefix}/lib; fi 733if test -z "$irclibdir"; then irclibdir=\${libdir}/irc; fi 734if test -z "$libexecdir"; then libexecdir=\${prefix}/libexec; fi 735 736epic=`echo "epic" | sed -e "$program_transform_name"` 737if test "$program_prefix" = "NONE" ; then 738 program_prefix= 739fi 740 741AC_MSG_CHECKING(whether to support bounds checking gcc) 742AC_ARG_WITH(bc, 743[ --with-bc[=PATH_TO_GCC] You have bounds checking gcc and want to use it.], 744[ case "$withval" in 745 no) 746 AC_MSG_RESULT(no); 747 ;; 748 *) 749 if test "x$withval" != "xyes" ; then 750 CC="$withval" 751 fi 752 753 CFLAGS="$CFLAGS -Wall -fbounds-checking" 754 LDFLAGS="$LDFLAGS -static" 755 AC_MSG_RESULT(yes) 756 ;; 757 esac ], 758 AC_MSG_RESULT(no) 759) 760 761AC_MSG_CHECKING(whether to turn on FreeBSD WARNS-like compiler warnings) 762AC_ARG_WITH(warns, 763[ --with-warns You wish to use FreeBSD WARNS-like compiler warnings.], 764[ case "$withval" in 765 no) 766 AC_MSG_RESULT(no); 767 ;; 768 *) 769 if test "x$withval" != "xyes" ; then 770 CFLAGS="$CFLAGS $withval" 771 fi 772 773 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" 774 AC_MSG_RESULT(yes) 775 ;; 776 esac ], 777 AC_MSG_RESULT(no) 778) 779 780AC_SUBST(CFLAGS) 781AC_SUBST(LDFLAGS) 782AC_SUBST(PERLDOTOH) 783AC_SUBST(TCLDOTOH) 784AC_SUBST(bindir) 785AC_SUBST(irclibdir) 786AC_SUBST(libexecdir) 787AC_SUBST(srcdir) 788AC_SUBST(includedir) 789AC_SUBST(epic) 790AC_SUBST(program_transform_name) 791AC_SUBST(program_prefix) 792AC_SUBST(mandir) 793 794AC_OUTPUT(Makefile source/Makefile source/info.c.sh) 795 796dnl ---- BLAH BLAH BLAH --- 797if test -f sig.inc ; then 798 mv sig.inc include/ 799fi 800 801 802dnl ---------------------------------------------------------- 803dnl 804dnl Commencement 805dnl 806 807echo 808echo "There you go. Look at include/config.h for any options that " 809echo "you might want to change before you 'make'. Don't forget to " 810echo "do a 'make install' before you're done." 811echo 812