+#
+# Detecting the linux distro for specific things like initscripts.
+#
+AC_ARG_WITH(distro, AS_HELP_STRING(--with-distro=DISTRO,Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware))
+if test "z$with_distro" = "z"; then
+ AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
+ AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
+ AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
+ AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
+ AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+ AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
+fi
+with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
+
+if test "z$with_distro" = "z"; then
+ echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
+ exit 1
+else
+case $with_distro in
+ debian|gentoo|suse)
+ ;;
+ *)
+ echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
+ ;;
+esac
+
+fi
+AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
+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_SLACKWARE, test x"$with_distro" = xslackware)
+
+#
+# Defining Avahi User and Group.
+#
+AC_ARG_WITH(avahi_user,[ --with-avahi-user=<user> User for running the Avahi daemon (avahi)])
+if test -z "$with_avahi_user" ; then
+ AVAHI_USER=avahi
+else
+ AVAHI_USER=$with_avahi_user
+fi
+AC_SUBST(AVAHI_USER)
+AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
+
+AC_ARG_WITH(avahi_group,[ --with-avahi-group=<grp> Group for Avahi (avahi)])
+if test -z "$with_avahi_group" ; then
+ AVAHI_GROUP=avahi
+else
+ AVAHI_GROUP=$with_avahi_group
+fi
+AC_SUBST(AVAHI_GROUP)
+AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
+
+#
+# Avahi runtime dir
+#
+avahi_runtime_dir="${localstatedir}/run"
+avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
+AC_SUBST(avahi_runtime_dir)
+AC_SUBST(avahi_socket)
+
+#
+# Python stuff
+#
+AM_PATH_PYTHON(2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no])
+AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = xyes ])
+
+# ==========================================================================
+AC_CONFIG_FILES([
+Makefile
+avahi-core.pc
+avahi-common/Makefile
+avahi-core/Makefile
+avahi-daemon/Makefile
+avahi-daemon/avahi-dbus.conf
+avahi-discover-standalone/Makefile
+avahi-client/Makefile
+initscript/Makefile
+initscript/Debian/Makefile
+initscript/Gentoo/Makefile
+initscript/SUSE/Makefile
+avahi-dnsconfd/Makefile
+avahi-utils/Makefile
+avahi-utils/avahi/Makefile
+examples/Makefile
+common/Makefile
+man/Makefile
+])