1 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h)
9 LIBXML_MICRO_VERSION=28
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)
26 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
28 dnl Checks for programs.
32 AC_PATH_PROG(RM, rm, /bin/rm)
33 AC_PATH_PROG(MV, mv, /bin/mv)
34 AC_PATH_PROG(TAR, tar, /bin/tar)
36 dnl Make sure we have an ANSI compiler
38 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
44 dnl Checks for zlib library.
45 _cppflags="${CPPFLAGS}"
50 [ --with-zlib[=DIR] use libz in DIR],[
51 if test "$withval" != "no" -a "$withval" != "yes"; then
53 CPPFLAGS="${CPPFLAGS} -I$withval/include"
54 LDFLAGS="${LDFLAGS} -L$withval/lib"
57 if test "$with_zlib" = "no"; then
58 echo "Disabling compression support"
60 AC_CHECK_HEADERS(zlib.h,
61 AC_CHECK_LIB(z, gzread,[
63 if test "x${Z_DIR}" != "x"; then
64 Z_CFLAGS="-I${Z_DIR}/include"
65 Z_LIBS="-L${Z_DIR}/lib -lz"
68 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
82 dnl Checks for header files.
85 AC_CHECK_HEADERS([fcntl.h])
86 AC_CHECK_HEADERS([unistd.h])
87 AC_CHECK_HEADERS([ctype.h])
88 AC_CHECK_HEADERS([dirent.h])
89 AC_CHECK_HEADERS([errno.h])
90 AC_CHECK_HEADERS([malloc.h])
91 AC_CHECK_HEADERS([stdarg.h])
92 AC_CHECK_HEADERS([sys/stat.h])
93 AC_CHECK_HEADERS([sys/types.h])
94 AC_CHECK_HEADERS([time.h])
95 AC_CHECK_HEADERS([ansidecl.h])
96 AC_CHECK_HEADERS([ieeefp.h])
97 AC_CHECK_HEADERS([nan.h])
98 AC_CHECK_HEADERS([math.h])
99 AC_CHECK_HEADERS([fp_class.h])
100 AC_CHECK_HEADERS([float.h])
101 AC_CHECK_HEADERS([stdlib.h])
102 AC_CHECK_HEADERS([sys/socket.h], [], [],
103 [#if HAVE_SYS_TYPES_H
104 # include <sys/types.h>
107 AC_CHECK_HEADERS([netinet/in.h], [], [],
108 [#if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
112 AC_CHECK_HEADERS([arpa/inet.h], [], [],
113 [#if HAVE_SYS_TYPES_H
114 # include <sys/types.h>
117 # include <arpa/inet.h>
120 AC_CHECK_HEADERS([netdb.h])
121 AC_CHECK_HEADERS([sys/time.h])
122 AC_CHECK_HEADERS([sys/select.h])
123 AC_CHECK_HEADERS([sys/mman.h])
124 AC_CHECK_HEADERS([sys/timeb.h])
125 AC_CHECK_HEADERS([signal.h])
126 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
127 [#if HAVE_SYS_TYPES_H
128 # include <sys/types.h>
131 AC_CHECK_HEADERS([resolv.h], [], [],
132 [#if HAVE_SYS_TYPES_H
133 # include <sys/types.h>
135 #if HAVE_NETINET_IN_H
136 # include <netinet/in.h>
138 #if HAVE_ARPA_NAMESER_H
139 # include <arpa/nameser.h>
143 dnl Specific dir for HTML output ?
144 if test "x$with_html_dir" = "x" ; then
145 HTML_DIR='$(prefix)/doc'
147 HTML_DIR=$with_html_dir
152 dnl Checks for library functions.
154 AC_CHECK_FUNCS(strdup strndup strerror)
155 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
156 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
157 AC_CHECK_FUNCS(stat _stat signal)
159 dnl Checking the standard string functions availability
160 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
163 dnl Checks for inet libraries:
164 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
165 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
166 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
168 dnl Determine what socket length (socklen_t) data type is
169 AC_MSG_CHECKING([for type of socket length (socklen_t)])
172 #include <sys/types.h>
173 #include <sys/socket.h>],[
174 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
175 AC_MSG_RESULT(socklen_t *)
176 SOCKLEN_T=socklen_t],[
179 #include <sys/types.h>
180 #include <sys/socket.h>],[
181 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
182 AC_MSG_RESULT(size_t *)
186 #include <sys/types.h>
187 #include <sys/socket.h>],[
188 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
191 AC_MSG_WARN(could not determine)])])])
192 AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)
194 dnl Checks for isnan in libm if not in libc
195 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
196 [AC_DEFINE(HAVE_ISNAN)]))
198 AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF) , AC_CHECK_LIB(m, isinf,
199 [AC_DEFINE(HAVE_ISINF)]))
201 XML_LIBDIR='-L${libdir}'
202 XML_INCLUDEDIR='-I${includedir}/libxml2'
211 dnl Workaround for native compilers
212 dnl HP : http://bugs.gnome.org/db/31/3163.html
213 dnl DEC : Enable NaN/Inf
215 if test "${GCC}" != "yes" ; then
218 CFLAGS="${CFLAGS} -Wp,-H30000"
221 CFLAGS="${CFLAGS} -ieee"
225 CFLAGS="${CFLAGS} -Wall"
228 CFLAGS="${CFLAGS} -mieee"
231 CFLAGS="${CFLAGS} -mieee"
237 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
252 PYTHON_SITE_PACKAGES=
253 AC_ARG_WITH(python, [ --with-python[=DIR] Build Python bindings if found])
254 if test "$with_python" != "no" ; then
255 if test -x "$with_python/bin/python"
257 echo Found python in $with_python/bin/python
258 PYTHON="$with_python/bin/python"
260 if test -x "$with_python"
262 echo Found python in $with_python
263 PYTHON="$with_python"
265 AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
268 if test "$PYTHON" != ""
270 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
271 echo Found Python version $PYTHON_VERSION
273 if test "$PYTHON_VERSION" != ""
275 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
276 -d $with_python/lib/python$PYTHON_VERSION/site-packages
278 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
279 PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
281 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
283 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
284 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
286 if test -r /usr/include/python$PYTHON_VERSION/Python.h
288 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
289 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
291 echo could not find python$PYTHON_VERSION/Python.h
294 if ! test -d "$PYTHON_SITE_PACKAGES"
296 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
301 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
302 if test "$PYTHON_INCLUDES" != ""
308 AC_SUBST(PYTHON_SUBDIR)
311 dnl Tester makes use of readline if present
313 _cppflags="${CPPFLAGS}"
314 _ldflags="${LDFLAGS}"
316 AC_ARG_WITH(readline,
317 [ --with-readline=DIR use readline in DIR],[
318 if test "$withval" != "no" -a "$withval" != "yes"; then
320 CPPFLAGS="${CPPFLAGS} -I$withval/include"
321 LDFLAGS="${LDFLAGS} -L$withval/lib"
326 dnl specific tests to setup DV's devel environment with debug etc ...
327 dnl (-Wunreachable-code)
329 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
330 if test "${with_mem_debug}" = "" ; then
333 if test "${with_docbook}" = "" ; then
336 if test "${with_xptr}" = "" ; then
339 if test "${with_schemas}" = "" ; then
342 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 "
343 dnl -Wcast-qual -ansi
347 dnl Check for trio string functions
350 if test "${NEED_TRIO}" = "1" ; then
351 echo Adding trio library for string functions
356 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
360 dnl Aloow to enable/disable various pieces
368 AC_ARG_WITH(threads, [ --with-threads Add multithread support(off)])
369 if test "$with_threads" = "yes" ; then
370 echo Enabling multithreaded support
372 AC_CHECK_HEADER(pthread.h,
373 AC_CHECK_LIB(pthread, pthread_join,[
374 THREAD_LIBS="-lpthread"
375 AC_DEFINE(HAVE_LIBPTHREAD)
376 AC_DEFINE(HAVE_PTHREAD_H)
379 if test "$WITH_THREADS" = "1" ; then
380 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
381 TEST_THREADS="Threadtests"
384 AC_ARG_WITH(thread-alloc, [ --with-thread-alloc Add per-thread memory(off)])
385 if test "$with_threads_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
386 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
389 AC_SUBST(THREAD_LIBS)
390 AC_SUBST(WITH_THREADS)
391 AC_SUBST(THREAD_CFLAGS)
392 AC_SUBST(TEST_THREADS)
394 AC_ARG_WITH(history, [ --with-history Add history support to xmllint shell(off)])
395 if test "$with_history" = "yes" ; then
396 echo Enabling xmllint shell history
397 dnl check for terminal library. this is a very cool solution
398 dnl from octave's configure.in
400 for termlib in ncurses curses termcap terminfo termlib; do
401 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
402 test -n "$tcap" && break
405 AC_CHECK_HEADER(readline/history.h,
406 AC_CHECK_LIB(history, append_history,[
408 AC_DEFINE(HAVE_LIBHISTORY)]))
409 AC_CHECK_HEADER(readline/readline.h,
410 AC_CHECK_LIB(readline, readline,[
411 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
412 AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
413 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
414 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
415 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
417 CPPFLAGS=${_cppflags}
424 AC_ARG_WITH(ftp, [ --with-ftp Add the FTP support (on)])
425 if test "$with_ftp" = "no" ; then
426 echo Disabling FTP support
436 AC_ARG_WITH(http, [ --with-http Add the HTTP support (on)])
437 if test "$with_http" = "no" ; then
438 echo Disabling HTTP support
448 AC_ARG_WITH(html, [ --with-html Add the HTML support (on)])
449 if test "$with_html" = "no" ; then
450 echo Disabling HTML support
455 HTML_OBJ="HTMLparser.o HTMLtree.o"
460 AC_ARG_WITH(catalog, [ --with-catalog Add the Catalog support (on)])
461 if test "$with_catalog" = "no" ; then
462 echo Disabling Catalog support
467 CATALOG_OBJ="catalog.o"
469 AC_SUBST(WITH_CATALOG)
470 AC_SUBST(CATALOG_OBJ)
472 AC_ARG_WITH(docbook, [ --with-docbook Add Docbook SGML support (on)])
473 if test "$with_docbook" = "no" ; then
474 echo Disabling Docbook support
479 DOCB_OBJ="DOCBparser.o"
485 AC_ARG_WITH(xpath, [ --with-xpath Add the XPATH support (on)])
486 if test "$with_xpath" = "no" ; then
487 echo Disabling XPATH support
500 AC_ARG_WITH(xptr, [ --with-xptr Add the XPointer support (on)])
501 if test "$with_xptr" = "no" ; then
502 echo Disabling XPointer support
512 AC_ARG_WITH(c14n, [ --with-c14n Add the Canonicalization support (on)])
513 if test "$with_c14n" = "no" ; then
514 echo Disabling C14N support
524 AC_ARG_WITH(xinclude, [ --with-xinclude Add the XInclude support (on)])
525 if test "$with_xinclude" = "no" ; then
526 echo Disabling XInclude support
532 XINCLUDE_OBJ=xinclude.o
534 AC_SUBST(WITH_XINCLUDE)
535 AC_SUBST(XINCLUDE_OBJ)
538 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] Add ICONV support (on)])
539 if test "$with_iconv" = "no" ; then
540 echo Disabling ICONV support
542 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
543 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
544 # Export this since our headers include iconv.h
545 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
546 ICONV_LIBS="-L$with_iconv/lib"
549 AC_CHECK_HEADER(iconv.h,
550 AC_MSG_CHECKING(for iconv)
551 AC_TRY_LINK([#include <stdlib.h>
552 #include <iconv.h>],[
553 iconv_t cd = iconv_open ("","");
554 iconv (cd, NULL, NULL, NULL, NULL);],[
558 AC_MSG_CHECKING(for iconv in -liconv)
560 _ldflags="${LDFLAGS}"
562 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
563 LIBS="${LIBS} -liconv"
565 AC_TRY_LINK([#include <stdlib.h>
566 #include <iconv.h>],[
567 iconv_t cd = iconv_open ("","");
568 iconv (cd, NULL, NULL, NULL, NULL);],[
571 ICONV_LIBS="${ICONV_LIBS} -liconv"
573 LDFLAGS="${_ldflags}"],[
576 LDFLAGS="${_ldflags}"])]))
579 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
582 AC_ARG_WITH(schemas, [ --with-schemas Add experimental Schemas support (off)])
583 if test "$with_schemas" = "yes" ; then
584 echo Enabling Schemas support
586 TEST_SCHEMAS="Schemastests"
592 AC_SUBST(WITH_SCHEMAS)
593 AC_SUBST(TEST_SCHEMAS)
595 AC_ARG_WITH(regexps, [ --with-regexps Add Regular Expressions support (on)])
596 if test "$with_regexps" = "no" ; then
597 echo Disabling Regexps support
602 TEST_REGEXPS="Regexptests Automatatests"
604 AC_SUBST(WITH_REGEXPS)
605 AC_SUBST(TEST_REGEXPS)
607 AC_ARG_WITH(debug, [ --with-debug Add the debugging module (on)])
608 if test "$with_debug" = "no" ; then
609 echo Disabling DEBUG support
619 AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
620 if test "$with_mem_debug" = "yes" ; then
621 echo Enabling memory debug support
626 AC_SUBST(WITH_MEM_DEBUG)
634 AC_SUBST(XML_INCLUDEDIR)
639 AC_SUBST(PYTHON_VERSION)
640 AC_SUBST(PYTHON_INCLUDES)
641 AC_SUBST(PYTHON_SITE_PACKAGES)
646 rm -f rm COPYING.LIB COPYING
647 ln -s Copyright COPYING
649 AC_OUTPUT(libxml.spec 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)
651 chmod +x xml2-config xml2Conf.sh python/setup.py