1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(entities.c)
3AM_CONFIG_HEADER(config.h)
4AC_CANONICAL_HOST
5
6LIBXML_MAJOR_VERSION=2
7LIBXML_MINOR_VERSION=6
8LIBXML_MICRO_VERSION=32
9LIBXML_MICRO_VERSION_SUFFIX=
10LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
11LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
12
13LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
14
15if test -f CVS/Entries ; then
16  extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
17  echo extra=$extra
18  if test "$extra" != ""
19  then
20      LIBXML_VERSION_EXTRA="-CVS$extra"
21  fi
22else if test -d .svn ; then
23  extra=`svn info | grep Revision | sed 's+Revision: ++'`
24  echo extra=$extra
25  if test "$extra" != ""
26  then
27      LIBXML_VERSION_EXTRA="-SVN$extra"
28  fi
29fi
30fi
31AC_SUBST(LIBXML_MAJOR_VERSION)
32AC_SUBST(LIBXML_MINOR_VERSION)
33AC_SUBST(LIBXML_MICRO_VERSION)
34AC_SUBST(LIBXML_VERSION)
35AC_SUBST(LIBXML_VERSION_INFO)
36AC_SUBST(LIBXML_VERSION_NUMBER)
37AC_SUBST(LIBXML_VERSION_EXTRA)
38
39VERSION=${LIBXML_VERSION}
40
41AM_INIT_AUTOMAKE(libxml2, $VERSION)
42
43dnl Checks for programs.
44AC_PROG_CC
45AC_PROG_INSTALL
46AC_PROG_CPP
47AC_PATH_PROG(RM, rm, /bin/rm)
48AC_PATH_PROG(MV, mv, /bin/mv)
49AC_PATH_PROG(TAR, tar, /bin/tar)
50AC_PATH_PROG(PERL, perl, /usr/bin/perl)
51AC_PATH_PROG(WGET, wget, /usr/bin/wget)
52AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
53AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
54
55dnl Make sure we have an ANSI compiler
56AM_C_PROTOTYPES
57test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
58
59AC_LIBTOOL_WIN32_DLL
60AM_PROG_LIBTOOL
61
62dnl
63dnl We process the AC_ARG_WITH first so that later we can modify
64dnl some of them to try to prevent impossible combinations.  This
65dnl also allows up so alphabetize the choices
66dnl
67
68dnl
69dnl zlib option might change flags, so we save them initially
70dnl
71_cppflags="${CPPFLAGS}"
72_ldflags="${LDFLAGS}"
73
74AC_ARG_WITH(c14n,
75[  --with-c14n             add the Canonicalization support (on)])
76AC_ARG_WITH(catalog,
77[  --with-catalog          add the Catalog support (on)])
78AC_ARG_WITH(debug,
79[  --with-debug            add the debugging module (on)])
80AC_ARG_WITH(docbook,
81[  --with-docbook          add Docbook SGML support (on)])
82AC_ARG_WITH(fexceptions,
83[  --with-fexceptions      add GCC flag -fexceptions for C++ exceptions (off)])
84AC_ARG_WITH(ftp,
85[  --with-ftp              add the FTP support (on)])
86AC_ARG_WITH(history,
87[  --with-history          add history support to xmllint shell(off)])
88AC_ARG_WITH(html,
89[  --with-html             add the HTML support (on)])
90dnl Specific dir for HTML output ?
91AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
92            [path to base html directory, default $datadir/doc/html]),
93            [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
94
95AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
96            [directory used under html-dir, default $PACKAGE-$VERSION/html]),
97            [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
98            [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
99AC_SUBST(HTML_DIR)
100AC_ARG_WITH(http,
101[  --with-http             add the HTTP support (on)])
102AC_ARG_WITH(iconv,
103[  --with-iconv[[=DIR]]      add ICONV support (on)])
104AC_ARG_WITH(iso8859x,
105[  --with-iso8859x         add ISO8859X support if no iconv (on)])
106AC_ARG_WITH(legacy,
107[  --with-legacy           add deprecated APIs for compatibility (on)])
108AC_ARG_WITH(mem_debug,
109[  --with-mem-debug        add the memory debugging module (off)])
110AC_ARG_WITH(minimum,
111[  --with-minimum          build a minimally sized library (off)])
112AC_ARG_WITH(output,
113[  --with-output           add the serialization support (on)])
114AC_ARG_WITH(pattern,
115[  --with-pattern          add the xmlPattern selection interface (on)])
116AC_ARG_WITH(push,
117[  --with-push             add the PUSH parser interfaces (on)])
118AC_ARG_WITH(python,
119[  --with-python[[=DIR]]     build Python bindings if found])
120AC_ARG_WITH(reader,
121[  --with-reader           add the xmlReader parsing interface (on)])
122AC_ARG_WITH(readline,
123[  --with-readline=DIR     use readline in DIR],[
124  if test "$withval" != "no" -a "$withval" != "yes"; then
125    RDL_DIR=$withval
126    CPPFLAGS="${CPPFLAGS} -I$withval/include"
127    LDFLAGS="${LDFLAGS} -L$withval/lib"
128  fi
129])
130AC_ARG_WITH(regexps,
131[  --with-regexps          add Regular Expressions support (on)])
132AC_ARG_WITH(run_debug,
133[  --with-run-debug        add the runtime debugging module (off)])
134AC_ARG_WITH(sax1,
135[  --with-sax1             add the older SAX1 interface (on)])
136AC_ARG_WITH(schemas,
137[  --with-schemas          add Relax-NG and Schemas support (on)])
138AC_ARG_WITH(schematron,
139[  --with-schematron       add Schematron support (on)])
140AC_ARG_WITH(threads,
141[  --with-threads          add multithread support(on)])
142AC_ARG_WITH(thread-alloc,
143[  --with-thread-alloc     add per-thread memory(off)])
144AC_ARG_WITH(tree,
145[  --with-tree             add the DOM like tree manipulation APIs (on)])
146AC_ARG_WITH(valid,
147[  --with-valid            add the DTD validation support (on)])
148AC_ARG_WITH(writer,
149[  --with-writer           add the xmlWriter saving interface (on)])
150AC_ARG_WITH(xinclude,
151[  --with-xinclude         add the XInclude support (on)])
152AC_ARG_WITH(xpath,
153[  --with-xpath            add the XPATH support (on)])
154AC_ARG_WITH(xptr,
155[  --with-xptr             add the XPointer support (on)])
156AC_ARG_WITH(modules,
157[  --with-modules          add the dynamic modules support (on)])
158AC_ARG_WITH(zlib,
159[  --with-zlib[[=DIR]]       use libz in DIR],[
160  if test "$withval" != "no" -a "$withval" != "yes"; then
161    Z_DIR=$withval
162    CPPFLAGS="${CPPFLAGS} -I$withval/include"
163    LDFLAGS="${LDFLAGS} -L$withval/lib"
164  fi
165])
166
167dnl
168dnl hard dependancies on options
169dnl
170if test "$with_schemas" = "yes"
171then
172    with_pattern=yes
173    with_regexps=yes
174fi
175if test "$with_schematron" = "yes"
176then
177    with_pattern=yes
178    with_xpath=yes
179fi
180if test "$with_reader" = "yes"
181then
182    with_push=yes
183fi
184if test "$with_xptr" = "yes"
185then
186    with_xpath=yes
187fi
188dnl
189dnl option to build a minimal libxml2 library
190dnl
191if test "$with_minimum" = "yes"
192then
193    echo "Configuring for a minimal library"
194    if test "$with_c14n" = ""
195    then
196      with_c14n=no
197    fi
198    if test "$with_catalog" = ""
199    then
200      with_catalog=no
201    fi
202    echo So far so good!
203    if test "$with_debug" = ""
204    then
205      with_debug=no
206    fi
207    if test "$with_docbook" = ""
208    then
209      with_docbook=no
210    fi
211    if test "$with_fexceptions" = ""
212    then
213      with_fexceptions=no
214    fi
215    if test "$with_ftp" = ""
216    then
217      with_ftp=no
218    fi
219    if test "$with_history" = ""
220    then
221      with_history=no
222    fi
223    if test "$with_html" = ""
224    then
225      with_html=no
226    fi
227    if test "$with_http" = ""
228    then
229      with_http=no
230    fi
231    if test "$with_iconv" = ""
232    then
233      with_iconv=no
234    fi
235    if test "$with_iso8859x" = ""
236    then
237      with_iso8859x=no
238    fi
239    if test "$with_legacy" = ""
240    then
241      with_legacy=no
242    fi
243    if test "$with_mem_debug" = ""
244    then
245      with_mem_debug=no
246    fi
247    if test "$with_output" = ""
248    then
249      with_output=no
250    fi
251    if test "$with_pattern" = ""
252    then
253      with_pattern=no
254    fi
255    if test "$with_push" = ""
256    then
257      with_push=no
258    fi
259    if test "$with_python" = ""
260    then
261      with_python=no
262    fi
263    if test "$with_reader" = ""
264    then
265      with_reader=no
266    fi
267    if test "$with_readline" = ""
268    then
269      with_readline=no
270    fi
271    if test "$with_regexps" = ""
272    then
273      with_regexps=no
274    fi
275    if test "$with_run_debug" = ""
276    then
277      with_run_debug=no
278    fi
279    if test "$with_sax1" = ""
280    then
281      with_sax1=no
282    fi
283    if test "$with_schemas" = ""
284    then
285      with_schemas=no
286    fi
287    if test "$with_schematron" = ""
288    then
289      with_schematron=no
290    fi
291    if test "$with_threads" = ""
292    then
293      with_threads=no
294    fi
295    if test "$with_thread_alloc" = ""
296    then
297      with_thread_alloc=no
298   fi
299    if test "$with_tree" = ""
300    then
301      with_tree=no
302    fi
303    if test "$with_valid" = ""
304    then
305      with_valid=no
306    fi
307    if test "$with_writer" = ""
308    then
309      with_writer=no
310    fi
311    if test "$with_xinclude" = ""
312    then
313      with_xinclude=no
314    fi
315    if test "$with_xpath" = ""
316    then
317      with_xpath=no
318    fi
319    if test "$with_xptr" = ""
320    then
321      with_xptr=no
322    fi
323    if test "$with_zlib" = ""
324    then
325      with_zlib=no
326    fi
327    if test "$with_modules" = ""
328    then
329      with_modules=no
330    fi
331fi
332
333echo Checking zlib
334
335dnl Checks for zlib library.
336
337WITH_ZLIB=0
338if test "$with_zlib" = "no"; then
339    echo "Disabling compression support"
340else
341    AC_CHECK_HEADERS(zlib.h,
342	AC_CHECK_LIB(z, gzread,[
343	    AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
344	    WITH_ZLIB=1
345	    if test "x${Z_DIR}" != "x"; then
346		Z_CFLAGS="-I${Z_DIR}/include"
347		Z_LIBS="-L${Z_DIR}/lib -lz"
348		[case ${host} in
349		    *-*-solaris*)
350			Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
351			;;
352		esac]
353	    else
354		Z_LIBS="-lz"
355	    fi]))
356fi
357
358AC_SUBST(Z_CFLAGS)
359AC_SUBST(Z_LIBS)
360AC_SUBST(WITH_ZLIB)
361
362CPPFLAGS=${_cppflags}
363LDFLAGS=${_ldflags}
364
365echo Checking headers
366
367dnl Checks for header files.
368AC_HEADER_DIRENT
369AC_HEADER_STDC
370AC_CHECK_HEADERS([fcntl.h])
371AC_CHECK_HEADERS([unistd.h])
372AC_CHECK_HEADERS([ctype.h])
373AC_CHECK_HEADERS([dirent.h])
374AC_CHECK_HEADERS([errno.h])
375AC_CHECK_HEADERS([malloc.h])
376AC_CHECK_HEADERS([stdarg.h])
377AC_CHECK_HEADERS([sys/stat.h])
378AC_CHECK_HEADERS([sys/types.h])
379AC_CHECK_HEADERS([time.h])
380AC_CHECK_HEADERS([ansidecl.h])
381AC_CHECK_HEADERS([ieeefp.h])
382AC_CHECK_HEADERS([nan.h])
383AC_CHECK_HEADERS([math.h])
384AC_CHECK_HEADERS([limits.h])
385AC_CHECK_HEADERS([fp_class.h])
386AC_CHECK_HEADERS([float.h])
387AC_CHECK_HEADERS([stdlib.h])
388AC_CHECK_HEADERS([sys/socket.h], [], [],
389[#if HAVE_SYS_TYPES_H
390# include <sys/types.h>
391# endif
392])
393AC_CHECK_HEADERS([netinet/in.h], [], [],
394[#if HAVE_SYS_TYPES_H
395# include <sys/types.h>
396# endif
397])
398AC_CHECK_HEADERS([arpa/inet.h], [], [],
399[#if HAVE_SYS_TYPES_H
400# include <sys/types.h>
401# endif
402#if HAVE_ARPA_INET_H
403# include <arpa/inet.h>
404# endif
405])
406AC_CHECK_HEADERS([netdb.h])
407AC_CHECK_HEADERS([sys/time.h])
408AC_CHECK_HEADERS([sys/select.h])
409AC_CHECK_HEADERS([sys/mman.h])
410AC_CHECK_HEADERS([sys/timeb.h])
411AC_CHECK_HEADERS([signal.h])
412AC_CHECK_HEADERS([arpa/nameser.h], [], [],
413[#if HAVE_SYS_TYPES_H
414# include <sys/types.h>
415# endif
416])
417AC_CHECK_HEADERS([resolv.h], [], [],
418[#if HAVE_SYS_TYPES_H
419# include <sys/types.h>
420# endif
421#if HAVE_NETINET_IN_H
422# include <netinet/in.h>
423# endif
424#if HAVE_ARPA_NAMESER_H
425# include <arpa/nameser.h>
426# endif
427])
428AC_CHECK_HEADERS([dl.h])
429AC_CHECK_HEADERS([dlfcn.h])
430
431
432echo Checking libraries
433
434dnl Checks for library functions.
435AC_FUNC_STRFTIME
436AC_CHECK_FUNCS(strdup strndup strerror)
437AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
438AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
439AC_CHECK_FUNCS(stat _stat signal)
440
441dnl Checking the standard string functions availability
442AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
443               NEED_TRIO=1)
444
445dnl Checking for va_copy availability
446AC_MSG_CHECKING([for va_copy])
447AC_TRY_LINK([#include <stdarg.h>
448va_list ap1,ap2;], [va_copy(ap1,ap2);],
449have_va_copy=yes,
450have_va_copy=no)
451AC_MSG_RESULT($have_va_copy)
452if test x"$have_va_copy" = x"yes"; then
453    AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
454else
455    AC_MSG_CHECKING([for __va_copy])
456    AC_TRY_LINK([#include <stdarg.h>
457    va_list ap1,ap2;], [__va_copy(ap1,ap2);],
458    have___va_copy=yes,
459    have___va_copy=no)
460    AC_MSG_RESULT($have___va_copy)
461    if test x"$have___va_copy" = x"yes"; then
462        AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
463    fi
464fi
465
466dnl Checks for inet libraries:
467AC_SEARCH_LIBS(gethostent, [nsl])
468AC_SEARCH_LIBS(setsockopt, [socket net])
469AC_SEARCH_LIBS(connect, [inet])
470
471dnl Determine what socket length (socklen_t) data type is
472AC_MSG_CHECKING([for type of socket length (socklen_t)])
473AC_TRY_COMPILE2([
474#include <stddef.h>
475#include <sys/types.h>
476#include <sys/socket.h>],[
477(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
478  AC_MSG_RESULT(socklen_t *)
479  XML_SOCKLEN_T=socklen_t],[
480  AC_TRY_COMPILE2([
481#include <stddef.h>
482#include <sys/types.h>
483#include <sys/socket.h>],[
484(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
485    AC_MSG_RESULT(size_t *)
486    XML_SOCKLEN_T=size_t],[
487    AC_TRY_COMPILE2([
488#include <stddef.h>
489#include <sys/types.h>
490#include <sys/socket.h>],[
491(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
492      AC_MSG_RESULT(int *)
493      XML_SOCKLEN_T=int],[
494      AC_MSG_WARN(could not determine)
495      XML_SOCKLEN_T="int"])])])
496AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
497
498dnl ***********************Checking for availability of IPv6*******************
499
500AC_MSG_CHECKING([whether to enable IPv6])
501AC_ARG_ENABLE(ipv6, [  --enable-ipv6[[=yes/no]]  enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
502if test "$with_minimum" = "yes"
503then
504    enable_ipv6=no
505fi
506if test $enable_ipv6 = yes; then
507  have_ipv6=no
508  AC_TRY_COMPILE([
509    #include <sys/types.h>
510    #include <sys/socket.h>
511    ], [
512    struct sockaddr_storage ss;
513    socket(AF_INET6, SOCK_STREAM, 0)
514    ],
515    have_ipv6=yes,
516    have_ipv6=no
517  )
518  AC_MSG_RESULT($have_ipv6)
519
520  if test $have_ipv6 = yes; then
521    AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
522    have_broken_ss_family=no
523
524    dnl *********************************************************************
525    dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
526    dnl a ss_family member, but rather __ss_family. Let's detect that
527    dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
528    dnl platforms.  However, we should only do this if ss_family is not
529    dnl present.
530    dnl ********************************************************************
531    AC_MSG_CHECKING([struct sockaddr::ss_family])
532    AC_TRY_COMPILE([
533      #include <sys/types.h>
534      #include <sys/socket.h>
535      ], [
536      struct sockaddr_storage ss ;
537      ss.ss_family = 0 ;
538      ],
539      have_ss_family=yes,
540      have_ss_family=no
541    )
542    AC_MSG_RESULT($have_ss_family)
543    if test x$have_ss_family = xno ; then
544      AC_MSG_CHECKING([broken struct sockaddr::ss_family])
545      AC_TRY_COMPILE([
546        #include <sys/types.h>
547        #include <sys/socket.h>
548        ], [
549        struct sockaddr_storage ss ;
550        ss.__ss_family = 0 ;
551        ],
552        have_broken_ss_family=yes,
553        have_broken_ss_family=no
554      )
555      AC_MSG_RESULT($have_broken_ss_family)
556      if test x$have_broken_ss_family = xyes ; then
557        AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
558	  [Whether struct sockaddr::__ss_family exists])
559        AC_DEFINE(ss_family, __ss_family,
560	  [ss_family is not defined here, use __ss_family instead])
561      else
562        AC_MSG_WARN(ss_family and __ss_family not found)
563      fi
564    fi
565
566    have_getaddrinfo=no
567    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
568    if test $have_getaddrinfo != yes; then
569      for lib in bsd socket inet; do
570        AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
571      done
572    fi
573
574    if test $have_getaddrinfo = yes; then
575      AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
576    fi
577  fi
578fi
579
580dnl ******************************End IPv6 checks******************************
581
582dnl Checks for isnan in libm if not in libc
583AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
584  [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
585
586AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
587  [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
588
589XML_LIBDIR='-L${libdir}'
590XML_INCLUDEDIR='-I${includedir}/libxml2'
591
592dnl
593dnl Extra flags
594dnl
595XML_CFLAGS=""
596RDL_LIBS=""
597
598dnl
599dnl Workaround for native compilers
600dnl  HP  : http://bugs.gnome.org/db/31/3163.html
601dnl  DEC : Enable NaN/Inf
602dnl
603if test "${GCC}" != "yes" ; then
604    case "${host}" in
605          hppa*-*-hpux* )
606	       CFLAGS="${CFLAGS} -Wp,-H30000"
607	       ;;
608          *-dec-osf* )
609               CFLAGS="${CFLAGS} -ieee"
610               ;;
611	  alpha*-*-linux* )
612	       CFLAGS="${CFLAGS} -ieee"
613	       ;;
614    esac
615else
616    if test "$with_fexceptions" = "yes"
617    then
618        #
619	# Not activated by default because this inflates the code size
620	# Used to allow propagation of C++ exceptions through the library
621	#
622	CFLAGS="${CFLAGS} -fexceptions"
623    fi
624
625    CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
626    case "${host}" in
627          alpha*-*-linux* )
628	       CFLAGS="${CFLAGS} -mieee"
629	       ;;
630	  alpha*-*-osf* )
631	       CFLAGS="${CFLAGS} -mieee"
632	       ;;
633    esac
634fi
635case ${host} in
636    *-*-solaris*)
637        XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
638        ;;
639    hppa*-hp-mpeix)
640        NEED_TRIO=1
641	;;
642    *-*-mingw* | *-*-cygwin* | *-*-msvc* )
643        # If the host is Windows, and shared libraries are disabled, we
644        # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
645        # work properly (without it, xmlexports.h would force the use of
646        # DLL imports, which obviously aren't present in a static
647        # library).
648        if test "x$enable_shared" = "xno"; then
649            XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
650            CFLAGS="$CFLAGS -DLIBXML_STATIC"
651        fi
652        ;;
653esac
654
655
656dnl
657dnl check for python
658dnl
659
660PYTHON_VERSION=
661PYTHON_INCLUDES=
662PYTHON_SITE_PACKAGES=
663PYTHON_TESTS=
664pythondir=
665if test "$with_python" != "no" ; then
666    if test -x "$with_python/bin/python"
667    then
668        echo Found python in $with_python/bin/python
669        PYTHON="$with_python/bin/python"
670    else
671	if test -x "$with_python"
672	then
673	    echo Found python in $with_python
674	    PYTHON="$with_python"
675	else
676	    if test -x "$PYTHON"
677	    then
678	        echo Found python in environment PYTHON=$PYTHON
679		with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
680	    else
681		AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
682	    fi
683	fi
684    fi
685    if test "$PYTHON" != ""
686    then
687        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
688	echo Found Python version $PYTHON_VERSION
689    fi
690    if test "$PYTHON_VERSION" != ""
691    then
692	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
693	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
694	then
695	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
696	    PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
697	else
698	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
699	    then
700	        PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
701	        PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
702	    else
703		if test -r /usr/include/python$PYTHON_VERSION/Python.h
704		then
705		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
706	            PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
707		else
708		    echo could not find python$PYTHON_VERSION/Python.h
709		fi
710	    fi
711	    if test ! -d "$PYTHON_SITE_PACKAGES"
712	    then
713		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
714	    fi
715	fi
716    fi
717    if test "$with_python" != ""
718    then
719        pythondir='$(PYTHON_SITE_PACKAGES)'
720    else
721        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
722    fi
723else
724    PYTHON=
725fi
726AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
727if test "$PYTHON_INCLUDES" != ""
728then
729    PYTHON_SUBDIR=python
730else
731    PYTHON_SUBDIR=
732fi
733AC_SUBST(pythondir)
734AC_SUBST(PYTHON_SUBDIR)
735
736dnl check for dso support
737WITH_MODULES=0
738TEST_MODULES=
739
740if test "$with_modules" != "no" ; then
741 case "$host" in
742  *-*-cygwin*)
743  MODULE_EXTENSION=".dll"
744  AC_CHECK_LIB(cygwin, dlopen, [
745    WITH_MODULES=1
746    MODULE_PLATFORM_LIBS=
747    AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
748  ])
749  ;;
750  *)
751  AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
752    AC_CHECK_LIB(dld, shl_load, [
753      MODULE_PLATFORM_LIBS="-ldld"
754      libxml_have_shl_load=yes], [
755      AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
756        AC_CHECK_LIB(dl, dlopen, [
757          MODULE_PLATFORM_LIBS="-ldl"
758          libxml_have_dlopen=yes])])])])
759
760  if test "${libxml_have_shl_load}" = "yes"; then
761    MODULE_EXTENSION=".sl"
762    WITH_MODULES=1
763    AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
764  fi
765
766  if test "${libxml_have_dlopen}" = "yes"; then
767    case "${host}" in
768      *-*-hpux* )
769	MODULE_EXTENSION=".sl"
770	;;
771      * )
772	MODULE_EXTENSION=".so"
773	;;
774    esac
775
776    WITH_MODULES=1
777    AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
778  fi
779 ;;
780 esac
781fi
782
783if test "${WITH_MODULES}" = "1"; then
784  TEST_MODULES="ModuleTests"
785fi
786
787AC_SUBST(WITH_MODULES)
788AC_SUBST(MODULE_PLATFORM_LIBS)
789AC_SUBST(MODULE_EXTENSION)
790AC_SUBST(TEST_MODULES)
791
792dnl
793dnl Tester makes use of readline if present
794dnl
795
796dnl
797dnl specific tests to setup DV and Bill's devel environments with debug etc ...
798dnl (-Wunreachable-code)
799dnl
800if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
801   [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
802   [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
803   then
804    if test "$with_minimum" != "yes"
805    then
806	if test "${with_mem_debug}" = "" ; then
807	    echo Activating memory debugging
808	    with_mem_debug="yes"
809	    with_run_debug="yes"
810	fi
811	if test "${with_docbook}" = "" ; then
812	    with_docbook="yes"
813	fi
814    fi
815    if test "${GCC}" = "yes" ; then
816    CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
817    fi
818    STATIC_BINARIES="-static"
819dnl -Wcast-qual -ansi
820else
821    STATIC_BINARIES=
822fi
823AC_SUBST(STATIC_BINARIES)
824
825dnl
826dnl Check for trio string functions
827dnl
828
829if test "${NEED_TRIO}" = "1" ; then
830    echo Adding trio library for string functions
831    WITH_TRIO=1
832else
833    WITH_TRIO=0
834fi
835AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
836AC_SUBST(WITH_TRIO)
837
838dnl
839dnl Allow to enable/disable various pieces
840dnl
841echo Checking configuration requirements
842
843dnl
844dnl Thread-related stuff
845dnl
846THREAD_LIBS=""
847BASE_THREAD_LIBS=""
848WITH_THREADS=0
849THREAD_CFLAGS=""
850TEST_THREADS=""
851THREADS_W32=""
852
853if test "$with_threads" = "no" ; then
854    echo Disabling multithreaded support
855else
856    echo Enabling multithreaded support
857
858    AC_CHECK_HEADER(pthread.h,
859	AC_CHECK_LIB(pthread, pthread_join,[
860	   THREAD_LIBS="-lpthread"
861	   AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
862	   AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
863	   WITH_THREADS="1"]))
864    case $host_os in
865       *mingw32*) WITH_THREADS="1"
866           THREADS_W32="Win32"
867	   THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
868       ;;
869       *cygwin*) THREAD_LIBS=""
870       ;;
871       *beos*) WITH_THREADS="1"
872	   THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
873       ;;
874       *linux*)
875           if test "${GCC}" = "yes" ; then
876	       GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
877	       GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
878	       GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
879	       if test "${THREAD_LIBS}" = "-lpthread" ; then
880	           if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
881		   then
882		       THREAD_LIBS=""
883		       BASE_THREAD_LIBS="-lpthread"
884		   else
885		   if expr ${GCC_MAJOR} \> 3 > /dev/null
886		   then
887		       THREAD_LIBS=""
888		       BASE_THREAD_LIBS="-lpthread"
889		   else
890		       echo old GCC disabling weak symbols for pthread
891		   fi
892		   fi
893	       fi
894	   fi
895       ;;
896    esac
897    if test "$WITH_THREADS" = "1" ; then
898	THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
899	TEST_THREADS="Threadtests"
900    fi
901fi
902if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
903    THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
904fi
905
906AC_SUBST(THREAD_LIBS)
907AC_SUBST(BASE_THREAD_LIBS)
908AC_SUBST(WITH_THREADS)
909AC_SUBST(THREAD_CFLAGS)
910AC_SUBST(TEST_THREADS)
911AC_SUBST(THREADS_W32)
912
913dnl
914dnl xmllint shell history
915dnl
916if test "$with_history" = "yes" ; then
917    echo Enabling xmllint shell history
918    dnl check for terminal library. this is a very cool solution
919    dnl from octave's configure.in
920    unset tcap
921    for termlib in ncurses curses termcap terminfo termlib; do
922	AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
923	test -n "$tcap" && break
924    done
925
926    AC_CHECK_HEADER(readline/history.h,
927	AC_CHECK_LIB(history, append_history,[
928	   RDL_LIBS="-lhistory"
929	   AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
930    AC_CHECK_HEADER(readline/readline.h,
931	AC_CHECK_LIB(readline, readline,[
932	   RDL_LIBS="-lreadline $RDL_LIBS $tcap"
933	   AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
934    if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
935	CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
936	RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
937    fi
938fi
939
940dnl
941dnl Tree functions
942dnl
943if test "$with_tree" = "no" ; then
944    echo Disabling DOM like tree manipulation APIs
945    WITH_TREE=0
946else
947    WITH_TREE=1
948fi
949AC_SUBST(WITH_TREE)
950
951if test "$with_ftp" = "no" ; then
952    echo Disabling FTP support
953    WITH_FTP=0
954    FTP_OBJ=
955else
956    WITH_FTP=1
957    FTP_OBJ=nanoftp.o
958fi
959AC_SUBST(WITH_FTP)
960AC_SUBST(FTP_OBJ)
961
962if test "$with_http" = "no" ; then
963    echo Disabling HTTP support
964    WITH_HTTP=0
965    HTTP_OBJ=
966else
967    WITH_HTTP=1
968    HTTP_OBJ=nanohttp.o
969fi
970AC_SUBST(WITH_HTTP)
971AC_SUBST(HTTP_OBJ)
972
973if test "$with_legacy" = "no" ; then
974    echo Disabling deprecated APIs
975    WITH_LEGACY=0
976else
977    WITH_LEGACY=1
978fi
979AC_SUBST(WITH_LEGACY)
980
981if test "$with_reader" = "no" ; then
982    echo Disabling the xmlReader parsing interface
983    WITH_READER=0
984    READER_TEST=
985else
986    WITH_READER=1
987    READER_TEST=Readertests
988    if test "$with_push" = "no" ; then
989        echo xmlReader requires Push interface - enabling it
990	with_push=yes
991    fi
992fi
993AC_SUBST(WITH_READER)
994AC_SUBST(READER_TEST)
995
996if test "$with_writer" = "no" ; then
997    echo Disabling the xmlWriter saving interface
998    WITH_WRITER=0
999#    WRITER_TEST=
1000else
1001    WITH_WRITER=1
1002#    WRITER_TEST=Writertests
1003    if test "$with_push" = "no" ; then
1004        echo xmlWriter requires Push interface - enabling it
1005	with_push=yes
1006    fi
1007    if test "$with_output" = "no" ; then
1008        echo xmlWriter requires Output interface - enabling it
1009	with_output=yes
1010    fi
1011fi
1012AC_SUBST(WITH_WRITER)
1013#AC_SUBST(WRITER_TEST)
1014
1015if test "$with_pattern" = "no" ; then
1016    echo Disabling the xmlPattern parsing interface
1017    WITH_PATTERN=0
1018    TEST_PATTERN=
1019else
1020    WITH_PATTERN=1
1021    TEST_PATTERN=Patterntests
1022fi
1023AC_SUBST(WITH_PATTERN)
1024AC_SUBST(TEST_PATTERN)
1025
1026if test "$with_sax1" = "no" ; then
1027    echo Disabling the older SAX1 interface
1028    WITH_SAX1=0
1029    TEST_SAX=
1030else
1031    WITH_SAX1=1
1032    TEST_SAX=SAXtests
1033fi
1034AC_SUBST(WITH_SAX1)
1035AC_SUBST(TEST_SAX)
1036
1037if test "$with_push" = "no" ; then
1038    echo Disabling the PUSH parser interfaces
1039    WITH_PUSH=0
1040    TEST_PUSH=
1041else
1042    WITH_PUSH=1
1043    TEST_PUSH="XMLPushtests"
1044fi
1045AC_SUBST(WITH_PUSH)
1046AC_SUBST(TEST_PUSH)
1047
1048if test "$with_html" = "no" ; then
1049    echo Disabling HTML support
1050    WITH_HTML=0
1051    HTML_OBJ=
1052    TEST_HTML=
1053else
1054    WITH_HTML=1
1055    HTML_OBJ="HTMLparser.o HTMLtree.o"
1056    TEST_HTML=HTMLtests
1057    if test "$with_push" != "no" ; then
1058        TEST_PHTML=HTMLPushtests
1059    else
1060        TEST_PHTML=
1061    fi
1062fi
1063AC_SUBST(WITH_HTML)
1064AC_SUBST(HTML_OBJ)
1065AC_SUBST(TEST_HTML)
1066AC_SUBST(TEST_PHTML)
1067
1068if test "$with_valid" = "no" ; then
1069    echo Disabling DTD validation support
1070    WITH_VALID=0
1071    TEST_VALID=
1072    TEST_VTIME=
1073else
1074    WITH_VALID=1
1075    TEST_VALID=Validtests
1076    TEST_VTIME=VTimingtests
1077fi
1078AC_SUBST(WITH_VALID)
1079AC_SUBST(TEST_VALID)
1080AC_SUBST(TEST_VTIME)
1081
1082if test "$with_catalog" = "no" ; then
1083    echo Disabling Catalog support
1084    WITH_CATALOG=0
1085    CATALOG_OBJ=
1086    TEST_CATALOG=
1087else
1088    WITH_CATALOG=1
1089    CATALOG_OBJ="catalog.o"
1090    TEST_CATALOG=Catatests
1091fi
1092AC_SUBST(WITH_CATALOG)
1093AC_SUBST(CATALOG_OBJ)
1094AC_SUBST(TEST_CATALOG)
1095
1096if test "$with_docbook" = "no" ; then
1097    echo Disabling Docbook support
1098    WITH_DOCB=0
1099    DOCB_OBJ=
1100else
1101    WITH_DOCB=1
1102    DOCB_OBJ="DOCBparser.o"
1103fi
1104AC_SUBST(WITH_DOCB)
1105AC_SUBST(DOCB_OBJ)
1106
1107
1108if test "$with_xptr" = "no" ; then
1109    echo Disabling XPointer support
1110    WITH_XPTR=0
1111    XPTR_OBJ=
1112    TEST_XPTR=
1113else
1114    WITH_XPTR=1
1115    XPTR_OBJ=xpointer.o
1116    TEST_XPTR=XPtrtests
1117    if test "$with_xpath" = "no" ; then
1118        echo XPointer requires XPath support - enabling it
1119	with_xpath=yes
1120    fi
1121fi
1122AC_SUBST(WITH_XPTR)
1123AC_SUBST(XPTR_OBJ)
1124AC_SUBST(TEST_XPTR)
1125
1126if test "$with_c14n" = "no" ; then
1127    echo Disabling C14N support
1128    WITH_C14N=0
1129    C14N_OBJ=
1130    TEST_C14N=
1131else
1132    WITH_C14N=1
1133    C14N_OBJ="c14n.c"
1134    TEST_C14N=C14Ntests
1135    if test "$with_xpath" = "no" ; then
1136        echo C14N requires XPath support - enabling it
1137	with_xpath=yes
1138    fi
1139fi
1140AC_SUBST(WITH_C14N)
1141AC_SUBST(C14N_OBJ)
1142AC_SUBST(TEST_C14N)
1143
1144if test "$with_xinclude" = "no" ; then
1145    echo Disabling XInclude support
1146    WITH_XINCLUDE=0
1147    XINCLUDE_OBJ=
1148    with_xinclude="no"
1149    TEST_XINCLUDE=
1150else
1151    WITH_XINCLUDE=1
1152    XINCLUDE_OBJ=xinclude.o
1153    TEST_XINCLUDE=XIncludetests
1154    if test "$with_xpath" = "no" ; then
1155        echo XInclude requires XPath support - enabling it
1156	with_xpath=yes
1157    fi
1158fi
1159AC_SUBST(WITH_XINCLUDE)
1160AC_SUBST(XINCLUDE_OBJ)
1161AC_SUBST(TEST_XINCLUDE)
1162
1163if test "$with_xpath" = "no" ; then
1164    echo Disabling XPATH support
1165    WITH_XPATH=0
1166    XPATH_OBJ=
1167    TEST_XPATH=
1168else
1169    WITH_XPATH=1
1170    XPATH_OBJ=xpath.o
1171    TEST_XPATH=XPathtests
1172fi
1173AC_SUBST(WITH_XPATH)
1174AC_SUBST(XPATH_OBJ)
1175AC_SUBST(TEST_XPATH)
1176
1177dnl
1178dnl output functions
1179dnl
1180if test "$with_output" = "no" ; then
1181    echo Disabling serialization/saving support
1182    WITH_OUTPUT=0
1183else
1184    WITH_OUTPUT=1
1185fi
1186AC_SUBST(WITH_OUTPUT)
1187
1188WITH_ICONV=0
1189if test "$with_iconv" = "no" ; then
1190    echo Disabling ICONV support
1191else
1192    if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1193	CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1194	# Export this since our headers include iconv.h
1195	XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1196	ICONV_LIBS="-L$with_iconv/lib"
1197    fi
1198
1199    AC_CHECK_HEADER(iconv.h,
1200	AC_MSG_CHECKING(for iconv)
1201	AC_TRY_LINK([#include <stdlib.h>
1202#include <iconv.h>],[
1203iconv_t cd = iconv_open ("","");
1204iconv (cd, NULL, NULL, NULL, NULL);],[
1205	    AC_MSG_RESULT(yes)
1206	    WITH_ICONV=1],[
1207	    AC_MSG_RESULT(no)
1208	    AC_MSG_CHECKING(for iconv in -liconv)
1209
1210	    _ldflags="${LDFLAGS}"
1211	    _libs="${LIBS}"
1212	    LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1213	    LIBS="${LIBS} -liconv"
1214
1215	    AC_TRY_LINK([#include <stdlib.h>
1216#include <iconv.h>],[
1217iconv_t cd = iconv_open ("","");
1218iconv (cd, NULL, NULL, NULL, NULL);],[
1219		AC_MSG_RESULT(yes)
1220		WITH_ICONV=1
1221		ICONV_LIBS="${ICONV_LIBS} -liconv"
1222		LIBS="${_libs}"
1223		LDFLAGS="${_ldflags}"],[
1224		AC_MSG_RESULT(no)
1225		LIBS="${_libs}"
1226		LDFLAGS="${_ldflags}"])]))
1227
1228	if test "$WITH_ICONV" = "1" ; then
1229		AC_MSG_CHECKING([for iconv declaration])
1230		AC_CACHE_VAL(xml_cv_iconv_arg2, [
1231			AC_TRY_COMPILE([#include <stdlib.h>
1232#include <iconv.h>
1233extern
1234#ifdef __cplusplus
1235"C"
1236#endif
1237#if defined(__STDC__) || defined(__cplusplus)
1238size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1239#else
1240size_t iconv();
1241#endif
1242], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1243
1244		xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
1245		AC_MSG_RESULT([${xml_xxx:-
1246	}$xml_cv_iconv_decl])
1247		AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1248			[Define as const if the declaration of iconv() needs const.])
1249	fi
1250fi
1251case "$host" in
1252	*mingw*) M_LIBS=""
1253	;;
1254	*beos*) M_LIBS=""
1255	;;
1256	*) M_LIBS="-lm"
1257	;;
1258esac
1259XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1260XML_LIBTOOLLIBS="libxml2.la"
1261AC_SUBST(WITH_ICONV)
1262
1263WITH_ISO8859X=1
1264if test "$WITH_ICONV" != "1" ; then
1265if test "$with_iso8859x" = "no" ; then
1266    echo Disabling ISO8859X support
1267    WITH_ISO8859X=0
1268fi
1269fi
1270AC_SUBST(WITH_ISO8859X)
1271
1272if test "$with_schematron" = "no" ; then
1273    echo "Disabling Schematron support"
1274    WITH_SCHEMATRON=0
1275    TEST_SCHEMATRON=
1276else
1277    echo "Enabled Schematron support"
1278    WITH_SCHEMATRON=1
1279    TEST_SCHEMATRON="Schematrontests"
1280    with_xpath=yes
1281    with_pattern=yes
1282fi
1283AC_SUBST(WITH_SCHEMATRON)
1284AC_SUBST(TEST_SCHEMATRON)
1285
1286if test "$with_schemas" = "no" ; then
1287    echo "Disabling Schemas/Relax-NG support"
1288    WITH_SCHEMAS=0
1289    TEST_SCHEMAS=
1290else
1291    echo "Enabled Schemas/Relax-NG support"
1292    WITH_SCHEMAS=1
1293    TEST_SCHEMAS="Schemastests Relaxtests"
1294    if test "$PYTHON_INCLUDES" != "" ; then
1295        PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1296    fi
1297    with_regexps=yes
1298fi
1299AC_SUBST(WITH_SCHEMAS)
1300AC_SUBST(TEST_SCHEMAS)
1301
1302if test "$with_regexps" = "no" ; then
1303    echo Disabling Regexps support
1304    WITH_REGEXPS=0
1305    TEST_REGEXPS=
1306else
1307    WITH_REGEXPS=1
1308    TEST_REGEXPS="Regexptests Automatatests"
1309fi
1310AC_SUBST(WITH_REGEXPS)
1311AC_SUBST(TEST_REGEXPS)
1312
1313if test "$with_debug" = "no" ; then
1314    echo Disabling DEBUG support
1315    WITH_DEBUG=0
1316    DEBUG_OBJ=
1317    TEST_DEBUG=
1318else
1319    WITH_DEBUG=1
1320    DEBUG_OBJ=debugXML.o
1321    TEST_DEBUG=Scripttests
1322fi
1323AC_SUBST(WITH_DEBUG)
1324AC_SUBST(DEBUG_OBJ)
1325AC_SUBST(TEST_DEBUG)
1326
1327if test "$with_mem_debug" = "yes" ; then
1328    if test "$with_thread_alloc" = "yes" ; then
1329        echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1330	WITH_MEM_DEBUG=0
1331    else
1332        echo Enabling memory debug support
1333        WITH_MEM_DEBUG=1
1334    fi
1335else
1336    WITH_MEM_DEBUG=0
1337fi
1338AC_SUBST(WITH_MEM_DEBUG)
1339
1340if test "$with_run_debug" = "yes" ; then
1341    echo Enabling runtime debug support
1342    WITH_RUN_DEBUG=1
1343else
1344    WITH_RUN_DEBUG=0
1345fi
1346AC_SUBST(WITH_RUN_DEBUG)
1347
1348WIN32_EXTRA_LIBADD=
1349WIN32_EXTRA_LDFLAGS=
1350CYGWIN_EXTRA_LDFLAGS=
1351CYGWIN_EXTRA_PYTHON_LIBADD=
1352case "$host" in
1353 *-*-mingw*)
1354 CPPFLAGS="$CPPFLAGS -DWIN32"
1355 WIN32_EXTRA_LIBADD="-lws2_32"
1356 WIN32_EXTRA_LDFLAGS="-no-undefined"
1357 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1358 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1359 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1360 ;;
1361 *-*-cygwin*)
1362 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1363 if test "${PYTHON}" != ""
1364 then
1365   CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1366 fi
1367 ;;
1368esac
1369AC_SUBST(WIN32_EXTRA_LIBADD)
1370AC_SUBST(WIN32_EXTRA_LDFLAGS)
1371AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1372AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1373
1374AC_SUBST(CPPFLAGS)
1375AC_SUBST(CFLAGS)
1376AC_SUBST(XML_CFLAGS)
1377
1378AC_SUBST(XML_LIBDIR)
1379AC_SUBST(XML_LIBS)
1380AC_SUBST(XML_LIBTOOLLIBS)
1381AC_SUBST(ICONV_LIBS)
1382AC_SUBST(XML_INCLUDEDIR)
1383AC_SUBST(HTML_DIR)
1384AC_SUBST(HAVE_ISNAN)
1385AC_SUBST(HAVE_ISINF)
1386AC_SUBST(PYTHON)
1387AC_SUBST(PYTHON_VERSION)
1388AC_SUBST(PYTHON_INCLUDES)
1389AC_SUBST(PYTHON_SITE_PACKAGES)
1390
1391AC_SUBST(M_LIBS)
1392AC_SUBST(RDL_LIBS)
1393
1394dnl for the spec file
1395RELDATE=`date +'%a %b %e %Y'`
1396AC_SUBST(RELDATE)
1397AC_SUBST(PYTHON_TESTS)
1398
1399rm -f COPYING.LIB COPYING
1400ln -s Copyright COPYING
1401
1402# keep on one line for cygwin c.f. #130896
1403AC_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)
1404
1405chmod +x xml2-config python/setup.py
1406echo Done configuring
1407