blob: 0fb498316c43cee760ff32bfd62888ee9b24401c [file] [log] [blame]
Daniel Veillard01791d51998-07-24 19:24:09 +00001dnl Process this file with autoconf to produce a configure script.
Adrian Bunk64b0d602010-11-04 09:43:31 +01002AC_PREREQ(2.59)
Owen Taylor3473f882001-02-23 17:55:21 +00003AC_INIT(entities.c)
Daniel Veillard01791d51998-07-24 19:24:09 +00004AM_CONFIG_HEADER(config.h)
Daniel Veillard3157e512010-03-09 11:32:46 +01005AC_CONFIG_MACRO_DIR([m4])
Daniel Veillardd2ade932000-09-30 14:39:55 +00006AC_CANONICAL_HOST
Daniel Veillard14fff061999-06-22 21:49:07 +00007
Daniel Veillardcf461992000-03-14 18:30:20 +00008LIBXML_MAJOR_VERSION=2
Daniel Veillardc943f702012-05-23 17:10:59 +08009LIBXML_MINOR_VERSION=8
10LIBXML_MICRO_VERSION=0
Daniel Veillard3e35f8e2003-10-21 00:05:38 +000011LIBXML_MICRO_VERSION_SUFFIX=
Daniel Veillard4fc52812003-09-01 20:33:13 +000012LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
Daniel Veillard14fff061999-06-22 21:49:07 +000013LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
14
Daniel Veillard361d8452000-04-03 19:48:13 +000015LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
16
Daniel Veillard9cb1b642007-01-03 15:07:44 +000017if test -f CVS/Entries ; then
Daniel Veillarddab93ea2004-08-20 16:47:10 +000018 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
19 echo extra=$extra
20 if test "$extra" != ""
21 then
22 LIBXML_VERSION_EXTRA="-CVS$extra"
23 fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000024else if test -d .svn ; then
25 extra=`svn info | grep Revision | sed 's+Revision: ++'`
26 echo extra=$extra
27 if test "$extra" != ""
28 then
29 LIBXML_VERSION_EXTRA="-SVN$extra"
30 fi
veillard97c7be62009-05-12 08:43:54 +020031else if test -d .git ; then
Christian Dywan040dcb52012-05-10 22:55:07 +080032 extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'`
veillard97c7be62009-05-12 08:43:54 +020033 echo extra=$extra
34 if test "$extra" != ""
35 then
36 LIBXML_VERSION_EXTRA="-GIT$extra"
37 fi
38fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000039fi
William M. Brackf4025492004-08-18 21:08:46 +000040fi
Daniel Veillard14fff061999-06-22 21:49:07 +000041AC_SUBST(LIBXML_MAJOR_VERSION)
42AC_SUBST(LIBXML_MINOR_VERSION)
43AC_SUBST(LIBXML_MICRO_VERSION)
44AC_SUBST(LIBXML_VERSION)
45AC_SUBST(LIBXML_VERSION_INFO)
Daniel Veillard361d8452000-04-03 19:48:13 +000046AC_SUBST(LIBXML_VERSION_NUMBER)
William M. Brackf4025492004-08-18 21:08:46 +000047AC_SUBST(LIBXML_VERSION_EXTRA)
Daniel Veillard14fff061999-06-22 21:49:07 +000048
Daniel Veillard361d8452000-04-03 19:48:13 +000049VERSION=${LIBXML_VERSION}
Daniel Veillard14fff061999-06-22 21:49:07 +000050
Daniel Veillardedfb29b2000-03-14 19:59:05 +000051AM_INIT_AUTOMAKE(libxml2, $VERSION)
Daniel Veillard1164e751999-02-16 16:29:17 +000052
Stefan Kostc9c939d2011-05-10 10:34:41 +030053# Support silent build rules, requires at least automake-1.11. Disable
54# by either passing --disable-silent-rules to configure or passing V=1
55# to make
56m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
57
Daniel Veillard01791d51998-07-24 19:24:09 +000058dnl Checks for programs.
59AC_PROG_CC
60AC_PROG_INSTALL
Adrian Bunk64b0d602010-11-04 09:43:31 +010061AC_PROG_MKDIR_P
Sebastian Wilhelmia44c8a41998-08-07 08:38:58 +000062AC_PROG_CPP
Daniel Veillard01791d51998-07-24 19:24:09 +000063AC_PATH_PROG(RM, rm, /bin/rm)
64AC_PATH_PROG(MV, mv, /bin/mv)
65AC_PATH_PROG(TAR, tar, /bin/tar)
William M. Brack1826d0a2004-07-21 09:03:57 +000066AC_PATH_PROG(PERL, perl, /usr/bin/perl)
Daniel Veillard33a2de92006-10-11 08:33:22 +000067AC_PATH_PROG(WGET, wget, /usr/bin/wget)
Daniel Veillard8b817da2004-09-30 09:19:33 +000068AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
Daniel Veillard06500c82004-09-07 09:12:44 +000069AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
Daniel Veillard01791d51998-07-24 19:24:09 +000070
Daniel Veillard6984e6d2003-12-09 14:20:17 +000071AC_LIBTOOL_WIN32_DLL
Daniel Veillard01791d51998-07-24 19:24:09 +000072AM_PROG_LIBTOOL
73
Daniel Veillard4432df22003-09-28 18:58:27 +000074dnl
Daniel Veillard8ed10722009-08-20 19:17:36 +020075dnl if the system support linker version scripts for symbol versioning
76dnl then add it
77dnl
78VERSION_SCRIPT_FLAGS=
Roumen Petrovf39adc22010-03-11 14:49:13 +010079# lt_cv_prog_gnu_ld is from libtool 2.+
80if test "$lt_cv_prog_gnu_ld" = yes; then
81 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
82else
83 case $host in
84 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
85 esac
86fi
Daniel Veillard8ed10722009-08-20 19:17:36 +020087AC_SUBST(VERSION_SCRIPT_FLAGS)
Daniel Veillard00819872010-11-04 21:53:14 +010088AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
Daniel Veillard8ed10722009-08-20 19:17:36 +020089
90dnl
William M. Brack21e4ef22005-01-02 09:53:13 +000091dnl We process the AC_ARG_WITH first so that later we can modify
92dnl some of them to try to prevent impossible combinations. This
93dnl also allows up so alphabetize the choices
Daniel Veillard4432df22003-09-28 18:58:27 +000094dnl
Daniel Veillard4432df22003-09-28 18:58:27 +000095
William M. Brack21e4ef22005-01-02 09:53:13 +000096dnl
97dnl zlib option might change flags, so we save them initially
98dnl
Owen Taylor3473f882001-02-23 17:55:21 +000099_cppflags="${CPPFLAGS}"
100_ldflags="${LDFLAGS}"
Daniel Veillard71b656e2000-01-05 14:46:17 +0000101
William M. Brack21e4ef22005-01-02 09:53:13 +0000102AC_ARG_WITH(c14n,
103[ --with-c14n add the Canonicalization support (on)])
104AC_ARG_WITH(catalog,
105[ --with-catalog add the Catalog support (on)])
106AC_ARG_WITH(debug,
107[ --with-debug add the debugging module (on)])
108AC_ARG_WITH(docbook,
109[ --with-docbook add Docbook SGML support (on)])
110AC_ARG_WITH(fexceptions,
111[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
112AC_ARG_WITH(ftp,
113[ --with-ftp add the FTP support (on)])
114AC_ARG_WITH(history,
115[ --with-history add history support to xmllint shell(off)])
116AC_ARG_WITH(html,
117[ --with-html add the HTML support (on)])
118dnl Specific dir for HTML output ?
119AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
120 [path to base html directory, default $datadir/doc/html]),
121 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
Daniel Veillard259ff742001-10-06 13:49:59 +0000122
William M. Brack21e4ef22005-01-02 09:53:13 +0000123AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
124 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
125 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
126 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
127AC_SUBST(HTML_DIR)
128AC_ARG_WITH(http,
129[ --with-http add the HTTP support (on)])
130AC_ARG_WITH(iconv,
131[ --with-iconv[[=DIR]] add ICONV support (on)])
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +0100132AC_ARG_WITH(icu,
133[ --with-icu add ICU support (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000134AC_ARG_WITH(iso8859x,
135[ --with-iso8859x add ISO8859X support if no iconv (on)])
136AC_ARG_WITH(legacy,
137[ --with-legacy add deprecated APIs for compatibility (on)])
138AC_ARG_WITH(mem_debug,
139[ --with-mem-debug add the memory debugging module (off)])
140AC_ARG_WITH(minimum,
141[ --with-minimum build a minimally sized library (off)])
142AC_ARG_WITH(output,
143[ --with-output add the serialization support (on)])
144AC_ARG_WITH(pattern,
145[ --with-pattern add the xmlPattern selection interface (on)])
146AC_ARG_WITH(push,
147[ --with-push add the PUSH parser interfaces (on)])
148AC_ARG_WITH(python,
149[ --with-python[[=DIR]] build Python bindings if found])
150AC_ARG_WITH(reader,
151[ --with-reader add the xmlReader parsing interface (on)])
152AC_ARG_WITH(readline,
153[ --with-readline=DIR use readline in DIR],[
154 if test "$withval" != "no" -a "$withval" != "yes"; then
155 RDL_DIR=$withval
156 CPPFLAGS="${CPPFLAGS} -I$withval/include"
157 LDFLAGS="${LDFLAGS} -L$withval/lib"
158 fi
159])
160AC_ARG_WITH(regexps,
161[ --with-regexps add Regular Expressions support (on)])
162AC_ARG_WITH(run_debug,
163[ --with-run-debug add the runtime debugging module (off)])
164AC_ARG_WITH(sax1,
165[ --with-sax1 add the older SAX1 interface (on)])
166AC_ARG_WITH(schemas,
Daniel Veillard39e5c892005-07-03 22:48:50 +0000167[ --with-schemas add Relax-NG and Schemas support (on)])
Daniel Veillarded6c5492005-07-23 15:00:22 +0000168AC_ARG_WITH(schematron,
169[ --with-schematron add Schematron support (on)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000170AC_ARG_WITH(threads,
171[ --with-threads add multithread support(on)])
172AC_ARG_WITH(thread-alloc,
173[ --with-thread-alloc add per-thread memory(off)])
174AC_ARG_WITH(tree,
175[ --with-tree add the DOM like tree manipulation APIs (on)])
176AC_ARG_WITH(valid,
177[ --with-valid add the DTD validation support (on)])
178AC_ARG_WITH(writer,
179[ --with-writer add the xmlWriter saving interface (on)])
180AC_ARG_WITH(xinclude,
181[ --with-xinclude add the XInclude support (on)])
182AC_ARG_WITH(xpath,
183[ --with-xpath add the XPATH support (on)])
184AC_ARG_WITH(xptr,
185[ --with-xptr add the XPointer support (on)])
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000186AC_ARG_WITH(modules,
187[ --with-modules add the dynamic modules support (on)])
Owen Taylor3473f882001-02-23 17:55:21 +0000188AC_ARG_WITH(zlib,
William M. Brack97ad4c72003-05-13 08:08:36 +0000189[ --with-zlib[[=DIR]] use libz in DIR],[
Owen Taylor3473f882001-02-23 17:55:21 +0000190 if test "$withval" != "no" -a "$withval" != "yes"; then
191 Z_DIR=$withval
192 CPPFLAGS="${CPPFLAGS} -I$withval/include"
193 LDFLAGS="${LDFLAGS} -L$withval/lib"
194 fi
Daniel Veillard259ff742001-10-06 13:49:59 +0000195])
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200196AC_ARG_WITH(lzma,
197[ --with-lzma[[=DIR]] use liblzma in DIR],[
198 if test "$withval" != "no" -a "$withval" != "yes"; then
199 LZMA_DIR=$withval
200 CPPFLAGS="${CPPFLAGS} -I$withval/include"
201 LDFLAGS="${LDFLAGS} -L$withval/lib"
202 fi
203])
Daniel Veillardbfa5cf12008-08-27 15:33:28 +0000204AC_ARG_WITH(coverage,
205[ --with-coverage build for code coverage with GCC (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000206
Daniel Veillardb40744e2008-10-17 13:26:44 +0000207AC_ARG_ENABLE(rebuild-docs,
208[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
209AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
210
William M. Brack21e4ef22005-01-02 09:53:13 +0000211dnl
Daniel Veillard39e5c892005-07-03 22:48:50 +0000212dnl hard dependancies on options
213dnl
214if test "$with_schemas" = "yes"
215then
216 with_pattern=yes
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000217 with_regexps=yes
Daniel Veillard39e5c892005-07-03 22:48:50 +0000218fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000219if test "$with_schematron" = "yes"
220then
221 with_pattern=yes
222 with_xpath=yes
223fi
Daniel Veillard39e5c892005-07-03 22:48:50 +0000224if test "$with_reader" = "yes"
225then
226 with_push=yes
227fi
228if test "$with_xptr" = "yes"
229then
230 with_xpath=yes
231fi
232dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000233dnl option to build a minimal libxml2 library
234dnl
235if test "$with_minimum" = "yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000236then
William M. Brack21e4ef22005-01-02 09:53:13 +0000237 echo "Configuring for a minimal library"
238 if test "$with_c14n" = ""
239 then
240 with_c14n=no
241 fi
242 if test "$with_catalog" = ""
243 then
244 with_catalog=no
245 fi
246 echo So far so good!
247 if test "$with_debug" = ""
248 then
249 with_debug=no
250 fi
251 if test "$with_docbook" = ""
252 then
253 with_docbook=no
254 fi
255 if test "$with_fexceptions" = ""
256 then
257 with_fexceptions=no
258 fi
259 if test "$with_ftp" = ""
260 then
261 with_ftp=no
262 fi
263 if test "$with_history" = ""
264 then
265 with_history=no
266 fi
267 if test "$with_html" = ""
268 then
269 with_html=no
270 fi
271 if test "$with_http" = ""
272 then
273 with_http=no
274 fi
275 if test "$with_iconv" = ""
276 then
277 with_iconv=no
278 fi
279 if test "$with_iso8859x" = ""
280 then
281 with_iso8859x=no
282 fi
283 if test "$with_legacy" = ""
284 then
285 with_legacy=no
286 fi
287 if test "$with_mem_debug" = ""
288 then
289 with_mem_debug=no
290 fi
291 if test "$with_output" = ""
292 then
293 with_output=no
294 fi
295 if test "$with_pattern" = ""
296 then
297 with_pattern=no
298 fi
299 if test "$with_push" = ""
300 then
301 with_push=no
302 fi
303 if test "$with_python" = ""
304 then
305 with_python=no
306 fi
307 if test "$with_reader" = ""
308 then
309 with_reader=no
310 fi
311 if test "$with_readline" = ""
312 then
313 with_readline=no
314 fi
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000315 if test "$with_regexps" = ""
William M. Brack21e4ef22005-01-02 09:53:13 +0000316 then
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000317 with_regexps=no
William M. Brack21e4ef22005-01-02 09:53:13 +0000318 fi
319 if test "$with_run_debug" = ""
320 then
321 with_run_debug=no
322 fi
323 if test "$with_sax1" = ""
324 then
325 with_sax1=no
326 fi
327 if test "$with_schemas" = ""
328 then
329 with_schemas=no
330 fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000331 if test "$with_schematron" = ""
332 then
333 with_schematron=no
334 fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000335 if test "$with_threads" = ""
336 then
337 with_threads=no
338 fi
339 if test "$with_thread_alloc" = ""
340 then
341 with_thread_alloc=no
342 fi
343 if test "$with_tree" = ""
344 then
345 with_tree=no
346 fi
347 if test "$with_valid" = ""
348 then
349 with_valid=no
350 fi
351 if test "$with_writer" = ""
352 then
353 with_writer=no
354 fi
355 if test "$with_xinclude" = ""
356 then
357 with_xinclude=no
358 fi
359 if test "$with_xpath" = ""
360 then
361 with_xpath=no
362 fi
363 if test "$with_xptr" = ""
364 then
365 with_xptr=no
366 fi
367 if test "$with_zlib" = ""
368 then
369 with_zlib=no
370 fi
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000371 if test "$with_modules" = ""
372 then
373 with_modules=no
374 fi
Daniel Veillard4432df22003-09-28 18:58:27 +0000375fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000376
377echo Checking zlib
378
379dnl Checks for zlib library.
380
Daniel Veillard75acfee2006-07-13 06:29:56 +0000381WITH_ZLIB=0
Daniel Veillard259ff742001-10-06 13:49:59 +0000382if test "$with_zlib" = "no"; then
383 echo "Disabling compression support"
384else
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000385 AC_CHECK_HEADERS(zlib.h,
386 AC_CHECK_LIB(z, gzread,[
Daniel Veillard75acfee2006-07-13 06:29:56 +0000387 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
388 WITH_ZLIB=1
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000389 if test "x${Z_DIR}" != "x"; then
390 Z_CFLAGS="-I${Z_DIR}/include"
391 Z_LIBS="-L${Z_DIR}/lib -lz"
392 [case ${host} in
393 *-*-solaris*)
394 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
395 ;;
396 esac]
397 else
398 Z_LIBS="-lz"
399 fi]))
Daniel Veillard259ff742001-10-06 13:49:59 +0000400fi
Owen Taylor3473f882001-02-23 17:55:21 +0000401
Owen Taylor3473f882001-02-23 17:55:21 +0000402AC_SUBST(Z_CFLAGS)
403AC_SUBST(Z_LIBS)
Daniel Veillard75acfee2006-07-13 06:29:56 +0000404AC_SUBST(WITH_ZLIB)
Owen Taylor3473f882001-02-23 17:55:21 +0000405
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200406echo Checking lzma
407
408dnl Checks for lzma library.
409
410WITH_LZMA=0
411if test "$with_lzma" = "no"; then
412 echo "Disabling compression support"
413else
414 AC_CHECK_HEADERS(lzma.h,
415 AC_CHECK_LIB(lzma, lzma_code,[
416 AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
417 WITH_LZMA=1
418 if test "x${LZMA_DIR}" != "x"; then
419 LZMA_CFLAGS="-I${LZMA_DIR}/include"
420 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
421 else
422 LZMA_LIBS="-llzma"
423 fi]))
424fi
425
426AC_SUBST(LZMA_CFLAGS)
427AC_SUBST(LZMA_LIBS)
428AC_SUBST(WITH_LZMA)
429
Owen Taylor3473f882001-02-23 17:55:21 +0000430CPPFLAGS=${_cppflags}
431LDFLAGS=${_ldflags}
Daniel Veillardb05deb71999-08-10 19:04:08 +0000432
William M. Brack21e4ef22005-01-02 09:53:13 +0000433echo Checking headers
434
Daniel Veillard01791d51998-07-24 19:24:09 +0000435dnl Checks for header files.
436AC_HEADER_DIRENT
437AC_HEADER_STDC
Daniel Veillard817e70b2002-11-19 22:28:48 +0000438AC_CHECK_HEADERS([fcntl.h])
439AC_CHECK_HEADERS([unistd.h])
440AC_CHECK_HEADERS([ctype.h])
441AC_CHECK_HEADERS([dirent.h])
442AC_CHECK_HEADERS([errno.h])
443AC_CHECK_HEADERS([malloc.h])
444AC_CHECK_HEADERS([stdarg.h])
445AC_CHECK_HEADERS([sys/stat.h])
446AC_CHECK_HEADERS([sys/types.h])
Daniel Veillard7f4547c2008-10-03 07:58:23 +0000447AC_CHECK_HEADERS([stdint.h])
Daniel Mustielesbde9c352012-03-19 21:39:58 +0100448AC_CHECK_HEADERS([inttypes.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000449AC_CHECK_HEADERS([time.h])
450AC_CHECK_HEADERS([ansidecl.h])
451AC_CHECK_HEADERS([ieeefp.h])
452AC_CHECK_HEADERS([nan.h])
453AC_CHECK_HEADERS([math.h])
Daniel Veillardebe48c62003-12-03 12:12:27 +0000454AC_CHECK_HEADERS([limits.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000455AC_CHECK_HEADERS([fp_class.h])
456AC_CHECK_HEADERS([float.h])
457AC_CHECK_HEADERS([stdlib.h])
458AC_CHECK_HEADERS([sys/socket.h], [], [],
459[#if HAVE_SYS_TYPES_H
460# include <sys/types.h>
461# endif
462])
463AC_CHECK_HEADERS([netinet/in.h], [], [],
464[#if HAVE_SYS_TYPES_H
465# include <sys/types.h>
466# endif
467])
468AC_CHECK_HEADERS([arpa/inet.h], [], [],
469[#if HAVE_SYS_TYPES_H
470# include <sys/types.h>
471# endif
472#if HAVE_ARPA_INET_H
473# include <arpa/inet.h>
474# endif
475])
476AC_CHECK_HEADERS([netdb.h])
477AC_CHECK_HEADERS([sys/time.h])
478AC_CHECK_HEADERS([sys/select.h])
Raphael Prevost48b60c32009-08-23 13:11:01 +0200479AC_CHECK_HEADERS([poll.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000480AC_CHECK_HEADERS([sys/mman.h])
481AC_CHECK_HEADERS([sys/timeb.h])
482AC_CHECK_HEADERS([signal.h])
483AC_CHECK_HEADERS([arpa/nameser.h], [], [],
484[#if HAVE_SYS_TYPES_H
485# include <sys/types.h>
486# endif
487])
488AC_CHECK_HEADERS([resolv.h], [], [],
489[#if HAVE_SYS_TYPES_H
490# include <sys/types.h>
491# endif
492#if HAVE_NETINET_IN_H
493# include <netinet/in.h>
494# endif
495#if HAVE_ARPA_NAMESER_H
496# include <arpa/nameser.h>
497# endif
498])
Daniel Veillarddcd93902005-01-13 11:25:15 +0000499AC_CHECK_HEADERS([dl.h])
500AC_CHECK_HEADERS([dlfcn.h])
Daniel Veillard01791d51998-07-24 19:24:09 +0000501
Daniel Veillardfc979062004-03-04 22:07:16 +0000502
William M. Brack21e4ef22005-01-02 09:53:13 +0000503echo Checking libraries
Daniel Veillard1164e751999-02-16 16:29:17 +0000504
Daniel Veillard01791d51998-07-24 19:24:09 +0000505dnl Checks for library functions.
506AC_FUNC_STRFTIME
Daniel Veillard92ad2102001-03-27 12:47:33 +0000507AC_CHECK_FUNCS(strdup strndup strerror)
Daniel Veillard71b656e2000-01-05 14:46:17 +0000508AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
Daniel Veillard90bc3712002-03-07 15:12:58 +0000509AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
Daniel Veillard068a9652001-06-07 15:30:26 +0000510AC_CHECK_FUNCS(stat _stat signal)
Daniel Veillardd495e6a2012-05-20 20:48:34 +0800511AC_CHECK_FUNCS(rand rand_r srand time)
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000512
William M. Brackf4caa5e2005-10-20 09:04:05 +0000513dnl Checking for va_copy availability
514AC_MSG_CHECKING([for va_copy])
515AC_TRY_LINK([#include <stdarg.h>
516va_list ap1,ap2;], [va_copy(ap1,ap2);],
517have_va_copy=yes,
518have_va_copy=no)
519AC_MSG_RESULT($have_va_copy)
520if test x"$have_va_copy" = x"yes"; then
521 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
522else
523 AC_MSG_CHECKING([for __va_copy])
524 AC_TRY_LINK([#include <stdarg.h>
525 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
526 have___va_copy=yes,
527 have___va_copy=no)
528 AC_MSG_RESULT($have___va_copy)
529 if test x"$have___va_copy" = x"yes"; then
530 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
531 fi
532fi
533
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000534dnl Checks for inet libraries:
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000535AC_SEARCH_LIBS(gethostent, [nsl])
Scott McCreary59f53082009-08-26 09:55:24 +0200536AC_SEARCH_LIBS(setsockopt, [socket net network])
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000537AC_SEARCH_LIBS(connect, [inet])
Daniel Veillardb05deb71999-08-10 19:04:08 +0000538
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000539dnl Determine what socket length (socklen_t) data type is
540AC_MSG_CHECKING([for type of socket length (socklen_t)])
541AC_TRY_COMPILE2([
542#include <stddef.h>
543#include <sys/types.h>
544#include <sys/socket.h>],[
545(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
546 AC_MSG_RESULT(socklen_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000547 XML_SOCKLEN_T=socklen_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000548 AC_TRY_COMPILE2([
549#include <stddef.h>
550#include <sys/types.h>
551#include <sys/socket.h>],[
552(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
553 AC_MSG_RESULT(size_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000554 XML_SOCKLEN_T=size_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000555 AC_TRY_COMPILE2([
556#include <stddef.h>
557#include <sys/types.h>
558#include <sys/socket.h>],[
559(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
560 AC_MSG_RESULT(int *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000561 XML_SOCKLEN_T=int],[
William M. Brack2e6b1432004-02-09 15:10:28 +0000562 AC_MSG_WARN(could not determine)
Daniel Veillardc284c642005-03-31 10:24:24 +0000563 XML_SOCKLEN_T="int"])])])
564AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000565
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000566dnl ***********************Checking for availability of IPv6*******************
567
568AC_MSG_CHECKING([whether to enable IPv6])
William M. Brack21e4ef22005-01-02 09:53:13 +0000569AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
Daniel Veillard4432df22003-09-28 18:58:27 +0000570if test "$with_minimum" = "yes"
571then
572 enable_ipv6=no
573fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000574if test $enable_ipv6 = yes; then
575 have_ipv6=no
576 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000577 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000578 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000579 ], [
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000580 struct sockaddr_storage ss;
581 socket(AF_INET6, SOCK_STREAM, 0)
582 ],
583 have_ipv6=yes,
584 have_ipv6=no
585 )
586 AC_MSG_RESULT($have_ipv6)
587
William M. Brack476cd962003-08-13 11:09:42 +0000588 if test $have_ipv6 = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000589 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000590 have_broken_ss_family=no
591
592 dnl *********************************************************************
593 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
594 dnl a ss_family member, but rather __ss_family. Let's detect that
William M. Brack7d8b36b2005-06-25 07:30:50 +0000595 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
596 dnl platforms. However, we should only do this if ss_family is not
597 dnl present.
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000598 dnl ********************************************************************
William M. Brack7d8b36b2005-06-25 07:30:50 +0000599 AC_MSG_CHECKING([struct sockaddr::ss_family])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000600 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000601 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000602 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000603 ], [
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000604 struct sockaddr_storage ss ;
William M. Brack7d8b36b2005-06-25 07:30:50 +0000605 ss.ss_family = 0 ;
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000606 ],
William M. Brack7d8b36b2005-06-25 07:30:50 +0000607 have_ss_family=yes,
608 have_ss_family=no
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000609 )
William M. Brack7d8b36b2005-06-25 07:30:50 +0000610 AC_MSG_RESULT($have_ss_family)
611 if test x$have_ss_family = xno ; then
612 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
613 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000614 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000615 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000616 ], [
William M. Brack7d8b36b2005-06-25 07:30:50 +0000617 struct sockaddr_storage ss ;
618 ss.__ss_family = 0 ;
619 ],
620 have_broken_ss_family=yes,
621 have_broken_ss_family=no
622 )
623 AC_MSG_RESULT($have_broken_ss_family)
624 if test x$have_broken_ss_family = xyes ; then
625 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
626 [Whether struct sockaddr::__ss_family exists])
627 AC_DEFINE(ss_family, __ss_family,
628 [ss_family is not defined here, use __ss_family instead])
629 else
630 AC_MSG_WARN(ss_family and __ss_family not found)
631 fi
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000632 fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000633
634 have_getaddrinfo=no
635 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
636 if test $have_getaddrinfo != yes; then
637 for lib in bsd socket inet; do
638 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
639 done
640 fi
641
William M. Brack476cd962003-08-13 11:09:42 +0000642 if test $have_getaddrinfo = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000643 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000644 fi
645 fi
646fi
647
648dnl ******************************End IPv6 checks******************************
649
Daniel Veillardb05deb71999-08-10 19:04:08 +0000650dnl Checks for isnan in libm if not in libc
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000651AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
Daniel Veillardc790bf42003-10-11 10:50:10 +0000652 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000653
Daniel Veillardc790bf42003-10-11 10:50:10 +0000654AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
655 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000656
657XML_LIBDIR='-L${libdir}'
Daniel Veillarde7dd2b82002-03-15 18:44:02 +0000658XML_INCLUDEDIR='-I${includedir}/libxml2'
Daniel Veillardb05deb71999-08-10 19:04:08 +0000659
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000660dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000661dnl Extra flags
662dnl
663XML_CFLAGS=""
Daniel Veillard357c9602001-05-03 10:49:20 +0000664RDL_LIBS=""
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000665
666dnl
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000667dnl Workaround for native compilers
668dnl HP : http://bugs.gnome.org/db/31/3163.html
669dnl DEC : Enable NaN/Inf
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000670dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000671if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000672 case "${host}" in
Daniel Veillard6a0baa02005-12-10 11:11:12 +0000673 hppa*-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000674 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000675 ;;
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000676 *-dec-osf* )
677 CFLAGS="${CFLAGS} -ieee"
678 ;;
William M. Brack476cd962003-08-13 11:09:42 +0000679 alpha*-*-linux* )
680 CFLAGS="${CFLAGS} -ieee"
681 ;;
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000682 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000683else
Daniel Veillardd94849b2003-07-28 13:02:24 +0000684 if test "$with_fexceptions" = "yes"
685 then
686 #
687 # Not activated by default because this inflates the code size
688 # Used to allow propagation of C++ exceptions through the library
689 #
690 CFLAGS="${CFLAGS} -fexceptions"
691 fi
Stefan Kost85deb482011-05-10 10:55:07 +0300692
693 # warnings we'd like to see
694 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"
695 # warnings we'd like to supress
696 CFLAGS="${CFLAGS} -Wno-long-long"
Daniel Veillard14839d52001-06-06 16:11:56 +0000697 case "${host}" in
698 alpha*-*-linux* )
699 CFLAGS="${CFLAGS} -mieee"
700 ;;
Daniel Veillardcb5b4d62002-04-11 08:24:26 +0000701 alpha*-*-osf* )
702 CFLAGS="${CFLAGS} -mieee"
703 ;;
Daniel Veillard14839d52001-06-06 16:11:56 +0000704 esac
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000705fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000706case ${host} in
707 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000708 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
709 ;;
Daniel Veillardd30be4a2002-03-28 18:25:31 +0000710 hppa*-hp-mpeix)
711 NEED_TRIO=1
712 ;;
Daniel Veillard4188ddf2006-01-19 08:58:42 +0000713 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
714 # If the host is Windows, and shared libraries are disabled, we
715 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
716 # work properly (without it, xmlexports.h would force the use of
717 # DLL imports, which obviously aren't present in a static
718 # library).
719 if test "x$enable_shared" = "xno"; then
720 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
721 CFLAGS="$CFLAGS -DLIBXML_STATIC"
722 fi
723 ;;
Daniel Veillardd2ade932000-09-30 14:39:55 +0000724esac
725
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000726
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000727dnl
728dnl check for python
729dnl
730
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000731PYTHON_VERSION=
732PYTHON_INCLUDES=
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000733PYTHON_SITE_PACKAGES=
Daniel Veillard6dc91962004-03-22 19:10:02 +0000734PYTHON_TESTS=
Daniel Veillard38b80a82003-05-14 18:59:00 +0000735pythondir=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000736if test "$with_python" != "no" ; then
737 if test -x "$with_python/bin/python"
738 then
739 echo Found python in $with_python/bin/python
740 PYTHON="$with_python/bin/python"
Daniel Veillard9b731d72002-04-14 12:56:08 +0000741 else
LRNfbd4ddf2010-11-04 15:45:46 +0100742 if test -x "$with_python/python.exe"
743 then
744 echo Found python in $with_python/python.exe
745 PYTHON="$with_python/python.exe"
746 else
747 if test -x "$with_python"
748 then
749 echo Found python in $with_python
750 PYTHON="$with_python"
751 else
752 if test -x "$PYTHON"
753 then
754 echo Found python in environment PYTHON=$PYTHON
755 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
756 else
757 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
758 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000759 fi
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000760 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000761 fi
762 if test "$PYTHON" != ""
763 then
764 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
765 echo Found Python version $PYTHON_VERSION
766 fi
767 if test "$PYTHON_VERSION" != ""
768 then
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000769 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
770 -d $with_python/lib/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000771 then
772 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000773 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000774 else
775 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
776 then
Daniel Veillard8492ba12006-04-25 12:52:12 +0000777 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000778 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000779 else
780 if test -r /usr/include/python$PYTHON_VERSION/Python.h
781 then
782 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000783 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000784 else
LRNfbd4ddf2010-11-04 15:45:46 +0100785 if test -r $with_python/include/Python.h -a \
786 -d $with_python/lib/site-packages
787 then
788 PYTHON_INCLUDES=$with_python/include
789 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
790 else
791 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
792 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000793 fi
794 fi
William M. Brack5d4cba42004-01-06 15:19:12 +0000795 if test ! -d "$PYTHON_SITE_PACKAGES"
Daniel Veillardb6984ef2002-08-14 16:55:31 +0000796 then
797 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
798 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000799 fi
Daniel Macks12febe82010-03-15 10:31:24 +0100800 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000801 fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000802 if test "$with_python" != ""
803 then
Daniel Veillardd7d07482006-05-03 13:15:44 +0000804 pythondir='$(PYTHON_SITE_PACKAGES)'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000805 else
Daniel Veillardb2f8f1d2006-04-28 16:30:48 +0000806 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000807 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000808else
809 PYTHON=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000810fi
811AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
Daniel Veillard40b11342002-09-20 12:01:39 +0000812if test "$PYTHON_INCLUDES" != ""
813then
814 PYTHON_SUBDIR=python
815else
816 PYTHON_SUBDIR=
817fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000818AC_SUBST(pythondir)
Daniel Veillard40b11342002-09-20 12:01:39 +0000819AC_SUBST(PYTHON_SUBDIR)
Frederic Crozate21731d2009-09-12 18:02:40 +0200820AC_SUBST(PYTHON_LIBS)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000821
Daniel Veillardce1648b2005-01-04 15:10:22 +0000822dnl check for dso support
823WITH_MODULES=0
Daniel Veillardce1648b2005-01-04 15:10:22 +0000824TEST_MODULES=
825
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000826if test "$with_modules" != "no" ; then
Daniel Veillard9202b672005-07-14 09:31:14 +0000827 case "$host" in
828 *-*-cygwin*)
829 MODULE_EXTENSION=".dll"
830 AC_CHECK_LIB(cygwin, dlopen, [
831 WITH_MODULES=1
832 MODULE_PLATFORM_LIBS=
833 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
834 ])
835 ;;
Roumen Petrov120a2692010-03-10 10:07:49 +0100836 *-*-mingw*)
837 MODULE_EXTENSION=".dll"
838 WITH_MODULES=1
839 ;;
Daniel Veillard9202b672005-07-14 09:31:14 +0000840 *)
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000841 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
842 AC_CHECK_LIB(dld, shl_load, [
843 MODULE_PLATFORM_LIBS="-ldld"
844 libxml_have_shl_load=yes], [
845 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
846 AC_CHECK_LIB(dl, dlopen, [
847 MODULE_PLATFORM_LIBS="-ldl"
848 libxml_have_dlopen=yes])])])])
849
850 if test "${libxml_have_shl_load}" = "yes"; then
851 MODULE_EXTENSION=".sl"
Daniel Veillard9202b672005-07-14 09:31:14 +0000852 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000853 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000854 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000855
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000856 if test "${libxml_have_dlopen}" = "yes"; then
857 case "${host}" in
858 *-*-hpux* )
859 MODULE_EXTENSION=".sl"
860 ;;
861 * )
862 MODULE_EXTENSION=".so"
863 ;;
864 esac
865
Daniel Veillard9202b672005-07-14 09:31:14 +0000866 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000867 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000868 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000869 ;;
870 esac
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000871fi
Daniel Veillardce1648b2005-01-04 15:10:22 +0000872
873if test "${WITH_MODULES}" = "1"; then
874 TEST_MODULES="ModuleTests"
875fi
876
877AC_SUBST(WITH_MODULES)
878AC_SUBST(MODULE_PLATFORM_LIBS)
879AC_SUBST(MODULE_EXTENSION)
880AC_SUBST(TEST_MODULES)
881
Daniel Veillard437b87b2000-01-03 17:30:46 +0000882dnl
883dnl Tester makes use of readline if present
884dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000885
Daniel Veillard361d8452000-04-03 19:48:13 +0000886dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000887dnl specific tests to setup DV and Bill's devel environments with debug etc ...
Daniel Veillard81418e32001-05-22 15:08:55 +0000888dnl (-Wunreachable-code)
Daniel Veillardf6eea272001-01-18 12:17:12 +0000889dnl
William M. Brack871611b2003-10-18 04:53:14 +0000890if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
Daniel Veillardb7c6ac42004-06-29 22:01:27 +0000891 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
William M. Brack7f28a012007-01-11 23:42:10 +0000892 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
William M. Brack871611b2003-10-18 04:53:14 +0000893 then
Daniel Veillard4432df22003-09-28 18:58:27 +0000894 if test "$with_minimum" != "yes"
895 then
896 if test "${with_mem_debug}" = "" ; then
Daniel Veillard379a3b72005-08-12 10:18:14 +0000897 echo Activating memory debugging
Daniel Veillard4432df22003-09-28 18:58:27 +0000898 with_mem_debug="yes"
Daniel Veillard22cdb842004-10-04 14:09:17 +0000899 with_run_debug="yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000900 fi
901 if test "${with_docbook}" = "" ; then
902 with_docbook="yes"
903 fi
Daniel Veillardeae522a2001-04-23 13:41:34 +0000904 fi
Daniel Veillard3854c572005-08-25 10:17:45 +0000905 if test "${GCC}" = "yes" ; then
Daniel Veillard05f97352004-10-31 15:35:32 +0000906 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"
Daniel Veillardeff45a92004-10-29 12:10:55 +0000907 fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000908 STATIC_BINARIES="-static"
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000909dnl -Wcast-qual -ansi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000910else
911 STATIC_BINARIES=
Daniel Veillardf6eea272001-01-18 12:17:12 +0000912fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000913AC_SUBST(STATIC_BINARIES)
Daniel Veillard92ad2102001-03-27 12:47:33 +0000914
915dnl
916dnl Check for trio string functions
917dnl
918
919if test "${NEED_TRIO}" = "1" ; then
920 echo Adding trio library for string functions
921 WITH_TRIO=1
922else
923 WITH_TRIO=0
924fi
Daniel Veillard01ef7382001-05-08 07:31:43 +0000925AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
Daniel Veillard92ad2102001-03-27 12:47:33 +0000926AC_SUBST(WITH_TRIO)
927
Daniel Veillardf6eea272001-01-18 12:17:12 +0000928dnl
William M. Brack97ad4c72003-05-13 08:08:36 +0000929dnl Allow to enable/disable various pieces
Daniel Veillard361d8452000-04-03 19:48:13 +0000930dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000931echo Checking configuration requirements
Daniel Veillard361d8452000-04-03 19:48:13 +0000932
William M. Brack21e4ef22005-01-02 09:53:13 +0000933dnl
934dnl Thread-related stuff
935dnl
Daniel Veillardb8478642001-10-12 17:29:10 +0000936THREAD_LIBS=""
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000937BASE_THREAD_LIBS=""
Daniel Veillardb8478642001-10-12 17:29:10 +0000938WITH_THREADS=0
939THREAD_CFLAGS=""
Daniel Veillardab7488e2001-10-17 11:30:37 +0000940TEST_THREADS=""
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000941THREADS_W32=""
Daniel Veillard64a411c2001-10-15 12:32:07 +0000942
Daniel Veillard84942712003-04-18 14:40:05 +0000943if test "$with_threads" = "no" ; then
944 echo Disabling multithreaded support
945else
Daniel Veillardb8478642001-10-12 17:29:10 +0000946 echo Enabling multithreaded support
Sam Thursfield115581a2012-05-09 18:46:56 +0800947
948 dnl Default to native threads on Win32
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000949 case $host_os in
Sam Thursfield115581a2012-05-09 18:46:56 +0800950 *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
LRN203fd2e2009-08-07 21:47:25 +0200951 WITH_THREADS="1"
952 THREADS_W32="Win32"
Sam Thursfield115581a2012-05-09 18:46:56 +0800953 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
LRN203fd2e2009-08-07 21:47:25 +0200954 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000955 ;;
Sam Thursfield115581a2012-05-09 18:46:56 +0800956 esac
957
958 dnl Use pthread by default in other cases
959 if test -z "$THREADS_W32"; then
960 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
961 AC_CHECK_HEADER(pthread.h,
962 AC_CHECK_LIB(pthread, pthread_join,[
963 THREAD_LIBS="-lpthread"
964 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
965 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
966 WITH_THREADS="1"]))
967 fi
968 fi
969
970 case $host_os in
William M. Bracka73f45b2005-01-11 02:21:33 +0000971 *cygwin*) THREAD_LIBS=""
972 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +0000973 *beos*) WITH_THREADS="1"
974 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
975 ;;
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000976 *linux*)
Daniel Veillard32a461f2005-08-25 21:48:54 +0000977 if test "${GCC}" = "yes" ; then
978 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
979 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
980 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
981 if test "${THREAD_LIBS}" = "-lpthread" ; then
982 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
983 then
984 THREAD_LIBS=""
985 BASE_THREAD_LIBS="-lpthread"
986 else
LRN203fd2e2009-08-07 21:47:25 +0200987 if expr ${GCC_MAJOR} \> 3 > /dev/null
Daniel Veillard32a461f2005-08-25 21:48:54 +0000988 then
989 THREAD_LIBS=""
990 BASE_THREAD_LIBS="-lpthread"
991 else
992 echo old GCC disabling weak symbols for pthread
993 fi
994 fi
995 fi
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000996 fi
997 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000998 esac
Daniel Veillardb8478642001-10-12 17:29:10 +0000999 if test "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +00001000 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
1001 TEST_THREADS="Threadtests"
Daniel Veillardb8478642001-10-12 17:29:10 +00001002 fi
1003fi
William M. Brack306e33c2004-06-12 01:01:22 +00001004if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +00001005 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
Daniel Veillard64a411c2001-10-15 12:32:07 +00001006fi
1007
Daniel Veillardb8478642001-10-12 17:29:10 +00001008AC_SUBST(THREAD_LIBS)
Daniel Veillarddbfe05a2005-05-04 09:18:00 +00001009AC_SUBST(BASE_THREAD_LIBS)
Daniel Veillardb8478642001-10-12 17:29:10 +00001010AC_SUBST(WITH_THREADS)
1011AC_SUBST(THREAD_CFLAGS)
Daniel Veillardab7488e2001-10-17 11:30:37 +00001012AC_SUBST(TEST_THREADS)
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001013AC_SUBST(THREADS_W32)
Daniel Veillardb8478642001-10-12 17:29:10 +00001014
William M. Brack21e4ef22005-01-02 09:53:13 +00001015dnl
1016dnl xmllint shell history
1017dnl
Daniel Veillard259ff742001-10-06 13:49:59 +00001018if test "$with_history" = "yes" ; then
Daniel Veillardf012a642001-07-23 19:10:52 +00001019 echo Enabling xmllint shell history
1020 dnl check for terminal library. this is a very cool solution
1021 dnl from octave's configure.in
1022 unset tcap
1023 for termlib in ncurses curses termcap terminfo termlib; do
1024 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
1025 test -n "$tcap" && break
1026 done
1027
1028 AC_CHECK_HEADER(readline/history.h,
1029 AC_CHECK_LIB(history, append_history,[
1030 RDL_LIBS="-lhistory"
Daniel Veillardc790bf42003-10-11 10:50:10 +00001031 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
Daniel Veillardf012a642001-07-23 19:10:52 +00001032 AC_CHECK_HEADER(readline/readline.h,
1033 AC_CHECK_LIB(readline, readline,[
1034 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
Daniel Veillardc790bf42003-10-11 10:50:10 +00001035 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
Daniel Veillardf012a642001-07-23 19:10:52 +00001036 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
1037 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
1038 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
Daniel Veillardf012a642001-07-23 19:10:52 +00001039 fi
Daniel Veillardf012a642001-07-23 19:10:52 +00001040fi
1041
William M. Brack21e4ef22005-01-02 09:53:13 +00001042dnl
1043dnl Tree functions
1044dnl
Daniel Veillard652327a2003-09-29 18:02:38 +00001045if test "$with_tree" = "no" ; then
1046 echo Disabling DOM like tree manipulation APIs
1047 WITH_TREE=0
1048else
1049 WITH_TREE=1
1050fi
1051AC_SUBST(WITH_TREE)
1052
Daniel Veillard361d8452000-04-03 19:48:13 +00001053if test "$with_ftp" = "no" ; then
1054 echo Disabling FTP support
1055 WITH_FTP=0
1056 FTP_OBJ=
1057else
1058 WITH_FTP=1
1059 FTP_OBJ=nanoftp.o
1060fi
1061AC_SUBST(WITH_FTP)
1062AC_SUBST(FTP_OBJ)
1063
Daniel Veillard361d8452000-04-03 19:48:13 +00001064if test "$with_http" = "no" ; then
1065 echo Disabling HTTP support
1066 WITH_HTTP=0
1067 HTTP_OBJ=
1068else
1069 WITH_HTTP=1
1070 HTTP_OBJ=nanohttp.o
1071fi
1072AC_SUBST(WITH_HTTP)
1073AC_SUBST(HTTP_OBJ)
1074
Daniel Veillard4432df22003-09-28 18:58:27 +00001075if test "$with_legacy" = "no" ; then
1076 echo Disabling deprecated APIs
1077 WITH_LEGACY=0
1078else
1079 WITH_LEGACY=1
1080fi
1081AC_SUBST(WITH_LEGACY)
1082
Daniel Veillard81273902003-09-30 00:43:48 +00001083if test "$with_reader" = "no" ; then
1084 echo Disabling the xmlReader parsing interface
1085 WITH_READER=0
Daniel Veillard73b013f2003-09-30 12:36:01 +00001086 READER_TEST=
Daniel Veillard81273902003-09-30 00:43:48 +00001087else
1088 WITH_READER=1
Daniel Veillard73b013f2003-09-30 12:36:01 +00001089 READER_TEST=Readertests
William M. Brack21e4ef22005-01-02 09:53:13 +00001090 if test "$with_push" = "no" ; then
1091 echo xmlReader requires Push interface - enabling it
1092 with_push=yes
1093 fi
Daniel Veillard81273902003-09-30 00:43:48 +00001094fi
1095AC_SUBST(WITH_READER)
Daniel Veillard73b013f2003-09-30 12:36:01 +00001096AC_SUBST(READER_TEST)
Daniel Veillard81273902003-09-30 00:43:48 +00001097
William M. Brack21e4ef22005-01-02 09:53:13 +00001098if test "$with_writer" = "no" ; then
1099 echo Disabling the xmlWriter saving interface
1100 WITH_WRITER=0
1101# WRITER_TEST=
1102else
1103 WITH_WRITER=1
1104# WRITER_TEST=Writertests
1105 if test "$with_push" = "no" ; then
1106 echo xmlWriter requires Push interface - enabling it
1107 with_push=yes
1108 fi
1109 if test "$with_output" = "no" ; then
1110 echo xmlWriter requires Output interface - enabling it
1111 with_output=yes
1112 fi
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001113fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001114AC_SUBST(WITH_WRITER)
1115#AC_SUBST(WRITER_TEST)
1116
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001117if test "$with_pattern" = "no" ; then
1118 echo Disabling the xmlPattern parsing interface
1119 WITH_PATTERN=0
Daniel Veillardf9d16912005-01-30 22:36:30 +00001120 TEST_PATTERN=
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001121else
1122 WITH_PATTERN=1
Daniel Veillardf9d16912005-01-30 22:36:30 +00001123 TEST_PATTERN=Patterntests
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001124fi
1125AC_SUBST(WITH_PATTERN)
Daniel Veillardf9d16912005-01-30 22:36:30 +00001126AC_SUBST(TEST_PATTERN)
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001127
Daniel Veillard81273902003-09-30 00:43:48 +00001128if test "$with_sax1" = "no" ; then
1129 echo Disabling the older SAX1 interface
1130 WITH_SAX1=0
1131 TEST_SAX=
1132else
1133 WITH_SAX1=1
1134 TEST_SAX=SAXtests
1135fi
1136AC_SUBST(WITH_SAX1)
1137AC_SUBST(TEST_SAX)
1138
Daniel Veillard73b013f2003-09-30 12:36:01 +00001139if test "$with_push" = "no" ; then
1140 echo Disabling the PUSH parser interfaces
1141 WITH_PUSH=0
1142 TEST_PUSH=
1143else
1144 WITH_PUSH=1
1145 TEST_PUSH="XMLPushtests"
1146fi
1147AC_SUBST(WITH_PUSH)
1148AC_SUBST(TEST_PUSH)
1149
Daniel Veillard73b013f2003-09-30 12:36:01 +00001150if test "$with_html" = "no" ; then
1151 echo Disabling HTML support
1152 WITH_HTML=0
1153 HTML_OBJ=
1154 TEST_HTML=
1155else
1156 WITH_HTML=1
1157 HTML_OBJ="HTMLparser.o HTMLtree.o"
1158 TEST_HTML=HTMLtests
William M. Brack871611b2003-10-18 04:53:14 +00001159 if test "$with_push" != "no" ; then
Daniel Veillard73b013f2003-09-30 12:36:01 +00001160 TEST_PHTML=HTMLPushtests
1161 else
1162 TEST_PHTML=
1163 fi
1164fi
1165AC_SUBST(WITH_HTML)
1166AC_SUBST(HTML_OBJ)
1167AC_SUBST(TEST_HTML)
1168AC_SUBST(TEST_PHTML)
1169
Daniel Veillard73b013f2003-09-30 12:36:01 +00001170if test "$with_valid" = "no" ; then
Daniel Veillard4432df22003-09-28 18:58:27 +00001171 echo Disabling DTD validation support
1172 WITH_VALID=0
1173 TEST_VALID=
1174 TEST_VTIME=
1175else
1176 WITH_VALID=1
1177 TEST_VALID=Validtests
1178 TEST_VTIME=VTimingtests
1179fi
1180AC_SUBST(WITH_VALID)
1181AC_SUBST(TEST_VALID)
1182AC_SUBST(TEST_VTIME)
Daniel Veillard361d8452000-04-03 19:48:13 +00001183
Daniel Veillarda7374592001-05-10 14:17:55 +00001184if test "$with_catalog" = "no" ; then
1185 echo Disabling Catalog support
1186 WITH_CATALOG=0
1187 CATALOG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001188 TEST_CATALOG=
Daniel Veillarda7374592001-05-10 14:17:55 +00001189else
1190 WITH_CATALOG=1
1191 CATALOG_OBJ="catalog.o"
Daniel Veillard4432df22003-09-28 18:58:27 +00001192 TEST_CATALOG=Catatests
Daniel Veillarda7374592001-05-10 14:17:55 +00001193fi
1194AC_SUBST(WITH_CATALOG)
1195AC_SUBST(CATALOG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001196AC_SUBST(TEST_CATALOG)
Daniel Veillarda7374592001-05-10 14:17:55 +00001197
Daniel Veillardb59076b2001-04-29 17:04:07 +00001198if test "$with_docbook" = "no" ; then
1199 echo Disabling Docbook support
Daniel Veillardeae522a2001-04-23 13:41:34 +00001200 WITH_DOCB=0
1201 DOCB_OBJ=
Daniel Veillardb59076b2001-04-29 17:04:07 +00001202else
1203 WITH_DOCB=1
1204 DOCB_OBJ="DOCBparser.o"
Daniel Veillardeae522a2001-04-23 13:41:34 +00001205fi
1206AC_SUBST(WITH_DOCB)
1207AC_SUBST(DOCB_OBJ)
1208
1209
William M. Brack21e4ef22005-01-02 09:53:13 +00001210if test "$with_xptr" = "no" ; then
1211 echo Disabling XPointer support
1212 WITH_XPTR=0
1213 XPTR_OBJ=
1214 TEST_XPTR=
1215else
1216 WITH_XPTR=1
1217 XPTR_OBJ=xpointer.o
1218 TEST_XPTR=XPtrtests
1219 if test "$with_xpath" = "no" ; then
1220 echo XPointer requires XPath support - enabling it
1221 with_xpath=yes
1222 fi
Daniel Veillard4432df22003-09-28 18:58:27 +00001223fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001224AC_SUBST(WITH_XPTR)
1225AC_SUBST(XPTR_OBJ)
1226AC_SUBST(TEST_XPTR)
1227
1228if test "$with_c14n" = "no" ; then
1229 echo Disabling C14N support
1230 WITH_C14N=0
1231 C14N_OBJ=
1232 TEST_C14N=
1233else
1234 WITH_C14N=1
1235 C14N_OBJ="c14n.c"
1236 TEST_C14N=C14Ntests
1237 if test "$with_xpath" = "no" ; then
1238 echo C14N requires XPath support - enabling it
1239 with_xpath=yes
1240 fi
1241fi
1242AC_SUBST(WITH_C14N)
1243AC_SUBST(C14N_OBJ)
1244AC_SUBST(TEST_C14N)
1245
1246if test "$with_xinclude" = "no" ; then
1247 echo Disabling XInclude support
1248 WITH_XINCLUDE=0
1249 XINCLUDE_OBJ=
1250 with_xinclude="no"
1251 TEST_XINCLUDE=
1252else
1253 WITH_XINCLUDE=1
1254 XINCLUDE_OBJ=xinclude.o
1255 TEST_XINCLUDE=XIncludetests
1256 if test "$with_xpath" = "no" ; then
1257 echo XInclude requires XPath support - enabling it
1258 with_xpath=yes
1259 fi
1260fi
1261AC_SUBST(WITH_XINCLUDE)
1262AC_SUBST(XINCLUDE_OBJ)
1263AC_SUBST(TEST_XINCLUDE)
1264
Daniel Veillard361d8452000-04-03 19:48:13 +00001265if test "$with_xpath" = "no" ; then
1266 echo Disabling XPATH support
1267 WITH_XPATH=0
1268 XPATH_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001269 TEST_XPATH=
Daniel Veillard361d8452000-04-03 19:48:13 +00001270else
1271 WITH_XPATH=1
1272 XPATH_OBJ=xpath.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001273 TEST_XPATH=XPathtests
Daniel Veillard361d8452000-04-03 19:48:13 +00001274fi
1275AC_SUBST(WITH_XPATH)
1276AC_SUBST(XPATH_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001277AC_SUBST(TEST_XPATH)
Daniel Veillard361d8452000-04-03 19:48:13 +00001278
William M. Brack21e4ef22005-01-02 09:53:13 +00001279dnl
1280dnl output functions
1281dnl
1282if test "$with_output" = "no" ; then
1283 echo Disabling serialization/saving support
1284 WITH_OUTPUT=0
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001285else
William M. Brack21e4ef22005-01-02 09:53:13 +00001286 WITH_OUTPUT=1
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001287fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001288AC_SUBST(WITH_OUTPUT)
Daniel Veillard9e8bfae2000-11-06 16:43:11 +00001289
Daniel Veillard6e90d192001-07-03 16:37:49 +00001290WITH_ICONV=0
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001291if test "$with_iconv" = "no" ; then
1292 echo Disabling ICONV support
Daniel Veillardd574f782001-03-14 19:40:17 +00001293else
Daniel Veillard220346d2001-12-07 11:33:54 +00001294 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
Daniel Veillard6e90d192001-07-03 16:37:49 +00001295 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
Daniel Veillardf5b44e42001-09-17 17:19:54 +00001296 # Export this since our headers include iconv.h
1297 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
Daniel Veillard6e90d192001-07-03 16:37:49 +00001298 ICONV_LIBS="-L$with_iconv/lib"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001299 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001300
1301 AC_CHECK_HEADER(iconv.h,
1302 AC_MSG_CHECKING(for iconv)
1303 AC_TRY_LINK([#include <stdlib.h>
1304#include <iconv.h>],[
1305iconv_t cd = iconv_open ("","");
1306iconv (cd, NULL, NULL, NULL, NULL);],[
1307 AC_MSG_RESULT(yes)
1308 WITH_ICONV=1],[
1309 AC_MSG_RESULT(no)
1310 AC_MSG_CHECKING(for iconv in -liconv)
1311
1312 _ldflags="${LDFLAGS}"
1313 _libs="${LIBS}"
1314 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1315 LIBS="${LIBS} -liconv"
1316
1317 AC_TRY_LINK([#include <stdlib.h>
1318#include <iconv.h>],[
1319iconv_t cd = iconv_open ("","");
1320iconv (cd, NULL, NULL, NULL, NULL);],[
1321 AC_MSG_RESULT(yes)
1322 WITH_ICONV=1
1323 ICONV_LIBS="${ICONV_LIBS} -liconv"
1324 LIBS="${_libs}"
1325 LDFLAGS="${_ldflags}"],[
1326 AC_MSG_RESULT(no)
1327 LIBS="${_libs}"
1328 LDFLAGS="${_ldflags}"])]))
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001329
1330 if test "$WITH_ICONV" = "1" ; then
1331 AC_MSG_CHECKING([for iconv declaration])
1332 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1333 AC_TRY_COMPILE([#include <stdlib.h>
1334#include <iconv.h>
1335extern
1336#ifdef __cplusplus
1337"C"
1338#endif
1339#if defined(__STDC__) || defined(__cplusplus)
1340size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1341#else
1342size_t iconv();
1343#endif
1344], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1345
1346 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);"
1347 AC_MSG_RESULT([${xml_xxx:-
1348 }$xml_cv_iconv_decl])
1349 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1350 [Define as const if the declaration of iconv() needs const.])
1351 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001352fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001353case "$host" in
1354 *mingw*) M_LIBS=""
1355 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +00001356 *beos*) M_LIBS=""
1357 ;;
Scott McCreary508a8d62009-08-24 16:35:35 +02001358 *haiku*) M_LIBS=""
1359 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001360 *) M_LIBS="-lm"
1361 ;;
1362esac
Daniel Veillardb82c1662001-12-09 14:00:54 +00001363XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
Daniel Veillard90d165b2003-09-01 20:33:13 +00001364XML_LIBTOOLLIBS="libxml2.la"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001365AC_SUBST(WITH_ICONV)
1366
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001367WITH_ICU=0
1368if test "$with_icu" != "yes" ; then
1369 echo Disabling ICU support
1370else
1371 ICU_CONFIG=icu-config
1372 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1373 then
1374 ICU_LIBS=`icu-config --ldflags`
1375 LDFLAGS="$LDFLAGS $ICU_LIBS"
1376 WITH_ICU=1
1377 echo Enabling ICU support
1378 else
1379 AC_MSG_ERROR([libicu config program icu-config not found])
1380 fi
1381fi
1382AC_SUBST(WITH_ICU)
1383
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001384WITH_ISO8859X=1
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001385if test "$WITH_ICONV" != "1" ; then
1386if test "$with_iso8859x" = "no" ; then
1387 echo Disabling ISO8859X support
1388 WITH_ISO8859X=0
1389fi
1390fi
1391AC_SUBST(WITH_ISO8859X)
1392
Daniel Veillarded6c5492005-07-23 15:00:22 +00001393if test "$with_schematron" = "no" ; then
1394 echo "Disabling Schematron support"
1395 WITH_SCHEMATRON=0
1396 TEST_SCHEMATRON=
1397else
1398 echo "Enabled Schematron support"
1399 WITH_SCHEMATRON=1
1400 TEST_SCHEMATRON="Schematrontests"
1401 with_xpath=yes
1402 with_pattern=yes
1403fi
1404AC_SUBST(WITH_SCHEMATRON)
1405AC_SUBST(TEST_SCHEMATRON)
1406
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001407if test "$with_schemas" = "no" ; then
William M. Brack21e4ef22005-01-02 09:53:13 +00001408 echo "Disabling Schemas/Relax-NG support"
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001409 WITH_SCHEMAS=0
1410 TEST_SCHEMAS=
1411else
Daniel Veillard71531f32003-02-05 13:19:53 +00001412 echo "Enabled Schemas/Relax-NG support"
Daniel Veillard4255d502002-04-16 15:50:10 +00001413 WITH_SCHEMAS=1
Daniel Veillard6eadf632003-01-23 18:29:16 +00001414 TEST_SCHEMAS="Schemastests Relaxtests"
Daniel Veillard6dc91962004-03-22 19:10:02 +00001415 if test "$PYTHON_INCLUDES" != "" ; then
1416 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1417 fi
Daniel Veillard23e73572002-09-19 19:56:43 +00001418 with_regexps=yes
Daniel Veillard4255d502002-04-16 15:50:10 +00001419fi
1420AC_SUBST(WITH_SCHEMAS)
1421AC_SUBST(TEST_SCHEMAS)
1422
Daniel Veillard23e73572002-09-19 19:56:43 +00001423if test "$with_regexps" = "no" ; then
1424 echo Disabling Regexps support
1425 WITH_REGEXPS=0
1426 TEST_REGEXPS=
1427else
1428 WITH_REGEXPS=1
1429 TEST_REGEXPS="Regexptests Automatatests"
1430fi
1431AC_SUBST(WITH_REGEXPS)
1432AC_SUBST(TEST_REGEXPS)
1433
Daniel Veillard361d8452000-04-03 19:48:13 +00001434if test "$with_debug" = "no" ; then
1435 echo Disabling DEBUG support
1436 WITH_DEBUG=0
1437 DEBUG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001438 TEST_DEBUG=
Daniel Veillard361d8452000-04-03 19:48:13 +00001439else
1440 WITH_DEBUG=1
1441 DEBUG_OBJ=debugXML.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001442 TEST_DEBUG=Scripttests
Daniel Veillard361d8452000-04-03 19:48:13 +00001443fi
1444AC_SUBST(WITH_DEBUG)
1445AC_SUBST(DEBUG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001446AC_SUBST(TEST_DEBUG)
Daniel Veillard361d8452000-04-03 19:48:13 +00001447
Daniel Veillard361d8452000-04-03 19:48:13 +00001448if test "$with_mem_debug" = "yes" ; then
William M. Brack306e33c2004-06-12 01:01:22 +00001449 if test "$with_thread_alloc" = "yes" ; then
1450 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1451 WITH_MEM_DEBUG=0
1452 else
1453 echo Enabling memory debug support
1454 WITH_MEM_DEBUG=1
1455 fi
Daniel Veillard361d8452000-04-03 19:48:13 +00001456else
1457 WITH_MEM_DEBUG=0
1458fi
1459AC_SUBST(WITH_MEM_DEBUG)
1460
Daniel Veillard22cdb842004-10-04 14:09:17 +00001461if test "$with_run_debug" = "yes" ; then
1462 echo Enabling runtime debug support
1463 WITH_RUN_DEBUG=1
1464else
1465 WITH_RUN_DEBUG=0
1466fi
1467AC_SUBST(WITH_RUN_DEBUG)
Daniel Veillard1638a472003-08-14 01:23:25 +00001468
1469WIN32_EXTRA_LIBADD=
1470WIN32_EXTRA_LDFLAGS=
William M. Bracka73f45b2005-01-11 02:21:33 +00001471CYGWIN_EXTRA_LDFLAGS=
1472CYGWIN_EXTRA_PYTHON_LIBADD=
LRNfbd4ddf2010-11-04 15:45:46 +01001473WIN32_EXTRA_PYTHON_LIBADD=
Daniel Veillard1638a472003-08-14 01:23:25 +00001474case "$host" in
1475 *-*-mingw*)
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001476 CPPFLAGS="$CPPFLAGS -DWIN32"
1477 WIN32_EXTRA_LIBADD="-lws2_32"
Daniel Veillard1638a472003-08-14 01:23:25 +00001478 WIN32_EXTRA_LDFLAGS="-no-undefined"
1479 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
LRNfbd4ddf2010-11-04 15:45:46 +01001480 if test "${PYTHON}" != ""
1481 then
John Heina4fe9b22012-05-10 22:12:46 +08001482 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
LRNfbd4ddf2010-11-04 15:45:46 +01001483 fi
Daniel Veillard1638a472003-08-14 01:23:25 +00001484 ;;
Daniel Veillardd392ba72004-08-04 14:56:45 +00001485 *-*-cygwin*)
1486 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
William M. Bracka73f45b2005-01-11 02:21:33 +00001487 if test "${PYTHON}" != ""
1488 then
1489 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1490 fi
Daniel Veillardd392ba72004-08-04 14:56:45 +00001491 ;;
Daniel Veillard1638a472003-08-14 01:23:25 +00001492esac
1493AC_SUBST(WIN32_EXTRA_LIBADD)
1494AC_SUBST(WIN32_EXTRA_LDFLAGS)
LRNfbd4ddf2010-11-04 15:45:46 +01001495AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
Daniel Veillardd392ba72004-08-04 14:56:45 +00001496AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1497AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
Daniel Veillard1638a472003-08-14 01:23:25 +00001498
Andoni Moralesfda57172012-05-08 10:46:09 +08001499dnl Checking the standard string functions availability
Roumen Petrov978ff222012-05-20 16:07:54 +03001500dnl
1501dnl Note mingw* has C99 implementation that produce expected xml numbers
1502dnl if code use {v}snprintf functions.
1503dnl If you like to activate at run-time C99 compatible number output
1504dnl see release note for mingw runtime 3.15:
1505dnl http://sourceforge.net/project/shownotes.php?release_id=24832
1506dnl
1507dnl Also *win32*config.h files redefine them for various MSC compilers.
1508dnl
1509dnl So do not redefine {v}snprintf to _{v}snprintf like follwing:
1510dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1511dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1512dnl and do not redefine those functions is C-source files.
1513dnl
1514AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
1515 NEED_TRIO=1)
Andoni Moralesfda57172012-05-08 10:46:09 +08001516
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001517if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1518then
1519 echo Enabling code coverage for GCC
1520 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1521 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1522else
1523 echo Disabling code coverage for GCC
1524fi
1525
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001526AC_SUBST(CPPFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001527AC_SUBST(CFLAGS)
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001528AC_SUBST(LDFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +00001529AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001530
Daniel Veillardb05deb71999-08-10 19:04:08 +00001531AC_SUBST(XML_LIBDIR)
1532AC_SUBST(XML_LIBS)
Daniel Veillard90d165b2003-09-01 20:33:13 +00001533AC_SUBST(XML_LIBTOOLLIBS)
Daniel Veillard81418e32001-05-22 15:08:55 +00001534AC_SUBST(ICONV_LIBS)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001535AC_SUBST(XML_INCLUDEDIR)
1536AC_SUBST(HTML_DIR)
1537AC_SUBST(HAVE_ISNAN)
1538AC_SUBST(HAVE_ISINF)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +00001539AC_SUBST(PYTHON)
1540AC_SUBST(PYTHON_VERSION)
1541AC_SUBST(PYTHON_INCLUDES)
Daniel Veillard253aa2c2002-02-02 09:17:16 +00001542AC_SUBST(PYTHON_SITE_PACKAGES)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001543
Daniel Veillardb05deb71999-08-10 19:04:08 +00001544AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +00001545AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +00001546
Daniel Veillard9715c172002-11-25 16:33:40 +00001547dnl for the spec file
1548RELDATE=`date +'%a %b %e %Y'`
1549AC_SUBST(RELDATE)
Daniel Veillard6dc91962004-03-22 19:10:02 +00001550AC_SUBST(PYTHON_TESTS)
Daniel Veillard9715c172002-11-25 16:33:40 +00001551
Daniel Veillardc6e997c2003-01-27 12:35:42 +00001552rm -f COPYING.LIB COPYING
Daniel Veillardc575b992002-02-08 13:28:40 +00001553ln -s Copyright COPYING
1554
Daniel Veillarde4177a52004-01-08 16:43:57 +00001555# keep on one line for cygwin c.f. #130896
Daniel Veillard99b78502005-09-11 22:04:08 +00001556AC_OUTPUT(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 xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
Arturo Espinosa15fe6e71998-09-07 17:27:57 +00001557
Daniel Veillard06d25242004-02-25 13:01:42 +00001558chmod +x xml2-config python/setup.py
Daniel Veillard67952602006-01-05 15:29:44 +00001559echo Done configuring