+#### can't use AM_PROG_GCJ since it fails fatally if no gcj found
+AC_CHECK_PROGS(GCJ, gcj, gcj)
+if test -z "$GCJ" ; then
+ have_gcj=no
+else
+ # Needs to be here so libtool wont get confused
+ AM_PROG_GCJ
+
+ have_gcj=yes
+ if test "x${GCJFLAGS-unset}" = xunset; then
+ GCJFLAGS="-g -O2 -Wall"
+ fi
+ AC_SUBST(GCJFLAGS)
+fi
+
+if test x$enable_gcj = xauto ; then
+ if test x$have_gcj = xno ; then
+ enable_gcj=no
+ else
+ enable_gcj=yes
+ fi
+fi
+
+if test x$enable_gcj = xyes; then
+ if test x$have_gcj = xno ; then
+ AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
+ fi
+fi
+
+AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
+
+AM_PROG_LIBTOOL
+
+#### Look for mono
+MONO_REQUIRED_VERSION=0.91
+AC_SUBST(MONO_REQUIRED_VERSION)
+PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
+
+if test "x$have_mono" = "xtrue"; then
+if test `uname -s` = "Darwin"; then
+ AC_PATH_PROG(RUNTIME, mint, no)
+ AC_PATH_PROG(CSC, mcs, no)
+ LIB_PREFIX=
+ LIB_SUFFIX=.dylib
+else
+ AC_PATH_PROG(RUNTIME, mono, no)
+ AC_PATH_PROG(CSC, mcs, no)
+ LIB_PREFIX=.so
+ LIB_SUFFIX=
+fi
+else
+AC_PATH_PROG(CSC, csc.exe, no)
+RUNTIME=
+LIB_PREFIX=
+LIB_SUFFIX=.dylib
+fi
+
+if test x$enable_mono = xyes; then
+ if test x$have_mcs = xno ; then
+ AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
+ fi
+
+ ### Test for GACUTIL
+ AC_PATH_PROG(GACUTIL, gacutil, no)
+ if test "x$GACUTIL" = "xno" ; then
+ AC_MSG_ERROR([No gacutil tool found])
+ fi
+
+ AC_SUBST(GACUTIL)
+fi
+
+if test x$enable_mono = xauto ; then
+ if test x$CSC = xno ; then
+ enable_mono=no
+ else
+ ### Test for GACUTIL
+ AC_PATH_PROG(GACUTIL, gacutil, no)
+ if test "x$GACUTIL" = "xno" ; then
+ enable_mono=no
+ else
+ enable_mono=yes
+ fi
+ fi
+fi
+
+AC_SUBST(RUNTIME)
+AC_SUBST(CSC)
+AC_SUBST(GACUTIL)
+AC_SUBST(LIB_PREFIX)
+AC_SUBST(LIB_SUFFIX)
+
+AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
+
+#### Look for monodoc
+MONODOC_REQUIRED_VERSION=0.15
+AC_SUBST(MONODOC_REQUIRED_VERSION)
+PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
+
+if test x$enable_mono_docs = xyes; then
+ if test x$have_monodoc = xno ; then
+ AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
+ else
+ AC_PATH_PROG(MONODOC, monodoc, no)
+ if test x$MONODOC = xno; then
+ AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
+ fi
+ fi
+fi
+
+if test x$enable_mono_docs = xauto ; then
+ if test x$have_monodoc = xno ; then
+ enable_mono_docs=no
+ MONODOC=
+ else
+ AC_PATH_PROG(MONODOC, monodoc, no)
+ if test x$MONODOC = xno; then
+ enable_mono_docs=no
+ MONODOC=
+ else
+ enable_mono_docs=yes
+ fi
+ fi
+fi
+
+AC_SUBST(MONODOC)
+
+AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
+
+changequote(,)dnl
+# let ourselves use our own unstable API
+CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
+# compress spaces in flags