- add sources.
[platform/framework/web/crosswalk.git] / src / third_party / libxml / src / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(entities.c)
3 AM_CONFIG_HEADER(config.h)
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_CANONICAL_HOST
6
7 LIBXML_MAJOR_VERSION=2
8 LIBXML_MINOR_VERSION=7
9 LIBXML_MICRO_VERSION=7
10 LIBXML_MICRO_VERSION_SUFFIX=
11 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
12 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
13
14 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
15
16 if 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
23 else 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
30 else 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
37 fi
38 fi
39 fi
40 AC_SUBST(LIBXML_MAJOR_VERSION)
41 AC_SUBST(LIBXML_MINOR_VERSION)
42 AC_SUBST(LIBXML_MICRO_VERSION)
43 AC_SUBST(LIBXML_VERSION)
44 AC_SUBST(LIBXML_VERSION_INFO)
45 AC_SUBST(LIBXML_VERSION_NUMBER)
46 AC_SUBST(LIBXML_VERSION_EXTRA)
47
48 VERSION=${LIBXML_VERSION}
49
50 AM_INIT_AUTOMAKE(libxml2, $VERSION)
51
52 dnl Checks for programs.
53 AC_PROG_CC
54 AC_PROG_INSTALL
55 AC_PROG_CPP
56 AC_PATH_PROG(RM, rm, /bin/rm)
57 AC_PATH_PROG(MV, mv, /bin/mv)
58 AC_PATH_PROG(TAR, tar, /bin/tar)
59 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
60 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
61 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
62 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
63
64 dnl Make sure we have an ANSI compiler
65 AM_C_PROTOTYPES
66 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
67
68 AC_LIBTOOL_WIN32_DLL
69 AM_PROG_LIBTOOL
70
71 dnl
72 dnl if the system support linker version scripts for symbol versioning
73 dnl then add it
74 dnl
75 VERSION_SCRIPT_FLAGS=
76 # lt_cv_prog_gnu_ld is from libtool 2.+
77 if test "$lt_cv_prog_gnu_ld" = yes; then
78   VERSION_SCRIPT_FLAGS=-Wl,--version-script=
79 else
80   case $host in
81   *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
82   esac
83 fi
84 AC_SUBST(VERSION_SCRIPT_FLAGS)
85 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
86
87 dnl
88 dnl We process the AC_ARG_WITH first so that later we can modify
89 dnl some of them to try to prevent impossible combinations.  This
90 dnl also allows up so alphabetize the choices
91 dnl
92
93 dnl
94 dnl zlib option might change flags, so we save them initially
95 dnl
96 _cppflags="${CPPFLAGS}"
97 _ldflags="${LDFLAGS}"
98
99 AC_ARG_WITH(c14n,
100 [  --with-c14n             add the Canonicalization support (on)])
101 AC_ARG_WITH(catalog,
102 [  --with-catalog          add the Catalog support (on)])
103 AC_ARG_WITH(debug,
104 [  --with-debug            add the debugging module (on)])
105 AC_ARG_WITH(docbook,
106 [  --with-docbook          add Docbook SGML support (on)])
107 AC_ARG_WITH(fexceptions,
108 [  --with-fexceptions      add GCC flag -fexceptions for C++ exceptions (off)])
109 AC_ARG_WITH(ftp,
110 [  --with-ftp              add the FTP support (on)])
111 AC_ARG_WITH(history,
112 [  --with-history          add history support to xmllint shell(off)])
113 AC_ARG_WITH(html,
114 [  --with-html             add the HTML support (on)])
115 dnl Specific dir for HTML output ?
116 AC_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
120 AC_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"])
124 AC_SUBST(HTML_DIR)
125 AC_ARG_WITH(http,
126 [  --with-http             add the HTTP support (on)])
127 AC_ARG_WITH(iconv,
128 [  --with-iconv[[=DIR]]      add ICONV support (on)])
129 AC_ARG_WITH(iso8859x,
130 [  --with-iso8859x         add ISO8859X support if no iconv (on)])
131 AC_ARG_WITH(legacy,
132 [  --with-legacy           add deprecated APIs for compatibility (on)])
133 AC_ARG_WITH(mem_debug,
134 [  --with-mem-debug        add the memory debugging module (off)])
135 AC_ARG_WITH(minimum,
136 [  --with-minimum          build a minimally sized library (off)])
137 AC_ARG_WITH(output,
138 [  --with-output           add the serialization support (on)])
139 AC_ARG_WITH(pattern,
140 [  --with-pattern          add the xmlPattern selection interface (on)])
141 AC_ARG_WITH(push,
142 [  --with-push             add the PUSH parser interfaces (on)])
143 AC_ARG_WITH(python,
144 [  --with-python[[=DIR]]     build Python bindings if found])
145 AC_ARG_WITH(reader,
146 [  --with-reader           add the xmlReader parsing interface (on)])
147 AC_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 ])
155 AC_ARG_WITH(regexps,
156 [  --with-regexps          add Regular Expressions support (on)])
157 AC_ARG_WITH(run_debug,
158 [  --with-run-debug        add the runtime debugging module (off)])
159 AC_ARG_WITH(sax1,
160 [  --with-sax1             add the older SAX1 interface (on)])
161 AC_ARG_WITH(schemas,
162 [  --with-schemas          add Relax-NG and Schemas support (on)])
163 AC_ARG_WITH(schematron,
164 [  --with-schematron       add Schematron support (on)])
165 AC_ARG_WITH(threads,
166 [  --with-threads          add multithread support(on)])
167 AC_ARG_WITH(thread-alloc,
168 [  --with-thread-alloc     add per-thread memory(off)])
169 AC_ARG_WITH(tree,
170 [  --with-tree             add the DOM like tree manipulation APIs (on)])
171 AC_ARG_WITH(valid,
172 [  --with-valid            add the DTD validation support (on)])
173 AC_ARG_WITH(writer,
174 [  --with-writer           add the xmlWriter saving interface (on)])
175 AC_ARG_WITH(xinclude,
176 [  --with-xinclude         add the XInclude support (on)])
177 AC_ARG_WITH(xpath,
178 [  --with-xpath            add the XPATH support (on)])
179 AC_ARG_WITH(xptr,
180 [  --with-xptr             add the XPointer support (on)])
181 AC_ARG_WITH(modules,
182 [  --with-modules          add the dynamic modules support (on)])
183 AC_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 ])
191 AC_ARG_WITH(coverage,
192 [  --with-coverage         build for code coverage with GCC (off)])
193
194 AC_ARG_ENABLE(rebuild-docs,
195 [  --enable-rebuild-docs[[=yes/no]]  rebuild some generated docs [[default=yes]]])
196 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
197
198 dnl
199 dnl hard dependancies on options
200 dnl
201 if test "$with_schemas" = "yes"
202 then
203     with_pattern=yes
204     with_regexps=yes
205 fi
206 if test "$with_schematron" = "yes"
207 then
208     with_pattern=yes
209     with_xpath=yes
210 fi
211 if test "$with_reader" = "yes"
212 then
213     with_push=yes
214 fi
215 if test "$with_xptr" = "yes"
216 then
217     with_xpath=yes
218 fi
219 dnl
220 dnl option to build a minimal libxml2 library
221 dnl
222 if test "$with_minimum" = "yes"
223 then
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
362 fi
363
364 echo Checking zlib
365
366 dnl Checks for zlib library.
367
368 WITH_ZLIB=0
369 if test "$with_zlib" = "no"; then
370     echo "Disabling compression support"
371 else
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]))
387 fi
388
389 AC_SUBST(Z_CFLAGS)
390 AC_SUBST(Z_LIBS)
391 AC_SUBST(WITH_ZLIB)
392
393 CPPFLAGS=${_cppflags}
394 LDFLAGS=${_ldflags}
395
396 echo Checking headers
397
398 dnl Checks for header files.
399 AC_HEADER_DIRENT
400 AC_HEADER_STDC
401 AC_CHECK_HEADERS([fcntl.h])
402 AC_CHECK_HEADERS([unistd.h])
403 AC_CHECK_HEADERS([ctype.h])
404 AC_CHECK_HEADERS([dirent.h])
405 AC_CHECK_HEADERS([errno.h])
406 AC_CHECK_HEADERS([malloc.h])
407 AC_CHECK_HEADERS([stdarg.h])
408 AC_CHECK_HEADERS([sys/stat.h])
409 AC_CHECK_HEADERS([sys/types.h])
410 AC_CHECK_HEADERS([stdint.h])
411 AC_CHECK_HEADERS([inttypes.h.h])
412 AC_CHECK_HEADERS([time.h])
413 AC_CHECK_HEADERS([ansidecl.h])
414 AC_CHECK_HEADERS([ieeefp.h])
415 AC_CHECK_HEADERS([nan.h])
416 AC_CHECK_HEADERS([math.h])
417 AC_CHECK_HEADERS([limits.h])
418 AC_CHECK_HEADERS([fp_class.h])
419 AC_CHECK_HEADERS([float.h])
420 AC_CHECK_HEADERS([stdlib.h])
421 AC_CHECK_HEADERS([sys/socket.h], [], [],
422 [#if HAVE_SYS_TYPES_H
423 # include <sys/types.h>
424 # endif
425 ])
426 AC_CHECK_HEADERS([netinet/in.h], [], [],
427 [#if HAVE_SYS_TYPES_H
428 # include <sys/types.h>
429 # endif
430 ])
431 AC_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 ])
439 AC_CHECK_HEADERS([netdb.h])
440 AC_CHECK_HEADERS([sys/time.h])
441 AC_CHECK_HEADERS([sys/select.h])
442 AC_CHECK_HEADERS([poll.h])
443 AC_CHECK_HEADERS([sys/mman.h])
444 AC_CHECK_HEADERS([sys/timeb.h])
445 AC_CHECK_HEADERS([signal.h])
446 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
447 [#if HAVE_SYS_TYPES_H
448 # include <sys/types.h>
449 # endif
450 ])
451 AC_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 ])
462 AC_CHECK_HEADERS([dl.h])
463 AC_CHECK_HEADERS([dlfcn.h])
464
465
466 echo Checking libraries
467
468 dnl Checks for library functions.
469 AC_FUNC_STRFTIME
470 AC_CHECK_FUNCS(strdup strndup strerror)
471 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
472 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
473 AC_CHECK_FUNCS(stat _stat signal)
474
475 dnl Checking the standard string functions availability
476 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
477                NEED_TRIO=1)
478
479 dnl Checking for va_copy availability
480 AC_MSG_CHECKING([for va_copy])
481 AC_TRY_LINK([#include <stdarg.h>
482 va_list ap1,ap2;], [va_copy(ap1,ap2);],
483 have_va_copy=yes,
484 have_va_copy=no)
485 AC_MSG_RESULT($have_va_copy)
486 if test x"$have_va_copy" = x"yes"; then
487     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
488 else
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
498 fi
499
500 dnl Checks for inet libraries:
501 AC_SEARCH_LIBS(gethostent, [nsl])
502 AC_SEARCH_LIBS(setsockopt, [socket net network])
503 AC_SEARCH_LIBS(connect, [inet])
504
505 dnl Determine what socket length (socklen_t) data type is
506 AC_MSG_CHECKING([for type of socket length (socklen_t)])
507 AC_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"])])])
530 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
531
532 dnl ***********************Checking for availability of IPv6*******************
533
534 AC_MSG_CHECKING([whether to enable IPv6])
535 AC_ARG_ENABLE(ipv6, [  --enable-ipv6[[=yes/no]]  enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
536 if test "$with_minimum" = "yes"
537 then
538     enable_ipv6=no
539 fi
540 if 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
612 fi 
613
614 dnl ******************************End IPv6 checks******************************
615
616 dnl Checks for isnan in libm if not in libc
617 AC_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
620 AC_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
623 XML_LIBDIR='-L${libdir}'
624 XML_INCLUDEDIR='-I${includedir}/libxml2'
625
626 dnl
627 dnl Extra flags
628 dnl
629 XML_CFLAGS=""
630 RDL_LIBS=""
631
632 dnl
633 dnl Workaround for native compilers
634 dnl  HP  : http://bugs.gnome.org/db/31/3163.html
635 dnl  DEC : Enable NaN/Inf
636 dnl
637 if 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
649 else
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
668 fi
669 case ${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         ;;
687 esac
688
689
690 dnl
691 dnl check for python
692 dnl
693
694 PYTHON_VERSION=
695 PYTHON_INCLUDES=
696 PYTHON_SITE_PACKAGES=
697 PYTHON_TESTS=
698 pythondir=
699 if 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
758 else
759     PYTHON=
760 fi
761 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
762 if test "$PYTHON_INCLUDES" != ""
763 then
764     PYTHON_SUBDIR=python
765 else
766     PYTHON_SUBDIR=
767 fi
768 AC_SUBST(pythondir)
769 AC_SUBST(PYTHON_SUBDIR)
770 AC_SUBST(PYTHON_LIBS)
771
772 dnl check for dso support
773 WITH_MODULES=0
774 TEST_MODULES=
775
776 if 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
821 fi
822
823 if test "${WITH_MODULES}" = "1"; then
824   TEST_MODULES="ModuleTests"
825 fi  
826
827 AC_SUBST(WITH_MODULES)
828 AC_SUBST(MODULE_PLATFORM_LIBS)
829 AC_SUBST(MODULE_EXTENSION)
830 AC_SUBST(TEST_MODULES)
831
832 dnl
833 dnl Tester makes use of readline if present
834 dnl
835
836 dnl
837 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
838 dnl (-Wunreachable-code)
839 dnl
840 if [[ "${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"
859 dnl -Wcast-qual -ansi
860 else
861     STATIC_BINARIES=
862 fi
863 AC_SUBST(STATIC_BINARIES)
864
865 dnl
866 dnl Check for trio string functions
867 dnl
868
869 if test "${NEED_TRIO}" = "1" ; then
870     echo Adding trio library for string functions
871     WITH_TRIO=1
872 else    
873     WITH_TRIO=0
874 fi
875 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
876 AC_SUBST(WITH_TRIO)
877
878 dnl
879 dnl Allow to enable/disable various pieces
880 dnl
881 echo Checking configuration requirements
882
883 dnl
884 dnl Thread-related stuff
885 dnl
886 THREAD_LIBS=""
887 BASE_THREAD_LIBS=""
888 WITH_THREADS=0
889 THREAD_CFLAGS=""
890 TEST_THREADS=""
891 THREADS_W32=""
892
893 if test "$with_threads" = "no" ; then
894     echo Disabling multithreaded support
895 else
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
945 fi
946 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
947     THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
948 fi
949
950 AC_SUBST(THREAD_LIBS)
951 AC_SUBST(BASE_THREAD_LIBS)
952 AC_SUBST(WITH_THREADS)
953 AC_SUBST(THREAD_CFLAGS)
954 AC_SUBST(TEST_THREADS)
955 AC_SUBST(THREADS_W32)
956
957 dnl
958 dnl xmllint shell history
959 dnl
960 if 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
982 fi
983
984 dnl
985 dnl Tree functions
986 dnl
987 if test "$with_tree" = "no" ; then
988     echo Disabling DOM like tree manipulation APIs
989     WITH_TREE=0
990 else    
991     WITH_TREE=1
992 fi
993 AC_SUBST(WITH_TREE)
994
995 if test "$with_ftp" = "no" ; then
996     echo Disabling FTP support
997     WITH_FTP=0
998     FTP_OBJ=
999 else    
1000     WITH_FTP=1
1001     FTP_OBJ=nanoftp.o
1002 fi
1003 AC_SUBST(WITH_FTP)
1004 AC_SUBST(FTP_OBJ)
1005
1006 if test "$with_http" = "no" ; then
1007     echo Disabling HTTP support
1008     WITH_HTTP=0
1009     HTTP_OBJ=
1010 else    
1011     WITH_HTTP=1
1012     HTTP_OBJ=nanohttp.o
1013 fi
1014 AC_SUBST(WITH_HTTP)
1015 AC_SUBST(HTTP_OBJ)
1016
1017 if test "$with_legacy" = "no" ; then
1018     echo Disabling deprecated APIs
1019     WITH_LEGACY=0
1020 else    
1021     WITH_LEGACY=1
1022 fi
1023 AC_SUBST(WITH_LEGACY)
1024
1025 if test "$with_reader" = "no" ; then
1026     echo Disabling the xmlReader parsing interface
1027     WITH_READER=0
1028     READER_TEST=
1029 else    
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
1036 fi
1037 AC_SUBST(WITH_READER)
1038 AC_SUBST(READER_TEST)
1039
1040 if test "$with_writer" = "no" ; then
1041     echo Disabling the xmlWriter saving interface
1042     WITH_WRITER=0
1043 #    WRITER_TEST=
1044 else    
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
1055 fi
1056 AC_SUBST(WITH_WRITER)
1057 #AC_SUBST(WRITER_TEST)
1058
1059 if test "$with_pattern" = "no" ; then
1060     echo Disabling the xmlPattern parsing interface
1061     WITH_PATTERN=0
1062     TEST_PATTERN=
1063 else    
1064     WITH_PATTERN=1
1065     TEST_PATTERN=Patterntests
1066 fi
1067 AC_SUBST(WITH_PATTERN)
1068 AC_SUBST(TEST_PATTERN)
1069
1070 if test "$with_sax1" = "no" ; then
1071     echo Disabling the older SAX1 interface
1072     WITH_SAX1=0
1073     TEST_SAX=
1074 else    
1075     WITH_SAX1=1
1076     TEST_SAX=SAXtests
1077 fi
1078 AC_SUBST(WITH_SAX1)
1079 AC_SUBST(TEST_SAX)
1080
1081 if test "$with_push" = "no" ; then
1082     echo Disabling the PUSH parser interfaces
1083     WITH_PUSH=0
1084     TEST_PUSH=
1085 else    
1086     WITH_PUSH=1
1087     TEST_PUSH="XMLPushtests"
1088 fi
1089 AC_SUBST(WITH_PUSH)
1090 AC_SUBST(TEST_PUSH)
1091
1092 if test "$with_html" = "no" ; then
1093     echo Disabling HTML support
1094     WITH_HTML=0
1095     HTML_OBJ=
1096     TEST_HTML=
1097 else    
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
1106 fi
1107 AC_SUBST(WITH_HTML)
1108 AC_SUBST(HTML_OBJ)
1109 AC_SUBST(TEST_HTML)
1110 AC_SUBST(TEST_PHTML)
1111
1112 if test "$with_valid" = "no" ; then
1113     echo Disabling DTD validation support
1114     WITH_VALID=0
1115     TEST_VALID=
1116     TEST_VTIME=
1117 else    
1118     WITH_VALID=1
1119     TEST_VALID=Validtests
1120     TEST_VTIME=VTimingtests
1121 fi
1122 AC_SUBST(WITH_VALID)
1123 AC_SUBST(TEST_VALID)
1124 AC_SUBST(TEST_VTIME)
1125
1126 if test "$with_catalog" = "no" ; then
1127     echo Disabling Catalog support
1128     WITH_CATALOG=0
1129     CATALOG_OBJ=
1130     TEST_CATALOG=
1131 else    
1132     WITH_CATALOG=1
1133     CATALOG_OBJ="catalog.o"
1134     TEST_CATALOG=Catatests
1135 fi
1136 AC_SUBST(WITH_CATALOG)
1137 AC_SUBST(CATALOG_OBJ)
1138 AC_SUBST(TEST_CATALOG)
1139
1140 if test "$with_docbook" = "no" ; then
1141     echo Disabling Docbook support
1142     WITH_DOCB=0
1143     DOCB_OBJ=
1144 else    
1145     WITH_DOCB=1
1146     DOCB_OBJ="DOCBparser.o"
1147 fi
1148 AC_SUBST(WITH_DOCB)
1149 AC_SUBST(DOCB_OBJ)
1150
1151
1152 if test "$with_xptr" = "no" ; then
1153     echo Disabling XPointer support
1154     WITH_XPTR=0
1155     XPTR_OBJ=
1156     TEST_XPTR=
1157 else    
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
1165 fi
1166 AC_SUBST(WITH_XPTR)
1167 AC_SUBST(XPTR_OBJ)
1168 AC_SUBST(TEST_XPTR)
1169
1170 if test "$with_c14n" = "no" ; then
1171     echo Disabling C14N support
1172     WITH_C14N=0
1173     C14N_OBJ=
1174     TEST_C14N=
1175 else    
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
1183 fi
1184 AC_SUBST(WITH_C14N)
1185 AC_SUBST(C14N_OBJ)
1186 AC_SUBST(TEST_C14N)
1187
1188 if test "$with_xinclude" = "no" ; then
1189     echo Disabling XInclude support
1190     WITH_XINCLUDE=0
1191     XINCLUDE_OBJ=
1192     with_xinclude="no"
1193     TEST_XINCLUDE=
1194 else    
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
1202 fi
1203 AC_SUBST(WITH_XINCLUDE)
1204 AC_SUBST(XINCLUDE_OBJ)
1205 AC_SUBST(TEST_XINCLUDE)
1206
1207 if test "$with_xpath" = "no" ; then
1208     echo Disabling XPATH support
1209     WITH_XPATH=0
1210     XPATH_OBJ=
1211     TEST_XPATH=
1212 else    
1213     WITH_XPATH=1
1214     XPATH_OBJ=xpath.o
1215     TEST_XPATH=XPathtests
1216 fi
1217 AC_SUBST(WITH_XPATH)
1218 AC_SUBST(XPATH_OBJ)
1219 AC_SUBST(TEST_XPATH)
1220
1221 dnl
1222 dnl output functions
1223 dnl
1224 if test "$with_output" = "no" ; then
1225     echo Disabling serialization/saving support
1226     WITH_OUTPUT=0
1227 else    
1228     WITH_OUTPUT=1
1229 fi
1230 AC_SUBST(WITH_OUTPUT)
1231
1232 WITH_ICONV=0
1233 if test "$with_iconv" = "no" ; then
1234     echo Disabling ICONV support
1235 else
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>],[
1247 iconv_t cd = iconv_open ("","");
1248 iconv (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>],[
1261 iconv_t cd = iconv_open ("","");
1262 iconv (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>
1277 extern
1278 #ifdef __cplusplus
1279 "C"
1280 #endif
1281 #if defined(__STDC__) || defined(__cplusplus)
1282 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1283 #else
1284 size_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
1294 fi
1295 case "$host" in
1296         *mingw*) M_LIBS=""
1297         ;;
1298         *beos*) M_LIBS=""
1299         ;;
1300         *haiku*) M_LIBS=""
1301         ;;
1302         *) M_LIBS="-lm"
1303         ;;
1304 esac
1305 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1306 XML_LIBTOOLLIBS="libxml2.la"
1307 AC_SUBST(WITH_ICONV)
1308
1309 WITH_ISO8859X=1
1310 if test "$WITH_ICONV" != "1" ; then
1311 if test "$with_iso8859x" = "no" ; then
1312     echo Disabling ISO8859X support
1313     WITH_ISO8859X=0
1314 fi
1315 fi
1316 AC_SUBST(WITH_ISO8859X)
1317
1318 if test "$with_schematron" = "no" ; then
1319     echo "Disabling Schematron support"
1320     WITH_SCHEMATRON=0
1321     TEST_SCHEMATRON=
1322 else    
1323     echo "Enabled Schematron support"
1324     WITH_SCHEMATRON=1
1325     TEST_SCHEMATRON="Schematrontests"
1326     with_xpath=yes
1327     with_pattern=yes
1328 fi
1329 AC_SUBST(WITH_SCHEMATRON)
1330 AC_SUBST(TEST_SCHEMATRON)
1331
1332 if test "$with_schemas" = "no" ; then
1333     echo "Disabling Schemas/Relax-NG support"
1334     WITH_SCHEMAS=0
1335     TEST_SCHEMAS=
1336 else    
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
1344 fi
1345 AC_SUBST(WITH_SCHEMAS)
1346 AC_SUBST(TEST_SCHEMAS)
1347
1348 if test "$with_regexps" = "no" ; then
1349     echo Disabling Regexps support
1350     WITH_REGEXPS=0
1351     TEST_REGEXPS=
1352 else    
1353     WITH_REGEXPS=1
1354     TEST_REGEXPS="Regexptests Automatatests"
1355 fi
1356 AC_SUBST(WITH_REGEXPS)
1357 AC_SUBST(TEST_REGEXPS)
1358
1359 if test "$with_debug" = "no" ; then
1360     echo Disabling DEBUG support
1361     WITH_DEBUG=0
1362     DEBUG_OBJ=
1363     TEST_DEBUG=
1364 else    
1365     WITH_DEBUG=1
1366     DEBUG_OBJ=debugXML.o
1367     TEST_DEBUG=Scripttests
1368 fi
1369 AC_SUBST(WITH_DEBUG)
1370 AC_SUBST(DEBUG_OBJ)
1371 AC_SUBST(TEST_DEBUG)
1372
1373 if 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
1381 else    
1382     WITH_MEM_DEBUG=0
1383 fi
1384 AC_SUBST(WITH_MEM_DEBUG)
1385
1386 if test "$with_run_debug" = "yes" ; then
1387     echo Enabling runtime debug support
1388     WITH_RUN_DEBUG=1
1389 else    
1390     WITH_RUN_DEBUG=0
1391 fi
1392 AC_SUBST(WITH_RUN_DEBUG)
1393
1394 WIN32_EXTRA_LIBADD=
1395 WIN32_EXTRA_LDFLAGS=
1396 CYGWIN_EXTRA_LDFLAGS=
1397 CYGWIN_EXTRA_PYTHON_LIBADD=
1398 case "$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  ;;
1414 esac
1415 AC_SUBST(WIN32_EXTRA_LIBADD)
1416 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1417 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1418 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1419
1420 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1421 then
1422     echo Enabling code coverage for GCC
1423     CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1424     LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1425 else
1426     echo Disabling code coverage for GCC
1427 fi
1428
1429 AC_SUBST(CPPFLAGS)
1430 AC_SUBST(CFLAGS)
1431 AC_SUBST(LDFLAGS)
1432 AC_SUBST(XML_CFLAGS)
1433
1434 AC_SUBST(XML_LIBDIR)
1435 AC_SUBST(XML_LIBS)
1436 AC_SUBST(XML_LIBTOOLLIBS)
1437 AC_SUBST(ICONV_LIBS)
1438 AC_SUBST(XML_INCLUDEDIR)
1439 AC_SUBST(HTML_DIR)
1440 AC_SUBST(HAVE_ISNAN)
1441 AC_SUBST(HAVE_ISINF)
1442 AC_SUBST(PYTHON)
1443 AC_SUBST(PYTHON_VERSION)
1444 AC_SUBST(PYTHON_INCLUDES)
1445 AC_SUBST(PYTHON_SITE_PACKAGES)
1446
1447 AC_SUBST(M_LIBS)
1448 AC_SUBST(RDL_LIBS)
1449
1450 dnl for the spec file
1451 RELDATE=`date +'%a %b %e %Y'`
1452 AC_SUBST(RELDATE)
1453 AC_SUBST(PYTHON_TESTS)
1454
1455 rm -f COPYING.LIB COPYING
1456 ln -s Copyright COPYING
1457
1458 # keep on one line for cygwin c.f. #130896
1459 AC_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
1461 chmod +x xml2-config python/setup.py
1462 echo Done configuring