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