1 dnl Process this file with autoconf to produce a configure script.
3 AM_CONFIG_HEADER(config.h)
9 LIBXML_MICRO_VERSION_SUFFIX=
10 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
11 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
13 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
15 if test -f CVS/Entries ; then
16 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
18 if test "$extra" != ""
20 LIBXML_VERSION_EXTRA="-CVS$extra"
22 else if test -d .svn ; then
23 extra=`svn info | grep Revision | sed 's+Revision: ++'`
25 if test "$extra" != ""
27 LIBXML_VERSION_EXTRA="-SVN$extra"
29 else if test -d .git ; then
30 extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
32 if test "$extra" != ""
34 LIBXML_VERSION_EXTRA="-GIT$extra"
39 AC_SUBST(LIBXML_MAJOR_VERSION)
40 AC_SUBST(LIBXML_MINOR_VERSION)
41 AC_SUBST(LIBXML_MICRO_VERSION)
42 AC_SUBST(LIBXML_VERSION)
43 AC_SUBST(LIBXML_VERSION_INFO)
44 AC_SUBST(LIBXML_VERSION_NUMBER)
45 AC_SUBST(LIBXML_VERSION_EXTRA)
47 VERSION=${LIBXML_VERSION}
49 AM_INIT_AUTOMAKE(libxml2, $VERSION)
51 dnl Checks for programs.
55 AC_PATH_PROG(RM, rm, /bin/rm)
56 AC_PATH_PROG(MV, mv, /bin/mv)
57 AC_PATH_PROG(TAR, tar, /bin/tar)
58 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
59 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
60 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
61 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
63 dnl Make sure we have an ANSI compiler
65 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
71 dnl if the system support linker version scripts for symbol versioning
75 $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
76 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
77 test "`uname`" == "SunOS" && \
78 VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
79 AC_SUBST(VERSION_SCRIPT_FLAGS)
80 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
83 dnl We process the AC_ARG_WITH first so that later we can modify
84 dnl some of them to try to prevent impossible combinations. This
85 dnl also allows up so alphabetize the choices
89 dnl zlib option might change flags, so we save them initially
91 _cppflags="${CPPFLAGS}"
95 [ --with-c14n add the Canonicalization support (on)])
97 [ --with-catalog add the Catalog support (on)])
99 [ --with-debug add the debugging module (on)])
101 [ --with-docbook add Docbook SGML support (on)])
102 AC_ARG_WITH(fexceptions,
103 [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
105 [ --with-ftp add the FTP support (on)])
107 [ --with-history add history support to xmllint shell(off)])
109 [ --with-html add the HTML support (on)])
110 dnl Specific dir for HTML output ?
111 AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
112 [path to base html directory, default $datadir/doc/html]),
113 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
115 AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
116 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
117 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
118 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
121 [ --with-http add the HTTP support (on)])
123 [ --with-iconv[[=DIR]] add ICONV support (on)])
124 AC_ARG_WITH(iso8859x,
125 [ --with-iso8859x add ISO8859X support if no iconv (on)])
127 [ --with-legacy add deprecated APIs for compatibility (on)])
128 AC_ARG_WITH(mem_debug,
129 [ --with-mem-debug add the memory debugging module (off)])
131 [ --with-minimum build a minimally sized library (off)])
133 [ --with-output add the serialization support (on)])
135 [ --with-pattern add the xmlPattern selection interface (on)])
137 [ --with-push add the PUSH parser interfaces (on)])
139 [ --with-python[[=DIR]] build Python bindings if found])
141 [ --with-reader add the xmlReader parsing interface (on)])
142 AC_ARG_WITH(readline,
143 [ --with-readline=DIR use readline in DIR],[
144 if test "$withval" != "no" -a "$withval" != "yes"; then
146 CPPFLAGS="${CPPFLAGS} -I$withval/include"
147 LDFLAGS="${LDFLAGS} -L$withval/lib"
151 [ --with-regexps add Regular Expressions support (on)])
152 AC_ARG_WITH(run_debug,
153 [ --with-run-debug add the runtime debugging module (off)])
155 [ --with-sax1 add the older SAX1 interface (on)])
157 [ --with-schemas add Relax-NG and Schemas support (on)])
158 AC_ARG_WITH(schematron,
159 [ --with-schematron add Schematron support (on)])
161 [ --with-threads add multithread support(on)])
162 AC_ARG_WITH(thread-alloc,
163 [ --with-thread-alloc add per-thread memory(off)])
165 [ --with-tree add the DOM like tree manipulation APIs (on)])
167 [ --with-valid add the DTD validation support (on)])
169 [ --with-writer add the xmlWriter saving interface (on)])
170 AC_ARG_WITH(xinclude,
171 [ --with-xinclude add the XInclude support (on)])
173 [ --with-xpath add the XPATH support (on)])
175 [ --with-xptr add the XPointer support (on)])
177 [ --with-modules add the dynamic modules support (on)])
179 [ --with-zlib[[=DIR]] use libz in DIR],[
180 if test "$withval" != "no" -a "$withval" != "yes"; then
182 CPPFLAGS="${CPPFLAGS} -I$withval/include"
183 LDFLAGS="${LDFLAGS} -L$withval/lib"
186 AC_ARG_WITH(coverage,
187 [ --with-coverage build for code coverage with GCC (off)])
189 AC_ARG_ENABLE(rebuild-docs,
190 [ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
191 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
194 dnl hard dependancies on options
196 if test "$with_schemas" = "yes"
201 if test "$with_schematron" = "yes"
206 if test "$with_reader" = "yes"
210 if test "$with_xptr" = "yes"
215 dnl option to build a minimal libxml2 library
217 if test "$with_minimum" = "yes"
219 echo "Configuring for a minimal library"
220 if test "$with_c14n" = ""
224 if test "$with_catalog" = ""
229 if test "$with_debug" = ""
233 if test "$with_docbook" = ""
237 if test "$with_fexceptions" = ""
241 if test "$with_ftp" = ""
245 if test "$with_history" = ""
249 if test "$with_html" = ""
253 if test "$with_http" = ""
257 if test "$with_iconv" = ""
261 if test "$with_iso8859x" = ""
265 if test "$with_legacy" = ""
269 if test "$with_mem_debug" = ""
273 if test "$with_output" = ""
277 if test "$with_pattern" = ""
281 if test "$with_push" = ""
285 if test "$with_python" = ""
289 if test "$with_reader" = ""
293 if test "$with_readline" = ""
297 if test "$with_regexps" = ""
301 if test "$with_run_debug" = ""
305 if test "$with_sax1" = ""
309 if test "$with_schemas" = ""
313 if test "$with_schematron" = ""
317 if test "$with_threads" = ""
321 if test "$with_thread_alloc" = ""
325 if test "$with_tree" = ""
329 if test "$with_valid" = ""
333 if test "$with_writer" = ""
337 if test "$with_xinclude" = ""
341 if test "$with_xpath" = ""
345 if test "$with_xptr" = ""
349 if test "$with_zlib" = ""
353 if test "$with_modules" = ""
361 dnl Checks for zlib library.
364 if test "$with_zlib" = "no"; then
365 echo "Disabling compression support"
367 AC_CHECK_HEADERS(zlib.h,
368 AC_CHECK_LIB(z, gzread,[
369 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
371 if test "x${Z_DIR}" != "x"; then
372 Z_CFLAGS="-I${Z_DIR}/include"
373 Z_LIBS="-L${Z_DIR}/lib -lz"
376 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
388 CPPFLAGS=${_cppflags}
391 echo Checking headers
393 dnl Checks for header files.
396 AC_CHECK_HEADERS([fcntl.h])
397 AC_CHECK_HEADERS([unistd.h])
398 AC_CHECK_HEADERS([ctype.h])
399 AC_CHECK_HEADERS([dirent.h])
400 AC_CHECK_HEADERS([errno.h])
401 AC_CHECK_HEADERS([malloc.h])
402 AC_CHECK_HEADERS([stdarg.h])
403 AC_CHECK_HEADERS([sys/stat.h])
404 AC_CHECK_HEADERS([sys/types.h])
405 AC_CHECK_HEADERS([stdint.h])
406 AC_CHECK_HEADERS([inttypes.h.h])
407 AC_CHECK_HEADERS([time.h])
408 AC_CHECK_HEADERS([ansidecl.h])
409 AC_CHECK_HEADERS([ieeefp.h])
410 AC_CHECK_HEADERS([nan.h])
411 AC_CHECK_HEADERS([math.h])
412 AC_CHECK_HEADERS([limits.h])
413 AC_CHECK_HEADERS([fp_class.h])
414 AC_CHECK_HEADERS([float.h])
415 AC_CHECK_HEADERS([stdlib.h])
416 AC_CHECK_HEADERS([sys/socket.h], [], [],
417 [#if HAVE_SYS_TYPES_H
418 # include <sys/types.h>
421 AC_CHECK_HEADERS([netinet/in.h], [], [],
422 [#if HAVE_SYS_TYPES_H
423 # include <sys/types.h>
426 AC_CHECK_HEADERS([arpa/inet.h], [], [],
427 [#if HAVE_SYS_TYPES_H
428 # include <sys/types.h>
431 # include <arpa/inet.h>
434 AC_CHECK_HEADERS([netdb.h])
435 AC_CHECK_HEADERS([sys/time.h])
436 AC_CHECK_HEADERS([sys/select.h])
437 AC_CHECK_HEADERS([poll.h])
438 AC_CHECK_HEADERS([sys/mman.h])
439 AC_CHECK_HEADERS([sys/timeb.h])
440 AC_CHECK_HEADERS([signal.h])
441 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
442 [#if HAVE_SYS_TYPES_H
443 # include <sys/types.h>
446 AC_CHECK_HEADERS([resolv.h], [], [],
447 [#if HAVE_SYS_TYPES_H
448 # include <sys/types.h>
450 #if HAVE_NETINET_IN_H
451 # include <netinet/in.h>
453 #if HAVE_ARPA_NAMESER_H
454 # include <arpa/nameser.h>
457 AC_CHECK_HEADERS([dl.h])
458 AC_CHECK_HEADERS([dlfcn.h])
461 echo Checking libraries
463 dnl Checks for library functions.
465 AC_CHECK_FUNCS(strdup strndup strerror)
466 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
467 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
468 AC_CHECK_FUNCS(stat _stat signal)
470 dnl Checking the standard string functions availability
471 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
474 dnl Checking for va_copy availability
475 AC_MSG_CHECKING([for va_copy])
476 AC_TRY_LINK([#include <stdarg.h>
477 va_list ap1,ap2;], [va_copy(ap1,ap2);],
480 AC_MSG_RESULT($have_va_copy)
481 if test x"$have_va_copy" = x"yes"; then
482 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
484 AC_MSG_CHECKING([for __va_copy])
485 AC_TRY_LINK([#include <stdarg.h>
486 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
489 AC_MSG_RESULT($have___va_copy)
490 if test x"$have___va_copy" = x"yes"; then
491 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
495 dnl Checks for inet libraries:
496 AC_SEARCH_LIBS(gethostent, [nsl])
497 AC_SEARCH_LIBS(setsockopt, [socket net network])
498 AC_SEARCH_LIBS(connect, [inet])
500 dnl Determine what socket length (socklen_t) data type is
501 AC_MSG_CHECKING([for type of socket length (socklen_t)])
504 #include <sys/types.h>
505 #include <sys/socket.h>],[
506 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
507 AC_MSG_RESULT(socklen_t *)
508 XML_SOCKLEN_T=socklen_t],[
511 #include <sys/types.h>
512 #include <sys/socket.h>],[
513 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
514 AC_MSG_RESULT(size_t *)
515 XML_SOCKLEN_T=size_t],[
518 #include <sys/types.h>
519 #include <sys/socket.h>],[
520 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
523 AC_MSG_WARN(could not determine)
524 XML_SOCKLEN_T="int"])])])
525 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
527 dnl ***********************Checking for availability of IPv6*******************
529 AC_MSG_CHECKING([whether to enable IPv6])
530 AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
531 if test "$with_minimum" = "yes"
535 if test $enable_ipv6 = yes; then
538 #include <sys/types.h>
539 #include <sys/socket.h>
541 struct sockaddr_storage ss;
542 socket(AF_INET6, SOCK_STREAM, 0)
547 AC_MSG_RESULT($have_ipv6)
549 if test $have_ipv6 = yes; then
550 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
551 have_broken_ss_family=no
553 dnl *********************************************************************
554 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
555 dnl a ss_family member, but rather __ss_family. Let's detect that
556 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
557 dnl platforms. However, we should only do this if ss_family is not
559 dnl ********************************************************************
560 AC_MSG_CHECKING([struct sockaddr::ss_family])
562 #include <sys/types.h>
563 #include <sys/socket.h>
565 struct sockaddr_storage ss ;
571 AC_MSG_RESULT($have_ss_family)
572 if test x$have_ss_family = xno ; then
573 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
575 #include <sys/types.h>
576 #include <sys/socket.h>
578 struct sockaddr_storage ss ;
581 have_broken_ss_family=yes,
582 have_broken_ss_family=no
584 AC_MSG_RESULT($have_broken_ss_family)
585 if test x$have_broken_ss_family = xyes ; then
586 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
587 [Whether struct sockaddr::__ss_family exists])
588 AC_DEFINE(ss_family, __ss_family,
589 [ss_family is not defined here, use __ss_family instead])
591 AC_MSG_WARN(ss_family and __ss_family not found)
596 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
597 if test $have_getaddrinfo != yes; then
598 for lib in bsd socket inet; do
599 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
603 if test $have_getaddrinfo = yes; then
604 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
609 dnl ******************************End IPv6 checks******************************
611 dnl Checks for isnan in libm if not in libc
612 AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
613 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
615 AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
616 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
618 XML_LIBDIR='-L${libdir}'
619 XML_INCLUDEDIR='-I${includedir}/libxml2'
628 dnl Workaround for native compilers
629 dnl HP : http://bugs.gnome.org/db/31/3163.html
630 dnl DEC : Enable NaN/Inf
632 if test "${GCC}" != "yes" ; then
635 CFLAGS="${CFLAGS} -Wp,-H30000"
638 CFLAGS="${CFLAGS} -ieee"
641 CFLAGS="${CFLAGS} -ieee"
645 if test "$with_fexceptions" = "yes"
648 # Not activated by default because this inflates the code size
649 # Used to allow propagation of C++ exceptions through the library
651 CFLAGS="${CFLAGS} -fexceptions"
654 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"
657 CFLAGS="${CFLAGS} -mieee"
660 CFLAGS="${CFLAGS} -mieee"
666 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
671 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
672 # If the host is Windows, and shared libraries are disabled, we
673 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
674 # work properly (without it, xmlexports.h would force the use of
675 # DLL imports, which obviously aren't present in a static
677 if test "x$enable_shared" = "xno"; then
678 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
679 CFLAGS="$CFLAGS -DLIBXML_STATIC"
691 PYTHON_SITE_PACKAGES=
694 if test "$with_python" != "no" ; then
695 if test -x "$with_python/bin/python"
697 echo Found python in $with_python/bin/python
698 PYTHON="$with_python/bin/python"
700 if test -x "$with_python"
702 echo Found python in $with_python
703 PYTHON="$with_python"
707 echo Found python in environment PYTHON=$PYTHON
708 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
710 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
714 if test "$PYTHON" != ""
716 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
717 echo Found Python version $PYTHON_VERSION
719 if test "$PYTHON_VERSION" != ""
721 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
722 -d $with_python/lib/python$PYTHON_VERSION/site-packages
724 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
725 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
727 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
729 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
730 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
732 if test -r /usr/include/python$PYTHON_VERSION/Python.h
734 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
735 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
737 echo could not find python$PYTHON_VERSION/Python.h
740 if test ! -d "$PYTHON_SITE_PACKAGES"
742 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
745 PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
747 if test "$with_python" != ""
749 pythondir='$(PYTHON_SITE_PACKAGES)'
751 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
756 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
757 if test "$PYTHON_INCLUDES" != ""
764 AC_SUBST(PYTHON_SUBDIR)
765 AC_SUBST(PYTHON_LIBS)
767 dnl check for dso support
771 if test "$with_modules" != "no" ; then
774 MODULE_EXTENSION=".dll"
775 AC_CHECK_LIB(cygwin, dlopen, [
777 MODULE_PLATFORM_LIBS=
778 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
782 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
783 AC_CHECK_LIB(dld, shl_load, [
784 MODULE_PLATFORM_LIBS="-ldld"
785 libxml_have_shl_load=yes], [
786 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
787 AC_CHECK_LIB(dl, dlopen, [
788 MODULE_PLATFORM_LIBS="-ldl"
789 libxml_have_dlopen=yes])])])])
791 if test "${libxml_have_shl_load}" = "yes"; then
792 MODULE_EXTENSION=".sl"
794 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
797 if test "${libxml_have_dlopen}" = "yes"; then
800 MODULE_EXTENSION=".sl"
803 MODULE_EXTENSION=".so"
808 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
814 if test "${WITH_MODULES}" = "1"; then
815 TEST_MODULES="ModuleTests"
818 AC_SUBST(WITH_MODULES)
819 AC_SUBST(MODULE_PLATFORM_LIBS)
820 AC_SUBST(MODULE_EXTENSION)
821 AC_SUBST(TEST_MODULES)
824 dnl Tester makes use of readline if present
828 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
829 dnl (-Wunreachable-code)
831 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
832 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
833 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
835 if test "$with_minimum" != "yes"
837 if test "${with_mem_debug}" = "" ; then
838 echo Activating memory debugging
842 if test "${with_docbook}" = "" ; then
846 if test "${GCC}" = "yes" ; then
847 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"
849 STATIC_BINARIES="-static"
850 dnl -Wcast-qual -ansi
854 AC_SUBST(STATIC_BINARIES)
857 dnl Check for trio string functions
860 if test "${NEED_TRIO}" = "1" ; then
861 echo Adding trio library for string functions
866 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
870 dnl Allow to enable/disable various pieces
872 echo Checking configuration requirements
875 dnl Thread-related stuff
884 if test "$with_threads" = "no" ; then
885 echo Disabling multithreaded support
887 echo Enabling multithreaded support
888 dnl Use pthread by default
889 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
890 AC_CHECK_HEADER(pthread.h,
891 AC_CHECK_LIB(pthread, pthread_join,[
892 THREAD_LIBS="-lpthread"
893 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
894 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
898 *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
901 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
904 *cygwin*) THREAD_LIBS=""
906 *beos*) WITH_THREADS="1"
907 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
910 if test "${GCC}" = "yes" ; then
911 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
912 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
913 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
914 if test "${THREAD_LIBS}" = "-lpthread" ; then
915 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
918 BASE_THREAD_LIBS="-lpthread"
920 if expr ${GCC_MAJOR} \> 3 > /dev/null
923 BASE_THREAD_LIBS="-lpthread"
925 echo old GCC disabling weak symbols for pthread
932 if test "$WITH_THREADS" = "1" ; then
933 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
934 TEST_THREADS="Threadtests"
937 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
938 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
941 AC_SUBST(THREAD_LIBS)
942 AC_SUBST(BASE_THREAD_LIBS)
943 AC_SUBST(WITH_THREADS)
944 AC_SUBST(THREAD_CFLAGS)
945 AC_SUBST(TEST_THREADS)
946 AC_SUBST(THREADS_W32)
949 dnl xmllint shell history
951 if test "$with_history" = "yes" ; then
952 echo Enabling xmllint shell history
953 dnl check for terminal library. this is a very cool solution
954 dnl from octave's configure.in
956 for termlib in ncurses curses termcap terminfo termlib; do
957 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
958 test -n "$tcap" && break
961 AC_CHECK_HEADER(readline/history.h,
962 AC_CHECK_LIB(history, append_history,[
964 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
965 AC_CHECK_HEADER(readline/readline.h,
966 AC_CHECK_LIB(readline, readline,[
967 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
968 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
969 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
970 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
971 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
978 if test "$with_tree" = "no" ; then
979 echo Disabling DOM like tree manipulation APIs
986 if test "$with_ftp" = "no" ; then
987 echo Disabling FTP support
997 if test "$with_http" = "no" ; then
998 echo Disabling HTTP support
1008 if test "$with_legacy" = "no" ; then
1009 echo Disabling deprecated APIs
1014 AC_SUBST(WITH_LEGACY)
1016 if test "$with_reader" = "no" ; then
1017 echo Disabling the xmlReader parsing interface
1022 READER_TEST=Readertests
1023 if test "$with_push" = "no" ; then
1024 echo xmlReader requires Push interface - enabling it
1028 AC_SUBST(WITH_READER)
1029 AC_SUBST(READER_TEST)
1031 if test "$with_writer" = "no" ; then
1032 echo Disabling the xmlWriter saving interface
1037 # WRITER_TEST=Writertests
1038 if test "$with_push" = "no" ; then
1039 echo xmlWriter requires Push interface - enabling it
1042 if test "$with_output" = "no" ; then
1043 echo xmlWriter requires Output interface - enabling it
1047 AC_SUBST(WITH_WRITER)
1048 #AC_SUBST(WRITER_TEST)
1050 if test "$with_pattern" = "no" ; then
1051 echo Disabling the xmlPattern parsing interface
1056 TEST_PATTERN=Patterntests
1058 AC_SUBST(WITH_PATTERN)
1059 AC_SUBST(TEST_PATTERN)
1061 if test "$with_sax1" = "no" ; then
1062 echo Disabling the older SAX1 interface
1072 if test "$with_push" = "no" ; then
1073 echo Disabling the PUSH parser interfaces
1078 TEST_PUSH="XMLPushtests"
1083 if test "$with_html" = "no" ; then
1084 echo Disabling HTML support
1090 HTML_OBJ="HTMLparser.o HTMLtree.o"
1092 if test "$with_push" != "no" ; then
1093 TEST_PHTML=HTMLPushtests
1101 AC_SUBST(TEST_PHTML)
1103 if test "$with_valid" = "no" ; then
1104 echo Disabling DTD validation support
1110 TEST_VALID=Validtests
1111 TEST_VTIME=VTimingtests
1113 AC_SUBST(WITH_VALID)
1114 AC_SUBST(TEST_VALID)
1115 AC_SUBST(TEST_VTIME)
1117 if test "$with_catalog" = "no" ; then
1118 echo Disabling Catalog support
1124 CATALOG_OBJ="catalog.o"
1125 TEST_CATALOG=Catatests
1127 AC_SUBST(WITH_CATALOG)
1128 AC_SUBST(CATALOG_OBJ)
1129 AC_SUBST(TEST_CATALOG)
1131 if test "$with_docbook" = "no" ; then
1132 echo Disabling Docbook support
1137 DOCB_OBJ="DOCBparser.o"
1143 if test "$with_xptr" = "no" ; then
1144 echo Disabling XPointer support
1152 if test "$with_xpath" = "no" ; then
1153 echo XPointer requires XPath support - enabling it
1161 if test "$with_c14n" = "no" ; then
1162 echo Disabling C14N support
1170 if test "$with_xpath" = "no" ; then
1171 echo C14N requires XPath support - enabling it
1179 if test "$with_xinclude" = "no" ; then
1180 echo Disabling XInclude support
1187 XINCLUDE_OBJ=xinclude.o
1188 TEST_XINCLUDE=XIncludetests
1189 if test "$with_xpath" = "no" ; then
1190 echo XInclude requires XPath support - enabling it
1194 AC_SUBST(WITH_XINCLUDE)
1195 AC_SUBST(XINCLUDE_OBJ)
1196 AC_SUBST(TEST_XINCLUDE)
1198 if test "$with_xpath" = "no" ; then
1199 echo Disabling XPATH support
1206 TEST_XPATH=XPathtests
1208 AC_SUBST(WITH_XPATH)
1210 AC_SUBST(TEST_XPATH)
1213 dnl output functions
1215 if test "$with_output" = "no" ; then
1216 echo Disabling serialization/saving support
1221 AC_SUBST(WITH_OUTPUT)
1224 if test "$with_iconv" = "no" ; then
1225 echo Disabling ICONV support
1227 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1228 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1229 # Export this since our headers include iconv.h
1230 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1231 ICONV_LIBS="-L$with_iconv/lib"
1234 AC_CHECK_HEADER(iconv.h,
1235 AC_MSG_CHECKING(for iconv)
1236 AC_TRY_LINK([#include <stdlib.h>
1237 #include <iconv.h>],[
1238 iconv_t cd = iconv_open ("","");
1239 iconv (cd, NULL, NULL, NULL, NULL);],[
1243 AC_MSG_CHECKING(for iconv in -liconv)
1245 _ldflags="${LDFLAGS}"
1247 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1248 LIBS="${LIBS} -liconv"
1250 AC_TRY_LINK([#include <stdlib.h>
1251 #include <iconv.h>],[
1252 iconv_t cd = iconv_open ("","");
1253 iconv (cd, NULL, NULL, NULL, NULL);],[
1256 ICONV_LIBS="${ICONV_LIBS} -liconv"
1258 LDFLAGS="${_ldflags}"],[
1261 LDFLAGS="${_ldflags}"])]))
1263 if test "$WITH_ICONV" = "1" ; then
1264 AC_MSG_CHECKING([for iconv declaration])
1265 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1266 AC_TRY_COMPILE([#include <stdlib.h>
1272 #if defined(__STDC__) || defined(__cplusplus)
1273 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1277 ], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1279 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);"
1280 AC_MSG_RESULT([${xml_xxx:-
1281 }$xml_cv_iconv_decl])
1282 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1283 [Define as const if the declaration of iconv() needs const.])
1296 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
1297 XML_LIBTOOLLIBS="libxml2.la"
1298 AC_SUBST(WITH_ICONV)
1301 if test "$WITH_ICONV" != "1" ; then
1302 if test "$with_iso8859x" = "no" ; then
1303 echo Disabling ISO8859X support
1307 AC_SUBST(WITH_ISO8859X)
1309 if test "$with_schematron" = "no" ; then
1310 echo "Disabling Schematron support"
1314 echo "Enabled Schematron support"
1316 TEST_SCHEMATRON="Schematrontests"
1320 AC_SUBST(WITH_SCHEMATRON)
1321 AC_SUBST(TEST_SCHEMATRON)
1323 if test "$with_schemas" = "no" ; then
1324 echo "Disabling Schemas/Relax-NG support"
1328 echo "Enabled Schemas/Relax-NG support"
1330 TEST_SCHEMAS="Schemastests Relaxtests"
1331 if test "$PYTHON_INCLUDES" != "" ; then
1332 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1336 AC_SUBST(WITH_SCHEMAS)
1337 AC_SUBST(TEST_SCHEMAS)
1339 if test "$with_regexps" = "no" ; then
1340 echo Disabling Regexps support
1345 TEST_REGEXPS="Regexptests Automatatests"
1347 AC_SUBST(WITH_REGEXPS)
1348 AC_SUBST(TEST_REGEXPS)
1350 if test "$with_debug" = "no" ; then
1351 echo Disabling DEBUG support
1357 DEBUG_OBJ=debugXML.o
1358 TEST_DEBUG=Scripttests
1360 AC_SUBST(WITH_DEBUG)
1362 AC_SUBST(TEST_DEBUG)
1364 if test "$with_mem_debug" = "yes" ; then
1365 if test "$with_thread_alloc" = "yes" ; then
1366 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1369 echo Enabling memory debug support
1375 AC_SUBST(WITH_MEM_DEBUG)
1377 if test "$with_run_debug" = "yes" ; then
1378 echo Enabling runtime debug support
1383 AC_SUBST(WITH_RUN_DEBUG)
1386 WIN32_EXTRA_LDFLAGS=
1387 CYGWIN_EXTRA_LDFLAGS=
1388 CYGWIN_EXTRA_PYTHON_LIBADD=
1391 CPPFLAGS="$CPPFLAGS -DWIN32"
1392 WIN32_EXTRA_LIBADD="-lws2_32"
1393 WIN32_EXTRA_LDFLAGS="-no-undefined"
1394 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1395 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1396 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1399 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1400 if test "${PYTHON}" != ""
1402 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1406 AC_SUBST(WIN32_EXTRA_LIBADD)
1407 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1408 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1409 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1411 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1413 echo Enabling code coverage for GCC
1414 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1415 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1417 echo Disabling code coverage for GCC
1423 AC_SUBST(XML_CFLAGS)
1425 AC_SUBST(XML_LIBDIR)
1427 AC_SUBST(XML_LIBTOOLLIBS)
1428 AC_SUBST(ICONV_LIBS)
1429 AC_SUBST(XML_INCLUDEDIR)
1431 AC_SUBST(HAVE_ISNAN)
1432 AC_SUBST(HAVE_ISINF)
1434 AC_SUBST(PYTHON_VERSION)
1435 AC_SUBST(PYTHON_INCLUDES)
1436 AC_SUBST(PYTHON_SITE_PACKAGES)
1441 dnl for the spec file
1442 RELDATE=`date +'%a %b %e %Y'`
1444 AC_SUBST(PYTHON_TESTS)
1446 rm -f COPYING.LIB COPYING
1447 ln -s Copyright COPYING
1449 # keep on one line for cygwin c.f. #130896
1450 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)
1452 chmod +x xml2-config python/setup.py
1453 echo Done configuring