1 dnl Process this file with autoconf to produce a configure script.
4 AC_CONFIG_SRCDIR([entities.c])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_MACRO_DIR([m4])
10 LIBXML_MINOR_VERSION=9
11 LIBXML_MICRO_VERSION=1
12 LIBXML_MICRO_VERSION_SUFFIX=
13 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
14 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
16 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
18 if test -f CVS/Entries ; then
19 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
21 if test "$extra" != ""
23 LIBXML_VERSION_EXTRA="-CVS$extra"
25 else if test -d .svn ; then
26 extra=`svn info | grep Revision | sed 's+Revision: ++'`
28 if test "$extra" != ""
30 LIBXML_VERSION_EXTRA="-SVN$extra"
32 else if test -d .git ; then
33 extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'`
35 if test "$extra" != ""
37 LIBXML_VERSION_EXTRA="-GIT$extra"
42 AC_SUBST(LIBXML_MAJOR_VERSION)
43 AC_SUBST(LIBXML_MINOR_VERSION)
44 AC_SUBST(LIBXML_MICRO_VERSION)
45 AC_SUBST(LIBXML_VERSION)
46 AC_SUBST(LIBXML_VERSION_INFO)
47 AC_SUBST(LIBXML_VERSION_NUMBER)
48 AC_SUBST(LIBXML_VERSION_EXTRA)
50 VERSION=${LIBXML_VERSION}
52 AM_INIT_AUTOMAKE(libxml2, $VERSION)
54 # Support silent build rules, requires at least automake-1.11. Disable
55 # by either passing --disable-silent-rules to configure or passing V=1
57 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
59 dnl Checks for programs.
65 AC_PATH_PROG(MV, mv, /bin/mv)
66 AC_PATH_PROG(TAR, tar, /bin/tar)
67 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
68 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
69 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
70 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}"
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, AS_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, AS_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 LIBS="${LIBS} -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 LIBS="${LIBS} -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 LIBS="${LIBS} -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=no]]])
209 if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then
210 AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir])
212 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes" -o "$USER" = "veillard"])
215 dnl hard dependancies on options
217 if test "$with_schemas" = "yes"
222 if test "$with_schematron" = "yes"
227 if test "$with_reader" = "yes"
231 if test "$with_xptr" = "yes"
236 dnl option to build a minimal libxml2 library
238 if test "$with_minimum" = "yes"
240 echo "Configuring for a minimal library"
241 if test "$with_c14n" = ""
245 if test "$with_catalog" = ""
250 if test "$with_debug" = ""
254 if test "$with_docbook" = ""
258 if test "$with_fexceptions" = ""
262 if test "$with_ftp" = ""
266 if test "$with_history" = ""
270 if test "$with_html" = ""
274 if test "$with_http" = ""
278 if test "$with_iconv" = ""
282 if test "$with_iso8859x" = ""
286 if test "$with_legacy" = ""
290 if test "$with_mem_debug" = ""
294 if test "$with_output" = ""
298 if test "$with_pattern" = ""
302 if test "$with_push" = ""
306 if test "$with_python" = ""
310 if test "$with_reader" = ""
314 if test "$with_readline" = ""
318 if test "$with_regexps" = ""
322 if test "$with_run_debug" = ""
326 if test "$with_sax1" = ""
330 if test "$with_schemas" = ""
334 if test "$with_schematron" = ""
338 if test "$with_threads" = ""
342 if test "$with_thread_alloc" = ""
346 if test "$with_tree" = ""
350 if test "$with_valid" = ""
354 if test "$with_writer" = ""
358 if test "$with_xinclude" = ""
362 if test "$with_xpath" = ""
366 if test "$with_xptr" = ""
370 if test "$with_zlib" = ""
374 if test "$with_modules" = ""
382 dnl Checks for zlib library.
385 if test "$with_zlib" = "no"; then
386 echo "Disabling compression support"
388 AC_CHECK_HEADERS(zlib.h,
389 AC_CHECK_LIB(z, gzread,[
390 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
392 if test "x${Z_DIR}" != "x"; then
393 Z_CFLAGS="-I${Z_DIR}/include"
394 Z_LIBS="-L${Z_DIR}/lib -lz"
397 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
411 dnl Checks for lzma library.
414 if test "$with_lzma" = "no"; then
415 echo "Disabling compression support"
417 AC_CHECK_HEADERS(lzma.h,
418 AC_CHECK_LIB(lzma, lzma_code,[
419 AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
421 if test "x${LZMA_DIR}" != "x"; then
422 LZMA_CFLAGS="-I${LZMA_DIR}/include"
423 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
429 AC_SUBST(LZMA_CFLAGS)
433 CPPFLAGS=${_cppflags}
436 echo Checking headers
438 dnl Checks for header files.
441 AC_CHECK_HEADERS([fcntl.h])
442 AC_CHECK_HEADERS([unistd.h])
443 AC_CHECK_HEADERS([ctype.h])
444 AC_CHECK_HEADERS([dirent.h])
445 AC_CHECK_HEADERS([errno.h])
446 AC_CHECK_HEADERS([malloc.h])
447 AC_CHECK_HEADERS([stdarg.h])
448 AC_CHECK_HEADERS([sys/stat.h])
449 AC_CHECK_HEADERS([sys/types.h])
450 AC_CHECK_HEADERS([stdint.h])
451 AC_CHECK_HEADERS([inttypes.h])
452 AC_CHECK_HEADERS([time.h])
453 AC_CHECK_HEADERS([ansidecl.h])
454 AC_CHECK_HEADERS([ieeefp.h])
455 AC_CHECK_HEADERS([nan.h])
456 AC_CHECK_HEADERS([math.h])
457 AC_CHECK_HEADERS([limits.h])
458 AC_CHECK_HEADERS([fp_class.h])
459 AC_CHECK_HEADERS([float.h])
460 AC_CHECK_HEADERS([stdlib.h])
461 AC_CHECK_HEADERS([sys/socket.h], [], [],
462 [#if HAVE_SYS_TYPES_H
463 # include <sys/types.h>
466 AC_CHECK_HEADERS([netinet/in.h], [], [],
467 [#if HAVE_SYS_TYPES_H
468 # include <sys/types.h>
471 AC_CHECK_HEADERS([arpa/inet.h], [], [],
472 [#if HAVE_SYS_TYPES_H
473 # include <sys/types.h>
476 # include <arpa/inet.h>
479 AC_CHECK_HEADERS([netdb.h])
480 AC_CHECK_HEADERS([sys/time.h])
481 AC_CHECK_HEADERS([sys/select.h])
482 AC_CHECK_HEADERS([poll.h])
483 AC_CHECK_HEADERS([sys/mman.h])
484 AC_CHECK_HEADERS([sys/timeb.h])
485 AC_CHECK_HEADERS([signal.h])
486 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
487 [#if HAVE_SYS_TYPES_H
488 # include <sys/types.h>
491 AC_CHECK_HEADERS([resolv.h], [], [],
492 [#if HAVE_SYS_TYPES_H
493 # include <sys/types.h>
495 #if HAVE_NETINET_IN_H
496 # include <netinet/in.h>
498 #if HAVE_ARPA_NAMESER_H
499 # include <arpa/nameser.h>
502 AC_CHECK_HEADERS([dl.h])
503 AC_CHECK_HEADERS([dlfcn.h])
511 echo Checking libraries
513 dnl Checks for library functions.
515 AC_CHECK_FUNCS(strdup strndup strerror)
516 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
517 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
518 AC_CHECK_FUNCS(stat _stat signal)
519 AC_CHECK_FUNCS(rand rand_r srand time)
520 AC_CHECK_FUNCS(isascii mmap munmap putenv)
522 AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
523 #if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
524 # undef /**/ HAVE_MMAP
527 dnl Checking for va_copy availability
528 AC_MSG_CHECKING([for va_copy])
529 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
530 va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])],
533 AC_MSG_RESULT($have_va_copy)
534 if test x"$have_va_copy" = x"yes"; then
535 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
537 AC_MSG_CHECKING([for __va_copy])
538 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
539 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],
542 AC_MSG_RESULT($have___va_copy)
543 if test x"$have___va_copy" = x"yes"; then
544 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
548 dnl Checks for inet libraries:
549 AC_SEARCH_LIBS(gethostent, [nsl])
550 AC_SEARCH_LIBS(setsockopt, [socket net network])
551 AC_SEARCH_LIBS(connect, [inet])
553 dnl Determine what socket length (socklen_t) data type is
554 AC_MSG_CHECKING([for type of socket length (socklen_t)])
557 #include <sys/types.h>
558 #include <sys/socket.h>],[
559 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
560 AC_MSG_RESULT(socklen_t *)
561 XML_SOCKLEN_T=socklen_t],[
564 #include <sys/types.h>
565 #include <sys/socket.h>],[
566 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
567 AC_MSG_RESULT(size_t *)
568 XML_SOCKLEN_T=size_t],[
571 #include <sys/types.h>
572 #include <sys/socket.h>],[
573 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
576 AC_MSG_WARN(could not determine)
577 XML_SOCKLEN_T="int"])])])
578 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
580 dnl ***********************Checking for availability of IPv6*******************
582 AC_MSG_CHECKING([whether to enable IPv6])
583 AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
584 if test "$with_minimum" = "yes"
588 if test $enable_ipv6 = yes; then
590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
591 # include <sys/types.h>
592 # include <sys/socket.h>
594 struct sockaddr_storage ss;
595 socket(AF_INET6, SOCK_STREAM, 0)
600 AC_MSG_RESULT($have_ipv6)
602 if test $have_ipv6 = yes; then
603 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
604 have_broken_ss_family=no
606 dnl *********************************************************************
607 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
608 dnl a ss_family member, but rather __ss_family. Let's detect that
609 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
610 dnl platforms. However, we should only do this if ss_family is not
612 dnl ********************************************************************
613 AC_MSG_CHECKING([struct sockaddr::ss_family])
614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
615 # include <sys/types.h>
616 # include <sys/socket.h>
618 struct sockaddr_storage ss ;
624 AC_MSG_RESULT($have_ss_family)
625 if test x$have_ss_family = xno ; then
626 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
627 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
628 # include <sys/types.h>
629 # include <sys/socket.h>
631 struct sockaddr_storage ss ;
634 have_broken_ss_family=yes,
635 have_broken_ss_family=no
637 AC_MSG_RESULT($have_broken_ss_family)
638 if test x$have_broken_ss_family = xyes ; then
639 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
640 [Whether struct sockaddr::__ss_family exists])
641 AC_DEFINE(ss_family, __ss_family,
642 [ss_family is not defined here, use __ss_family instead])
644 AC_MSG_WARN(ss_family and __ss_family not found)
649 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
650 if test $have_getaddrinfo != yes; then
651 for lib in bsd socket inet; do
652 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
656 if test $have_getaddrinfo = yes; then
657 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
662 dnl ******************************End IPv6 checks******************************
664 dnl Checks for isnan in libm if not in libc
665 AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
666 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
668 AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
669 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
671 XML_LIBDIR='-L${libdir}'
672 XML_INCLUDEDIR='-I${includedir}/libxml2'
681 dnl Workaround for native compilers
682 dnl HP : http://bugs.gnome.org/db/31/3163.html
683 dnl DEC : Enable NaN/Inf
685 if test "${GCC}" != "yes" ; then
688 CFLAGS="${CFLAGS} -Wp,-H30000"
691 CFLAGS="${CFLAGS} -ieee"
694 CFLAGS="${CFLAGS} -ieee"
698 if test "$with_fexceptions" = "yes"
701 # Not activated by default because this inflates the code size
702 # Used to allow propagation of C++ exceptions through the library
704 CFLAGS="${CFLAGS} -fexceptions"
707 # warnings we'd like to see
708 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"
709 # warnings we'd like to supress
710 CFLAGS="${CFLAGS} -Wno-long-long"
713 CFLAGS="${CFLAGS} -mieee"
716 CFLAGS="${CFLAGS} -mieee"
722 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
727 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
728 # If the host is Windows, and shared libraries are disabled, we
729 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
730 # work properly (without it, xmlexports.h would force the use of
731 # DLL imports, which obviously aren't present in a static
733 if test "x$enable_shared" = "xno"; then
734 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
735 CFLAGS="$CFLAGS -DLIBXML_STATIC"
747 PYTHON_SITE_PACKAGES=
750 if test "$with_python" != "no" ; then
751 if test -x "$with_python/bin/python"
753 echo Found python in $with_python/bin/python
754 PYTHON="$with_python/bin/python"
756 if test -x "$with_python/python.exe"
758 echo Found python in $with_python/python.exe
759 PYTHON="$with_python/python.exe"
761 if test -x "$with_python"
763 echo Found python in $with_python
764 PYTHON="$with_python"
768 echo Found python in environment PYTHON=$PYTHON
769 with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
771 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
776 if test "$PYTHON" != ""
778 PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
779 PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
780 # does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
782 # PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
783 echo Found Python version $PYTHON_VERSION
785 if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
787 if test -r $with_python/include/python$PYTHON_VERSION/Python.h
789 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
791 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
793 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
795 if test -r /usr/include/python$PYTHON_VERSION/Python.h
797 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
799 if test -r $with_python/include/Python.h
801 PYTHON_INCLUDES=$with_python/include
803 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
809 if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
811 if test -d $libdir/python$PYTHON_VERSION/site-packages
813 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
815 if test -d $with_python/lib/site-packages
817 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
819 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
823 pythondir='$(PYTHON_SITE_PACKAGES)'
824 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
828 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
829 if test "$PYTHON_INCLUDES" != ""
836 AC_SUBST(PYTHON_SUBDIR)
837 AC_SUBST(PYTHON_LIBS)
839 dnl check for dso support
843 if test "$with_modules" != "no" ; then
846 MODULE_EXTENSION=".dll"
847 AC_CHECK_LIB(cygwin, dlopen, [
849 MODULE_PLATFORM_LIBS=
850 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
854 MODULE_EXTENSION=".dll"
858 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
859 AC_CHECK_LIB(dld, shl_load, [
860 MODULE_PLATFORM_LIBS="-ldld"
861 libxml_have_shl_load=yes], [
862 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
863 AC_CHECK_LIB(dl, dlopen, [
864 MODULE_PLATFORM_LIBS="-ldl"
865 libxml_have_dlopen=yes])])])])
867 if test "${libxml_have_shl_load}" = "yes"; then
868 MODULE_EXTENSION=".sl"
870 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
873 if test "${libxml_have_dlopen}" = "yes"; then
876 MODULE_EXTENSION=".sl"
879 MODULE_EXTENSION=".so"
884 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
890 if test "${WITH_MODULES}" = "1"; then
891 TEST_MODULES="ModuleTests"
894 AC_SUBST(WITH_MODULES)
895 AC_SUBST(MODULE_PLATFORM_LIBS)
896 AC_SUBST(MODULE_EXTENSION)
897 AC_SUBST(TEST_MODULES)
900 dnl Tester makes use of readline if present
904 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
905 dnl (-Wunreachable-code)
907 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
908 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
909 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
911 if test "$with_minimum" != "yes"
913 if test "${with_mem_debug}" = "" ; then
914 echo Activating memory debugging
918 if test "${with_docbook}" = "" ; then
922 if test "${GCC}" = "yes" ; then
923 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"
925 STATIC_BINARIES="-static"
926 dnl -Wcast-qual -ansi
930 AC_SUBST(STATIC_BINARIES)
933 dnl Check for trio string functions
936 if test "${NEED_TRIO}" = "1" ; then
937 echo Adding trio library for string functions
942 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
946 dnl Allow to enable/disable various pieces
948 echo Checking configuration requirements
951 dnl Thread-related stuff
961 if test "$with_threads" = "no" ; then
962 echo Disabling multithreaded support
964 echo Enabling multithreaded support
966 dnl Default to native threads on Win32
968 *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
971 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
976 dnl Use pthread by default in other cases
977 if test -z "$THREADS_W32"; then
978 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
979 AC_CHECK_HEADER(pthread.h,
980 AC_CHECK_LIB(pthread, pthread_join,[
981 THREAD_LIBS="-lpthread"
982 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
983 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
989 *cygwin*) THREAD_LIBS=""
991 *beos*) WITH_THREADS="1"
992 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
995 if test "${GCC}" = "yes" ; then
996 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
997 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
998 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
999 if test "${THREAD_LIBS}" = "-lpthread" ; then
1000 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
1003 BASE_THREAD_LIBS="-lpthread"
1005 if expr ${GCC_MAJOR} \> 3 > /dev/null
1008 BASE_THREAD_LIBS="-lpthread"
1010 echo old GCC disabling weak symbols for pthread
1017 if test "$WITH_THREADS" = "1" ; then
1018 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
1019 TEST_THREADS="Threadtests"
1022 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
1026 AC_SUBST(THREAD_LIBS)
1027 AC_SUBST(BASE_THREAD_LIBS)
1028 AC_SUBST(WITH_THREADS)
1029 AC_SUBST(THREAD_CFLAGS)
1030 AC_SUBST(TEST_THREADS)
1031 AC_SUBST(WITH_THREAD_ALLOC)
1032 AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
1035 dnl xmllint shell history
1037 if test "$with_history" = "yes" ; then
1038 echo Enabling xmllint shell history
1039 dnl check for terminal library. this is a very cool solution
1040 dnl from octave's configure.in
1042 for termlib in ncurses curses termcap terminfo termlib; do
1043 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
1044 test -n "$tcap" && break
1047 AC_CHECK_HEADER(readline/history.h,
1048 AC_CHECK_LIB(history, append_history,[
1049 RDL_LIBS="-lhistory"
1050 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
1051 AC_CHECK_HEADER(readline/readline.h,
1052 AC_CHECK_LIB(readline, readline,[
1053 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
1054 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
1055 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
1056 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
1057 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
1064 if test "$with_tree" = "no" ; then
1065 echo Disabling DOM like tree manipulation APIs
1072 if test "$with_ftp" = "no" ; then
1073 echo Disabling FTP support
1083 if test "$with_http" = "no" ; then
1084 echo Disabling HTTP support
1094 if test "$with_legacy" = "no" ; then
1095 echo Disabling deprecated APIs
1100 AC_SUBST(WITH_LEGACY)
1102 if test "$with_reader" = "no" ; then
1103 echo Disabling the xmlReader parsing interface
1108 READER_TEST=Readertests
1109 if test "$with_push" = "no" ; then
1110 echo xmlReader requires Push interface - enabling it
1114 AC_SUBST(WITH_READER)
1115 AC_SUBST(READER_TEST)
1117 if test "$with_writer" = "no" ; then
1118 echo Disabling the xmlWriter saving interface
1123 # WRITER_TEST=Writertests
1124 if test "$with_push" = "no" ; then
1125 echo xmlWriter requires Push interface - enabling it
1128 if test "$with_output" = "no" ; then
1129 echo xmlWriter requires Output interface - enabling it
1133 AC_SUBST(WITH_WRITER)
1134 #AC_SUBST(WRITER_TEST)
1136 if test "$with_pattern" = "no" ; then
1137 echo Disabling the xmlPattern parsing interface
1142 TEST_PATTERN=Patterntests
1144 AC_SUBST(WITH_PATTERN)
1145 AC_SUBST(TEST_PATTERN)
1147 if test "$with_sax1" = "no" ; then
1148 echo Disabling the older SAX1 interface
1156 AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1")
1159 if test "$with_push" = "no" ; then
1160 echo Disabling the PUSH parser interfaces
1165 TEST_PUSH="XMLPushtests"
1170 if test "$with_html" = "no" ; then
1171 echo Disabling HTML support
1177 HTML_OBJ="HTMLparser.o HTMLtree.o"
1179 if test "$with_push" != "no" ; then
1180 TEST_PHTML=HTMLPushtests
1188 AC_SUBST(TEST_PHTML)
1190 if test "$with_valid" = "no" ; then
1191 echo Disabling DTD validation support
1197 TEST_VALID=Validtests
1198 TEST_VTIME=VTimingtests
1200 AC_SUBST(WITH_VALID)
1201 AC_SUBST(TEST_VALID)
1202 AC_SUBST(TEST_VTIME)
1204 if test "$with_catalog" = "no" ; then
1205 echo Disabling Catalog support
1211 CATALOG_OBJ="catalog.o"
1212 TEST_CATALOG=Catatests
1214 AC_SUBST(WITH_CATALOG)
1215 AC_SUBST(CATALOG_OBJ)
1216 AC_SUBST(TEST_CATALOG)
1218 if test "$with_docbook" = "no" ; then
1219 echo Disabling Docbook support
1224 DOCB_OBJ="DOCBparser.o"
1230 if test "$with_xptr" = "no" ; then
1231 echo Disabling XPointer support
1239 if test "$with_xpath" = "no" ; then
1240 echo XPointer requires XPath support - enabling it
1248 if test "$with_c14n" = "no" ; then
1249 echo Disabling C14N support
1257 if test "$with_xpath" = "no" ; then
1258 echo C14N requires XPath support - enabling it
1266 if test "$with_xinclude" = "no" ; then
1267 echo Disabling XInclude support
1274 XINCLUDE_OBJ=xinclude.o
1275 TEST_XINCLUDE=XIncludetests
1276 if test "$with_xpath" = "no" ; then
1277 echo XInclude requires XPath support - enabling it
1281 AC_SUBST(WITH_XINCLUDE)
1282 AC_SUBST(XINCLUDE_OBJ)
1283 AC_SUBST(TEST_XINCLUDE)
1285 if test "$with_xpath" = "no" ; then
1286 echo Disabling XPATH support
1293 TEST_XPATH=XPathtests
1295 AC_SUBST(WITH_XPATH)
1297 AC_SUBST(TEST_XPATH)
1300 dnl output functions
1302 if test "$with_output" = "no" ; then
1303 echo Disabling serialization/saving support
1308 AC_SUBST(WITH_OUTPUT)
1311 if test "$with_iconv" = "no" ; then
1312 echo Disabling ICONV support
1314 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1315 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1316 # Export this since our headers include iconv.h
1317 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1318 ICONV_LIBS="-L$with_iconv/lib"
1321 AC_CHECK_HEADER(iconv.h,
1322 AC_MSG_CHECKING(for iconv)
1323 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1324 #include <iconv.h>]],[[
1325 iconv_t cd = iconv_open ("","");
1326 iconv (cd, NULL, NULL, NULL, NULL);]])],[
1330 AC_MSG_CHECKING(for iconv in -liconv)
1332 _ldflags="${LDFLAGS}"
1334 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1335 LIBS="${LIBS} -liconv"
1337 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1338 #include <iconv.h>]],[[
1339 iconv_t cd = iconv_open ("","");
1340 iconv (cd, NULL, NULL, NULL, NULL);]])],[
1343 ICONV_LIBS="${ICONV_LIBS} -liconv"
1345 LDFLAGS="${_ldflags}"],[
1348 LDFLAGS="${_ldflags}"])]))
1350 if test "$WITH_ICONV" = "1" ; then
1351 AC_MSG_CHECKING([for iconv declaration])
1352 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1359 #if defined(__STDC__) || defined(__cplusplus)
1360 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1364 ]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1366 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);"
1367 AC_MSG_RESULT([${xml_xxx:-
1368 }$xml_cv_iconv_decl])
1369 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1370 [Define as const if the declaration of iconv() needs const.])
1383 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1384 XML_LIBTOOLLIBS="libxml2.la"
1385 AC_SUBST(WITH_ICONV)
1389 if test "$with_icu" != "yes" ; then
1390 echo Disabling ICU support
1392 ICU_CONFIG=icu-config
1393 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1395 ICU_LIBS=`${ICU_CONFIG} --ldflags`
1397 echo Enabling ICU support
1399 AC_MSG_ERROR([libicu config program icu-config not found])
1406 if test "$WITH_ICONV" != "1" ; then
1407 if test "$with_iso8859x" = "no" ; then
1408 echo Disabling ISO8859X support
1412 AC_SUBST(WITH_ISO8859X)
1414 if test "$with_schematron" = "no" ; then
1415 echo "Disabling Schematron support"
1419 echo "Enabled Schematron support"
1421 TEST_SCHEMATRON="Schematrontests"
1425 AC_SUBST(WITH_SCHEMATRON)
1426 AC_SUBST(TEST_SCHEMATRON)
1428 if test "$with_schemas" = "no" ; then
1429 echo "Disabling Schemas/Relax-NG support"
1433 echo "Enabled Schemas/Relax-NG support"
1435 TEST_SCHEMAS="Schemastests Relaxtests"
1436 if test "$PYTHON_INCLUDES" != "" ; then
1437 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1441 AC_SUBST(WITH_SCHEMAS)
1442 AC_SUBST(TEST_SCHEMAS)
1444 if test "$with_regexps" = "no" ; then
1445 echo Disabling Regexps support
1450 TEST_REGEXPS="Regexptests Automatatests"
1452 AC_SUBST(WITH_REGEXPS)
1453 AC_SUBST(TEST_REGEXPS)
1455 if test "$with_debug" = "no" ; then
1456 echo Disabling DEBUG support
1462 DEBUG_OBJ=debugXML.o
1463 TEST_DEBUG=Scripttests
1465 AC_SUBST(WITH_DEBUG)
1467 AC_SUBST(TEST_DEBUG)
1469 if test "$with_mem_debug" = "yes" ; then
1470 if test "$with_thread_alloc" = "yes" ; then
1471 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1474 echo Enabling memory debug support
1480 AC_SUBST(WITH_MEM_DEBUG)
1482 if test "$with_run_debug" = "yes" ; then
1483 echo Enabling runtime debug support
1488 AC_SUBST(WITH_RUN_DEBUG)
1491 WIN32_EXTRA_LDFLAGS=
1492 CYGWIN_EXTRA_LDFLAGS=
1493 CYGWIN_EXTRA_PYTHON_LIBADD=
1494 WIN32_EXTRA_PYTHON_LIBADD=
1497 CPPFLAGS="$CPPFLAGS -DWIN32"
1498 WIN32_EXTRA_LIBADD="-lws2_32"
1499 WIN32_EXTRA_LDFLAGS="-no-undefined"
1500 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1501 if test "${PYTHON}" != ""
1503 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
1507 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1508 if test "${PYTHON}" != ""
1510 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1514 AC_SUBST(WIN32_EXTRA_LIBADD)
1515 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1516 AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
1517 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1518 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1520 dnl Checking the standard string functions availability
1522 dnl Note mingw* has C99 implementation that produce expected xml numbers
1523 dnl if code use {v}snprintf functions.
1524 dnl If you like to activate at run-time C99 compatible number output
1525 dnl see release note for mingw runtime 3.15:
1526 dnl http://sourceforge.net/project/shownotes.php?release_id=24832
1528 dnl Also *win32*config.h files redefine them for various MSC compilers.
1530 dnl So do not redefine {v}snprintf to _{v}snprintf like follwing:
1531 dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1532 dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1533 dnl and do not redefine those functions is C-source files.
1535 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
1538 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1540 echo Enabling code coverage for GCC
1541 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1542 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1544 echo Disabling code coverage for GCC
1550 AC_SUBST(XML_CFLAGS)
1552 AC_SUBST(XML_LIBDIR)
1554 AC_SUBST(XML_LIBTOOLLIBS)
1555 AC_SUBST(ICONV_LIBS)
1556 AC_SUBST(XML_INCLUDEDIR)
1558 AC_SUBST(HAVE_ISNAN)
1559 AC_SUBST(HAVE_ISINF)
1561 AC_SUBST(PYTHON_VERSION)
1562 AC_SUBST(PYTHON_INCLUDES)
1563 AC_SUBST(PYTHON_SITE_PACKAGES)
1568 dnl for the spec file
1569 RELDATE=`date +'%a %b %e %Y'`
1571 AC_SUBST(PYTHON_TESTS)
1573 rm -f COPYING.LIB COPYING
1574 ln -s $srcdir/Copyright COPYING
1576 # keep on one line for cygwin c.f. #130896
1577 AC_CONFIG_FILES([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])
1580 chmod +x xml2-config python/setup.py
1581 echo Done configuring