fixing compilation bug with some options disabled as well as

* debugXML.c testHTML.c tree.c doc/examples/*.c
  include/libxml/xmlsave.h: fixing compilation bug with some options
  disabled as well as --with-minimum should fix #134695
Daniel
diff --git a/ChangeLog b/ChangeLog
index 3aed4ae..6fb9522 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar  4 16:57:50 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+	* debugXML.c testHTML.c tree.c doc/examples/*.c
+	  include/libxml/xmlsave.h: fixing compilation bug with some options
+	  disabled as well as --with-minimum should fix #134695
+
 Thu Mar  4 15:00:45 CET 2004 Daniel Veillard <daniel@veillard.com>
 
 	* xmlcatalog.c: allow fallback to URI lookup when SYSTEM fails,
diff --git a/debugXML.c b/debugXML.c
index 25c1d15..0da87e5 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -1538,6 +1538,7 @@
     return (0);
 }
 
+#ifdef XML_TREE_ENABLED
 /**
  * xmlShellSetBase:
  * @ctxt:  the shell context
@@ -1558,6 +1559,7 @@
     xmlNodeSetBase(node, (xmlChar*) arg);
     return (0);
 }
+#endif
 
 /**
  * xmlShellGrep:
@@ -2306,8 +2308,10 @@
 		xmlXPathFreeObject(list);
 	    }
 #endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_TREE_ENABLED
         } else if (!strcmp(command, "setbase")) {
             xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
+#endif
         } else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) {
             int dir = (!strcmp(command, "dir"));
 
diff --git a/doc/examples/io1.c b/doc/examples/io1.c
index b505f80..c8a47e3 100644
--- a/doc/examples/io1.c
+++ b/doc/examples/io1.c
@@ -18,6 +18,7 @@
 #include <libxml/xinclude.h>
 #include <libxml/xmlIO.h>
 
+#ifdef LIBXML_XINCLUDE_ENABLED
 static const char *result = "<list><people>a</people><people>b</people></list>";
 static const char *cur = NULL;
 static int rlen;
@@ -125,6 +126,7 @@
         fprintf(stderr, "failed to parse the including file\n");
 	exit(1);
     }
+
     /*
      * apply the XInclude process, this should trigger the I/O just
      * registered.
@@ -133,10 +135,14 @@
         fprintf(stderr, "XInclude processing failed\n");
 	exit(1);
     }
+
+#ifdef LIBXML_OUTPUT_ENABLED
     /*
      * save the output for checking to stdout
      */
     xmlDocDump(stdout, doc);
+#endif
+
     /*
      * Free the document
      */
@@ -152,3 +158,9 @@
     xmlMemoryDump();
     return(0);
 }
+#else
+int main(void) {
+    fprintf(stderr, "XInclude support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/reader1.c b/doc/examples/reader1.c
index 2ae7f4d..90db2a1 100644
--- a/doc/examples/reader1.c
+++ b/doc/examples/reader1.c
@@ -14,6 +14,8 @@
 #include <stdio.h>
 #include <libxml/xmlreader.h>
 
+#ifdef LIBXML_READER_ENABLED
+
 /**
  * processNode:
  * @reader: the xmlReader
@@ -96,3 +98,10 @@
     xmlMemoryDump();
     return(0);
 }
+
+#else
+int main(void) {
+    fprintf(stderr, "XInclude support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/reader2.c b/doc/examples/reader2.c
index cd0b995..c32ada5 100644
--- a/doc/examples/reader2.c
+++ b/doc/examples/reader2.c
@@ -15,6 +15,8 @@
 #include <stdio.h>
 #include <libxml/xmlreader.h>
 
+#ifdef LIBXML_READER_ENABLED
+
 /**
  * processNode:
  * @reader: the xmlReader
@@ -111,3 +113,10 @@
     xmlMemoryDump();
     return(0);
 }
+
+#else
+int main(void) {
+    fprintf(stderr, "XInclude support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/reader3.c b/doc/examples/reader3.c
index d5475f6..2da7532 100644
--- a/doc/examples/reader3.c
+++ b/doc/examples/reader3.c
@@ -15,6 +15,8 @@
 #include <stdio.h>
 #include <libxml/xmlreader.h>
 
+#ifdef LIBXML_READER_ENABLED
+
 /**
  * streamFile:
  * @filename: the file name to parse
@@ -108,3 +110,10 @@
     xmlMemoryDump();
     return(0);
 }
+
+#else
+int main(void) {
+    fprintf(stderr, "XInclude support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c
index c6bb41a..02f9eb7 100644
--- a/doc/examples/testWriter.c
+++ b/doc/examples/testWriter.c
@@ -16,6 +16,8 @@
 #include <libxml/encoding.h>
 #include <libxml/xmlwriter.h>
 
+#if defined(LIBXML_WRITER_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
+
 #define MY_ENCODING "ISO-8859-1"
 
 void testXmlwriterFilename(const char *uri);
@@ -1187,3 +1189,10 @@
 
     return out;
 }
+
+#else
+int main(void) {
+    fprintf(stderr, "Writer or output support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/tree1.c b/doc/examples/tree1.c
index 7942fc6..8a303e2 100644
--- a/doc/examples/tree1.c
+++ b/doc/examples/tree1.c
@@ -13,6 +13,8 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
+#ifdef LIBXML_TREE_ENABLED
+
 /*
  *To compile this file using gcc you can type
  *gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c
@@ -84,3 +86,9 @@
 
     return 0;
 }
+#else
+int main(void) {
+    fprintf(stderr, "Tree support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/tree2.c b/doc/examples/tree2.c
index 196ffb4..3ab2179 100644
--- a/doc/examples/tree2.c
+++ b/doc/examples/tree2.c
@@ -12,6 +12,8 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
+#ifdef LIBXML_TREE_ENABLED
+
 /*
  *To compile this file using gcc you can type
  *gcc `xml2-config --cflags --libs` -o tree2 tree2.c
@@ -108,3 +110,9 @@
     xmlMemoryDump();
     return(0);
 }
+#else
+int main(void) {
+    fprintf(stderr, "tree support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/doc/examples/xpath1.c b/doc/examples/xpath1.c
index 2629c3d..0e49737 100644
--- a/doc/examples/xpath1.c
+++ b/doc/examples/xpath1.c
@@ -17,6 +17,9 @@
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
 
+#ifdef LIBXML_XPATH_ENABLED
+
+
 void usage(const char *name);
 int  execute_xpath_expression(const char* filename, const xmlChar* xpathExpr, const xmlChar* nsList);
 int  register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList);
@@ -238,3 +241,9 @@
     }
 }
 
+#else
+int main(void) {
+    fprintf(stderr, "XPath support not compiled in\n");
+    exit(1);
+}
+#endif
diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h
index f783ffd..1d43a71 100644
--- a/include/libxml/xmlsave.h
+++ b/include/libxml/xmlsave.h
@@ -14,6 +14,7 @@
 #include <libxml/tree.h>
 #include <libxml/xmlIO.h>
 
+#ifdef LIBXML_OUTPUT_ENABLED
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -54,6 +55,7 @@
 #ifdef __cplusplus
 }
 #endif
+#endif /* LIBXML_OUTPUT_ENABLED */
 #endif /* __XML_XMLSAVE_H__ */
 
 
diff --git a/testHTML.c b/testHTML.c
index cd3516e..c913bb3 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -704,7 +704,7 @@
 
 static void
 parseAndPrintFile(char *filename) {
-    htmlDocPtr doc = NULL, tmp;
+    htmlDocPtr doc = NULL;
 
     /*
      * build an HTML tree from a string;
@@ -745,14 +745,18 @@
 		"Could not parse %s\n", filename);
     }
 
+#ifdef LIBXML_TREE_ENABLED
     /*
      * test intermediate copy if needed.
      */
     if (copy) {
+        htmlDocPtr tmp;
+
         tmp = doc;
 	doc = xmlCopyDoc(doc, 1);
 	xmlFreeDoc(tmp);
     }
+#endif
 
 #ifdef LIBXML_OUTPUT_ENABLED
     /*
diff --git a/tree.c b/tree.c
index 330197d..bd18fb6 100644
--- a/tree.c
+++ b/tree.c
@@ -321,7 +321,6 @@
     return(&name[l+1]);
 }
 
-#ifdef LIBXML_TREE_ENABLED
 /************************************************************************
  *									*
  *		Check Name, NCName and QName strings			*
@@ -330,6 +329,7 @@
  
 #define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
 
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 /**
  * xmlValidateNCName:
  * @value: the value to check
@@ -398,7 +398,9 @@
 
     return(0);
 }
+#endif
 
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 /**
  * xmlValidateQName:
  * @value: the value to check
@@ -1669,7 +1671,7 @@
 }
 #endif /* LIBXML_TREE_ENABLED */
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED)
 /**
  * xmlNewProp:
  * @node:  the holding node
@@ -2716,7 +2718,7 @@
     }
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 /**
  * xmlNewChild:
  * @parent:  the parent node
@@ -2874,7 +2876,7 @@
     return(elem);
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED)
 /**
  * xmlAddPrevSibling:
  * @cur:  the child node
@@ -3427,7 +3429,7 @@
     cur->next = cur->prev = NULL;
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
 /**
  * xmlReplaceNode:
  * @old:  the old node
@@ -3933,7 +3935,7 @@
     return(ret);
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED)
 /**
  * xmlCopyDtd:
  * @dtd:  the dtd
@@ -4018,7 +4020,9 @@
 
     return(ret);
 }
+#endif
 
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 /**
  * xmlCopyDoc:
  * @doc:  the document
@@ -4047,11 +4051,13 @@
 
     ret->last = NULL;
     ret->children = NULL;
+#ifdef LIBXML_TREE_ENABLED
     if (doc->intSubset != NULL) {
         ret->intSubset = xmlCopyDtd(doc->intSubset);
 	xmlSetTreeDoc((xmlNodePtr)ret->intSubset, ret);
 	ret->intSubset->parent = ret;
     }
+#endif
     if (doc->oldNs != NULL)
         ret->oldNs = xmlCopyNamespaceList(doc->oldNs);
     if (doc->children != NULL) {
@@ -4107,7 +4113,7 @@
     return result;
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
 /**
  * xmlGetNodePath:
  * @node: a node
@@ -4348,7 +4354,7 @@
     return(ret);
 }
  
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
 /**
  * xmlDocSetRootElement:
  * @doc:  the document
@@ -4387,7 +4393,9 @@
     }
     return(old);
 }
+#endif
  
+#if defined(LIBXML_TREE_ENABLED)
 /**
  * xmlNodeSetLang:
  * @cur:  the node being changed
@@ -4588,7 +4596,9 @@
     if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
     cur->name = xmlStrdup(name);
 }
+#endif
  
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
 /**
  * xmlNodeSetBase:
  * @cur:  the node being changed
@@ -5245,7 +5255,7 @@
     return(first);
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED)
 /**
  * xmlGetNsList:
  * @doc:  the document
@@ -6121,7 +6131,75 @@
     return(NULL);
 }
 
-#ifdef LIBXML_TREE_ENABLED
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+/**
+ * xmlUnsetProp:
+ * @node:  the node
+ * @name:  the attribute name
+ *
+ * Remove an attribute carried by a node.
+ * Returns 0 if successful, -1 if not found
+ */
+int
+xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
+    xmlAttrPtr prop, prev = NULL;;
+
+    if ((node == NULL) || (name == NULL))
+	return(-1);
+    prop = node->properties;
+    while (prop != NULL) {
+        if ((xmlStrEqual(prop->name, name)) &&
+	    (prop->ns == NULL)) {
+	    if (prev == NULL)
+		node->properties = prop->next;
+	    else
+		prev->next = prop->next;
+	    xmlFreeProp(prop);
+	    return(0);
+	}
+	prev = prop;
+	prop = prop->next;
+    }
+    return(-1);
+}
+
+/**
+ * xmlUnsetNsProp:
+ * @node:  the node
+ * @ns:  the namespace definition
+ * @name:  the attribute name
+ *
+ * Remove an attribute carried by a node.
+ * Returns 0 if successful, -1 if not found
+ */
+int
+xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
+    xmlAttrPtr prop = node->properties, prev = NULL;;
+
+    if ((node == NULL) || (name == NULL))
+	return(-1);
+    if (ns == NULL)
+	return(xmlUnsetProp(node, name));
+    if (ns->href == NULL)
+	return(-1);
+    while (prop != NULL) {
+        if ((xmlStrEqual(prop->name, name)) &&
+	    (prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
+	    if (prev == NULL)
+		node->properties = prop->next;
+	    else
+		prev->next = prop->next;
+	    xmlFreeProp(prop);
+	    return(0);
+	}
+	prev = prop;
+	prop = prop->next;
+    }
+    return(-1);
+}
+#endif
+
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
 /**
  * xmlSetProp:
  * @node:  the node
@@ -6176,37 +6254,6 @@
 }
 
 /**
- * xmlUnsetProp:
- * @node:  the node
- * @name:  the attribute name
- *
- * Remove an attribute carried by a node.
- * Returns 0 if successful, -1 if not found
- */
-int
-xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
-    xmlAttrPtr prop, prev = NULL;;
-
-    if ((node == NULL) || (name == NULL))
-	return(-1);
-    prop = node->properties;
-    while (prop != NULL) {
-        if ((xmlStrEqual(prop->name, name)) &&
-	    (prop->ns == NULL)) {
-	    if (prev == NULL)
-		node->properties = prop->next;
-	    else
-		prev->next = prop->next;
-	    xmlFreeProp(prop);
-	    return(0);
-	}
-	prev = prop;
-	prop = prop->next;
-    }
-    return(-1);
-}
-
-/**
  * xmlSetNsProp:
  * @node:  the node
  * @ns:  the namespace definition
@@ -6269,40 +6316,6 @@
     return(prop);
 }
 
-/**
- * xmlUnsetNsProp:
- * @node:  the node
- * @ns:  the namespace definition
- * @name:  the attribute name
- *
- * Remove an attribute carried by a node.
- * Returns 0 if successful, -1 if not found
- */
-int
-xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
-    xmlAttrPtr prop = node->properties, prev = NULL;;
-
-    if ((node == NULL) || (name == NULL))
-	return(-1);
-    if (ns == NULL)
-	return(xmlUnsetProp(node, name));
-    if (ns->href == NULL)
-	return(-1);
-    while (prop != NULL) {
-        if ((xmlStrEqual(prop->name, name)) &&
-	    (prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
-	    if (prev == NULL)
-		node->properties = prop->next;
-	    else
-		prev->next = prop->next;
-	    xmlFreeProp(prop);
-	    return(0);
-	}
-	prev = prop;
-	prop = prop->next;
-    }
-    return(-1);
-}
 #endif /* LIBXML_TREE_ENABLED */
 
 /**