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=2
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)
76 dnl if the system support linker version scripts for symbol versioning
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=
85 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
88 AC_SUBST(VERSION_SCRIPT_FLAGS)
89 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
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
98 dnl zlib option might change flags, so we save them initially
100 _cppflags="${CPPFLAGS}"
104 [ --with-c14n add the Canonicalization support (on)])
106 [ --with-catalog add the Catalog support (on)])
108 [ --with-debug add the debugging module (on)])
110 [ --with-docbook add Docbook SGML support (on)])
111 AC_ARG_WITH(fexceptions,
112 [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
114 [ --with-ftp add the FTP support (on)])
116 [ --with-history add history support to xmllint shell(off)])
118 [ --with-html add the HTML support (on)])
119 dnl Specific dir for HTML output ?
120 AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
121 [path to base html directory, default $datadir/doc/html]),
122 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
124 AC_ARG_WITH(html-subdir, AS_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"])
130 [ --with-http add the HTTP support (on)])
132 [ --with-iconv[[=DIR]] add ICONV support (on)])
134 [ --with-icu add ICU support (off)])
135 AC_ARG_WITH(iso8859x,
136 [ --with-iso8859x add ISO8859X support if no iconv (on)])
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)])
142 [ --with-minimum build a minimally sized library (off)])
144 [ --with-output add the serialization support (on)])
146 [ --with-pattern add the xmlPattern selection interface (on)])
148 [ --with-push add the PUSH parser interfaces (on)])
150 [ --with-python[[=DIR]] build Python bindings if found])
151 AC_ARG_WITH(python_install_dir,
152 [ --with-python-install-dir=DIR
153 install Python bindings in DIR])
155 [ --with-reader add the xmlReader parsing interface (on)])
156 AC_ARG_WITH(readline,
157 [ --with-readline=DIR use readline in DIR],[
158 if test "$withval" != "no" -a "$withval" != "yes"; then
160 CPPFLAGS="${CPPFLAGS} -I$withval/include"
161 LIBS="${LIBS} -L$withval/lib"
165 [ --with-regexps add Regular Expressions support (on)])
166 AC_ARG_WITH(run_debug,
167 [ --with-run-debug add the runtime debugging module (off)])
169 [ --with-sax1 add the older SAX1 interface (on)])
171 [ --with-schemas add Relax-NG and Schemas support (on)])
172 AC_ARG_WITH(schematron,
173 [ --with-schematron add Schematron support (on)])
175 [ --with-threads add multithread support(on)])
176 AC_ARG_WITH(thread-alloc,
177 [ --with-thread-alloc add per-thread memory(off)])
179 [ --with-tree add the DOM like tree manipulation APIs (on)])
181 [ --with-valid add the DTD validation support (on)])
183 [ --with-writer add the xmlWriter saving interface (on)])
184 AC_ARG_WITH(xinclude,
185 [ --with-xinclude add the XInclude support (on)])
187 [ --with-xpath add the XPATH support (on)])
189 [ --with-xptr add the XPointer support (on)])
191 [ --with-modules add the dynamic modules support (on)])
193 [ --with-zlib[[=DIR]] use libz in DIR],[
194 if test "$withval" != "no" -a "$withval" != "yes"; then
196 CPPFLAGS="${CPPFLAGS} -I$withval/include"
197 LIBS="${LIBS} -L$withval/lib"
201 [ --with-lzma[[=DIR]] use liblzma in DIR],[
202 if test "$withval" != "no" -a "$withval" != "yes"; then
204 CPPFLAGS="${CPPFLAGS} -I$withval/include"
205 LIBS="${LIBS} -L$withval/lib"
208 AC_ARG_WITH(coverage,
209 [ --with-coverage build for code coverage with GCC (off)])
211 AC_ARG_ENABLE(rebuild-docs,
212 [ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=no]]])
213 if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then
214 AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir])
216 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes" -o "$USER" = "veillard"])
219 dnl hard dependancies on options
221 if test "$with_schemas" = "yes"
226 if test "$with_schematron" = "yes"
232 if test "$with_reader" = "yes"
236 if test "$with_xptr" = "yes"
241 dnl option to build a minimal libxml2 library
243 if test "$with_minimum" = "yes"
245 echo "Configuring for a minimal library"
246 if test "$with_c14n" = ""
250 if test "$with_catalog" = ""
255 if test "$with_debug" = ""
259 if test "$with_docbook" = ""
263 if test "$with_fexceptions" = ""
267 if test "$with_ftp" = ""
271 if test "$with_history" = ""
275 if test "$with_html" = ""
279 if test "$with_http" = ""
283 if test "$with_iconv" = ""
287 if test "$with_iso8859x" = ""
291 if test "$with_legacy" = ""
295 if test "$with_mem_debug" = ""
299 if test "$with_output" = ""
303 if test "$with_pattern" = ""
307 if test "$with_push" = ""
311 if test "$with_python" = ""
315 if test "$with_reader" = ""
319 if test "$with_readline" = ""
323 if test "$with_regexps" = ""
327 if test "$with_run_debug" = ""
331 if test "$with_sax1" = ""
335 if test "$with_schemas" = ""
339 if test "$with_schematron" = ""
343 if test "$with_threads" = ""
347 if test "$with_thread_alloc" = ""
351 if test "$with_tree" = ""
355 if test "$with_valid" = ""
359 if test "$with_writer" = ""
363 if test "$with_xinclude" = ""
367 if test "$with_xpath" = ""
371 if test "$with_xptr" = ""
375 if test "$with_zlib" = ""
379 if test "$with_modules" = ""
387 dnl Checks for zlib library.
390 if test "$with_zlib" = "no"; then
391 echo "Disabling compression support"
393 AC_CHECK_HEADERS(zlib.h,
394 [SAVE_LDFLAGS="${LDFLAGS}"
395 LDFLAGS="-L${Z_DIR}/lib"
396 AC_CHECK_LIB(z, gzread,[
397 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
399 if test "x${Z_DIR}" != "x"; then
400 Z_CFLAGS="-I${Z_DIR}/include"
401 Z_LIBS="-L${Z_DIR}/lib -lz"
404 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
410 LDFLAGS="${SAVE_LDFLAGS}"])
419 dnl Checks for lzma library.
422 if test "$with_lzma" = "no"; then
423 echo "Disabling compression support"
425 # Try pkg-config first so that static linking works.
426 # If this succeeeds, we ignore the WITH_LZMA directory.
427 PKG_CHECK_MODULES([LZMA],[liblzma],
431 # If pkg-config failed, fall back to AC_CHECK_LIB. This
432 # will not pick up the necessary LIBS flags for liblzma's
433 # private dependencies, though, so static linking may fail.
434 if test "x$have_liblzma" = "xno"; then
435 AC_CHECK_HEADERS(lzma.h,
436 [SAVE_LDFLAGS="${LDFLAGS}"
437 LDFLAGS="-L${LZMA_DIR}/lib"
438 AC_CHECK_LIB(lzma, lzma_code,[
440 if test "x${LZMA_DIR}" != "x"; then
441 LZMA_CFLAGS="-I${LZMA_DIR}/include"
442 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
447 LDFLAGS="${SAVE_LDFLAGS}"])
450 # Found the library via either method?
451 if test "x$have_liblzma" = "xyes"; then
452 AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
457 AC_SUBST(LZMA_CFLAGS)
461 CPPFLAGS=${_cppflags}
464 echo Checking headers
466 dnl Checks for header files.
469 AC_CHECK_HEADERS([fcntl.h])
470 AC_CHECK_HEADERS([unistd.h])
471 AC_CHECK_HEADERS([ctype.h])
472 AC_CHECK_HEADERS([dirent.h])
473 AC_CHECK_HEADERS([errno.h])
474 AC_CHECK_HEADERS([malloc.h])
475 AC_CHECK_HEADERS([stdarg.h])
476 AC_CHECK_HEADERS([sys/stat.h])
477 AC_CHECK_HEADERS([sys/types.h])
478 AC_CHECK_HEADERS([stdint.h])
479 AC_CHECK_HEADERS([inttypes.h])
480 AC_CHECK_HEADERS([time.h])
481 AC_CHECK_HEADERS([ansidecl.h])
482 AC_CHECK_HEADERS([ieeefp.h])
483 AC_CHECK_HEADERS([nan.h])
484 AC_CHECK_HEADERS([math.h])
485 AC_CHECK_HEADERS([limits.h])
486 AC_CHECK_HEADERS([fp_class.h])
487 AC_CHECK_HEADERS([float.h])
488 AC_CHECK_HEADERS([stdlib.h])
489 AC_CHECK_HEADERS([sys/socket.h], [], [],
490 [#if HAVE_SYS_TYPES_H
491 # include <sys/types.h>
494 AC_CHECK_HEADERS([netinet/in.h], [], [],
495 [#if HAVE_SYS_TYPES_H
496 # include <sys/types.h>
499 AC_CHECK_HEADERS([arpa/inet.h], [], [],
500 [#if HAVE_SYS_TYPES_H
501 # include <sys/types.h>
504 # include <arpa/inet.h>
507 AC_CHECK_HEADERS([netdb.h])
508 AC_CHECK_HEADERS([sys/time.h])
509 AC_CHECK_HEADERS([sys/select.h])
510 AC_CHECK_HEADERS([poll.h])
511 AC_CHECK_HEADERS([sys/mman.h])
512 AC_CHECK_HEADERS([sys/timeb.h])
513 AC_CHECK_HEADERS([signal.h])
514 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
515 [#if HAVE_SYS_TYPES_H
516 # include <sys/types.h>
519 AC_CHECK_HEADERS([resolv.h], [], [],
520 [#if HAVE_SYS_TYPES_H
521 # include <sys/types.h>
523 #if HAVE_NETINET_IN_H
524 # include <netinet/in.h>
526 #if HAVE_ARPA_NAMESER_H
527 # include <arpa/nameser.h>
530 AC_CHECK_HEADERS([dl.h])
531 AC_CHECK_HEADERS([dlfcn.h])
539 echo Checking libraries
541 dnl Checks for library functions.
543 AC_CHECK_FUNCS(strdup strndup strerror)
544 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
545 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
546 AC_CHECK_FUNCS(stat _stat signal)
547 AC_CHECK_FUNCS(rand rand_r srand time)
548 AC_CHECK_FUNCS(isascii mmap munmap putenv)
550 AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
551 #if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
552 # undef /**/ HAVE_MMAP
555 dnl Checking for va_copy availability
556 AC_MSG_CHECKING([for va_copy])
557 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
558 va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])],
561 AC_MSG_RESULT($have_va_copy)
562 if test x"$have_va_copy" = x"yes"; then
563 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
565 AC_MSG_CHECKING([for __va_copy])
566 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
567 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],
570 AC_MSG_RESULT($have___va_copy)
571 if test x"$have___va_copy" = x"yes"; then
572 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
576 dnl Checking whether va_list is an array type
577 AC_MSG_CHECKING([whether va_list is an array type])
580 void a(va_list * ap) {}],[
581 va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[
584 AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])])
586 dnl Checks for inet libraries:
587 AC_SEARCH_LIBS(gethostent, [nsl])
588 AC_SEARCH_LIBS(setsockopt, [socket net network])
589 AC_SEARCH_LIBS(connect, [inet])
591 dnl Determine what socket length (socklen_t) data type is
592 AC_MSG_CHECKING([for type of socket length (socklen_t)])
595 #include <sys/types.h>
596 #include <sys/socket.h>],[
597 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
598 AC_MSG_RESULT(socklen_t *)
599 XML_SOCKLEN_T=socklen_t],[
602 #include <sys/types.h>
603 #include <sys/socket.h>],[
604 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
605 AC_MSG_RESULT(size_t *)
606 XML_SOCKLEN_T=size_t],[
609 #include <sys/types.h>
610 #include <sys/socket.h>],[
611 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
614 AC_MSG_WARN(could not determine)
615 XML_SOCKLEN_T="int"])])])
616 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
618 dnl Checking if gethostbyname() argument is const.
619 AC_MSG_CHECKING([for const gethostbyname() argument])
620 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
621 [[(void)gethostbyname((const char *)"");]])],
622 have_gethostbyname_const_arg=yes,
623 have_gethostbyname_const_arg=no)
624 AC_MSG_RESULT($have_gethostbyname_const_arg)
625 if test x"$have_gethostbyname_const_arg" = x"yes"; then
626 AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [],
627 [Type cast for the gethostbyname() argument])
629 AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)],
630 [Type cast for the gethostbyname() argument])
633 dnl Checking if send() second argument is const.
634 AC_MSG_CHECKING([for const send() second argument])
635 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
636 #include <sys/socket.h>]],
637 [[(void)send(1,(const char *)"",1,1);]])],
638 have_send_const_arg2=yes,
639 have_send_const_arg2=no)
640 AC_MSG_RESULT($have_send_const_arg2)
641 if test x"$have_send_const_arg2" = x"yes"; then
642 AC_DEFINE([SEND_ARG2_CAST], [],
643 [Type cast for the send() function 2nd arg])
645 AC_DEFINE([SEND_ARG2_CAST], [(char *)],
646 [Type cast for the send() function 2nd arg])
649 dnl ***********************Checking for availability of IPv6*******************
651 AC_MSG_CHECKING([whether to enable IPv6])
652 AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
653 if test "$with_minimum" = "yes"
657 if test $enable_ipv6 = yes; then
659 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
660 # include <sys/types.h>
661 # include <sys/socket.h>
663 struct sockaddr_storage ss;
664 socket(AF_INET6, SOCK_STREAM, 0)
669 AC_MSG_RESULT($have_ipv6)
671 if test $have_ipv6 = yes; then
672 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
673 have_broken_ss_family=no
675 dnl *********************************************************************
676 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
677 dnl a ss_family member, but rather __ss_family. Let's detect that
678 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
679 dnl platforms. However, we should only do this if ss_family is not
681 dnl ********************************************************************
682 AC_MSG_CHECKING([struct sockaddr::ss_family])
683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
684 # include <sys/types.h>
685 # include <sys/socket.h>
687 struct sockaddr_storage ss ;
693 AC_MSG_RESULT($have_ss_family)
694 if test x$have_ss_family = xno ; then
695 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
696 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
697 # include <sys/types.h>
698 # include <sys/socket.h>
700 struct sockaddr_storage ss ;
703 have_broken_ss_family=yes,
704 have_broken_ss_family=no
706 AC_MSG_RESULT($have_broken_ss_family)
707 if test x$have_broken_ss_family = xyes ; then
708 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
709 [Whether struct sockaddr::__ss_family exists])
710 AC_DEFINE(ss_family, __ss_family,
711 [ss_family is not defined here, use __ss_family instead])
713 AC_MSG_WARN(ss_family and __ss_family not found)
718 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
719 if test $have_getaddrinfo != yes; then
720 for lib in bsd socket inet; do
721 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
725 if test $have_getaddrinfo = yes; then
726 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
731 dnl ******************************End IPv6 checks******************************
733 dnl Checks for isnan in libm if not in libc
734 AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
735 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
737 AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
738 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
740 XML_LIBDIR='-L${libdir}'
741 XML_INCLUDEDIR='-I${includedir}/libxml2'
750 dnl Workaround for native compilers
751 dnl HP : http://bugs.gnome.org/db/31/3163.html
752 dnl DEC : Enable NaN/Inf
754 if test "${GCC}" != "yes" ; then
757 CFLAGS="${CFLAGS} -Wp,-H30000"
760 CFLAGS="${CFLAGS} -ieee"
763 CFLAGS="${CFLAGS} -ieee"
767 if test "$with_fexceptions" = "yes"
770 # Not activated by default because this inflates the code size
771 # Used to allow propagation of C++ exceptions through the library
773 CFLAGS="${CFLAGS} -fexceptions"
776 # warnings we'd like to see
777 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"
778 # warnings we'd like to supress
779 CFLAGS="${CFLAGS} -Wno-long-long"
782 CFLAGS="${CFLAGS} -mieee"
785 CFLAGS="${CFLAGS} -mieee"
791 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
796 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
797 # If the host is Windows, and shared libraries are disabled, we
798 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
799 # work properly (without it, xmlexports.h would force the use of
800 # DLL imports, which obviously aren't present in a static
802 if test "x$enable_shared" = "xno"; then
803 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
804 CFLAGS="$CFLAGS -DLIBXML_STATIC"
816 PYTHON_SITE_PACKAGES=
819 if test "$with_python" != "no" ; then
820 if test -x "$with_python/bin/python"
822 echo Found python in $with_python/bin/python
823 PYTHON="$with_python/bin/python"
825 if test -x "$with_python/python.exe"
827 echo Found python in $with_python/python.exe
828 PYTHON="$with_python/python.exe"
830 if test -x "$with_python"
832 echo Found python in $with_python
833 PYTHON="$with_python"
837 echo Found python in environment PYTHON=$PYTHON
838 with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
840 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
845 if test "$PYTHON" != ""
847 PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
848 PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
849 # does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
851 # PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
852 echo Found Python version $PYTHON_VERSION
854 if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
856 if test -r $with_python/include/python$PYTHON_VERSION/Python.h
858 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
860 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
862 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
864 if test -r /usr/include/python$PYTHON_VERSION/Python.h
866 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
868 if test -r $with_python/include/Python.h
870 PYTHON_INCLUDES=$with_python/include
872 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
878 if test "$with_python_install_dir" != ""
880 PYTHON_SITE_PACKAGES="$with_python_install_dir"
882 if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
884 if test -d $libdir/python$PYTHON_VERSION/site-packages
886 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
888 if test -d $with_python/lib/site-packages
890 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
892 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
896 pythondir='$(PYTHON_SITE_PACKAGES)'
897 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
901 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
902 if test "$PYTHON_INCLUDES" != ""
909 AC_SUBST(PYTHON_SUBDIR)
910 AC_SUBST(PYTHON_LIBS)
912 dnl check for dso support
916 if test "$with_modules" != "no" ; then
919 MODULE_EXTENSION=".dll"
920 AC_CHECK_LIB(cygwin, dlopen, [
922 MODULE_PLATFORM_LIBS=
923 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
927 MODULE_EXTENSION=".dll"
931 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
932 AC_CHECK_LIB(dld, shl_load, [
933 MODULE_PLATFORM_LIBS="-ldld"
934 libxml_have_shl_load=yes], [
935 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
936 AC_CHECK_LIB(dl, dlopen, [
937 MODULE_PLATFORM_LIBS="-ldl"
938 libxml_have_dlopen=yes])])])])
940 if test "${libxml_have_shl_load}" = "yes"; then
941 MODULE_EXTENSION=".sl"
943 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
946 if test "${libxml_have_dlopen}" = "yes"; then
949 MODULE_EXTENSION=".sl"
952 MODULE_EXTENSION=".so"
957 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
963 if test "${WITH_MODULES}" = "1"; then
964 TEST_MODULES="ModuleTests"
967 AC_SUBST(WITH_MODULES)
968 AC_SUBST(MODULE_PLATFORM_LIBS)
969 AC_SUBST(MODULE_EXTENSION)
970 AC_SUBST(TEST_MODULES)
973 dnl Tester makes use of readline if present
977 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
978 dnl (-Wunreachable-code)
980 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
981 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
982 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
984 if test "$with_minimum" != "yes"
986 if test "${with_mem_debug}" = "" ; then
987 echo Activating memory debugging
991 if test "${with_docbook}" = "" ; then
995 if test "${GCC}" = "yes" ; then
996 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"
998 STATIC_BINARIES="-static"
999 dnl -Wcast-qual -ansi
1003 AC_SUBST(STATIC_BINARIES)
1006 dnl Check for trio string functions
1009 if test "${NEED_TRIO}" = "1" ; then
1010 echo Adding trio library for string functions
1015 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
1019 dnl Allow to enable/disable various pieces
1021 echo Checking configuration requirements
1024 dnl Thread-related stuff
1034 if test "$with_threads" = "no" ; then
1035 echo Disabling multithreaded support
1037 echo Enabling multithreaded support
1039 dnl Default to native threads on Win32
1041 *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
1044 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
1049 dnl Use pthread by default in other cases
1050 if test -z "$THREADS_W32"; then
1051 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
1052 AC_CHECK_HEADER(pthread.h,
1053 AC_CHECK_LIB(pthread, pthread_join,[
1054 THREAD_LIBS="-lpthread"
1055 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
1056 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
1062 *cygwin*) THREAD_LIBS=""
1064 *beos*) WITH_THREADS="1"
1065 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
1068 if test "${GCC}" = "yes" ; then
1069 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
1070 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
1071 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
1072 if test "${THREAD_LIBS}" = "-lpthread" ; then
1073 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
1076 BASE_THREAD_LIBS="-lpthread"
1078 if expr ${GCC_MAJOR} \> 3 > /dev/null
1081 BASE_THREAD_LIBS="-lpthread"
1083 echo old GCC disabling weak symbols for pthread
1090 if test "$WITH_THREADS" = "1" ; then
1091 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
1092 TEST_THREADS="Threadtests"
1095 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
1099 AC_SUBST(THREAD_LIBS)
1100 AC_SUBST(BASE_THREAD_LIBS)
1101 AC_SUBST(WITH_THREADS)
1102 AC_SUBST(THREAD_CFLAGS)
1103 AC_SUBST(TEST_THREADS)
1104 AC_SUBST(WITH_THREAD_ALLOC)
1105 AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
1108 dnl xmllint shell history
1110 if test "$with_history" = "yes" ; then
1111 echo Enabling xmllint shell history
1112 dnl check for terminal library. this is a very cool solution
1113 dnl from octave's configure.in
1115 for termlib in ncurses curses termcap terminfo termlib; do
1116 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
1117 test -n "$tcap" && break
1120 AC_CHECK_HEADER(readline/history.h,
1121 AC_CHECK_LIB(history, append_history,[
1122 RDL_LIBS="-lhistory"
1123 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
1124 AC_CHECK_HEADER(readline/readline.h,
1125 AC_CHECK_LIB(readline, readline,[
1126 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
1127 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
1128 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
1129 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
1130 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
1137 if test "$with_tree" = "no" ; then
1138 echo Disabling DOM like tree manipulation APIs
1145 if test "$with_ftp" = "no" ; then
1146 echo Disabling FTP support
1156 if test "$with_http" = "no" ; then
1157 echo Disabling HTTP support
1167 if test "$with_legacy" = "no" ; then
1168 echo Disabling deprecated APIs
1173 AC_SUBST(WITH_LEGACY)
1175 if test "$with_reader" = "no" ; then
1176 echo Disabling the xmlReader parsing interface
1181 READER_TEST=Readertests
1182 if test "$with_push" = "no" ; then
1183 echo xmlReader requires Push interface - enabling it
1187 AC_SUBST(WITH_READER)
1188 AC_SUBST(READER_TEST)
1190 if test "$with_writer" = "no" ; then
1191 echo Disabling the xmlWriter saving interface
1196 # WRITER_TEST=Writertests
1197 if test "$with_push" = "no" ; then
1198 echo xmlWriter requires Push interface - enabling it
1201 if test "$with_output" = "no" ; then
1202 echo xmlWriter requires Output interface - enabling it
1206 AC_SUBST(WITH_WRITER)
1207 #AC_SUBST(WRITER_TEST)
1209 if test "$with_pattern" = "no" ; then
1210 echo Disabling the xmlPattern parsing interface
1215 TEST_PATTERN=Patterntests
1217 AC_SUBST(WITH_PATTERN)
1218 AC_SUBST(TEST_PATTERN)
1220 if test "$with_sax1" = "no" ; then
1221 echo Disabling the older SAX1 interface
1229 AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1")
1232 if test "$with_push" = "no" ; then
1233 echo Disabling the PUSH parser interfaces
1238 TEST_PUSH="XMLPushtests"
1243 if test "$with_html" = "no" ; then
1244 echo Disabling HTML support
1250 HTML_OBJ="HTMLparser.o HTMLtree.o"
1252 if test "$with_push" != "no" ; then
1253 TEST_PHTML=HTMLPushtests
1261 AC_SUBST(TEST_PHTML)
1263 if test "$with_valid" = "no" ; then
1264 echo Disabling DTD validation support
1270 TEST_VALID=Validtests
1271 TEST_VTIME=VTimingtests
1273 AC_SUBST(WITH_VALID)
1274 AC_SUBST(TEST_VALID)
1275 AC_SUBST(TEST_VTIME)
1277 if test "$with_catalog" = "no" ; then
1278 echo Disabling Catalog support
1284 CATALOG_OBJ="catalog.o"
1285 TEST_CATALOG=Catatests
1287 AC_SUBST(WITH_CATALOG)
1288 AC_SUBST(CATALOG_OBJ)
1289 AC_SUBST(TEST_CATALOG)
1291 if test "$with_docbook" = "no" ; then
1292 echo Disabling Docbook support
1297 DOCB_OBJ="DOCBparser.o"
1303 if test "$with_xptr" = "no" ; then
1304 echo Disabling XPointer support
1312 if test "$with_xpath" = "no" ; then
1313 echo XPointer requires XPath support - enabling it
1321 if test "$with_c14n" = "no" ; then
1322 echo Disabling C14N support
1330 if test "$with_xpath" = "no" ; then
1331 echo C14N requires XPath support - enabling it
1339 if test "$with_xinclude" = "no" ; then
1340 echo Disabling XInclude support
1347 XINCLUDE_OBJ=xinclude.o
1348 TEST_XINCLUDE=XIncludetests
1349 if test "$with_xpath" = "no" ; then
1350 echo XInclude requires XPath support - enabling it
1354 AC_SUBST(WITH_XINCLUDE)
1355 AC_SUBST(XINCLUDE_OBJ)
1356 AC_SUBST(TEST_XINCLUDE)
1358 if test "$with_xptr" = "" -a "$with_xpath" = "no" ; then
1362 if test "$with_schematron" = "" -a "$with_xpath" = "no" ; then
1366 if test "$with_schematron" = "no" ; then
1367 echo "Disabling Schematron support"
1371 echo "Enabled Schematron support"
1373 TEST_SCHEMATRON="Schematrontests"
1378 AC_SUBST(WITH_SCHEMATRON)
1379 AC_SUBST(TEST_SCHEMATRON)
1381 if test "$with_xpath" = "no" ; then
1382 echo Disabling XPATH support
1389 TEST_XPATH=XPathtests
1391 AC_SUBST(WITH_XPATH)
1393 AC_SUBST(TEST_XPATH)
1396 dnl output functions
1398 if test "$with_output" = "no" ; then
1399 echo Disabling serialization/saving support
1404 AC_SUBST(WITH_OUTPUT)
1407 if test "$with_iconv" = "no" ; then
1408 echo Disabling ICONV support
1410 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1411 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1412 # Export this since our headers include iconv.h
1413 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1414 ICONV_LIBS="-L$with_iconv/lib"
1417 AC_CHECK_HEADER(iconv.h,
1418 AC_MSG_CHECKING(for iconv)
1419 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1420 #include <iconv.h>]],[[
1421 iconv_t cd = iconv_open ("","");
1422 iconv (cd, NULL, NULL, NULL, NULL);]])],[
1426 AC_MSG_CHECKING(for iconv in -liconv)
1428 _ldflags="${LDFLAGS}"
1430 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1431 LIBS="${LIBS} -liconv"
1433 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1434 #include <iconv.h>]],[[
1435 iconv_t cd = iconv_open ("","");
1436 iconv (cd, NULL, NULL, NULL, NULL);]])],[
1439 ICONV_LIBS="${ICONV_LIBS} -liconv"
1441 LDFLAGS="${_ldflags}"],[
1444 LDFLAGS="${_ldflags}"])]))
1446 if test "$WITH_ICONV" = "1" ; then
1447 AC_MSG_CHECKING([for iconv declaration])
1448 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1449 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1455 #if defined(__STDC__) || defined(__cplusplus)
1456 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1460 ]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1462 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);"
1463 AC_MSG_RESULT([${xml_xxx:-
1464 }$xml_cv_iconv_decl])
1465 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1466 [Define as const if the declaration of iconv() needs const.])
1479 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1480 XML_LIBTOOLLIBS="libxml2.la"
1481 AC_SUBST(WITH_ICONV)
1485 if test "$with_icu" != "yes" ; then
1486 echo Disabling ICU support
1488 ICU_CONFIG=icu-config
1489 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1491 ICU_LIBS=`${ICU_CONFIG} --ldflags`
1493 echo Enabling ICU support
1495 AC_MSG_ERROR([libicu config program icu-config not found])
1502 if test "$WITH_ICONV" != "1" ; then
1503 if test "$with_iso8859x" = "no" ; then
1504 echo Disabling ISO8859X support
1508 AC_SUBST(WITH_ISO8859X)
1510 if test "$with_schemas" = "no" ; then
1511 echo "Disabling Schemas/Relax-NG support"
1515 echo "Enabled Schemas/Relax-NG support"
1517 TEST_SCHEMAS="Schemastests Relaxtests"
1518 if test "$PYTHON_INCLUDES" != "" ; then
1519 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1523 AC_SUBST(WITH_SCHEMAS)
1524 AC_SUBST(TEST_SCHEMAS)
1526 if test "$with_regexps" = "no" ; then
1527 echo Disabling Regexps support
1532 TEST_REGEXPS="Regexptests Automatatests"
1534 AC_SUBST(WITH_REGEXPS)
1535 AC_SUBST(TEST_REGEXPS)
1537 if test "$with_debug" = "no" ; then
1538 echo Disabling DEBUG support
1544 DEBUG_OBJ=debugXML.o
1545 TEST_DEBUG=Scripttests
1547 AC_SUBST(WITH_DEBUG)
1549 AC_SUBST(TEST_DEBUG)
1551 if test "$with_mem_debug" = "yes" ; then
1552 if test "$with_thread_alloc" = "yes" ; then
1553 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1556 echo Enabling memory debug support
1562 AC_SUBST(WITH_MEM_DEBUG)
1564 if test "$with_run_debug" = "yes" ; then
1565 echo Enabling runtime debug support
1570 AC_SUBST(WITH_RUN_DEBUG)
1573 WIN32_EXTRA_LDFLAGS=
1574 CYGWIN_EXTRA_LDFLAGS=
1575 CYGWIN_EXTRA_PYTHON_LIBADD=
1576 WIN32_EXTRA_PYTHON_LIBADD=
1579 CPPFLAGS="$CPPFLAGS -DWIN32"
1580 WIN32_EXTRA_LIBADD="-lws2_32"
1581 WIN32_EXTRA_LDFLAGS="-no-undefined"
1582 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1583 if test "${PYTHON}" != ""
1585 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
1589 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1590 if test "${PYTHON}" != ""
1592 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1596 AC_SUBST(WIN32_EXTRA_LIBADD)
1597 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1598 AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
1599 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1600 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1602 dnl Checking the standard string functions availability
1604 dnl Note mingw* has C99 implementation that produce expected xml numbers
1605 dnl if code use {v}snprintf functions.
1606 dnl If you like to activate at run-time C99 compatible number output
1607 dnl see release note for mingw runtime 3.15:
1608 dnl http://sourceforge.net/project/shownotes.php?release_id=24832
1610 dnl Also *win32*config.h files redefine them for various MSC compilers.
1612 dnl So do not redefine {v}snprintf to _{v}snprintf like follwing:
1613 dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1614 dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1615 dnl and do not redefine those functions is C-source files.
1617 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
1620 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1622 echo Enabling code coverage for GCC
1623 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1624 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1626 echo Disabling code coverage for GCC
1632 AC_SUBST(XML_CFLAGS)
1634 AC_SUBST(XML_LIBDIR)
1636 AC_SUBST(XML_LIBTOOLLIBS)
1637 AC_SUBST(ICONV_LIBS)
1638 AC_SUBST(XML_INCLUDEDIR)
1640 AC_SUBST(HAVE_ISNAN)
1641 AC_SUBST(HAVE_ISINF)
1643 AC_SUBST(PYTHON_VERSION)
1644 AC_SUBST(PYTHON_INCLUDES)
1645 AC_SUBST(PYTHON_SITE_PACKAGES)
1650 dnl for the spec file
1651 RELDATE=`date +'%a %b %e %Y'`
1653 AC_SUBST(PYTHON_TESTS)
1655 rm -f COPYING.LIB COPYING
1656 ln -s $srcdir/Copyright COPYING
1658 # keep on one line for cygwin c.f. #130896
1659 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 libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
1660 AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
1661 AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config])
1664 echo Done configuring