VirtualBox

source: vbox/trunk/src/libs/libxml2-2.9.14/configure.ac@ 102948

Last change on this file since 102948 was 95312, checked in by vboxsync, 2 years ago

libs/{curl,libxml2}: OSE export fixes, bugref:8515

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette