[xslt] [PATCH] Various "make distcheck" and other fixes



Hello list,

I am making use of LibXSLT across a number of Unix and Windows platforms, and have a slew of fixes to contribute. The attached patch is against git master.

The main thrust of my changes is to get Automake's "make distcheck" target into working order, and address a handful of issues I encountered in building the library on various non-Linux platforms (including compatibility with non-GNU make(1)).

I'll be happy to answer any questions, and rework elements of this patch as needed to get it in.

A walk-through of my changes, in patch order:

Makefile.am:

* Use $(VAR), not @VAR@, as the former is the correct form for AC_SUBST'ed
  variables in Makefile.am files

* Touch these *.xml/*.syms files in the "dist-hook" target to prevent them
  from being regenerated, because the "make dist" process in itself
  updates the timestamps of the source files when it copies them into
  $(distdir)

* Add EXTRA_LIBS (-lrt on my system) to xsltConf.sh, as this is a required
  dependency when client applications link against -lxslt

  (note that the definition of EXTRA_LIBS has been changed; see below)

* Removed MAKEFLAGS+=--silent bits, as this is not compatible with non-GNU
  Make programs

autogen.sh:

* Add --warnings=all options to automake and autoconf invocations, to
  better catch potential problems (most of which I've fixed in this patch)

configure.in:

* Replaced obsolete macros with their current equivalents; for reference,
  see

    http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html

  (I removed AC_ISC_POSIX outright because the doc states it is no longer
  useful)

* test(1) uses "=" as an operator, not "=="

* Fixed quoting on an AC_LINK_IFELSE() invocation to quell Autoconf errors

* Don't add redundant libraries to EXTRA_LIBS, because (1) this variable
  already contains LibXSLT's own additional system-library deps, and is
  useful in that form, and (2) the LibXML2 deps are already handled by
  Libtool

* Don't delete files in srcdir, and don't create the symlink to
  "Copyright" there either

  (I don't understand why this is being symlinked in the first place...)

doc/Makefile.am:

* Can't use wildcards in EXTRA_DIST, because this breaks dependencies
  (e.g. you can't "make EXSLT/\*.html"), and they only work properly when
  building inside the source tree; these have been replaced with their
  expansions. Other entries have been added here in lieu of the wildcards
  in the dist-hook target, as well as opportunistic use of the $(*PAGES)
  variables.

* Don't define an "all" target, because this steps on Automake's toes; use
  "all-local" instead

* Define and use an "xsltproc" variable to reference an in-tree-built
  version of xsltproc, instead of e.g. $(bindir)/xsltproc

  NOTE: The makefile also uses $(XSLTPROC), which names an external
  instance of the program found at configure time. Some instances of this
  could probably be changed to $(xsltproc) to remove the dependency on an
  existing installed program.

* Qualified various filenames as appropriate with $(srcdir)

* Use $(XMLLINT) consistently instead of $(bindir)/xmllint

* In the "libxslt-api.xml ..." rule, cd into $(srcdir) before invoking
  apibuild.py as this script has to run in srcdir anyway

* In the "clean-local" rule, clear out some additional files to allow
  "make distcheck" to pass

* Eliminated the redundant "maintainer-clean-local" rule

* Added a "distclean-local" rule to clear out the build directory in an
  out-of-source build to allow "make distcheck" to pass

* Added a "check-extra-dist" target to make it easier to check that
  EXTRA_DIST isn't missing anything

* Use $(MKDIR_P), not $(mkinstalldirs), as the latter name is obsolete

* Use $(VAR) instead of @VAR@

* The "dist-hook" target didn't work (if any generated files were in
  builddir and not in srcdir), and is no longer needed thanks to the
  comprehensive EXTRA_DIST variable

* Added an "uninstall-local" rule to allow "make distcheck" to pass

* Updated the .PHONY target list, removed non-existent targets

doc/symbols.xml:

* Needed to add this bit to make the generation scripts shut up

libexslt/Makefile.am:

* AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an
  obsolete name

* Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS

  (Note that $(CFLAGS) need not be added to AM_CFLAGS, because Automake
  already references both in the build rules)

* Use $(VAR) instead of @VAR@

libxslt.pc.in:

* Add EXTRA_LIBS (-lrt on my system), as this is a required dependency
  when client applications link against -lxslt

libxslt/Makefile.am:

* AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an
  obsolete name

* Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS

* Use $(VAR) instead of @VAR@, $(MKDIR_P) instead of $(mkinstalldirs)

* Use $(MKDIR_P), not $(mkinstalldirs), as the latter name is obsolete

libxslt/xsltutils.c:

* Some systems don't know about CLOCK_MONOTONIC; older Solaris knows about
  CLOCK_HIGHRES. Some systems, alas, have no usable alternative to
  CLOCK_REALTIME.

python/Makefile.am:

* AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an
  obsolete name

* Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS

* Because libxslt-py.c is (presumably) supposed to be generated every time
  at build time, don't bundle it in the dist tarball

* Use $(VAR) instead of @VAR@

* libxsltclass.py is a generated file, so it doesn't get qualified with
  $(srcdir)

* Use $(MKDIR_P) instead of (mkinstalldirs)

* Added an uninstall-local rule so that "make distcheck" passes

* Removed the $(srcdir) qualifications in the GENERATED file list, as
  these files may exist in builddir

* In the gen_prog rule, qualify the script invocation with $(srcdir), and
  set the SRCDIR environment variable so that the script can find the
  files it needs when builddir != srcdir

* Don't define an "all" target, as this steps on Automake's toes

python/generator.py:

* Get the source directory from the SRCDIR environment variable, and use
  it appropriately

python/tests/Makefile.am:

* Set CLEANFILES instead of defining a "clean" rule

* Use $(VAR) instead of @VAR@, $(MKDIR_P) instead of $(mkinstalldirs)

tests/*/Makefile.am, tests/exslt/*/Makefile.am:

* Need to clean up .memdump files for "make distcheck" to pass

* Don't define an "all" target, as this steps on Automake's toes

tests/REC/Makefile.am:

* Added two missing *.stand.out files to EXTRA_DIST

tests/XSLTMark/Makefile.am:

* Replaced the GNU-Make-specific %.out bit with a more broadly compatible
  rule

  (the "dummy" bit shuts up Automake)

* Use "$(xsltproc)" instead of "$(top_builddir)/xsltproc/xsltproc"

* Use a less $(MAKE)-heavy invocation in the "tests" target

* Replaced a conflicting "clean" target with CLEANFILES

* Added a dependency on $(xsltproc) to all the test targets

* Added a .PHONY target list

tests/docbook/Makefile.am:

* Ditched the "echo -n" bit, because it wasn't working as advertised

* Create output directories for out-of-source builds

* "$(basename $$i)" is a typo in a makefile

* Don't embed $(srcdir) in $out/$html/$fo/$msg/$xhtml, so that we can
  refer to these files in builddir or srcdir

* Add a trailing "echo" to complete the "echo -n"

* Don't output files unconditionally to srcdir (it may be read-only, for
  starters)

tests/plugins/Makefile.am:

* AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an
  obsolete name

  (Note that the "$(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)" bit that was here
  can be dropped entirely, because these already appear in
  xmlsoft_org_xslt_testplugin_la_CFLAGS)

* Use noinst_LTLIBRARIES inside the WITH_MODULES conditional instead of
  EXTRA_LTLIBRARIES, as this is cleaner (and disallows building the plugin
  if module support is disabled)

* Need to clean up *.res files for "make distcheck" to pass

* Use the abs_builddir variable conveniently provided to us by Automake
  instead of a GNU Make $(shell ...) construct

xslt-config.in:

* Add EXTRA_LIBS (-lrt on my system), as this is a required dependency
  when client applications link against -lxslt

xsltproc/Makefile.am:

* AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an
  obsolete name

* Moved $(LIBXML_CFLAGS) into AM_CFLAGS

* Use $(VAR) instead of @VAR@

* Need to clean .memdump for "make distcheck" to pass

* Added rules to build lib[e]xslt.la if needed, which allows test
  makefiles to build xsltproc on the fly even if nothing else has been
  built already

* Create .memdump file in the "tests" target, as it's being grepped
  afterward


--Daniel


--
Daniel Richard G. || danielg teragram com || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/
diff --git a/Makefile.am b/Makefile.am
index 60bc051..e357f19 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = \
 	libexslt \
 	xsltproc \
 	doc \
-	@PYTHON_SUBDIR@ \
+	$(PYTHON_SUBDIR) \
 	tests
 
 DIST_SUBDIRS = libxslt libexslt xsltproc python doc tests
@@ -14,6 +14,9 @@ confexec_DATA = xsltConf.sh
 bin_SCRIPTS = xslt-config
 
 dist-hook: cleanup libxslt.spec
+	touch $(distdir)/doc/*.xml
+	touch $(distdir)/doc/EXSLT/*.xml
+	touch $(distdir)/libxslt/*.syms
 	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn win32 vms examples) | (cd $(distdir); tar xf -)
 
 CVS_EXTRA_DIST =
@@ -34,7 +37,7 @@ xsltConf.sh: xsltConf.sh.in Makefile
 	sed -e 's?\@XSLT_LIBDIR\@?$(XSLT_LIBDIR)?g' \
 	    -e 's?\@XSLT_INCLUDEDIR\@?$(XSLT_INCLUDEDIR)?g' \
 	    -e 's?\@VERSION\@?$(VERSION)?g' \
-	    -e 's?\@XSLT_LIBS\@?$(XSLT_LIBS)?g' \
+	    -e 's?\@XSLT_LIBS\@?$(XSLT_LIBS) $(EXTRA_LIBS)?g' \
 	       < $(srcdir)/xsltConf.sh.in > xsltConf.tmp \
 	&& mv xsltConf.tmp xsltConf.sh
 
@@ -46,9 +49,9 @@ dummy:
 
 tests: dummy
 	@echo '## Running the regression test suite'
-	@(cd tests ; $(MAKE) MAKEFLAGS+=--silent tests)
-	@(cd xsltproc ; $(MAKE) MAKEFLAGS+=--silent tests)
-	@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) MAKEFLAGS+=--silent tests ; fi)
+	@(cd tests ; $(MAKE) tests)
+	@(cd xsltproc ; $(MAKE) tests)
+	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; $(MAKE) tests ; fi)
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/autogen.sh b/autogen.sh
index 4b7cf09..f091bef 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -51,9 +51,9 @@ libtoolize --copy --force
 echo "Running aclocal..."
 aclocal $ACLOCAL_FLAGS
 echo "Running automake..."
-automake --add-missing
+automake --add-missing --warnings=all
 echo "Running autoconf..."
-autoconf
+autoconf --warnings=all
 
 cd $THEDIR
 
diff --git a/configure.in b/configure.in
index f217e24..3cf2ba5 100644
--- a/configure.in
+++ b/configure.in
@@ -1,9 +1,9 @@
 dnl Process this file with autoconf to produce a configuration script.
 AC_PREREQ(2.59)
 AC_INIT(libxslt/xslt.c)
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
 AC_CANONICAL_HOST
-AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
 
 dnl
 dnl libxslt is the main part of the package
@@ -95,11 +95,11 @@ dnl
 dnl Specific dir for HTML output ?
 dnl
 
-AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
+AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
             [path to base html directory, default $datadir/doc/html]),
             [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
 
-AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
+AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path],
             [directory used under html-dir, default $PACKAGE-$VERSION/html]),
             [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
             [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
@@ -110,7 +110,6 @@ dnl
 dnl Check the environment
 dnl
 
-AC_ISC_POSIX
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_CPP
@@ -120,10 +119,9 @@ AC_PATH_PROG(TAR, tar, /bin/tar)
 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
 
-AC_STDC_HEADERS
+AC_HEADER_STDC
 
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
+LT_INIT(win32-dll)
 
 
 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
@@ -135,7 +133,7 @@ dnl
 VERSION_SCRIPT_FLAGS=
 $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
     VERSION_SCRIPT_FLAGS=-Wl,--version-script=
-test "`uname`" == "SunOS" && \
+test "`uname`" = "SunOS" && \
     VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
 AC_SUBST(VERSION_SCRIPT_FLAGS)
 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
@@ -168,7 +166,7 @@ dnl
 dnl Check for generic locale_t declaration
 dnl
 AC_MSG_CHECKING([if xlocale program link])
-AC_LINK_IFELSE(AC_LANG_PROGRAM([[
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
@@ -213,7 +211,7 @@ typedef locale_t xsltLocale;
 
     exit(0);
     return(0);
-]]),
+]])],
   [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
   [AC_MSG_RESULT(no)]
 )
@@ -651,7 +649,6 @@ AC_SUBST(EXSLT_LIBDIR)
 AC_SUBST(EXSLT_INCLUDEDIR)
 AC_SUBST(EXSLT_LIBS)
 
-EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
 AC_SUBST(EXTRA_LIBS)
 
 AC_SUBST(M_LIBS)
@@ -660,13 +657,10 @@ dnl for the spec file
 RELDATE=`date +'%a %b %e %Y'`
 AC_SUBST(RELDATE)
 
-( cd $srcdir
-rm -f COPYING.LIB COPYING
-$LN_S Copyright COPYING
-)
+rm -f COPYING.LIB COPYING 2>/dev/null && $LN_S $srcdir/Copyright COPYING
 
 
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile
 libxslt.pc
 libexslt.pc
@@ -708,3 +702,5 @@ doc/Makefile
 xslt-config
 libxslt.spec
 ])
+
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
index ff64165..83403d2 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -22,30 +22,124 @@ APIPAGES=APIconstructors.html APIfiles.html APIfunctions.html \
 EAPIPAGES=EXSLT/APIconstructors.html EXSLT/APIfiles.html \
 	 EXSLT/APIfunctions.html EXSLT/APIsymbols.html EXSLT/APIchunk0.html
 
-EXTRA_DIST =			\
-	api.xsl			\
-	apibuild.py		\
-	EXSLT/*.html		\
-	EXSLT/html/*.html	\
-	EXSLT/html/*.png	\
-	EXSLT/libexslt-api.xml	\
-	EXSLT/libexslt-refs.xml	\
-	libxslt-api.xml		\
-	libxslt-refs.xml	\
-	symbols.xml		\
-	checkapisym.xsl		\
-	syms.xsl		\
-	libxslt.xsa		\
-	newapi.xsl		\
-	news.xsl		\
-	search.xml		\
-	site.xsl		\
-	xslt.html		\
+EXTRA_DIST =				\
+	$(PAGES)			\
+	$(EPAGES)			\
+	$(EAPIPAGES)			\
+	APIchunk0.html			\
+	APIchunk1.html			\
+	APIchunk2.html			\
+	APIchunk3.html			\
+	APIchunk4.html			\
+	APIchunk5.html			\
+	APIchunk6.html			\
+	APIchunk7.html			\
+	APIchunk8.html			\
+	APIchunk9.html			\
+	APIchunk10.html			\
+	APIchunk11.html			\
+	APIchunk12.html			\
+	APIchunk13.html			\
+	APIconstructors.html		\
+	APIfiles.html			\
+	APIfunctions.html		\
+	APIsymbols.html			\
+	EXSLT/exslt.html		\
+	EXSLT/html/book1.html		\
+	EXSLT/html/home.png		\
+	EXSLT/html/index.html		\
+	EXSLT/html/left.png		\
+	EXSLT/html/libexslt-exslt.html	\
+	EXSLT/html/libexslt-exsltexports.html \
+	EXSLT/html/libexslt-lib.html	\
+	EXSLT/html/right.png		\
+	EXSLT/html/up.png		\
+	EXSLT/libexslt-api.xml		\
+	EXSLT/libexslt-refs.xml		\
+	Libxslt-Logo-180x168.gif	\
+	Libxslt-Logo-90x34.gif		\
+	api.xsl				\
+	apibuild.py			\
+	checkapisym.xsl			\
+	contexts.gif			\
+	docbook.html			\
+	duck.png			\
+	epatents.png			\
+	extensions.html			\
+	gnome2.png			\
+	html/book1.html			\
+	html/home.png			\
+	html/index.html			\
+	html/left.png			\
+	html/libxslt-attributes.html	\
+	html/libxslt-documents.html	\
+	html/libxslt-extensions.html	\
+	html/libxslt-extra.html		\
+	html/libxslt-functions.html	\
+	html/libxslt-imports.html	\
+	html/libxslt-keys.html		\
+	html/libxslt-lib.html		\
+	html/libxslt-namespaces.html	\
+	html/libxslt-numbersInternals.html \
+	html/libxslt-pattern.html	\
+	html/libxslt-preproc.html	\
+	html/libxslt-security.html	\
+	html/libxslt-templates.html	\
+	html/libxslt-transform.html	\
+	html/libxslt-variables.html	\
+	html/libxslt-xslt.html		\
+	html/libxslt-xsltInternals.html	\
+	html/libxslt-xsltexports.html	\
+	html/libxslt-xsltlocale.html	\
+	html/libxslt-xsltutils.html	\
+	html/right.png			\
+	html/up.png			\
+	images/callouts/1.png		\
+	images/callouts/10.png		\
+	images/callouts/2.png		\
+	images/callouts/3.png		\
+	images/callouts/4.png		\
+	images/callouts/5.png		\
+	images/callouts/6.png		\
+	images/callouts/7.png		\
+	images/callouts/8.png		\
+	images/callouts/9.png		\
+	internals.html			\
+	libxslt-api.xml			\
+	libxslt-refs.xml		\
+	libxslt.xsa			\
+	newapi.xsl			\
+	news.xsl			\
+	node.gif			\
+	object.gif			\
+	processing.gif			\
+	python.html			\
+	redhat.gif			\
+	search.xml			\
+	site.xsl			\
+	smallfootonly.gif		\
+	stylesheet.gif			\
+	symbols.xml			\
+	syms.xsl			\
+	templates.gif			\
+	tutorial/libxslt_tutorial.c	\
+	tutorial/libxslttutorial.html	\
+	tutorial/libxslttutorial.xml	\
+	tutorial2/libxslt_pipes.c	\
+	tutorial2/libxslt_pipes.html	\
+	tutorial2/libxslt_pipes.xml	\
+	w3c.png				\
+	xsa.xsl				\
+	xslt.html			\
+	xsltproc.1			\
+	xsltproc.html			\
 	xsltproc.xml
 
 man_MANS = xsltproc.1
 
-all:	web ../NEWS libxslt.xsa $(man_MANS)
+xsltproc = $(top_builddir)/xsltproc/xsltproc
+
+all-local:	web ../NEWS libxslt.xsa $(man_MANS)
 
 api:	libxslt-api.xml libxslt-refs.xml $(APIPAGES) search.php \
         html/index.html $(WIN32_DIR)/libxslt.def.src
@@ -55,147 +149,180 @@ eapi:	EXSLT/libexslt-api.xml EXSLT/libexslt-refs.xml $(EAPIPAGES) \
 
 web: $(PAGES) $(EPAGES)
 
-$(PAGES): xslt.html $(srcdir)/site.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+$(PAGES): $(srcdir)/xslt.html $(srcdir)/site.xsl
+	-@(if [ -x $(xsltproc) ] ; then \
 	  echo "Rebuilding the HTML Web pages from xslt.html" ; \
-	  $(bindir)/xsltproc --nonet --html $(srcdir)/site.xsl \
-	    xslt.html > index.html ; fi )
-	-@(if [ -x $(bindir)/xmllint ] ; then \
+	  $(xsltproc) --nonet --html $(srcdir)/site.xsl \
+	    $(srcdir)/xslt.html > index.html ; fi )
+	-@(if [ -x $(XMLLINT) ] ; then \
 	  echo "Validating the HTML Web pages" ; \
-	  $(bindir)/xmllint --nonet --valid --noout $(PAGES) ; fi );
+	  $(XMLLINT) --nonet --valid --noout $(PAGES) ; fi );
 
-$(EPAGES): EXSLT/exslt.html $(srcdir)/site.xsl
+$(EPAGES): $(srcdir)/EXSLT/exslt.html $(srcdir)/site.xsl
 	 -@(if [ ! -d EXSLT/html ] ; then \
 	   mkdir -p EXSLT/html ; fi )
-	 -@(if [ -x $(bindir)/xsltproc ] ; then \
+	 -@(if [ -x $(xsltproc) ] ; then \
 	   echo "Rebuilding the HTML Web pages from exslt.html" ; \
-	   $(bindir)/xsltproc --nonet --html \
+	   $(xsltproc) --nonet --html \
 		--stringparam dirname EXSLT/ \
 		--stringparam libname libexslt \
 		--stringparam logo_base ../ \
 		$(srcdir)/site.xsl \
-		EXSLT/exslt.html > EXSLT/index.html ; fi )
-	 -@(if [ -x $(bindir)/xmllint ] ; then \
+		$(srcdir)/EXSLT/exslt.html > EXSLT/index.html ; fi )
+	 -@(if [ -x $(XMLLINT) ] ; then \
 	   echo "Validating the HTML Web pages" ; \
-	   $(bindir)/xmllint --nonet --valid --noout $(EPAGES) ; fi );
+	   $(XMLLINT) --nonet --valid --noout $(EPAGES) ; fi );
 
-../NEWS: $(srcdir)/news.xsl news.html
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
-	  $(bindir)/xsltproc --nonet $(srcdir)/news.xsl \
-	    news.html > ../NEWS ; fi );
+../NEWS: $(srcdir)/news.xsl $(srcdir)/news.html
+	-@(if [ -x $(xsltproc) ] ; then \
+	  $(xsltproc) --nonet $(srcdir)/news.xsl \
+	    $(srcdir)/news.html > ../NEWS ; fi );
 
-libxslt.xsa: $(srcdir)/xsa.xsl news.html
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
-	  $(bindir)/xsltproc --nonet $(srcdir)/xsa.xsl \
+libxslt.xsa: $(srcdir)/xsa.xsl $(srcdir)/news.html
+	-@(if [ -x $(xsltproc) ] ; then \
+	  $(xsltproc) --nonet $(srcdir)/xsa.xsl \
 	    news.html > libxslt.xsa ; fi );
 
 $(APIPAGES): libxslt-refs.xml site.xsl api.xsl $(srcdir)/site.xsl \
 	     $(srcdir)/api.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+	-@(if [ -x $(xsltproc) ] ; then \
 	  echo "Rebuilding the HTML API pages from libxslt-refs.xml" ; \
-	  $(bindir)/xsltproc --nonet --html \
+	  $(xsltproc) --nonet --html \
 			     $(srcdir)/api.xsl \
-			     xslt.html ; fi );
-	-@(if [ -x $(bindir)/xmllint ] ; then \
+			     $(srcdir)/xslt.html ; fi );
+	-@(if [ -x $(XMLLINT) ] ; then \
 	  echo "Validating the HTML API pages" ; \
-	  $(bindir)/xmllint --nonet --valid --noout API*.html; fi );
+	  $(XMLLINT) --nonet --valid --noout API*.html; fi );
 
 $(EAPIPAGES): EXSLT/libexslt-refs.xml site.xsl api.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+	-@(if [ -x $(xsltproc) ] ; then \
 	  echo "Rebuilding the HTML API pages from libexslt-refs.xml" ; \
-	  $(bindir)/xsltproc --nonet --html --output EXSLT/ \
+	  $(xsltproc) --nonet --html --output EXSLT/ \
 			     --stringparam libname libexslt \
 			     --stringparam dirname EXSLT/ \
 			     --stringparam logo_base ../ \
 			     $(srcdir)/api.xsl \
-			     EXSLT/exslt.html ; fi );
+			     $(srcdir)/EXSLT/exslt.html ; fi );
 
 html/index.html: libxslt-api.xml $(srcdir)/newapi.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+	-@(if [ -x $(xsltproc) ] ; then \
 	  echo "Rebuilding the HTML pages from the XSLT API" ; \
-	  $(bindir)/xsltproc --nonet \
-			     $(srcdir)/newapi.xsl libxslt-api.xml ; fi );
-	-@(if [ -x $(bindir)/xmllint ] ; then \
+	  $(xsltproc) --nonet \
+			     $(srcdir)/newapi.xsl $(srcdir)/libxslt-api.xml ; fi );
+	-@(if [ -x $(XMLLINT) ] ; then \
 	  echo "Validating the resulting XHTML pages" ; \
-	  $(bindir)/xmllint --nonet --valid --noout html/*.html ; fi );
+	  $(XMLLINT) --nonet --valid --noout html/*.html ; fi );
 
 wiki: libxslt-api.xml $(srcdir)/wiki.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+	-@(if [ -x $(xsltproc) ] ; then \
 		echo "Rebuilding the wiki HTML pages from the XSLT API" ; \
-		$(bindir)/xsltproc --nonet $(srcdir)/wiki.xsl libxslt-api.xml; fi )
+		$(xsltproc) --nonet $(srcdir)/wiki.xsl $(srcdir)/libxslt-api.xml; fi )
 
 EXSLT/html/index.html: EXSLT/libexslt-api.xml \
 	$(srcdir)/newapi.xsl
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
+	-@(if [ -x $(xsltproc) ] ; then \
 	  echo "Rebuilding the HTML pages from the EXSLT API" ; \
-	  $(bindir)/xsltproc --nonet --output EXSLT/ \
+	  $(xsltproc) --nonet --output EXSLT/ \
 			     --stringparam libname libexslt \
 			     --stringparam dirname EXSLT/ \
 			     --stringparam logo_base ../../ \
 			     $(srcdir)/newapi.xsl \
-			     EXSLT/libexslt-api.xml ; fi );
-	-@(if [ -x $(bindir)/xmllint ] ; then \
+			     $(srcdir)/EXSLT/libexslt-api.xml ; fi );
+	-@(if [ -x $(XMLLINT) ] ; then \
 	  echo "Validating the resulting XHTML pages" ; \
-	  $(bindir)/xmllint --nonet --valid --noout EXSLT/html/*.html ; fi );
+	  $(XMLLINT) --nonet --valid --noout EXSLT/html/*.html ; fi );
 
 
 libxslt-api.xml libxslt-refs.xml EXSLT/libexslt-api.xml \
   EXSLT/libexslt-refs.xml ../libxslt/libxslt.syms : $(srcdir)/apibuild.py $(top_srcdir)/libxslt/*.h \
 		$(top_srcdir)/libxslt/*.c $(top_srcdir)/libexslt/*.h \
 		$(top_srcdir)/libexslt/*.c
-	-($(srcdir)/apibuild.py)
-	($(XSLTPROC) checkapisym.xsl libxslt-api.xml)
-	($(XSLTPROC) -o ../libxslt/libxslt.syms syms.xsl symbols.xml)
+	-(cd $(srcdir) && ./apibuild.py)
+	($(XSLTPROC) $(srcdir)/checkapisym.xsl $(srcdir)/libxslt-api.xml)
+	($(XSLTPROC) -o ../libxslt/libxslt.syms $(srcdir)/syms.xsl $(srcdir)/symbols.xml)
 
-xsltproc.1: xsltproc.xml
-	-@(xsltproc --nonet xsltproc.xml)
+xsltproc.1: $(srcdir)/xsltproc.xml
+	-@(xsltproc --nonet $(srcdir)/xsltproc.xml)
 
 # Note that in the following, xmllint output is piped to xsltproc
 search.php: $(srcdir)/api.xsl $(srcdir)/site.xsl $(srcdir)/search.templ \
             $(srcdir)/search.xml $(srcdir)/search.php.inc
-	-@(if test -x $(bindir)/xmllint -a -x $(bindir)/xsltproc; then \
+	-@(if test -x $(XMLLINT) -a -x $(xsltproc); then \
 	   echo "Rebuilding search.php" ; \
-	   $(bindir)/xmllint --xinclude --nonet \
+	   $(XMLLINT) --xinclude --nonet \
 	                      $(srcdir)/search.xml | \
-	   $(bindir)/xsltproc --nonet - search.templ \
+	   $(xsltproc) --nonet - search.templ \
 			      > search.php ; else \
 	   echo "Unable to find xmllint or xsltproc in $(bindir)" ; fi)
 
 $(WIN32_DIR)/libxslt.def.src: libxslt-api.xml
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
-	  $(bindir)/xsltproc -o $(WIN32_DIR)/libxslt.def.src \
-	  --nonet $(WIN32_DIR)/defgen.xsl libxslt-api.xml ; fi )
+	-@(if [ -x $(xsltproc) ] ; then \
+	  $(xsltproc) -o $(WIN32_DIR)/libxslt.def.src \
+	  --nonet $(WIN32_DIR)/defgen.xsl $(srcdir)/libxslt-api.xml ; fi )
 
 $(WIN32_DIR)/libexslt.def.src: EXSLT/libexslt-api.xml
-	-@(if [ -x $(bindir)/xsltproc ] ; then \
-	  $(bindir)/xsltproc -o $(WIN32_DIR)/libexslt.def.src \
-	  --nonet $(WIN32_DIR)/defgen.xsl EXSLT/libexslt-api.xml ; fi )
+	-@(if [ -x $(xsltproc) ] ; then \
+	  $(xsltproc) -o $(WIN32_DIR)/libexslt.def.src \
+	  --nonet $(WIN32_DIR)/defgen.xsl $(srcdir)/EXSLT/libexslt-api.xml ; fi )
 
 clean-local:
-	rm -f *~ *.bak *.hierarchy *.signals *-unused.txt
+	rm -f *~ *.1 *.bak *.hierarchy *.signals *-unused.txt
 
-maintainer-clean-local: clean
+distclean-local:
+	if test ! -r Makefile.am ; then \
+		rm -f *.html *.templ *.xsa ; \
+		rm -rf EXSLT html ; \
+	fi
 
 rebuild: api eapi all
 
+wildcards =			\
+	*.1			\
+	*.gif			\
+	*.html			\
+	*.png			\
+	*.xsl			\
+	EXSLT/*.html		\
+	EXSLT/html/*.html	\
+	EXSLT/html/*.png	\
+	html/*.html		\
+	html/*.png		\
+	images/callouts/*.png	\
+	tutorial*/libxslt*
+
+# This target verifies that EXTRA_DIST contains all the files matched by
+# the above list of wildcards. Note that this will only work properly when
+# srcdir = builddir.
+#
+check-extra-dist:
+	@for a in $(wildcards) ; do \
+		if test ! -f "$$a" ; then \
+			echo "not found: $$a" ; \
+			continue ; \
+		fi ; \
+		present= ; \
+		for b in $(EXTRA_DIST) ; do \
+			test "$$a" = "$$b" && present=1 && break ; \
+		done ; \
+		test -n "$$present" || echo "not in EXTRA_DIST: $$a" ; \
+	done
+
 install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-	-@INSTALL@ -m 0644 $(srcdir)/*.html $(DESTDIR)$(HTML_DIR)
-	-@INSTALL@ -m 0644 $(srcdir)/*.gif $(DESTDIR)$(HTML_DIR)
-	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html
-	-@INSTALL@ -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(HTML_DIR)/html
-	-@INSTALL@ -m 0644 $(srcdir)/html/*.png $(DESTDIR)$(HTML_DIR)/html
-	-@INSTALL@ -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(HTML_DIR)/html
-	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/EXSLT
-	-@INSTALL@ -m 0644 $(srcdir)/EXSLT/*.html $(DESTDIR)$(HTML_DIR)/EXSLT
-	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/tutorial
-	-@INSTALL@ -m 0644 $(srcdir)/tutorial/* $(DESTDIR)$(HTML_DIR)/tutorial
-	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/tutorial2
-	-@INSTALL@ -m 0644 $(srcdir)/tutorial2/* $(DESTDIR)$(HTML_DIR)/tutorial2
-
-dist-hook:
-	(cd $(srcdir) ; tar cvf - *.1 *.html site.xsl news.xsl xsa.xsl \
-	  *.gif *.png images html/*.html html/*.png tutorial*/libxslt*) | \
-	  (cd $(distdir); tar xf -)
-
-.PHONY : html EXSLT EXSLT/html
+	$(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+	-$(INSTALL) -m 0644 $(srcdir)/*.html $(DESTDIR)$(HTML_DIR)
+	-$(INSTALL) -m 0644 $(srcdir)/*.gif $(DESTDIR)$(HTML_DIR)
+	$(MKDIR_P) $(DESTDIR)$(HTML_DIR)/html
+	-$(INSTALL) -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(HTML_DIR)/html
+	-$(INSTALL) -m 0644 $(srcdir)/html/*.png $(DESTDIR)$(HTML_DIR)/html
+	-$(INSTALL) -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(HTML_DIR)/html
+	$(MKDIR_P) $(DESTDIR)$(HTML_DIR)/EXSLT
+	-$(INSTALL) -m 0644 $(srcdir)/EXSLT/*.html $(DESTDIR)$(HTML_DIR)/EXSLT
+	$(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial
+	-$(INSTALL) -m 0644 $(srcdir)/tutorial/* $(DESTDIR)$(HTML_DIR)/tutorial
+	$(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial2
+	-$(INSTALL) -m 0644 $(srcdir)/tutorial2/* $(DESTDIR)$(HTML_DIR)/tutorial2
+
+uninstall-local:
+	rm -rf $(DESTDIR)$(HTML_DIR)
+
+.PHONY : api eapi web wiki rebuild check-extra-dist
diff --git a/doc/symbols.xml b/doc/symbols.xml
index 9e199e8..d808c0a 100644
--- a/doc/symbols.xml
+++ b/doc/symbols.xml
@@ -310,4 +310,7 @@
     <!-- lxml was using it even if not pusblished -->
     <symbol file="transform">xsltProcessOneNode</symbol>
   </release>
+  <release version="1.1.27">
+    <symbol file="xsltlocale">xsltFreeLocales</symbol>
+  </release>
 </symbols>
diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am
index d44c61c..d0a7f92 100644
--- a/libexslt/Makefile.am
+++ b/libexslt/Makefile.am
@@ -1,8 +1,8 @@
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \
-	   -I$(top_builddir) -I$(top_builddir)/libxslt \
-	   -I$(top_builddir)/libexslt $(LIBXML_CFLAGS) $(CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \
+	      -I$(top_builddir) -I$(top_builddir)/libxslt \
+	      -I$(top_builddir)/libexslt
 
-AM_CFLAGS = $(LIBGCRYPT_CFLAGS)
+AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS)
 
 lib_LTLIBRARIES = libexslt.la
 
@@ -27,7 +27,7 @@ libexslt_la_SOURCES =                   \
 	dynamic.c
 
 libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS)
-libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info @LIBEXSLT_VERSION_INFO@ $(LIBGCRYPT_LIBS)
+libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO) $(LIBGCRYPT_LIBS)
 
 man_MANS = libexslt.3
 
diff --git a/libxslt.pc.in b/libxslt.pc.in
index 07304b2..082d64c 100644
--- a/libxslt.pc.in
+++ b/libxslt.pc.in
@@ -8,5 +8,5 @@ Name: libxslt
 Version: @VERSION@
 Description: XSLT library version 2.
 Requires: libxml-2.0
-Libs: @XSLT_LIBDIR@ @XSLT_LIBS@
+Libs: @XSLT_LIBDIR@ @XSLT_LIBS@ @EXTRA_LIBS@
 Cflags: @XSLT_INCLUDEDIR@
diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am
index bead72c..8930de3 100644
--- a/libxslt/Makefile.am
+++ b/libxslt/Makefile.am
@@ -1,4 +1,6 @@
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(LIBXML_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt
+
+AM_CFLAGS = $(LIBXML_CFLAGS)
 
 lib_LTLIBRARIES = libxslt.la
 
@@ -62,7 +64,7 @@ libxslt_la_LIBADD = $(EXTRA_LIBS)
 libxslt_la_LDFLAGS =					\
 		$(WIN32_EXTRA_LDFLAGS)			\
 		$(LIBXSLT_VERSION_SCRIPT)		\
-		-version-info @LIBXSLT_VERSION_INFO@
+		-version-info $(LIBXSLT_VERSION_INFO)
 
 man_MANS = libxslt.3
 
@@ -72,4 +74,4 @@ xsltproc: all
 	@(cd ../xsltproc ; $(MAKE))
 
 install-exec-hook:
-	$(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins"
+	$(MKDIR_P) "$(DESTDIR)$(libdir)/libxslt-plugins"
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index 7a4caf0..0a341c0 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -1856,19 +1856,26 @@ xsltTimestamp(void)
 
 #else /* XSLT_WIN32_PERFORMANCE_COUNTER */
 #ifdef HAVE_CLOCK_GETTIME
+#  if defined(CLOCK_MONOTONIC)
+#    define XSLT_CLOCK CLOCK_MONOTONIC
+#  elif defined(CLOCK_HIGHRES)
+#    define XSLT_CLOCK CLOCK_HIGHRES
+#  else
+#    define XSLT_CLOCK CLOCK_REALTIME
+#  endif
     static struct timespec startup;
     struct timespec cur;
     long tics;
 
     if (calibration < 0) {
-        clock_gettime(CLOCK_MONOTONIC, &startup);
+        clock_gettime(XSLT_CLOCK, &startup);
         calibration = 0;
         calibration = xsltCalibrateTimestamps();
-        clock_gettime(CLOCK_MONOTONIC, &startup);
+        clock_gettime(XSLT_CLOCK, &startup);
         return (0);
     }
 
-    clock_gettime(CLOCK_MONOTONIC, &cur);
+    clock_gettime(XSLT_CLOCK, &cur);
     tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
     tics += (cur.tv_nsec - startup.tv_nsec) /
                           (1000000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
diff --git a/python/Makefile.am b/python/Makefile.am
index fd3ef28..48a6c6e 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -3,13 +3,14 @@ AUTOMAKE_OPTIONS = 1.4 foreign
 
 SUBDIRS= . tests
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(PYTHON_INCLUDES) \
-	 $(LIBXML_CFLAGS) \
 	-I$(top_srcdir)/libxslt \
 	-I$(top_srcdir) \
 	-I../libexslt
 
+AM_CFLAGS = $(LIBXML_CFLAGS)
+
 DOCS_DIR = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
 # libxsltclass.txt is generated
 DOCS = TODO
@@ -35,38 +36,42 @@ all-local: libxslt.py
 
 python_LTLIBRARIES = libxsltmod.la
 
-libxsltmod_la_SOURCES = libxslt.c types.c libxslt-py.c
-libxsltmod_la_LIBADD = $(mylibs) @PYTHON_LIBS@
+libxsltmod_la_SOURCES = libxslt.c types.c
+nodist_libxsltmod_la_SOURCES = libxslt-py.c
+libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
 
-libxslt.py: $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py
-	cat $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py > libxslt.py
+libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
+	cat $(srcdir)/libxsl.py libxsltclass.py > $@
 
 install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(pythondir)
-	@INSTALL@ -m 0644 libxslt.py $(DESTDIR)$(pythondir)
-	$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
+	$(MKDIR_P) $(DESTDIR)$(pythondir)
+	$(INSTALL) -m 0644 libxslt.py $(DESTDIR)$(pythondir)
+	$(MKDIR_P) $(DESTDIR)$(DOCS_DIR)
 	@(for doc in $(DOCS) ; \
-	   do @INSTALL@ -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
+	   do $(INSTALL) -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
+
+uninstall-local:
+	rm -f $(DESTDIR)$(pythondir)/libxslt.py
+	rm -rf $(DESTDIR)$(DOCS_DIR)
 
 GENERATE = generator.py
 API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml
-GENERATED= $(srcdir)/libxsltclass.py \
-           $(srcdir)/libxslt-export.c \
-	   $(srcdir)/libxslt-py.c \
-	   $(srcdir)/libxslt-py.h \
-	   $(srcdir)/libxsltclass.txt
+GENERATED= libxsltclass.py \
+	   libxslt-export.c \
+	   libxslt-py.c \
+	   libxslt-py.h \
+	   libxsltclass.txt
 
 $(GENERATED): gen_prog
 
 gen_prog:  $(srcdir)/$(GENERATE) $(API_DESC)
-	cd $(srcdir) && $(PYTHON) $(GENERATE)
+	SRCDIR=$(srcdir) $(PYTHON) $(srcdir)/$(GENERATE)
 	touch gen_prog
 
 $(libxsltmod_la_OBJECTS): $(GENERATED)
 
-else
-all: 
 endif
+
 tests test: all
 	cd tests && $(MAKE) tests
 
diff --git a/python/generator.py b/python/generator.py
index 797528f..c13c877 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -18,6 +18,7 @@ import os
 import xml.sax
 
 debug = 0
+srcdir = os.getenv("SRCDIR", ".")
 
 def getparser():
     # Attach parser to an unmarshalling object. return both objects.
@@ -392,14 +393,14 @@ def buildStubs():
     global unknown_types
 
     try:
-        f = open("libxslt-api.xml")
+        f = open("%s/libxslt-api.xml" % srcdir)
         data = f.read()
         (parser, target)  = getparser()
         parser.feed(data)
         parser.close()
     except IOError, msg:
         try:
-            f = open("../doc/libxslt-api.xml")
+            f = open("%s/../doc/libxslt-api.xml" % srcdir)
             data = f.read()
             (parser, target)  = getparser()
             parser.feed(data)
@@ -413,7 +414,7 @@ def buildStubs():
     py_types['pythonObject'] = ('O', "pythonObject", "pythonObject",
                                 "pythonObject", "libxml_")
     try:
-        f = open("libxslt-python-api.xml")
+        f = open("%s/libxslt-python-api.xml" % srcdir)
         data = f.read()
         (parser, target)  = getparser()
         parser.feed(data)
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 2458688..f757774 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -15,6 +15,8 @@ EXTRAS=		\
 
 EXTRA_DIST = $(TESTSPY) $(XMLS) $(EXTRAS)
 
+CLEANFILES = *.pyc core
+
 if WITH_PYTHON
 tests: $(TESTSPY)
 	-@(PYTHONPATH="`pwd`/..:`pwd`/../.libs:$(srcdir)/.."; \
@@ -25,11 +27,8 @@ else
 tests:
 endif
 
-clean:
-	rm -f *.pyc core
-
 install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
+	$(MKDIR_P) $(DESTDIR)$(EXAMPLE_DIR)
 	-(for test in $(TESTSPY) $(XMLS) $(EXTRAS); \
-	  do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
+	  do $(INSTALL) -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
 
diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am
index 0e299d2..6f89310 100644
--- a/tests/REC/Makefile.am
+++ b/tests/REC/Makefile.am
@@ -77,10 +77,10 @@ EXTRA_DIST = 						\
     test-9.2-1.xsl					\
     stand-2.7-1.dtd stand-2.7-1.stand.out stand-2.7-1.xsl \
     stand-2.7-1.out stand-2.7-1.xml			\
-    stand-2.7-2.xml stand-2.7-3.xml
+    stand-2.7-2.stand.out stand-2.7-2.xml stand-2.7-3.xml \
+    stand-2.7-3.stand.out
 
-
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/REC1/Makefile.am b/tests/REC1/Makefile.am
index 3b00f0b..0688daa 100644
--- a/tests/REC1/Makefile.am
+++ b/tests/REC1/Makefile.am
@@ -5,7 +5,7 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = doc.xsl doc.xml doc.dtd result.xml
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/REC2/Makefile.am b/tests/REC2/Makefile.am
index 06c679b..72e9af1 100644
--- a/tests/REC2/Makefile.am
+++ b/tests/REC2/Makefile.am
@@ -5,7 +5,7 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = data.xml vrml.xsl vrml.xml svg.xsl svg.xml	html.xsl html.xml
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/XSLTMark/Makefile.am b/tests/XSLTMark/Makefile.am
index 5f68d02..eb64cb4 100644
--- a/tests/XSLTMark/Makefile.am
+++ b/tests/XSLTMark/Makefile.am
@@ -1,5 +1,4 @@
 ## Process this file with automake to produce Makefile.in
-%.out : %
 
 EXTRA_DIST = \
   dbgen.pl \
@@ -53,22 +52,23 @@ ALL_TESTS=	alphabetize attsets avts axis backwards bottles breadth brutal chart
   priority products queens reverser stringsort summarize total tower trend \
   union xpath xslbench1 xslbench2 xslbench3
 
+dummy $(ALL_TESTS:=.out):
+	$(MAKE) $(@:.out=)
 
-$(top_builddir)/xsltproc/xsltproc:
-	@(cd ../../xsltproc ; $(MAKE) xsltproc)
+xsltproc = $(top_builddir)/xsltproc/xsltproc
 
-all:
+$(xsltproc):
+	cd ../../xsltproc && $(MAKE) xsltproc
 
 test tests:
 	@echo '## Running XSLTMark tests'
-	@for i in $(ALL_TESTS); do $(MAKE) $$i; done
+	@$(MAKE) $(ALL_TESTS)
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
 	$(MAKE) CHECKER='valgrind -q' tests
 
-clean:
-	rm -f *.tmp *~ core db100.xml db1000.xml db10000.xml
+CLEANFILES = *.tmp *~ .memdump core db100.xml db1000.xml db10000.xml
 
 
 if WITH_PERL
@@ -81,9 +81,9 @@ db1000.xml: $(srcdir)/dbgen.pl
 db10000.xml: $(srcdir)/dbgen.pl
 	$(PERL) $(srcdir)/dbgen.pl 10000 > db10000.xml
 
-alphabetize:	db100.xml
+alphabetize:	db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -97,9 +97,9 @@ alphabetize:	db100.xml
 	fi
 	@rm -f $@.tmp
 
-avts:			db100.xml
+avts:			db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -113,9 +113,9 @@ avts:			db100.xml
 	fi
 	@rm -f $@.tmp
 
-creation:		db100.xml
+creation:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -129,9 +129,9 @@ creation:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-dbonerow:		db10000.xml
+dbonerow:		db10000.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -145,9 +145,9 @@ dbonerow:		db10000.xml
 	fi
 	@rm -f $@.tmp
 
-dbtail:		db100.xml
+dbtail:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -161,9 +161,9 @@ dbtail:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-decoy:		db100.xml
+decoy:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -177,9 +177,9 @@ decoy:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-encrypt:		db100.xml
+encrypt:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -193,9 +193,9 @@ encrypt:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-functions:		db100.xml
+functions:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -209,9 +209,9 @@ functions:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-identity:		db1000.xml
+identity:		db1000.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -225,9 +225,9 @@ identity:		db1000.xml
 	fi
 	@rm -f $@.tmp
 
-patterns:		db100.xml
+patterns:		db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -241,9 +241,9 @@ patterns:		db100.xml
 	fi
 	@rm -f $@.tmp
 
-prettyprint:	db100.xml
+prettyprint:	db100.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -257,9 +257,9 @@ prettyprint:	db100.xml
 	fi
 	@rm -f $@.tmp
 
-stringsort:		db1000.xml
+stringsort:		db1000.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -289,9 +289,9 @@ stringsort:
 
 endif
 
-attsets:		chart.xml
+attsets:		chart.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -305,9 +305,9 @@ attsets:		chart.xml
 	fi
 	@rm -f $@.tmp
 
-axis:			axis.xml
+axis:			axis.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -321,9 +321,9 @@ axis:			axis.xml
 	fi
 	@rm -f $@.tmp
 
-backwards:		game.xml
+backwards:		game.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -337,9 +337,9 @@ backwards:		game.xml
 	fi
 	@rm -f $@.tmp
 
-bottles:		bottles.xml
+bottles:		bottles.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -353,9 +353,9 @@ bottles:		bottles.xml
 	fi
 	@rm -f $@.tmp
 
-brutal:		brutal.xml
+brutal:		brutal.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -369,9 +369,9 @@ brutal:		brutal.xml
 	fi
 	@rm -f $@.tmp
 
-chart:		chart.xml
+chart:		chart.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -385,9 +385,9 @@ chart:		chart.xml
 	fi
 	@rm -f $@.tmp
 
-current:		current.xml
+current:		current.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -401,9 +401,9 @@ current:		current.xml
 	fi
 	@rm -f $@.tmp
 
-game:			game.xml
+game:			game.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -417,9 +417,9 @@ game:			game.xml
 	fi
 	@rm -f $@.tmp
 
-html:			html.xml
+html:			html.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -433,9 +433,9 @@ html:			html.xml
 	fi
 	@rm -f $@.tmp
 
-inventory:		inventory.xml
+inventory:		inventory.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -449,9 +449,9 @@ inventory:		inventory.xml
 	fi
 	@rm -f $@.tmp
 
-metric:		metric.xml
+metric:		metric.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -465,9 +465,9 @@ metric:		metric.xml
 	fi
 	@rm -f $@.tmp
 
-number:		number.xml
+number:		number.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -481,9 +481,9 @@ number:		number.xml
 	fi
 	@rm -f $@.tmp
 
-oddtemplate:	oddtemplate.xml
+oddtemplate:	oddtemplate.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -497,9 +497,9 @@ oddtemplate:	oddtemplate.xml
 	fi
 	@rm -f $@.tmp
 
-priority:		priority.xml
+priority:		priority.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -513,9 +513,9 @@ priority:		priority.xml
 	fi
 	@rm -f $@.tmp
 
-products:		products.xml
+products:		products.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -529,9 +529,9 @@ products:		products.xml
 	fi
 	@rm -f $@.tmp
 
-queens:		queens.xml
+queens:		queens.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -545,9 +545,9 @@ queens:		queens.xml
 	fi
 	@rm -f $@.tmp
 
-reverser:		gettysburg.xml
+reverser:		gettysburg.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -561,9 +561,9 @@ reverser:		gettysburg.xml
 	fi
 	@rm -f $@.tmp
 
-summarize:		queens.xsl
+summarize:		queens.xsl $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -577,9 +577,9 @@ summarize:		queens.xsl
 	fi
 	@rm -f $@.tmp
 
-total:		chart.xml
+total:		chart.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -593,9 +593,9 @@ total:		chart.xml
 	fi
 	@rm -f $@.tmp
 
-tower:		tower.xml
+tower:		tower.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -609,9 +609,9 @@ tower:		tower.xml
 	fi
 	@rm -f $@.tmp
 
-trend:		trend.xml
+trend:		trend.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -625,9 +625,9 @@ trend:		trend.xml
 	fi
 	@rm -f $@.tmp
 
-union:		union.xml
+union:		union.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -641,9 +641,9 @@ union:		union.xml
 	fi
 	@rm -f $@.tmp
 
-xpath:		xpath.xml
+xpath:		xpath.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -657,9 +657,9 @@ xpath:		xpath.xml
 	fi
 	@rm -f $@.tmp
 
-xslbench1:		xslbench1.xml
+xslbench1:		xslbench1.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -673,9 +673,9 @@ xslbench1:		xslbench1.xml
 	fi
 	@rm -f $@.tmp
 
-xslbench2:		xslbenchdream.xml
+xslbench2:		xslbenchdream.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -689,9 +689,9 @@ xslbench2:		xslbenchdream.xml
 	fi
 	@rm -f $@.tmp
 
-xslbench3:		xslbenchdream.xml
+xslbench3:		xslbenchdream.xml $(xsltproc)
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/$@.xsl $< > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -705,9 +705,10 @@ xslbench3:		xslbenchdream.xml
 	fi
 	@rm -f $@.tmp
 
-breadth:		
+breadth: $(xsltproc)
+	@test -f breadth.xml || $(LN_S) $(srcdir)/breadth.xml .
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/find.xsl $@.xml > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -721,9 +722,10 @@ breadth:
 	fi
 	@rm -f $@.tmp
 
-depth:		
+depth: $(xsltproc)
+	@test -f depth.xml || $(LN_S) $(srcdir)/depth.xml .
 	@(echo > .memdump)
-	@log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+	@log=`$(CHECKER) $(xsltproc) \
 		$(srcdir)/find.xsl $@.xml > $@.tmp; \
 	  if [ ! -f $(srcdir)/$@.out ] ; then \
 		cp $@.tmp $(srcdir)/$@.out ; \
@@ -737,4 +739,4 @@ depth:
 	fi
 	@rm -f $@.tmp
 
-
+.PHONY: test tests valgrind $(ALL_TESTS)
diff --git a/tests/docbook/Makefile.am b/tests/docbook/Makefile.am
index a785a0d..9ae0145 100644
--- a/tests/docbook/Makefile.am
+++ b/tests/docbook/Makefile.am
@@ -1,9 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
-all:
-
 tests:
-	@echo -n '## Running docbook tests: '
+	@echo '## Running docbook tests'
 	$(MAKE) single
 	$(MAKE) xtchunk
 
@@ -16,26 +14,31 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = README VERSION
 
+CLEANFILES = .memdump
+
 full: tests htmltests xhtmltests fotests
 
 #
 # a single tests to check that stuff ain't broken
 #
 single:
+	@$(MKDIR_P) result/html
+	@$(MKDIR_P) result/fo
+	@$(MKDIR_P) result/xhtml
 	@(echo > .memdump)
 	@(for i in $(srcdir)/test/gdp-handbook.xml ; do \
-	  echo -n "$(basename $$i) : html " ; \
-	  out=$(srcdir)/result/html/`basename $$i .xml`.tst; \
-	  html=$(srcdir)/result/html/`basename $$i .xml`.html; \
+	  echo -n "`basename $$i` : html " ; \
+	  out=result/html/`basename $$i .xml`.tst; \
+	  html=result/html/`basename $$i .xml`.html; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
 		$(srcdir)/html/docbook.xsl $$i > $$out ; \
-	    if [ -f $$html ] ; then \
-	  	grep -v id < $$html > $$html.noid ; \
+	    if [ -f $(srcdir)/$$html ] ; then \
+	  	grep -v id < $(srcdir)/$$html > $$html.noid ; \
 		grep -v id < $$out > $$out.noid ; \
 		diff $$html.noid $$out.noid ; \
 		rm -f $$html.noid $$out.noid ; \
 	    else \
-		mv $$out $$html ; \
+		mv $$out $(srcdir)/$$html ; \
 	    fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
 	  if [ -n "$$log" ] ; then \
@@ -45,18 +48,18 @@ single:
 	  fi ; \
 	  rm -f $$out ; \
 	  echo -n "fo " ; \
-	  out=$(srcdir)/result/fo/`basename $$i .xml`.tst; \
-	  fo=$(srcdir)/result/fo/`basename $$i .xml`.fo; \
-	  msg=$(srcdir)/result/fo/`basename $$i .xml`.msg; \
+	  out=result/fo/`basename $$i .xml`.tst; \
+	  fo=result/fo/`basename $$i .xml`.fo; \
+	  msg=result/fo/`basename $$i .xml`.msg; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
 		$(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \
-	  if [ -f $$fo ] ; then \
-	      grep -v id < $$fo > $$fo.noid ; \
+	  if [ -f $(srcdir)/$$fo ] ; then \
+	      grep -v id < $(srcdir)/$$fo > $$fo.noid ; \
 	      grep -v id < $$out > $$out.noid ; \
 	      diff $$fo.noid $$out.noid ; \
 	      rm -f $$fo.noid $$out.noid ; \
 	  else \
-		mv $$out $$fo ; \
+		mv $$out $(srcdir)/$$fo ; \
 	  fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
 	  if [ -n "$$log" ] ; then \
@@ -66,17 +69,17 @@ single:
 	  fi ; \
 	  rm -f $$out $$msg ; \
 	  echo -n "xhtml " ; \
-	  out=$(srcdir)/result/xhtml/`basename $$i .xml`.tst; \
-	  xhtml=$(srcdir)/result/xhtml/`basename $$i .xml`.xhtml; \
+	  out=result/xhtml/`basename $$i .xml`.tst; \
+	  xhtml=result/xhtml/`basename $$i .xml`.xhtml; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
 		$(srcdir)/xhtml/docbook.xsl $$i > $$out ; \
-	  if [ -f $$xhtml ] ; then \
-	      grep -v id < $$xhtml > $$xhtml.noid ; \
+	  if [ -f $(srcdir)/$$xhtml ] ; then \
+	      grep -v id < $(srcdir)/$$xhtml > $$xhtml.noid ; \
 	      grep -v id < $$out > $$out.noid ; \
 	      diff $$xhtml.noid $$out.noid ; \
 	      rm -f $$xhtml.noid $$out.noid ; \
 	  else \
-		mv $$out $$xhtml ; \
+		mv $$out $(srcdir)/$$xhtml ; \
 	  fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
 	  if [ -n "$$log" ] ; then \
@@ -86,15 +89,18 @@ single:
 	  fi ; \
 	  rm -f $$out ; \
 	  done )
+	@echo
 
 xtchunk:
+	@$(MKDIR_P) result/html
+	@$(MKDIR_P) result/xtchunk
 	@(echo > .memdump)
 	@echo -n html-chunking
 	@(for i in $(srcdir)/test/gdp-handbook.xml ; do \
 	  base=`basename $$i .xml` ; \
-	  html=$(srcdir)/result/html/$$base.html; \
+	  html=result/html/$$base.html; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
-		-o $(srcdir)/result/xtchunk/html/gdp-handbook \
+		-o result/xtchunk/html/gdp-handbook \
 		$(srcdir)/html/xtchunk.xsl $$i 2> $$base.err ; \
 	    if [ -f $(srcdir)/result/html/$$base.err ] ; then \
 		diff $(srcdir)/result/html/$$base.err $$base.err ; \
@@ -102,15 +108,15 @@ xtchunk:
 	    else \
 		mv $$base.err $(srcdir)/result/html/$$base.err ; \
 	    fi ; \
-	    for html in $(srcdir)/result/xtchunk/html/*.html ; do \
-	      orig=$(srcdir)/result/xtchunk/html/\`basename $$html .html\`.orig ;\
-	      if [ -f $$orig ] ; then \
+	    for html in result/xtchunk/html/*.html ; do \
+	      orig=result/xtchunk/html/\`basename $$html .html\`.orig ;\
+	      if [ -f $(srcdir)/$$orig ] ; then \
 		  grep -v id < $$html > $$html.noid ; \
-		  grep -v id < $$orig > $$orig.noid ; \
+		  grep -v id < $(srcdir)/$$orig > $$orig.noid ; \
 		  diff $$orig.noid $$html.noid ; \
 		  rm -f $$html.noid $$orig.noid $$html; \
 	      else \
-		  mv $$html $$orig ; \
+		  mv $$html $(srcdir)/$$orig ; \
 		fi ; \
 	    done ; \
 	    grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
@@ -119,7 +125,7 @@ xtchunk:
 	  	echo result ; \
 		echo $$log ; \
 	  fi ; \
-	  rm -f $(srcdir)/result/xtchunk/html/gdp-handbook ; \
+	  rm -f result/xtchunk/html/gdp-handbook ; \
 	  done )
 	@echo
 
@@ -127,61 +133,64 @@ xtchunk:
 # The full set of tests
 #
 htmltests: $(top_builddir)/xsltproc/xsltproc
+	@$(MKDIR_P) result/html
 	@(echo > .memdump)
 	@echo "##"
 	@echo "## HTML stylesheets regression tests"
 	@echo "##"
 	@(for i in $(srcdir)/test/*.xml ; do \
 	  echo $$i ; \
-	  out=$(srcdir)/result/html/`basename $$i .xml`.tst; \
-	  html=$(srcdir)/result/html/`basename $$i .xml`.html; \
+	  out=result/html/`basename $$i .xml`.tst; \
+	  html=result/html/`basename $$i .xml`.html; \
 	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \
-	  if [ -f $$html ] ; then \
-	      grep -v id < $$html > $$html.noid ; \
+	  if [ -f $(srcdir)/$$html ] ; then \
+	      grep -v id < $(srcdir)/$$html > $$html.noid ; \
 	      grep -v id < $$out > $$out.noid ; \
 	      diff $$html.noid $$out.noid ; \
 	      rm -f $$html.noid $$out.noid ; \
-	  else mv $$out $$html ; fi ; \
+	  else mv $$out $(srcdir)/$$html ; fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
 	  rm -f $$out ; done )
 
 fotests: $(top_builddir)/xsltproc/xsltproc
+	@$(MKDIR_P) result/fo
 	@(echo > .memdump)
 	@echo "##"
 	@echo "## XSL FO stylesheets regression tests"
 	@echo "##"
 	@(for i in $(srcdir)/test/*.xml ; do \
 	  echo $$i ; \
-	  out=$(srcdir)/result/fo/`basename $$i .xml`.tst; \
-	  fo=$(srcdir)/result/fo/`basename $$i .xml`.fo; \
-	  msg=$(srcdir)/result/fo/`basename $$i .xml`.msg; \
+	  out=result/fo/`basename $$i .xml`.tst; \
+	  fo=result/fo/`basename $$i .xml`.fo; \
+	  msg=result/fo/`basename $$i .xml`.msg; \
 	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out  2> $$msg ; \
-	  if [ -f $$fo ] ; then \
-	      grep -v id < $$fo > $$fo.noid ; \
+	  if [ -f $(srcdir)/$$fo ] ; then \
+	      grep -v id < $(srcdir)/$$fo > $$fo.noid ; \
 	      grep -v id < $$out > $$out.noid ; \
 	      diff $$fo.noid $$out.noid ; \
 	      rm -f $$fo.noid $$out.noid ; \
-	  else mv $$out $$fo ; fi ; \
+	  else mv $$out $(srcdir)/$$fo ; fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
 	  rm -f $$out $$msg ; \
 	  done )
 
 xhtmltests: $(top_builddir)/xsltproc/xsltproc
+	@$(MKDIR_P) result/xhtml
 	@(echo > .memdump)
 	@echo "##"
 	@echo "## XHTML stylesheets regression tests"
 	@echo "##"
 	@(for i in $(srcdir)/test/*.xml ; do \
 	  echo $$i ; \
-	  out=$(srcdir)/result/xhtml/`basename $$i .xml`.tst; \
-	  xhtml=$(srcdir)/result/xhtml/`basename $$i .xml`.xhtml; \
+	  out=result/xhtml/`basename $$i .xml`.tst; \
+	  xhtml=result/xhtml/`basename $$i .xml`.xhtml; \
 	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \
-	  if [ -f $$xhtml ] ; then \
-	      grep -v id < $$xhtml > $$xhtml.noid ; \
+	  if [ -f $(srcdir)/$$xhtml ] ; then \
+	      grep -v id < $(srcdir)/$$xhtml > $$xhtml.noid ; \
 	      grep -v id < $$out > $$out.noid ; \
 	      diff $$xhtml.noid $$out.noid ; \
 	      rm -f $$xhtml.noid $$out.noid ; \
-	  else mv $$out $$xhtml ; fi ; \
+	  else mv $$out $(srcdir)/$$xhtml ; fi ; \
 	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
 	  rm -f $$out ; done )
 
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index 4393739..9e2204f 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -172,6 +172,4 @@ EXTRA_DIST =	\
 	array.xml \
 	items.xml
 
-all:
-
 tests:
diff --git a/tests/documents/Makefile.am b/tests/documents/Makefile.am
index 88a9c73..6cd98a0 100644
--- a/tests/documents/Makefile.am
+++ b/tests/documents/Makefile.am
@@ -10,8 +10,7 @@ EXTRA_DIST = \
     result.xhtml system.xml test_bad.err test_bad.result \
     test_bad.xml test.result test.xml test.xsl worklog.xml
 
-
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/Makefile.am b/tests/exslt/Makefile.am
index bbfc7e3..800701b 100644
--- a/tests/exslt/Makefile.am
+++ b/tests/exslt/Makefile.am
@@ -2,8 +2,6 @@
 
 SUBDIRS=common functions math sets strings dynamic date
 
-all:
-
 test tests:
 	@(cur=`pwd` ; for dir in $(SUBDIRS) ; do cd $$dir ; $(MAKE) CHECKER='$(CHECKER)' tests ; cd $$cur ; done)
 
diff --git a/tests/exslt/common/Makefile.am b/tests/exslt/common/Makefile.am
index 176ec77..cde7a44 100644
--- a/tests/exslt/common/Makefile.am
+++ b/tests/exslt/common/Makefile.am
@@ -16,7 +16,7 @@ EXTRA_DIST = 						\
 	import-test1a.imp import-test1b.imp import-test1.out \
 	import-test1.xml import-test1.xsl
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/date/Makefile.am b/tests/exslt/date/Makefile.am
index 52e2308..7e0e22b 100644
--- a/tests/exslt/date/Makefile.am
+++ b/tests/exslt/date/Makefile.am
@@ -34,7 +34,7 @@ EXTRA_DIST = 						\
 	seconds.1.out	seconds.1.xml	seconds.1.xsl	\
 	seconds.2.out	seconds.2.xml	seconds.2.xsl
 
-all:
+CLEANFILES = .memdump
 
 test-current:
 	@(echo > .memdump)
diff --git a/tests/exslt/dynamic/Makefile.am b/tests/exslt/dynamic/Makefile.am
index 3cf8263..bcc7eb3 100644
--- a/tests/exslt/dynamic/Makefile.am
+++ b/tests/exslt/dynamic/Makefile.am
@@ -6,7 +6,7 @@ $(top_builddir)/xsltproc/xsltproc:
 EXTRA_DIST = 							\
   dynmap.out     dynmap.xml     dynmap.xsl
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/functions/Makefile.am b/tests/exslt/functions/Makefile.am
index 88e8c8d..3248106 100644
--- a/tests/exslt/functions/Makefile.am
+++ b/tests/exslt/functions/Makefile.am
@@ -15,7 +15,7 @@ EXTRA_DIST = 						\
 	function.9.out  function.9.xml  function.9.xsl  \
 	function.10.out function.10.xml function.10.xsl
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/math/Makefile.am b/tests/exslt/math/Makefile.am
index 117901c..a4785d7 100644
--- a/tests/exslt/math/Makefile.am
+++ b/tests/exslt/math/Makefile.am
@@ -17,7 +17,7 @@ EXTRA_DIST = 						\
 	min.1.out      min.1.xml      min.1.xsl		\
 	min.2.out      min.2.xml      min.2.xsl
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/sets/Makefile.am b/tests/exslt/sets/Makefile.am
index 3eaac3c..634acb4 100644
--- a/tests/exslt/sets/Makefile.am
+++ b/tests/exslt/sets/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST = 							\
   leading.1.out        leading.1.xml        leading.1.xsl	\
   trailing.1.out       trailing.1.xml       trailing.1.xsl
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/exslt/strings/Makefile.am b/tests/exslt/strings/Makefile.am
index 5bdbd2a..0645b6d 100644
--- a/tests/exslt/strings/Makefile.am
+++ b/tests/exslt/strings/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST = 						\
 	split.1.xml split.1.xsl split.1.out \
 	replace.1.xml replace.1.xsl replace.1.out 
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/extensions/Makefile.am b/tests/extensions/Makefile.am
index 31cfe67..4cf132d 100644
--- a/tests/extensions/Makefile.am
+++ b/tests/extensions/Makefile.am
@@ -7,8 +7,7 @@ EXTRA_DIST = \
     module.xml module.xsl module.out \
     list.xml list.xsl list.out
 
-
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 72d649b..b6c738b 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -185,8 +185,7 @@ EXTRA_DIST = \
     itemschoose.out itemschoose.xsl \
     inner.xsl date_add.xsl
 
-
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/keys/Makefile.am b/tests/keys/Makefile.am
index 2666a70..08e645d 100644
--- a/tests/keys/Makefile.am
+++ b/tests/keys/Makefile.am
@@ -5,7 +5,7 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = dates.xml month.xml month.xsl month.out
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/multiple/Makefile.am b/tests/multiple/Makefile.am
index d2e4abc..ceaaa76 100644
--- a/tests/multiple/Makefile.am
+++ b/tests/multiple/Makefile.am
@@ -28,7 +28,7 @@ GENERATED = \
 	out/letterw.html out/letterx.html out/lettery.html out/letterz.html \
 	out/titlepage.html
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/namespaces/Makefile.am b/tests/namespaces/Makefile.am
index edc9b2f..72f976e 100644
--- a/tests/namespaces/Makefile.am
+++ b/tests/namespaces/Makefile.am
@@ -16,7 +16,7 @@ EXTRA_DIST = \
     tst8.xml tst8.xsl tst8.out \
     tst9.xml tst9.xsl tst9.out
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/numbers/Makefile.am b/tests/numbers/Makefile.am
index b03e723..2ca6eba 100644
--- a/tests/numbers/Makefile.am
+++ b/tests/numbers/Makefile.am
@@ -5,7 +5,7 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = format-number.xsl format-number.xml format-number.out
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/plugins/Makefile.am b/tests/plugins/Makefile.am
index b008f62..e0736ab 100644
--- a/tests/plugins/Makefile.am
+++ b/tests/plugins/Makefile.am
@@ -5,28 +5,28 @@ $(top_builddir)/xsltproc/xsltproc:
 
 EXTRA_DIST = plugin.out	plugin.xml plugin.xsl
 
-INCLUDES = -I$(top_srcdir) -I../../libxslt $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir) -I../../libxslt
 
-EXTRA_LTLIBRARIES = xmlsoft_org_xslt_testplugin.la
+CLEANFILES = *.res
+
+if WITH_MODULES
+
+noinst_LTLIBRARIES = xmlsoft_org_xslt_testplugin.la
 
 # our rpath is a rather unorthodox location as we 
 # don't want to pollute $(DESTDIR) with the test plugin
 
-plugindir=$(shell pwd)/.libs/
+plugindir = $(abs_builddir)/.libs
 
 xmlsoft_org_xslt_testplugin_la_CFLAGS = -DMODULE_COMPILE $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 xmlsoft_org_xslt_testplugin_la_SOURCES = testplugin.c
 xmlsoft_org_xslt_testplugin_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS)
 xmlsoft_org_xslt_testplugin_la_LDFLAGS = -module -avoid-version -rpath $(plugindir)
 
-all:
-
-if WITH_MODULES
-
 test-logall:
 	@echo '## Running plugin tests'
 
-test tests: $(top_builddir)/xsltproc/xsltproc test-logall $(EXTRA_LTLIBRARIES)
+test tests: $(top_builddir)/xsltproc/xsltproc test-logall $(noinst_LTLIBRARIES)
 	@LD_LIBRARY_PATH=$(plugindir):$(top_builddir)/libxslt/.libs:$(LD_LIBRARY_PATH) \
 	 LIBXSLT_PLUGINS_PATH=$(plugindir) \
 	 $(top_builddir)/xsltproc/xsltproc plugin.xsl plugin.xml > plugin.res
diff --git a/tests/reports/Makefile.am b/tests/reports/Makefile.am
index 14bb655..bd08d24 100644
--- a/tests/reports/Makefile.am
+++ b/tests/reports/Makefile.am
@@ -11,8 +11,7 @@ EXTRA_DIST = \
 	recglobparam.xsl recglobvar.xsl reclocparam.xsl reclocvar.xsl \
 	recglobparam.xml recglobvar.xml reclocparam.xml reclocvar.xml 
 
-
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/xinclude/Makefile.am b/tests/xinclude/Makefile.am
index 60009df..8d408de 100644
--- a/tests/xinclude/Makefile.am
+++ b/tests/xinclude/Makefile.am
@@ -11,7 +11,7 @@ EXTRA_DIST =		\
 	normal.out	\
 	xinclude.out
 
-all:
+CLEANFILES = .memdump
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/tests/xmlspec/Makefile.am b/tests/xmlspec/Makefile.am
index babe870..ff55d82 100644
--- a/tests/xmlspec/Makefile.am
+++ b/tests/xmlspec/Makefile.am
@@ -7,7 +7,7 @@ EXTRA_DIST = REC-xml-20001006.xml xmlspec-v21.dtd W3C-REC.css \
              logo-REC xmlspec.xsl REC-xml-2e.xsl diffspec.xsl \
 	     REC-xml-20001006.html REC-xml-20001006-review.html
 
-all:
+CLEANFILES = .memdump debug
 
 valgrind:
 	@echo '## Running the regression tests under Valgrind'
diff --git a/xslt-config.in b/xslt-config.in
index a1e1fb5..45c3e28 100644
--- a/xslt-config.in
+++ b/xslt-config.in
@@ -89,7 +89,7 @@ while test $# -gt 0; do
     shift
 done
 
-the_libs="@XSLT_LIBDIR@ @XSLT_LIBS@"
+the_libs="@XSLT_LIBDIR@ @XSLT_LIBS@ @EXTRA_LIBS@"
 if test "$includedir" != "/usr/include"; then
     the_flags="$the_flags -I$includedir `@XML_CONFIG@ --cflags`"
 else
diff --git a/xsltproc/Makefile.am b/xsltproc/Makefile.am
index 21d5cea..46a5e93 100644
--- a/xsltproc/Makefile.am
+++ b/xsltproc/Makefile.am
@@ -1,13 +1,13 @@
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \
-           -I$(top_builddir) -I$(top_builddir)/libxslt \
-	   -I$(top_builddir)/libexslt $(LIBXML_CFLAGS) $(CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \
+	      -I$(top_builddir) -I$(top_builddir)/libxslt \
+	      -I$(top_builddir)/libexslt
 
 EXTRA_PROGRAMS=
 bin_PROGRAMS = xsltproc $(XSLTPROCDV)
 
 noinst_PROGRAMS=testThreads
 
-AM_CFLAGS = $(LIBGCRYPT_CFLAGS)
+AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS)
 
 xsltproc_SOURCES = xsltproc.c
 xsltproc_LDFLAGS = 
@@ -23,13 +23,22 @@ DEPS = $(top_builddir)/libxslt/libxslt.la \
 
 LDADDS = $(top_builddir)/libxslt/libxslt.la \
          $(top_builddir)/libexslt/libexslt.la \
-	@LIBXML_LIBS@ $(EXTRA_LIBS) @WIN32_EXTRA_LIBADD@
+	$(LIBXML_LIBS) $(EXTRA_LIBS) $(WIN32_EXTRA_LIBADD)
 
 xsltproc_LDADD = $(LIBGCRYPT_LIBS) $(LDADDS)
 
+CLEANFILES = .memdump
+
+$(top_builddir)/libxslt/libxslt.la:
+	cd $(top_builddir)/libxslt && $(MAKE) libxslt.la
+
+$(top_builddir)/libexslt/libexslt.la: $(top_builddir)/libxslt/libxslt.la
+	cd $(top_builddir)/libexslt && $(MAKE) libexslt.la
+
 xsltproc.dv: xsltproc.o
-	$(CC) $(CFLAGS) -o xsltproc xsltproc.o ../libexslt/.libs/libexslt.a ../libxslt/.libs/libxslt.a @LIBXML_LIBS@ $(EXTRA_LIBS) $(LIBGCRYPT_LIBS)
+	$(CC) $(CFLAGS) -o xsltproc xsltproc.o ../libexslt/.libs/libexslt.a ../libxslt/.libs/libxslt.a $(LIBXML_LIBS) $(EXTRA_LIBS) $(LIBGCRYPT_LIBS)
 
 tests: testThreads
+	@echo > .memdump
 	@echo '## Running testThreads'
 	@($(CHECKER) ./testThreads ; grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]