1 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h)
9 LIBXML_MICRO_VERSION=10
10 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
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 AC_SUBST(LIBXML_MAJOR_VERSION)
16 AC_SUBST(LIBXML_MINOR_VERSION)
17 AC_SUBST(LIBXML_MICRO_VERSION)
18 AC_SUBST(LIBXML_VERSION)
19 AC_SUBST(LIBXML_VERSION_INFO)
20 AC_SUBST(LIBXML_VERSION_NUMBER)
22 VERSION=${LIBXML_VERSION}
24 AM_INIT_AUTOMAKE(libxml2, $VERSION)
27 [ --with-html-dir=PATH path to installed docs ])
29 dnl Checks for programs.
33 AC_PATH_PROG(RM, rm, /bin/rm)
34 AC_PATH_PROG(MV, mv, /bin/mv)
35 AC_PATH_PROG(TAR, tar, /bin/tar)
37 dnl Make sure we have an ANSI compiler
39 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
45 dnl Checks for zlib library.
46 _cppflags="${CPPFLAGS}"
51 [ --with-zlib[[=DIR]] use libz in DIR],[
52 if test "$withval" != "no" -a "$withval" != "yes"; then
54 CPPFLAGS="${CPPFLAGS} -I$withval/include"
55 LDFLAGS="${LDFLAGS} -L$withval/lib"
58 if test "$with_zlib" = "no"; then
59 echo "Disabling compression support"
61 AC_CHECK_HEADERS(zlib.h,
62 AC_CHECK_LIB(z, gzread,[
64 if test "x${Z_DIR}" != "x"; then
65 Z_CFLAGS="-I${Z_DIR}/include"
66 Z_LIBS="-L${Z_DIR}/lib -lz"
69 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
83 dnl Checks for header files.
86 AC_CHECK_HEADERS([fcntl.h])
87 AC_CHECK_HEADERS([unistd.h])
88 AC_CHECK_HEADERS([ctype.h])
89 AC_CHECK_HEADERS([dirent.h])
90 AC_CHECK_HEADERS([errno.h])
91 AC_CHECK_HEADERS([malloc.h])
92 AC_CHECK_HEADERS([stdarg.h])
93 AC_CHECK_HEADERS([sys/stat.h])
94 AC_CHECK_HEADERS([sys/types.h])
95 AC_CHECK_HEADERS([time.h])
96 AC_CHECK_HEADERS([ansidecl.h])
97 AC_CHECK_HEADERS([ieeefp.h])
98 AC_CHECK_HEADERS([nan.h])
99 AC_CHECK_HEADERS([math.h])
100 AC_CHECK_HEADERS([fp_class.h])
101 AC_CHECK_HEADERS([float.h])
102 AC_CHECK_HEADERS([stdlib.h])
103 AC_CHECK_HEADERS([sys/socket.h], [], [],
104 [#if HAVE_SYS_TYPES_H
105 # include <sys/types.h>
108 AC_CHECK_HEADERS([netinet/in.h], [], [],
109 [#if HAVE_SYS_TYPES_H
110 # include <sys/types.h>
113 AC_CHECK_HEADERS([arpa/inet.h], [], [],
114 [#if HAVE_SYS_TYPES_H
115 # include <sys/types.h>
118 # include <arpa/inet.h>
121 AC_CHECK_HEADERS([netdb.h])
122 AC_CHECK_HEADERS([sys/time.h])
123 AC_CHECK_HEADERS([sys/select.h])
124 AC_CHECK_HEADERS([sys/mman.h])
125 AC_CHECK_HEADERS([sys/timeb.h])
126 AC_CHECK_HEADERS([signal.h])
127 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
128 [#if HAVE_SYS_TYPES_H
129 # include <sys/types.h>
132 AC_CHECK_HEADERS([resolv.h], [], [],
133 [#if HAVE_SYS_TYPES_H
134 # include <sys/types.h>
136 #if HAVE_NETINET_IN_H
137 # include <netinet/in.h>
139 #if HAVE_ARPA_NAMESER_H
140 # include <arpa/nameser.h>
144 dnl Specific dir for HTML output ?
145 if test "x$with_html_dir" = "x" ; then
146 HTML_DIR='$(prefix)/doc'
148 HTML_DIR=$with_html_dir
153 dnl Checks for library functions.
155 AC_CHECK_FUNCS(strdup strndup strerror)
156 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
157 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
158 AC_CHECK_FUNCS(stat _stat signal)
160 dnl Checking the standard string functions availability
161 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
164 dnl Checks for inet libraries:
165 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
166 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
167 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
169 dnl Determine what socket length (socklen_t) data type is
170 AC_MSG_CHECKING([for type of socket length (socklen_t)])
173 #include <sys/types.h>
174 #include <sys/socket.h>],[
175 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
176 AC_MSG_RESULT(socklen_t *)
177 SOCKLEN_T=socklen_t],[
180 #include <sys/types.h>
181 #include <sys/socket.h>],[
182 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
183 AC_MSG_RESULT(size_t *)
187 #include <sys/types.h>
188 #include <sys/socket.h>],[
189 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
192 AC_MSG_WARN(could not determine)])])])
193 AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)
195 dnl ***********************Checking for availability of IPv6*******************
197 AC_MSG_CHECKING([whether to enable IPv6])
198 AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[yes/no] enables compilation of IPv6 code],, enable_ipv6=yes)
199 if test $enable_ipv6 = yes; then
202 #include <sys/socket.h>
203 #include <sys/types.h>], [
204 struct sockaddr_storage ss;
205 socket(AF_INET6, SOCK_STREAM, 0)
210 AC_MSG_RESULT($have_ipv6)
212 if test $have_ipv6 = yes; then
213 AC_DEFINE(SUPPORT_IP6)
216 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
217 if test $have_getaddrinfo != yes; then
218 for lib in bsd socket inet; do
219 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
223 if test $have_getaddrinfo = yes; then
224 AC_DEFINE(HAVE_GETADDRINFO)
229 dnl ******************************End IPv6 checks******************************
231 dnl Checks for isnan in libm if not in libc
232 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
233 [AC_DEFINE(HAVE_ISNAN)]))
235 AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF) , AC_CHECK_LIB(m, isinf,
236 [AC_DEFINE(HAVE_ISINF)]))
238 XML_LIBDIR='-L${libdir}'
239 XML_INCLUDEDIR='-I${includedir}/libxml2'
247 AC_ARG_WITH(fexceptions,
248 [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
250 dnl Workaround for native compilers
251 dnl HP : http://bugs.gnome.org/db/31/3163.html
252 dnl DEC : Enable NaN/Inf
254 if test "${GCC}" != "yes" ; then
257 CFLAGS="${CFLAGS} -Wp,-H30000"
260 CFLAGS="${CFLAGS} -ieee"
263 CFLAGS="${CFLAGS} -ieee"
267 if test "$with_fexceptions" = "yes"
270 # Not activated by default because this inflates the code size
271 # Used to allow propagation of C++ exceptions through the library
273 CFLAGS="${CFLAGS} -fexceptions"
276 CFLAGS="${CFLAGS} -Wall"
279 CFLAGS="${CFLAGS} -mieee"
282 CFLAGS="${CFLAGS} -mieee"
288 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
303 PYTHON_SITE_PACKAGES=
306 [ --with-python[[=DIR]] build Python bindings if found])
307 if test "$with_python" != "no" ; then
308 if test -x "$with_python/bin/python"
310 echo Found python in $with_python/bin/python
311 PYTHON="$with_python/bin/python"
313 if test -x "$with_python"
315 echo Found python in $with_python
316 PYTHON="$with_python"
318 AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
321 if test "$PYTHON" != ""
323 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
324 echo Found Python version $PYTHON_VERSION
326 if test "$PYTHON_VERSION" != ""
328 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
329 -d $with_python/lib/python$PYTHON_VERSION/site-packages
331 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
332 PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
334 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
336 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
337 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
339 if test -r /usr/include/python$PYTHON_VERSION/Python.h
341 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
342 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
344 echo could not find python$PYTHON_VERSION/Python.h
347 if ! test -d "$PYTHON_SITE_PACKAGES"
349 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
353 if test "$with_python" != ""
355 pythondir='$(PYTHON_SITE_PACKAGES)'
357 pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
360 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
361 if test "$PYTHON_INCLUDES" != ""
368 AC_SUBST(PYTHON_SUBDIR)
371 dnl Tester makes use of readline if present
373 _cppflags="${CPPFLAGS}"
374 _ldflags="${LDFLAGS}"
376 AC_ARG_WITH(readline,
377 [ --with-readline=DIR use readline in DIR],[
378 if test "$withval" != "no" -a "$withval" != "yes"; then
380 CPPFLAGS="${CPPFLAGS} -I$withval/include"
381 LDFLAGS="${LDFLAGS} -L$withval/lib"
386 dnl specific tests to setup DV's devel environment with debug etc ...
387 dnl (-Wunreachable-code)
389 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
390 if test "${with_mem_debug}" = "" ; then
393 if test "${with_docbook}" = "" ; then
396 CFLAGS="-g -O -pedantic -W -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 "
397 STATIC_BINARIES="-static"
398 dnl -Wcast-qual -ansi
402 AC_SUBST(STATIC_BINARIES)
405 dnl Check for trio string functions
408 if test "${NEED_TRIO}" = "1" ; then
409 echo Adding trio library for string functions
414 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
418 dnl Allow to enable/disable various pieces
427 [ --with-threads add multithread support(on)])
428 if test "$with_threads" = "no" ; then
429 echo Disabling multithreaded support
431 echo Enabling multithreaded support
433 AC_CHECK_HEADER(pthread.h,
434 AC_CHECK_LIB(pthread, pthread_join,[
435 THREAD_LIBS="-lpthread"
436 AC_DEFINE(HAVE_LIBPTHREAD)
437 AC_DEFINE(HAVE_PTHREAD_H)
440 if test "$WITH_THREADS" = "1" ; then
441 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
442 TEST_THREADS="Threadtests"
445 AC_ARG_WITH(thread-alloc,
446 [ --with-thread-alloc add per-thread memory(off)])
447 if test "$with_threads_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
448 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
451 AC_SUBST(THREAD_LIBS)
452 AC_SUBST(WITH_THREADS)
453 AC_SUBST(THREAD_CFLAGS)
454 AC_SUBST(TEST_THREADS)
457 [ --with-history add history support to xmllint shell(off)])
458 if test "$with_history" = "yes" ; then
459 echo Enabling xmllint shell history
460 dnl check for terminal library. this is a very cool solution
461 dnl from octave's configure.in
463 for termlib in ncurses curses termcap terminfo termlib; do
464 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
465 test -n "$tcap" && break
468 AC_CHECK_HEADER(readline/history.h,
469 AC_CHECK_LIB(history, append_history,[
471 AC_DEFINE(HAVE_LIBHISTORY)]))
472 AC_CHECK_HEADER(readline/readline.h,
473 AC_CHECK_LIB(readline, readline,[
474 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
475 AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
476 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
477 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
478 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
480 CPPFLAGS=${_cppflags}
488 [ --with-ftp add the FTP support (on)])
489 if test "$with_ftp" = "no" ; then
490 echo Disabling FTP support
501 [ --with-http add the HTTP support (on)])
502 if test "$with_http" = "no" ; then
503 echo Disabling HTTP support
514 [ --with-html add the HTML support (on)])
515 if test "$with_html" = "no" ; then
516 echo Disabling HTML support
521 HTML_OBJ="HTMLparser.o HTMLtree.o"
527 [ --with-catalog add the Catalog support (on)])
528 if test "$with_catalog" = "no" ; then
529 echo Disabling Catalog support
534 CATALOG_OBJ="catalog.o"
536 AC_SUBST(WITH_CATALOG)
537 AC_SUBST(CATALOG_OBJ)
540 [ --with-docbook add Docbook SGML support (on)])
541 if test "$with_docbook" = "no" ; then
542 echo Disabling Docbook support
547 DOCB_OBJ="DOCBparser.o"
554 [ --with-xpath add the XPATH support (on)])
555 if test "$with_xpath" = "no" ; then
556 echo Disabling XPATH support
570 [ --with-xptr add the XPointer support (on)])
571 if test "$with_xptr" = "no" ; then
572 echo Disabling XPointer support
583 [ --with-c14n add the Canonicalization support (on)])
584 if test "$with_c14n" = "no" ; then
585 echo Disabling C14N support
595 AC_ARG_WITH(xinclude,
596 [ --with-xinclude add the XInclude support (on)])
597 if test "$with_xinclude" = "no" ; then
598 echo Disabling XInclude support
604 XINCLUDE_OBJ=xinclude.o
606 AC_SUBST(WITH_XINCLUDE)
607 AC_SUBST(XINCLUDE_OBJ)
611 [ --with-iconv[[=DIR]] add ICONV support (on)])
612 if test "$with_iconv" = "no" ; then
613 echo Disabling ICONV support
615 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
616 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
617 # Export this since our headers include iconv.h
618 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
619 ICONV_LIBS="-L$with_iconv/lib"
622 AC_CHECK_HEADER(iconv.h,
623 AC_MSG_CHECKING(for iconv)
624 AC_TRY_LINK([#include <stdlib.h>
625 #include <iconv.h>],[
626 iconv_t cd = iconv_open ("","");
627 iconv (cd, NULL, NULL, NULL, NULL);],[
631 AC_MSG_CHECKING(for iconv in -liconv)
633 _ldflags="${LDFLAGS}"
635 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
636 LIBS="${LIBS} -liconv"
638 AC_TRY_LINK([#include <stdlib.h>
639 #include <iconv.h>],[
640 iconv_t cd = iconv_open ("","");
641 iconv (cd, NULL, NULL, NULL, NULL);],[
644 ICONV_LIBS="${ICONV_LIBS} -liconv"
646 LDFLAGS="${_ldflags}"],[
649 LDFLAGS="${_ldflags}"])]))
652 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
656 AC_ARG_WITH(iso8859x,
657 [ --with-iso8859x add ISO8859X support if no iconv (on)])
658 if test "$WITH_ICONV" != "1" ; then
659 if test "$with_iso8859x" = "no" ; then
660 echo Disabling ISO8859X support
664 AC_SUBST(WITH_ISO8859X)
667 [ --with-schemas add experimental Schemas/RelaxNG support (on)])
668 if test "$with_schemas" = "no" ; then
669 echo "Disabled Schemas/Relax-NG support"
673 echo "Enabled Schemas/Relax-NG support"
675 TEST_SCHEMAS="Schemastests Relaxtests"
678 AC_SUBST(WITH_SCHEMAS)
679 AC_SUBST(TEST_SCHEMAS)
682 [ --with-regexps add Regular Expressions support (on)])
683 if test "$with_regexps" = "no" ; then
684 echo Disabling Regexps support
689 TEST_REGEXPS="Regexptests Automatatests"
691 AC_SUBST(WITH_REGEXPS)
692 AC_SUBST(TEST_REGEXPS)
695 [ --with-debug add the debugging module (on)])
696 if test "$with_debug" = "no" ; then
697 echo Disabling DEBUG support
707 AC_ARG_WITH(mem_debug,
708 [ --with-mem-debug add the memory debugging module (off)])
709 if test "$with_mem_debug" = "yes" ; then
710 echo Enabling memory debug support
715 AC_SUBST(WITH_MEM_DEBUG)
722 WIN32_EXTRA_LIBADD="-lwsock32"
723 WIN32_EXTRA_LDFLAGS="-no-undefined"
724 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
725 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
726 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
729 AC_SUBST(WIN32_EXTRA_LIBADD)
730 AC_SUBST(WIN32_EXTRA_LDFLAGS)
739 AC_SUBST(XML_INCLUDEDIR)
744 AC_SUBST(PYTHON_VERSION)
745 AC_SUBST(PYTHON_INCLUDES)
746 AC_SUBST(PYTHON_SITE_PACKAGES)
751 dnl for the spec file
752 RELDATE=`date +'%a %b %e %Y'`
755 rm -f COPYING.LIB COPYING
756 ln -s Copyright COPYING
758 AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile example/Makefile python/Makefile python/tests/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc xml2Conf.sh python/setup.py)
760 chmod +x xml2-config xml2Conf.sh python/setup.py