added Info.plist
[TestXSLT.git] / libxml2 / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 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=5
9 LIBXML_MICRO_VERSION=10
10 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
11 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
12
13 LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
14
15 AC_SUBST(LIBXML_MAJOR_VERSION)
16 AC_SUBST(LIBXML_MINOR_VERSION)
17 AC_SUBST(LIBXML_MICRO_VERSION)
18 AC_SUBST(LIBXML_VERSION)
19 AC_SUBST(LIBXML_VERSION_INFO)
20 AC_SUBST(LIBXML_VERSION_NUMBER)
21
22 VERSION=${LIBXML_VERSION}
23
24 AM_INIT_AUTOMAKE(libxml2, $VERSION)
25
26 AC_ARG_WITH(html-dir,
27 [  --with-html-dir=PATH    path to installed docs ])
28
29 dnl Checks for programs.
30 AC_PROG_CC
31 AC_PROG_INSTALL
32 AC_PROG_CPP
33 AC_PATH_PROG(RM, rm, /bin/rm)
34 AC_PATH_PROG(MV, mv, /bin/mv)
35 AC_PATH_PROG(TAR, tar, /bin/tar)
36
37 dnl Make sure we have an ANSI compiler
38 AM_C_PROTOTYPES
39 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
40
41 AM_PROG_LIBTOOL
42
43 AM_MAINTAINER_MODE
44
45 dnl Checks for zlib library.
46 _cppflags="${CPPFLAGS}"
47 _ldflags="${LDFLAGS}"
48
49
50 AC_ARG_WITH(zlib,
51 [  --with-zlib[[=DIR]]       use libz in DIR],[
52   if test "$withval" != "no" -a "$withval" != "yes"; then
53     Z_DIR=$withval
54     CPPFLAGS="${CPPFLAGS} -I$withval/include"
55     LDFLAGS="${LDFLAGS} -L$withval/lib"
56   fi
57 ])
58 if test "$with_zlib" = "no"; then
59     echo "Disabling compression support"
60 else
61     AC_CHECK_HEADERS(zlib.h,
62         AC_CHECK_LIB(z, gzread,[
63             AC_DEFINE(HAVE_LIBZ)
64             if test "x${Z_DIR}" != "x"; then
65                 Z_CFLAGS="-I${Z_DIR}/include"
66                 Z_LIBS="-L${Z_DIR}/lib -lz"
67                 [case ${host} in
68                     *-*-solaris*)
69                         Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
70                         ;;
71                 esac]
72             else
73                 Z_LIBS="-lz"
74             fi]))
75 fi
76
77 AC_SUBST(Z_CFLAGS)
78 AC_SUBST(Z_LIBS)
79
80 CPPFLAGS=${_cppflags}
81 LDFLAGS=${_ldflags}
82
83 dnl Checks for header files.
84 AC_HEADER_DIRENT
85 AC_HEADER_STDC
86 AC_CHECK_HEADERS([fcntl.h])
87 AC_CHECK_HEADERS([unistd.h])
88 AC_CHECK_HEADERS([ctype.h])
89 AC_CHECK_HEADERS([dirent.h])
90 AC_CHECK_HEADERS([errno.h])
91 AC_CHECK_HEADERS([malloc.h])
92 AC_CHECK_HEADERS([stdarg.h])
93 AC_CHECK_HEADERS([sys/stat.h])
94 AC_CHECK_HEADERS([sys/types.h])
95 AC_CHECK_HEADERS([time.h])
96 AC_CHECK_HEADERS([ansidecl.h])
97 AC_CHECK_HEADERS([ieeefp.h])
98 AC_CHECK_HEADERS([nan.h])
99 AC_CHECK_HEADERS([math.h])
100 AC_CHECK_HEADERS([fp_class.h])
101 AC_CHECK_HEADERS([float.h])
102 AC_CHECK_HEADERS([stdlib.h])
103 AC_CHECK_HEADERS([sys/socket.h], [], [],
104 [#if HAVE_SYS_TYPES_H
105 # include <sys/types.h>
106 # endif
107 ])
108 AC_CHECK_HEADERS([netinet/in.h], [], [],
109 [#if HAVE_SYS_TYPES_H
110 # include <sys/types.h>
111 # endif
112 ])
113 AC_CHECK_HEADERS([arpa/inet.h], [], [],
114 [#if HAVE_SYS_TYPES_H
115 # include <sys/types.h>
116 # endif
117 #if HAVE_ARPA_INET_H
118 # include <arpa/inet.h>
119 # endif
120 ])
121 AC_CHECK_HEADERS([netdb.h])
122 AC_CHECK_HEADERS([sys/time.h])
123 AC_CHECK_HEADERS([sys/select.h])
124 AC_CHECK_HEADERS([sys/mman.h])
125 AC_CHECK_HEADERS([sys/timeb.h])
126 AC_CHECK_HEADERS([signal.h])
127 AC_CHECK_HEADERS([arpa/nameser.h], [], [],
128 [#if HAVE_SYS_TYPES_H
129 # include <sys/types.h>
130 # endif
131 ])
132 AC_CHECK_HEADERS([resolv.h], [], [],
133 [#if HAVE_SYS_TYPES_H
134 # include <sys/types.h>
135 # endif
136 #if HAVE_NETINET_IN_H
137 # include <netinet/in.h>
138 # endif
139 #if HAVE_ARPA_NAMESER_H
140 # include <arpa/nameser.h>
141 # endif
142 ])
143
144 dnl Specific dir for HTML output ?
145 if test "x$with_html_dir" = "x" ; then
146   HTML_DIR='$(prefix)/doc'
147 else
148   HTML_DIR=$with_html_dir
149 fi
150
151 AC_SUBST(HTML_DIR)
152
153 dnl Checks for library functions.
154 AC_FUNC_STRFTIME
155 AC_CHECK_FUNCS(strdup strndup strerror)
156 AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
157 AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
158 AC_CHECK_FUNCS(stat _stat signal)
159
160 dnl Checking the standard string functions availability
161 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
162                NEED_TRIO=1)
163
164 dnl Checks for inet libraries:
165 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
166 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
167 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
168
169 dnl Determine what socket length (socklen_t) data type is
170 AC_MSG_CHECKING([for type of socket length (socklen_t)])
171 AC_TRY_COMPILE2([
172 #include <stddef.h>
173 #include <sys/types.h>
174 #include <sys/socket.h>],[
175 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
176   AC_MSG_RESULT(socklen_t *)
177   SOCKLEN_T=socklen_t],[
178   AC_TRY_COMPILE2([
179 #include <stddef.h>
180 #include <sys/types.h>
181 #include <sys/socket.h>],[
182 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
183     AC_MSG_RESULT(size_t *)
184     SOCKLEN_T=size_t],[
185     AC_TRY_COMPILE2([
186 #include <stddef.h>
187 #include <sys/types.h>
188 #include <sys/socket.h>],[
189 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
190       AC_MSG_RESULT(int *)
191       SOCKLEN_T=int],[
192       AC_MSG_WARN(could not determine)])])])
193 AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)
194
195 dnl ***********************Checking for availability of IPv6*******************
196
197 AC_MSG_CHECKING([whether to enable IPv6])
198 AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[yes/no] enables compilation of IPv6 code],, enable_ipv6=yes)
199 if test $enable_ipv6 = yes; then
200   have_ipv6=no
201   AC_TRY_COMPILE([
202     #include <sys/socket.h>
203     #include <sys/types.h>], [
204     struct sockaddr_storage ss;
205     socket(AF_INET6, SOCK_STREAM, 0)
206     ],
207     have_ipv6=yes,
208     have_ipv6=no
209   )
210   AC_MSG_RESULT($have_ipv6)
211
212   if test $have_ipv6 = yes; then
213     AC_DEFINE(SUPPORT_IP6)
214
215     have_getaddrinfo=no
216     AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
217     if test $have_getaddrinfo != yes; then
218       for lib in bsd socket inet; do
219         AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
220       done
221     fi
222
223     if test $have_getaddrinfo = yes; then
224       AC_DEFINE(HAVE_GETADDRINFO)
225     fi
226   fi
227 fi 
228
229 dnl ******************************End IPv6 checks******************************
230
231 dnl Checks for isnan in libm if not in libc
232 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
233   [AC_DEFINE(HAVE_ISNAN)]))
234
235 AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF) , AC_CHECK_LIB(m, isinf,
236   [AC_DEFINE(HAVE_ISINF)]))
237
238 XML_LIBDIR='-L${libdir}'
239 XML_INCLUDEDIR='-I${includedir}/libxml2'
240
241 dnl
242 dnl Extra flags
243 dnl
244 XML_CFLAGS=""
245 RDL_LIBS=""
246
247 AC_ARG_WITH(fexceptions,
248 [  --with-fexceptions      add GCC flag -fexceptions for C++ exceptions (off)])
249 dnl
250 dnl Workaround for native compilers
251 dnl  HP  : http://bugs.gnome.org/db/31/3163.html
252 dnl  DEC : Enable NaN/Inf
253 dnl
254 if test "${GCC}" != "yes" ; then
255     case "${host}" in
256           *-*-hpux* )
257                CFLAGS="${CFLAGS} -Wp,-H30000"
258                ;;
259           *-dec-osf* )
260                CFLAGS="${CFLAGS} -ieee"
261                ;;
262           alpha*-*-linux* )
263                CFLAGS="${CFLAGS} -ieee"
264                ;;
265     esac
266 else
267     if test "$with_fexceptions" = "yes"
268     then
269         #
270         # Not activated by default because this inflates the code size
271         # Used to allow propagation of C++ exceptions through the library
272         #
273         CFLAGS="${CFLAGS} -fexceptions"
274     fi
275        
276     CFLAGS="${CFLAGS} -Wall"
277     case "${host}" in
278           alpha*-*-linux* )
279                CFLAGS="${CFLAGS} -mieee"
280                ;;
281           alpha*-*-osf* )
282                CFLAGS="${CFLAGS} -mieee"
283                ;;
284     esac
285 fi
286 case ${host} in
287     *-*-solaris*)
288         XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
289         ;;
290     hppa*-hp-mpeix)
291         NEED_TRIO=1
292         ;;
293 esac
294
295
296 dnl
297 dnl check for python
298 dnl
299
300 PYTHON=
301 PYTHON_VERSION=
302 PYTHON_INCLUDES=
303 PYTHON_SITE_PACKAGES=
304 pythondir=
305 AC_ARG_WITH(python,
306 [  --with-python[[=DIR]]     build Python bindings if found])
307 if test "$with_python" != "no" ; then
308     if test -x "$with_python/bin/python"
309     then
310         echo Found python in $with_python/bin/python
311         PYTHON="$with_python/bin/python"
312     else
313         if test -x "$with_python"
314         then
315             echo Found python in $with_python
316             PYTHON="$with_python"
317         else
318             AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
319         fi
320     fi
321     if test "$PYTHON" != ""
322     then
323         PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
324         echo Found Python version $PYTHON_VERSION
325     fi
326     if test "$PYTHON_VERSION" != ""
327     then
328         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
329            -d $with_python/lib/python$PYTHON_VERSION/site-packages
330         then
331             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
332             PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
333         else
334             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
335             then
336                 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
337                 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
338             else
339                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
340                 then
341                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
342                     PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
343                 else
344                     echo could not find python$PYTHON_VERSION/Python.h
345                 fi
346             fi
347             if ! test -d "$PYTHON_SITE_PACKAGES"
348             then
349                     PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
350             fi
351         fi
352     fi
353     if test "$with_python" != ""
354     then
355         pythondir='$(PYTHON_SITE_PACKAGES)'
356     else
357         pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
358     fi
359 fi
360 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
361 if test "$PYTHON_INCLUDES" != ""
362 then
363     PYTHON_SUBDIR=python
364 else
365     PYTHON_SUBDIR=
366 fi
367 AC_SUBST(pythondir)
368 AC_SUBST(PYTHON_SUBDIR)
369
370 dnl
371 dnl Tester makes use of readline if present
372 dnl
373 _cppflags="${CPPFLAGS}"
374 _ldflags="${LDFLAGS}"
375
376 AC_ARG_WITH(readline,
377 [  --with-readline=DIR     use readline in DIR],[
378   if test "$withval" != "no" -a "$withval" != "yes"; then
379     RDL_DIR=$withval
380     CPPFLAGS="${CPPFLAGS} -I$withval/include"
381     LDFLAGS="${LDFLAGS} -L$withval/lib"
382   fi
383 ])
384
385 dnl
386 dnl specific tests to setup DV's devel environment with debug etc ...
387 dnl (-Wunreachable-code)
388 dnl
389 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
390     if test "${with_mem_debug}" = "" ; then
391         with_mem_debug="yes"
392     fi
393     if test "${with_docbook}" = "" ; then
394         with_docbook="yes"
395     fi
396     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 "
397     STATIC_BINARIES="-static"
398 dnl -Wcast-qual -ansi
399 else
400     STATIC_BINARIES=
401 fi
402 AC_SUBST(STATIC_BINARIES)
403
404 dnl
405 dnl Check for trio string functions
406 dnl
407
408 if test "${NEED_TRIO}" = "1" ; then
409     echo Adding trio library for string functions
410     WITH_TRIO=1
411 else    
412     WITH_TRIO=0
413 fi
414 AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
415 AC_SUBST(WITH_TRIO)
416
417 dnl
418 dnl Allow to enable/disable various pieces
419 dnl
420
421 THREAD_LIBS=""
422 WITH_THREADS=0
423 THREAD_CFLAGS=""
424 TEST_THREADS=""
425
426 AC_ARG_WITH(threads,
427 [  --with-threads          add multithread support(on)])
428 if test "$with_threads" = "no" ; then
429     echo Disabling multithreaded support
430 else
431     echo Enabling multithreaded support
432
433     AC_CHECK_HEADER(pthread.h,
434         AC_CHECK_LIB(pthread, pthread_join,[
435            THREAD_LIBS="-lpthread"
436            AC_DEFINE(HAVE_LIBPTHREAD)
437            AC_DEFINE(HAVE_PTHREAD_H)
438            WITH_THREADS="1"]))
439
440     if test "$WITH_THREADS" = "1" ; then
441         THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
442         TEST_THREADS="Threadtests"
443     fi
444 fi
445 AC_ARG_WITH(thread-alloc,
446 [  --with-thread-alloc     add per-thread memory(off)])
447 if test "$with_threads_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
448     THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
449 fi
450
451 AC_SUBST(THREAD_LIBS)
452 AC_SUBST(WITH_THREADS)
453 AC_SUBST(THREAD_CFLAGS)
454 AC_SUBST(TEST_THREADS)
455
456 AC_ARG_WITH(history,
457 [  --with-history          add history support to xmllint shell(off)])
458 if test "$with_history" = "yes" ; then
459     echo Enabling xmllint shell history
460     dnl check for terminal library. this is a very cool solution
461     dnl from octave's configure.in
462     unset tcap
463     for termlib in ncurses curses termcap terminfo termlib; do
464         AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
465         test -n "$tcap" && break
466     done
467
468     AC_CHECK_HEADER(readline/history.h,
469         AC_CHECK_LIB(history, append_history,[
470            RDL_LIBS="-lhistory"
471            AC_DEFINE(HAVE_LIBHISTORY)]))
472     AC_CHECK_HEADER(readline/readline.h,
473         AC_CHECK_LIB(readline, readline,[
474            RDL_LIBS="-lreadline $RDL_LIBS $tcap"
475            AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
476     if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
477         CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
478         RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
479     else
480         CPPFLAGS=${_cppflags}
481     fi
482     LDFLAGS=${_ldflags}
483 fi
484
485 AC_SUBST(WITH_FTP)
486 AC_SUBST(FTP_OBJ)
487 AC_ARG_WITH(ftp,
488 [  --with-ftp              add the FTP support (on)])
489 if test "$with_ftp" = "no" ; then
490     echo Disabling FTP support
491     WITH_FTP=0
492     FTP_OBJ=
493 else    
494     WITH_FTP=1
495     FTP_OBJ=nanoftp.o
496 fi
497 AC_SUBST(WITH_FTP)
498 AC_SUBST(FTP_OBJ)
499
500 AC_ARG_WITH(http,
501 [  --with-http             add the HTTP support (on)])
502 if test "$with_http" = "no" ; then
503     echo Disabling HTTP support
504     WITH_HTTP=0
505     HTTP_OBJ=
506 else    
507     WITH_HTTP=1
508     HTTP_OBJ=nanohttp.o
509 fi
510 AC_SUBST(WITH_HTTP)
511 AC_SUBST(HTTP_OBJ)
512
513 AC_ARG_WITH(html,
514 [  --with-html             add the HTML support (on)])
515 if test "$with_html" = "no" ; then
516     echo Disabling HTML support
517     WITH_HTML=0
518     HTML_OBJ=
519 else    
520     WITH_HTML=1
521     HTML_OBJ="HTMLparser.o HTMLtree.o"
522 fi
523 AC_SUBST(WITH_HTML)
524 AC_SUBST(HTML_OBJ)
525
526 AC_ARG_WITH(catalog,
527 [  --with-catalog          add the Catalog support (on)])
528 if test "$with_catalog" = "no" ; then
529     echo Disabling Catalog support
530     WITH_CATALOG=0
531     CATALOG_OBJ=
532 else    
533     WITH_CATALOG=1
534     CATALOG_OBJ="catalog.o"
535 fi
536 AC_SUBST(WITH_CATALOG)
537 AC_SUBST(CATALOG_OBJ)
538
539 AC_ARG_WITH(docbook,
540 [  --with-docbook          add Docbook SGML support (on)])
541 if test "$with_docbook" = "no" ; then
542     echo Disabling Docbook support
543     WITH_DOCB=0
544     DOCB_OBJ=
545 else    
546     WITH_DOCB=1
547     DOCB_OBJ="DOCBparser.o"
548 fi
549 AC_SUBST(WITH_DOCB)
550 AC_SUBST(DOCB_OBJ)
551
552
553 AC_ARG_WITH(xpath,
554 [  --with-xpath            add the XPATH support (on)])
555 if test "$with_xpath" = "no" ; then
556     echo Disabling XPATH support
557     with_xptr="no"
558     with_c14n="no"
559     with_xinclude="no"
560     WITH_XPATH=0
561     XPATH_OBJ=
562 else    
563     WITH_XPATH=1
564     XPATH_OBJ=xpath.o
565 fi
566 AC_SUBST(WITH_XPATH)
567 AC_SUBST(XPATH_OBJ)
568
569 AC_ARG_WITH(xptr,
570 [  --with-xptr             add the XPointer support (on)])
571 if test "$with_xptr" = "no" ; then
572     echo Disabling XPointer support
573     WITH_XPTR=0
574     XPTR_OBJ=
575 else    
576     WITH_XPTR=1
577     XPTR_OBJ=xpointer.o
578 fi
579 AC_SUBST(WITH_XPTR)
580 AC_SUBST(XPTR_OBJ)
581
582 AC_ARG_WITH(c14n,
583 [  --with-c14n             add the Canonicalization support (on)])
584 if test "$with_c14n" = "no" ; then
585     echo Disabling C14N support
586     WITH_C14N=0
587     C14N_OBJ=
588 else    
589     WITH_C14N=1
590     C14N_OBJ="c14n.c"
591 fi
592 AC_SUBST(WITH_C14N)
593 AC_SUBST(C14N_OBJ)
594
595 AC_ARG_WITH(xinclude,
596 [  --with-xinclude         add the XInclude support (on)])
597 if test "$with_xinclude" = "no" ; then
598     echo Disabling XInclude support
599     WITH_XINCLUDE=0
600     XINCLUDE_OBJ=
601     with_xinclude="no"
602 else    
603     WITH_XINCLUDE=1
604     XINCLUDE_OBJ=xinclude.o
605 fi
606 AC_SUBST(WITH_XINCLUDE)
607 AC_SUBST(XINCLUDE_OBJ)
608
609 WITH_ICONV=0
610 AC_ARG_WITH(iconv,
611 [  --with-iconv[[=DIR]]      add ICONV support (on)])
612 if test "$with_iconv" = "no" ; then
613     echo Disabling ICONV support
614 else
615     if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
616         CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
617         # Export this since our headers include iconv.h
618         XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
619         ICONV_LIBS="-L$with_iconv/lib"
620     fi
621
622     AC_CHECK_HEADER(iconv.h,
623         AC_MSG_CHECKING(for iconv)
624         AC_TRY_LINK([#include <stdlib.h>
625 #include <iconv.h>],[
626 iconv_t cd = iconv_open ("","");
627 iconv (cd, NULL, NULL, NULL, NULL);],[
628             AC_MSG_RESULT(yes)
629             WITH_ICONV=1],[
630             AC_MSG_RESULT(no)
631             AC_MSG_CHECKING(for iconv in -liconv)
632
633             _ldflags="${LDFLAGS}"
634             _libs="${LIBS}"
635             LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
636             LIBS="${LIBS} -liconv"
637
638             AC_TRY_LINK([#include <stdlib.h>
639 #include <iconv.h>],[
640 iconv_t cd = iconv_open ("","");
641 iconv (cd, NULL, NULL, NULL, NULL);],[
642                 AC_MSG_RESULT(yes)
643                 WITH_ICONV=1
644                 ICONV_LIBS="${ICONV_LIBS} -liconv"
645                 LIBS="${_libs}"
646                 LDFLAGS="${_ldflags}"],[
647                 AC_MSG_RESULT(no)
648                 LIBS="${_libs}"
649                 LDFLAGS="${_ldflags}"])]))
650 fi
651 M_LIBS="-lm"
652 XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
653 AC_SUBST(WITH_ICONV)
654
655 WITH_ISO8859X=1
656 AC_ARG_WITH(iso8859x,
657 [  --with-iso8859x         add ISO8859X support if no iconv (on)])
658 if test "$WITH_ICONV" != "1" ; then
659 if test "$with_iso8859x" = "no" ; then
660     echo Disabling ISO8859X support
661     WITH_ISO8859X=0
662 fi
663 fi
664 AC_SUBST(WITH_ISO8859X)
665
666 AC_ARG_WITH(schemas,
667 [  --with-schemas          add experimental Schemas/RelaxNG support (on)])
668 if test "$with_schemas" = "no" ; then
669     echo "Disabled Schemas/Relax-NG support"
670     WITH_SCHEMAS=0
671     TEST_SCHEMAS=
672 else    
673     echo "Enabled Schemas/Relax-NG support"
674     WITH_SCHEMAS=1
675     TEST_SCHEMAS="Schemastests Relaxtests"
676     with_regexps=yes
677 fi
678 AC_SUBST(WITH_SCHEMAS)
679 AC_SUBST(TEST_SCHEMAS)
680
681 AC_ARG_WITH(regexps,
682 [  --with-regexps          add Regular Expressions support (on)])
683 if test "$with_regexps" = "no" ; then
684     echo Disabling Regexps support
685     WITH_REGEXPS=0
686     TEST_REGEXPS=
687 else    
688     WITH_REGEXPS=1
689     TEST_REGEXPS="Regexptests Automatatests"
690 fi
691 AC_SUBST(WITH_REGEXPS)
692 AC_SUBST(TEST_REGEXPS)
693
694 AC_ARG_WITH(debug,
695 [  --with-debug            add the debugging module (on)])
696 if test "$with_debug" = "no" ; then
697     echo Disabling DEBUG support
698     WITH_DEBUG=0
699     DEBUG_OBJ=
700 else    
701     WITH_DEBUG=1
702     DEBUG_OBJ=debugXML.o
703 fi
704 AC_SUBST(WITH_DEBUG)
705 AC_SUBST(DEBUG_OBJ)
706
707 AC_ARG_WITH(mem_debug,
708 [  --with-mem-debug        add the memory debugging module (off)])
709 if test "$with_mem_debug" = "yes" ; then
710     echo Enabling memory debug support
711     WITH_MEM_DEBUG=1
712 else    
713     WITH_MEM_DEBUG=0
714 fi
715 AC_SUBST(WITH_MEM_DEBUG)
716
717
718 WIN32_EXTRA_LIBADD=
719 WIN32_EXTRA_LDFLAGS=
720 case "$host" in
721  *-*-mingw*)
722  WIN32_EXTRA_LIBADD="-lwsock32"
723  WIN32_EXTRA_LDFLAGS="-no-undefined"
724  AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
725  AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
726  AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
727  ;;
728 esac
729 AC_SUBST(WIN32_EXTRA_LIBADD)
730 AC_SUBST(WIN32_EXTRA_LDFLAGS)
731
732
733 AC_SUBST(CFLAGS)
734 AC_SUBST(XML_CFLAGS)
735
736 AC_SUBST(XML_LIBDIR)
737 AC_SUBST(XML_LIBS)
738 AC_SUBST(ICONV_LIBS)
739 AC_SUBST(XML_INCLUDEDIR)
740 AC_SUBST(HTML_DIR)
741 AC_SUBST(HAVE_ISNAN)
742 AC_SUBST(HAVE_ISINF)
743 AC_SUBST(PYTHON)
744 AC_SUBST(PYTHON_VERSION)
745 AC_SUBST(PYTHON_INCLUDES)
746 AC_SUBST(PYTHON_SITE_PACKAGES)
747
748 AC_SUBST(M_LIBS)
749 AC_SUBST(RDL_LIBS)
750
751 dnl for the spec file
752 RELDATE=`date +'%a %b %e %Y'`
753 AC_SUBST(RELDATE)
754
755 rm -f COPYING.LIB COPYING
756 ln -s Copyright COPYING
757
758 AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile example/Makefile python/Makefile python/tests/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc xml2Conf.sh python/setup.py)
759
760 chmod +x xml2-config xml2Conf.sh python/setup.py