--- mulk-0.4.1/src/parse.c.orig	2009-05-24 15:54:39.000000000 +0100
+++ mulk-0.4.1/src/parse.c	2010-07-29 16:38:58.997014932 +0100
@@ -23,6 +23,8 @@
 # include <tidy.h>
 #elif defined(HAVE_TIDY_TIDY_H)
 # include <tidy/tidy.h>
+#elif defined(HAVE_TIDYP_TIDYP_H)
+# include <tidyp/tidyp.h>
 #else
 # error "Don't know where to look for libtidy headers"
 #endif
--- mulk-0.4.1/configure.ac.orig	2009-05-24 15:44:30.000000000 +0100
+++ mulk-0.4.1/configure.ac	2010-07-29 16:48:24.336997827 +0100
@@ -45,7 +45,9 @@
 
 # Checks for libraries.
 AC_CHECK_LIB([curl], [curl_multi_init], [], AC_MSG_ERROR([Cannot compile without libcurl. Try at http://curl.haxx.se/]))
-AC_CHECK_LIB([tidy], [tidyGetChild], [], AC_MSG_ERROR([Cannot compile without libtidy. Try at http://tidy.sourceforge.net/]))
+AC_CHECK_LIB([tidy], [tidyGetChild], [],
+  [AC_CHECK_LIB([tidyp], [tidyGetChild], [], AC_MSG_ERROR([Cannot compile without libtidy. Try at http://tidy.sourceforge.net/]))]
+)
 AC_CHECK_LIB([uriparser], [uriParseUriA], [], AC_MSG_ERROR([Cannot compile without liburiparser. Try at http://uriparser.sourceforge.net/]))
 
 if test "x$enable_metalink" = "xyes"; then
@@ -74,7 +76,10 @@
   [AC_DEFINE([HAVE_TIDY_H], [1], [Define to 1 if you have the <tidy.h> header file.])],
   [AC_CHECK_HEADER([tidy/tidy.h],
     [AC_DEFINE([HAVE_TIDY_TIDY_H], [1], [Define to 1 if you have the <tidy/tidy.h> header file.])],
-    [AC_MSG_ERROR([Cannot compile without libtidy. Try at http://tidy.sourceforge.net/])])
+    [AC_CHECK_HEADER([tidyp/tidyp.h],
+      [AC_DEFINE([HAVE_TIDYP_TIDYP_H], [1], [Define to 1 if you have the <tidyp/tidyp.h> header file.])],
+      [AC_MSG_ERROR([Cannot compile without libtidy. Try at http://tidy.sourceforge.net/])])
+    ])
   ]
 )
 AC_CHECK_HEADER([uriparser/Uri.h],, AC_MSG_ERROR([Cannot compile without liburiparser. Try at http://uriparser.sourceforge.net/]))
======================= delete this line and everything below for an upstreamable patch ====================
diff -ur mulk-0.4.1.orig/config.h.in mulk-0.4.1/config.h.in
--- mulk-0.4.1.orig/config.h.in	2009-05-24 15:44:30.000000000 +0100
+++ mulk-0.4.1/config.h.in	2010-07-29 16:54:02.000000000 +0100
@@ -30,6 +30,9 @@
 /* Define to 1 if you have the `tidy' library (-ltidy). */
 #undef HAVE_LIBTIDY
 
+/* Define to 1 if you have the `tidyp' library (-ltidyp). */
+#undef HAVE_LIBTIDYP
+
 /* Define to 1 if you have the `uriparser' library (-luriparser). */
 #undef HAVE_LIBURIPARSER
 
@@ -108,6 +111,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <tidyp/tidyp.h> header file. */
+#undef HAVE_TIDYP_TIDYP_H
+
 /* Define to 1 if you have the <tidy.h> header file. */
 #undef HAVE_TIDY_H
 
diff -ur mulk-0.4.1.orig/configure mulk-0.4.1/configure
--- mulk-0.4.1.orig/configure	2009-05-24 15:44:30.000000000 +0100
+++ mulk-0.4.1/configure	2010-07-29 16:54:02.000000000 +0100
@@ -3980,12 +3980,89 @@
   LIBS="-ltidy $LIBS"
 
 else
+
+{ $as_echo "$as_me:$LINENO: checking for tidyGetChild in -ltidyp" >&5
+$as_echo_n "checking for tidyGetChild in -ltidyp... " >&6; }
+if test "${ac_cv_lib_tidyp_tidyGetChild+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltidyp  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tidyGetChild ();
+int
+main ()
+{
+return tidyGetChild ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  ac_cv_lib_tidyp_tidyGetChild=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_tidyp_tidyGetChild=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_tidyp_tidyGetChild" >&5
+$as_echo "$ac_cv_lib_tidyp_tidyGetChild" >&6; }
+if test "x$ac_cv_lib_tidyp_tidyGetChild" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTIDYP 1
+_ACEOF
+
+  LIBS="-ltidyp $LIBS"
+
+else
   { { $as_echo "$as_me:$LINENO: error: Cannot compile without libtidy. Try at http://tidy.sourceforge.net/" >&5
 $as_echo "$as_me: error: Cannot compile without libtidy. Try at http://tidy.sourceforge.net/" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 
+fi
+
+
 { $as_echo "$as_me:$LINENO: checking for uriParseUriA in -luriparser" >&5
 $as_echo_n "checking for uriParseUriA in -luriparser... " >&6; }
 if test "${ac_cv_lib_uriparser_uriParseUriA+set}" = set; then
@@ -5463,6 +5540,145 @@
 _ACEOF
 
 else
+  if test "${ac_cv_header_tidyp_tidyp_h+set}" = set; then
+  { $as_echo "$as_me:$LINENO: checking for tidyp/tidyp.h" >&5
+$as_echo_n "checking for tidyp/tidyp.h... " >&6; }
+if test "${ac_cv_header_tidyp_tidyp_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_tidyp_tidyp_h" >&5
+$as_echo "$ac_cv_header_tidyp_tidyp_h" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking tidyp/tidyp.h usability" >&5
+$as_echo_n "checking tidyp/tidyp.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <tidyp/tidyp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking tidyp/tidyp.h presence" >&5
+$as_echo_n "checking tidyp/tidyp.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <tidyp/tidyp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: tidyp/tidyp.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: tidyp/tidyp.h: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## --------------------------------------------------- ##
+## Report this to http://sourceforge.net/projects/mulk ##
+## --------------------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for tidyp/tidyp.h" >&5
+$as_echo_n "checking for tidyp/tidyp.h... " >&6; }
+if test "${ac_cv_header_tidyp_tidyp_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_header_tidyp_tidyp_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_tidyp_tidyp_h" >&5
+$as_echo "$ac_cv_header_tidyp_tidyp_h" >&6; }
+
+fi
+if test "x$ac_cv_header_tidyp_tidyp_h" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TIDYP_TIDYP_H 1
+_ACEOF
+
+else
   { { $as_echo "$as_me:$LINENO: error: Cannot compile without libtidy. Try at http://tidy.sourceforge.net/" >&5
 $as_echo "$as_me: error: Cannot compile without libtidy. Try at http://tidy.sourceforge.net/" >&2;}
    { (exit 1); exit 1; }; }
@@ -5470,6 +5686,10 @@
 
 
 
+fi
+
+
+
 
 fi
 
