+# use zlib compression?
+
+x_zlib_on=no
+AC_ARG_WITH(zlib,
+ [ --without-zlib disable zlib compression (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_LIB(z, deflate)
+ AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
+ AC_MSG_ERROR([Can't enable zlib!])
+ )
+ fi
+ ],
+ [ AC_CHECK_LIB(z, deflate)
+ AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
+ ]
+)
+if test "$x_zlib_on" = "yes"; then
+ AC_DEFINE(ZLIB, 1)
+ AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
+fi
+
+# detect which IO API to use:
+
+x_io_backend=none
+
+AC_ARG_WITH(select,
+ [ --without-select disable select IO support (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_FUNCS(select, x_io_select=yes,
+ AC_MSG_ERROR([Can't enable select IO support!])
+ )
+ fi
+ ],
+ [
+ AC_CHECK_FUNCS(select, x_io_select=yes)
+ ]
+)
+
+AC_ARG_WITH(poll,
+ [ --without-poll disable poll support (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_FUNCS(poll, x_io_backend=poll\(\),
+ AC_MSG_ERROR([Can't enable poll IO support!])
+ )
+ fi
+ ],
+ [
+ AC_CHECK_FUNCS(poll, x_io_backend=poll\(\))
+ ]
+)
+
+AC_ARG_WITH(devpoll,
+ [ --without-devpoll disable /dev/poll IO support (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+
+ AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
+ fi
+ ],
+ [
+ AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
+ ]
+)
+
+AC_ARG_WITH(epoll,
+ [ --without-epoll disable epoll IO support (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
+ AC_MSG_ERROR([Can't enable epoll IO support!])
+ )
+ fi
+ ],
+ [
+ AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
+ ]
+)
+
+AC_ARG_WITH(kqueue,
+ [ --without-kqueue disable kqueue IO support (autodetected by default)],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
+ AC_MSG_ERROR([Can't enable kqueue IO support!])
+ )
+ fi
+ ],
+ [
+ AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
+ ]
+)
+
+if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
+ # when epoll() and select() are available, we'll use both!
+ x_io_backend="epoll(), select()"
+else
+ if test "$x_io_epoll" = "yes"; then
+ # we prefere epoll() if it is available
+ x_io_backend="epoll()"
+ else
+ if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
+ # we'll use select, when available and no "better"
+ # interface has been detected ...
+ x_io_backend="select()"
+ fi
+ fi
+fi
+
+if test "$x_io_backend" = "none"; then
+ AC_MSG_ERROR([No useabe IO API activated/found!?])
+fi
+
+# use TCP wrappers?
+
+x_tcpwrap_on=no
+AC_ARG_WITH(tcp-wrappers,
+ [ --with-tcp-wrappers enable TCP wrappers support],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_MSG_CHECKING(for hosts_access)
+ LIBS="-lwrap $LIBS"
+ AC_TRY_LINK([
+#include <tcpd.h>
+int allow_severity = 0;
+int deny_severity = 0;
+ ],[
+ tcpd_warn("link test");
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(TCPWRAP, 1)
+ x_tcpwrap_on=yes
+ ],[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([Can't enable TCP wrappers!])
+ ])
+ fi
+ ]
+)
+
+# include support for "zeroconf"?
+
+x_zeroconf_on=no
+AC_ARG_WITH(zeroconf,
+ [ --with-zeroconf enable support for "Zeroconf"],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
+ [
+ AC_CHECK_LIB(pthread, pthread_mutexattr_init)
+ AC_CHECK_LIB(howl, sw_discovery_init)
+ AC_CHECK_FUNCS(sw_discovery_init, \
+ x_zeroconf_on=howl, \
+ AC_MSG_ERROR([Can't enable Zeroconf!]))
+ ])
+ fi
+ ]
+)
+if test "$x_zeroconf_on" = "osx"; then
+ AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
+ mach/port.h],,AC_MSG_ERROR([required C header missing!]))
+ AC_DEFINE(ZEROCONF, 1)
+fi
+if test "$x_zeroconf_on" = "howl"; then
+ for dir in /usr/local/include /usr/local/include/howl* \
+ /usr/include /usr/include/howl* \
+ /usr/local/include/avahi* /usr/include/avahi*; do
+ test -d "$dir" || continue
+ AC_MSG_CHECKING([for Howl headers in $dir])
+ if test -f "$dir/rendezvous/rendezvous.h"; then
+ if test "$dir" != "/usr/local/include" -a \
+ "$dir" != "/usr/include"; then
+ CFLAGS="-I$dir $CFLAGS"
+ CPPFLAGS="-I$dir $CPPFLAGS"
+ fi
+ AC_MSG_RESULT(yes)
+ break
+ else
+ AC_MSG_RESULT(no)
+ fi
+ done
+ AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
+ AC_MSG_ERROR([required C header missing!]))
+ AC_DEFINE(ZEROCONF, 1)
+fi
+
+# do IDENT requests using libident?
+
+x_identauth_on=no
+AC_ARG_WITH(ident,
+ [ --with-ident enable "IDENT" ("AUTH") protocol support],
+ [ if test "$withval" != "no"; then
+ if test "$withval" != "yes"; then
+ CFLAGS="-I$withval/include $CFLAGS"
+ CPPFLAGS="-I$withval/include $CPPFLAGS"
+ LDFLAGS="-L$withval/lib $LDFLAGS"
+ fi
+ AC_CHECK_LIB(ident, ident_id)
+ AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
+ AC_MSG_ERROR([Can't enable IDENT support!])
+ )
+ fi
+ ]
+)
+if test "$x_identauth_on" = "yes"; then
+ AC_DEFINE(IDENTAUTH, 1)
+ AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
+fi
+
+# compile in IRC+ protocol support?
+