Re: [xml] [PATCH] Various "make distcheck" and portability fixups



Below is an updated version of the patch I mailed in on March 14. As 
before, it applies against current git master.

Below is the updated walk-through. For brevity's sake, only the first of 
multiple instances of the same change is described.

I'll be happy to rework the patch as needed to get it in.


Makefile.am:

* Don't use @VAR@, use $(VAR). Autoconf's AC_SUBST provides us the Make
   variable, it allows overriding the value at the command line, and
   (notably) it avoids a Make parse error in the libxml2_la_LDFLAGS
   assignment when @MODULE_PLATFORM_LIBS@ is empty

* Changed how the THREADS_W32 mechanism switches the build between
   testThreads.c and testThreadsWin32.c as appropriate; using AM_CONDITIONAL
   allows this to work cleanly and plays well with dependencies

* testapi.c should be specified as BUILT_SOURCES

* Create symlinks to the test/ and result/ subdirs so that the runtests
   target is usable in out-of-source-tree builds

* Don't do MAKEFLAGS+=--silent as this is not portable to non-GNU Makes

* Fixed incorrect find(1) syntax in the "cleanup" rule, and doing "rm -f"
   instead of just "rm" is good form

* (DIST)CLEANFILES needed a bit more coverage to allow "make distcheck" to
   pass

configure.in:

* Need AC_PROG_LN_S to create test/ and result/ symlinks in Makefile.am

* AC_LIBTOOL_WIN32_DLL and AM_PROG_LIBTOOL are obsolete; these have been
   superceded by LT_INIT

* Don't rebuild docs by default, as this requires GNU Make (as
   implemented)

* Check for uint32_t as some platforms don't provide it

* Check for some more functions, and undefine HAVE_MMAP if we don't also
   HAVE_MUNMAP (one system I tested on actually needed this)

* Changed THREADS_W32 from a filename insert into an Automake conditional

* The "Copyright" file will not be in the current directory if builddir !=
   srcdir

doc/Makefile.am:

* EXTRA_DIST cannot use wildcards when they refer to generated files; this
   breaks dependencies. What I did was define EXTRA_DIST_wc, which uses GNU
   Make $(wildcard) directives to build up a list of files, and EXTRA_DIST,
   as a literal expansion of EXTRA_DIST_wc. I also added a new rule,
   "check-extra-dist", to simplify checking that the two variables are
   equivalent. (Note that this works only when builddir == srcdir)

   (I can implement this differently if desired; this is just one way of
   doing it)

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

* Fixed up the "libxml2-api.xml ..." rule by using $(wildcard) for
   dependencies (as Make doesn't process the wildcards otherwise) and
   qualifying appropriate files with $(srcdir)

   (Note that $(srcdir) is not needed in the dependencies, thanks to VPATH,
   which we can count on as this is GNU-Make-only code anyway)

doc/devhelp/Makefile.am:

* Qualified appropriate files with $(srcdir)

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

doc/examples/Makefile.am:

* Rather than use a wildcard that doesn't work, use a substitution that
   most Make programs can handle

doc/examples/index.py:

* Do the same here

include/libxml/nanoftp.h:

* Some platforms (e.g. MSVC 6) already #define INVALID_SOCKET:

     user host:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/\
     Include$ grep -R INVALID_SOCKET .
     ./WINSOCK.H:#define INVALID_SOCKET  (SOCKET)(~0)
     ./WINSOCK2.H:#define INVALID_SOCKET  (SOCKET)(~0)

include/libxml/xmlversion.h.in:

* Support ancient GCCs (I was actually able to build the library with 2.5
   but for this bit)

python/Makefile.am:

* Expanded CLEANFILES to allow "make distcheck" to pass

python/tests/Makefile.am:

* Define CLEANFILES instead of a "clean" rule, and added tmp.xml to allow
   "make distcheck" to pass

testRelax.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H (as some
   systems have the header but not the function)

testSchemas.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H

testapi.c:

* Don't use putenv() if it's not available

threads.c:

* This fixes the following build error on Solaris 8:

     libtool: compile:  cc -DHAVE_CONFIG_H -I. -I./include -I./include \
     -D_REENTRANT -D__EXTENSIONS__ -D_REENTRANT -Dsparc -Xa -mt -v \
     -xarch=v9 -xcrossfile -xO5 -c threads.c  -KPIC -DPIC -o threads.o
     "threads.c", line 442: controlling expressions must have scalar type
     "threads.c", line 512: controlling expressions must have scalar type
     cc: acomp failed for threads.c
     *** Error code 1

trio.c:

* Define isascii() if the system doesn't provide it

trio.h:

* The trio library's HAVE_CONFIG_H header is not the same as LibXML2's
   HAVE_CONFIG_H header; this change is needed to avoid a double-inclusion

win32/configure.js:

* Added support for the LZMA compression option

win32/Makefile.{bcb,mingw,msvc}:

* Added appropriate bits to support WITH_LZMA=1

* Install the header files under $(INCPREFIX)\libxml2\libxml instead of
   $(INCPREFIX)\libxml, to mirror the install location on Unix+Autotools

xml2-config.in:

* @MODULE_PLATFORM_LIBS@ (usually "-ldl") needs to be in there in order for
   `xml2-config --libs` to provide a complete set of dependencies

xmllint.c:

* Use HAVE_MMAP instead of the less-explicit HAVE_SYS_MMAN_H


--Daniel


On Tue, 13 Mar 2012, Daniel Richard G. wrote:

Hello list,

I am making use of LibXML2 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 was to get Automake's "make distcheck" target
into working order, and address the handful of portability issues I
encountered on various non-Linux platforms (including compatibility with
non-GNU make(1)).

-- 
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 f82cefa..e75eaf8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,11 +2,11 @@

 ACLOCAL_AMFLAGS = -I m4

-SUBDIRS = include . doc example xstc @PYTHON_SUBDIR@
+SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR)

 DIST_SUBDIRS = include . doc example python xstc

-INCLUDES = -I$(top_builddir)/include -I srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@ @LZMA_CFLAGS@
+INCLUDES = -I$(top_builddir)/include -I$(srcdir)/include $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)

 noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
                 testThreads testC14N testAutomata testRegexp \
@@ -18,7 +18,7 @@ bin_PROGRAMS = xmllint xmlcatalog
 bin_SCRIPTS=xml2-config

 lib_LTLIBRARIES = libxml2.la
-libxml2_la_LIBADD = @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ $(ICONV_LIBS) @M_LIBS@ @WIN32_EXTRA_LIBADD@
+libxml2_la_LIBADD = $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)

 if USE_VERSION_SCRIPT
 LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
@@ -26,10 +26,10 @@ else
 LIBXML2_VERSION_SCRIPT =
 endif

-libxml2_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ \
-                     $(LIBXML2_VERSION_SCRIPT) \
-                    -version-info @LIBXML_VERSION_INFO@ \
-                    @MODULE_PLATFORM_LIBS@
+libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \
+                    $(LIBXML2_VERSION_SCRIPT) \
+                    -version-info $(LIBXML_VERSION_INFO) \
+                    $(MODULE_PLATFORM_LIBS)

 if WITH_TRIO_SOURCES
 libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
@@ -54,7 +54,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
 endif

 DEPS = $(top_builddir)/libxml2.la
-LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ $(ICONV_LIBS) 
@M_LIBS@ @WIN32_EXTRA_LIBADD@
+LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) 
$(M_LIBS) $(WIN32_EXTRA_LIBADD)


 man_MANS = xml2-config.1 libxml.3
@@ -65,32 +65,32 @@ m4data_DATA = libxml.m4
 runtest_SOURCES=runtest.c
 runtest_LDFLAGS =
 runtest_DEPENDENCIES = $(DEPS)
-runtest_LDADD= @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS)
+runtest_LDADD = $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)

 testrecurse_SOURCES=testrecurse.c
 testrecurse_LDFLAGS =
 testrecurse_DEPENDENCIES = $(DEPS)
-testrecurse_LDADD= @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS)
+testrecurse_LDADD = $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)

 testchar_SOURCES=testchar.c
 testchar_LDFLAGS =
 testchar_DEPENDENCIES = $(DEPS)
-testchar_LDADD= @RDL_LIBS@ $(LDADDS)
+testchar_LDADD = $(RDL_LIBS) $(LDADDS)

 testdict_SOURCES=testdict.c
 testdict_LDFLAGS =
 testdict_DEPENDENCIES = $(DEPS)
-testdict_LDADD= @RDL_LIBS@ $(LDADDS)
+testdict_LDADD = $(RDL_LIBS) $(LDADDS)

 runsuite_SOURCES=runsuite.c
 runsuite_LDFLAGS =
 runsuite_DEPENDENCIES = $(DEPS)
-runsuite_LDADD= @RDL_LIBS@ $(LDADDS)
+runsuite_LDADD = $(RDL_LIBS) $(LDADDS)

 xmllint_SOURCES=xmllint.c
 xmllint_LDFLAGS =
 xmllint_DEPENDENCIES = $(DEPS)
-xmllint_LDADD=  @RDL_LIBS@ $(LDADDS)
+xmllint_LDADD = $(RDL_LIBS) $(LDADDS)

 testSAX_SOURCES=testSAX.c
 testSAX_LDFLAGS = 
@@ -105,7 +105,7 @@ testHTML_LDADD= $(LDADDS)
 xmlcatalog_SOURCES=xmlcatalog.c
 xmlcatalog_LDFLAGS =
 xmlcatalog_DEPENDENCIES = $(DEPS)
-xmlcatalog_LDADD= @RDL_LIBS@ $(LDADDS)
+xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)

 testXPath_SOURCES=testXPath.c
 testXPath_LDFLAGS = 
@@ -117,10 +117,14 @@ testC14N_LDFLAGS =
 testC14N_DEPENDENCIES = $(DEPS)
 testC14N_LDADD= $(LDADDS)

-testThreads_SOURCES=testThreads THREADS_W32@.c
+if THREADS_W32
+testThreads_SOURCES = testThreadsWin32.c
+else
+testThreads_SOURCES = testThreads.c
+endif
 testThreads_LDFLAGS =
 testThreads_DEPENDENCIES = $(DEPS)
-testThreads_LDADD= @BASE_THREAD_LIBS@  $(LDADDS)
+testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS)

 testURI_SOURCES=testURI.c
 testURI_LDFLAGS = 
@@ -172,6 +176,8 @@ testapi.c: $(srcdir)/gentest.py
        -@(if [ "$(PYTHON)" != "" ] ; then \
            $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )

+BUILT_SOURCES = testapi.c
+
 testapi_SOURCES=testapi.c
 testapi_LDFLAGS =
 testapi_DEPENDENCIES = $(DEPS)
@@ -188,9 +194,11 @@ runxmlconf_LDADD= $(LDADDS)
 #testOOM_LDADD= $(LDADDS)

 runtests:
+       [ -d test   ] || $(LN_S) $(srcdir)/test   .
+       [ -d result ] || $(LN_S) $(srcdir)/result .
        $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && 
$(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
-       @(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; \
-           $(MAKE) MAKEFLAGS+=--silent tests ; fi)
+       @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
+           $(MAKE) tests ; fi)

 check: all runtests

@@ -201,10 +209,10 @@ check-valgrind: all

 testall : tests SVGtests SAXtests

-tests: XMLtests XMLenttests NStests IDtests Errtests APItests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ 
@TEST_HTML@ @TEST_PHTML@  @TEST_VALID@ URItests @TEST_PATTERN@ @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ 
@TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_SCHEMATRON@ @TEST_THREADS@ 
Timingtests @TEST_VTIME@ @PYTHON_TESTS@ @TEST_MODULES@
-       @(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; \
-           $(MAKE) MAKEFLAGS+=--silent tests ; fi)
-       @(cd doc/examples ; $(MAKE) MAKEFLAGS+=--silent tests)
+tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) 
$(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) 
$(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) 
Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES)
+       @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
+           $(MAKE) tests ; fi)
+       @(cd doc/examples ; $(MAKE) tests)

 valgrind:
        @echo '## Running the regression tests under Valgrind'
@@ -1115,7 +1123,7 @@ SchemasPythonTests:
            echo "## It is normal to see 11 errors reported" ; \
            $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \
          fi)
-       @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" MAKEFLAGS+=--silent 
pytests ; fi)
+       @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi)

 Patterntests: xmllint$(EXEEXT)
        @(echo > .memdump)
@@ -1147,8 +1155,8 @@ ModuleTests: testModule$(EXEEXT) testdso.la

 cleanup:
        -@(find . -name .\#\* -exec rm {} \;)
-       -@(find . -name \*.gcda -o *.gcno -exec rm {} \;)
-       -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm {} \;)
+       -@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;)
+       -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;)

 dist-hook: cleanup libxml2.spec
        -cp libxml2.spec $(distdir)
@@ -1183,7 +1191,8 @@ xml2Conf.sh: xml2Conf.sh.in Makefile
               < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
        && mv xml2Conf.tmp xml2Conf.sh

-CLEANFILES=xml2Conf.sh *.gcda *.gcno
+CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res
+DISTCLEANFILES = COPYING libxml2.syms missing.lst

 confexecdir=$(libdir)
 confexec_DATA = xml2Conf.sh
@@ -1213,13 +1222,13 @@ DOC_MODULE=libxml2-$(VERSION)
 EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples

 install-data-local: 
-       @MKDIR_P@ $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
-       - INSTALL@ -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
-       @MKDIR_P@ $(DESTDIR)$(EXAMPLES_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)
+       $(MKDIR_P) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
+       -$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
+       $(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)

 uninstall-local:
        rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
diff --git a/configure.in b/configure.in
index 0fb4983..ccbc330 100644
--- a/configure.in
+++ b/configure.in
@@ -58,6 +58,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
+AC_PROG_LN_S
 AC_PROG_MKDIR_P
 AC_PROG_CPP
 AC_PATH_PROG(RM, rm, /bin/rm)
@@ -68,8 +69,7 @@ AC_PATH_PROG(WGET, wget, /usr/bin/wget)
 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)

-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
+LT_INIT

 dnl
 dnl if the system support linker version scripts for symbol versioning
@@ -205,8 +205,8 @@ AC_ARG_WITH(coverage,
 [  --with-coverage         build for code coverage with GCC (off)])

 AC_ARG_ENABLE(rebuild-docs,
-[  --enable-rebuild-docs[[=yes/no]]  rebuild some generated docs [[default=yes]]])
-AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
+[  --enable-rebuild-docs[[=yes/no]]  rebuild some generated docs [[default=no]]])
+AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes"])

 dnl
 dnl hard dependancies on options
@@ -500,6 +500,11 @@ AC_CHECK_HEADERS([dl.h])
 AC_CHECK_HEADERS([dlfcn.h])


+echo Checking types
+
+AC_TYPE_UINT32_T
+
+
 echo Checking libraries

 dnl Checks for library functions.
@@ -509,6 +514,12 @@ AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
 AC_CHECK_FUNCS(stat _stat signal)
 AC_CHECK_FUNCS(rand rand_r srand time)
+AC_CHECK_FUNCS(isascii mmap munmap putenv)
+
+AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
+#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
+#  undef /**/ HAVE_MMAP
+#endif])

 dnl Checking for va_copy availability
 AC_MSG_CHECKING([for va_copy])
@@ -949,7 +960,7 @@ else
     case $host_os in
        *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
                WITH_THREADS="1"
-               THREADS_W32="Win32"
+               THREADS_W32="1"
                THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
            fi
        ;;
@@ -1010,7 +1021,7 @@ AC_SUBST(BASE_THREAD_LIBS)
 AC_SUBST(WITH_THREADS)
 AC_SUBST(THREAD_CFLAGS)
 AC_SUBST(TEST_THREADS)
-AC_SUBST(THREADS_W32)
+AM_CONDITIONAL(THREADS_W32, test -n "$THREADS_WIN32")

 dnl
 dnl xmllint shell history
@@ -1550,7 +1561,7 @@ AC_SUBST(RELDATE)
 AC_SUBST(PYTHON_TESTS)

 rm -f COPYING.LIB COPYING
-ln -s Copyright COPYING
+ln -s $srcdir/Copyright COPYING

 # keep on one line for cygwin c.f. #130896
 AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile 
doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile 
xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index dd39f69..b9ab1ad 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -16,21 +16,229 @@ PAGES= architecture.html bugs.html contribs.html docs.html DOM.html \
     tree.html xmldtd.html XMLinfo.html XSLT.html
 APIPAGES=APIconstructors.html APIfiles.html APIfunctions.html \
     APIsymbols.html APIchunk0.html
-EXTRA_DIST=xmlcatalog_man.xml tutorial/*.html tutorial/*.c tutorial/*.pdf \
-           tutorial/images/*.png tutorial/images/callouts/*.png \
-          API*.html *.1 *.xsl *.html *.gif w3c.png html/*.html \
-          html/*.png libxml2-api.xml index.py search.php \
-          apibuild.py libxml2.xsa xmllint.xml xmlcatalog_man.xml \
-          README.docs symbols.xml

+if REBUILD_DOCS
+EXTRA_DIST_wc = xmlcatalog_man.xml $(wildcard tutorial/*.html) \
+    $(wildcard tutorial/*.c) $(wildcard tutorial/*.pdf) \
+    $(wildcard tutorial/images/*.png) \
+    $(wildcard tutorial/images/callouts/*.png) $(wildcard API*.html) \
+    $(wildcard *.1) $(wildcard *.xsl) $(wildcard *.html) \
+    $(wildcard *.gif) w3c.png $(wildcard html/*.html) \
+    $(wildcard html/*.png) libxml2-api.xml index.py search.php \
+    apibuild.py libxml2.xsa xmllint.xml xmlcatalog_man.xml \
+    README.docs symbols.xml
+endif
+
+# Expanded form of EXTRA_DIST_wc
+#
+EXTRA_DIST = \
+       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 \
+       APIchunk14.html \
+       APIchunk15.html \
+       APIchunk16.html \
+       APIchunk17.html \
+       APIchunk18.html \
+       APIchunk19.html \
+       APIchunk20.html \
+       APIchunk21.html \
+       APIchunk22.html \
+       APIchunk23.html \
+       APIchunk24.html \
+       APIchunk25.html \
+       APIchunk26.html \
+       APIchunk27.html \
+       APIchunk28.html \
+       APIchunk29.html \
+       APIconstructors.html \
+       APIfiles.html \
+       APIfunctions.html \
+       APIsymbols.html \
+       ChangeLog.xsl \
+       DOM.gif \
+       DOM.html \
+       FAQ.html \
+       Libxml2-Logo-180x168.gif \
+       Libxml2-Logo-90x34.gif \
+       README.docs \
+       XMLinfo.html \
+       XSLT.html \
+       api.xsl \
+       apibuild.py \
+       architecture.html \
+       bugs.html \
+       catalog.gif \
+       catalog.html \
+       checkapisym.xsl \
+       contribs.html \
+       docs.html \
+       downloads.html \
+       elfgcchack.xsl \
+       encoding.html \
+       entities.html \
+       example.html \
+       guidelines.html \
+       help.html \
+       html/book1.html \
+       html/home.png \
+       html/index.html \
+       html/left.png \
+       html/libxml-DOCBparser.html \
+       html/libxml-HTMLparser.html \
+       html/libxml-HTMLtree.html \
+       html/libxml-SAX.html \
+       html/libxml-SAX2.html \
+       html/libxml-c14n.html \
+       html/libxml-catalog.html \
+       html/libxml-chvalid.html \
+       html/libxml-debugXML.html \
+       html/libxml-dict.html \
+       html/libxml-encoding.html \
+       html/libxml-entities.html \
+       html/libxml-globals.html \
+       html/libxml-hash.html \
+       html/libxml-lib.html \
+       html/libxml-list.html \
+       html/libxml-nanoftp.html \
+       html/libxml-nanohttp.html \
+       html/libxml-parser.html \
+       html/libxml-parserInternals.html \
+       html/libxml-pattern.html \
+       html/libxml-relaxng.html \
+       html/libxml-schemasInternals.html \
+       html/libxml-schematron.html \
+       html/libxml-threads.html \
+       html/libxml-tree.html \
+       html/libxml-uri.html \
+       html/libxml-valid.html \
+       html/libxml-xinclude.html \
+       html/libxml-xlink.html \
+       html/libxml-xmlIO.html \
+       html/libxml-xmlautomata.html \
+       html/libxml-xmlerror.html \
+       html/libxml-xmlexports.html \
+       html/libxml-xmlmemory.html \
+       html/libxml-xmlmodule.html \
+       html/libxml-xmlreader.html \
+       html/libxml-xmlregexp.html \
+       html/libxml-xmlsave.html \
+       html/libxml-xmlschemas.html \
+       html/libxml-xmlschemastypes.html \
+       html/libxml-xmlstring.html \
+       html/libxml-xmlunicode.html \
+       html/libxml-xmlversion.html \
+       html/libxml-xmlwriter.html \
+       html/libxml-xpath.html \
+       html/libxml-xpathInternals.html \
+       html/libxml-xpointer.html \
+       html/right.png \
+       html/up.png \
+       index.html \
+       index.py \
+       interface.html \
+       intro.html \
+       library.html \
+       libxml.gif \
+       libxml2-api.xml \
+       libxml2.xsa \
+       namespaces.html \
+       newapi.xsl \
+       news.html \
+       news.xsl \
+       python.html \
+       redhat.gif \
+       search.php \
+       searches.html \
+       searches.xsl \
+       site.xsl \
+       smallfootonly.gif \
+       structure.gif \
+       symbols.xml \
+       syms.xsl \
+       threads.html \
+       tree.html \
+       tutorial/apa.html \
+       tutorial/apb.html \
+       tutorial/apc.html \
+       tutorial/apd.html \
+       tutorial/ape.html \
+       tutorial/apf.html \
+       tutorial/apg.html \
+       tutorial/aph.html \
+       tutorial/api.html \
+       tutorial/ar01s02.html \
+       tutorial/ar01s03.html \
+       tutorial/ar01s04.html \
+       tutorial/ar01s05.html \
+       tutorial/ar01s06.html \
+       tutorial/ar01s07.html \
+       tutorial/ar01s08.html \
+       tutorial/ar01s09.html \
+       tutorial/images/blank.png \
+       tutorial/images/callouts/1.png \
+       tutorial/images/callouts/10.png \
+       tutorial/images/callouts/2.png \
+       tutorial/images/callouts/3.png \
+       tutorial/images/callouts/4.png \
+       tutorial/images/callouts/5.png \
+       tutorial/images/callouts/6.png \
+       tutorial/images/callouts/7.png \
+       tutorial/images/callouts/8.png \
+       tutorial/images/callouts/9.png \
+       tutorial/images/caution.png \
+       tutorial/images/draft.png \
+       tutorial/images/home.png \
+       tutorial/images/important.png \
+       tutorial/images/next.png \
+       tutorial/images/note.png \
+       tutorial/images/prev.png \
+       tutorial/images/tip.png \
+       tutorial/images/toc-blank.png \
+       tutorial/images/toc-minus.png \
+       tutorial/images/toc-plus.png \
+       tutorial/images/up.png \
+       tutorial/images/warning.png \
+       tutorial/includeaddattribute.c \
+       tutorial/includeaddkeyword.c \
+       tutorial/includeconvert.c \
+       tutorial/includegetattribute.c \
+       tutorial/includekeyword.c \
+       tutorial/includexpath.c \
+       tutorial/index.html \
+       tutorial/ix01.html \
+       tutorial/xmltutorial.pdf \
+       upgrade.html \
+       w3c.png \
+       wiki.xsl \
+       xml.html \
+       xmlcatalog.1 \
+       xmlcatalog_man.html \
+       xmlcatalog_man.xml \
+       xmldtd.html \
+       xmlio.html \
+       xmllint.1 \
+       xmllint.html \
+       xmllint.xml \
+       xmlmem.html \
+       xmlreader.html \
+       xsa.xsl

 man_MANS = xmllint.1 xmlcatalog.1

 if REBUILD_DOCS
-all: web $(top_builddir)/NEWS libxml2.xsa $(man_MANS)
-else
-all:
-endif
+docs: web $(top_builddir)/NEWS libxml2.xsa $(man_MANS)

 api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src 
../elfgcchack.h $(srcdir)/site.xsl

@@ -89,10 +297,10 @@ $(WIN32_DIR)/libxml2.def.src: libxml2-api.xml
          $(XSLTPROC) -o $(WIN32_DIR)/libxml2.def.src \
          --nonet $(WIN32_DIR)/defgen.xsl libxml2-api.xml ; fi )

-libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.xsl checkapisym.xsl 
../include/libxml/*.h ../*.c
-       -(./apibuild.py)
-       ($(XSLTPROC) checkapisym.xsl libxml2-api.xml)
-       ($(XSLTPROC) -o ../libxml2.syms syms.xsl symbols.xml)
+libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.xsl checkapisym.xsl 
$(wildcard $(top_srcdir)/include/libxml/*.h) $(wildcard $(top_srcdir)/*.c)
+       -($(srcdir)/apibuild.py)
+       ($(XSLTPROC) $(srcdir)/checkapisym.xsl $(srcdir)/libxml2-api.xml)
+       ($(XSLTPROC) -o ../libxml2.syms $(srcdir)/syms.xsl $(srcdir)/symbols.xml)
        -@(cd .. ; $(MAKE) rebuild_testapi)


@@ -102,28 +310,35 @@ xmllint.1: xmllint.xml
 xmlcatalog.1: xmlcatalog_man.xml
        -@($(XSLTPROC) --nonet xmlcatalog_man.xml)

+check-extra-dist:
+       for f in $(EXTRA_DIST_wc) ; do echo $$f; done | sort -u >tmp.EXTRA_DIST_wc
+       for f in $(EXTRA_DIST) ;    do echo $$f; done | sort    >tmp.EXTRA_DIST
+       diff -u tmp.EXTRA_DIST_wc tmp.EXTRA_DIST
+       rm -f tmp.EXTRA_DIST_wc tmp.EXTRA_DIST
+endif
+
 clean-local:
        rm -f *~ *.bak *.hierarchy *.signals *-unused.txt

 maintainer-clean-local: clean-local
        rm -rf libxml-decl-list.txt libxml-decl.txt

-rebuild: api all
+rebuild: api docs

 install-data-local: 
-       @MKDIR_P@ $(DESTDIR)$(HTML_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/xml.html $(srcdir)/encoding.html $(srcdir)/FAQ.html 
$(srcdir)/structure.gif $(srcdir)/DOM.gif $(srcdir)/smallfootonly.gif $(srcdir)/redhat.gif 
$(srcdir)/libxml.gif $(srcdir)/w3c.png $(srcdir)/Libxml2-Logo-180x168.gif $(srcdir)/Libxml2-Logo-90x34.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
-       @MKDIR_P@ $(DESTDIR)$(HTML_DIR)/tutorial
-       - INSTALL@ -m 0644 $(srcdir)/tutorial/*.* \
+       $(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/xml.html $(srcdir)/encoding.html $(srcdir)/FAQ.html 
$(srcdir)/structure.gif $(srcdir)/DOM.gif $(srcdir)/smallfootonly.gif $(srcdir)/redhat.gif 
$(srcdir)/libxml.gif $(srcdir)/w3c.png $(srcdir)/Libxml2-Logo-180x168.gif $(srcdir)/Libxml2-Logo-90x34.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
+       $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial
+       -$(INSTALL) -m 0644 $(srcdir)/tutorial/*.* \
                $(DESTDIR)$(HTML_DIR)/tutorial
-       @MKDIR_P@ $(DESTDIR)$(HTML_DIR)/tutorial/images
-       - INSTALL@ -m 0644 $(srcdir)/tutorial/images/*.* \
+       $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial/images
+       -$(INSTALL) -m 0644 $(srcdir)/tutorial/images/*.* \
                $(DESTDIR)$(HTML_DIR)/tutorial/images
-       @MKDIR_P@ $(DESTDIR)$(HTML_DIR)/tutorial/images/callouts
-       - INSTALL@ -m 0644 $(srcdir)/tutorial/images/callouts/*.* \
+       $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial/images/callouts
+       -$(INSTALL) -m 0644 $(srcdir)/tutorial/images/callouts/*.* \
                $(DESTDIR)$(HTML_DIR)/tutorial/images/callouts

 .PHONY : html xml templates scan
diff --git a/doc/devhelp/Makefile.am b/doc/devhelp/Makefile.am
index 36852f9..23c77b8 100644
--- a/doc/devhelp/Makefile.am
+++ b/doc/devhelp/Makefile.am
@@ -63,11 +63,17 @@ all: libxml2.devhelp $(HTML_FILES)
 libxml2.devhelp $(HTML_FILES): devhelp.xsl html.xsl $(top_srcdir)/doc/libxml2-api.xml
        -@(echo Rebuilding devhelp files)
        -@(if [ -x $(XSLTPROC) ] ; then \
-         $(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp devhelp.xsl $(top_srcdir)/doc/libxml2-api.xml ; fi 
);
+         $(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp $(srcdir)/devhelp.xsl 
$(top_srcdir)/doc/libxml2-api.xml ; fi );

 install-data-local: 
-       - MKDIR_P@ $(DESTDIR)$(DEVHELP_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/libxml2.devhelp $(DESTDIR)$(DEVHELP_DIR)
-       - INSTALL@ -m 0644 $(EXTRA_FORMAT:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)
-       - INSTALL@ -m 0644 $(HTML_FILES:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)
+       -$(MKDIR_P) $(DESTDIR)$(DEVHELP_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/libxml2.devhelp $(DESTDIR)$(DEVHELP_DIR)
+       -$(INSTALL) -m 0644 $(EXTRA_FORMAT:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)
+       -$(INSTALL) -m 0644 $(HTML_FILES:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)

+uninstall-local:
+       rm -f $(DESTDIR)$(DEVHELP_DIR)/libxml2.devhelp
+       rm -f $(DESTDIR)$(DEVHELP_DIR)/*.css
+       rm -f $(DESTDIR)$(DEVHELP_DIR)/*.html
+       rm -f $(DESTDIR)$(DEVHELP_DIR)/*.png
+       -rmdir $(DESTDIR)$(DEVHELP_DIR)
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index bdac7bb..6c59cbc 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -1,19 +1,19 @@
 # Beware this is autogenerated by index.py
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include $(THREAD_CFLAGS) $(Z_CFLAGS)
 DEPS = $(top_builddir)/libxml2.la
-LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm 
@WIN32_EXTRA_LIBADD@
+LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm 
$(WIN32_EXTRA_LIBADD)

 rebuild: examples.xml index.html

-examples.xml: index.py *.c
+examples.xml: index.py $(noinst_PROGRAMS:=.c)
        -@($(srcdir)/index.py)

 index.html: examples.xml examples.xsl
        -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout 
index.html)

 install-data-local: 
-       @MKDIR_P@ $(DESTDIR)$(HTML_DIR)
-       - INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res 
$(DESTDIR)$(HTML_DIR)
+       $(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+       -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res 
$(DESTDIR)$(HTML_DIR)

 EXTRA_DIST=examples.xsl index.py examples.xml writer.xml test3.xml tst.xml test1.xml test2.xml io2.res 
xpath2.res tree1.res reader4.res io1.res tree2.res reader3.res xpath1.res reader1.res

@@ -22,77 +22,77 @@ noinst_PROGRAMS=xpath2 reader1 reader4 parse2 reader2 parse3 reader3 tree2 parse
 xpath2_SOURCES=xpath2.c
 xpath2_LDFLAGS=
 xpath2_DEPENDENCIES= $(DEPS)
-xpath2_LDADD= @RDL_LIBS@ $(LDADDS)
+xpath2_LDADD = $(RDL_LIBS) $(LDADDS)

 reader1_SOURCES=reader1.c
 reader1_LDFLAGS=
 reader1_DEPENDENCIES= $(DEPS)
-reader1_LDADD= @RDL_LIBS@ $(LDADDS)
+reader1_LDADD = $(RDL_LIBS) $(LDADDS)

 reader4_SOURCES=reader4.c
 reader4_LDFLAGS=
 reader4_DEPENDENCIES= $(DEPS)
-reader4_LDADD= @RDL_LIBS@ $(LDADDS)
+reader4_LDADD = $(RDL_LIBS) $(LDADDS)

 parse2_SOURCES=parse2.c
 parse2_LDFLAGS=
 parse2_DEPENDENCIES= $(DEPS)
-parse2_LDADD= @RDL_LIBS@ $(LDADDS)
+parse2_LDADD = $(RDL_LIBS) $(LDADDS)

 reader2_SOURCES=reader2.c
 reader2_LDFLAGS=
 reader2_DEPENDENCIES= $(DEPS)
-reader2_LDADD= @RDL_LIBS@ $(LDADDS)
+reader2_LDADD = $(RDL_LIBS) $(LDADDS)

 parse3_SOURCES=parse3.c
 parse3_LDFLAGS=
 parse3_DEPENDENCIES= $(DEPS)
-parse3_LDADD= @RDL_LIBS@ $(LDADDS)
+parse3_LDADD = $(RDL_LIBS) $(LDADDS)

 reader3_SOURCES=reader3.c
 reader3_LDFLAGS=
 reader3_DEPENDENCIES= $(DEPS)
-reader3_LDADD= @RDL_LIBS@ $(LDADDS)
+reader3_LDADD = $(RDL_LIBS) $(LDADDS)

 tree2_SOURCES=tree2.c
 tree2_LDFLAGS=
 tree2_DEPENDENCIES= $(DEPS)
-tree2_LDADD= @RDL_LIBS@ $(LDADDS)
+tree2_LDADD = $(RDL_LIBS) $(LDADDS)

 parse4_SOURCES=parse4.c
 parse4_LDFLAGS=
 parse4_DEPENDENCIES= $(DEPS)
-parse4_LDADD= @RDL_LIBS@ $(LDADDS)
+parse4_LDADD = $(RDL_LIBS) $(LDADDS)

 io2_SOURCES=io2.c
 io2_LDFLAGS=
 io2_DEPENDENCIES= $(DEPS)
-io2_LDADD= @RDL_LIBS@ $(LDADDS)
+io2_LDADD = $(RDL_LIBS) $(LDADDS)

 testWriter_SOURCES=testWriter.c
 testWriter_LDFLAGS=
 testWriter_DEPENDENCIES= $(DEPS)
-testWriter_LDADD= @RDL_LIBS@ $(LDADDS)
+testWriter_LDADD = $(RDL_LIBS) $(LDADDS)

 io1_SOURCES=io1.c
 io1_LDFLAGS=
 io1_DEPENDENCIES= $(DEPS)
-io1_LDADD= @RDL_LIBS@ $(LDADDS)
+io1_LDADD = $(RDL_LIBS) $(LDADDS)

 xpath1_SOURCES=xpath1.c
 xpath1_LDFLAGS=
 xpath1_DEPENDENCIES= $(DEPS)
-xpath1_LDADD= @RDL_LIBS@ $(LDADDS)
+xpath1_LDADD = $(RDL_LIBS) $(LDADDS)

 parse1_SOURCES=parse1.c
 parse1_LDFLAGS=
 parse1_DEPENDENCIES= $(DEPS)
-parse1_LDADD= @RDL_LIBS@ $(LDADDS)
+parse1_LDADD = $(RDL_LIBS) $(LDADDS)

 tree1_SOURCES=tree1.c
 tree1_LDFLAGS=
 tree1_DEPENDENCIES= $(DEPS)
-tree1_LDADD= @RDL_LIBS@ $(LDADDS)
+tree1_LDADD = $(RDL_LIBS) $(LDADDS)

 valgrind:
        $(MAKE) CHECKER='valgrind' tests
diff --git a/doc/examples/index.py b/doc/examples/index.py
index 11df6f0..536d5dc 100755
--- a/doc/examples/index.py
+++ b/doc/examples/index.py
@@ -227,7 +227,7 @@ LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(I

 rebuild: examples.xml index.html

-examples.xml: index.py *.c
+examples.xml: index.py $(noinst_PROGRAMS:=.c)
        -@($(srcdir)/index.py)

 index.html: examples.xml examples.xsl
diff --git a/example/Makefile.am b/example/Makefile.am
index 9eb6a76..f8a137b 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -1,10 +1,10 @@
 noinst_PROGRAMS        = gjobread

-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include $(THREAD_CFLAGS) $(Z_CFLAGS)
 DEPS = $(top_builddir)/libxml2.la
-LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm 
@WIN32_EXTRA_LIBADD@
+LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm 
$(WIN32_EXTRA_LIBADD)

 gjobread_SOURCES=gjobread.c
 gjobread_LDFLAGS=
 gjobread_DEPENDENCIES= $(DEPS)
-gjobread_LDADD= @RDL_LIBS@ $(LDADDS)
+gjobread_LDADD = $(RDL_LIBS) $(LDADDS)
diff --git a/include/libxml/nanoftp.h b/include/libxml/nanoftp.h
index 397bbba..abb4bf7 100644
--- a/include/libxml/nanoftp.h
+++ b/include/libxml/nanoftp.h
@@ -31,6 +31,7 @@
  * macro used to provide portability of code to windows sockets
  * the value to be used when the socket is not valid
  */
+#undef  INVALID_SOCKET
 #define INVALID_SOCKET (-1)
 #endif

diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index ddd4633..c98e7ca 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -412,7 +412,11 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
  */

 #ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__((unused))
+# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
+#  define ATTRIBUTE_UNUSED __attribute__((unused))
+# else
+#  define ATTRIBUTE_UNUSED
+# endif
 #endif

 /**
diff --git a/python/Makefile.am b/python/Makefile.am
index 68d2236..177b457 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -21,7 +21,7 @@ EXTRA_DIST =                  \
        libxml.py               \
        libxml2-python-api.xml

-libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version 
+libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version

 if WITH_PYTHON
 mylibs = \
@@ -31,7 +31,7 @@ python_LTLIBRARIES = libxml2mod.la

 libxml2mod_la_SOURCES = $(srcdir)/libxml.c $(srcdir)/types.c
 nodist_libxml2mod_la_SOURCES = libxml2-py.c
-libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ @WIN32_EXTRA_PYTHON_LIBADD@ @PYTHON_LIBS@ 
-lpython$(PYTHON_VERSION)
+libxml2mod_la_LIBADD = $(mylibs) $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) 
-lpython$(PYTHON_VERSION)

 $(srcdir)/libxml.c: libxml2-py.h # to generate before to compile

@@ -53,7 +53,7 @@ GENERATED= libxml2class.py \
           libxml2-py.c \
           libxml2-py.h

-CLEANFILES= $(GENERATED) gen_prog libxml2.py
+CLEANFILES = $(GENERATED) gen_prog libxml2.py *.pyc

 $(GENERATED): gen_prog

@@ -63,5 +63,5 @@ gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
 endif

 tests test: all
-       cd tests && $(MAKE) MAKEFLAGS+=--silent tests
+       cd tests && $(MAKE) tests

diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 52c89fc..ca72fdd 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -55,6 +55,8 @@ XMLS=         \
     invalid.xml        \
     test.dtd

+CLEANFILES = core tmp.xml *.pyc
+
 if WITH_PYTHON
 tests: $(PYTESTS)
        @echo "## running Python regression tests"
@@ -69,6 +71,3 @@ tests: $(PYTESTS)
 else
 tests:
 endif
-
-clean:
-       rm -f *.pyc core
diff --git a/testRelax.c b/testRelax.c
index e18b3c2..6133348 100644
--- a/testRelax.c
+++ b/testRelax.c
@@ -49,7 +49,7 @@ static int debug = 0;
 #endif
 static int noout = 0;
 static int tree = 0;
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
 static int memory = 0;
 #endif

@@ -65,7 +65,7 @@ int main(int argc, char **argv) {
            debug++;
        else
 #endif
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) {
            memory++;
         } else
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
            if (schema == NULL) {
                xmlRelaxNGParserCtxtPtr ctxt;

-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
                if (memory) {
                    int fd;
                    struct stat info;
@@ -174,7 +174,7 @@ int main(int argc, char **argv) {
 #endif
        printf("\t--noout : do not print the result\n");
        printf("\t--tree : print the intermediate Relax-NG document tree\n");
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        printf("\t--memory : test the schemas in memory parsing\n");
 #endif
     }
diff --git a/testSchemas.c b/testSchemas.c
index 47f8b39..b1cb753 100644
--- a/testSchemas.c
+++ b/testSchemas.c
@@ -49,7 +49,7 @@
 static int debug = 0;
 #endif
 static int noout = 0;
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
 static int memory = 0;
 #endif

@@ -65,7 +65,7 @@ int main(int argc, char **argv) {
            debug++;
        else
 #endif
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) {
            memory++;
         } else
@@ -80,7 +80,7 @@ int main(int argc, char **argv) {
            if (schema == NULL) {
                xmlSchemaParserCtxtPtr ctxt;

-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
                if (memory) {
                    int fd;
                    struct stat info;
@@ -164,7 +164,7 @@ int main(int argc, char **argv) {
        printf("\t--debug : dump a debug tree of the in-memory document\n");
 #endif
        printf("\t--noout : do not print the result\n");
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        printf("\t--memory : test the schemas in memory parsing\n");
 #endif
     }
diff --git a/testapi.c b/testapi.c
index 4f4b39b..25e47be 100644
--- a/testapi.c
+++ b/testapi.c
@@ -127,8 +127,10 @@ int main(int argc, char **argv) {
     int ret;
     int blocks, mem;

+#ifdef HAVE_PUTENV
     /* access to the proxy can slow up regression tests a lot */
     putenv((char *) "http_proxy=");
+#endif

     memset(chartab, 0, sizeof(chartab));
     strncpy((char *) chartab, "  chartab\n", 20);
diff --git a/threads.c b/threads.c
index 1eeac0e..6d25565 100644
--- a/threads.c
+++ b/threads.c
@@ -439,7 +439,7 @@ __xmlGlobalInitMutexLock(void)
     /* Make sure the global init lock is initialized and then lock it. */
 #ifdef HAVE_PTHREAD_H
     /* The mutex is statically initialized, so we just lock it. */
-    if (pthread_mutex_lock)
+    if (pthread_mutex_lock != NULL)
         pthread_mutex_lock(&global_init_lock);
 #elif defined HAVE_WIN32_THREADS
     LPCRITICAL_SECTION cs;
@@ -509,7 +509,7 @@ void
 __xmlGlobalInitMutexUnlock(void)
 {
 #ifdef HAVE_PTHREAD_H
-    if (pthread_mutex_unlock)
+    if (pthread_mutex_unlock != NULL)
         pthread_mutex_unlock(&global_init_lock);
 #elif defined HAVE_WIN32_THREADS
     if (global_init_lock != NULL) {
diff --git a/trio.c b/trio.c
index b116ccc..a0e3d4d 100644
--- a/trio.c
+++ b/trio.c
@@ -307,6 +307,10 @@ typedef trio_longlong_t trio_int64_t;
 #define NAN_LOWER "nan"
 #define NAN_UPPER "NAN"

+#if !defined(HAVE_ISASCII) && !defined(isascii)
+#  define isascii(x) ((unsigned int)(x) < 128)
+#endif
+
 /* Various constants */
 enum {
   TYPE_PRINT = 1,
diff --git a/trio.h b/trio.h
index eab1b6d..108a709 100644
--- a/trio.h
+++ b/trio.h
@@ -28,7 +28,7 @@
  * Use autoconf defines if present. Packages using trio must define
  * HAVE_CONFIG_H as a compiler option themselves.
  */
-#if defined(HAVE_CONFIG_H)
+#if defined(TRIO_HAVE_CONFIG_H)
 # include "config.h"
 #endif

diff --git a/win32/Makefile.bcb b/win32/Makefile.bcb
index d612e2d..a374b71 100644
--- a/win32/Makefile.bcb
+++ b/win32/Makefile.bcb
@@ -68,6 +68,9 @@ CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
 !if "$(WITH_ZLIB)" == "1"
 CFLAGS = $(CFLAGS) -DHAVE_ZLIB_H
 !endif
+!if "$(WITH_LZMA)" == "1"
+CFLAGS = $(CFLAGS) -DHAVE_LZMA_H
+!endif

 # The linker and its options.
 LD = ilink32.exe
@@ -92,6 +95,9 @@ LIBS = $(LIBS) iconvomf.lib
 !if "$(WITH_ZLIB)" == "1"
 LIBS = $(LIBS) zlibomf.lib
 !endif
+!if "$(WITH_LZMA)" == "1"
+LIBS = $(LIBS) liblzma.lib
+!endif
 !if "$(WITH_THREADS)" == "posix"
 LIBS = $(LIBS) pthreadVC.lib
 !endif
@@ -250,10 +256,11 @@ distclean : clean
 rebuild : clean all

 install-libs : all
-       if not exist "$(INCPREFIX)\libxml" mkdir "$(INCPREFIX)\libxml"
+       if not exist "$(INCPREFIX)\libxml2" mkdir "$(INCPREFIX)\libxml2"
+       if not exist "$(INCPREFIX)\libxml2\libxml" mkdir "$(INCPREFIX)\libxml2\libxml"
        if not exist "$(BINPREFIX)" mkdir "$(BINPREFIX)"
        if not exist "$(LIBPREFIX)" mkdir "$(LIBPREFIX)"
-       copy $(XML_SRCDIR)\include\libxml\*.h "$(INCPREFIX)\libxml"
+       copy $(XML_SRCDIR)\include\libxml\*.h "$(INCPREFIX)\libxml2\libxml"
        copy $(BINDIR)\$(XML_SO) "$(SOPREFIX)"
        copy $(BINDIR)\$(XML_A) "$(LIBPREFIX)"
        copy $(BINDIR)\$(XML_IMP) "$(LIBPREFIX)"
diff --git a/win32/Makefile.mingw b/win32/Makefile.mingw
index 0f8198b..dbe967d 100644
--- a/win32/Makefile.mingw
+++ b/win32/Makefile.mingw
@@ -60,6 +60,9 @@ endif
 ifeq ($(WITH_ZLIB),1)
 CFLAGS += -DHAVE_ZLIB_H
 endif
+ifeq ($(WITH_LZMA),1)
+CFLAGS += -DHAVE_LZMA_H
+endif

 # The linker and its options.
 LD = gcc.exe
@@ -83,6 +86,9 @@ ifeq ($(WITH_ZLIB),1)
 # LIBS += -lzdll
 LIBS += -lz
 endif
+ifeq ($(WITH_LZMA),1)
+LIBS += -llzma
+endif
 ifeq ($(WITH_THREADS),posix)
 LIBS += -lpthreadGC
 endif
@@ -254,10 +260,11 @@ distclean : clean
 rebuild : clean all

 install-libs : all
-       cmd.exe /C "if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml"
+       cmd.exe /C "if not exist $(INCPREFIX)\libxml2 mkdir $(INCPREFIX)\libxml2"
+       cmd.exe /C "if not exist $(INCPREFIX)\libxml2\libxml mkdir $(INCPREFIX)\libxml2\libxml"
        cmd.exe /C "if not exist $(BINPREFIX) mkdir $(BINPREFIX)"
        cmd.exe /C "if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)"
-       cmd.exe /C "copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml"
+       cmd.exe /C "copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml2\libxml"
        cmd.exe /C "copy $(BINDIR)\$(XML_SO) $(SOPREFIX)"
        cmd.exe /C "copy $(BINDIR)\$(XML_A) $(LIBPREFIX)"
        cmd.exe /C "copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX)"
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index cc93372..8ef4f5e 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -299,11 +299,12 @@ distclean : clean
 rebuild : clean all

 install-libs : all
-       if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml
+       if not exist $(INCPREFIX)\libxml2 mkdir $(INCPREFIX)\libxml2
+       if not exist $(INCPREFIX)\libxml2\libxml mkdir $(INCPREFIX)\libxml2\libxml
        if not exist $(BINPREFIX) mkdir $(BINPREFIX)
        if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)
        if not exist $(SOPREFIX) mkdir $(SOPREFIX)
-       copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml
+       copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml2\libxml
        copy $(BINDIR)\$(XML_SO) $(SOPREFIX)
        copy $(BINDIR)\$(XML_A) $(LIBPREFIX)
        copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX)
diff --git a/xml2-config.in b/xml2-config.in
index 2989325..1957486 100644
--- a/xml2-config.in
+++ b/xml2-config.in
@@ -86,12 +86,12 @@ while test $# -gt 0; do
        then
            if [ "@XML_LIBDIR@" = "-L/usr/lib" -o "@XML_LIBDIR@" = "-L/usr/lib64" ]
            then
-               echo @XML_LIBS@ 
+               echo @XML_LIBS@ @MODULE_PLATFORM_LIBS@
            else
-               echo @XML_LIBDIR@ @XML_LIBS@ 
+               echo @XML_LIBDIR@ @XML_LIBS@ @MODULE_PLATFORM_LIBS@
            fi
        else
-           echo @XML_LIBDIR@ @XML_LIBS@ @WIN32_EXTRA_LIBADD@
+           echo @XML_LIBDIR@ @XML_LIBS@ @MODULE_PLATFORM_LIBS@ @WIN32_EXTRA_LIBADD@
        fi
                ;;

diff --git a/xmllint.c b/xmllint.c
index 3edeccb..8c1ca8a 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -169,7 +169,7 @@ static int nodefdtd = 0;
 #ifdef LIBXML_PUSH_ENABLED
 static int push = 0;
 #endif /* LIBXML_PUSH_ENABLED */
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
 static int memory = 0;
 #endif
 static int testIO = 0;
@@ -1823,7 +1823,7 @@ static void processNode(xmlTextReaderPtr reader) {
 static void streamFile(char *filename) {
     xmlTextReaderPtr reader;
     int ret;
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
     int fd = -1;
     struct stat info;
     const char *base = NULL;
@@ -1974,7 +1974,7 @@ static void streamFile(char *filename) {
        patstream = NULL;
     }
 #endif
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
     if (memory) {
         xmlFreeParserInputBuffer(input);
        munmap((char *) base, info.st_size);
@@ -2212,7 +2212,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
         }
     }
 #endif /* LIBXML_PUSH_ENABLED */
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
     else if ((html) && (memory)) {
        int fd;
        struct stat info;
@@ -2327,7 +2327,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
                if (rectxt == NULL)
                    xmlFreeParserCtxt(ctxt);
            }
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        } else if (memory) {
            int fd;
            struct stat info;
@@ -2591,7 +2591,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
                }
            } else
 #endif
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
            if (memory) {
                xmlChar *result;
                int len;
@@ -2619,7 +2619,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
                }

            } else
-#endif /* HAVE_SYS_MMAN_H */
+#endif /* HAVE_MMAP */
            if (compress) {
                xmlSaveFile(output ? output : "-", doc);
            } else if (oldout) {
@@ -3017,7 +3017,7 @@ static void usage(const char *name) {
 #ifdef LIBXML_PUSH_ENABLED
     printf("\t--push : use the push mode of the parser\n");
 #endif /* LIBXML_PUSH_ENABLED */
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
     printf("\t--memory : parse from memory\n");
 #endif
     printf("\t--maxmem nbbytes : limits memory allocation to nbbytes bytes\n");
@@ -3247,7 +3247,7 @@ main(int argc, char **argv) {
                 (!strcmp(argv[i], "--push")))
            push++;
 #endif /* LIBXML_PUSH_ENABLED */
-#ifdef HAVE_SYS_MMAN_H
+#ifdef HAVE_MMAP
        else if ((!strcmp(argv[i], "-memory")) ||
                 (!strcmp(argv[i], "--memory")))
            memory++;
diff --git a/xstc/Makefile.am b/xstc/Makefile.am
index 966a8de..5ef1819 100644
--- a/xstc/Makefile.am
+++ b/xstc/Makefile.am
@@ -118,7 +118,7 @@ pytests: $(PYSCRIPTS) $(TESTDIRS)

 tests:
        -@(if [ -x $(PYTHON) ] ; then                                   \
-          $(MAKE) MAKEFLAGS+=--silent pytests ; fi);
+          $(MAKE) pytests ; fi);

 #
 # Heavy, works well only on RHEL3
@@ -126,7 +126,7 @@ tests:
 valgrind:
        -@(if [ -x $(PYTHON) ] ; then                                   \
           echo '## Running the regression tests under Valgrind' ;      \
-          $(MAKE) CHECKER='valgrind -q' MAKEFLAGS+=--silent pytests ; fi);
+          $(MAKE) CHECKER='valgrind -q' pytests ; fi);

 CLEANFILES=$(PYSCRIPTS) test.log




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