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