cleanup, creating a new legacy.c module, made sure make tests ran in

* Makefile.am: cleanup, creating a new legacy.c module,
  made sure make tests ran in reduced conditions
* SAX.c SAX2.c configure.in entities.c globals.c parser.c
  parserInternals.c tree.c valid.c xlink.c xmlIO.c xmlcatalog.c
  xmlmemory.c xpath.c xmlmemory.c include/libxml/xmlversion.h.in:
  increased the modularization, allow to configure out
  validation code and legacy code, added a configuration
  option --with-minimum compiling only the mandatory code
  which then shrink to 200KB.
Daniel
diff --git a/valid.c b/valid.c
index 470f912..b1555a8 100644
--- a/valid.c
+++ b/valid.c
@@ -25,6 +25,10 @@
 #include <libxml/list.h>
 #include <libxml/globals.h>
 
+static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
+	                           int create);
+#ifdef LIBXML_VALID_ENABLED
+
 /* #define DEBUG_VALID_ALGO */
 /* #define DEBUG_REGEXP_ALGO */
 
@@ -449,8 +453,6 @@
    else if ((doc->intSubset == NULL) &&				\
 	    (doc->extSubset == NULL)) return(0)
 
-static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
-	                           int create);
 xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem);
 
 #ifdef LIBXML_REGEXP_ENABLED
@@ -709,6 +711,8 @@
     xmlFree(cur);
 }
 
+#endif /* LIBXML_VALID_ENABLED */
+
 /**
  * xmlNewElementContent:
  * @name:  the subelement name or NULL
@@ -1160,10 +1164,12 @@
     ret = xmlHashLookup2(table, name, ns);
     if (ret != NULL) {
 	if (ret->etype != XML_ELEMENT_TYPE_UNDEFINED) {
+#ifdef LIBXML_VALID_ENABLED
 	    /*
 	     * The element is already defined in this DTD.
 	     */
 	    VERROR(ctxt->userData, "Redefinition of element %s\n", name);
+#endif /* LIBXML_VALID_ENABLED */
 	    if (uqname != NULL)
 		xmlFree(uqname);
             if (ns != NULL)
@@ -1205,10 +1211,12 @@
 	 * Insertion must not fail
 	 */
 	if (xmlHashAddEntry2(table, name, ns, ret)) {
+#ifdef LIBXML_VALID_ENABLED
 	    /*
 	     * The element is already defined in this DTD.
 	     */
 	    VERROR(ctxt->userData, "Redefinition of element %s\n", name);
+#endif /* LIBXML_VALID_ENABLED */
 	    xmlFreeElement(ret);
 	    if (uqname != NULL)
 		xmlFree(uqname);
@@ -1472,6 +1480,7 @@
     return(xmlHashCreate(0));
 }
 
+#ifdef LIBXML_VALID_ENABLED
 /**
  * xmlScanAttributeDeclCallback:
  * @attr:  the attribute decl
@@ -1552,6 +1561,7 @@
     }
     return(ret);
 }
+#endif /* LIBXML_VALID_ENABLED */
 
 /**
  * xmlFreeAttribute:
@@ -1622,6 +1632,7 @@
 	return(NULL);
     }
 
+#ifdef LIBXML_VALID_ENABLED
     /*
      * Check the type and possibly the default value.
      */
@@ -1659,6 +1670,7 @@
 	defaultValue = NULL;
 	ctxt->valid = 0;
     }
+#endif /* LIBXML_VALID_ENABLED */
 
     /*
      * Check first that an attribute defined in the external subset wasn't
@@ -1713,12 +1725,14 @@
      * Search the DTD for previous declarations of the ATTLIST
      */
     if (xmlHashAddEntry3(table, name, ns, elem, ret) < 0) {
+#ifdef LIBXML_VALID_ENABLED
 	/*
 	 * The attribute is already defined in this DTD.
 	 */
 	VWARNING(ctxt->userData,
 		 "Attribute %s of element %s: already defined\n",
 		 name, elem);
+#endif /* LIBXML_VALID_ENABLED */
 	xmlFreeAttribute(ret);
 	return(NULL);
     }
@@ -1730,6 +1744,7 @@
     elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
     if (elemDef != NULL) {
 
+#ifdef LIBXML_VALID_ENABLED
         if ((type == XML_ATTRIBUTE_ID) &&
 	    (xmlScanIDAttributeDecl(NULL, elemDef) != 0)) {
 	    VERROR(ctxt->userData, 
@@ -1737,6 +1752,7 @@
 		   elem, name);
 	    ctxt->valid = 0;
 	}
+#endif /* LIBXML_VALID_ENABLED */
 
 	/*
 	 * Insert namespace default def first they need to be
@@ -2040,8 +2056,10 @@
      * Check the DTD for previous declarations of the ATTLIST
      */
     if (xmlHashAddEntry(table, name, ret)) {
+#ifdef LIBXML_VALID_ENABLED
 	xmlGenericError(xmlGenericErrorContext,
 		"xmlAddNotationDecl: %s already defined\n", name);
+#endif /* LIBXML_VALID_ENABLED */
 	xmlFreeNotation(ret);
 	return(NULL);
     }
@@ -2246,6 +2264,7 @@
     ret->lineno = xmlGetLineNo(attr->parent);
 
     if (xmlHashAddEntry(table, value, ret) < 0) {
+#ifdef LIBXML_VALID_ENABLED
 	/*
 	 * The id is already defined in this DTD.
 	 */
@@ -2253,6 +2272,7 @@
 	    VECTXT(ctxt, attr->parent);
 	    VERROR(ctxt->userData, "ID %s already defined\n", value);
 	}
+#endif /* LIBXML_VALID_ENABLED */
 	xmlFreeID(ret);
 	return(NULL);
     }
@@ -2920,6 +2940,7 @@
     return(xmlHashLookup(table, name));
 }
 
+#ifdef LIBXML_VALID_ENABLED
 /**
  * xmlValidateNotationUse:
  * @ctxt:  the validation context
@@ -2949,6 +2970,7 @@
     }
     return(1);
 }
+#endif /* LIBXML_VALID_ENABLED */
 
 /**
  * xmlIsMixedElement:
@@ -2988,6 +3010,7 @@
     return(1);
 }
 
+#ifdef LIBXML_VALID_ENABLED
 /**
  * xmlValidateNameValue:
  * @value:  an Name value
@@ -6295,7 +6318,6 @@
     return(ret);
 }
 
-
 /************************************************************************
  *									*
  *		Routines for dynamic validation editing			*
@@ -6473,3 +6495,5 @@
 
     return(nb_valid_elements);
 }
+#endif /* LIBXML_VALID_ENABLED */
+