diff -ur libtimidity-0.1.0.orig/configure.ac libtimidity-0.1.0/configure.ac
--- libtimidity-0.1.0.orig/configure.ac	2004-11-23 06:30:46.000000000 +0200
+++ libtimidity-0.1.0/configure.ac	2007-08-02 15:51:47.000000000 +0300
@@ -39,9 +39,24 @@
 # Checks for libraries.
 LIBTIMIDITY_LIBS=""
 AC_CHECK_LIB([m], [pow], [LIBTIMIDITY_LIBS="$TIMIDITY_LIBS -lm"])
-have_ao=no
-XIPH_PATH_AO([have_ao=yes])
+
+AC_ARG_ENABLE([ao],
+    [AS_HELP_STRING([--enable-ao], [Enable libao (default=disabled)])],
+    [have_ao="$enableval"],
+    [have_ao="no"]
+)
+
+if test "$have_ao" = "yes"; then
+    PKG_CHECK_MODULES([AO], [ao >= 0.8.5])
+    AC_DEFINE([AO], [], [Define when building with ao])
+    HAVE_AO="true"
+else
+    HAVE_AO="false"
+fi
+
+AC_SUBST([ENABLE_AO])
 AM_CONDITIONAL([HAVE_AO], [test $have_ao = yes])
+AC_SUBST(AO_LIBS)
 
 # Checks for header files.
 AC_HEADER_STDC
