1 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h)
5 AC_CONFIG_MACRO_DIR([m4])
10 LIBXML_MICRO_VERSION=8
11 LIBXML_MICRO_VERSION_SUFFIX=
12 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
13 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
15 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
17 if test -f CVS/Entries ; then
18 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
20 if test "$extra" != ""
22 LIBXML_VERSION_EXTRA="-CVS$extra"
24 else if test -d .svn ; then
25 extra=`svn info | grep Revision | sed 's+Revision: ++'`
27 if test "$extra" != ""
29 LIBXML_VERSION_EXTRA="-SVN$extra"
31 else if test -d .git ; then
32 extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
34 if test "$extra" != ""
36 LIBXML_VERSION_EXTRA="-GIT$extra"
41 AC_SUBST(LIBXML_MAJOR_VERSION)
42 AC_SUBST(LIBXML_MINOR_VERSION)
43 AC_SUBST(LIBXML_MICRO_VERSION)
44 AC_SUBST(LIBXML_VERSION)
45 AC_SUBST(LIBXML_VERSION_INFO)
46 AC_SUBST(LIBXML_VERSION_NUMBER)
47 AC_SUBST(LIBXML_VERSION_EXTRA)
49 VERSION=${LIBXML_VERSION}
51 AM_INIT_AUTOMAKE(libxml2, $VERSION)
53 dnl Checks for programs.
58 AC_PATH_PROG(RM, rm, /bin/rm)
59 AC_PATH_PROG(MV, mv, /bin/mv)
60 AC_PATH_PROG(TAR, tar, /bin/tar)
61 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
62 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
63 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
64 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
66 dnl Make sure we have an ANSI compiler
68 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
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}"
101 _ldflags="${LDFLAGS}"
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, AC_HELP_STRING([--with-html-dir=path],
121 [path to base html directory, default $datadir/doc/html]),
122 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
124 AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
125 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
126 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
127 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
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])
152 [ --with-reader add the xmlReader parsing interface (on)])
153 AC_ARG_WITH(readline,
154 [ --with-readline=DIR use readline in DIR],[
155 if test "$withval" != "no" -a "$withval" != "yes"; then
157 CPPFLAGS="${CPPFLAGS} -I$withval/include"
158 LDFLAGS="${LDFLAGS} -L$withval/lib"
162 [ --with-regexps add Regular Expressions support (on)])
163 AC_ARG_WITH(run_debug,
164 [ --with-run-debug add the runtime debugging module (off)])
166 [ --with-sax1 add the older SAX1 interface (on)])
168 [ --with-schemas add Relax-NG and Schemas support (on)])
169 AC_ARG_WITH(schematron,
170 [ --with-schematron add Schematron support (on)])
172 [ --with-threads add multithread support(on)])
173 AC_ARG_WITH(thread-alloc,
174 [ --with-thread-alloc add per-thread memory(off)])
176 [ --with-tree add the DOM like tree manipulation APIs (on)])
178 [ --with-valid add the DTD validation support (on)])
180 [ --with-writer add the xmlWriter saving interface (on)])
181 AC_ARG_WITH(xinclude,
182 [ --with-xinclude add the XInclude support (on)])
184 [ --with-xpath add the XPATH support (on)])
186 [ --with-xptr add the XPointer support (on)])
188 [ --with-modules add the dynamic modules support (on)])
190 [ --with-zlib[[=DIR]] use libz in DIR],[
191 if test "$withval" != "no" -a "$withval" != "yes"; then
193 CPPFLAGS="${CPPFLAGS} -I$withval/include"
194 LDFLAGS="${LDFLAGS} -L$withval/lib"
197 AC_ARG_WITH(coverage,
198 [ --with-coverage build for code coverage with GCC (off)])
200 AC_ARG_ENABLE(rebuild-docs,
201 [ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
202 AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
205 dnl hard dependancies on options
207 if test "$with_schemas" = "yes"
212 if test "$with_schematron" = "yes"
217 if test "$with_reader" = "yes"
221 if test "$with_xptr" = "yes"
226 dnl option to build a minimal libxml2 library
228 if test "$with_minimum" = "yes"
230 echo "Configuring for a minimal library"
231 if test "$with_c14n" = ""
235 if test "$with_catalog" = ""
240 if test "$with_debug" = ""
244 if test "$with_docbook" = ""
248 if test "$with_fexceptions" = ""
252 if test "$with_ftp" = ""
256 if test "$with_history" = ""
260 if test "$with_html" = ""
264 if test "$with_http" = ""
268 if test "$with_iconv" = ""
272 if test "$with_iso8859x" = ""
276 if test "$with_legacy" = ""
280 if test "$with_mem_debug" = ""
284 if test "$with_output" = ""
288 if test "$with_pattern" = ""
292 if test "$with_push" = ""
296 if test "$with_python" = ""
300 if test "$with_reader" = ""
304 if test "$with_readline" = ""
308 if test "$with_regexps" = ""
312 if test "$with_run_debug" = ""
316 if test "$with_sax1" = ""
320 if test "$with_schemas" = ""
324 if test "$with_schematron" = ""
328 if test "$with_threads" = ""
332 if test "$with_thread_alloc" = ""
336 if test "$with_tree" = ""
340 if test "$with_valid" = ""
344 if test "$with_writer" = ""
348 if test "$with_xinclude" = ""
352 if test "$with_xpath" = ""
356 if test "$with_xptr" = ""
360 if test "$with_zlib" = ""
364 if test "$with_modules" = ""
372 dnl Checks for zlib library.
375 if test "$with_zlib" = "no"; then
376 echo "Disabling compression support"
378 AC_CHECK_HEADERS(zlib.h,
379 AC_CHECK_LIB(z, gzread,[
380 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
382 if test "x${Z_DIR}" != "x"; then
383 Z_CFLAGS="-I${Z_DIR}/include"
384 Z_LIBS="-L${Z_DIR}/lib -lz"
387 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
399 CPPFLAGS=${_cppflags}
402 echo Checking headers
404 dnl Checks for header files.
407 AC_CHECK_HEADERS([fcntl.h])
408 AC_CHECK_HEADERS([unistd.h])
409 AC_CHECK_HEADERS([ctype.h])
410 AC_CHECK_HEADERS([dirent.h])
411 AC_CHECK_HEADERS([errno.h])
412 AC_CHECK_HEADERS([malloc.h])
413 AC_CHECK_HEADERS([stdarg.h])
414 AC_CHECK_HEADERS([sys/stat.h])
415 AC_CHECK_HEADERS([sys/types.h])
416 AC_CHECK_HEADERS([stdint.h])
417 AC_CHECK_HEADERS([inttypes.h.h])
418 AC_CHECK_HEADERS([time.h])
419 AC_CHECK_HEADERS([ansidecl.h])
420 AC_CHECK_HEADERS([ieeefp.h])
421 AC_CHECK_HEADERS([nan.h])
422 AC_CHECK_HEADERS([math.h])
423 AC_CHECK_HEADERS([limits.h])
424 AC_CHECK_HEADERS([fp_class.h])
425 AC_CHECK_HEADERS([float.h])
426 AC_CHECK_HEADERS([stdlib.h])
427 AC_CHECK_HEADERS([sys/socket.h], [], [],
428 [#if HAVE_SYS_TYPES_H
429 # include <sys/types.h>
432 AC_CHECK_HEADERS([netinet/in.h], [], [],
433 [#if HAVE_SYS_TYPES_H
434 # include <sys/types.h>
437 AC_CHECK_HEADERS([arpa/inet.h], [], [],
438 [#if HAVE_SYS_TYPES_H
439 # include <sys/types.h>
442 # include <arpa/inet.h>
445 AC_CHECK_HEADERS([netdb.h])
446 AC_CHECK_HEADERS([sys/time.h])
447 AC_CHECK_HEADERS([sys/select.h])
448 AC_CHECK_HEADERS([poll.h])
449 AC_CHECK_HEADERS([sys/mman.h])
450 AC_CHECK_HEADERS([sys/timeb.h])
451 AC_CHECK_HEADERS([signal.h])
452 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
453 [#if HAVE_SYS_TYPES_H
454 # include <sys/types.h>
457 AC_CHECK_HEADERS([resolv.h], [], [],
458 [#if HAVE_SYS_TYPES_H
459 # include <sys/types.h>
461 #if HAVE_NETINET_IN_H
462 # include <netinet/in.h>
464 #if HAVE_ARPA_NAMESER_H
465 # include <arpa/nameser.h>
468 AC_CHECK_HEADERS([dl.h])
469 AC_CHECK_HEADERS([dlfcn.h])
472 echo Checking libraries
474 dnl Checks for library functions.
476 AC_CHECK_FUNCS(strdup strndup strerror)
477 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
478 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
479 AC_CHECK_FUNCS(stat _stat signal)
481 dnl Checking the standard string functions availability
482 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
485 dnl Checking for va_copy availability
486 AC_MSG_CHECKING([for va_copy])
487 AC_TRY_LINK([#include <stdarg.h>
488 va_list ap1,ap2;], [va_copy(ap1,ap2);],
491 AC_MSG_RESULT($have_va_copy)
492 if test x"$have_va_copy" = x"yes"; then
493 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
495 AC_MSG_CHECKING([for __va_copy])
496 AC_TRY_LINK([#include <stdarg.h>
497 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
500 AC_MSG_RESULT($have___va_copy)
501 if test x"$have___va_copy" = x"yes"; then
502 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
506 dnl Checks for inet libraries:
507 AC_SEARCH_LIBS(gethostent, [nsl])
508 AC_SEARCH_LIBS(setsockopt, [socket net network])
509 AC_SEARCH_LIBS(connect, [inet])
511 dnl Determine what socket length (socklen_t) data type is
512 AC_MSG_CHECKING([for type of socket length (socklen_t)])
515 #include <sys/types.h>
516 #include <sys/socket.h>],[
517 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
518 AC_MSG_RESULT(socklen_t *)
519 XML_SOCKLEN_T=socklen_t],[
522 #include <sys/types.h>
523 #include <sys/socket.h>],[
524 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
525 AC_MSG_RESULT(size_t *)
526 XML_SOCKLEN_T=size_t],[
529 #include <sys/types.h>
530 #include <sys/socket.h>],[
531 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
534 AC_MSG_WARN(could not determine)
535 XML_SOCKLEN_T="int"])])])
536 AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
538 dnl ***********************Checking for availability of IPv6*******************
540 AC_MSG_CHECKING([whether to enable IPv6])
541 AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
542 if test "$with_minimum" = "yes"
546 if test $enable_ipv6 = yes; then
549 #include <sys/types.h>
550 #include <sys/socket.h>
552 struct sockaddr_storage ss;
553 socket(AF_INET6, SOCK_STREAM, 0)
558 AC_MSG_RESULT($have_ipv6)
560 if test $have_ipv6 = yes; then
561 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
562 have_broken_ss_family=no
564 dnl *********************************************************************
565 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
566 dnl a ss_family member, but rather __ss_family. Let's detect that
567 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
568 dnl platforms. However, we should only do this if ss_family is not
570 dnl ********************************************************************
571 AC_MSG_CHECKING([struct sockaddr::ss_family])
573 #include <sys/types.h>
574 #include <sys/socket.h>
576 struct sockaddr_storage ss ;
582 AC_MSG_RESULT($have_ss_family)
583 if test x$have_ss_family = xno ; then
584 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
586 #include <sys/types.h>
587 #include <sys/socket.h>
589 struct sockaddr_storage ss ;
592 have_broken_ss_family=yes,
593 have_broken_ss_family=no
595 AC_MSG_RESULT($have_broken_ss_family)
596 if test x$have_broken_ss_family = xyes ; then
597 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
598 [Whether struct sockaddr::__ss_family exists])
599 AC_DEFINE(ss_family, __ss_family,
600 [ss_family is not defined here, use __ss_family instead])
602 AC_MSG_WARN(ss_family and __ss_family not found)
607 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
608 if test $have_getaddrinfo != yes; then
609 for lib in bsd socket inet; do
610 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
614 if test $have_getaddrinfo = yes; then
615 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
620 dnl ******************************End IPv6 checks******************************
622 dnl Checks for isnan in libm if not in libc
623 AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
624 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
626 AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
627 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
629 XML_LIBDIR='-L${libdir}'
630 XML_INCLUDEDIR='-I${includedir}/libxml2'
639 dnl Workaround for native compilers
640 dnl HP : http://bugs.gnome.org/db/31/3163.html
641 dnl DEC : Enable NaN/Inf
643 if test "${GCC}" != "yes" ; then
646 CFLAGS="${CFLAGS} -Wp,-H30000"
649 CFLAGS="${CFLAGS} -ieee"
652 CFLAGS="${CFLAGS} -ieee"
656 if test "$with_fexceptions" = "yes"
659 # Not activated by default because this inflates the code size
660 # Used to allow propagation of C++ exceptions through the library
662 CFLAGS="${CFLAGS} -fexceptions"
665 CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
668 CFLAGS="${CFLAGS} -mieee"
671 CFLAGS="${CFLAGS} -mieee"
677 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
682 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
683 # If the host is Windows, and shared libraries are disabled, we
684 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
685 # work properly (without it, xmlexports.h would force the use of
686 # DLL imports, which obviously aren't present in a static
688 if test "x$enable_shared" = "xno"; then
689 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
690 CFLAGS="$CFLAGS -DLIBXML_STATIC"
702 PYTHON_SITE_PACKAGES=
705 if test "$with_python" != "no" ; then
706 if test -x "$with_python/bin/python"
708 echo Found python in $with_python/bin/python
709 PYTHON="$with_python/bin/python"
711 if test -x "$with_python/python.exe"
713 echo Found python in $with_python/python.exe
714 PYTHON="$with_python/python.exe"
716 if test -x "$with_python"
718 echo Found python in $with_python
719 PYTHON="$with_python"
723 echo Found python in environment PYTHON=$PYTHON
724 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
726 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
731 if test "$PYTHON" != ""
733 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
734 echo Found Python version $PYTHON_VERSION
736 if test "$PYTHON_VERSION" != ""
738 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
739 -d $with_python/lib/python$PYTHON_VERSION/site-packages
741 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
742 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
744 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
746 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
747 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
749 if test -r /usr/include/python$PYTHON_VERSION/Python.h
751 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
752 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
754 if test -r $with_python/include/Python.h -a \
755 -d $with_python/lib/site-packages
757 PYTHON_INCLUDES=$with_python/include
758 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
760 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
764 if test ! -d "$PYTHON_SITE_PACKAGES"
766 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
769 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
771 if test "$with_python" != ""
773 pythondir='$(PYTHON_SITE_PACKAGES)'
775 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
780 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
781 if test "$PYTHON_INCLUDES" != ""
788 AC_SUBST(PYTHON_SUBDIR)
789 AC_SUBST(PYTHON_LIBS)
791 dnl check for dso support
795 if test "$with_modules" != "no" ; then
798 MODULE_EXTENSION=".dll"
799 AC_CHECK_LIB(cygwin, dlopen, [
801 MODULE_PLATFORM_LIBS=
802 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
806 MODULE_EXTENSION=".dll"
810 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
811 AC_CHECK_LIB(dld, shl_load, [
812 MODULE_PLATFORM_LIBS="-ldld"
813 libxml_have_shl_load=yes], [
814 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
815 AC_CHECK_LIB(dl, dlopen, [
816 MODULE_PLATFORM_LIBS="-ldl"
817 libxml_have_dlopen=yes])])])])
819 if test "${libxml_have_shl_load}" = "yes"; then
820 MODULE_EXTENSION=".sl"
822 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
825 if test "${libxml_have_dlopen}" = "yes"; then
828 MODULE_EXTENSION=".sl"
831 MODULE_EXTENSION=".so"
836 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
842 if test "${WITH_MODULES}" = "1"; then
843 TEST_MODULES="ModuleTests"
846 AC_SUBST(WITH_MODULES)
847 AC_SUBST(MODULE_PLATFORM_LIBS)
848 AC_SUBST(MODULE_EXTENSION)
849 AC_SUBST(TEST_MODULES)
852 dnl Tester makes use of readline if present
856 dnl specific tests to setup DV and Bill's devel environments with debug etc ...
857 dnl (-Wunreachable-code)
859 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
860 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
861 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
863 if test "$with_minimum" != "yes"
865 if test "${with_mem_debug}" = "" ; then
866 echo Activating memory debugging
870 if test "${with_docbook}" = "" ; then
874 if test "${GCC}" = "yes" ; then
875 CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
877 STATIC_BINARIES="-static"
878 dnl -Wcast-qual -ansi
882 AC_SUBST(STATIC_BINARIES)
885 dnl Check for trio string functions
888 if test "${NEED_TRIO}" = "1" ; then
889 echo Adding trio library for string functions
894 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
898 dnl Allow to enable/disable various pieces
900 echo Checking configuration requirements
903 dnl Thread-related stuff
912 if test "$with_threads" = "no" ; then
913 echo Disabling multithreaded support
915 echo Enabling multithreaded support
916 dnl Use pthread by default
917 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
918 AC_CHECK_HEADER(pthread.h,
919 AC_CHECK_LIB(pthread, pthread_join,[
920 THREAD_LIBS="-lpthread"
921 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
922 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
926 *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
929 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
932 *cygwin*) THREAD_LIBS=""
934 *beos*) WITH_THREADS="1"
935 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
938 if test "${GCC}" = "yes" ; then
939 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
940 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
941 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
942 if test "${THREAD_LIBS}" = "-lpthread" ; then
943 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
946 BASE_THREAD_LIBS="-lpthread"
948 if expr ${GCC_MAJOR} \> 3 > /dev/null
951 BASE_THREAD_LIBS="-lpthread"
953 echo old GCC disabling weak symbols for pthread
960 if test "$WITH_THREADS" = "1" ; then
961 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
962 TEST_THREADS="Threadtests"
965 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
966 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
969 AC_SUBST(THREAD_LIBS)
970 AC_SUBST(BASE_THREAD_LIBS)
971 AC_SUBST(WITH_THREADS)
972 AC_SUBST(THREAD_CFLAGS)
973 AC_SUBST(TEST_THREADS)
974 AC_SUBST(THREADS_W32)
977 dnl xmllint shell history
979 if test "$with_history" = "yes" ; then
980 echo Enabling xmllint shell history
981 dnl check for terminal library. this is a very cool solution
982 dnl from octave's configure.in
984 for termlib in ncurses curses termcap terminfo termlib; do
985 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
986 test -n "$tcap" && break
989 AC_CHECK_HEADER(readline/history.h,
990 AC_CHECK_LIB(history, append_history,[
992 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
993 AC_CHECK_HEADER(readline/readline.h,
994 AC_CHECK_LIB(readline, readline,[
995 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
996 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
997 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
998 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
999 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
1006 if test "$with_tree" = "no" ; then
1007 echo Disabling DOM like tree manipulation APIs
1014 if test "$with_ftp" = "no" ; then
1015 echo Disabling FTP support
1025 if test "$with_http" = "no" ; then
1026 echo Disabling HTTP support
1036 if test "$with_legacy" = "no" ; then
1037 echo Disabling deprecated APIs
1042 AC_SUBST(WITH_LEGACY)
1044 if test "$with_reader" = "no" ; then
1045 echo Disabling the xmlReader parsing interface
1050 READER_TEST=Readertests
1051 if test "$with_push" = "no" ; then
1052 echo xmlReader requires Push interface - enabling it
1056 AC_SUBST(WITH_READER)
1057 AC_SUBST(READER_TEST)
1059 if test "$with_writer" = "no" ; then
1060 echo Disabling the xmlWriter saving interface
1065 # WRITER_TEST=Writertests
1066 if test "$with_push" = "no" ; then
1067 echo xmlWriter requires Push interface - enabling it
1070 if test "$with_output" = "no" ; then
1071 echo xmlWriter requires Output interface - enabling it
1075 AC_SUBST(WITH_WRITER)
1076 #AC_SUBST(WRITER_TEST)
1078 if test "$with_pattern" = "no" ; then
1079 echo Disabling the xmlPattern parsing interface
1084 TEST_PATTERN=Patterntests
1086 AC_SUBST(WITH_PATTERN)
1087 AC_SUBST(TEST_PATTERN)
1089 if test "$with_sax1" = "no" ; then
1090 echo Disabling the older SAX1 interface
1100 if test "$with_push" = "no" ; then
1101 echo Disabling the PUSH parser interfaces
1106 TEST_PUSH="XMLPushtests"
1111 if test "$with_html" = "no" ; then
1112 echo Disabling HTML support
1118 HTML_OBJ="HTMLparser.o HTMLtree.o"
1120 if test "$with_push" != "no" ; then
1121 TEST_PHTML=HTMLPushtests
1129 AC_SUBST(TEST_PHTML)
1131 if test "$with_valid" = "no" ; then
1132 echo Disabling DTD validation support
1138 TEST_VALID=Validtests
1139 TEST_VTIME=VTimingtests
1141 AC_SUBST(WITH_VALID)
1142 AC_SUBST(TEST_VALID)
1143 AC_SUBST(TEST_VTIME)
1145 if test "$with_catalog" = "no" ; then
1146 echo Disabling Catalog support
1152 CATALOG_OBJ="catalog.o"
1153 TEST_CATALOG=Catatests
1155 AC_SUBST(WITH_CATALOG)
1156 AC_SUBST(CATALOG_OBJ)
1157 AC_SUBST(TEST_CATALOG)
1159 if test "$with_docbook" = "no" ; then
1160 echo Disabling Docbook support
1165 DOCB_OBJ="DOCBparser.o"
1171 if test "$with_xptr" = "no" ; then
1172 echo Disabling XPointer support
1180 if test "$with_xpath" = "no" ; then
1181 echo XPointer requires XPath support - enabling it
1189 if test "$with_c14n" = "no" ; then
1190 echo Disabling C14N support
1198 if test "$with_xpath" = "no" ; then
1199 echo C14N requires XPath support - enabling it
1207 if test "$with_xinclude" = "no" ; then
1208 echo Disabling XInclude support
1215 XINCLUDE_OBJ=xinclude.o
1216 TEST_XINCLUDE=XIncludetests
1217 if test "$with_xpath" = "no" ; then
1218 echo XInclude requires XPath support - enabling it
1222 AC_SUBST(WITH_XINCLUDE)
1223 AC_SUBST(XINCLUDE_OBJ)
1224 AC_SUBST(TEST_XINCLUDE)
1226 if test "$with_xpath" = "no" ; then
1227 echo Disabling XPATH support
1234 TEST_XPATH=XPathtests
1236 AC_SUBST(WITH_XPATH)
1238 AC_SUBST(TEST_XPATH)
1241 dnl output functions
1243 if test "$with_output" = "no" ; then
1244 echo Disabling serialization/saving support
1249 AC_SUBST(WITH_OUTPUT)
1252 if test "$with_iconv" = "no" ; then
1253 echo Disabling ICONV support
1255 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
1256 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
1257 # Export this since our headers include iconv.h
1258 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
1259 ICONV_LIBS="-L$with_iconv/lib"
1262 AC_CHECK_HEADER(iconv.h,
1263 AC_MSG_CHECKING(for iconv)
1264 AC_TRY_LINK([#include <stdlib.h>
1265 #include <iconv.h>],[
1266 iconv_t cd = iconv_open ("","");
1267 iconv (cd, NULL, NULL, NULL, NULL);],[
1271 AC_MSG_CHECKING(for iconv in -liconv)
1273 _ldflags="${LDFLAGS}"
1275 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1276 LIBS="${LIBS} -liconv"
1278 AC_TRY_LINK([#include <stdlib.h>
1279 #include <iconv.h>],[
1280 iconv_t cd = iconv_open ("","");
1281 iconv (cd, NULL, NULL, NULL, NULL);],[
1284 ICONV_LIBS="${ICONV_LIBS} -liconv"
1286 LDFLAGS="${_ldflags}"],[
1289 LDFLAGS="${_ldflags}"])]))
1291 if test "$WITH_ICONV" = "1" ; then
1292 AC_MSG_CHECKING([for iconv declaration])
1293 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1294 AC_TRY_COMPILE([#include <stdlib.h>
1300 #if defined(__STDC__) || defined(__cplusplus)
1301 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1305 ], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1307 xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
1308 AC_MSG_RESULT([${xml_xxx:-
1309 }$xml_cv_iconv_decl])
1310 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1311 [Define as const if the declaration of iconv() needs const.])
1325 XML_LIBTOOLLIBS="libxml2.la"
1326 AC_SUBST(WITH_ICONV)
1329 if test "$with_icu" != "yes" ; then
1330 echo Disabling ICU support
1332 ICU_CONFIG=icu-config
1333 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1335 ICU_LIBS=`icu-config --ldflags`
1336 LDFLAGS="$LDFLAGS $ICU_LIBS"
1338 echo Enabling ICU support
1340 AC_MSG_ERROR([libicu config program icu-config not found])
1346 if test "$WITH_ICONV" != "1" ; then
1347 if test "$with_iso8859x" = "no" ; then
1348 echo Disabling ISO8859X support
1352 AC_SUBST(WITH_ISO8859X)
1354 if test "$with_schematron" = "no" ; then
1355 echo "Disabling Schematron support"
1359 echo "Enabled Schematron support"
1361 TEST_SCHEMATRON="Schematrontests"
1365 AC_SUBST(WITH_SCHEMATRON)
1366 AC_SUBST(TEST_SCHEMATRON)
1368 if test "$with_schemas" = "no" ; then
1369 echo "Disabling Schemas/Relax-NG support"
1373 echo "Enabled Schemas/Relax-NG support"
1375 TEST_SCHEMAS="Schemastests Relaxtests"
1376 if test "$PYTHON_INCLUDES" != "" ; then
1377 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1381 AC_SUBST(WITH_SCHEMAS)
1382 AC_SUBST(TEST_SCHEMAS)
1384 if test "$with_regexps" = "no" ; then
1385 echo Disabling Regexps support
1390 TEST_REGEXPS="Regexptests Automatatests"
1392 AC_SUBST(WITH_REGEXPS)
1393 AC_SUBST(TEST_REGEXPS)
1395 if test "$with_debug" = "no" ; then
1396 echo Disabling DEBUG support
1402 DEBUG_OBJ=debugXML.o
1403 TEST_DEBUG=Scripttests
1405 AC_SUBST(WITH_DEBUG)
1407 AC_SUBST(TEST_DEBUG)
1409 if test "$with_mem_debug" = "yes" ; then
1410 if test "$with_thread_alloc" = "yes" ; then
1411 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1414 echo Enabling memory debug support
1420 AC_SUBST(WITH_MEM_DEBUG)
1422 if test "$with_run_debug" = "yes" ; then
1423 echo Enabling runtime debug support
1428 AC_SUBST(WITH_RUN_DEBUG)
1431 WIN32_EXTRA_LDFLAGS=
1432 CYGWIN_EXTRA_LDFLAGS=
1433 CYGWIN_EXTRA_PYTHON_LIBADD=
1434 WIN32_EXTRA_PYTHON_LIBADD=
1437 CPPFLAGS="$CPPFLAGS -DWIN32"
1438 WIN32_EXTRA_LIBADD="-lws2_32"
1439 WIN32_EXTRA_LDFLAGS="-no-undefined"
1440 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1441 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1442 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1443 if test "${PYTHON}" != ""
1445 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
1449 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1450 if test "${PYTHON}" != ""
1452 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1456 AC_SUBST(WIN32_EXTRA_LIBADD)
1457 AC_SUBST(WIN32_EXTRA_LDFLAGS)
1458 AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
1459 AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1460 AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
1462 if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1464 echo Enabling code coverage for GCC
1465 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1466 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1468 echo Disabling code coverage for GCC
1474 AC_SUBST(XML_CFLAGS)
1476 AC_SUBST(XML_LIBDIR)
1478 AC_SUBST(XML_LIBTOOLLIBS)
1479 AC_SUBST(ICONV_LIBS)
1480 AC_SUBST(XML_INCLUDEDIR)
1482 AC_SUBST(HAVE_ISNAN)
1483 AC_SUBST(HAVE_ISINF)
1485 AC_SUBST(PYTHON_VERSION)
1486 AC_SUBST(PYTHON_INCLUDES)
1487 AC_SUBST(PYTHON_SITE_PACKAGES)
1492 dnl for the spec file
1493 RELDATE=`date +'%a %b %e %Y'`
1495 AC_SUBST(PYTHON_TESTS)
1497 rm -f COPYING.LIB COPYING
1498 ln -s Copyright COPYING
1500 # keep on one line for cygwin c.f. #130896
1501 AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
1503 chmod +x xml2-config python/setup.py
1504 echo Done configuring