AC_PREREQ(2.59) AC_INIT(source/irc.c) AC_CONFIG_HEADER(include/defs.h) dnl configure.in for ScrollZ dnl dnl Copyright (c) 1993-2002 Matthew R. Green. dnl All rights reserved. dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions dnl are met: dnl 1. Redistributions of source code must retain the above copyright dnl notice, this list of conditions and the following disclaimer. dnl 2. Redistributions in binary form must reproduce the above copyright dnl notice, this list of conditions and the following disclaimer in the dnl documentation and/or other materials provided with the distribution. dnl 3. The name of the author may not be used to endorse or promote products dnl derived from this software without specific prior written permission. dnl dnl THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES dnl OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. dnl IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF dnl SUCH DAMAGE. dnl dnl certain portions have other attributions, see below. dnl 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.56 2009-12-21 14:56:02 f Exp $ # So many systems seem to need this that it is better do it here automatically. if test "x$prefix" != xNONE; then if test -d "$prefix/lib"; then LIBS="-L${prefix}/lib $LIBS" fi else if test -d "$ac_default_prefix/lib"; then LIBS="-L${ac_default_prefix}/lib $LIBS" fi fi dnl dnl grok the version number - from source/irc.c dnl VERSION=`sed -n -e 's/"$//' -e '/#define[ ]*SCROLLZ_VERSION[ ]*"/s///p' -e '/#define SCROLLZ_VERSION/q' < ${srcdir}/source/irc.c` IRCIIVERSION=`sed -n -e 's/"[[^"]]*$//' -e '/^#define[ ]*IRCII_VERSION[ ]*"/s///p' -e '/^#define IRCII_VERSION/q' < ${srcdir}/source/irc.c` echo this is ScrollZ version $VERSION + ircII version $IRCIIVERSION echo AC_SUBST(VERSION) CATEGORIES='build change-request doc pending runtime' AC_SUBST(CATEGORIES) dnl so that the generated configure has an id. echo '$Id: configure.in,v 1.56 2009-12-21 14:56:02 f Exp $' > /dev/null dnl dnl initial stuff dnl AC_PROG_CC AC_PROG_CPP AC_ISC_POSIX dnl dnl setup variables dnl srcdir=`(cd $srcdir; pwd)` AC_SUBST(srcdir) objdir=`pwd` AC_SUBST(objdir) ifdef([AC_PROG_EGREP],[AC_PROG_EGREP],[]) dnl dnl check for NeXT.. and -bsd switch dnl AC_MSG_CHECKING(for NeXT) AC_EGREP_CPP(yes, [#if defined(NeXT) || defined(__NeXT) || defined(__NeXT__) yes #endif ],nextstep=1) if test -n "$nextstep"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl AC_AIX is broken. blah. AC_MSG_CHECKING(for AIX) AC_EGREP_CPP(yes, [ #ifdef _AIX yes #endif ],AC_MSG_RESULT(yes) aix=1 AC_DEFINE(_ALL_SOURCE), AC_MSG_RESULT(no)) AC_PROG_GCC_TRADITIONAL AC_CHECK_LIB(sun, getpwnam) AC_MSG_CHECKING(for qnx) case "`uname -s`" in dnl bleck - wish i could ditch this qnx test, but we need to bump the stack QNX*) AC_MSG_RESULT(yes) if test -z "$GCC"; then LDFLAGS="-N256k -M" CFLAGS="-w4 -Otax -zc -Wc,-fr= -Wc,-wcd=121" fi ;; *) AC_MSG_RESULT(no) esac AC_MSG_CHECKING(for solaris) if /bin/sun 2> /dev/null then uname=`uname -r` case "$uname" in 4.*) AC_MSG_RESULT(no) sunos4=1 ;; 5.*) svr4=1 ;; esac else AC_MSG_RESULT(no) AC_MSG_CHECKING(for SVR4) AC_EGREP_CPP(yes, [#if defined(SVR4) || defined(__svr4__) || defined(__SVR4) yes #endif ],svr4=1) fi if test -n "$svr4" then AC_MSG_RESULT(yes) LIBS="-L/usr/ccs/lib $LIBS" else if test ! -n "$sunos4" then AC_MSG_RESULT(no) fi fi dnl dnl testing for svr3/wollengong tcp's /usr/netinclude dnl AC_MSG_CHECKING(for -I/usr/netinclude) if test -d /usr/netinclude; then AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I/usr/netinclude" else AC_MSG_RESULT(no) fi dnl dnl check for hpux, and hpux version dnl AC_MSG_CHECKING(for hpux version) if test -f /hp-ux -o -f /stand/vmunix; then AC_MSG_RESULT(yes) hpux=1 uname=`uname -r` 2> /dev/null case $uname in A.09* | A.9* | a.9* | a.09* | 9* | 09* | B.09*) ;; A.08* | A.8* | a.8* | a.08* | 8* | 08*) AC_DEFINE(HPUX8) ;; A.07* | A.B7* | A.7* | a.7* | a.07* | 7* | 07*) AC_DEFINE(HPUX7) ;; *) AC_DEFINE(HPUXUNKNOWN) ;; esac else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(for ultrix) AC_EGREP_CPP(yes, [#if defined(ultrix) || defined(__ultrix) || defined(__ultrix) yes #endif ], ultrix=1) if test -n "$ultrix"; then AC_MSG_RESULT(yes) test -z "$GCC" && CC="$CC -YBSD" else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(for sequent/ptx) AC_EGREP_CPP(yes, [#ifdef _SEQUENT_ yes #endif ], LIBS="$LIBS -lseq" seqptx=1) if test -n "$seqptx"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(whether to enable UTF-8 (iconv) support) AC_ARG_ENABLE(utf8, [ --disable-utf8 Disable UTF-8 (iconv) support], [ case "$enableval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) ;; esac ], [ AC_MSG_RESULT(yes) enable_utf8=yes ]) dnl check for FreeBSD, so we can find iconv.h in /usr/local/include AC_MSG_CHECKING(for FreeBSD) case "`uname -s`" in FreeBSD*) AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I/usr/local/include" CPPFLAGS="$CPPFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" freebsd=1 ;; *) AC_MSG_RESULT(no) esac dnl check for OpenBSD, so we can find iconv.h in /usr/local/include AC_MSG_CHECKING(for OpenBSD) case "`uname -s`" in OpenBSD*) AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I/usr/local/include" CPPFLAGS="$CPPFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" openbsd=1 ;; *) AC_MSG_RESULT(no) esac dnl check for IRIX, so we can find iconv.h in /usr/nekoware/include AC_MSG_CHECKING(for IRIX) case "`uname -s`" in IRIX*) AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I/usr/nekoware/include" CPPFLAGS="$CPPFLAGS -I/usr/nekoware/include" LIBS="$LIBS -L/usr/nekoware/lib" freebsd=1 ;; *) AC_MSG_RESULT(no) esac if test "x$enable_utf8" = "xyes" ; then if test -n "$freebsd"; then case "`uname -r`" in 10.*) ;; *) LIBS="$LIBS -liconv" ;; esac fi if test -n "$openbsd"; then LIBS="$LIBS -liconv" fi fi AC_CHECK_HEADERS(sys/un.h sys/select.h sys/fcntl.h sys/ioctl.h sys/file.h sys/time.h sys/wait.h sys/twg_config.h sys/ptem.h sys/uio.h)dnl sys/ ones AC_CHECK_HEADERS(unistd.h fcntl.h string.h memory.h netdb.h limits.h)dnl non sys/ ones AC_CHECK_HEADERS(stdarg.h varargs.h, break)dnl look for varadic function header AC_CHECK_HEADERS(process.h termcap.h)dnl others if test "x$enable_utf8" = "xyes" ; then AC_CHECK_HEADERS(iconv.h) fi if test -n "$ultrix" -o -n "$nextstep"; then # POSIX termios is broken on Ultrix so don't look for it. # NEXTSTEP POSIX is broken so don't look for it. AC_CHECK_HEADERS(termio.h sgtty.h, break)dnl sigh. else AC_CHECK_HEADERS(termios.h termio.h sgtty.h, break)dnl sigh. fi AC_CHECK_FUNC(fchmod,, AC_DEFINE(NEED_FCHMOD)) AC_CHECK_FUNC(getcwd,, AC_DEFINE(NEED_GETCWD)) AC_CHECK_FUNC(getpgid, AC_DEFINE(HAVE_GETPGID),) AC_CHECK_FUNC(getsid, AC_DEFINE(HAVE_GETSID),) AC_CHECK_FUNC(getloadavg, AC_DEFINE(HAVEGETLOADAVG),) AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),) AC_CHECK_FUNC(scandir, AC_DEFINE(HAVE_SCANDIR),) AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID),) AC_CHECK_FUNC(strerror,, AC_DEFINE(NEED_STRERROR)) AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME),) AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME),) AC_CHECK_FUNC(writev, AC_DEFINE(HAVE_WRITEV),) AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF),) AC_CHECK_FUNC(fputc, AC_DEFINE(HAVE_FPUTC),) AC_CHECK_FUNC(fwrite, AC_DEFINE(HAVE_FWRITE),) AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),) AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF),) if test "x$enable_utf8" = "xyes" ; then AC_CHECK_FUNC(iconv_open, AC_DEFINE([HAVE_ICONV_OPEN]),) fi if test -n "$openbsd" ; then AC_CHECK_FUNC(libiconv_open, AC_DEFINE([HAVE_ICONV_OPEN]),) fi 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_CHECK_TYPE(ssize_t,int) if test x$ac_cv_header_sys_twg_config_h = xyes then AC_DEFINE(WINS) fi dnl dnl check if we need snprintf.c dnl if test x$ac_cv_func_snprintf != xyes || test x$ac_cv_func_vsnprintf != xyes then EXTRA_OBJECTS=snprintf.o EXTRA_SOURCES=snprintf.c else EXTRA_OBJECTS= EXTRA_SOURCES= fi AC_SUBST(EXTRA_OBJECTS) AC_SUBST(EXTRA_SOURCES) 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 grok process groups dnl if test x$ac_cv_func_getsid != xyes && test x$ac_cv_func_getpgid != xyes then AC_MSG_CHECKING(if getpgrp takes an argument) AC_TRY_RUN([ main() { int pid; int pgid; pid = fork(); if (0 == pid) { #ifdef HAVE_SETSID setsid(); #else setpgrp(0, getpid()); #endif /* HAVE_SETSID */ sleep(10); } else { sleep(2); pgid = getpgrp(pid); kill(pid,9); if (pid != pgid) exit(1); } exit(0); } ], AC_MSG_RESULT(yes), AC_MSG_RESULT(no your getpgrp is painful) AC_DEFINE(BROKEN_GETPGRP), :) fi dnl dnl work out wait type.. dnl AC_CHECK_FUNC(waitpid,, AC_MSG_RESULT(no) AC_MSG_CHECKING(for bsd wait) AC_TRY_LINK([ #include #include ],[ union wait x; int y; #ifdef WEXITSTATUS y = WEXITSTATUS(x); #endif ], AC_DEFINE(BSDWAIT) bsdwait=1 AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_DEFINE(NEED_WAITPID))) dnl dnl checking for select() dnl olibs="$LIBS" AC_CHECK_FUNC(select, , AC_CHECK_LIB(socket, select, LIBS="$LIBS -lsocket", AC_CHECK_LIB(nsl, select, LIBS="$LIBS -lnsl", AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet", AC_CHECK_LIB(cposix, select, LIBS="$LIBS -lcposix", AC_CHECK_LIB(net, select, LIBS="$LIBS -lnet", AC_MSG_WARN(i can not find select. you might need to help me))))))) dnl dnl termcap or curses dnl if termcap, check for tputs declaration dnl if test x$aix = x1 then LIBS="-lcurses $LIBS" AC_DEFINE(INCLUDE_CURSES_H) else olibs="$LIBS" case "`uname -s`" in Linux*) if test -d /usr/include/ncurses; then CFLAGS="-I/usr/include/ncurses $CFLAGS" fi ;; esac AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $olibs", AC_CHECK_LIB(tinfo, tgetent, LIBS="-ltinfo $olibs", AC_CHECK_LIB(termlib, tgetent, LIBS="-ltermlib $olibs", AC_CHECK_LIB(curses, tgetent, LIBS="-lcurses $olibs", AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $olibs", AC_CHECK_LIB(xtermcap, tgetent, LIBS="-lxtermcap $olibs", AC_MSG_ERROR(Can not find curses or termcap library. Installing package libncurses5-dev or ncurses-devel usually fixes this problem.))))))) AC_MSG_CHECKING(for tputs in curses.h) AC_EGREP_CPP([tputs( | |\()],[#include ], AC_DEFINE(INCLUDE_CURSES_H) AC_MSG_RESULT(yes), blahhack=1; AC_MSG_RESULT(no)) fi dnl dnl libiconv (Sunfreeware gcc) dnl dnl if test "x$enable_utf8" = "xyes" ; then if test -n "$svr4" -a -n "$GCC" then AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv") fi fi dnl is broken on most systems; ignoreit. dnl if test x$blahhack = x1 dnl then dnl AC_MSG_CHECKING(for tputs in term.h) dnl AC_EGREP_CPP([tputs( | |\()],[#include dnl ], AC_DEFINE(INCLUDE_TERM_H) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl fi dnl dnl signal handling dnl AC_CHECKING(signal implementation) AC_CHECK_FUNC(sigaction, AC_DEFINE(USE_SIGACTION) echo using posix signals , AC_CHECK_FUNC(sigset, AC_DEFINE(USE_SIGSET) echo using ok system v signals , echo checking for reliable signals AC_TRY_RUN([ #include #include #ifndef SIGCHLD # define SIGCHLD SIGCLD #endif #ifdef USE_SIGSET # define signal sigset #endif int got; #ifdef SIGVOID void #endif hand() { got++; } main() { (void)signal(SIGCHLD, hand); kill(getpid(), SIGCHLD); kill(getpid(), SIGCHLD); if (got < 2) exit(1); exit(0); } ], echo using bsd signals , AC_DEFINE(SYSVSIGNALS) echo using system v signals, you lose. ))) if test x$bsdwait = x1 then AC_MSG_CHECKING(for wait3 declaration) AC_EGREP_CPP([wait3( | |\()],[#include ) #include #include ], AC_DEFINE(WAIT3_DECLARED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) else AC_MSG_CHECKING(for waitpid declaration) AC_EGREP_CPP([waitpid( | |\()],[#include ) #include #include ], AC_DEFINE(WAITPID_DECLARED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) fi dnl dnl check for errno declaration dnl AC_MSG_CHECKING(for errno declaration) AC_TRY_RUN([ #include #include main() { int i = errno; exit(0); } ], AC_MSG_RESULT(yes) AC_DEFINE(ERRNO_DECLARED), AC_MSG_RESULT(no), :) dnl dnl check for sys_errlist declaration dnl AC_MSG_CHECKING(for sys_errlist declaration) AC_TRY_RUN([ #include #include #include main() { char *s = sys_errlist[0]; exit(0); } ], AC_MSG_RESULT(yes) AC_DEFINE(SYS_ERRLIST_DECLARED), AC_MSG_RESULT(no), :) dnl dnl check the type of iconv(3)'s 2nd argument dnl if test "x$enable_utf8" = "xyes" ; then AC_MSG_CHECKING(for const iconv 2nd argument) AC_EGREP_HEADER([\\.*\\(.*const], iconv.h, AC_MSG_RESULT(yes) AC_DEFINE([ICONV_CONST_ARG2]), AC_MSG_RESULT(no)) fi dnl dnl need this for dcc stuff dnl AC_MSG_CHECKING(for a 32 bit integer) AC_TRY_RUN([ main() { if (4 == sizeof(unsigned long)) exit(0); exit(1); } ], AC_MSG_RESULT(unsigned long) AC_DEFINE(UNSIGNED_LONG32), AC_TRY_RUN([ main() { if (4 == sizeof(unsigned int)) exit(0); exit(1); } ], AC_MSG_RESULT(unsigned int) AC_DEFINE(UNSIGNED_INT32), AC_MSG_RESULT(none, using unsigned long) AC_DEFINE(UNKNOWN_32INT), :), :) dnl dnl libraries dnl dnl i think this was only needed for solaris with -lucb. dnl AC_HAVE_LIBRARY(elf, LIBS="$LIBS -lelf",) dnl AC_HAVE_LIBRARY(nls, libnls=1;AC_DEFINE(HAVE_LIB_NLS),) if test ! -n "$libsocket"; then AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",) fi dnl this is for isc. need the nsl_s library as well. if test ! -n "$libinet"; then AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",) fi AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",) ) AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",) AC_CHECK_LIB(resolv, gethostbyname, olibs=$LIBS LIBS="$LIBS -lresolv" AC_TRY_RUN([ #include main() { struct hostent *hp; hp = gethostbyname("`uname -n`"); exit(0); } ],,LIBS=$olibs, :), AC_CHECK_LIB(nsl, gethostbyname, olibs=$LIBS LIBS="$LIBS -lnsl")) AC_CHECK_LIB(resolv, inet_aton, LIBS="$LIBS -lresolv",) dnl AC_HAVE_LIBRARY(PW, LIBS="$LIBS -lPW",) dnl dnl check for non-blocking fd style available.. dnl AC_MSG_CHECKING(for non-blocking) changequote(<<, >>)dnl << precode='#include #include #include #include #include #include alarmed() { exit(1); } main() { char b[12], x[32]; int f, l = sizeof(x); f = socket(AF_INET, SOCK_DGRAM, 0); if (f >= 0 && (fcntl(f, F_SETFL,' postcode=') != -1)) { signal(SIGALRM, alarmed); alarm(3); recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l); alarm(0); exit(0); } exit(1); }' >> changequote([, ])dnl code="$precode O_NONBLOCK $postcode" AC_TRY_RUN($code, AC_DEFINE(NBLOCK_POSIX) AC_MSG_RESULT(posix), code="$precode O_NDELAY $postcode" AC_TRY_RUN($code, AC_DEFINE(NBLOCK_BSD) AC_MSG_RESULT(bsd), code="$precode FIONBIO $postcode" AC_TRY_RUN($code, AC_DEFINE(NBLOCK_SYSV) AC_MSG_RESULT(system v), AC_MSG_WARN(i can't find a working non blocking system), :), :), :) dnl this is all stolen from perl-4.036's Configure. larry is god. dnl well, most of it. couple of tweaks to make it work better. 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) set X `kill -l 2> /dev/null` shift case $# in 0) if test -f /bin/csh; then set X `/bin/csh -cf 'kill -l'` shift case $# in 0) dnl this is a reasonable default; HUP, QUIT, ABRT, KILL, BUS, SEGV, ALRM and dnl TERM are all reasonably portable defaults -- i (mrg) haven't ever seen dnl a system where they are different than these. set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM ;; esac fi ;; esac ;; esac sig_name="ZERO $*" if test -f source/sig.inc; then /bin/rm -f source/sig.inc fi [echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/char *signals[] = { "/' -e 's/};/, NULL};/' >> source/sig.inc] dnl work out UNIX mail dir.. AC_MSG_CHECKING(for unix mail directory) for foo in /var/spool/mail /usr/spool/mail /var/mail /usr/mail do if test -d $foo; then mdir=$foo break fi done if test -n "$mdir"; then UNIX_MAIL=\"$mdir\" AC_MSG_RESULT($mdir) AC_DEFINE_UNQUOTED(UNIX_MAIL, "$mdir") else AC_MSG_RESULT(none) AC_MSG_CHECKING(for AMS mail) if test "x$HOME" != "/" -o -z "x$HOME" && test -d "$HOME/Mailbox"; then AC_MSG_RESULT(using Mailbox) AC_DEFINE_UNQUOTED(AMS_MAIL, "Mailbox") else AC_MSG_RESULT(no) fi fi if test -z "$CFLAGS"; then CFLAGS=-O ; fi if test -z "$LDFLAGS"; then LDFLAGS= ; fi RM="rm -f" LN="ln -s" if test ! -n "$bindir"; then bindir=\${exec_prefix}/bin fi AC_SUBST(bindir) if test ! -n "$IRCLIB"; then IRCLIB=\${datadir}/scrollz fi AC_SUBST(IRCLIB) if test "x$exec_prefix" = "xNONE"; then if test "x$prefix" = "xNONE"; then libdir="$ac_default_prefix/lib" else if test "x$libdir" = "xNONE"; then libdir="$prefix/lib" fi fi else libdir="$exec_prefix/lib" fi AC_MSG_CHECKING(for ElectricFence library) AC_ARG_WITH(efence, [ --with-efence[=PATH] Compile with the ElectricFence debugging library.], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) if test "x$withval" = xyes; then withval="-lefence" else if test -d "$withval"; then if test -d "$withval/lib"; then withval="-L$withval/lib -lefence" else withval="-L$withval -lefence" fi fi fi LIBS="$withval $LIBS" ;; esac ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(paranoia status) AC_ARG_WITH(paranoid, [ --with-paranoid Sets the compile-time paranoid flag.], [ AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(PARANOID, 1) ], AC_MSG_RESULT(none) ) AC_MSG_CHECKING(for /dev/urandom) if test -c /dev/urandom; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_DEV_RANDOM, 1) AC_DEFINE_UNQUOTED(DEV_RANDOM_PATH, "/dev/urandom") else AC_MSG_RESULT(no) AC_MSG_CHECKING(for /dev/random) if test -c /dev/random; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_DEV_RANDOM, 1) AC_DEFINE_UNQUOTED(DEV_RANDOM_PATH, "/dev/random") else AC_MSG_RESULT(no) fi fi AC_MSG_CHECKING(for default server) AC_ARG_WITH(default-server, [ --with-default-server=SERVER[:PORT] Connect to SERVER by default.], [ if test "$withval"; then AC_MSG_RESULT($withval) AC_DEFINE_UNQUOTED(DEFAULT_SERVER, "$withval") else AC_MSG_RESULT(none) fi ], AC_MSG_RESULT(none) ) AC_CHECK_LIB(c, crypt, [AC_DEFINE(HAVE_CRYPT) LIBS="-lc $LIBS"], AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_CRYPT) LIBS="-lcrypt $LIBS"], AC_CHECK_LIB(des, des, [AC_DEFINE(HAVE_CRYPT) LIBS="-ldes $LIBS"]))) AC_MSG_CHECKING(whether to support SOCKS) AC_ARG_WITH(socks, [ --with-socks Compile with SOCKS firewall traversal support.], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) AC_CHECK_LIB(socks5, SOCKSconnect, [ socks=5 LIBS="-lsocks5 $LIBS"], [ AC_CHECK_LIB(socks, Rconnect, [ socks=4 LIBS="-lsocks $LIBS"], [ AC_MSG_ERROR(Could not find socks library. You must first install socks.) ] ) ] ) ;; esac ], AC_MSG_RESULT(no) ) if test "x$socks" = "x"; then 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) ;; *) AC_MSG_RESULT(yes) socks=5 if test "x$withval" = "xyes"; then withval="-lsocks5" else if test -d "$withval"; then if test -d "$withval/include"; then CFLAGS="$CFLAGS -I$withval/include" else CFLAGS="$CFLAGS -I$withval" fi if test -d "$withval/lib"; then withval="-L$withval/lib -lsocks5" else withval="-L$withval -lsocks5" fi fi fi LIBS="$withval $LIBS" # If Socks was compiled with Kerberos support, we will need # to link against kerberos libraries. Temporarily append # to LIBS. This is harmless if there is no kerberos support. TMPLIBS="$LIBS" LIBS="$LIBS $KERBEROS_LIBS" AC_TRY_LINK([], [ SOCKSconnect(); ], [], [ AC_MSG_ERROR(Could not find the $withval library. You must first install socks5.) ]) LIBS="$TMPLIBS" ;; esac ], AC_MSG_RESULT(no) ) fi if test "x$socks" = "x"; then AC_MSG_CHECKING(whether to support SOCKS4) AC_ARG_WITH(socks4, [ --with-socks4[=PATH] Compile with SOCKS4 firewall traversal support.], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) socks=4 if test "x$withval" = "xyes"; then withval="-lsocks" else if test -d "$withval"; then withval="-L$withval -lsocks" fi fi LIBS="$withval $LIBS" AC_TRY_LINK([], [ Rconnect(); ], [], [ AC_MSG_ERROR(Could not find the $withval library. You must first install socks.) ]) ;; esac ], AC_MSG_RESULT(no) ) fi if test "x$socks" = "x4"; then AC_DEFINE(SOCKS) AC_DEFINE(SOCKS4) AC_DEFINE(connect, Rconnect) AC_DEFINE(getsockname, Rgetsockname) AC_DEFINE(bind, Rbind) AC_DEFINE(accept, Raccept) AC_DEFINE(listen, Rlisten) AC_DEFINE(select, Rselect) fi if test "x$socks" = "x5"; then AC_DEFINE(SOCKS) AC_DEFINE(SOCKS5) AC_DEFINE(connect,SOCKSconnect) AC_DEFINE(getsockname,SOCKSgetsockname) AC_DEFINE(getpeername,SOCKSgetpeername) AC_DEFINE(bind,SOCKSbind) AC_DEFINE(accept,SOCKSaccept) AC_DEFINE(listen,SOCKSlisten) AC_DEFINE(select,SOCKSselect) AC_DEFINE(recvfrom,SOCKSrecvfrom) AC_DEFINE(sendto,SOCKSsendto) AC_DEFINE(recv,SOCKSrecv) AC_DEFINE(send,SOCKSsend) AC_DEFINE(read,SOCKSread) AC_DEFINE(write,SOCKSwrite) AC_DEFINE(rresvport,SOCKSrresvport) AC_DEFINE(shutdown,SOCKSshutdown) AC_DEFINE(listen,SOCKSlisten) AC_DEFINE(close,SOCKSclose) AC_DEFINE(dup,SOCKSdup) AC_DEFINE(dup2,SOCKSdup2) AC_DEFINE(fclose,SOCKSfclose) AC_DEFINE(gethostbyname,SOCKSgethostbyname) fi AC_MSG_CHECKING([whether to enable ipv6]) if test "x$socks" = "x4" -o "x$socks" = "x5"; then AC_MSG_RESULT(no, bacause you enabled SOCKS$socks support) else AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable ipv6 (with ipv4) support], [ case "$enableval" in yes) AC_MSG_RESULT(yes) AC_DEFINE(INET6) ipv6=yes ;; esac ]) if test "x$ipv6" = "xno" -o "x$ipv6" = "x" ; then AC_MSG_RESULT(no) ipv6=no fi ipv6type=unknown ipv6lib=none ipv6trylibc=no if test "x$ipv6" = "xyes"; then AC_MSG_CHECKING([ipv6 stack type]) for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do case $i in inria) dnl http://www.kame.net/ AC_EGREP_CPP(yes, [ #include #ifdef IPV6_INRIA_VERSION yes #endif], [ipv6type=$i; AC_DEFINE(INET6)]) ;; kame) dnl http://www.kame.net/ AC_EGREP_CPP(yes, [ #include #ifdef __KAME__ yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; ipv6trylibc=yes; AC_DEFINE(INET6)]) ;; linux-glibc) dnl http://www.v6.linux.or.jp/ AC_EGREP_CPP(yes, [ #include #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 yes #endif], [ipv6type=$i; AC_DEFINE(INET6)]) ;; linux-libinet6) dnl http://www.v6.linux.or.jp/ if test -d /usr/inet6 -a -f /usr/include/netinet/ip6.h; then ipv6type=$i ipv6lib=inet6 ipv6libdir=/usr/inet6/lib ipv6trylibc=yes; CFLAGS="-I/usr/inet6/include $CFLAGS" AC_DEFINE(INET6) fi ;; toshiba) AC_EGREP_CPP(yes, [ #include #ifdef _TOSHIBA_INET6 yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; AC_DEFINE(INET6)]) ;; v6d) AC_EGREP_CPP(yes, [ #include #ifdef __V6D__ yes #endif], [ipv6type=$i; ipv6lib=v6; ipv6libdir=/usr/local/v6/lib; CFLAGS="-I/usr/local/v6/include $CFLAGS"]) ;; zeta) AC_EGREP_CPP(yes, [ #include #ifdef _ZETA_MINAMI_INET6 yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; AC_DEFINE(INET6)]) ;; esac if test "x$ipv6type" != "xunknown"; then break fi done AC_MSG_RESULT($ipv6type) fi if test "x$ipv6" = "xyes" -a "x$ipv6lib" != "xnone"; then if test -d "$ipv6libdir" -a -f "$ipv6libdir/lib$ipv6lib.a"; then LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" AC_MSG_RESULT(You have $ipv6lib library, using it) else if test "x$ipv6trylibc" = "xyes"; then AC_MSG_RESULT([You do not have (need) $ipv6lib library, using libc]) else AC_MSG_ERROR(Fatal: no $ipv6lib library found. cannot continue. You need to fetch lib$ipv6lib.a from appropriate ipv6 kit and compile beforehand.) fi fi fi AC_MSG_CHECKING(getaddrinfo bug) AC_TRY_RUN([ #include #include #include #include #include main() { int passive, gaierr, inet4 = 0, inet6 = 0; struct addrinfo hints, *ai, *aitop; char straddr[INET6_ADDRSTRLEN], strport[16]; for (passive = 0; passive <= 1; passive++) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_flags = passive ? AI_PASSIVE : 0; hints.ai_socktype = SOCK_STREAM; if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { (void)gai_strerror(gaierr); goto bad; } for (ai = aitop; ai; ai = ai->ai_next) { if (ai->ai_addr == NULL || ai->ai_addrlen == 0 || getnameinfo(ai->ai_addr, ai->ai_addrlen, straddr, sizeof(straddr), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { goto bad; } switch (ai->ai_family) { case AF_INET: if (strcmp(strport, "54321") != 0) { goto bad; } if (passive) { if (strcmp(straddr, "0.0.0.0") != 0) { goto bad; } } else { if (strcmp(straddr, "127.0.0.1") != 0) { goto bad; } } inet4++; break; case AF_INET6: if (strcmp(strport, "54321") != 0) { goto bad; } if (passive) { if (strcmp(straddr, "::") != 0) { goto bad; } } else { if (strcmp(straddr, "::1") != 0) { goto bad; } } inet6++; break; case AF_UNSPEC: goto bad; break; default: /* another family support? */ break; } } } if (inet4 != 0 && inet4 != 2) goto bad; if (inet6 != 0 && inet6 != 2) goto bad; if (aitop) freeaddrinfo(aitop); exit(0); bad: if (aitop) freeaddrinfo(aitop); exit(1); } ], AC_MSG_RESULT(good) buggygetaddrinfo=no, AC_MSG_RESULT(buggy) buggygetaddrinfo=yes, AC_MSG_RESULT(buggy) buggygetaddrinfo=yes) fi if test "x$buggygetaddrinfo" = "xyes"; then if test "x$ipv6" = "xyes" -a "x$ipv6type" != "xlinux"; then AC_MSG_ERROR(Fatal: You must get working getaddrinfo() function.) AC_MSG_ERROR( or you can specify "--disable-ipv6".) exit 1 elif test "x$ipv6type" = "xlinux"; then AC_MSG_ERROR(Warning: getaddrinfo() implementation on your system seems be buggy.) AC_MSG_ERROR( Better upgreade your system library to newest version) AC_MSG_ERROR([ of GNU C library (aka glibc).]) fi fi AC_MSG_CHECKING(for struct sockaddr's sa_len) AC_TRY_LINK([ #include #include ],[ struct sockaddr sa; int i; i = sa.sa_len; exit(0); ], AC_DEFINE(HAVE_SOCKADDR_SA_LEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING(whether to enable SSL) AC_ARG_WITH(ssl, [ --with-ssl[=PATH] Prefix where GNU TLS is installed (optional)], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) olibs="$LIBS" ocflags="$CFLAGS" if test "x$withval" = "xyes"; then gnutls_prefix="" else gnutls_prefix="$withval" fi AC_MSG_CHECKING(for GNU TLS) pkg-config --exists gnutls >/dev/null 2>&1 if test $? -ne 0; then AC_MSG_RESULT(no) ssl=no else if test -d "$gnutls_prefix/include" -a -n "$gnutls_prefix"; then CFLAGS="-I$gnutls_prefix/include" else CFLAGS="$ocflags `pkg-config --cflags gnutls`" fi if test -d "$gnutls_prefix/lib" -a -n "$gnutls_prefix"; then LIBS="$olibs -L$gnutls_prefix/lib -lgnutls" else LIBS="$olibs `pkg-config --libs gnutls`" fi AC_TRY_LINK([ #include ], [ gnutls_check_version(NULL); ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SSL) ssl=yes ], [ AC_MSG_RESULT(no) LIBS="$olibs" CFLAGS="$ocflags" ssl=no ]) fi esac ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to enable OpenSSL) if test "x$ssl" = "xyes"; then AC_MSG_RESULT(no (you enabled GNU TLS support)) else AC_ARG_WITH(openssl, [ --with-openssl[=PATH] Prefix where OpenSSL is installed (optional)], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) olibs="$LIBS" ocflags="$CFLAGS" if test "x$withval" = "xyes"; then openssl_prefix="" else openssl_prefix="$withval" fi AC_MSG_CHECKING(for OpenSSL) if test -d "$openssl_prefix/include" -a -n "$openssl_prefix"; then CFLAGS="-I$openssl_prefix/include $CFLAGS" fi if test -d "$openssl_prefix/lib" -a -n "$openssl_prefix"; then LIBS="-L$openssl_prefix/lib $LIBS -lssl -lcrypto" else LIBS="$LIBS -lssl -lcrypto" fi AC_TRY_LINK([ #include ], [ return OPENSSL_VERSION_NUMBER; ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OPENSSL) openssl=yes ], [ AC_MSG_RESULT(no) LIBS="$olibs" CFLAGS="$ocflags" openssl=no ]) ;; esac ], AC_MSG_RESULT(no) ) fi AC_MSG_CHECKING(whether to enable regexp support) AC_ARG_ENABLE(regexp, [ --enable-regexp Enable POSIX.2 regexp support], [ case "$enableval" in yes) AC_TRY_LINK([ #include #include ], [ int rc; regex_t preg; rc = regcomp(&preg, "blah", REG_EXTENDED); if (rc != 0) return 1; else return 0; ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_REGCOMP) regexp=yes ], [ AC_MSG_RESULT(no) LIBS="$ac_save_LIBS" regexp=no ]) ;; esac ]) if test "x$regexp" = "xno" -o "x$regexp" = "x" ; then AC_MSG_RESULT(no) regexp=no fi AC_MSG_CHECKING(whether to enable FiSH support) AC_ARG_ENABLE(fish, [ --disable-fish Disable FiSH encryption support]) if test "x$enable_fish" != "xno"; then olibs="$LIBS" LIBS="$LIBS -lgmp" AC_TRY_LINK([ #include #include ], [ int rc; mpz_t val; mpz_init(val); return 0; ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GMP) fish=yes ] else [ LIBS="$olibs" fish=no ]) fi if test "x$fish" = "xno" -o "x$fish" = "x" ; then AC_MSG_RESULT(no) fish=no fi if test -n "$hpux" then # HP-UX's pax is broken AC_CHECK_PROGS(COPY_DIRECTORY, tar cpio) else AC_CHECK_PROGS(COPY_DIRECTORY, pax tar cpio) fi if test "x$COPY_DIRECTORY" = "xpax"; then INSTALL_HELP_CMD='cd help; pax -r -w -s ";.*/\.?CVS$$;;" -s ";.*/\.?CVS/.*;;" . $(DESTDIR)/$(HELP_DIR)' else if test "x$COPY_DIRECTORY" = "xtar"; then INSTALL_HELP_CMD='cd help; tar -cf - . | ( cd $(DESTDIR)/$(HELP_DIR); tar -xf - )' else if test "x$COPY_DIRECTORY" = "xcpio"; then INSTALL_HELP_CMD='cd help; find . -print | cpio -pdu $(DESTDIR)/$(HELP_DIR)' else INSTALL_HELP_CMD="@echo \"I couldn't figure out a way to install the help files.\"" fi fi fi AC_SUBST(INSTALL_HELP_CMD) if test "x$COPY_DIRECTORY" = "xpax"; then INSTALL_TRANSLATION_CMD='cd translation; pax -r -w -s ";.*/\.?CVS$$;;" -s ";.*/\.?CVS/.*;;" . $(DESTDIR)/$(TRANS_PATH)' else if test "x$COPY_DIRECTORY" = "xtar"; then INSTALL_TRANSLATION_CMD='cd translation; tar -cf - . | ( cd $(DESTDIR)/$(TRANS_PATH); tar -xf - )' else if test "x$COPY_DIRECTORY" = "xcpio"; then INSTALL_TRANSLATION_CMD='cd translation; find . -print | cpio -pdu $(DESTDIR)/$(TRANS_PATH)' else INSTALL_TRANSLATION_CMD="@echo \"I couldn't figure out a way to install the translation files.\"" fi fi fi AC_SUBST(INSTALL_TRANSLATION_CMD) AC_CHECK_PROGS(ZCAT, gzcat zcat gunzip gzip uncompress uncompress) case "x$ZCAT" in xgzcat) ZSUFFIX=".gz" ZARGS= ;; xzcat) ZSUFFIX=".Z" ZARGS= ;; xgunzip) ZSUFFIX=".gz" ZARGS="-c" ;; xgzip) ZSUFFIX=".gz" ZARGS="-dc" ;; xuncompress) ZSUFFIX=".Z" ZARGS="-c" ;; xcompress) ZSUFFIX=".Z" ZARGS="-dc" ;; esac AC_DEFINE_UNQUOTED(ZCAT,"$ZCAT") AC_DEFINE_UNQUOTED(ZSUFFIX,"$ZSUFFIX") if test x"$ZARGS" != x; then AC_DEFINE_UNQUOTED(ZARGS,"$ZARGS") fi AC_FIND_PROGRAM(SENDMAIL,sendmail,/usr/sbin:/usr/lib:/usr/ucblib) AC_SUBST(RM) AC_SUBST(LN) AC_OUTPUT(Makefile source/Makefile ircbug) #if test ! -f config.h; then # cp ${srcdir}/include/config.h.dist config.h #fi echo echo well there we are, you now might want to look in config.h and echo see if there is anything you might want to tune, else you can echo just run a make here.. good luck! echo