1dnl Process this file with autoconf to produce a configure script. 2AC_PREREQ([2.63]) 3 4m4_define([MAJOR_VERSION], 2) 5m4_define([MINOR_VERSION], 9) 6m4_define([MICRO_VERSION], 13) 7 8AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION]) 9AC_CONFIG_SRCDIR([entities.c]) 10AC_CONFIG_HEADERS([config.h]) 11AM_MAINTAINER_MODE([enable]) 12AC_CONFIG_MACRO_DIR([m4]) 13AC_CANONICAL_HOST 14 15LIBXML_MAJOR_VERSION=MAJOR_VERSION 16LIBXML_MINOR_VERSION=MINOR_VERSION 17LIBXML_MICRO_VERSION=MICRO_VERSION 18LIBXML_MICRO_VERSION_SUFFIX= 19LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX 20LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION 21 22LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION` 23 24if test -d .git ; then 25 extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'` 26 echo extra=$extra 27 if test "$extra" != "" 28 then 29 LIBXML_VERSION_EXTRA="-GIT$extra" 30 fi 31fi 32 33AC_SUBST(LIBXML_MAJOR_VERSION) 34AC_SUBST(LIBXML_MINOR_VERSION) 35AC_SUBST(LIBXML_MICRO_VERSION) 36AC_SUBST(LIBXML_VERSION) 37AC_SUBST(LIBXML_VERSION_INFO) 38AC_SUBST(LIBXML_VERSION_NUMBER) 39AC_SUBST(LIBXML_VERSION_EXTRA) 40 41VERSION=${LIBXML_VERSION} 42 43AM_INIT_AUTOMAKE([foreign]) 44 45# Support silent build rules, requires at least automake-1.11. Disable 46# by either passing --disable-silent-rules to configure or passing V=1 47# to make 48m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 49 50dnl Checks for programs. 51AC_PROG_CC 52AC_PROG_INSTALL 53AC_PROG_LN_S 54AC_PROG_MKDIR_P 55AC_PROG_CPP 56AC_PATH_PROG(MV, mv, /bin/mv) 57AC_PATH_PROG(TAR, tar, /bin/tar) 58AC_PATH_PROG(PERL, perl, /usr/bin/perl) 59AC_PATH_PROG(WGET, wget, /usr/bin/wget) 60AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint) 61AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc) 62PKG_PROG_PKG_CONFIG 63 64LT_INIT 65 66dnl 67dnl if the system support linker version scripts for symbol versioning 68dnl then add it 69dnl 70VERSION_SCRIPT_FLAGS= 71# lt_cv_prog_gnu_ld is from libtool 2.+ 72if test "$lt_cv_prog_gnu_ld" = yes; then 73 VERSION_SCRIPT_FLAGS=-Wl,--version-script= 74else 75 case $host in 76 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";; 77 esac 78fi 79AC_SUBST(VERSION_SCRIPT_FLAGS) 80AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"]) 81 82dnl 83dnl We process the AC_ARG_WITH first so that later we can modify 84dnl some of them to try to prevent impossible combinations. This 85dnl also allows up so alphabetize the choices 86dnl 87 88dnl 89dnl zlib option might change flags, so we save them initially 90dnl 91_cppflags="${CPPFLAGS}" 92_libs="${LIBS}" 93 94AC_ARG_WITH(c14n, 95[ --with-c14n add the Canonicalization support (on)]) 96AC_ARG_WITH(catalog, 97[ --with-catalog add the Catalog support (on)]) 98AC_ARG_WITH(debug, 99[ --with-debug add the debugging module (on)]) 100AC_ARG_WITH(docbook, 101[ --with-docbook add Docbook SGML support (off)]) 102AC_ARG_WITH(fexceptions, 103[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)]) 104AC_ARG_WITH(ftp, 105[ --with-ftp add the FTP support (off)]) 106AC_ARG_WITH(history, 107[ --with-history add history support to xmllint shell(off)]) 108AC_ARG_WITH(html, 109[ --with-html add the HTML support (on)]) 110dnl Specific dir for HTML output ? 111AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path], 112 [path to base html directory, default $docdir/html]), 113 [HTML_DIR=$withval], [HTML_DIR='$(docdir)/html']) 114 115AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path], 116 [directory used under html-dir, default '']), 117 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"]) 118AC_SUBST(HTML_DIR) 119AC_ARG_WITH(http, 120[ --with-http add the HTTP support (on)]) 121AC_ARG_WITH(iconv, 122[ --with-iconv[[=DIR]] add ICONV support (on)]) 123AC_ARG_WITH(icu, 124[ --with-icu add ICU support (off)]) 125AC_ARG_WITH(iso8859x, 126[ --with-iso8859x add ISO8859X support if no iconv (on)]) 127AC_ARG_WITH(legacy, 128[ --with-legacy add deprecated APIs for compatibility (off)]) 129AC_ARG_WITH(mem_debug, 130[ --with-mem-debug add the memory debugging module (off)]) 131AC_ARG_WITH(minimum, 132[ --with-minimum build a minimally sized library (off)]) 133AC_ARG_WITH(output, 134[ --with-output add the serialization support (on)]) 135AC_ARG_WITH(pattern, 136[ --with-pattern add the xmlPattern selection interface (on)]) 137AC_ARG_WITH(push, 138[ --with-push add the PUSH parser interfaces (on)]) 139AC_ARG_WITH(python, 140[ --with-python[[=DIR]] build Python bindings if found]) 141AC_ARG_WITH(python_install_dir, 142[ --with-python-install-dir=DIR 143 install Python bindings in DIR]) 144AC_ARG_WITH(reader, 145[ --with-reader add the xmlReader parsing interface (on)]) 146AC_ARG_WITH(readline, 147[ --with-readline=DIR use readline in DIR],[ 148 if test "$withval" != "no" -a "$withval" != "yes"; then 149 RDL_DIR=$withval 150 CPPFLAGS="${CPPFLAGS} -I$withval/include" 151 LDFLAGS="${LDFLAGS} -L$withval/lib" 152 fi 153]) 154AC_ARG_WITH(regexps, 155[ --with-regexps add Regular Expressions support (on)]) 156AC_ARG_WITH(run_debug, 157[ --with-run-debug add the runtime debugging module (off)]) 158AC_ARG_WITH(sax1, 159[ --with-sax1 add the older SAX1 interface (on)]) 160AC_ARG_WITH(schemas, 161[ --with-schemas add Relax-NG and Schemas support (on)]) 162AC_ARG_WITH(schematron, 163[ --with-schematron add Schematron support (on)]) 164AC_ARG_WITH(threads, 165[ --with-threads add multithread support(on)]) 166AC_ARG_WITH(thread-alloc, 167[ --with-thread-alloc add per-thread memory(off)]) 168AC_ARG_WITH(tree, 169[ --with-tree add the DOM like tree manipulation APIs (on)]) 170AC_ARG_WITH(valid, 171[ --with-valid add the DTD validation support (on)]) 172AC_ARG_WITH(writer, 173[ --with-writer add the xmlWriter saving interface (on)]) 174AC_ARG_WITH(xinclude, 175[ --with-xinclude add the XInclude support (on)]) 176AC_ARG_WITH(xpath, 177[ --with-xpath add the XPATH support (on)]) 178AC_ARG_WITH(xptr, 179[ --with-xptr add the XPointer support (on)]) 180AC_ARG_WITH(modules, 181[ --with-modules add the dynamic modules support (on)]) 182AC_ARG_WITH(zlib, 183[ --with-zlib[[=DIR]] use libz in DIR],[ 184 if test "$withval" != "no" -a "$withval" != "yes"; then 185 Z_DIR=$withval 186 CPPFLAGS="${CPPFLAGS} -I$withval/include" 187 LDFLAGS="${LDFLAGS} -L$withval/lib" 188 fi 189]) 190AC_ARG_WITH(lzma, 191[ --with-lzma[[=DIR]] use liblzma in DIR],[ 192 if test "$withval" != "no" -a "$withval" != "yes"; then 193 LZMA_DIR=$withval 194 CPPFLAGS="${CPPFLAGS} -I$withval/include" 195 LDFLAGS="${LDFLAGS} -L$withval/lib" 196 fi 197]) 198AC_ARG_WITH(coverage, 199[ --with-coverage build for code coverage with GCC (off)]) 200 201AC_ARG_ENABLE(rebuild-docs, 202[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=no]]]) 203if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then 204 AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir]) 205fi 206AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes"]) 207 208dnl 209dnl hard dependencies on options 210dnl 211if test "$with_schemas" = "yes" 212then 213 with_pattern=yes 214 with_regexps=yes 215fi 216if test "$with_schematron" = "yes" 217then 218 with_pattern=yes 219 with_tree=yes 220 with_xpath=yes 221fi 222if test "$with_reader" = "yes" 223then 224 with_push=yes 225fi 226if test "$with_xptr" = "yes" 227then 228 with_xpath=yes 229fi 230dnl 231dnl option to build a minimal libxml2 library 232dnl 233if test "$with_minimum" = "yes" 234then 235 echo "Configuring for a minimal library" 236 if test "$with_c14n" = "" 237 then 238 with_c14n=no 239 fi 240 if test "$with_catalog" = "" 241 then 242 with_catalog=no 243 fi 244 echo So far so good! 245 if test "$with_debug" = "" 246 then 247 with_debug=no 248 fi 249 if test "$with_fexceptions" = "" 250 then 251 with_fexceptions=no 252 fi 253 if test "$with_history" = "" 254 then 255 with_history=no 256 fi 257 if test "$with_html" = "" 258 then 259 with_html=no 260 fi 261 if test "$with_http" = "" 262 then 263 with_http=no 264 fi 265 if test "$with_iconv" = "" 266 then 267 with_iconv=no 268 fi 269 if test "$with_iso8859x" = "" 270 then 271 with_iso8859x=no 272 fi 273 if test "$with_mem_debug" = "" 274 then 275 with_mem_debug=no 276 fi 277 if test "$with_output" = "" 278 then 279 with_output=no 280 fi 281 if test "$with_pattern" = "" 282 then 283 with_pattern=no 284 fi 285 if test "$with_push" = "" 286 then 287 with_push=no 288 fi 289 if test "$with_python" = "" 290 then 291 with_python=no 292 fi 293 if test "$with_reader" = "" 294 then 295 with_reader=no 296 fi 297 if test "$with_readline" = "" 298 then 299 with_readline=no 300 fi 301 if test "$with_regexps" = "" 302 then 303 with_regexps=no 304 fi 305 if test "$with_run_debug" = "" 306 then 307 with_run_debug=no 308 fi 309 if test "$with_sax1" = "" 310 then 311 with_sax1=no 312 fi 313 if test "$with_schemas" = "" 314 then 315 with_schemas=no 316 fi 317 if test "$with_schematron" = "" 318 then 319 with_schematron=no 320 fi 321 if test "$with_threads" = "" 322 then 323 with_threads=no 324 fi 325 if test "$with_thread_alloc" = "" 326 then 327 with_thread_alloc=no 328 fi 329 if test "$with_tree" = "" 330 then 331 with_tree=no 332 fi 333 if test "$with_valid" = "" 334 then 335 with_valid=no 336 fi 337 if test "$with_writer" = "" 338 then 339 with_writer=no 340 fi 341 if test "$with_xinclude" = "" 342 then 343 with_xinclude=no 344 fi 345 if test "$with_xpath" = "" 346 then 347 with_xpath=no 348 fi 349 if test "$with_xptr" = "" 350 then 351 with_xptr=no 352 fi 353 if test "$with_zlib" = "" 354 then 355 with_zlib=no 356 fi 357 if test "$with_modules" = "" 358 then 359 with_modules=no 360 fi 361fi 362 363echo Checking zlib 364 365dnl Checks for zlib library. 366 367WITH_ZLIB=0 368if test "$with_zlib" = "no"; then 369 echo "Disabling zlib compression support" 370else 371 # Don't run pkg-config if with_zlib contains a path. 372 if test "x$Z_DIR" = "x"; then 373 # Try pkg-config first so that static linking works. 374 PKG_CHECK_MODULES([Z],[zlib], 375 [WITH_ZLIB=1], 376 [:]) 377 fi 378 379 if test "$WITH_ZLIB" = "0"; then 380 AC_CHECK_HEADERS(zlib.h, 381 AC_CHECK_LIB(z, gzread,[ 382 WITH_ZLIB=1 383 if test "x${Z_DIR}" != "x"; then 384 Z_CFLAGS="-I${Z_DIR}/include" 385 Z_LIBS="-L${Z_DIR}/lib -lz" 386 [case ${host} in 387 *-*-solaris*) 388 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" 389 ;; 390 esac] 391 else 392 Z_LIBS="-lz" 393 fi]) 394 ) 395 fi 396fi 397 398AC_SUBST(Z_CFLAGS) 399AC_SUBST(Z_LIBS) 400AC_SUBST(WITH_ZLIB) 401 402echo Checking lzma 403 404dnl Checks for lzma library. 405 406WITH_LZMA=0 407if test "$with_lzma" = "no"; then 408 echo "Disabling lzma compression support" 409else 410 # Don't run pkg-config if with_lzma contains a path. 411 if test "x$LZMA_DIR" = "x"; then 412 # Try pkg-config first so that static linking works. 413 PKG_CHECK_MODULES([LZMA],[liblzma], 414 [WITH_LZMA=1], 415 [:]) 416 fi 417 418 # If pkg-config failed, fall back to AC_CHECK_LIB. This 419 # will not pick up the necessary LIBS flags for liblzma's 420 # private dependencies, though, so static linking may fail. 421 if test "$WITH_LZMA" = "0"; then 422 AC_CHECK_HEADERS(lzma.h, 423 AC_CHECK_LIB(lzma, lzma_code,[ 424 WITH_LZMA=1 425 if test "x${LZMA_DIR}" != "x"; then 426 LZMA_CFLAGS="-I${LZMA_DIR}/include" 427 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma" 428 else 429 LZMA_LIBS="-llzma" 430 fi]) 431 ) 432 fi 433fi 434 435AC_SUBST(LZMA_CFLAGS) 436AC_SUBST(LZMA_LIBS) 437AC_SUBST(WITH_LZMA) 438 439CPPFLAGS=${_cppflags} 440LIBS=${_libs} 441 442echo Checking headers 443 444dnl Checks for header files. 445AC_HEADER_DIRENT 446AC_HEADER_STDC 447AC_CHECK_HEADERS([fcntl.h]) 448AC_CHECK_HEADERS([unistd.h]) 449AC_CHECK_HEADERS([ctype.h]) 450AC_CHECK_HEADERS([errno.h]) 451AC_CHECK_HEADERS([malloc.h]) 452AC_CHECK_HEADERS([stdarg.h]) 453AC_CHECK_HEADERS([sys/stat.h]) 454AC_CHECK_HEADERS([sys/types.h]) 455AC_CHECK_HEADERS([stdint.h]) 456AC_CHECK_HEADERS([inttypes.h]) 457AC_CHECK_HEADERS([time.h]) 458AC_CHECK_HEADERS([math.h]) 459AC_CHECK_HEADERS([limits.h]) 460AC_CHECK_HEADERS([float.h]) 461AC_CHECK_HEADERS([stdlib.h]) 462AC_CHECK_HEADERS([sys/socket.h], [], [], 463[#if HAVE_SYS_TYPES_H 464# include <sys/types.h> 465# endif 466]) 467AC_CHECK_HEADERS([netinet/in.h], [], [], 468[#if HAVE_SYS_TYPES_H 469# include <sys/types.h> 470# endif 471]) 472AC_CHECK_HEADERS([arpa/inet.h], [], [], 473[#if HAVE_SYS_TYPES_H 474# include <sys/types.h> 475# endif 476#if HAVE_ARPA_INET_H 477# include <arpa/inet.h> 478# endif 479]) 480AC_CHECK_HEADERS([netdb.h]) 481AC_CHECK_HEADERS([sys/time.h]) 482AC_CHECK_HEADERS([sys/select.h]) 483AC_CHECK_HEADERS([poll.h]) 484AC_CHECK_HEADERS([sys/mman.h]) 485AC_CHECK_HEADERS([sys/timeb.h]) 486AC_CHECK_HEADERS([signal.h]) 487AC_CHECK_HEADERS([arpa/nameser.h], [], [], 488[#if HAVE_SYS_TYPES_H 489# include <sys/types.h> 490# endif 491]) 492AC_CHECK_HEADERS([resolv.h], [], [], 493[#if HAVE_SYS_TYPES_H 494# include <sys/types.h> 495# endif 496#if HAVE_NETINET_IN_H 497# include <netinet/in.h> 498# endif 499#if HAVE_ARPA_NAMESER_H 500# include <arpa/nameser.h> 501# endif 502]) 503AC_CHECK_HEADERS([dl.h]) 504AC_CHECK_HEADERS([dlfcn.h]) 505 506 507echo Checking types 508 509AC_TYPE_UINT32_T 510 511 512echo Checking libraries 513 514dnl Checks for library functions. 515AC_FUNC_STRFTIME 516AC_CHECK_FUNCS(strftime localtime gettimeofday ftime) 517AC_CHECK_FUNCS(stat signal) 518AC_CHECK_FUNCS(rand rand_r srand time) 519AC_CHECK_FUNCS(isascii mmap munmap putenv) 520 521AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ 522#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP) 523# undef /**/ HAVE_MMAP 524#endif]) 525 526dnl Checking for va_copy availability 527AC_MSG_CHECKING([for va_copy]) 528AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> 529va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])], 530have_va_copy=yes, 531have_va_copy=no) 532AC_MSG_RESULT($have_va_copy) 533if test x"$have_va_copy" = x"yes"; then 534 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) 535else 536 AC_MSG_CHECKING([for __va_copy]) 537 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> 538 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])], 539 have___va_copy=yes, 540 have___va_copy=no) 541 AC_MSG_RESULT($have___va_copy) 542 if test x"$have___va_copy" = x"yes"; then 543 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) 544 fi 545fi 546 547dnl Checking whether va_list is an array type 548AC_MSG_CHECKING([whether va_list is an array type]) 549AC_TRY_COMPILE2([ 550#include <stdarg.h> 551void a(va_list * ap) {}],[ 552va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[ 553 AC_MSG_RESULT(no)],[ 554 AC_MSG_RESULT(yes) 555 AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])]) 556 557dnl Checks for inet libraries: 558AC_SEARCH_LIBS(gethostent, [nsl]) 559AC_SEARCH_LIBS(setsockopt, [socket net network]) 560AC_SEARCH_LIBS(connect, [inet]) 561 562dnl Determine what socket length (socklen_t) data type is 563AC_MSG_CHECKING([for type of socket length (socklen_t)]) 564AC_TRY_COMPILE2([ 565#include <stddef.h> 566#include <sys/types.h> 567#include <sys/socket.h>],[ 568(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[ 569 AC_MSG_RESULT(socklen_t *) 570 XML_SOCKLEN_T=socklen_t],[ 571 AC_TRY_COMPILE2([ 572#include <stddef.h> 573#include <sys/types.h> 574#include <sys/socket.h>],[ 575(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[ 576 AC_MSG_RESULT(size_t *) 577 XML_SOCKLEN_T=size_t],[ 578 AC_TRY_COMPILE2([ 579#include <stddef.h> 580#include <sys/types.h> 581#include <sys/socket.h>],[ 582(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[ 583 AC_MSG_RESULT(int *) 584 XML_SOCKLEN_T=int],[ 585 AC_MSG_WARN(could not determine) 586 XML_SOCKLEN_T="int"])])]) 587AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is]) 588 589dnl Checking if gethostbyname() argument is const. 590AC_MSG_CHECKING([for const gethostbyname() argument]) 591AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], 592 [[(void)gethostbyname((const char *)"");]])], 593have_gethostbyname_const_arg=yes, 594have_gethostbyname_const_arg=no) 595AC_MSG_RESULT($have_gethostbyname_const_arg) 596if test x"$have_gethostbyname_const_arg" = x"yes"; then 597 AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [], 598 [Type cast for the gethostbyname() argument]) 599else 600 AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)], 601 [Type cast for the gethostbyname() argument]) 602fi 603 604dnl Checking if send() second argument is const. 605AC_MSG_CHECKING([for const send() second argument]) 606AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 607#include <sys/socket.h>]], 608 [[(void)send(1,(const char *)"",1,1);]])], 609have_send_const_arg2=yes, 610have_send_const_arg2=no) 611AC_MSG_RESULT($have_send_const_arg2) 612if test x"$have_send_const_arg2" = x"yes"; then 613 AC_DEFINE([SEND_ARG2_CAST], [], 614 [Type cast for the send() function 2nd arg]) 615else 616 AC_DEFINE([SEND_ARG2_CAST], [(char *)], 617 [Type cast for the send() function 2nd arg]) 618fi 619 620dnl Checking whether __attribute__((destructor)) is accepted by the compiler 621AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted]) 622AC_TRY_COMPILE2([ 623void __attribute__((destructor)) 624f(void) {}], [], [ 625 AC_MSG_RESULT(yes) 626 AC_DEFINE([HAVE_ATTRIBUTE_DESTRUCTOR], [1],[Define if __attribute__((destructor)) is accepted]) 627 AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[ 628 AC_MSG_RESULT(no)]) 629 630 631dnl ***********************Checking for availability of IPv6******************* 632 633AC_MSG_CHECKING([whether to enable IPv6]) 634AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes) 635if test "$with_minimum" = "yes" 636then 637 enable_ipv6=no 638fi 639if test $enable_ipv6 = yes; then 640 have_ipv6=no 641 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 642# include <sys/types.h> 643# include <sys/socket.h> 644 ]], [[ 645 struct sockaddr_storage ss; 646 socket(AF_INET6, SOCK_STREAM, 0) 647 ]])], 648 have_ipv6=yes, 649 have_ipv6=no 650 ) 651 AC_MSG_RESULT($have_ipv6) 652 653 if test $have_ipv6 = yes; then 654 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6]) 655 have_broken_ss_family=no 656 657 dnl ********************************************************************* 658 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have 659 dnl a ss_family member, but rather __ss_family. Let's detect that 660 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these 661 dnl platforms. However, we should only do this if ss_family is not 662 dnl present. 663 dnl ******************************************************************** 664 AC_MSG_CHECKING([struct sockaddr::ss_family]) 665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 666# include <sys/types.h> 667# include <sys/socket.h> 668 ]], [[ 669 struct sockaddr_storage ss ; 670 ss.ss_family = 0 ; 671 ]])], 672 have_ss_family=yes, 673 have_ss_family=no 674 ) 675 AC_MSG_RESULT($have_ss_family) 676 if test x$have_ss_family = xno ; then 677 AC_MSG_CHECKING([broken struct sockaddr::ss_family]) 678 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 679# include <sys/types.h> 680# include <sys/socket.h> 681 ]], [[ 682 struct sockaddr_storage ss ; 683 ss.__ss_family = 0 ; 684 ]])], 685 have_broken_ss_family=yes, 686 have_broken_ss_family=no 687 ) 688 AC_MSG_RESULT($have_broken_ss_family) 689 if test x$have_broken_ss_family = xyes ; then 690 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [], 691 [Whether struct sockaddr::__ss_family exists]) 692 AC_DEFINE(ss_family, __ss_family, 693 [ss_family is not defined here, use __ss_family instead]) 694 else 695 AC_MSG_WARN(ss_family and __ss_family not found) 696 fi 697 fi 698 699 have_getaddrinfo=no 700 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes) 701 if test $have_getaddrinfo != yes; then 702 for lib in bsd socket inet; do 703 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break]) 704 done 705 fi 706 707 if test $have_getaddrinfo = yes; then 708 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there]) 709 fi 710 fi 711fi 712 713dnl ******************************End IPv6 checks****************************** 714 715XML_LIBDIR='-L${libdir}' 716XML_INCLUDEDIR='-I${includedir}/libxml2' 717 718dnl 719dnl Extra flags 720dnl 721XML_CFLAGS="" 722RDL_LIBS="" 723 724dnl 725dnl Workaround for native compilers 726dnl HP : http://bugs.gnome.org/db/31/3163.html 727dnl DEC : Enable NaN/Inf 728dnl 729if test "${GCC}" != "yes" ; then 730 case "${host}" in 731 hppa*-*-hpux* ) 732 EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000" 733 ;; 734 *-dec-osf* ) 735 EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" 736 ;; 737 alpha*-*-linux* ) 738 EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" 739 ;; 740 esac 741else 742 if test "$with_fexceptions" = "yes" 743 then 744 # 745 # Not activated by default because this inflates the code size 746 # Used to allow propagation of C++ exceptions through the library 747 # 748 EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions" 749 fi 750 751 # warnings we'd like to see 752 EXTRA_CFLAGS="${EXTRA_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" 753 # warnings we'd like to suppress 754 EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args" 755 case "${host}" in 756 alpha*-*-linux* ) 757 EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" 758 ;; 759 alpha*-*-osf* ) 760 EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" 761 ;; 762 esac 763fi 764case ${host} in 765 *-*-solaris*) 766 XML_LIBDIR="${XML_LIBDIR} -R${libdir}" 767 ;; 768 hppa*-hp-mpeix) 769 NEED_TRIO=1 770 ;; 771 *-*-mingw* | *-*-cygwin* | *-*-msvc* ) 772 # If the host is Windows, and shared libraries are disabled, we 773 # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to 774 # work properly (without it, xmlexports.h would force the use of 775 # DLL imports, which obviously aren't present in a static 776 # library). 777 if test "x$enable_shared" = "xno"; then 778 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC" 779 EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC" 780 fi 781 ;; 782esac 783 784 785dnl 786dnl check for python 787dnl 788 789PYTHON_VERSION= 790PYTHON_INCLUDES= 791PYTHON_SITE_PACKAGES= 792PYTHON_TESTS= 793pythondir= 794if test "$with_python" != "no" ; then 795 if test -x "$with_python/bin/python" 796 then 797 echo Found python in $with_python/bin/python 798 PYTHON="$with_python/bin/python" 799 else 800 if test -x "$with_python/python.exe" 801 then 802 echo Found python in $with_python/python.exe 803 PYTHON="$with_python/python.exe" 804 else 805 if test -x "$with_python" 806 then 807 echo Found python in $with_python 808 PYTHON="$with_python" 809 else 810 if test -x "$PYTHON" 811 then 812 echo Found python in environment PYTHON=$PYTHON 813 with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"` 814 else 815 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5) 816 fi 817 fi 818 fi 819 fi 820 if test "$PYTHON" != "" 821 then 822 PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"` 823 PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"` 824# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python 825# 826# PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"` 827 echo Found Python version $PYTHON_VERSION 828 fi 829 if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = "" 830 then 831 if test -r $with_python/include/python$PYTHON_VERSION/Python.h 832 then 833 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION 834 else 835 if test -r $prefix/include/python$PYTHON_VERSION/Python.h 836 then 837 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION 838 else 839 if test -r /usr/include/python$PYTHON_VERSION/Python.h 840 then 841 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION 842 else 843 if test -r $with_python/include/Python.h 844 then 845 PYTHON_INCLUDES=$with_python/include 846 else 847 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h 848 fi 849 fi 850 fi 851 fi 852 fi 853 if test "$with_python_install_dir" != "" 854 then 855 PYTHON_SITE_PACKAGES="$with_python_install_dir" 856 fi 857 if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = "" 858 then 859 if test -d $libdir/python$PYTHON_VERSION/site-packages 860 then 861 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages 862 else 863 if test -d $with_python/lib/site-packages 864 then 865 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages 866 else 867 PYTHON_SITE_PACKAGES=$($PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(True,False,"${exec_prefix}"))') 868 fi 869 fi 870 fi 871 pythondir='$(PYTHON_SITE_PACKAGES)' 872 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags` 873else 874 PYTHON= 875fi 876AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "") 877if test "$PYTHON_INCLUDES" != "" 878then 879 PYTHON_SUBDIR=python 880else 881 PYTHON_SUBDIR= 882fi 883AC_SUBST(pythondir) 884AC_SUBST(PYTHON_SUBDIR) 885AC_SUBST(PYTHON_LIBS) 886 887dnl check for dso support 888WITH_MODULES=0 889TEST_MODULES= 890 891if test "$with_modules" != "no" ; then 892 case "$host" in 893 *-*-cygwin*) 894 MODULE_EXTENSION=".dll" 895 AC_CHECK_LIB(cygwin, dlopen, [ 896 WITH_MODULES=1 897 MODULE_PLATFORM_LIBS= 898 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) 899 ]) 900 ;; 901 *-*-mingw*) 902 MODULE_EXTENSION=".dll" 903 WITH_MODULES=1 904 ;; 905 *) 906 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [ 907 AC_CHECK_LIB(dld, shl_load, [ 908 MODULE_PLATFORM_LIBS="-ldld" 909 libxml_have_shl_load=yes], [ 910 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [ 911 AC_CHECK_LIB(dl, dlopen, [ 912 MODULE_PLATFORM_LIBS="-ldl" 913 libxml_have_dlopen=yes])])])]) 914 915 if test "${libxml_have_shl_load}" = "yes"; then 916 MODULE_EXTENSION=".sl" 917 WITH_MODULES=1 918 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso]) 919 fi 920 921 if test "${libxml_have_dlopen}" = "yes"; then 922 case "${host}" in 923 *-*-hpux* ) 924 MODULE_EXTENSION=".sl" 925 ;; 926 * ) 927 MODULE_EXTENSION=".so" 928 ;; 929 esac 930 931 WITH_MODULES=1 932 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) 933 fi 934 ;; 935 esac 936fi 937 938if test "${WITH_MODULES}" = "1"; then 939 TEST_MODULES="ModuleTests" 940fi 941 942AC_SUBST(WITH_MODULES) 943AC_SUBST(MODULE_PLATFORM_LIBS) 944AC_SUBST(MODULE_EXTENSION) 945AC_SUBST(TEST_MODULES) 946 947dnl 948dnl Check for trio string functions 949dnl 950 951if test "${NEED_TRIO}" = "1" ; then 952 echo Adding trio library for string functions 953 WITH_TRIO=1 954else 955 WITH_TRIO=0 956fi 957AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1") 958AC_SUBST(WITH_TRIO) 959 960dnl 961dnl Allow to enable/disable various pieces 962dnl 963echo Checking configuration requirements 964 965dnl 966dnl Thread-related stuff 967dnl 968THREAD_LIBS="" 969BASE_THREAD_LIBS="" 970WITH_THREADS=0 971THREAD_CFLAGS="" 972TEST_THREADS="" 973THREADS_W32="" 974WITH_THREAD_ALLOC=0 975 976if test "$with_threads" = "no" ; then 977 echo Disabling multithreaded support 978else 979 echo Enabling multithreaded support 980 981 dnl Default to native threads on Windows 982 case $host_os in 983 *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then 984 WITH_THREADS="1" 985 THREADS_W32="1" 986 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" 987 fi 988 ;; 989 esac 990 991 dnl Use pthread by default in other cases 992 if test -z "$THREADS_W32"; then 993 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then 994 AC_CHECK_HEADER(pthread.h, 995 AC_CHECK_LIB(pthread, pthread_join,[ 996 THREAD_LIBS="-lpthread" 997 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there]) 998 WITH_THREADS="1"])) 999 fi 1000 fi 1001 1002 case $host_os in 1003 *cygwin*) THREAD_LIBS="" 1004 ;; 1005 *beos*) WITH_THREADS="1" 1006 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS" 1007 ;; 1008 *linux*) 1009 if test "${GCC}" = "yes" ; then 1010 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'` 1011 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'` 1012 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'` 1013 if test "${THREAD_LIBS}" = "-lpthread" ; then 1014 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null 1015 then 1016 THREAD_LIBS="" 1017 BASE_THREAD_LIBS="-lpthread" 1018 else 1019 if expr ${GCC_MAJOR} \> 3 > /dev/null 1020 then 1021 THREAD_LIBS="" 1022 BASE_THREAD_LIBS="-lpthread" 1023 else 1024 echo old GCC disabling weak symbols for pthread 1025 fi 1026 fi 1027 fi 1028 fi 1029 ;; 1030 esac 1031 if test "$WITH_THREADS" = "1" ; then 1032 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" 1033 TEST_THREADS="Threadtests" 1034 fi 1035fi 1036if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then 1037 WITH_THREAD_ALLOC=1 1038fi 1039 1040AC_SUBST(THREAD_LIBS) 1041AC_SUBST(BASE_THREAD_LIBS) 1042AC_SUBST(WITH_THREADS) 1043AC_SUBST(THREAD_CFLAGS) 1044AC_SUBST(TEST_THREADS) 1045AC_SUBST(WITH_THREAD_ALLOC) 1046AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"]) 1047 1048dnl 1049dnl xmllint shell history 1050dnl 1051if test "$with_history" = "yes" ; then 1052 echo Enabling xmllint shell history 1053 dnl check for terminal library. this is a very cool solution 1054 dnl from octave's configure.in 1055 unset tcap 1056 for termlib in ncurses curses termcap terminfo termlib; do 1057 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"]) 1058 test -n "$tcap" && break 1059 done 1060 1061 AC_CHECK_HEADER(readline/history.h, 1062 AC_CHECK_LIB(history, append_history,[ 1063 RDL_LIBS="-lhistory" 1064 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])])) 1065 AC_CHECK_HEADER(readline/readline.h, 1066 AC_CHECK_LIB(readline, readline,[ 1067 RDL_LIBS="-lreadline $RDL_LIBS $tcap" 1068 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap)) 1069 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then 1070 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include" 1071 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS" 1072 fi 1073fi 1074 1075dnl 1076dnl Tree functions 1077dnl 1078if test "$with_tree" = "no" ; then 1079 echo Disabling DOM like tree manipulation APIs 1080 WITH_TREE=0 1081else 1082 WITH_TREE=1 1083fi 1084AC_SUBST(WITH_TREE) 1085 1086if test "$with_ftp" != "yes" ; then 1087 echo Disabling FTP support 1088 WITH_FTP=0 1089 FTP_OBJ= 1090else 1091 WITH_FTP=1 1092 FTP_OBJ=nanoftp.o 1093fi 1094AC_SUBST(WITH_FTP) 1095AC_SUBST(FTP_OBJ) 1096 1097if test "$with_http" = "no" ; then 1098 echo Disabling HTTP support 1099 WITH_HTTP=0 1100 HTTP_OBJ= 1101else 1102 WITH_HTTP=1 1103 HTTP_OBJ=nanohttp.o 1104fi 1105AC_SUBST(WITH_HTTP) 1106AC_SUBST(HTTP_OBJ) 1107 1108if test "$with_legacy" != "yes" ; then 1109 echo Disabling deprecated APIs 1110 WITH_LEGACY=0 1111else 1112 WITH_LEGACY=1 1113fi 1114AC_SUBST(WITH_LEGACY) 1115 1116if test "$with_reader" = "no" ; then 1117 echo Disabling the xmlReader parsing interface 1118 WITH_READER=0 1119 READER_TEST= 1120else 1121 WITH_READER=1 1122 READER_TEST=Readertests 1123 if test "$with_push" = "no" ; then 1124 echo xmlReader requires Push interface - enabling it 1125 with_push=yes 1126 fi 1127fi 1128AC_SUBST(WITH_READER) 1129AC_SUBST(READER_TEST) 1130 1131if test "$with_writer" = "no" ; then 1132 echo Disabling the xmlWriter saving interface 1133 WITH_WRITER=0 1134# WRITER_TEST= 1135else 1136 WITH_WRITER=1 1137# WRITER_TEST=Writertests 1138 if test "$with_push" = "no" ; then 1139 echo xmlWriter requires Push interface - enabling it 1140 with_push=yes 1141 fi 1142 if test "$with_output" = "no" ; then 1143 echo xmlWriter requires Output interface - enabling it 1144 with_output=yes 1145 fi 1146fi 1147AC_SUBST(WITH_WRITER) 1148#AC_SUBST(WRITER_TEST) 1149 1150if test "$with_pattern" = "no" ; then 1151 echo Disabling the xmlPattern parsing interface 1152 WITH_PATTERN=0 1153 TEST_PATTERN= 1154else 1155 WITH_PATTERN=1 1156 TEST_PATTERN=Patterntests 1157fi 1158AC_SUBST(WITH_PATTERN) 1159AC_SUBST(TEST_PATTERN) 1160 1161if test "$with_sax1" = "no" ; then 1162 echo Disabling the older SAX1 interface 1163 WITH_SAX1=0 1164 TEST_SAX= 1165else 1166 WITH_SAX1=1 1167 TEST_SAX=SAXtests 1168fi 1169AC_SUBST(WITH_SAX1) 1170AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1") 1171AC_SUBST(TEST_SAX) 1172 1173if test "$with_push" = "no" ; then 1174 echo Disabling the PUSH parser interfaces 1175 WITH_PUSH=0 1176 TEST_PUSH= 1177else 1178 WITH_PUSH=1 1179 TEST_PUSH="XMLPushtests" 1180fi 1181AC_SUBST(WITH_PUSH) 1182AC_SUBST(TEST_PUSH) 1183 1184if test "$with_html" = "no" ; then 1185 echo Disabling HTML support 1186 WITH_HTML=0 1187 HTML_OBJ= 1188 TEST_HTML= 1189else 1190 WITH_HTML=1 1191 HTML_OBJ="HTMLparser.o HTMLtree.o" 1192 TEST_HTML=HTMLtests 1193 if test "$with_push" != "no" ; then 1194 TEST_PHTML=HTMLPushtests 1195 else 1196 TEST_PHTML= 1197 fi 1198fi 1199AC_SUBST(WITH_HTML) 1200AC_SUBST(HTML_OBJ) 1201AC_SUBST(TEST_HTML) 1202AC_SUBST(TEST_PHTML) 1203 1204if test "$with_valid" = "no" ; then 1205 echo Disabling DTD validation support 1206 WITH_VALID=0 1207 TEST_VALID= 1208 TEST_VTIME= 1209else 1210 WITH_VALID=1 1211 TEST_VALID=Validtests 1212 TEST_VTIME=VTimingtests 1213fi 1214AC_SUBST(WITH_VALID) 1215AC_SUBST(TEST_VALID) 1216AC_SUBST(TEST_VTIME) 1217 1218if test "$with_catalog" = "no" ; then 1219 echo Disabling Catalog support 1220 WITH_CATALOG=0 1221 CATALOG_OBJ= 1222 TEST_CATALOG= 1223else 1224 WITH_CATALOG=1 1225 CATALOG_OBJ="catalog.o" 1226 TEST_CATALOG=Catatests 1227fi 1228AC_SUBST(WITH_CATALOG) 1229AC_SUBST(CATALOG_OBJ) 1230AC_SUBST(TEST_CATALOG) 1231 1232if test "$with_docbook" != "yes" ; then 1233 echo Disabling Docbook support 1234 WITH_DOCB=0 1235 DOCB_OBJ= 1236else 1237 WITH_DOCB=1 1238 DOCB_OBJ="DOCBparser.o" 1239fi 1240AC_SUBST(WITH_DOCB) 1241AC_SUBST(DOCB_OBJ) 1242 1243 1244if test "$with_xptr" = "no" ; then 1245 echo Disabling XPointer support 1246 WITH_XPTR=0 1247 XPTR_OBJ= 1248 TEST_XPTR= 1249else 1250 WITH_XPTR=1 1251 XPTR_OBJ=xpointer.o 1252 TEST_XPTR=XPtrtests 1253 if test "$with_xpath" = "no" ; then 1254 echo XPointer requires XPath support - enabling it 1255 with_xpath=yes 1256 fi 1257fi 1258AC_SUBST(WITH_XPTR) 1259AC_SUBST(XPTR_OBJ) 1260AC_SUBST(TEST_XPTR) 1261 1262if test "$with_c14n" = "no" ; then 1263 echo Disabling C14N support 1264 WITH_C14N=0 1265 C14N_OBJ= 1266 TEST_C14N= 1267else 1268 WITH_C14N=1 1269 C14N_OBJ="c14n.c" 1270 TEST_C14N=C14Ntests 1271 if test "$with_xpath" = "no" ; then 1272 echo C14N requires XPath support - enabling it 1273 with_xpath=yes 1274 fi 1275fi 1276AC_SUBST(WITH_C14N) 1277AC_SUBST(C14N_OBJ) 1278AC_SUBST(TEST_C14N) 1279 1280if test "$with_xinclude" = "no" ; then 1281 echo Disabling XInclude support 1282 WITH_XINCLUDE=0 1283 XINCLUDE_OBJ= 1284 with_xinclude="no" 1285 TEST_XINCLUDE= 1286else 1287 WITH_XINCLUDE=1 1288 XINCLUDE_OBJ=xinclude.o 1289 TEST_XINCLUDE=XIncludetests 1290 if test "$with_xpath" = "no" ; then 1291 echo XInclude requires XPath support - enabling it 1292 with_xpath=yes 1293 fi 1294fi 1295AC_SUBST(WITH_XINCLUDE) 1296AC_SUBST(XINCLUDE_OBJ) 1297AC_SUBST(TEST_XINCLUDE) 1298 1299if test "$with_xptr" = "" -a "$with_xpath" = "no" ; then 1300 with_xptr=no 1301fi 1302 1303if test "$with_schematron" = "" -a "$with_xpath" = "no" ; then 1304 with_schematron=no 1305fi 1306 1307if test "$with_schematron" = "no" ; then 1308 echo "Disabling Schematron support" 1309 WITH_SCHEMATRON=0 1310 TEST_SCHEMATRON= 1311else 1312 echo "Enabled Schematron support" 1313 WITH_SCHEMATRON=1 1314 TEST_SCHEMATRON="Schematrontests" 1315 with_xpath=yes 1316 with_pattern=yes 1317 with_schematron=yes 1318fi 1319AC_SUBST(WITH_SCHEMATRON) 1320AC_SUBST(TEST_SCHEMATRON) 1321 1322if test "$with_xpath" = "no" ; then 1323 echo Disabling XPATH support 1324 WITH_XPATH=0 1325 XPATH_OBJ= 1326 TEST_XPATH= 1327else 1328 WITH_XPATH=1 1329 XPATH_OBJ=xpath.o 1330 TEST_XPATH=XPathtests 1331fi 1332AC_SUBST(WITH_XPATH) 1333AC_SUBST(XPATH_OBJ) 1334AC_SUBST(TEST_XPATH) 1335 1336dnl 1337dnl output functions 1338dnl 1339if test "$with_output" = "no" ; then 1340 echo Disabling serialization/saving support 1341 WITH_OUTPUT=0 1342else 1343 WITH_OUTPUT=1 1344fi 1345AC_SUBST(WITH_OUTPUT) 1346 1347WITH_ICONV=0 1348if test "$with_iconv" = "no" ; then 1349 echo Disabling ICONV support 1350else 1351 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then 1352 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include" 1353 # Export this since our headers include iconv.h 1354 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include" 1355 ICONV_LIBS="-L$with_iconv/lib" 1356 fi 1357 1358 AC_CHECK_HEADER(iconv.h, 1359 AC_MSG_CHECKING(for iconv) 1360 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> 1361#include <iconv.h>]],[[ 1362iconv_t cd = iconv_open ("",""); 1363iconv (cd, NULL, NULL, NULL, NULL);]])],[ 1364 AC_MSG_RESULT(yes) 1365 WITH_ICONV=1],[ 1366 AC_MSG_RESULT(no) 1367 AC_MSG_CHECKING(for iconv in -liconv) 1368 1369 _ldflags="${LDFLAGS}" 1370 _libs="${LIBS}" 1371 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}" 1372 LIBS="${LIBS} -liconv" 1373 1374 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> 1375#include <iconv.h>]],[[ 1376iconv_t cd = iconv_open ("",""); 1377iconv (cd, NULL, NULL, NULL, NULL);]])],[ 1378 AC_MSG_RESULT(yes) 1379 WITH_ICONV=1 1380 ICONV_LIBS="${ICONV_LIBS} -liconv" 1381 LIBS="${_libs}" 1382 LDFLAGS="${_ldflags}"],[ 1383 AC_MSG_RESULT(no) 1384 LIBS="${_libs}" 1385 LDFLAGS="${_ldflags}"])])) 1386 1387 if test "$WITH_ICONV" = "1" ; then 1388 AC_MSG_CHECKING([for iconv declaration]) 1389 AC_CACHE_VAL(xml_cv_iconv_arg2, [ 1390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> 1391#include <iconv.h> 1392extern 1393#ifdef __cplusplus 1394"C" 1395#endif 1396#if defined(__STDC__) || defined(__cplusplus) 1397size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 1398#else 1399size_t iconv(); 1400#endif 1401]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")]) 1402 1403 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);" 1404 AC_MSG_RESULT([${xml_xxx:- 1405 }$xml_cv_iconv_decl]) 1406 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2, 1407 [Define as const if the declaration of iconv() needs const.]) 1408 fi 1409fi 1410case "$host" in 1411 *mingw*) M_LIBS="" 1412 ;; 1413 *beos*) M_LIBS="" 1414 ;; 1415 *haiku*) M_LIBS="" 1416 ;; 1417 *) M_LIBS="-lm" 1418 ;; 1419esac 1420AC_SUBST(WITH_ICONV) 1421 1422WITH_ICU=0 1423ICU_LIBS="" 1424if test "$with_icu" != "yes" ; then 1425 echo Disabling ICU support 1426else 1427 # Try pkg-config first so that static linking works. 1428 # If this succeeeds, we ignore the WITH_ICU directory. 1429 PKG_CHECK_MODULES([ICU],[icu-i18n], 1430 [have_libicu=yes], 1431 [have_libicu=no]) 1432 1433 # If pkg-config failed, fall back to AC_CHECK_LIB. This 1434 # will not pick up the necessary LIBS flags for liblzma's 1435 # private dependencies, though, so static linking may fail. 1436 if test "x$have_libicu" = "xno"; then 1437 ICU_CONFIG=icu-config 1438 if ${ICU_CONFIG} --cflags >/dev/null 2>&1 1439 then 1440 ICU_LIBS=`${ICU_CONFIG} --ldflags` 1441 have_libicu=yes 1442 echo Enabling ICU support 1443 else 1444 if test "$with_icu" != "yes" -a "$with_iconv" != "" ; then 1445 CPPFLAGS="${CPPFLAGS} -I$with_icu" 1446 # Export this since our headers include icu.h 1447 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_icu" 1448 fi 1449 1450 AC_CHECK_HEADER(unicode/ucnv.h, 1451 AC_MSG_CHECKING(for icu) 1452 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[ 1453 UConverter *utf = ucnv_open("UTF-8", NULL);]])],[ 1454 AC_MSG_RESULT(yes) 1455 have_libicu=yes],[ 1456 AC_MSG_RESULT(no) 1457 AC_MSG_CHECKING(for icu in -licucore) 1458 1459 _ldflags="${LDFLAGS}" 1460 _libs="${LIBS}" 1461 LDFLAGS="${LDFLAGS} ${ICU_LIBS}" 1462 LIBS="${LIBS} -licucore" 1463 1464 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[ 1465 UConverter *utf = ucnv_open("UTF-8", NULL);]])],[ 1466 AC_MSG_RESULT(yes) 1467 have_libicu=yes 1468 ICU_LIBS="${ICU_LIBS} -licucore" 1469 LIBS="${_libs}" 1470 LDFLAGS="${_ldflags}"],[ 1471 AC_MSG_RESULT(no) 1472 LIBS="${_libs}" 1473 LDFLAGS="${_ldflags}"])])) 1474 fi 1475 fi 1476 1477 # Found the library via either method? 1478 if test "x$have_libicu" = "xyes"; then 1479 WITH_ICU=1 1480 fi 1481fi 1482XML_LIBS="-lxml2" 1483XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS" 1484XML_LIBTOOLLIBS="libxml2.la" 1485AC_SUBST(WITH_ICU) 1486 1487WITH_ISO8859X=1 1488if test "$WITH_ICONV" != "1" ; then 1489if test "$with_iso8859x" = "no" ; then 1490 echo Disabling ISO8859X support 1491 WITH_ISO8859X=0 1492fi 1493fi 1494AC_SUBST(WITH_ISO8859X) 1495 1496if test "$with_schemas" = "no" ; then 1497 echo "Disabling Schemas/Relax-NG support" 1498 WITH_SCHEMAS=0 1499 TEST_SCHEMAS= 1500else 1501 echo "Enabled Schemas/Relax-NG support" 1502 WITH_SCHEMAS=1 1503 TEST_SCHEMAS="Schemastests Relaxtests" 1504 if test "$PYTHON_INCLUDES" != "" ; then 1505 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests" 1506 fi 1507 with_regexps=yes 1508fi 1509AC_SUBST(WITH_SCHEMAS) 1510AC_SUBST(TEST_SCHEMAS) 1511 1512if test "$with_regexps" = "no" ; then 1513 echo Disabling Regexps support 1514 WITH_REGEXPS=0 1515 TEST_REGEXPS= 1516else 1517 WITH_REGEXPS=1 1518 TEST_REGEXPS="Regexptests Automatatests" 1519fi 1520AC_SUBST(WITH_REGEXPS) 1521AC_SUBST(TEST_REGEXPS) 1522 1523if test "$with_debug" = "no" ; then 1524 echo Disabling DEBUG support 1525 WITH_DEBUG=0 1526 DEBUG_OBJ= 1527 TEST_DEBUG= 1528else 1529 WITH_DEBUG=1 1530 DEBUG_OBJ=debugXML.o 1531 TEST_DEBUG=Scripttests 1532fi 1533AC_SUBST(WITH_DEBUG) 1534AC_SUBST(DEBUG_OBJ) 1535AC_SUBST(TEST_DEBUG) 1536 1537if test "$with_mem_debug" = "yes" ; then 1538 if test "$with_thread_alloc" = "yes" ; then 1539 echo Disabling memory debug - cannot use mem-debug with thread-alloc! 1540 WITH_MEM_DEBUG=0 1541 else 1542 echo Enabling memory debug support 1543 WITH_MEM_DEBUG=1 1544 fi 1545else 1546 WITH_MEM_DEBUG=0 1547fi 1548AC_SUBST(WITH_MEM_DEBUG) 1549 1550if test "$with_run_debug" = "yes" ; then 1551 echo Enabling runtime debug support 1552 WITH_RUN_DEBUG=1 1553else 1554 WITH_RUN_DEBUG=0 1555fi 1556AC_SUBST(WITH_RUN_DEBUG) 1557 1558WIN32_EXTRA_LIBADD= 1559WIN32_EXTRA_LDFLAGS= 1560CYGWIN_EXTRA_LDFLAGS= 1561CYGWIN_EXTRA_PYTHON_LIBADD= 1562WIN32_EXTRA_PYTHON_LIBADD= 1563case "$host" in 1564 *-*-mingw*) 1565 CPPFLAGS="$CPPFLAGS -DWIN32" 1566 WIN32_EXTRA_LIBADD="-lws2_32" 1567 WIN32_EXTRA_LDFLAGS="-no-undefined" 1568 if test "${PYTHON}" != "" 1569 then 1570 case "$host" in 1571 *-w64-mingw*) 1572 WIN32_EXTRA_PYTHON_LIBADD="-shrext .pyd -L${pythondir}/../../lib -lpython${PYTHON_VERSION}" 1573 ;; 1574 *) 1575 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" 1576 ;; 1577 esac 1578 fi 1579 ;; 1580 *-*-cygwin*) 1581 CYGWIN_EXTRA_LDFLAGS="-no-undefined" 1582 if test "${PYTHON}" != "" 1583 then 1584 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" 1585 fi 1586 ;; 1587esac 1588AC_SUBST(WIN32_EXTRA_LIBADD) 1589AC_SUBST(WIN32_EXTRA_LDFLAGS) 1590AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD) 1591AC_SUBST(CYGWIN_EXTRA_LDFLAGS) 1592AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD) 1593 1594dnl Checking the standard string functions availability 1595dnl 1596dnl Note mingw* has C99 implementation that produce expected xml numbers 1597dnl if code use {v}snprintf functions. 1598dnl If you like to activate at run-time C99 compatible number output 1599dnl see release note for mingw runtime 3.15: 1600dnl http://sourceforge.net/project/shownotes.php?release_id=24832 1601dnl 1602dnl Also *win32*config.h files redefine them for various MSC compilers. 1603dnl 1604dnl So do not redefine {v}snprintf to _{v}snprintf like following: 1605dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) 1606dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) 1607dnl and do not redefine those functions is C-source files. 1608dnl 1609AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,, 1610 NEED_TRIO=1) 1611 1612if test "$with_coverage" = "yes" -a "${GCC}" = "yes" 1613then 1614 echo Enabling code coverage for GCC 1615 EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage" 1616 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" 1617else 1618 echo Disabling code coverage for GCC 1619fi 1620 1621AC_SUBST(CPPFLAGS) 1622AC_SUBST(EXTRA_CFLAGS) 1623AC_SUBST(LDFLAGS) 1624AC_SUBST(XML_CFLAGS) 1625 1626AC_SUBST(XML_LIBDIR) 1627AC_SUBST(XML_LIBS) 1628AC_SUBST(XML_PRIVATE_LIBS) 1629AC_SUBST(XML_LIBTOOLLIBS) 1630AC_SUBST(ICONV_LIBS) 1631AC_SUBST(ICU_LIBS) 1632AC_SUBST(XML_INCLUDEDIR) 1633AC_SUBST(HTML_DIR) 1634AC_SUBST(PYTHON) 1635AC_SUBST(PYTHON_VERSION) 1636AC_SUBST(PYTHON_INCLUDES) 1637AC_SUBST(PYTHON_SITE_PACKAGES) 1638 1639AC_SUBST(M_LIBS) 1640AC_SUBST(RDL_LIBS) 1641 1642dnl for the spec file 1643RELDATE=`date +'%a %b %e %Y'` 1644AC_SUBST(RELDATE) 1645AC_SUBST(PYTHON_TESTS) 1646 1647rm -f COPYING.LIB COPYING 1648ln -s $srcdir/Copyright COPYING 1649 1650# keep on one line for cygwin c.f. #130896 1651AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake]) 1652AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py]) 1653AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config]) 1654AC_OUTPUT 1655 1656echo Done configuring 1657