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