1## Process this file with automake to produce Makefile.in
2
3ACLOCAL_AMFLAGS = -I m4
4
5SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR)
6
7DIST_SUBDIRS = include . doc example python xstc
8
9AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
10
11AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
12
13noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
14                testThreads testC14N testAutomata testRegexp \
15                testReader testapi testModule runtest runsuite testchar \
16		testdict runxmlconf testrecurse testlimits
17
18bin_PROGRAMS = xmllint xmlcatalog
19
20bin_SCRIPTS=xml2-config
21
22lib_LTLIBRARIES = libxml2.la
23libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
24
25if USE_VERSION_SCRIPT
26LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
27else
28LIBXML2_VERSION_SCRIPT =
29endif
30
31libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \
32		     $(LIBXML2_VERSION_SCRIPT) \
33		     -version-info $(LIBXML_VERSION_INFO) \
34		     $(MODULE_PLATFORM_LIBS)
35
36if WITH_SAX1_SOURCES
37docb_sources = DOCBparser.c
38else
39docb_sources =
40endif
41
42if WITH_TRIO_SOURCES
43trio_sources = triostr.c trio.c
44else
45trio_sources =
46endif
47
48libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
49		parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c  \
50		valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c  \
51		xpointer.c xinclude.c nanohttp.c nanoftp.c \
52		$(docb_sources) \
53		catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \
54		xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
55		$(trio_sources) \
56		xmlreader.c relaxng.c dict.c SAX2.c \
57		xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
58		xmlmodule.c schematron.c xzlib.c
59
60DEPS = $(top_builddir)/libxml2.la
61LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
62
63
64man_MANS = xml2-config.1 libxml.3
65
66m4datadir = $(datadir)/aclocal
67m4data_DATA = libxml.m4
68
69runtest_SOURCES=runtest.c
70runtest_LDFLAGS = 
71runtest_DEPENDENCIES = $(DEPS)
72runtest_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
73
74testrecurse_SOURCES=testrecurse.c
75testrecurse_LDFLAGS = 
76testrecurse_DEPENDENCIES = $(DEPS)
77testrecurse_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
78
79testlimits_SOURCES=testlimits.c
80testlimits_LDFLAGS = 
81testlimits_DEPENDENCIES = $(DEPS)
82testlimits_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
83
84testchar_SOURCES=testchar.c
85testchar_LDFLAGS = 
86testchar_DEPENDENCIES = $(DEPS)
87testchar_LDADD= $(RDL_LIBS) $(LDADDS)
88
89testdict_SOURCES=testdict.c
90testdict_LDFLAGS = 
91testdict_DEPENDENCIES = $(DEPS)
92testdict_LDADD= $(RDL_LIBS) $(LDADDS)
93
94runsuite_SOURCES=runsuite.c
95runsuite_LDFLAGS = 
96runsuite_DEPENDENCIES = $(DEPS)
97runsuite_LDADD= $(RDL_LIBS) $(LDADDS)
98
99xmllint_SOURCES=xmllint.c
100xmllint_LDFLAGS = 
101xmllint_DEPENDENCIES = $(DEPS)
102xmllint_LDADD=  $(RDL_LIBS) $(LDADDS)
103
104testSAX_SOURCES=testSAX.c
105testSAX_LDFLAGS = 
106testSAX_DEPENDENCIES = $(DEPS)
107testSAX_LDADD= $(LDADDS)
108
109testHTML_SOURCES=testHTML.c
110testHTML_LDFLAGS = 
111testHTML_DEPENDENCIES = $(DEPS)
112testHTML_LDADD= $(LDADDS)
113
114xmlcatalog_SOURCES=xmlcatalog.c
115xmlcatalog_LDFLAGS = 
116xmlcatalog_DEPENDENCIES = $(DEPS)
117xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
118
119testXPath_SOURCES=testXPath.c
120testXPath_LDFLAGS = 
121testXPath_DEPENDENCIES = $(DEPS)
122testXPath_LDADD= $(LDADDS)
123
124testC14N_SOURCES=testC14N.c
125testC14N_LDFLAGS = 
126testC14N_DEPENDENCIES = $(DEPS)
127testC14N_LDADD= $(LDADDS)
128
129if THREADS_W32
130testThreads_SOURCES = testThreadsWin32.c
131else
132testThreads_SOURCES = testThreads.c
133endif
134testThreads_LDFLAGS = 
135testThreads_DEPENDENCIES = $(DEPS)
136testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS)
137
138testURI_SOURCES=testURI.c
139testURI_LDFLAGS = 
140testURI_DEPENDENCIES = $(DEPS)
141testURI_LDADD= $(LDADDS)
142
143testRegexp_SOURCES=testRegexp.c
144testRegexp_LDFLAGS = 
145testRegexp_DEPENDENCIES = $(DEPS)
146testRegexp_LDADD= $(LDADDS)
147
148testAutomata_SOURCES=testAutomata.c
149testAutomata_LDFLAGS = 
150testAutomata_DEPENDENCIES = $(DEPS)
151testAutomata_LDADD= $(LDADDS)
152
153testSchemas_SOURCES=testSchemas.c
154testSchemas_LDFLAGS = 
155testSchemas_DEPENDENCIES = $(DEPS)
156testSchemas_LDADD= $(LDADDS)
157
158testRelax_SOURCES=testRelax.c
159testRelax_LDFLAGS = 
160testRelax_DEPENDENCIES = $(DEPS)
161testRelax_LDADD= $(LDADDS)
162
163testReader_SOURCES=testReader.c
164testReader_LDFLAGS = 
165testReader_DEPENDENCIES = $(DEPS)
166testReader_LDADD= $(LDADDS)
167
168testModule_SOURCES=testModule.c
169testModule_LDFLAGS = 
170testModule_DEPENDENCIES = $(DEPS)
171testModule_LDADD= $(LDADDS)
172
173noinst_LTLIBRARIES = testdso.la
174testdso_la_SOURCES = testdso.c
175testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
176
177# that one forces the rebuild when "make rebuild" is run on doc/
178rebuild_testapi:
179	-@(if [ "$(PYTHON)" != "" ] ; then \
180	    $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
181
182# that one is just to make sure it is rebuilt if missing
183# but adding the dependances generate mess
184testapi.c: $(srcdir)/gentest.py
185	-@(if [ "$(PYTHON)" != "" ] ; then \
186	    $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
187
188BUILT_SOURCES = testapi.c
189
190testapi_SOURCES=testapi.c
191testapi_LDFLAGS = 
192testapi_DEPENDENCIES = $(DEPS)
193testapi_LDADD= $(LDADDS)
194
195runxmlconf_SOURCES=runxmlconf.c
196runxmlconf_LDFLAGS = 
197runxmlconf_DEPENDENCIES = $(DEPS)
198runxmlconf_LDADD= $(LDADDS)
199
200#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
201#testOOM_LDFLAGS = 
202#testOOM_DEPENDENCIES = $(DEPS)
203#testOOM_LDADD= $(LDADDS)
204
205runtests:
206	[ -d test   ] || $(LN_S) $(srcdir)/test   .
207	[ -d result ] || $(LN_S) $(srcdir)/result .
208	$(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
209	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
210	    $(MAKE) tests ; fi)
211
212check: all runtests
213
214check-valgrind valgrind: all
215	@echo '## Running the regression tests under Valgrind'
216	@echo '## Go get a cup of coffee it is gonna take a while ...'
217	$(MAKE) CHECKER='valgrind -q' runtests
218
219testall : tests SVGtests SAXtests
220
221tests: 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)
222	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
223	    $(MAKE) tests ; fi)
224	@(cd doc/examples ; $(MAKE) tests)
225
226APItests: testapi$(EXEEXT)
227	@echo "## Running the API regression tests this may take a little while"
228	-@($(CHECKER) $(top_builddir)/testapi -q)
229
230HTMLtests : testHTML$(EXEEXT)
231	@(echo > .memdump)
232	@echo "## HTML regression tests"
233	-@(for i in $(srcdir)/test/HTML/* ; do \
234	  name=`basename $$i`; \
235	  if [ ! -d $$i ] ; then \
236	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
237	      echo New test file $$name ; \
238	      $(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
239	  else \
240	      log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
241	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
242	      diff $(srcdir)/result/HTML/$$name result.$$name ; \
243	      diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \
244	      $(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \
245	      diff result.$$name result2.$$name` ; \
246	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
247	      rm result.$$name result2.$$name error.$$name ; \
248	  fi ; fi ; done)
249
250HTMLPushtests : testHTML$(EXEEXT)
251	@echo "## Push HTML regression tests"
252	-@(for i in $(srcdir)/test/HTML/* ; do \
253	  name=`basename $$i`; \
254	  if [ ! -d $$i ] ; then \
255	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
256	      echo New test file $$name ; \
257	      $(CHECKER) $(top_builddir)/testHTML --push $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
258	  else \
259	      log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
260	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
261	      diff $(srcdir)/result/HTML/$$name result.$$name ; \
262	      cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \
263	      cut -b 1-15 error.$$name > errorcut2.$$name; \
264	      diff -b errorcut.$$name errorcut2.$$name ; \
265	      $(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \
266	      diff result.$$name result2.$$name` ; \
267	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
268	      rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \
269	  fi ; fi ; done)
270	@echo "## HTML SAX regression tests"
271	-@(for i in $(srcdir)/test/HTML/* ; do \
272	  name=`basename $$i`; \
273	  if [ ! -d $$i ] ; then \
274	  if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \
275	      echo New test file $$name ; \
276	      $(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
277	  else \
278	      log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
279	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
280	      diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
281	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
282	      rm result.$$name.sax ; \
283	  fi ; fi ; done)
284	@echo "## Push HTML SAX regression tests"
285	-@(for i in $(srcdir)/test/HTML/* ; do \
286	  name=`basename $$i`; \
287	  if [ ! -d $$i ] ; then \
288	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
289	      echo New test file $$name ; \
290	      $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
291	  else \
292	      log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \
293	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
294	      diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
295	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
296	      rm result.$$name.sax ; \
297	  fi ; fi ; done)
298
299XMLtests : xmllint$(EXEEXT)
300	@(echo > .memdump)
301	@echo "## XML regression tests"
302	-@(for i in $(srcdir)/test/* ; do \
303	  name=`basename $$i`; \
304	  if [ ! -d $$i ] ; then \
305	  if [ ! -f $(srcdir)/result/$$name ] ; then \
306	      echo New test file $$name ; \
307	      $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \
308	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
309	  else \
310	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \
311	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
312	      diff $(srcdir)/result/$$name result.$$name ; \
313	      $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
314	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
315	      diff result.$$name result2.$$name` ;\
316	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
317	      rm result.$$name result2.$$name ; \
318	  fi ; fi ; done)
319	@echo "## XML regression tests on memory"
320	-@(for i in $(srcdir)/test/* ; do \
321	  name=`basename $$i`; \
322	  if [ ! -d $$i ] ; then \
323	  if [ ! -f $(srcdir)/result/$$name ] ; then \
324	      echo New test file $$name ; \
325	      $(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \
326	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
327	  else \
328	      log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \
329	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
330	      diff $(srcdir)/result/$$name result.$$name ; \
331	      $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
332	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"`; \
333	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
334	      diff result.$$name result2.$$name ; \
335	      rm result.$$name result2.$$name ; \
336	  fi ; fi ; done)
337
338XMLPushtests: xmllint$(EXEEXT)
339	@(echo > .memdump)
340	@echo "## XML push regression tests"
341	-@(for i in $(srcdir)/test/* ; do \
342	  name=`basename $$i`; \
343	  if [ ! -d $$i ] ; then \
344	  if [ ! -f $(srcdir)/result/$$name ] ; then \
345	      echo New test file $$name ; \
346	      $(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \
347	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
348	  else \
349	      log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \
350	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
351	      diff $(srcdir)/result/$$name result.$$name ; \
352	      $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
353	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
354	      diff result.$$name result2.$$name` ; \
355	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
356	      rm result.$$name result2.$$name ; \
357	  fi ; fi ; done)
358
359NStests : xmllint$(EXEEXT)
360	@(echo > .memdump)
361	@echo "## XML Namespaces regression tests"
362	-@(for i in $(srcdir)/test/namespaces/* ; do \
363	  name=`basename $$i`; \
364	  if [ ! -d $$i ] ; then \
365	  if [ ! -f $(srcdir)/result/namespaces/$$name ] ; then \
366	      echo New test file $$name ; \
367	      $(CHECKER) $(top_builddir)/xmllint $$i \
368	         2> $(srcdir)/result/namespaces/$$name.err \
369		 > $(srcdir)/result/namespaces/$$name ; \
370	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
371	  else \
372	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
373	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
374	      diff $(srcdir)/result/namespaces/$$name result.$$name ; \
375	      diff $(srcdir)/result/namespaces/$$name.err error.$$name`; \
376	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
377	      rm result.$$name error.$$name ; \
378	  fi ; fi ; done)
379
380IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT)
381	@(echo > .memdump)
382	@echo "## xml:id regression tests"
383	-@(for i in $(srcdir)/test/xmlid/id_*.xml ; do \
384	  name=`basename $$i`; \
385	  if [ ! -d $$i ] ; then \
386	  if [ ! -f $(srcdir)/result/xmlid/$$name ] ; then \
387	      echo New test file $$name ; \
388	      $(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" \
389	         2> $(srcdir)/result/xmlid/$$name.err \
390		 > $(srcdir)/result/xmlid/$$name ; \
391	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
392	  else \
393	      log=`$(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" 2> error.$$name > result.$$name ; \
394	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
395	      diff $(srcdir)/result/xmlid/$$name result.$$name ; \
396	      diff $(srcdir)/result/xmlid/$$name.err error.$$name` ; \
397	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
398	      rm result.$$name error.$$name ; \
399	  fi ; fi ; done)
400
401Errtests : xmllint$(EXEEXT)
402	@(echo > .memdump)
403	@echo "## Error cases regression tests"
404	-@(for i in $(srcdir)/test/errors/*.xml ; do \
405	  name=`basename $$i`; \
406	  if [ ! -d $$i ] ; then \
407	  if [ ! -f $(srcdir)/result/errors/$$name ] ; then \
408	      echo New test file $$name ; \
409	      $(CHECKER) $(top_builddir)/xmllint $$i \
410	         2> $(srcdir)/result/errors/$$name.err \
411		 > $(srcdir)/result/errors/$$name ; \
412	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
413	  else \
414	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
415	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
416	      diff $(srcdir)/result/errors/$$name result.$$name ; \
417	      diff $(srcdir)/result/errors/$$name.err error.$$name` ; \
418	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
419	      rm result.$$name error.$$name ; \
420	  fi ; fi ; done)
421	@echo "## Error cases stream regression tests"
422	-@(for i in $(srcdir)/test/errors/*.xml ; do \
423	  name=`basename $$i`; \
424	  if [ ! -d $$i ] ; then \
425	  if [ ! -f $(srcdir)/result/errors/$$name.str ] ; then \
426	      echo New test file $$name ; \
427	      $(CHECKER) $(top_builddir)/xmllint --stream $$i \
428	         2> $(srcdir)/result/errors/$$name.str \
429		 > /dev/null ; \
430	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
431	  else \
432	      log=`$(CHECKER) $(top_builddir)/xmllint --stream $$i 2> error.$$name > /dev/null ; \
433	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
434	      diff $(srcdir)/result/errors/$$name.str error.$$name` ; \
435	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
436	      rm error.$$name ; \
437	  fi ; fi ; done)
438
439Docbtests : xmllint$(EXEEXT)
440
441XMLenttests : xmllint$(EXEEXT)
442	@(echo > .memdump)
443	@echo "## XML entity subst regression tests"
444	-@(for i in $(srcdir)/test/* ; do \
445	  name=`basename $$i`; \
446	  if [ ! -d $$i ] ; then \
447	  if [ ! -f $(srcdir)/result/noent/$$name ] ; then \
448	      echo New test file $$name ; \
449	      $(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \
450	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
451	  else \
452	      log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \
453	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
454	      diff $(srcdir)/result/noent/$$name result.$$name ; \
455	      $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \
456	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
457	      diff result.$$name result2.$$name` ; \
458	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
459	      rm result.$$name result2.$$name ; \
460	  fi ; fi ; done)
461
462URItests : testURI$(EXEEXT)
463	@(echo > .memdump)
464	@echo "## URI module regression tests"
465	-@(for i in $(srcdir)/test/URI/*.data ; do \
466	  name=`basename $$i`; \
467	  if [ ! -d $$i ] ; then \
468	  if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
469	      echo New test file $$name ; \
470	      $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \
471	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
472	  else \
473	      log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \
474	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
475	      diff $(srcdir)/result/URI/$$name result.$$name` ; \
476	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
477	      rm result.$$name ; \
478	  fi ; fi ; done)
479	-@(for i in $(srcdir)/test/URI/*.uri ; do \
480	  name=`basename $$i`; \
481	  if [ ! -d $$i ] ; then \
482	  if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
483	      echo New test file $$name ; \
484	      $(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \
485	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
486	  else \
487	      log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \
488	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
489	      diff $(srcdir)/result/URI/$$name result.$$name` ; \
490	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
491	      rm result.$$name ; \
492	  fi ; fi ; done)
493
494XPathtests : testXPath$(EXEEXT)
495	@(echo > .memdump)
496	@echo "## XPath regression tests"
497	-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
498	  then echo Skipping debug not compiled in ; exit 0 ; fi ; \
499	  for i in $(srcdir)/test/XPath/expr/* ; do \
500	  name=`basename $$i`; \
501	  if [ ! -d $$i ] ; then \
502	  if [ ! -f $(srcdir)/result/XPath/expr/$$name ] ; then \
503	      echo New test file $$name ; \
504	      $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name ; \
505	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
506	  else \
507	      log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i 2>&1 > result.$$name ; \
508	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
509	      diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \
510	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
511	      rm result.$$name ; \
512	  fi ; fi ; done ; \
513	  for i in $(srcdir)/test/XPath/docs/* ; do \
514	  if [ ! -d $$i ] ; then \
515	  doc=`basename $$i`; \
516	  for j in $(srcdir)/test/XPath/tests/$$doc* ; do \
517	  if [ ! -f $$j ] ; then continue ; fi ; \
518	  name=`basename $$j`; \
519	  if [ ! -d $$j ] ; then \
520	  if [ ! -f $(srcdir)/result/XPath/tests/$$name ] ; then \
521	      echo New test file $$name ; \
522	      $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \
523	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
524	  else \
525	      log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j 2>&1 > result.$$name ; \
526	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
527	      diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \
528	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
529	      rm result.$$name ; \
530	  fi ; fi ; done ; fi ; done)
531
532XPtrtests : testXPath$(EXEEXT)
533	@(echo > .memdump)
534	@echo "## XPointer regression tests"
535	-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
536	  then echo Skipping debug not compiled in ; exit 0 ; fi ; \
537	  for i in $(srcdir)/test/XPath/docs/* ; do \
538	  if [ ! -d $$i ] ; then \
539	  doc=`basename $$i`; \
540	  for j in $(srcdir)/test/XPath/xptr/$$doc* ; do \
541	  if [ ! -f $$j ] ; then continue ; fi ; \
542	  name=`basename $$j`; \
543	  if [ ! -d $$j ] ; then \
544	  if [ ! -f $(srcdir)/result/XPath/xptr/$$name ] ; then \
545	      echo New test file $$name ; \
546	      $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name ; \
547	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
548	  else \
549	      log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j 2>&1 > result.$$name ; \
550	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
551	      diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \
552	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
553	      rm result.$$name ; \
554	  fi ; fi ; done ; fi ; done)
555
556XIncludetests : xmllint$(EXEEXT)
557	@(echo > .memdump)
558	@echo "## XInclude regression tests"
559	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
560	  name=`basename $$i`; \
561	  if [ ! -d $$i ] ; then \
562	  if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
563	      echo New test file $$name ; \
564	      $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
565	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
566	  else \
567	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name ; \
568	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
569	      diff $(srcdir)/result/XInclude/$$name result.$$name ; \
570	      diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
571	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
572	      rm result.$$name error.$$name ; \
573	  fi ; fi ; done)
574	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
575	  name=`basename $$i`; \
576	  if [ ! -d $$i ] ; then \
577	  if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
578	      echo New test file $$name ; \
579	      $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
580	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
581	  else \
582	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > result.$$name 2>error.$$name ; \
583	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
584	      diff $(srcdir)/result/XInclude/$$name result.$$name ; \
585	      diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
586	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
587	      rm result.$$name error.$$name ; \
588	  fi ; fi ; done)
589	@(echo > .memdump)
590	@echo "## XInclude xmlReader regression tests"
591	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
592	  name=`basename $$i`; \
593	  if [ ! -d $$i ] ; then \
594	  if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
595	      echo New test file $$name ; \
596	      $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
597	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
598	  else \
599	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
600	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
601	      diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
602	      diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
603	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
604	      rm result.$$name error.$$name ; \
605	  fi ; fi ; done)
606	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
607	  name=`basename $$i`; \
608	  if [ ! -d $$i ] ; then \
609	  if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
610	      echo New test file $$name ; \
611	      $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
612	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
613	  else \
614	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
615	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
616	      diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
617	      diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
618	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
619	      rm result.$$name error.$$name ; \
620	  fi ; fi ; done)
621
622Scripttests : xmllint$(EXEEXT)
623	@(echo > .memdump)
624	@echo "## Scripts regression tests"
625	@echo "## Some of the base computations may be different if srcdir != ."
626	-@(for i in $(srcdir)/test/scripts/*.script ; do \
627	  name=`basename $$i .script`; \
628	  xml=$(srcdir)/test/scripts/`basename $$i .script`.xml; \
629	  if [ -f $$xml ] ; then \
630	  if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \
631	      echo New test file $$name ; \
632	      $(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name 2> $(srcdir)/result/scripts/$$name.err ; \
633	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
634	  else \
635	      log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name 2> result.$$name.err ; \
636	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
637	      diff $(srcdir)/result/scripts/$$name result.$$name ; \
638	      diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \
639	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
640	      rm result.$$name result.$$name.err ; \
641	  fi ; fi ; done)
642
643Catatests : xmlcatalog$(EXEEXT)
644	@(echo > .memdump)
645	@echo "## Catalog regression tests"
646	-@(for i in $(srcdir)/test/catalogs/*.script ; do \
647	  name=`basename $$i .script`; \
648	  xml=$(srcdir)/test/catalogs/`basename $$i .script`.xml; \
649	  if [ -f $$xml ] ; then \
650	  if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \
651	      echo New test file $$name ; \
652	      $(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > $(srcdir)/result/catalogs/$$name ; \
653	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
654	  else \
655	      log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \
656	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
657	      diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
658	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
659	      rm result.$$name ; \
660	  fi ; fi ; done)
661	-@(for i in $(srcdir)/test/catalogs/*.script ; do \
662	  name=`basename $$i .script`; \
663	  sgml=$(srcdir)/test/catalogs/`basename $$i .script`.sgml; \
664	  if [ -f $$sgml ] ; then \
665	  if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \
666	      echo New test file $$name ; \
667	      $(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \
668	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
669	  else \
670	      log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
671	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
672	      diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
673	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
674	      rm result.$$name ; \
675	  fi ; fi ; done)
676	@echo "## Add and del operations on XML Catalogs"
677	-@($(CHECKER) $(top_builddir)/xmlcatalog --create --noout $(srcdir)/result/catalogs/mycatalog; \
678	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
679	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid sysid $(srcdir)/result/catalogs/mycatalog; \
680	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
681	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid2 sysid2 $(srcdir)/result/catalogs/mycatalog; \
682	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
683	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid3 sysid3 $(srcdir)/result/catalogs/mycatalog; \
684	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
685	diff result/catalogs/mycatalog.full $(srcdir)/result/catalogs/mycatalog; \
686	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
687	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid $(srcdir)/result/catalogs/mycatalog; \
688	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
689	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid3 $(srcdir)/result/catalogs/mycatalog; \
690	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
691	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid2 $(srcdir)/result/catalogs/mycatalog; \
692	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
693	diff result/catalogs/mycatalog.empty $(srcdir)/result/catalogs/mycatalog; \
694	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
695	rm -f $(srcdir)/result/catalogs/mycatalog)
696
697SVGtests : xmllint$(EXEEXT)
698	@echo "## SVG parsing regression tests"
699	-@(for i in $(srcdir)/test/SVG/* ; do \
700	  name=`basename $$i`; \
701	  if [ ! -d $$i ] ; then \
702	  if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \
703	      echo New test file $$name ; \
704	      $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \
705	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
706	  else \
707	      echo Testing $$name ; \
708	      $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \
709	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
710	      diff $(srcdir)/result/SVG/$$name result.$$name ; \
711	      $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \
712	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
713	      diff result.$$name result2.$$name ; \
714	      rm result.$$name result2.$$name ; \
715	  fi ; fi ; done)
716
717Threadtests : testThreads$(EXEEXT)
718	@echo "## Threaded regression tests"
719	-@($(CHECKER) $(top_builddir)/testThreads ; \
720	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
721	   exit 0)
722
723Readertests : xmllint$(EXEEXT)
724	@(echo > .memdump)
725	@echo "## Reader regression tests"
726	-@(for i in $(srcdir)/test/* ; do \
727	  name=`basename $$i`; \
728	  if [ ! -d $$i ] ; then \
729	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
730	      echo New test file $$name ; \
731	      $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
732	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
733	  else \
734	      log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
735	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
736	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
737	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
738	      rm result.$$name ; \
739	  fi ; fi ; done)
740	@echo "## Reader on memory regression tests"
741	-@(for i in $(srcdir)/test/* ; do \
742	  name=`basename $$i`; \
743	  if [ ! -d $$i ] ; then \
744	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
745	      echo New test file $$name ; \
746	      $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
747	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
748	  else \
749	      log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
750	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
751	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
752	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
753	      rm result.$$name ; \
754	  fi ; fi ; done)
755	@(echo > .memdump)
756	@echo "## Walker regression tests"
757	-@(for i in $(srcdir)/test/* ; do \
758	  name=`basename $$i`; \
759	  if [ ! -d $$i ] ; then \
760	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
761	      echo New test file $$name ; \
762	      $(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
763	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
764	  else \
765	      log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > result.$$name 2>/dev/null ; \
766	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
767	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
768	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
769	      rm result.$$name ; \
770	  fi ; fi ; done)
771	@echo "## Reader entities substitution regression tests"
772	-@(for i in $(srcdir)/test/* ; do \
773	  name=`basename $$i`; \
774	  if [ ! -d $$i ] ; then \
775	  if [ ! -f $(srcdir)/result/$$name.rde ] ; then \
776	      echo New test file $$name ; \
777	      $(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > $(srcdir)/result/$$name.rde 2>/dev/null ; \
778	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
779	  else \
780	      log=`$(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
781	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
782	      diff $(srcdir)/result/$$name.rde result.$$name` ; \
783	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
784	      rm result.$$name ; \
785	  fi ; fi ; done)
786
787SAXtests : testSAX$(EXEEXT)
788	@(echo > .memdump)
789	@echo "## SAX1 callbacks regression tests"
790	-@(for i in $(srcdir)/test/* ; do \
791	  name=`basename $$i`; \
792	  if [ ! -d $$i ] ; then \
793	  if [ ! -f $(srcdir)/result/$$name.sax ] ; then \
794	      echo New test file $$name ; \
795	      $(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax 2> /dev/null ; \
796	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
797	  else \
798	      log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name 2> /dev/null ; \
799	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
800	      diff $(srcdir)/result/$$name.sax result.$$name` ; \
801	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
802	      rm result.$$name ; \
803	  fi ; fi ; done)
804	@echo "## SAX2 callbacks regression tests"
805	-@(for i in $(srcdir)/test/* ; do \
806	  name=`basename $$i`; \
807	  if [ ! -d $$i ] ; then \
808	  if [ ! -f $(srcdir)/result/$$name.sax2 ] ; then \
809	      echo New test file $$name ; \
810	      $(CHECKER) $(top_builddir)/testSAX --sax2 $$i > $(srcdir)/result/$$name.sax2 2> /dev/null ; \
811	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
812	  else \
813	      log=`$(CHECKER) $(top_builddir)/testSAX --sax2 $$i > result.$$name 2> /dev/null ; \
814	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
815	      diff $(srcdir)/result/$$name.sax2 result.$$name` ; \
816	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
817	      rm result.$$name ; \
818	  fi ; fi ; done)
819
820Validtests : xmllint$(EXEEXT)
821	@(echo > .memdump)
822	@echo "## Valid documents regression tests"
823	-@(for i in $(srcdir)/test/VCM/* ; do \
824	  name=`basename $$i`; \
825	  if [ ! -d $$i ] ; then \
826	      log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \
827	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"`;\
828	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
829	  fi ; done ; exit 0)
830	@echo "## Validity checking regression tests"
831	-@(for i in $(srcdir)/test/VC/* ; do \
832	  name=`basename $$i`; \
833	  if [ ! -d $$i ] ; then \
834	  if [ ! -f $(srcdir)/result/VC/$$name ] ; then \
835	      echo New test file $$name ; \
836	      $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
837	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
838	  else \
839	      log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
840	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
841	      diff $(srcdir)/result/VC/$$name result.$$name` ; \
842	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
843	      rm result.$$name ; \
844	  fi ; fi ; done)
845	@echo "## General documents valid regression tests"
846	-@(for i in $(srcdir)/test/valid/* ; do \
847	  name=`basename $$i`; \
848	  if [ ! -d $$i ] ; then \
849	  if [ ! -f $(srcdir)/result/valid/$$name ] ; then \
850	      echo New test file $$name ; \
851	      $(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
852	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
853	  else \
854	      log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
855	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
856	      diff $(srcdir)/result/valid/$$name result.$$name ; \
857	      diff $(srcdir)/result/valid/$$name.err error.$$name` ; \
858	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
859	      rm result.$$name error.$$name ; \
860	  fi ; fi ; done)
861
862Regexptests: testRegexp$(EXEEXT)
863	@(echo > .memdump)
864	@echo "## Regexp regression tests"
865	-@(for i in $(srcdir)/test/regexp/* ; do \
866	  name=`basename $$i`; \
867	  if [ ! -d $$i ] ; then \
868	  if [ ! -f $(srcdir)/result/regexp/$$name ] ; then \
869	      echo New test file $$name ; \
870	      $(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name; \
871	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
872	  else \
873	      log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i 2>&1 > result.$$name ; \
874	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
875	      diff $(srcdir)/result/regexp/$$name result.$$name` ; \
876	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
877	      rm result.$$name ; \
878	  fi ; fi ; done)
879	@echo "## Formal expresssions regression tests"
880	-@(for i in $(srcdir)/test/expr/* ; do \
881	  name=`basename $$i`; \
882	  if [ ! -d $$i ] ; then \
883	  if [ ! -f $(srcdir)/result/expr/$$name ] ; then \
884	      echo New test file $$name ; \
885	      $(CHECKER) $(top_builddir)/testRegexp --expr -i $$i > $(srcdir)/result/expr/$$name; \
886	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
887	  else \
888	      log=`$(CHECKER) $(top_builddir)/testRegexp --expr -i $$i 2>&1 > result.$$name ; \
889	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
890	      diff $(srcdir)/result/expr/$$name result.$$name` ; \
891	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
892	      rm result.$$name ; \
893	  fi ; fi ; done)
894
895Automatatests: testAutomata$(EXEEXT)
896	@(echo > .memdump)
897	@echo "## Automata regression tests"
898	-@(for i in $(srcdir)/test/automata/* ; do \
899	  name=`basename $$i`; \
900	  if [ ! -d $$i ] ; then \
901	  if [ ! -f $(srcdir)/result/automata/$$name ] ; then \
902	      echo New test file $$name ; \
903	      $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \
904	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
905	  else \
906	      log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \
907	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
908	      diff $(srcdir)/result/automata/$$name result.$$name` ; \
909	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
910	      rm result.$$name ; \
911	  fi ; fi ; done)
912
913dba100000.xml: dbgenattr.pl
914	@echo "## generating dba100000.xml"
915	@($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml)
916
917Timingtests: xmllint$(EXEEXT) dba100000.xml
918	@echo "## Timing tests to try to detect performance"
919	@echo "## as well a memory usage breakage when streaming"
920	@echo "## 1/ using the file interface"
921	@echo "## 2/ using the memory interface"
922	@echo "## 3/ repeated DOM parsing"
923	@echo "## 4/ repeated DOM validation"
924	-@($(top_builddir)/xmllint --stream --timing dba100000.xml; \
925	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
926	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
927	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
928	   exit 0)
929	-@($(top_builddir)/xmllint --stream --timing --memory dba100000.xml; \
930	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
931	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
932	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
933	   exit 0)
934	-@($(top_builddir)/xmllint --noout --timing --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \
935	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
936	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
937	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
938	   exit 0)
939
940VTimingtests: xmllint$(EXEEXT)
941	-@($(top_builddir)/xmllint --noout --timing --valid --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \
942	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
943	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
944	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
945	   exit 0)
946
947C14Ntests : testC14N$(EXEEXT)
948	@echo "## C14N and XPath regression tests"
949	-@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \
950	    for i in $(srcdir)/test/c14n/$$m/*.xml ; do  \
951		if [ ! -d $$i ] ; then \
952		    name=`basename $$i .xml`; \
953		    cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \
954		    if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \
955			cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \
956			if [ -f $(srcdir)/test/c14n/$$m/$$name.ns ] ; then \
957			    cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \
958			fi; \
959		    fi; \
960		    $$cmdline > $(srcdir)/test/c14n/test.tmp; \
961		    if [ $$? -eq 0 ]; then \
962			diff  $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \
963			if [ $$? -ne 0 ]; then \
964			    echo "Test $$m/$$name failed"; \
965			    cat $(srcdir)/test/c14n/test.tmp; \
966			fi; \
967		    else \
968			echo "C14N failed"; \
969		    fi; \
970		    grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
971		fi; \
972		rm -f $(srcdir)/test/c14n/test.tmp; \
973	    done; \
974	done)
975
976Schemastests: testSchemas$(EXEEXT)
977	@(echo > .memdump)
978	@echo "## Schemas regression tests"
979	-@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \
980	  name=`basename $$i | sed 's+_.*++'`; \
981	  sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \
982	  for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \
983	      if [ -f $$j ] ; then \
984	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
985	      if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \
986	      then \
987		  echo New test file "$$name"_"$$sno"_"$$xno" ; \
988		  $(CHECKER) $(top_builddir)/testSchemas $$i $$j \
989		    > $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
990		    2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \
991	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
992	      else \
993	          log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
994		    > res.$$name 2> err.$$name;\
995	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
996	          diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
997		       res.$$name;\
998	          diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \
999		       err.$$name;\
1000		  grep Unimplemented err.$$name`; \
1001	          if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo $$log ; fi ; \
1002	          rm res.$$name err.$$name ; \
1003	       fi ; fi ;\
1004	  done; done)
1005
1006Relaxtests: xmllint$(EXEEXT)
1007	@(echo > .memdump)
1008	@echo "## Relax-NG regression tests"
1009	-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
1010	  name=`basename $$i | sed 's+\.rng++'`; \
1011	  if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \
1012	      echo New schemas $$name ; \
1013	      $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
1014		      > $(srcdir)/result/relaxng/"$$name"_valid \
1015		      2> $(srcdir)/result/relaxng/"$$name"_err; \
1016	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1017	  else \
1018	      log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
1019	      > res.$$name 2> err.$$name;\
1020	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1021	      diff $(srcdir)/result/relaxng/"$$name"_valid \
1022		   res.$$name;\
1023	      diff $(srcdir)/result/relaxng/"$$name"_err \
1024		   err.$$name | grep -v "error detected at";\
1025	      grep Unimplemented err.$$name`; \
1026	      if [ -n "$$log" ] ; then echo schemas $$name result ; echo $$log ; fi ; \
1027	      rm res.$$name err.$$name ; \
1028	  fi; \
1029	  for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
1030	      if [ -f $$j ] ; then \
1031	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1032	      if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
1033	      then \
1034		  echo New test file "$$name"_"$$xno" ; \
1035		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1036		    > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1037		    2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
1038	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1039	      else \
1040	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1041		    > res.$$name 2> err.$$name;\
1042	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1043	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1044		       res.$$name;\
1045	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
1046		       err.$$name | grep -v "error detected at";\
1047		  grep Unimplemented err.$$name`; \
1048		  if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \
1049	          rm res.$$name err.$$name ; \
1050	       fi ; fi ; \
1051	  done; done)
1052	@echo "## Relax-NG streaming regression tests"
1053	-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
1054	  name=`basename $$i | sed 's+\.rng++'`; \
1055	  for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
1056	      if [ -f $$j ] ; then \
1057	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1058	      if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
1059	      then \
1060		  echo New test file "$$name"_"$$xno" ; \
1061		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1062		    > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1063		    2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
1064	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1065	      else \
1066	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \
1067		    > res.$$name 2> err.$$name;\
1068	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1069	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\
1070		  if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \
1071		      diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
1072			   err.$$name | grep -v "error detected at";\
1073		  fi ; grep Unimplemented err.$$name`; \
1074	          if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \
1075	          rm res.$$name err.$$name ; \
1076	       fi ; fi ; \
1077	  done; done)
1078
1079Schematrontests: xmllint$(EXEEXT)
1080	@(echo > .memdump)
1081	@echo "## Schematron regression tests"
1082	-@(for i in $(srcdir)/test/schematron/*.sct ; do \
1083	  name=`basename $$i | sed 's+\.sct++'`; \
1084	  for j in $(srcdir)/test/schematron/"$$name"_*.xml ; do \
1085	      if [ -f $$j ] ; then \
1086	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1087	      if [ ! -f $(srcdir)/result/schematron/"$$name"_"$$xno" ]; \
1088	      then \
1089		  echo New test file "$$name"_"$$xno" ; \
1090		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \
1091		    > $(srcdir)/result/schematron/"$$name"_"$$xno" \
1092		    2> $(srcdir)/result/schematron/"$$name"_"$$xno".err; \
1093	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1094	      else \
1095	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \
1096		    > res.$$name 2> err.$$name;\
1097	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1098	          diff $(srcdir)/result/schematron/"$$name"_"$$xno" \
1099		       res.$$name;\
1100	          diff $(srcdir)/result/schematron/"$$name"_"$$xno".err \
1101		       err.$$name | grep -v "error detected at";\
1102		  grep Unimplemented err.$$name`; \
1103		  if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \
1104	          rm res.$$name err.$$name ; \
1105	       fi ; fi ; \
1106	  done; done)
1107
1108RelaxNGPythonTests:
1109	@(if [ -x $(PYTHON) ] ; then \
1110	    PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH ; \
1111	    export PYTHONPATH; \
1112	    LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
1113	    export LD_LIBRARY_PATH; \
1114	    echo "## Relax-NG Python based test suite 1" ; \
1115	    $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite.py ; \
1116	    echo "## Relax-NG Python based test suite 2" ; \
1117	    $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite2.py ; \
1118	  fi)
1119
1120SchemasPythonTests:
1121	@(if [ -x $(PYTHON) ] ; then \
1122	    PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH; \
1123	    export PYTHONPATH; \
1124	    LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
1125	    export LD_LIBRARY_PATH; \
1126	    echo "## XML Schemas datatypes Python based test suite" ; \
1127	    echo "## It is normal to see 11 errors reported" ; \
1128	    $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \
1129	  fi)
1130	@(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi)
1131
1132Patterntests: xmllint$(EXEEXT)
1133	@(echo > .memdump)
1134	@echo "## Pattern regression tests"
1135	-@(for i in $(srcdir)/test/pattern/*.pat ; do \
1136	  name=`basename $$i .pat`; \
1137	  if [ -f $(srcdir)/test/pattern/$$name.xml ] ; then \
1138	  if [ ! -f $(srcdir)/result/pattern/$$name ] ; then \
1139	      rm -f result.$$name ; \
1140	      echo New test file $$name ; \
1141	      for pat in `cat $$i` ; do \
1142	      $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml >> $(srcdir)/result/pattern/$$name ; \
1143	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1144	      done ;\
1145	  else \
1146	      rm -f result.$$name ; \
1147	      lst=`cat $$i` ; \
1148	      log=`for pat in $$lst ; do $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml 2>&1 >> result.$$name ; \
1149	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1150	      done ;\
1151	      diff $(srcdir)/result/pattern/$$name result.$$name` ; \
1152	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
1153	      rm result.$$name ; \
1154	  fi ; fi ; done ;)
1155
1156ModuleTests: testModule$(EXEEXT) testdso.la
1157	@echo "## Module tests"
1158	@(./testModule$(EXEEXT))
1159
1160cleanup:
1161	-@(find . -name .\#\* -exec rm {} \;)
1162	-@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;)
1163	-@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;)
1164
1165dist-hook: cleanup libxml2.spec
1166	-cp libxml2.spec $(distdir)
1167	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos os400 vms VxWorks bakefile test result) | (cd $(distdir); tar xf -)
1168
1169dist-source: distdir
1170	$(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz
1171
1172dist-test: distdir
1173	(mkdir -p $(distdir))
1174	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -)
1175	tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests  $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
1176	@(rm -rf $(distdir)/xstc/Test)
1177
1178cleantar:
1179	@(rm -f libxml*.tar.gz COPYING.LIB)
1180
1181rpm: cleanup cleantar
1182	@(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz)
1183
1184## We create xml2Conf.sh here and not from configure because we want
1185## to get the paths expanded correctly.  Macros like srcdir are given
1186## the value NONE in configure if the user doesn't specify them (this
1187## is an autoconf feature, not a bug).
1188
1189xml2Conf.sh: xml2Conf.sh.in Makefile
1190## Use sed and then mv to avoid problems if the user interrupts.
1191	sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \
1192	    -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
1193	    -e 's?\@VERSION\@?$(VERSION)?g' \
1194	    -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
1195	       < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
1196	&& mv xml2Conf.tmp xml2Conf.sh
1197
1198CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res
1199DISTCLEANFILES = COPYING missing.lst
1200
1201confexecdir=$(libdir)
1202confexec_DATA = xml2Conf.sh
1203CVS_EXTRA_DIST=
1204EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
1205             libxml.m4 Copyright check-xml-test-suite.py gentest.py \
1206	     check-relaxng-test-suite.py check-relaxng-test-suite2.py \
1207	     check-xsddata-test-suite.py check-xinclude-test-suite.py \
1208             example/Makefile.am example/gjobread.c example/gjobs.xml \
1209	     $(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
1210	     libxml2-config.cmake.in \
1211	     trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
1212	     triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \
1213	     enc.h save.h testThreadsWin32.c genUnicode.py TODO_SCHEMAS \
1214	     dbgen.pl dbgenattr.pl regressions.py regressions.xml \
1215	     README.tests Makefile.tests libxml2.syms timsort.h \
1216	     $(CVS_EXTRA_DIST)
1217
1218
1219pkgconfigdir = $(libdir)/pkgconfig
1220pkgconfig_DATA = libxml-2.0.pc
1221
1222cmakedir = $(libdir)/cmake/libxml2
1223cmake_DATA = libxml2-config.cmake
1224
1225#
1226# Install the tests program sources as examples 
1227#
1228BASE_DIR=$(datadir)/doc
1229DOC_MODULE=libxml2-$(VERSION)
1230EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples
1231
1232install-data-local: 
1233	$(MKDIR_P) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1234	-$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1235	$(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR)
1236	-$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
1237	-$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
1238	-$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)
1239	-$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)
1240
1241uninstall-local:
1242	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
1243	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c
1244	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c
1245	rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c
1246	rm -rf $(DESTDIR)$(EXAMPLES_DIR)
1247	rm -f $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright
1248	rm -rf $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1249
1250tst: tst.c
1251	$(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma
1252
1253sparse: clean
1254	$(MAKE) CC=cgcc
1255
1256#
1257# Coverage support, largely borrowed from libvirt
1258# Both binaries comes from the lcov package in Fedora
1259#
1260LCOV = /usr/bin/lcov
1261GENHTML = /usr/bin/genhtml
1262
1263cov: clean-cov
1264	if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \
1265	    echo not configured with coverage; exit 1 ; fi
1266	if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
1267	    echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
1268	-@($(MAKE) check)
1269	-@(./runsuite$(EXEEXT))
1270	mkdir $(top_builddir)/coverage
1271	$(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir)
1272	$(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr*
1273	rm $(top_builddir)/coverage/libxml2.info.tmp
1274	$(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info
1275	echo "Coverage report is in $(top_builddir)/coverage/index.html"
1276
1277clean-cov:
1278	rm -rf $(top_builddir)/coverage
1279
1280