+# -- Functions --
+
+AC_FUNC_FORK
+AC_FUNC_STRFTIME
+
+AC_CHECK_FUNCS([ \
+ bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
+ memset realloc setsid setsockopt socket strcasecmp strchr strerror \
+ strstr waitpid],,AC_MSG_ERROR([required function missing!]))
+
+AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
+
+AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
+ AC_MSG_ERROR([required function select() is missing!])
+)
+
+# -- Configuration options --
+
+x_syslog_on=no
+AC_ARG_WITH(syslog,
+ [ --without-syslog disable syslog (autodetected by default)],
+ [ if test "$withval" = "yes"; then
+ AC_CHECK_LIB(be, syslog)
+ AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
+ AC_MSG_ERROR([Can't enable syslog!])
+ )
+ fi
+ ],
+ [
+ AC_CHECK_LIB(be, syslog)
+ AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
+ ]
+)
+if test "$x_syslog_on" = "yes"; then
+ AC_DEFINE(SYSLOG, 1)
+ AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
+fi
+
+x_zlib_on=no
+AC_ARG_WITH(zlib,
+ [ --without-zlib disable zlib compression (autodetected by default)],
+ [ if test "$withval" = "yes"; then
+ 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
+
+x_tcpwrap_on=no
+AC_ARG_WITH(tcp-wrappers,
+ [ --with-tcp-wrappers enable TCP wrappers support],
+ [ if test "$withval" = "yes"; then
+ AC_CHECK_LIB(wrap, tcpd_warn)
+ AC_MSG_CHECKING(for hosts_access)
+ AC_TRY_LINK([
+ #include <tcpd.h>
+ ],[
+ void *ptr;
+ ptr = hosts_access;
+ ],[
+ 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
+ ]
+)
+
+x_rendezvous_on=no
+AC_ARG_WITH(rendezvous,
+ [ --with-rendezvous enable support for "Rendezvous"],
+ [ if test "$withval" = "yes"; then
+ AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
+ AC_MSG_ERROR([Can't enable Rendezvous!])
+ )
+ fi
+ ]
+)
+if test "$x_rendezvous_on" = "yes"; then
+ AC_DEFINE(RENDEZVOUS, 1)
+ AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
+ mach/port.h],,AC_MSG_ERROR([required C header missing!]))
+fi
+
+x_identauth_on=no
+AC_ARG_WITH(ident,
+ [ --with-ident enable "IDENT" ("AUTH") protocol support],
+ [ if test "$withval" = "yes"; then
+ 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
+
+x_ircplus_on=yes
+AC_ARG_ENABLE(ircplus,
+ [ --disable-ircplus disable IRC+ protocol],
+ if test "$enableval" = "no"; then x_ircplus_on=no; fi