+# 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 SSL?
+
+AC_ARG_WITH(openssl,
+ [ --with-openssl enable SSL support using OpenSSL],
+ [ 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(crypto, BIO_s_mem)
+ AC_CHECK_LIB(ssl, SSL_library_init)
+ AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
+ AC_MSG_ERROR([Can't enable openssl])
+ )
+ fi
+ ]
+)
+
+AC_ARG_WITH(gnutls,
+ [ --with-gnutls enable SSL support using gnutls],
+ [ 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(gnutls, gnutls_global_init)
+ AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
+ AC_MSG_ERROR([Can't enable gnutls])
+ )
+ fi
+ ]
+)
+
+x_ssl_lib="no"
+if test "$x_ssl_gnutls" = "yes"; then
+ if test "$x_ssl_openssl" = "yes";then
+ AC_MSG_ERROR([Cannot enable both gnutls and openssl])
+ fi
+ x_ssl_lib=gnutls
+fi
+if test "$x_ssl_openssl" = "yes"; then
+ x_ssl_lib=openssl
+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
+ ]
+)
+
+# 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 PAM support?
+
+x_pam_on=no
+AC_ARG_WITH(pam,
+ [ --with-pam enable user authentication using PAM],
+ [ 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(pam, pam_authenticate)
+ AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
+ AC_MSG_ERROR([Can't enable PAM support!])
+ )
+ fi
+ ]
+)
+if test "$x_pam_on" = "yes"; then
+ AC_DEFINE(PAM, 1)
+ AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
+ if test "$pam_ok" != "yes"; then
+ AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
+ AC_MSG_ERROR([required C header missing!]))
+ fi
+fi
+
+# compile in IRC+ protocol support?
+