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