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