configure.in 26.2 KB
Newer Older
1 2
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.2)
3
AC_INIT(entities.c)
4
AM_CONFIG_HEADER(config.h)
5
AC_CANONICAL_HOST
6

7
LIBXML_MAJOR_VERSION=2
8
LIBXML_MINOR_VERSION=6
9
LIBXML_MICRO_VERSION=7
10
LIBXML_MICRO_VERSION_SUFFIX=
11
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
12 13
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION

14 15
LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`

16 17 18 19 20
AC_SUBST(LIBXML_MAJOR_VERSION)
AC_SUBST(LIBXML_MINOR_VERSION)
AC_SUBST(LIBXML_MICRO_VERSION)
AC_SUBST(LIBXML_VERSION)
AC_SUBST(LIBXML_VERSION_INFO)
21
AC_SUBST(LIBXML_VERSION_NUMBER)
22

23
VERSION=${LIBXML_VERSION}
24

25
AM_INIT_AUTOMAKE(libxml2, $VERSION)
26

27 28 29
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
30
AC_PROG_CPP
31 32 33 34
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)

35 36 37 38
dnl Make sure we have an ANSI compiler
AM_C_PROTOTYPES
test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)

39
AC_LIBTOOL_WIN32_DLL
40 41
AM_PROG_LIBTOOL

42
# AM_MAINTAINER_MODE
43

44 45 46 47 48 49 50 51 52
dnl
dnl option to build a minimal libxml2 library
dnl
AC_ARG_WITH(minimum, [  --with-minimum          build a minimally sized library (off)])
if test "$with_minimum" = "yes"
then
    echo "Configuring for a minimal library"
fi

53
dnl Checks for zlib library.
54 55
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"
56

Daniel Veillard's avatar
Daniel Veillard committed
57

58
AC_ARG_WITH(zlib,
William M. Brack's avatar
William M. Brack committed
59
[  --with-zlib[[=DIR]]       use libz in DIR],[
60 61 62 63 64
  if test "$withval" != "no" -a "$withval" != "yes"; then
    Z_DIR=$withval
    CPPFLAGS="${CPPFLAGS} -I$withval/include"
    LDFLAGS="${LDFLAGS} -L$withval/lib"
  fi
Daniel Veillard's avatar
Daniel Veillard committed
65
])
66 67 68 69
if test "$with_minimum" = "yes" -a "$with_zlib" = ""
then
    with_zlib=no
fi
Daniel Veillard's avatar
Daniel Veillard committed
70 71 72
if test "$with_zlib" = "no"; then
    echo "Disabling compression support"
else
73 74
    AC_CHECK_HEADERS(zlib.h,
	AC_CHECK_LIB(z, gzread,[
75
	    AC_DEFINE([HAVE_LIBZ], [], [Have compression library])
76 77 78 79 80 81 82 83 84 85 86
	    if test "x${Z_DIR}" != "x"; then
		Z_CFLAGS="-I${Z_DIR}/include"
		Z_LIBS="-L${Z_DIR}/lib -lz"
		[case ${host} in
		    *-*-solaris*)
			Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
			;;
		esac]
	    else
		Z_LIBS="-lz"
	    fi]))
Daniel Veillard's avatar
Daniel Veillard committed
87
fi
88 89 90 91 92 93

AC_SUBST(Z_CFLAGS)
AC_SUBST(Z_LIBS)

CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
94

95 96 97
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
98 99 100 101 102 103 104 105 106 107 108 109 110 111
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([ansidecl.h])
AC_CHECK_HEADERS([ieeefp.h])
AC_CHECK_HEADERS([nan.h])
AC_CHECK_HEADERS([math.h])
112
AC_CHECK_HEADERS([limits.h])
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
AC_CHECK_HEADERS([fp_class.h])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/socket.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([netinet/in.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([arpa/inet.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#if HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
])
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([signal.h])
AC_CHECK_HEADERS([arpa/nameser.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([resolv.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
# endif
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
# endif
])
156

157
dnl Specific dir for HTML output ?
158 159 160 161 162 163 164 165
AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
            [path to base html directory, default $datadir/doc/html]),
            [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])

AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
            [directory used under html-dir, default $PACKAGE-$VERSION/html]),
            [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
            [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
166 167 168

AC_SUBST(HTML_DIR)

169 170
dnl Checks for library functions.
AC_FUNC_STRFTIME
171
AC_CHECK_FUNCS(strdup strndup strerror)
172
AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
173
AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
174
AC_CHECK_FUNCS(stat _stat signal)
175

176 177 178 179
dnl Checking the standard string functions availability
AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
               NEED_TRIO=1)

180
dnl Checks for inet libraries:
181 182 183
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
184

185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
dnl Determine what socket length (socklen_t) data type is
AC_MSG_CHECKING([for type of socket length (socklen_t)])
AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
  AC_MSG_RESULT(socklen_t *)
  SOCKLEN_T=socklen_t],[
  AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
    AC_MSG_RESULT(size_t *)
    SOCKLEN_T=size_t],[
    AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
      AC_MSG_RESULT(int *)
      SOCKLEN_T=int],[
208 209
      AC_MSG_WARN(could not determine)
      SOCKLEN_T="unsigned int"])])])
210
AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
211

212 213 214 215
dnl ***********************Checking for availability of IPv6*******************

AC_MSG_CHECKING([whether to enable IPv6])
AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[yes/no] enables compilation of IPv6 code],, enable_ipv6=yes)
216 217 218 219
if test "$with_minimum" = "yes"
then
    enable_ipv6=no
fi
220 221 222 223 224 225 226 227 228 229 230 231 232
if test $enable_ipv6 = yes; then
  have_ipv6=no
  AC_TRY_COMPILE([
    #include <sys/socket.h>
    #include <sys/types.h>], [
    struct sockaddr_storage ss;
    socket(AF_INET6, SOCK_STREAM, 0)
    ],
    have_ipv6=yes,
    have_ipv6=no
  )
  AC_MSG_RESULT($have_ipv6)

233
  if test $have_ipv6 = yes; then
234
    AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
235 236 237 238 239 240 241 242 243

    have_getaddrinfo=no
    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
    if test $have_getaddrinfo != yes; then
      for lib in bsd socket inet; do
        AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
      done
    fi

244
    if test $have_getaddrinfo = yes; then
245
      AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
246 247 248 249 250 251
    fi
  fi
fi 

dnl ******************************End IPv6 checks******************************

252
dnl Checks for isnan in libm if not in libc
253
AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
254
  [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
255

256 257
AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
  [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
258 259

XML_LIBDIR='-L${libdir}'
260
XML_INCLUDEDIR='-I${includedir}/libxml2'
261

262 263 264 265
dnl
dnl Extra flags
dnl
XML_CFLAGS=""
266
RDL_LIBS=""
267

268 269
AC_ARG_WITH(fexceptions,
[  --with-fexceptions      add GCC flag -fexceptions for C++ exceptions (off)])
270 271 272 273
if test "$with_minimum" = "yes" -a "$with_fexceptions" = ""
then
    with_fexceptions=no
fi
274
dnl
275 276 277
dnl Workaround for native compilers
dnl  HP  : http://bugs.gnome.org/db/31/3163.html
dnl  DEC : Enable NaN/Inf
278
dnl
279
if test "${GCC}" != "yes" ; then
280 281
    case "${host}" in
          *-*-hpux* )
282
	       CFLAGS="${CFLAGS} -Wp,-H30000"
283
	       ;;
284 285 286
          *-dec-osf* )
               CFLAGS="${CFLAGS} -ieee"
               ;;
287 288 289
	  alpha*-*-linux* )
	       CFLAGS="${CFLAGS} -ieee"
	       ;;
290
    esac
291
else
292 293 294 295 296 297 298 299 300
    if test "$with_fexceptions" = "yes"
    then
        #
	# Not activated by default because this inflates the code size
	# Used to allow propagation of C++ exceptions through the library
	#
	CFLAGS="${CFLAGS} -fexceptions"
    fi
       
301
    CFLAGS="${CFLAGS} -Wall"
302 303 304 305
    case "${host}" in
          alpha*-*-linux* )
	       CFLAGS="${CFLAGS} -mieee"
	       ;;
306 307 308
	  alpha*-*-osf* )
	       CFLAGS="${CFLAGS} -mieee"
	       ;;
309
    esac
310
fi
311 312
case ${host} in
    *-*-solaris*)
313 314
        XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
        ;;
315 316 317
    hppa*-hp-mpeix)
        NEED_TRIO=1
	;;
318 319
esac

320

321 322 323 324 325 326 327
dnl
dnl check for python
dnl

PYTHON=
PYTHON_VERSION=
PYTHON_INCLUDES=
328
PYTHON_SITE_PACKAGES=
329
pythondir=
William M. Brack's avatar
William M. Brack committed
330 331
AC_ARG_WITH(python,
[  --with-python[[=DIR]]     build Python bindings if found])
332 333 334 335
if test "$with_minimum" = "yes" -a "$with_python" = ""
then
    with_python=no
fi
336 337 338 339 340
if test "$with_python" != "no" ; then
    if test -x "$with_python/bin/python"
    then
        echo Found python in $with_python/bin/python
        PYTHON="$with_python/bin/python"
Daniel Veillard's avatar
Daniel Veillard committed
341
    else
342 343
	if test -x "$with_python"
	then
344 345
	    echo Found python in $with_python
	    PYTHON="$with_python"
346
	else
347
	    AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
348
	fi
349 350 351 352 353 354 355 356
    fi
    if test "$PYTHON" != ""
    then
        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
	echo Found Python version $PYTHON_VERSION
    fi
    if test "$PYTHON_VERSION" != ""
    then
357 358
	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
359 360
	then
	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
361
	    PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
362 363 364
	else
	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
	    then
365
	        PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
366
		PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
367 368 369 370
	    else
		if test -r /usr/include/python$PYTHON_VERSION/Python.h
		then
		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
371
		    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
372 373 374 375
		else
		    echo could not find python$PYTHON_VERSION/Python.h
		fi
	    fi
376
	    if test ! -d "$PYTHON_SITE_PACKAGES"
377 378 379
	    then
		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
	    fi
380 381
	fi
    fi
382 383 384 385 386 387
    if test "$with_python" != ""
    then
        pythondir='$(PYTHON_SITE_PACKAGES)'
    else
        pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
    fi
388 389
fi
AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
390 391 392 393 394 395
if test "$PYTHON_INCLUDES" != ""
then
    PYTHON_SUBDIR=python
else
    PYTHON_SUBDIR=
fi
396
AC_SUBST(pythondir)
397
AC_SUBST(PYTHON_SUBDIR)
398

399 400 401
dnl
dnl Tester makes use of readline if present
dnl
402 403 404 405 406 407 408 409 410 411 412
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(readline,
[  --with-readline=DIR     use readline in DIR],[
  if test "$withval" != "no" -a "$withval" != "yes"; then
    RDL_DIR=$withval
    CPPFLAGS="${CPPFLAGS} -I$withval/include"
    LDFLAGS="${LDFLAGS} -L$withval/lib"
  fi
])
413 414 415 416
if test "$with_minimum" = "yes" -a "$with_readline" = ""
then
    with_readline=no
fi
417

418 419
dnl
dnl specific tests to setup DV's devel environment with debug etc ...
420
dnl (-Wunreachable-code)
421
dnl
422
if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
423 424
   [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xmltest" ]] || \
   [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xmlnew" ]]
425
   then
426 427 428 429 430 431 432 433
    if test "$with_minimum" != "yes"
    then
	if test "${with_mem_debug}" = "" ; then
	    with_mem_debug="yes"
	fi
	if test "${with_docbook}" = "" ; then
	    with_docbook="yes"
	fi
434
    fi
435
    CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls "
436
    STATIC_BINARIES="-static"
437
dnl -Wcast-qual -ansi
438 439
else
    STATIC_BINARIES=
440
fi
441
AC_SUBST(STATIC_BINARIES)
442 443 444 445 446 447 448 449 450 451 452

dnl
dnl Check for trio string functions
dnl

if test "${NEED_TRIO}" = "1" ; then
    echo Adding trio library for string functions
    WITH_TRIO=1
else    
    WITH_TRIO=0
fi
453
AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
454 455
AC_SUBST(WITH_TRIO)

456
dnl
William M. Brack's avatar
William M. Brack committed
457
dnl Allow to enable/disable various pieces
458 459
dnl

460 461 462
THREAD_LIBS=""
WITH_THREADS=0
THREAD_CFLAGS=""
463
TEST_THREADS=""
464
THREADS_W32=""
465

William M. Brack's avatar
William M. Brack committed
466 467
AC_ARG_WITH(threads,
[  --with-threads          add multithread support(on)])
468 469 470 471
if test "$with_minimum" = "yes" -a "$with_threads" = ""
then
    with_threads=no
fi
472 473 474
if test "$with_threads" = "no" ; then
    echo Disabling multithreaded support
else
475 476 477
    echo Enabling multithreaded support

    AC_CHECK_HEADER(pthread.h,
478
	AC_CHECK_LIB(pthread, pthread_join,[
479
	   THREAD_LIBS="-lpthread"
480 481
	   AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
	   AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
482
	   WITH_THREADS="1"]))
483 484 485 486 487 488
    case $host_os in
       *mingw32*) WITH_THREADS="1"
           THREADS_W32="Win32"
	   THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
       ;;
    esac
489
    if test "$WITH_THREADS" = "1" ; then
490 491
	THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
	TEST_THREADS="Threadtests"
492 493
    fi
fi
William M. Brack's avatar
William M. Brack committed
494 495
AC_ARG_WITH(thread-alloc,
[  --with-thread-alloc     add per-thread memory(off)])
496 497 498 499
if test "$with_minimum" = "yes" -a "$with_thread_alloc" = ""
then
    with_thread_alloc=no
fi
500 501
if test "$with_threads_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
    THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
502 503
fi

504 505 506
AC_SUBST(THREAD_LIBS)
AC_SUBST(WITH_THREADS)
AC_SUBST(THREAD_CFLAGS)
507
AC_SUBST(TEST_THREADS)
508
AC_SUBST(THREADS_W32)
509

William M. Brack's avatar
William M. Brack committed
510 511
AC_ARG_WITH(history,
[  --with-history          add history support to xmllint shell(off)])
512 513 514 515
if test "$with_minimum" = "yes" -a "$with_history" = ""
then
    with_history=no
fi
Daniel Veillard's avatar
Daniel Veillard committed
516
if test "$with_history" = "yes" ; then
517 518 519 520 521 522 523 524 525 526 527 528
    echo Enabling xmllint shell history
    dnl check for terminal library. this is a very cool solution
    dnl from octave's configure.in
    unset tcap
    for termlib in ncurses curses termcap terminfo termlib; do
	AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
	test -n "$tcap" && break
    done

    AC_CHECK_HEADER(readline/history.h,
	AC_CHECK_LIB(history, append_history,[
	   RDL_LIBS="-lhistory"
529
	   AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
530 531 532
    AC_CHECK_HEADER(readline/readline.h,
	AC_CHECK_LIB(readline, readline,[
	   RDL_LIBS="-lreadline $RDL_LIBS $tcap"
533
	   AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
534 535 536 537 538 539 540 541 542
    if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
	CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
	RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
    else
	CPPFLAGS=${_cppflags}
    fi
    LDFLAGS=${_ldflags}
fi

543
AC_ARG_WITH(output,
544
[  --with-output           add the serialization support (on)])
545 546 547 548 549 550 551 552 553 554 555 556
if test "$with_minimum" = "yes" -a "$with_output" = ""
then
    with_output=no
fi
if test "$with_output" = "no" ; then
    echo Disabling serialization/saving support
    WITH_OUTPUT=0
else    
    WITH_OUTPUT=1
fi
AC_SUBST(WITH_OUTPUT)

557 558 559 560 561 562 563 564 565 566 567 568 569 570
AC_ARG_WITH(tree,
[  --with-tree             add the DOM like tree manipulation APIs (on)])
if test "$with_minimum" = "yes" -a "$with_tree" = ""
then
    with_tree=no
fi
if test "$with_tree" = "no" ; then
    echo Disabling DOM like tree manipulation APIs
    WITH_TREE=0
else    
    WITH_TREE=1
fi
AC_SUBST(WITH_TREE)

William M. Brack's avatar
William M. Brack committed
571 572
AC_ARG_WITH(ftp,
[  --with-ftp              add the FTP support (on)])
573 574 575 576
if test "$with_minimum" = "yes" -a "$with_ftp" = ""
then
    with_ftp=no
fi
577 578 579 580 581 582 583 584 585 586 587
if test "$with_ftp" = "no" ; then
    echo Disabling FTP support
    WITH_FTP=0
    FTP_OBJ=
else    
    WITH_FTP=1
    FTP_OBJ=nanoftp.o
fi
AC_SUBST(WITH_FTP)
AC_SUBST(FTP_OBJ)

William M. Brack's avatar
William M. Brack committed
588 589
AC_ARG_WITH(http,
[  --with-http             add the HTTP support (on)])
590 591 592 593
if test "$with_minimum" = "yes" -a "$with_http" = ""
then
    with_http=no
fi
594 595 596 597 598 599 600 601 602 603 604
if test "$with_http" = "no" ; then
    echo Disabling HTTP support
    WITH_HTTP=0
    HTTP_OBJ=
else    
    WITH_HTTP=1
    HTTP_OBJ=nanohttp.o
fi
AC_SUBST(WITH_HTTP)
AC_SUBST(HTTP_OBJ)

605
AC_ARG_WITH(legacy,
606
[  --with-legacy           add deprecated APIs for compatibility (on)])
607 608 609 610 611 612 613 614 615 616 617 618
if test "$with_minimum" = "yes" -a "$with_legacy" = ""
then
    with_legacy=no
fi
if test "$with_legacy" = "no" ; then
    echo Disabling deprecated APIs
    WITH_LEGACY=0
else    
    WITH_LEGACY=1
fi
AC_SUBST(WITH_LEGACY)

619 620 621 622 623 624 625 626 627
AC_ARG_WITH(reader,
[  --with-reader           add the xmlReader parsing interface (on)])
if test "$with_minimum" = "yes" -a "$with_reader" = ""
then
    with_reader=no
fi
if test "$with_reader" = "no" ; then
    echo Disabling the xmlReader parsing interface
    WITH_READER=0
628
    READER_TEST=
629 630
else    
    WITH_READER=1
631
    READER_TEST=Readertests
632 633
fi
AC_SUBST(WITH_READER)
634
AC_SUBST(READER_TEST)
635

636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
AC_ARG_WITH(pattern,
[  --with-pattern           add the xmlPattern selection interface (on)])
if test "$with_minimum" = "yes" -a "$with_pattern" = ""
then
    with_pattern=no
fi
if test "$with_pattern" = "no" ; then
    echo Disabling the xmlPattern parsing interface
    WITH_PATTERN=0
    PATTERN_TEST=
else    
    WITH_PATTERN=1
    PATTERN_TEST=Patterntests
fi
AC_SUBST(WITH_PATTERN)
AC_SUBST(PATTERN_TEST)

653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
AC_ARG_WITH(writer,
[  --with-writer           add the xmlWriter saving interface (on)])
if test "$with_minimum" = "yes" -a "$with_writer" = ""
then
    with_writer=no
fi
if test "$with_writer" = "no" ; then
    echo Disabling the xmlWriter saving interface
    WITH_WRITER=0
#    WRITER_TEST=
else    
    WITH_WRITER=1
#    WRITER_TEST=Writertests
fi
AC_SUBST(WITH_WRITER)
#AC_SUBST(WRITER_TEST)

670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
AC_ARG_WITH(sax1,
[  --with-sax1             add the older SAX1 interface (on)])
if test "$with_minimum" = "yes" -a "$with_sax1" = ""
then
    with_sax1=no
fi
if test "$with_sax1" = "no" ; then
    echo Disabling the older SAX1 interface
    WITH_SAX1=0
    TEST_SAX=
else    
    WITH_SAX1=1
    TEST_SAX=SAXtests
fi
AC_SUBST(WITH_SAX1)
AC_SUBST(TEST_SAX)

687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
AC_ARG_WITH(push,
[  --with-push             add the PUSH parser interfaces (on)])
if test "$with_minimum" = "yes" -a "$with_push" = ""
then
    with_push=no
fi
if test "$with_push" = "no" ; then
    echo Disabling the PUSH parser interfaces
    WITH_PUSH=0
    TEST_PUSH=
else    
    WITH_PUSH=1
    TEST_PUSH="XMLPushtests"
fi
AC_SUBST(WITH_PUSH)
AC_SUBST(TEST_PUSH)

AC_ARG_WITH(html,
[  --with-html             add the HTML support (on)])
if test "$with_minimum" = "yes" -a "$with_html" = ""
then
    with_html=no
fi
if test "$with_html" = "no" ; then
    echo Disabling HTML support
    WITH_HTML=0
    HTML_OBJ=
    TEST_HTML=
else    
    WITH_HTML=1
    HTML_OBJ="HTMLparser.o HTMLtree.o"
    TEST_HTML=HTMLtests
719
    if test "$with_push" != "no" ; then
720 721 722 723 724 725 726 727 728 729
        TEST_PHTML=HTMLPushtests
    else
        TEST_PHTML=
    fi
fi
AC_SUBST(WITH_HTML)
AC_SUBST(HTML_OBJ)
AC_SUBST(TEST_HTML)
AC_SUBST(TEST_PHTML)

730 731 732 733 734 735
AC_ARG_WITH(valid,
[  --with-valid            add the DTD validation support (on)])
if test "$with_minimum" = "yes" -a "$with_valid" = ""
then
    with_valid=no
fi
736
if test "$with_valid" = "no" ; then
737 738 739 740 741 742 743 744 745 746 747 748
    echo Disabling DTD validation support
    WITH_VALID=0
    TEST_VALID=
    TEST_VTIME=
else    
    WITH_VALID=1
    TEST_VALID=Validtests
    TEST_VTIME=VTimingtests
fi
AC_SUBST(WITH_VALID)
AC_SUBST(TEST_VALID)
AC_SUBST(TEST_VTIME)
749

William M. Brack's avatar
William M. Brack committed
750 751
AC_ARG_WITH(catalog,
[  --with-catalog          add the Catalog support (on)])
752 753 754 755
if test "$with_minimum" = "yes" -a "$with_catalog" = ""
then
    with_catalog=no
fi
756 757 758 759
if test "$with_catalog" = "no" ; then
    echo Disabling Catalog support
    WITH_CATALOG=0
    CATALOG_OBJ=
760
    TEST_CATALOG=
761 762 763
else    
    WITH_CATALOG=1
    CATALOG_OBJ="catalog.o"
764
    TEST_CATALOG=Catatests
765 766 767
fi
AC_SUBST(WITH_CATALOG)
AC_SUBST(CATALOG_OBJ)
768
AC_SUBST(TEST_CATALOG)
769

William M. Brack's avatar
William M. Brack committed
770 771
AC_ARG_WITH(docbook,
[  --with-docbook          add Docbook SGML support (on)])
772 773 774 775
if test "$with_minimum" = "yes" -a "$with_docbook" = ""
then
    with_docbook=no
fi
776 777
if test "$with_docbook" = "no" ; then
    echo Disabling Docbook support
778 779
    WITH_DOCB=0
    DOCB_OBJ=
780 781 782
else    
    WITH_DOCB=1
    DOCB_OBJ="DOCBparser.o"
783 784 785 786 787
fi
AC_SUBST(WITH_DOCB)
AC_SUBST(DOCB_OBJ)


William M. Brack's avatar
William M. Brack committed
788 789
AC_ARG_WITH(xpath,
[  --with-xpath            add the XPATH support (on)])
790 791 792 793
if test "$with_minimum" = "yes" -a "$with_xpath" = ""
then
    with_xpath=no
fi
794 795
if test "$with_xpath" = "no" ; then
    echo Disabling XPATH support
796
    with_xptr="no"
797
    with_c14n="no"
798
    with_xinclude="no"
799 800
    WITH_XPATH=0
    XPATH_OBJ=
801
    TEST_XPATH=
802 803 804
else    
    WITH_XPATH=1
    XPATH_OBJ=xpath.o
805
    TEST_XPATH=XPathtests
806 807 808
fi
AC_SUBST(WITH_XPATH)
AC_SUBST(XPATH_OBJ)
809
AC_SUBST(TEST_XPATH)
810

William M. Brack's avatar
William M. Brack committed
811 812
AC_ARG_WITH(xptr,
[  --with-xptr             add the XPointer support (on)])
813 814 815 816
if test "$with_minimum" = "yes" -a "$with_xptr" = ""
then
    with_xptr=no
fi
817 818 819 820
if test "$with_xptr" = "no" ; then
    echo Disabling XPointer support
    WITH_XPTR=0
    XPTR_OBJ=
821
    TEST_XPTR=
822 823 824
else    
    WITH_XPTR=1
    XPTR_OBJ=xpointer.o
825
    TEST_XPTR=XPtrtests
826 827 828
fi
AC_SUBST(WITH_XPTR)
AC_SUBST(XPTR_OBJ)
829
AC_SUBST(TEST_XPTR)
830

William M. Brack's avatar
William M. Brack committed
831 832
AC_ARG_WITH(c14n,
[  --with-c14n             add the Canonicalization support (on)])
833 834 835 836
if test "$with_minimum" = "yes" -a "$with_c14n" = ""
then
    with_c14n=no
fi
837 838 839 840
if test "$with_c14n" = "no" ; then
    echo Disabling C14N support
    WITH_C14N=0
    C14N_OBJ=
841
    TEST_C14N=
842 843 844
else    
    WITH_C14N=1
    C14N_OBJ="c14n.c"
845
    TEST_C14N=C14Ntests
846 847 848
fi
AC_SUBST(WITH_C14N)
AC_SUBST(C14N_OBJ)
849
AC_SUBST(TEST_C14N)
850

William M. Brack's avatar
William M. Brack committed
851 852
AC_ARG_WITH(xinclude,
[  --with-xinclude         add the XInclude support (on)])
853 854 855 856
if test "$with_minimum" = "yes" -a "$with_xinclude" = ""
then
    with_xinclude=no
fi
857 858 859 860 861
if test "$with_xinclude" = "no" ; then
    echo Disabling XInclude support
    WITH_XINCLUDE=0
    XINCLUDE_OBJ=
    with_xinclude="no"
862
    TEST_XINCLUDE=
863 864 865
else    
    WITH_XINCLUDE=1
    XINCLUDE_OBJ=xinclude.o
866
    TEST_XINCLUDE=XIncludetests
867 868 869
fi
AC_SUBST(WITH_XINCLUDE)
AC_SUBST(XINCLUDE_OBJ)
870
AC_SUBST(TEST_XINCLUDE)
871

872
WITH_ICONV=0
William M. Brack's avatar
William M. Brack committed
873 874
AC_ARG_WITH(iconv,
[  --with-iconv[[=DIR]]      add ICONV support (on)])
875 876 877 878
if test "$with_minimum" = "yes" -a "$with_iconv" = ""
then
    with_iconv=no
fi
879 880
if test "$with_iconv" = "no" ; then
    echo Disabling ICONV support
881
else
882
    if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
883
	CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
884 885
	# Export this since our headers include iconv.h
	XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
886
	ICONV_LIBS="-L$with_iconv/lib"
887
    fi
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917

    AC_CHECK_HEADER(iconv.h,
	AC_MSG_CHECKING(for iconv)
	AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
	    AC_MSG_RESULT(yes)
	    WITH_ICONV=1],[
	    AC_MSG_RESULT(no)
	    AC_MSG_CHECKING(for iconv in -liconv)

	    _ldflags="${LDFLAGS}"
	    _libs="${LIBS}"
	    LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
	    LIBS="${LIBS} -liconv"

	    AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
		AC_MSG_RESULT(yes)
		WITH_ICONV=1
		ICONV_LIBS="${ICONV_LIBS} -liconv"
		LIBS="${_libs}"
		LDFLAGS="${_ldflags}"],[
		AC_MSG_RESULT(no)
		LIBS="${_libs}"
		LDFLAGS="${_ldflags}"])]))
fi
918 919 920 921 922 923
case "$host" in
	*mingw*) M_LIBS=""
	;;
	*) M_LIBS="-lm"
	;;
esac
924
XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
925
XML_LIBTOOLLIBS="libxml2.la"
926 927
AC_SUBST(WITH_ICONV)

928 929 930
WITH_ISO8859X=1
AC_ARG_WITH(iso8859x,
[  --with-iso8859x         add ISO8859X support if no iconv (on)])
931 932 933 934
if test "$with_minimum" = "yes" -a "$with_iso8859x" = ""
then
    with_iso8859x=no
fi
935 936 937 938 939 940 941 942
if test "$WITH_ICONV" != "1" ; then
if test "$with_iso8859x" = "no" ; then
    echo Disabling ISO8859X support
    WITH_ISO8859X=0
fi
fi
AC_SUBST(WITH_ISO8859X)

William M. Brack's avatar
William M. Brack committed
943
AC_ARG_WITH(schemas,
944
[  --with-schemas          add Relax-NG and experimental Schemas support (on)])
945 946 947 948
if test "$with_minimum" = "yes" -a "$with_schemas" = ""
then
    with_schemas=no
fi
949 950 951 952 953
if test "$with_schemas" = "no" ; then
    echo "Disabled Schemas/Relax-NG support"
    WITH_SCHEMAS=0
    TEST_SCHEMAS=
else    
954
    echo "Enabled Schemas/Relax-NG support"
955
    WITH_SCHEMAS=1
956
    TEST_SCHEMAS="Schemastests Relaxtests"
957
    with_regexps=yes
958 959 960 961
fi
AC_SUBST(WITH_SCHEMAS)
AC_SUBST(TEST_SCHEMAS)

William M. Brack's avatar
William M. Brack committed
962 963
AC_ARG_WITH(regexps,
[  --with-regexps          add Regular Expressions support (on)])
964 965 966 967
if test "$with_minimum" = "yes" -a "$with_regexps" = ""
then
    with_regexps=no
fi
968 969 970 971 972 973 974 975 976 977 978
if test "$with_regexps" = "no" ; then
    echo Disabling Regexps support
    WITH_REGEXPS=0
    TEST_REGEXPS=
else    
    WITH_REGEXPS=1
    TEST_REGEXPS="Regexptests Automatatests"
fi
AC_SUBST(WITH_REGEXPS)
AC_SUBST(TEST_REGEXPS)

William M. Brack's avatar
William M. Brack committed
979 980
AC_ARG_WITH(debug,
[  --with-debug            add the debugging module (on)])
981 982 983 984
if test "$with_minimum" = "yes" -a "$with_debug" = ""
then
    with_debug=no
fi
985 986 987 988
if test "$with_debug" = "no" ; then
    echo Disabling DEBUG support
    WITH_DEBUG=0
    DEBUG_OBJ=
989
    TEST_DEBUG=
990 991 992
else    
    WITH_DEBUG=1
    DEBUG_OBJ=debugXML.o
993
    TEST_DEBUG=Scripttests
994 995 996
fi
AC_SUBST(WITH_DEBUG)
AC_SUBST(DEBUG_OBJ)
997
AC_SUBST(TEST_DEBUG)
998

William M. Brack's avatar
William M. Brack committed
999 1000
AC_ARG_WITH(mem_debug,
[  --with-mem-debug        add the memory debugging module (off)])
1001 1002 1003 1004
if test "$with_minimum" = "yes" -a "$with_mem_debug" = ""
then
    with_mem_debug=no
fi
1005 1006 1007 1008 1009 1010 1011 1012
if test "$with_mem_debug" = "yes" ; then
    echo Enabling memory debug support
    WITH_MEM_DEBUG=1
else    
    WITH_MEM_DEBUG=0
fi
AC_SUBST(WITH_MEM_DEBUG)

1013 1014 1015 1016 1017

WIN32_EXTRA_LIBADD=
WIN32_EXTRA_LDFLAGS=
case "$host" in
 *-*-mingw*)
1018 1019
 CPPFLAGS="$CPPFLAGS -DWIN32"
 WIN32_EXTRA_LIBADD="-lws2_32"
1020 1021 1022 1023 1024 1025 1026 1027 1028
 WIN32_EXTRA_LDFLAGS="-no-undefined"
 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
 ;;
esac
AC_SUBST(WIN32_EXTRA_LIBADD)
AC_SUBST(WIN32_EXTRA_LDFLAGS)

1029
AC_SUBST(CPPFLAGS)
1030
AC_SUBST(CFLAGS)
1031
AC_SUBST(XML_CFLAGS)
1032

1033 1034
AC_SUBST(XML_LIBDIR)
AC_SUBST(XML_LIBS)
1035
AC_SUBST(XML_LIBTOOLLIBS)
1036
AC_SUBST(ICONV_LIBS)
1037 1038 1039 1040
AC_SUBST(XML_INCLUDEDIR)
AC_SUBST(HTML_DIR)
AC_SUBST(HAVE_ISNAN)
AC_SUBST(HAVE_ISINF)
1041 1042 1043
AC_SUBST(PYTHON)
AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_INCLUDES)
1044
AC_SUBST(PYTHON_SITE_PACKAGES)
1045 1046

AC_SUBST(M_LIBS)
1047
AC_SUBST(RDL_LIBS)
1048

1049 1050 1051 1052
dnl for the spec file
RELDATE=`date +'%a %b %e %Y'`
AC_SUBST(RELDATE)

1053
rm -f COPYING.LIB COPYING
1054 1055
ln -s Copyright COPYING

1056
# keep on one line for cygwin c.f. #130896
1057
AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile example/Makefile python/Makefile python/tests/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
1058

1059
chmod +x xml2-config python/setup.py