+ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
+
+#
+# Host specific stuffs
+#
+case "$host" in
+ *-netbsd* | *-knetbsd*-gnu)
+ AC_DEFINE([NETBSD],[],[ Support for NetBSD])
+ avahi_platform=netbsd
+ ;;
+ *-openbsd*)
+ AC_DEFINE([OPENBSD],[],[ Support for OpenBSD])
+ avahi_platform=openbsd
+ ;;
+ *-solaris*)
+ AC_DEFINE([SOLARIS],[],[ Support for Sun Solaris])
+ avahi_platform=solaris
+ ;;
+ *-linux*)
+ AC_DEFINE([LINUX],[],[ Support for GNU/Linux])
+ avahi_platform=linux
+ ;;
+ *-freebsd* | *-kfreebsd*-gnu)
+ AC_DEFINE([FREEBSD],[],[ Support for FreeBSD])
+ avahi_platform=freebsd
+ ;;
+ *-apple-darwin*)
+ AC_DEFINE([DARWIN],[],[ Support for AppleDarwin])
+ avahi_platform=darwin
+ ;;
+esac
+
+#
+# Check for netlink.h
+#
+AC_CHECK_HEADER(linux/netlink.h,
+HAVE_NETLINK=yes
+AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
+, [], [
+#include <sys/socket.h>
+#include <asm/types.h>
+])
+
+AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
+
+#
+# Check for struct ip_mreqn
+#
+AC_MSG_CHECKING(for struct ip_mreqn)
+AC_TRY_COMPILE([#include <netinet/in.h>], [
+ struct ip_mreqn mreq;
+ mreq.imr_address.s_addr = 0;
+], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
+], [
+ # We'll just have to try and use struct ip_mreq
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(for struct ip_mreq)
+ AC_TRY_COMPILE([#include <netinet/in.h>], [
+ struct ip_mreq mreq;
+ mreq.imr_interface.s_addr = 0;
+ ], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
+ ], [
+ # No multicast support
+ AC_MSG_RESULT(no)
+ ])
+])
+
+#
+# Detecting the linux distribution for specific things like init scripts.
+#
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of debian, gentoo, archlinux or none]))
+if test "z$with_distro" = "z"; then
+ AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
+ AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
+ AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux")
+ AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+fi
+with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
+
+if test "z$with_distro" = "z"; then
+ AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
+ exit 1
+else
+case $with_distro in
+ debian|gentoo|archlinux|suse|none)
+ ;;
+ *)
+ AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
+ ;;
+esac
+fi
+
+AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
+AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
+AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
+AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux)
+