1 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h)
5 AC_CONFIG_MACRO_DIR([m4])
10 LIBXML_MICRO_VERSION=0
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
15 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
17 if test -f CVS/Entries ; then
18 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
20 if test "$extra" != ""
22 LIBXML_VERSION_EXTRA="-CVS$extra"
24 else if test -d .svn ; then
25 extra=`svn info | grep Revision | sed 's+Revision: ++'`
27 if test "$extra" != ""
29 LIBXML_VERSION_EXTRA="-SVN$extra"
31 else if test -d .git ; then
32 extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'`
34 if test "$extra" != ""
36 LIBXML_VERSION_EXTRA="-GIT$extra"
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)
49 VERSION=${LIBXML_VERSION}
51 AM_INIT_AUTOMAKE(libxml2, $VERSION)
53 # Support silent build rules, requires at least automake-1.11. Disable
54 # by either passing --disable-silent-rules to configure or passing V=1
56 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
58 dnl Checks for programs.
63 AC_PATH_PROG(RM, rm, /bin/rm)
64 AC_PATH_PROG(MV, mv, /bin/mv)
65 AC_PATH_PROG(TAR, tar, /bin/tar)
66 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
67 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
68 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
69 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
75 dnl if the system support linker version scripts for symbol versioning
79 # lt_cv_prog_gnu_ld is from libtool 2.+
80 if test "$lt_cv_prog_gnu_ld" = yes; then
81 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
84 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
87 AC_SUBST(VERSION_SCRIPT_FLAGS)
88 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
91 dnl We process the AC_ARG_WITH first so that later we can modify
92 dnl some of them to try to prevent impossible combinations. This
93 dnl also allows up so alphabetize the choices
97 dnl zlib option might change flags, so we save them initially
99 _cppflags="${CPPFLAGS}"
100 _ldflags="${LDFLAGS}"
103 [ --with-c14n add the Canonicalization support (on)])
105 [ --with-catalog add the Catalog support (on)])
107 [ --with-debug add the debugging module (on)])
109 [ --with-docbook add Docbook SGML support (on)])
110 AC_ARG_WITH(fexceptions,
111 [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
113 [ --with-ftp add the FTP support (on)])
115 [ --with-history add history support to xmllint shell(off)])
117 [ --with-html add the HTML support (on)])
118 dnl Specific dir for HTML output ?
119 AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
120 [path to base html directory, default $datadir/doc/html]),
121 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
123 AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
124 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
125 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
126 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
129 [ --with-http add the HTTP support (on)])
131 [ --with-iconv[[=DIR]] add ICONV support (on)])
133 [ --with-icu add ICU support (off)])
134 AC_ARG_WITH(iso8859x,
135 [ --with-iso8859x add ISO8859X support if no iconv (on)])
137 [ --with-legacy add deprecated APIs for compatibility (on)])
138 AC_ARG_WITH(mem_debug,
139 [ --with-mem-debug add the memory debugging module (off)])
141 [ --with-minimum build a minimally sized library (off)])
143 [ --with-output add the serialization support (on)])
145 [ --with-pattern add the xmlPattern selection interface (on)])
147 [ --with-push add the PUSH parser interfaces (on)])
149 [ --with-python[[=DIR]] build Python bindings if found])
151 [ --with-reader add the xmlReader parsing interface (on)])
152 AC_ARG_WITH(readline,
153 [ --with-readline=DIR use readline in DIR],[
154 if test "$withval" != "no" -a "$withval" != "yes"; then
156 CPPFLAGS="${CPPFLAGS} -I$withval/include"
157 LDFLAGS="${LDFLAGS} -L$withval/lib"
161 [ --with-regexps add Regular Expressions support (on)])
162 AC_ARG_WITH(run_debug,
163 [ --with-run-debug add the runtime debugging module (off)])
165 [ --with-sax1 add the older SAX1 interface (on)])
167 [ --with-schemas add Relax-NG and Schemas support (on)])
168 AC_ARG_WITH(schematron,
169 [ --with-schematron add Schematron support (on)])
171 [ --with-threads add multithread support(on)])
172 AC_ARG_WITH(thread-alloc,
173 [ --with-thread-alloc add per-thread memory(off)])
175 [ --with-tree add the DOM like tree manipulation APIs (on)])
177 [ --with-valid add the DTD validation support (on)])
179 [ --with-writer add the xmlWriter saving interface (on)])
180 AC_ARG_WITH(xinclude,
181 [ --with-xinclude add the XInclude support (on)])
183 [ --with-xpath add the XPATH support (on)])
185 [ --with-xptr add the XPointer support (on)])
187 [ --with-modules add the dynamic modules support (on)])
189 [ --with-zlib[[=DIR]] use libz in DIR],[
190 if test "$withval" != "no" -a "$withval" != "yes"; then
192 CPPFLAGS="${CPPFLAGS} -I$withval/include"
193 LDFLAGS="${LDFLAGS} -L$withval/lib"
197 [ --with-lzma[[=DIR]] use liblzma in DIR],[
198 if test "$withval" != "no" -a "$withval" != "yes"; then
200 CPPFLAGS="${CPPFLAGS} -I$withval/include"
201 LDFLAGS="${LDFLAGS} -L$withval/lib"
204 AC_ARG_WITH(coverage,
205 [ --with-coverage build for code coverage with GCC (off)])
207 AC_ARG_ENABLE(rebuild-docs,
208 [ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
209 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
212 dnl hard dependancies on options
214 if test "$with_schemas" = "yes"
219 if test "$with_schematron" = "yes"
224 if test "$with_reader" = "yes"
228 if test "$with_xptr" = "yes"
233 dnl option to build a minimal libxml2 library
235 if test "$with_minimum" = "yes"
237 echo "Configuring for a minimal library"
238 if test "$with_c14n" = ""
242 if test "$with_catalog" = ""
247 if test "$with_debug" = ""
251 if test "$with_docbook" = ""
255 if test "$with_fexceptions" = ""
259 if test "$with_ftp" = ""
263 if test "$with_history" = ""
267 if test "$with_html" = ""
271 if test "$with_http" = ""
275 if test "$with_iconv" = ""
279 if test "$with_iso8859x" = ""
283 if test "$with_legacy" = ""
287 if test "$with_mem_debug" = ""
291 if test "$with_output" = ""
295 if test "$with_pattern" = ""
299 if test "$with_push" = ""
303 if test "$with_python" = ""
307 if test "$with_reader" = ""
311 if test "$with_readline" = ""
315 if test "$with_regexps" = ""
319 if test "$with_run_debug" = ""
323 if test "$with_sax1" = ""
327 if test "$with_schemas" = ""
331 if test "$with_schematron" = ""
335 if test "$with_threads" = ""
339 if test "$with_thread_alloc" = ""
343 if test "$with_tree" = ""
347 if test "$with_valid" = ""
351 if test "$with_writer" = ""
355 if test "$with_xinclude" = ""
359 if test "$with_xpath" = ""
363 if test "$with_xptr" = ""
367 if test "$with_zlib" = ""
371 if test "$with_modules" = ""
379 dnl Checks for zlib library.
382 if test "$with_zlib" = "no"; then
383 echo "Disabling compression support"
385 AC_CHECK_HEADERS(zlib.h,
386 AC_CHECK_LIB(z, gzread,[
387 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
389 if test "x${Z_DIR}" != "x"; then
390 Z_CFLAGS="-I${Z_DIR}/include"
391 Z_LIBS="-L${Z_DIR}/lib -lz"
394 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
408 dnl Checks for lzma library.
411 if test "$with_lzma" = "no"; then
412 echo "Disabling compression support"
414 AC_CHECK_HEADERS(lzma.h,
415 AC_CHECK_LIB(lzma, lzma_code,[
416 AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
418 if test "x${LZMA_DIR}" != "x"; then
419 LZMA_CFLAGS="-I${LZMA_DIR}/include"
420 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
426 AC_SUBST(LZMA_CFLAGS)
430 CPPFLAGS=${_cppflags}
433 echo Checking headers
435 dnl Checks for header files.
438 AC_CHECK_HEADERS([fcntl.h])
439 AC_CHECK_HEADERS([unistd.h])
440 AC_CHECK_HEADERS([ctype.h])
441 AC_CHECK_HEADERS([dirent.h])
442 AC_CHECK_HEADERS([errno.h])
443 AC_CHECK_HEADERS([malloc.h])
444 AC_CHECK_HEADERS([stdarg.h])
445 AC_CHECK_HEADERS([sys/stat.h])
446 AC_CHECK_HEADERS([sys/types.h])
447 AC_CHECK_HEADERS([stdint.h])
448 AC_CHECK_HEADERS([inttypes.h])
449 AC_CHECK_HEADERS([time.h])
450 AC_CHECK_HEADERS([ansidecl.h])
451 AC_CHECK_HEADERS([ieeefp.h])
452 AC_CHECK_HEADERS([nan.h])
453 AC_CHECK_HEADERS([math.h])
454 AC_CHECK_HEADERS([limits.h])
455 AC_CHECK_HEADERS([fp_class.h])
456 AC_CHECK_HEADERS([float.h])
457 AC_CHECK_HEADERS([stdlib.h])
458 AC_CHECK_HEADERS([sys/socket.h], [], [],
459 [#if HAVE_SYS_TYPES_H
460 # include <sys/types.h>
463 AC_CHECK_HEADERS([netinet/in.h], [], [],
464 [#if HAVE_SYS_TYPES_H
465 # include <sys/types.h>
468 AC_CHECK_HEADERS([arpa/inet.h], [], [],
469 [#if HAVE_SYS_TYPES_H
470 # include <sys/types.h>
473 # include <arpa/inet.h>
476 AC_CHECK_HEADERS([netdb.h])
477 AC_CHECK_HEADERS([sys/time.h])
478 AC_CHECK_HEADERS([sys/select.h])
479 AC_CHECK_HEADERS([poll.h])
480 AC_CHECK_HEADERS([sys/mman.h])
481 AC_CHECK_HEADERS([sys/timeb.h])
482 AC_CHECK_HEADERS([signal.h])
483 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
484 [#if HAVE_SYS_TYPES_H
485 # include <sys/types.h>
488 AC_CHECK_HEADERS([resolv.h], [], [],
489 [#if HAVE_SYS_TYPES_H
490 # include <sys/types.h>
492 #if HAVE_NETINET_IN_H
493 # include <netinet/in.h>
495 #if HAVE_ARPA_NAMESER_H
496 # include <arpa/nameser.h>
499 AC_CHECK_HEADERS([dl.h])
500 AC_CHECK_HEADERS([dlfcn.h])
503 echo Checking libraries
505 dnl Checks for library functions.
507 AC_CHECK_FUNCS(strdup strndup strerror)
508 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
509 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
510 AC_CHECK_FUNCS(stat _stat signal)
511 AC_CHECK_FUNCS(rand rand_r srand time)
513 dnl Checking for va_copy availability
514 AC_MSG_CHECKING([for va_copy])
515 AC_TRY_LINK([#include <stdarg.h>
516 va_list ap1,ap2;], [va_copy(ap1,ap2);],
519 AC_MSG_RESULT($have_va_copy)
520 if test x"$have_va_copy" = x"yes"; then
521 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
523 AC_MSG_CHECKING([for __va_copy])
524 AC_TRY_LINK([#include <stdarg.h>
525 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
528 AC_MSG_RESULT($have___va_copy)
529 if test x"$have___va_copy" = x"yes"; then
530 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
534 dnl Checks for inet libraries:
535 AC_SEARCH_LIBS(gethostent, [nsl])
536 AC_SEARCH_LIBS(setsockopt, [socket net network])
537 AC_SEARCH_LIBS(connect, [inet])
539 dnl Determine what socket length (socklen_t) data type is
540 AC_MSG_CHECKING([for type of socket length (socklen_t)])
543 #include <sys/types.h>
544 #include <sys/socket.h>],[
545 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
546 AC_MSG_RESULT(socklen_t *)
547 XML_SOCKLEN_T=socklen_t],[
550 #include <sys/types.h>
551 #include <sys/socket.h>],[
552 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
553 AC_MSG_RESULT(size_t *)
554 XML_SOCKLEN_T=size_t],[
557 #include <sys/types.h>
558 #include <sys/socket.h>],[
559 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
562 AC_MSG_WARN(could not determine)
563 XML_SOCKLEN_T="int"])])])
564 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
566 dnl ***********************Checking for availability of IPv6*******************
568 AC_MSG_CHECKING([whether to enable IPv6])
569 AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
570 if test "$with_minimum" = "yes"
574 if test $enable_ipv6 = yes; then
577 #include <sys/types.h>
578 #include <sys/socket.h>
580 struct sockaddr_storage ss;
581 socket(AF_INET6, SOCK_STREAM, 0)
586 AC_MSG_RESULT($have_ipv6)
588 if test $have_ipv6 = yes; then
589 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
590 have_broken_ss_family=no
592 dnl *********************************************************************
593 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
594 dnl a ss_family member, but rather __ss_family. Let's detect that
595 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
596 dnl platforms. However, we should only do this if ss_family is not
598 dnl ********************************************************************
599 AC_MSG_CHECKING([struct sockaddr::ss_family])
601 #include <sys/types.h>
602 #include <sys/socket.h>
604 struct sockaddr_storage ss ;
610 AC_MSG_RESULT($have_ss_family)
611 if test x$have_ss_family = xno ; then
612 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
614 #include <sys/types.h>
615 #include <sys/socket.h>
617 struct sockaddr_storage ss ;
620 have_broken_ss_family=yes,
621 have_broken_ss_family=no
623 AC_MSG_RESULT($have_broken_ss_family)
624 if test x$have_broken_ss_family = xyes ; then
625 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
626 [Whether struct sockaddr::__ss_family exists])
627 AC_DEFINE(ss_family, __ss_family,
628 [ss_family is not defined here, use __ss_family instead])
630 AC_MSG_WARN(ss_family and __ss_family not found)
635 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
636 if test $have_getaddrinfo != yes; then
637 for lib in bsd socket inet; do
638 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
642 if test $have_getaddrinfo = yes; then
643 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
648 dnl ******************************End IPv6 checks******************************
650 dnl Checks for isnan in libm if not in libc
651 AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
652 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
654 AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
655 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
657 XML_LIBDIR='-L${libdir}'
658 XML_INCLUDEDIR='-I${includedir}/libxml2'
667 dnl Workaround for native compilers
668 dnl HP : http://bugs.gnome.org/db/31/3163.html
669 dnl DEC : Enable NaN/Inf
671 if test "${GCC}" != "yes" ; then
674 CFLAGS="${CFLAGS} -Wp,-H30000"
677 CFLAGS="${CFLAGS} -ieee"
680 CFLAGS="${CFLAGS} -ieee"
684 if test "$with_fexceptions" = "yes"
687 # Not activated by default because this inflates the code size
688 # Used to allow propagation of C++ exceptions through the library
690 CFLAGS="${CFLAGS} -fexceptions"
693 # warnings we'd like to see
694 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"
695 # warnings we'd like to supress
696 CFLAGS="${CFLAGS} -Wno-long-long"
699 CFLAGS="${CFLAGS} -mieee"
702 CFLAGS="${CFLAGS} -mieee"
708 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
713 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
714 # If the host is Windows, and shared libraries are disabled, we
715 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
716 # work properly (without it, xmlexports.h would force the use of
717 # DLL imports, which obviously aren't present in a static
719 if test "x$enable_shared" = "xno"; then
720 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
721 CFLAGS="$CFLAGS -DLIBXML_STATIC"
733 PYTHON_SITE_PACKAGES=
736 if test "$with_python" != "no" ; then
737 if test -x "$with_python/bin/python"
739 echo Found python in $with_python/bin/python
740 PYTHON="$with_python/bin/python"
742 if test -x "$with_python/python.exe"
744 echo Found python in $with_python/python.exe
745 PYTHON="$with_python/python.exe"
747 if test -x "$with_python"
749 echo Found python in $with_python
750 PYTHON="$with_python"
754 echo Found python in environment PYTHON=$PYTHON
755 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
757 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
762 if test "$PYTHON" != ""
764 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
765 echo Found Python version $PYTHON_VERSION
767 if test "$PYTHON_VERSION" != ""
769 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
770 -d $with_python/lib/python$PYTHON_VERSION/site-packages
772 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
773 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
775 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
777 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
778 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
780 if test -r /usr/include/python$PYTHON_VERSION/Python.h
782 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
783 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
785 if test -r $with_python/include/Python.h -a \
786 -d $with_python/lib/site-packages
788 PYTHON_INCLUDES=$with_python/include
789 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
791 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
795 if test ! -d "$PYTHON_SITE_PACKAGES"
797 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
800 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
802 if test "$with_python" != ""
804 pythondir='$(PYTHON_SITE_PACKAGES)'
806 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
811 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
812 if test "$PYTHON_INCLUDES" != ""
819 AC_SUBST(PYTHON_SUBDIR)
820 AC_SUBST(PYTHON_LIBS)
822 dnl check for dso support
826 if test "$with_modules" != "no" ; then
829 MODULE_EXTENSION=".dll"
830 AC_CHECK_LIB(cygwin, dlopen, [
832 MODULE_PLATFORM_LIBS=
833 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
837 MODULE_EXTENSION=".dll"
841 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
842 AC_CHECK_LIB(dld, shl_load, [
843 MODULE_PLATFORM_LIBS="-ldld"
844 libxml_have_shl_load=yes], [
845 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
846 AC_CHECK_LIB(dl, dlopen, [
847 MODULE_PLATFORM_LIBS="-ldl"
848 libxml_have_dlopen=yes])])])])
850 if test "${libxml_have_shl_load}" = "yes"; then
851 MODULE_EXTENSION=".sl"
853 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
856 if test "${libxml_have_dlopen}" = "yes"; then
859 MODULE_EXTENSION=".sl"
862 MODULE_EXTENSION=".so"
867 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
873 if test "${WITH_MODULES}" = "1"; then
874 TEST_MODULES="ModuleTests"
877 AC_SUBST(WITH_MODULES)
878 AC_SUBST(MODULE_PLATFORM_LIBS)
879 AC_SUBST(MODULE_EXTENSION)
880 AC_SUBST(TEST_MODULES)
883 dnl Tester makes use of readline if present
887 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
888 dnl (-Wunreachable-code)
890 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
891 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
892 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
894 if test "$with_minimum" != "yes"
896 if test "${with_mem_debug}" = "" ; then
897 echo Activating memory debugging
901 if test "${with_docbook}" = "" ; then
905 if test "${GCC}" = "yes" ; then
906 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"
908 STATIC_BINARIES="-static"
909 dnl -Wcast-qual -ansi
913 AC_SUBST(STATIC_BINARIES)
916 dnl Check for trio string functions
919 if test "${NEED_TRIO}" = "1" ; then
920 echo Adding trio library for string functions
925 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
929 dnl Allow to enable/disable various pieces
931 echo Checking configuration requirements
934 dnl Thread-related stuff
943 if test "$with_threads" = "no" ; then
944 echo Disabling multithreaded support
946 echo Enabling multithreaded support
948 dnl Default to native threads on Win32
950 *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
953 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
958 dnl Use pthread by default in other cases
959 if test -z "$THREADS_W32"; then
960 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
961 AC_CHECK_HEADER(pthread.h,
962 AC_CHECK_LIB(pthread, pthread_join,[
963 THREAD_LIBS="-lpthread"
964 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
965 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
971 *cygwin*) THREAD_LIBS=""
973 *beos*) WITH_THREADS="1"
974 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
977 if test "${GCC}" = "yes" ; then
978 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
979 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
980 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
981 if test "${THREAD_LIBS}" = "-lpthread" ; then
982 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
985 BASE_THREAD_LIBS="-lpthread"
987 if expr ${GCC_MAJOR} \> 3 > /dev/null
990 BASE_THREAD_LIBS="-lpthread"
992 echo old GCC disabling weak symbols for pthread
999 if test "$WITH_THREADS" = "1" ; then
1000 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
1001 TEST_THREADS="Threadtests"
1004 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
1005 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
1008 AC_SUBST(THREAD_LIBS)
1009 AC_SUBST(BASE_THREAD_LIBS)
1010 AC_SUBST(WITH_THREADS)
1011 AC_SUBST(THREAD_CFLAGS)
1012 AC_SUBST(TEST_THREADS)
1013 AC_SUBST(THREADS_W32)
1016 dnl xmllint shell history
1018 if test "$with_history" = "yes" ; then
1019 echo Enabling xmllint shell history
1020 dnl check for terminal library. this is a very cool solution
1021 dnl from octave's configure.in
1023 for termlib in ncurses curses termcap terminfo termlib; do
1024 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
1025 test -n "$tcap" && break
1028 AC_CHECK_HEADER(readline/history.h,
1029 AC_CHECK_LIB(history, append_history,[
1030 RDL_LIBS="-lhistory"
1031 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
1032 AC_CHECK_HEADER(readline/readline.h,
1033 AC_CHECK_LIB(readline, readline,[
1034 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
1035 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
1036 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
1037 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
1038 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
1045 if test "$with_tree" = "no" ; then
1046 echo Disabling DOM like tree manipulation APIs
1053 if test "$with_ftp" = "no" ; then
1054 echo Disabling FTP support
1064 if test "$with_http" = "no" ; then
1065 echo Disabling HTTP support
1075 if test "$with_legacy" = "no" ; then
1076 echo Disabling deprecated APIs
1081 AC_SUBST(WITH_LEGACY)
1083 if test "$with_reader" = "no" ; then
1084 echo Disabling the xmlReader parsing interface
1089 READER_TEST=Readertests
1090 if test "$with_push" = "no" ; then
1091 echo xmlReader requires Push interface - enabling it
1095 AC_SUBST(WITH_READER)
1096 AC_SUBST(READER_TEST)
1098 if test "$with_writer" = "no" ; then
1099 echo Disabling the xmlWriter saving interface
1104 # WRITER_TEST=Writertests
1105 if test "$with_push" = "no" ; then
1106 echo xmlWriter requires Push interface - enabling it
1109 if test "$with_output" = "no" ; then
1110 echo xmlWriter requires Output interface - enabling it
1114 AC_SUBST(WITH_WRITER)
1115 #AC_SUBST(WRITER_TEST)
1117 if test "$with_pattern" = "no" ; then
1118 echo Disabling the xmlPattern parsing interface
1123 TEST_PATTERN=Patterntests
1125 AC_SUBST(WITH_PATTERN)
1126 AC_SUBST(TEST_PATTERN)
1128 if test "$with_sax1" = "no" ; then
1129 echo Disabling the older SAX1 interface
1139 if test "$with_push" = "no" ; then
1140 echo Disabling the PUSH parser interfaces
1145 TEST_PUSH="XMLPushtests"
1150 if test "$with_html" = "no" ; then
1151 echo Disabling HTML support
1157 HTML_OBJ="HTMLparser.o HTMLtree.o"
1159 if test "$with_push" != "no" ; then
1160 TEST_PHTML=HTMLPushtests
1168 AC_SUBST(TEST_PHTML)
1170 if test "$with_valid" = "no" ; then
1171 echo Disabling DTD validation support
1177 TEST_VALID=Validtests
1178 TEST_VTIME=VTimingtests
1180 AC_SUBST(WITH_VALID)
1181 AC_SUBST(TEST_VALID)
1182 AC_SUBST(TEST_VTIME)
1184 if test "$with_catalog" = "no" ; then
1185 echo Disabling Catalog support
1191 CATALOG_OBJ="catalog.o"
1192 TEST_CATALOG=Catatests
1194 AC_SUBST(WITH_CATALOG)
1195 AC_SUBST(CATALOG_OBJ)
1196 AC_SUBST(TEST_CATALOG)
1198 if test "$with_docbook" = "no" ; then
1199 echo Disabling Docbook support
1204 DOCB_OBJ="DOCBparser.o"
1210 if test "$with_xptr" = "no" ; then
1211 echo Disabling XPointer support
1219 if test "$with_xpath" = "no" ; then
1220 echo XPointer requires XPath support - enabling it
1228 if test "$with_c14n" = "no" ; then
1229 echo Disabling C14N support
1237 if test "$with_xpath" = "no" ; then
1238 echo C14N requires XPath support - enabling it
1246 if test "$with_xinclude" = "no" ; then
1247 echo Disabling XInclude support
1254 XINCLUDE_OBJ=xinclude.o
1255 TEST_XINCLUDE=XIncludetests
1256 if test "$with_xpath" = "no" ; then
1257 echo XInclude requires XPath support - enabling it
1261 AC_SUBST(WITH_XINCLUDE)
1262 AC_SUBST(XINCLUDE_OBJ)
1263 AC_SUBST(TEST_XINCLUDE)
1265 if test "$with_xpath" = "no" ; then
1266 echo Disabling XPATH support
1273 TEST_XPATH=XPathtests
1275 AC_SUBST(WITH_XPATH)
1277 AC_SUBST(TEST_XPATH)
1280 dnl output functions
1282 if test "$with_output" = "no" ; then
1283 echo Disabling serialization/saving support
1288 AC_SUBST(WITH_OUTPUT)
1291 if test "$with_iconv" = "no" ; then
1292 echo Disabling ICONV support
1294 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1295 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1296 # Export this since our headers include iconv.h
1297 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1298 ICONV_LIBS="-L$with_iconv/lib"
1301 AC_CHECK_HEADER(iconv.h,
1302 AC_MSG_CHECKING(for iconv)
1303 AC_TRY_LINK([#include <stdlib.h>
1304 #include <iconv.h>],[
1305 iconv_t cd = iconv_open ("","");
1306 iconv (cd, NULL, NULL, NULL, NULL);],[
1310 AC_MSG_CHECKING(for iconv in -liconv)
1312 _ldflags="${LDFLAGS}"
1314 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1315 LIBS="${LIBS} -liconv"
1317 AC_TRY_LINK([#include <stdlib.h>
1318 #include <iconv.h>],[
1319 iconv_t cd = iconv_open ("","");
1320 iconv (cd, NULL, NULL, NULL, NULL);],[
1323 ICONV_LIBS="${ICONV_LIBS} -liconv"
1325 LDFLAGS="${_ldflags}"],[
1328 LDFLAGS="${_ldflags}"])]))
1330 if test "$WITH_ICONV" = "1" ; then
1331 AC_MSG_CHECKING([for iconv declaration])
1332 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1333 AC_TRY_COMPILE([#include <stdlib.h>
1339 #if defined(__STDC__) || defined(__cplusplus)
1340 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1344 ], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1346 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);"
1347 AC_MSG_RESULT([${xml_xxx:-
1348 }$xml_cv_iconv_decl])
1349 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1350 [Define as const if the declaration of iconv() needs const.])
1363 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1364 XML_LIBTOOLLIBS="libxml2.la"
1365 AC_SUBST(WITH_ICONV)
1368 if test "$with_icu" != "yes" ; then
1369 echo Disabling ICU support
1371 ICU_CONFIG=icu-config
1372 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1374 ICU_LIBS=`icu-config --ldflags`
1375 LDFLAGS="$LDFLAGS $ICU_LIBS"
1377 echo Enabling ICU support
1379 AC_MSG_ERROR([libicu config program icu-config not found])
1385 if test "$WITH_ICONV" != "1" ; then
1386 if test "$with_iso8859x" = "no" ; then
1387 echo Disabling ISO8859X support
1391 AC_SUBST(WITH_ISO8859X)
1393 if test "$with_schematron" = "no" ; then
1394 echo "Disabling Schematron support"
1398 echo "Enabled Schematron support"
1400 TEST_SCHEMATRON="Schematrontests"
1404 AC_SUBST(WITH_SCHEMATRON)
1405 AC_SUBST(TEST_SCHEMATRON)
1407 if test "$with_schemas" = "no" ; then
1408 echo "Disabling Schemas/Relax-NG support"
1412 echo "Enabled Schemas/Relax-NG support"
1414 TEST_SCHEMAS="Schemastests Relaxtests"
1415 if test "$PYTHON_INCLUDES" != "" ; then
1416 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1420 AC_SUBST(WITH_SCHEMAS)
1421 AC_SUBST(TEST_SCHEMAS)
1423 if test "$with_regexps" = "no" ; then
1424 echo Disabling Regexps support
1429 TEST_REGEXPS="Regexptests Automatatests"
1431 AC_SUBST(WITH_REGEXPS)
1432 AC_SUBST(TEST_REGEXPS)
1434 if test "$with_debug" = "no" ; then
1435 echo Disabling DEBUG support
1441 DEBUG_OBJ=debugXML.o
1442 TEST_DEBUG=Scripttests
1444 AC_SUBST(WITH_DEBUG)
1446 AC_SUBST(TEST_DEBUG)
1448 if test "$with_mem_debug" = "yes" ; then
1449 if test "$with_thread_alloc" = "yes" ; then
1450 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1453 echo Enabling memory debug support
1459 AC_SUBST(WITH_MEM_DEBUG)
1461 if test "$with_run_debug" = "yes" ; then
1462 echo Enabling runtime debug support
1467 AC_SUBST(WITH_RUN_DEBUG)
1470 WIN32_EXTRA_LDFLAGS=
1471 CYGWIN_EXTRA_LDFLAGS=
1472 CYGWIN_EXTRA_PYTHON_LIBADD=
1473 WIN32_EXTRA_PYTHON_LIBADD=
1476 CPPFLAGS="$CPPFLAGS -DWIN32"
1477 WIN32_EXTRA_LIBADD="-lws2_32"
1478 WIN32_EXTRA_LDFLAGS="-no-undefined"
1479 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1480 if test "${PYTHON}" != ""
1482 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
1486 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1487 if test "${PYTHON}" != ""
1489 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1493 AC_SUBST(WIN32_EXTRA_LIBADD)
1494 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1495 AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
1496 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1497 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1499 dnl Checking the standard string functions availability
1501 dnl Note mingw* has C99 implementation that produce expected xml numbers
1502 dnl if code use {v}snprintf functions.
1503 dnl If you like to activate at run-time C99 compatible number output
1504 dnl see release note for mingw runtime 3.15:
1505 dnl http://sourceforge.net/project/shownotes.php?release_id=24832
1507 dnl Also *win32*config.h files redefine them for various MSC compilers.
1509 dnl So do not redefine {v}snprintf to _{v}snprintf like follwing:
1510 dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1511 dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1512 dnl and do not redefine those functions is C-source files.
1514 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
1517 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1519 echo Enabling code coverage for GCC
1520 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1521 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1523 echo Disabling code coverage for GCC
1529 AC_SUBST(XML_CFLAGS)
1531 AC_SUBST(XML_LIBDIR)
1533 AC_SUBST(XML_LIBTOOLLIBS)
1534 AC_SUBST(ICONV_LIBS)
1535 AC_SUBST(XML_INCLUDEDIR)
1537 AC_SUBST(HAVE_ISNAN)
1538 AC_SUBST(HAVE_ISINF)
1540 AC_SUBST(PYTHON_VERSION)
1541 AC_SUBST(PYTHON_INCLUDES)
1542 AC_SUBST(PYTHON_SITE_PACKAGES)
1547 dnl for the spec file
1548 RELDATE=`date +'%a %b %e %Y'`
1550 AC_SUBST(PYTHON_TESTS)
1552 rm -f COPYING.LIB COPYING
1553 ln -s Copyright COPYING
1555 # keep on one line for cygwin c.f. #130896
1556 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)
1558 chmod +x xml2-config python/setup.py
1559 echo Done configuring