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