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