blob: 8e0604d3a35cfdeae758acae12cd674b7a4d54d6 [file] [log] [blame]
Daniel Veillard01791d51998-07-24 19:24:09 +00001dnl Process this file with autoconf to produce a configure script.
Daniel Veillard5d04ad12012-09-11 17:17:15 +08002AC_PREREQ([2.63])
Daniel Richard Gec4fc522012-08-17 10:04:30 +08003AC_INIT
4AC_CONFIG_SRCDIR([entities.c])
5AC_CONFIG_HEADERS([config.h])
Daniel Veillard3157e512010-03-09 11:32:46 +01006AC_CONFIG_MACRO_DIR([m4])
Daniel Veillardd2ade932000-09-30 14:39:55 +00007AC_CANONICAL_HOST
Daniel Veillard14fff061999-06-22 21:49:07 +00008
Daniel Veillardcf461992000-03-14 18:30:20 +00009LIBXML_MAJOR_VERSION=2
Daniel Veillardaa017c52012-08-10 10:42:56 +080010LIBXML_MINOR_VERSION=9
Daniel Veillardf4e5a692013-04-19 15:36:36 +080011LIBXML_MICRO_VERSION=1
Daniel Veillard3e35f8e2003-10-21 00:05:38 +000012LIBXML_MICRO_VERSION_SUFFIX=
Daniel Veillard4fc52812003-09-01 20:33:13 +000013LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
Daniel Veillard14fff061999-06-22 21:49:07 +000014LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
15
Daniel Veillard361d8452000-04-03 19:48:13 +000016LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
17
Daniel Veillard9cb1b642007-01-03 15:07:44 +000018if test -f CVS/Entries ; then
Daniel Veillarddab93ea2004-08-20 16:47:10 +000019 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
20 echo extra=$extra
21 if test "$extra" != ""
22 then
23 LIBXML_VERSION_EXTRA="-CVS$extra"
24 fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000025else if test -d .svn ; then
26 extra=`svn info | grep Revision | sed 's+Revision: ++'`
27 echo extra=$extra
28 if test "$extra" != ""
29 then
30 LIBXML_VERSION_EXTRA="-SVN$extra"
31 fi
veillard97c7be62009-05-12 08:43:54 +020032else if test -d .git ; then
Christian Dywan040dcb52012-05-10 22:55:07 +080033 extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'`
veillard97c7be62009-05-12 08:43:54 +020034 echo extra=$extra
35 if test "$extra" != ""
36 then
37 LIBXML_VERSION_EXTRA="-GIT$extra"
38 fi
39fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000040fi
William M. Brackf4025492004-08-18 21:08:46 +000041fi
Daniel Veillard14fff061999-06-22 21:49:07 +000042AC_SUBST(LIBXML_MAJOR_VERSION)
43AC_SUBST(LIBXML_MINOR_VERSION)
44AC_SUBST(LIBXML_MICRO_VERSION)
45AC_SUBST(LIBXML_VERSION)
46AC_SUBST(LIBXML_VERSION_INFO)
Daniel Veillard361d8452000-04-03 19:48:13 +000047AC_SUBST(LIBXML_VERSION_NUMBER)
William M. Brackf4025492004-08-18 21:08:46 +000048AC_SUBST(LIBXML_VERSION_EXTRA)
Daniel Veillard14fff061999-06-22 21:49:07 +000049
Daniel Veillard361d8452000-04-03 19:48:13 +000050VERSION=${LIBXML_VERSION}
Daniel Veillard14fff061999-06-22 21:49:07 +000051
Daniel Veillardedfb29b2000-03-14 19:59:05 +000052AM_INIT_AUTOMAKE(libxml2, $VERSION)
Daniel Veillard1164e751999-02-16 16:29:17 +000053
Stefan Kostc9c939d2011-05-10 10:34:41 +030054# Support silent build rules, requires at least automake-1.11. Disable
55# by either passing --disable-silent-rules to configure or passing V=1
56# to make
57m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
58
Daniel Veillard01791d51998-07-24 19:24:09 +000059dnl Checks for programs.
60AC_PROG_CC
61AC_PROG_INSTALL
Daniel Richard G5706b6d2012-08-06 11:32:54 +080062AC_PROG_LN_S
Adrian Bunk64b0d602010-11-04 09:43:31 +010063AC_PROG_MKDIR_P
Sebastian Wilhelmia44c8a41998-08-07 08:38:58 +000064AC_PROG_CPP
Daniel Veillard01791d51998-07-24 19:24:09 +000065AC_PATH_PROG(MV, mv, /bin/mv)
66AC_PATH_PROG(TAR, tar, /bin/tar)
William M. Brack1826d0a2004-07-21 09:03:57 +000067AC_PATH_PROG(PERL, perl, /usr/bin/perl)
Daniel Veillard33a2de92006-10-11 08:33:22 +000068AC_PATH_PROG(WGET, wget, /usr/bin/wget)
Daniel Veillard8b817da2004-09-30 09:19:33 +000069AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
Daniel Veillard06500c82004-09-07 09:12:44 +000070AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
Philip Withnallf3f86ff2013-10-28 17:24:02 +000071PKG_PROG_PKG_CONFIG
Daniel Veillard01791d51998-07-24 19:24:09 +000072
Daniel Richard G5706b6d2012-08-06 11:32:54 +080073LT_INIT
Daniel Veillard01791d51998-07-24 19:24:09 +000074
Daniel Veillard4432df22003-09-28 18:58:27 +000075dnl
Daniel Veillard8ed10722009-08-20 19:17:36 +020076dnl if the system support linker version scripts for symbol versioning
77dnl then add it
78dnl
79VERSION_SCRIPT_FLAGS=
Roumen Petrovf39adc22010-03-11 14:49:13 +010080# lt_cv_prog_gnu_ld is from libtool 2.+
81if test "$lt_cv_prog_gnu_ld" = yes; then
82 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
83else
84 case $host in
85 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
86 esac
87fi
Daniel Veillard8ed10722009-08-20 19:17:36 +020088AC_SUBST(VERSION_SCRIPT_FLAGS)
Daniel Veillard00819872010-11-04 21:53:14 +010089AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
Daniel Veillard8ed10722009-08-20 19:17:36 +020090
91dnl
William M. Brack21e4ef22005-01-02 09:53:13 +000092dnl We process the AC_ARG_WITH first so that later we can modify
93dnl some of them to try to prevent impossible combinations. This
94dnl also allows up so alphabetize the choices
Daniel Veillard4432df22003-09-28 18:58:27 +000095dnl
Daniel Veillard4432df22003-09-28 18:58:27 +000096
William M. Brack21e4ef22005-01-02 09:53:13 +000097dnl
98dnl zlib option might change flags, so we save them initially
99dnl
Owen Taylor3473f882001-02-23 17:55:21 +0000100_cppflags="${CPPFLAGS}"
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +0800101_libs="${LIBS}"
Daniel Veillard71b656e2000-01-05 14:46:17 +0000102
William M. Brack21e4ef22005-01-02 09:53:13 +0000103AC_ARG_WITH(c14n,
104[ --with-c14n add the Canonicalization support (on)])
105AC_ARG_WITH(catalog,
106[ --with-catalog add the Catalog support (on)])
107AC_ARG_WITH(debug,
108[ --with-debug add the debugging module (on)])
109AC_ARG_WITH(docbook,
110[ --with-docbook add Docbook SGML support (on)])
111AC_ARG_WITH(fexceptions,
112[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
113AC_ARG_WITH(ftp,
114[ --with-ftp add the FTP support (on)])
115AC_ARG_WITH(history,
116[ --with-history add history support to xmllint shell(off)])
117AC_ARG_WITH(html,
118[ --with-html add the HTML support (on)])
119dnl Specific dir for HTML output ?
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800120AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
William M. Brack21e4ef22005-01-02 09:53:13 +0000121 [path to base html directory, default $datadir/doc/html]),
122 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
Daniel Veillard259ff742001-10-06 13:49:59 +0000123
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800124AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path],
William M. Brack21e4ef22005-01-02 09:53:13 +0000125 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
126 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
127 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
128AC_SUBST(HTML_DIR)
129AC_ARG_WITH(http,
130[ --with-http add the HTTP support (on)])
131AC_ARG_WITH(iconv,
132[ --with-iconv[[=DIR]] add ICONV support (on)])
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +0100133AC_ARG_WITH(icu,
134[ --with-icu add ICU support (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000135AC_ARG_WITH(iso8859x,
136[ --with-iso8859x add ISO8859X support if no iconv (on)])
137AC_ARG_WITH(legacy,
138[ --with-legacy add deprecated APIs for compatibility (on)])
139AC_ARG_WITH(mem_debug,
140[ --with-mem-debug add the memory debugging module (off)])
141AC_ARG_WITH(minimum,
142[ --with-minimum build a minimally sized library (off)])
143AC_ARG_WITH(output,
144[ --with-output add the serialization support (on)])
145AC_ARG_WITH(pattern,
146[ --with-pattern add the xmlPattern selection interface (on)])
147AC_ARG_WITH(push,
148[ --with-push add the PUSH parser interfaces (on)])
149AC_ARG_WITH(python,
150[ --with-python[[=DIR]] build Python bindings if found])
151AC_ARG_WITH(reader,
152[ --with-reader add the xmlReader parsing interface (on)])
153AC_ARG_WITH(readline,
154[ --with-readline=DIR use readline in DIR],[
155 if test "$withval" != "no" -a "$withval" != "yes"; then
156 RDL_DIR=$withval
157 CPPFLAGS="${CPPFLAGS} -I$withval/include"
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +0800158 LIBS="${LIBS} -L$withval/lib"
William M. Brack21e4ef22005-01-02 09:53:13 +0000159 fi
160])
161AC_ARG_WITH(regexps,
162[ --with-regexps add Regular Expressions support (on)])
163AC_ARG_WITH(run_debug,
164[ --with-run-debug add the runtime debugging module (off)])
165AC_ARG_WITH(sax1,
166[ --with-sax1 add the older SAX1 interface (on)])
167AC_ARG_WITH(schemas,
Daniel Veillard39e5c892005-07-03 22:48:50 +0000168[ --with-schemas add Relax-NG and Schemas support (on)])
Daniel Veillarded6c5492005-07-23 15:00:22 +0000169AC_ARG_WITH(schematron,
170[ --with-schematron add Schematron support (on)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000171AC_ARG_WITH(threads,
172[ --with-threads add multithread support(on)])
173AC_ARG_WITH(thread-alloc,
174[ --with-thread-alloc add per-thread memory(off)])
175AC_ARG_WITH(tree,
176[ --with-tree add the DOM like tree manipulation APIs (on)])
177AC_ARG_WITH(valid,
178[ --with-valid add the DTD validation support (on)])
179AC_ARG_WITH(writer,
180[ --with-writer add the xmlWriter saving interface (on)])
181AC_ARG_WITH(xinclude,
182[ --with-xinclude add the XInclude support (on)])
183AC_ARG_WITH(xpath,
184[ --with-xpath add the XPATH support (on)])
185AC_ARG_WITH(xptr,
186[ --with-xptr add the XPointer support (on)])
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000187AC_ARG_WITH(modules,
188[ --with-modules add the dynamic modules support (on)])
Owen Taylor3473f882001-02-23 17:55:21 +0000189AC_ARG_WITH(zlib,
William M. Brack97ad4c72003-05-13 08:08:36 +0000190[ --with-zlib[[=DIR]] use libz in DIR],[
Owen Taylor3473f882001-02-23 17:55:21 +0000191 if test "$withval" != "no" -a "$withval" != "yes"; then
192 Z_DIR=$withval
193 CPPFLAGS="${CPPFLAGS} -I$withval/include"
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +0800194 LIBS="${LIBS} -L$withval/lib"
Owen Taylor3473f882001-02-23 17:55:21 +0000195 fi
Daniel Veillard259ff742001-10-06 13:49:59 +0000196])
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200197AC_ARG_WITH(lzma,
198[ --with-lzma[[=DIR]] use liblzma in DIR],[
199 if test "$withval" != "no" -a "$withval" != "yes"; then
200 LZMA_DIR=$withval
201 CPPFLAGS="${CPPFLAGS} -I$withval/include"
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +0800202 LIBS="${LIBS} -L$withval/lib"
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200203 fi
204])
Daniel Veillardbfa5cf12008-08-27 15:33:28 +0000205AC_ARG_WITH(coverage,
206[ --with-coverage build for code coverage with GCC (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000207
Daniel Veillardb40744e2008-10-17 13:26:44 +0000208AC_ARG_ENABLE(rebuild-docs,
Daniel Richard G5706b6d2012-08-06 11:32:54 +0800209[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=no]]])
Daniel Richard878ec9d2012-09-07 14:52:17 +0800210if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then
211 AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir])
212fi
Daniel Veillard28cc42d2012-08-10 10:00:18 +0800213AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes" -o "$USER" = "veillard"])
Daniel Veillardb40744e2008-10-17 13:26:44 +0000214
William M. Brack21e4ef22005-01-02 09:53:13 +0000215dnl
Daniel Veillard39e5c892005-07-03 22:48:50 +0000216dnl hard dependancies on options
217dnl
218if test "$with_schemas" = "yes"
219then
220 with_pattern=yes
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000221 with_regexps=yes
Daniel Veillard39e5c892005-07-03 22:48:50 +0000222fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000223if test "$with_schematron" = "yes"
224then
225 with_pattern=yes
226 with_xpath=yes
227fi
Daniel Veillard39e5c892005-07-03 22:48:50 +0000228if test "$with_reader" = "yes"
229then
230 with_push=yes
231fi
232if test "$with_xptr" = "yes"
233then
234 with_xpath=yes
235fi
236dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000237dnl option to build a minimal libxml2 library
238dnl
239if test "$with_minimum" = "yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000240then
William M. Brack21e4ef22005-01-02 09:53:13 +0000241 echo "Configuring for a minimal library"
242 if test "$with_c14n" = ""
243 then
244 with_c14n=no
245 fi
246 if test "$with_catalog" = ""
247 then
248 with_catalog=no
249 fi
250 echo So far so good!
251 if test "$with_debug" = ""
252 then
253 with_debug=no
254 fi
255 if test "$with_docbook" = ""
256 then
257 with_docbook=no
258 fi
259 if test "$with_fexceptions" = ""
260 then
261 with_fexceptions=no
262 fi
263 if test "$with_ftp" = ""
264 then
265 with_ftp=no
266 fi
267 if test "$with_history" = ""
268 then
269 with_history=no
270 fi
271 if test "$with_html" = ""
272 then
273 with_html=no
274 fi
275 if test "$with_http" = ""
276 then
277 with_http=no
278 fi
279 if test "$with_iconv" = ""
280 then
281 with_iconv=no
282 fi
283 if test "$with_iso8859x" = ""
284 then
285 with_iso8859x=no
286 fi
287 if test "$with_legacy" = ""
288 then
289 with_legacy=no
290 fi
291 if test "$with_mem_debug" = ""
292 then
293 with_mem_debug=no
294 fi
295 if test "$with_output" = ""
296 then
297 with_output=no
298 fi
299 if test "$with_pattern" = ""
300 then
301 with_pattern=no
302 fi
303 if test "$with_push" = ""
304 then
305 with_push=no
306 fi
307 if test "$with_python" = ""
308 then
309 with_python=no
310 fi
311 if test "$with_reader" = ""
312 then
313 with_reader=no
314 fi
315 if test "$with_readline" = ""
316 then
317 with_readline=no
318 fi
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000319 if test "$with_regexps" = ""
William M. Brack21e4ef22005-01-02 09:53:13 +0000320 then
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000321 with_regexps=no
William M. Brack21e4ef22005-01-02 09:53:13 +0000322 fi
323 if test "$with_run_debug" = ""
324 then
325 with_run_debug=no
326 fi
327 if test "$with_sax1" = ""
328 then
329 with_sax1=no
330 fi
331 if test "$with_schemas" = ""
332 then
333 with_schemas=no
334 fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000335 if test "$with_schematron" = ""
336 then
337 with_schematron=no
338 fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000339 if test "$with_threads" = ""
340 then
341 with_threads=no
342 fi
343 if test "$with_thread_alloc" = ""
344 then
345 with_thread_alloc=no
346 fi
347 if test "$with_tree" = ""
348 then
349 with_tree=no
350 fi
351 if test "$with_valid" = ""
352 then
353 with_valid=no
354 fi
355 if test "$with_writer" = ""
356 then
357 with_writer=no
358 fi
359 if test "$with_xinclude" = ""
360 then
361 with_xinclude=no
362 fi
363 if test "$with_xpath" = ""
364 then
365 with_xpath=no
366 fi
367 if test "$with_xptr" = ""
368 then
369 with_xptr=no
370 fi
371 if test "$with_zlib" = ""
372 then
373 with_zlib=no
374 fi
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000375 if test "$with_modules" = ""
376 then
377 with_modules=no
378 fi
Daniel Veillard4432df22003-09-28 18:58:27 +0000379fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000380
381echo Checking zlib
382
383dnl Checks for zlib library.
384
Daniel Veillard75acfee2006-07-13 06:29:56 +0000385WITH_ZLIB=0
Daniel Veillard259ff742001-10-06 13:49:59 +0000386if test "$with_zlib" = "no"; then
387 echo "Disabling compression support"
388else
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000389 AC_CHECK_HEADERS(zlib.h,
390 AC_CHECK_LIB(z, gzread,[
Daniel Veillard75acfee2006-07-13 06:29:56 +0000391 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
392 WITH_ZLIB=1
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000393 if test "x${Z_DIR}" != "x"; then
394 Z_CFLAGS="-I${Z_DIR}/include"
395 Z_LIBS="-L${Z_DIR}/lib -lz"
396 [case ${host} in
397 *-*-solaris*)
398 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
399 ;;
400 esac]
401 else
402 Z_LIBS="-lz"
403 fi]))
Daniel Veillard259ff742001-10-06 13:49:59 +0000404fi
Owen Taylor3473f882001-02-23 17:55:21 +0000405
Owen Taylor3473f882001-02-23 17:55:21 +0000406AC_SUBST(Z_CFLAGS)
407AC_SUBST(Z_LIBS)
Daniel Veillard75acfee2006-07-13 06:29:56 +0000408AC_SUBST(WITH_ZLIB)
Owen Taylor3473f882001-02-23 17:55:21 +0000409
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200410echo Checking lzma
411
412dnl Checks for lzma library.
413
414WITH_LZMA=0
415if test "$with_lzma" = "no"; then
416 echo "Disabling compression support"
417else
Philip Withnallf3f86ff2013-10-28 17:24:02 +0000418 # Try pkg-config first so that static linking works.
419 # If this succeeeds, we ignore the WITH_LZMA directory.
420 PKG_CHECK_MODULES([LZMA],[liblzma],
421 [have_liblzma=yes],
422 [have_liblzma=no])
423
424 # If pkg-config failed, fall back to AC_CHECK_LIB. This
425 # will not pick up the necessary LIBS flags for liblzma's
426 # private dependencies, though, so static linking may fail.
427 if test "x$have_liblzma" = "xno"; then
428 AC_CHECK_HEADERS(lzma.h,
429 AC_CHECK_LIB(lzma, lzma_code,[
430 have_liblzma=yes
431 if test "x${LZMA_DIR}" != "x"; then
432 LZMA_CFLAGS="-I${LZMA_DIR}/include"
433 LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
434 else
435 LZMA_LIBS="-llzma"
436 fi],
437 [have_liblzma=no]))
438 fi
439
440 # Found the library via either method?
441 if test "x$have_liblzma" = "xyes"; then
442 AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
443 WITH_LZMA=1
444 fi
Anders F Bjorklundeae52612011-09-18 16:59:13 +0200445fi
446
447AC_SUBST(LZMA_CFLAGS)
448AC_SUBST(LZMA_LIBS)
449AC_SUBST(WITH_LZMA)
450
Owen Taylor3473f882001-02-23 17:55:21 +0000451CPPFLAGS=${_cppflags}
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +0800452LIBS=${_libs}
Daniel Veillardb05deb71999-08-10 19:04:08 +0000453
William M. Brack21e4ef22005-01-02 09:53:13 +0000454echo Checking headers
455
Daniel Veillard01791d51998-07-24 19:24:09 +0000456dnl Checks for header files.
457AC_HEADER_DIRENT
458AC_HEADER_STDC
Daniel Veillard817e70b2002-11-19 22:28:48 +0000459AC_CHECK_HEADERS([fcntl.h])
460AC_CHECK_HEADERS([unistd.h])
461AC_CHECK_HEADERS([ctype.h])
462AC_CHECK_HEADERS([dirent.h])
463AC_CHECK_HEADERS([errno.h])
464AC_CHECK_HEADERS([malloc.h])
465AC_CHECK_HEADERS([stdarg.h])
466AC_CHECK_HEADERS([sys/stat.h])
467AC_CHECK_HEADERS([sys/types.h])
Daniel Veillard7f4547c2008-10-03 07:58:23 +0000468AC_CHECK_HEADERS([stdint.h])
Daniel Mustielesbde9c352012-03-19 21:39:58 +0100469AC_CHECK_HEADERS([inttypes.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000470AC_CHECK_HEADERS([time.h])
471AC_CHECK_HEADERS([ansidecl.h])
472AC_CHECK_HEADERS([ieeefp.h])
473AC_CHECK_HEADERS([nan.h])
474AC_CHECK_HEADERS([math.h])
Daniel Veillardebe48c62003-12-03 12:12:27 +0000475AC_CHECK_HEADERS([limits.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000476AC_CHECK_HEADERS([fp_class.h])
477AC_CHECK_HEADERS([float.h])
478AC_CHECK_HEADERS([stdlib.h])
479AC_CHECK_HEADERS([sys/socket.h], [], [],
480[#if HAVE_SYS_TYPES_H
481# include <sys/types.h>
482# endif
483])
484AC_CHECK_HEADERS([netinet/in.h], [], [],
485[#if HAVE_SYS_TYPES_H
486# include <sys/types.h>
487# endif
488])
489AC_CHECK_HEADERS([arpa/inet.h], [], [],
490[#if HAVE_SYS_TYPES_H
491# include <sys/types.h>
492# endif
493#if HAVE_ARPA_INET_H
494# include <arpa/inet.h>
495# endif
496])
497AC_CHECK_HEADERS([netdb.h])
498AC_CHECK_HEADERS([sys/time.h])
499AC_CHECK_HEADERS([sys/select.h])
Raphael Prevost48b60c32009-08-23 13:11:01 +0200500AC_CHECK_HEADERS([poll.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000501AC_CHECK_HEADERS([sys/mman.h])
502AC_CHECK_HEADERS([sys/timeb.h])
503AC_CHECK_HEADERS([signal.h])
504AC_CHECK_HEADERS([arpa/nameser.h], [], [],
505[#if HAVE_SYS_TYPES_H
506# include <sys/types.h>
507# endif
508])
509AC_CHECK_HEADERS([resolv.h], [], [],
510[#if HAVE_SYS_TYPES_H
511# include <sys/types.h>
512# endif
513#if HAVE_NETINET_IN_H
514# include <netinet/in.h>
515# endif
516#if HAVE_ARPA_NAMESER_H
517# include <arpa/nameser.h>
518# endif
519])
Daniel Veillarddcd93902005-01-13 11:25:15 +0000520AC_CHECK_HEADERS([dl.h])
521AC_CHECK_HEADERS([dlfcn.h])
Daniel Veillard01791d51998-07-24 19:24:09 +0000522
Daniel Veillardfc979062004-03-04 22:07:16 +0000523
Daniel Richard G5706b6d2012-08-06 11:32:54 +0800524echo Checking types
525
526AC_TYPE_UINT32_T
527
528
William M. Brack21e4ef22005-01-02 09:53:13 +0000529echo Checking libraries
Daniel Veillard1164e751999-02-16 16:29:17 +0000530
Daniel Veillard01791d51998-07-24 19:24:09 +0000531dnl Checks for library functions.
532AC_FUNC_STRFTIME
Daniel Veillard92ad2102001-03-27 12:47:33 +0000533AC_CHECK_FUNCS(strdup strndup strerror)
Daniel Veillard71b656e2000-01-05 14:46:17 +0000534AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
Daniel Veillard90bc3712002-03-07 15:12:58 +0000535AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
Daniel Veillard068a9652001-06-07 15:30:26 +0000536AC_CHECK_FUNCS(stat _stat signal)
Daniel Veillardd495e6a2012-05-20 20:48:34 +0800537AC_CHECK_FUNCS(rand rand_r srand time)
Daniel Richard G5706b6d2012-08-06 11:32:54 +0800538AC_CHECK_FUNCS(isascii mmap munmap putenv)
539
540AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
541#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
542# undef /**/ HAVE_MMAP
543#endif])
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000544
William M. Brackf4caa5e2005-10-20 09:04:05 +0000545dnl Checking for va_copy availability
546AC_MSG_CHECKING([for va_copy])
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800547AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
548va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])],
William M. Brackf4caa5e2005-10-20 09:04:05 +0000549have_va_copy=yes,
550have_va_copy=no)
551AC_MSG_RESULT($have_va_copy)
552if test x"$have_va_copy" = x"yes"; then
553 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
554else
555 AC_MSG_CHECKING([for __va_copy])
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800556 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
557 va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],
William M. Brackf4caa5e2005-10-20 09:04:05 +0000558 have___va_copy=yes,
559 have___va_copy=no)
560 AC_MSG_RESULT($have___va_copy)
561 if test x"$have___va_copy" = x"yes"; then
562 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
563 fi
564fi
565
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000566dnl Checks for inet libraries:
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000567AC_SEARCH_LIBS(gethostent, [nsl])
Scott McCreary59f53082009-08-26 09:55:24 +0200568AC_SEARCH_LIBS(setsockopt, [socket net network])
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000569AC_SEARCH_LIBS(connect, [inet])
Daniel Veillardb05deb71999-08-10 19:04:08 +0000570
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000571dnl Determine what socket length (socklen_t) data type is
572AC_MSG_CHECKING([for type of socket length (socklen_t)])
573AC_TRY_COMPILE2([
574#include <stddef.h>
575#include <sys/types.h>
576#include <sys/socket.h>],[
577(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
578 AC_MSG_RESULT(socklen_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000579 XML_SOCKLEN_T=socklen_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000580 AC_TRY_COMPILE2([
581#include <stddef.h>
582#include <sys/types.h>
583#include <sys/socket.h>],[
584(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
585 AC_MSG_RESULT(size_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000586 XML_SOCKLEN_T=size_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000587 AC_TRY_COMPILE2([
588#include <stddef.h>
589#include <sys/types.h>
590#include <sys/socket.h>],[
591(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
592 AC_MSG_RESULT(int *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000593 XML_SOCKLEN_T=int],[
William M. Brack2e6b1432004-02-09 15:10:28 +0000594 AC_MSG_WARN(could not determine)
Daniel Veillardc284c642005-03-31 10:24:24 +0000595 XML_SOCKLEN_T="int"])])])
596AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000597
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000598dnl ***********************Checking for availability of IPv6*******************
599
600AC_MSG_CHECKING([whether to enable IPv6])
William M. Brack21e4ef22005-01-02 09:53:13 +0000601AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
Daniel Veillard4432df22003-09-28 18:58:27 +0000602if test "$with_minimum" = "yes"
603then
604 enable_ipv6=no
605fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000606if test $enable_ipv6 = yes; then
607 have_ipv6=no
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
609# include <sys/types.h>
610# include <sys/socket.h>
611 ]], [[
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000612 struct sockaddr_storage ss;
613 socket(AF_INET6, SOCK_STREAM, 0)
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800614 ]])],
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000615 have_ipv6=yes,
616 have_ipv6=no
617 )
618 AC_MSG_RESULT($have_ipv6)
619
William M. Brack476cd962003-08-13 11:09:42 +0000620 if test $have_ipv6 = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000621 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000622 have_broken_ss_family=no
623
624 dnl *********************************************************************
625 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
626 dnl a ss_family member, but rather __ss_family. Let's detect that
William M. Brack7d8b36b2005-06-25 07:30:50 +0000627 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
628 dnl platforms. However, we should only do this if ss_family is not
629 dnl present.
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000630 dnl ********************************************************************
William M. Brack7d8b36b2005-06-25 07:30:50 +0000631 AC_MSG_CHECKING([struct sockaddr::ss_family])
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
633# include <sys/types.h>
634# include <sys/socket.h>
635 ]], [[
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000636 struct sockaddr_storage ss ;
William M. Brack7d8b36b2005-06-25 07:30:50 +0000637 ss.ss_family = 0 ;
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800638 ]])],
William M. Brack7d8b36b2005-06-25 07:30:50 +0000639 have_ss_family=yes,
640 have_ss_family=no
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000641 )
William M. Brack7d8b36b2005-06-25 07:30:50 +0000642 AC_MSG_RESULT($have_ss_family)
643 if test x$have_ss_family = xno ; then
644 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
646# include <sys/types.h>
647# include <sys/socket.h>
648 ]], [[
William M. Brack7d8b36b2005-06-25 07:30:50 +0000649 struct sockaddr_storage ss ;
650 ss.__ss_family = 0 ;
Daniel Richard Gec4fc522012-08-17 10:04:30 +0800651 ]])],
William M. Brack7d8b36b2005-06-25 07:30:50 +0000652 have_broken_ss_family=yes,
653 have_broken_ss_family=no
654 )
655 AC_MSG_RESULT($have_broken_ss_family)
656 if test x$have_broken_ss_family = xyes ; then
657 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
658 [Whether struct sockaddr::__ss_family exists])
659 AC_DEFINE(ss_family, __ss_family,
660 [ss_family is not defined here, use __ss_family instead])
661 else
662 AC_MSG_WARN(ss_family and __ss_family not found)
663 fi
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000664 fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000665
666 have_getaddrinfo=no
667 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
668 if test $have_getaddrinfo != yes; then
669 for lib in bsd socket inet; do
670 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
671 done
672 fi
673
William M. Brack476cd962003-08-13 11:09:42 +0000674 if test $have_getaddrinfo = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000675 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000676 fi
677 fi
678fi
679
680dnl ******************************End IPv6 checks******************************
681
Daniel Veillardb05deb71999-08-10 19:04:08 +0000682dnl Checks for isnan in libm if not in libc
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000683AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
Daniel Veillardc790bf42003-10-11 10:50:10 +0000684 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000685
Daniel Veillardc790bf42003-10-11 10:50:10 +0000686AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
687 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000688
689XML_LIBDIR='-L${libdir}'
Daniel Veillarde7dd2b82002-03-15 18:44:02 +0000690XML_INCLUDEDIR='-I${includedir}/libxml2'
Daniel Veillardb05deb71999-08-10 19:04:08 +0000691
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000692dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000693dnl Extra flags
694dnl
695XML_CFLAGS=""
Daniel Veillard357c9602001-05-03 10:49:20 +0000696RDL_LIBS=""
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000697
698dnl
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000699dnl Workaround for native compilers
700dnl HP : http://bugs.gnome.org/db/31/3163.html
701dnl DEC : Enable NaN/Inf
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000702dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000703if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000704 case "${host}" in
Daniel Veillard6a0baa02005-12-10 11:11:12 +0000705 hppa*-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000706 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000707 ;;
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000708 *-dec-osf* )
709 CFLAGS="${CFLAGS} -ieee"
710 ;;
William M. Brack476cd962003-08-13 11:09:42 +0000711 alpha*-*-linux* )
712 CFLAGS="${CFLAGS} -ieee"
713 ;;
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000714 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000715else
Daniel Veillardd94849b2003-07-28 13:02:24 +0000716 if test "$with_fexceptions" = "yes"
717 then
718 #
719 # Not activated by default because this inflates the code size
720 # Used to allow propagation of C++ exceptions through the library
721 #
722 CFLAGS="${CFLAGS} -fexceptions"
723 fi
Stefan Kost85deb482011-05-10 10:55:07 +0300724
725 # warnings we'd like to see
726 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"
727 # warnings we'd like to supress
728 CFLAGS="${CFLAGS} -Wno-long-long"
Daniel Veillard14839d52001-06-06 16:11:56 +0000729 case "${host}" in
730 alpha*-*-linux* )
731 CFLAGS="${CFLAGS} -mieee"
732 ;;
Daniel Veillardcb5b4d62002-04-11 08:24:26 +0000733 alpha*-*-osf* )
734 CFLAGS="${CFLAGS} -mieee"
735 ;;
Daniel Veillard14839d52001-06-06 16:11:56 +0000736 esac
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000737fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000738case ${host} in
739 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000740 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
741 ;;
Daniel Veillardd30be4a2002-03-28 18:25:31 +0000742 hppa*-hp-mpeix)
743 NEED_TRIO=1
744 ;;
Daniel Veillard4188ddf2006-01-19 08:58:42 +0000745 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
746 # If the host is Windows, and shared libraries are disabled, we
747 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
748 # work properly (without it, xmlexports.h would force the use of
749 # DLL imports, which obviously aren't present in a static
750 # library).
751 if test "x$enable_shared" = "xno"; then
752 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
753 CFLAGS="$CFLAGS -DLIBXML_STATIC"
754 fi
755 ;;
Daniel Veillardd2ade932000-09-30 14:39:55 +0000756esac
757
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000758
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000759dnl
760dnl check for python
761dnl
762
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000763PYTHON_VERSION=
764PYTHON_INCLUDES=
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000765PYTHON_SITE_PACKAGES=
Daniel Veillard6dc91962004-03-22 19:10:02 +0000766PYTHON_TESTS=
Daniel Veillard38b80a82003-05-14 18:59:00 +0000767pythondir=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000768if test "$with_python" != "no" ; then
769 if test -x "$with_python/bin/python"
770 then
771 echo Found python in $with_python/bin/python
772 PYTHON="$with_python/bin/python"
Daniel Veillard9b731d72002-04-14 12:56:08 +0000773 else
LRNfbd4ddf2010-11-04 15:45:46 +0100774 if test -x "$with_python/python.exe"
775 then
776 echo Found python in $with_python/python.exe
777 PYTHON="$with_python/python.exe"
778 else
779 if test -x "$with_python"
780 then
781 echo Found python in $with_python
782 PYTHON="$with_python"
783 else
784 if test -x "$PYTHON"
785 then
786 echo Found python in environment PYTHON=$PYTHON
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800787 with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
LRNfbd4ddf2010-11-04 15:45:46 +0100788 else
789 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
790 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000791 fi
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000792 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000793 fi
794 if test "$PYTHON" != ""
795 then
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800796 PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
797 PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
798# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
799#
800# PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000801 echo Found Python version $PYTHON_VERSION
802 fi
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800803 if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000804 then
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800805 if test -r $with_python/include/python$PYTHON_VERSION/Python.h
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000806 then
807 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
808 else
809 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
810 then
Daniel Veillard8492ba12006-04-25 12:52:12 +0000811 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000812 else
813 if test -r /usr/include/python$PYTHON_VERSION/Python.h
814 then
815 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
816 else
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800817 if test -r $with_python/include/Python.h
LRNfbd4ddf2010-11-04 15:45:46 +0100818 then
819 PYTHON_INCLUDES=$with_python/include
LRNfbd4ddf2010-11-04 15:45:46 +0100820 else
821 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
822 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000823 fi
824 fi
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800825 fi
826 fi
827 if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
828 then
829 if test -d $libdir/python$PYTHON_VERSION/site-packages
830 then
831 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
832 else
833 if test -d $with_python/lib/site-packages
Daniel Veillardb6984ef2002-08-14 16:55:31 +0000834 then
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800835 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
836 else
837 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
Daniel Veillardb6984ef2002-08-14 16:55:31 +0000838 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000839 fi
840 fi
Daniel Veillardb8e3f802013-03-28 09:46:20 +0800841 pythondir='$(PYTHON_SITE_PACKAGES)'
842 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000843else
844 PYTHON=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000845fi
846AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
Daniel Veillard40b11342002-09-20 12:01:39 +0000847if test "$PYTHON_INCLUDES" != ""
848then
849 PYTHON_SUBDIR=python
850else
851 PYTHON_SUBDIR=
852fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000853AC_SUBST(pythondir)
Daniel Veillard40b11342002-09-20 12:01:39 +0000854AC_SUBST(PYTHON_SUBDIR)
Frederic Crozate21731d2009-09-12 18:02:40 +0200855AC_SUBST(PYTHON_LIBS)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000856
Daniel Veillardce1648b2005-01-04 15:10:22 +0000857dnl check for dso support
858WITH_MODULES=0
Daniel Veillardce1648b2005-01-04 15:10:22 +0000859TEST_MODULES=
860
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000861if test "$with_modules" != "no" ; then
Daniel Veillard9202b672005-07-14 09:31:14 +0000862 case "$host" in
863 *-*-cygwin*)
864 MODULE_EXTENSION=".dll"
865 AC_CHECK_LIB(cygwin, dlopen, [
866 WITH_MODULES=1
867 MODULE_PLATFORM_LIBS=
868 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
869 ])
870 ;;
Roumen Petrov120a2692010-03-10 10:07:49 +0100871 *-*-mingw*)
872 MODULE_EXTENSION=".dll"
873 WITH_MODULES=1
874 ;;
Daniel Veillard9202b672005-07-14 09:31:14 +0000875 *)
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000876 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
877 AC_CHECK_LIB(dld, shl_load, [
878 MODULE_PLATFORM_LIBS="-ldld"
879 libxml_have_shl_load=yes], [
880 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
881 AC_CHECK_LIB(dl, dlopen, [
882 MODULE_PLATFORM_LIBS="-ldl"
883 libxml_have_dlopen=yes])])])])
884
885 if test "${libxml_have_shl_load}" = "yes"; then
886 MODULE_EXTENSION=".sl"
Daniel Veillard9202b672005-07-14 09:31:14 +0000887 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000888 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000889 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000890
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000891 if test "${libxml_have_dlopen}" = "yes"; then
892 case "${host}" in
893 *-*-hpux* )
894 MODULE_EXTENSION=".sl"
895 ;;
896 * )
897 MODULE_EXTENSION=".so"
898 ;;
899 esac
900
Daniel Veillard9202b672005-07-14 09:31:14 +0000901 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000902 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000903 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000904 ;;
905 esac
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000906fi
Daniel Veillardce1648b2005-01-04 15:10:22 +0000907
908if test "${WITH_MODULES}" = "1"; then
909 TEST_MODULES="ModuleTests"
910fi
911
912AC_SUBST(WITH_MODULES)
913AC_SUBST(MODULE_PLATFORM_LIBS)
914AC_SUBST(MODULE_EXTENSION)
915AC_SUBST(TEST_MODULES)
916
Daniel Veillard437b87b2000-01-03 17:30:46 +0000917dnl
918dnl Tester makes use of readline if present
919dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000920
Daniel Veillard361d8452000-04-03 19:48:13 +0000921dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000922dnl specific tests to setup DV and Bill's devel environments with debug etc ...
Daniel Veillard81418e32001-05-22 15:08:55 +0000923dnl (-Wunreachable-code)
Daniel Veillardf6eea272001-01-18 12:17:12 +0000924dnl
William M. Brack871611b2003-10-18 04:53:14 +0000925if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
Daniel Veillardb7c6ac42004-06-29 22:01:27 +0000926 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
William M. Brack7f28a012007-01-11 23:42:10 +0000927 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
William M. Brack871611b2003-10-18 04:53:14 +0000928 then
Daniel Veillard4432df22003-09-28 18:58:27 +0000929 if test "$with_minimum" != "yes"
930 then
931 if test "${with_mem_debug}" = "" ; then
Daniel Veillard379a3b72005-08-12 10:18:14 +0000932 echo Activating memory debugging
Daniel Veillard4432df22003-09-28 18:58:27 +0000933 with_mem_debug="yes"
Daniel Veillard22cdb842004-10-04 14:09:17 +0000934 with_run_debug="yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000935 fi
936 if test "${with_docbook}" = "" ; then
937 with_docbook="yes"
938 fi
Daniel Veillardeae522a2001-04-23 13:41:34 +0000939 fi
Daniel Veillard3854c572005-08-25 10:17:45 +0000940 if test "${GCC}" = "yes" ; then
Daniel Veillard05f97352004-10-31 15:35:32 +0000941 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 +0000942 fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000943 STATIC_BINARIES="-static"
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000944dnl -Wcast-qual -ansi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000945else
946 STATIC_BINARIES=
Daniel Veillardf6eea272001-01-18 12:17:12 +0000947fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000948AC_SUBST(STATIC_BINARIES)
Daniel Veillard92ad2102001-03-27 12:47:33 +0000949
950dnl
951dnl Check for trio string functions
952dnl
953
954if test "${NEED_TRIO}" = "1" ; then
955 echo Adding trio library for string functions
956 WITH_TRIO=1
957else
958 WITH_TRIO=0
959fi
Daniel Veillard01ef7382001-05-08 07:31:43 +0000960AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
Daniel Veillard92ad2102001-03-27 12:47:33 +0000961AC_SUBST(WITH_TRIO)
962
Daniel Veillardf6eea272001-01-18 12:17:12 +0000963dnl
William M. Brack97ad4c72003-05-13 08:08:36 +0000964dnl Allow to enable/disable various pieces
Daniel Veillard361d8452000-04-03 19:48:13 +0000965dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000966echo Checking configuration requirements
Daniel Veillard361d8452000-04-03 19:48:13 +0000967
William M. Brack21e4ef22005-01-02 09:53:13 +0000968dnl
969dnl Thread-related stuff
970dnl
Daniel Veillardb8478642001-10-12 17:29:10 +0000971THREAD_LIBS=""
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000972BASE_THREAD_LIBS=""
Daniel Veillardb8478642001-10-12 17:29:10 +0000973WITH_THREADS=0
974THREAD_CFLAGS=""
Daniel Veillardab7488e2001-10-17 11:30:37 +0000975TEST_THREADS=""
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000976THREADS_W32=""
Tim Starling0ad948e2012-10-29 13:41:55 +1100977WITH_THREAD_ALLOC=0
Daniel Veillard64a411c2001-10-15 12:32:07 +0000978
Daniel Veillard84942712003-04-18 14:40:05 +0000979if test "$with_threads" = "no" ; then
980 echo Disabling multithreaded support
981else
Daniel Veillardb8478642001-10-12 17:29:10 +0000982 echo Enabling multithreaded support
Sam Thursfield115581a2012-05-09 18:46:56 +0800983
984 dnl Default to native threads on Win32
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000985 case $host_os in
Sam Thursfield115581a2012-05-09 18:46:56 +0800986 *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
LRN203fd2e2009-08-07 21:47:25 +0200987 WITH_THREADS="1"
Daniel Richard G5706b6d2012-08-06 11:32:54 +0800988 THREADS_W32="1"
Sam Thursfield115581a2012-05-09 18:46:56 +0800989 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
LRN203fd2e2009-08-07 21:47:25 +0200990 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000991 ;;
Sam Thursfield115581a2012-05-09 18:46:56 +0800992 esac
993
994 dnl Use pthread by default in other cases
995 if test -z "$THREADS_W32"; then
996 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
997 AC_CHECK_HEADER(pthread.h,
998 AC_CHECK_LIB(pthread, pthread_join,[
999 THREAD_LIBS="-lpthread"
1000 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
1001 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
1002 WITH_THREADS="1"]))
1003 fi
1004 fi
1005
1006 case $host_os in
William M. Bracka73f45b2005-01-11 02:21:33 +00001007 *cygwin*) THREAD_LIBS=""
1008 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +00001009 *beos*) WITH_THREADS="1"
1010 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
1011 ;;
Daniel Veillarddbfe05a2005-05-04 09:18:00 +00001012 *linux*)
Daniel Veillard32a461f2005-08-25 21:48:54 +00001013 if test "${GCC}" = "yes" ; then
1014 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
1015 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
1016 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
1017 if test "${THREAD_LIBS}" = "-lpthread" ; then
1018 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
1019 then
1020 THREAD_LIBS=""
1021 BASE_THREAD_LIBS="-lpthread"
1022 else
LRN203fd2e2009-08-07 21:47:25 +02001023 if expr ${GCC_MAJOR} \> 3 > /dev/null
Daniel Veillard32a461f2005-08-25 21:48:54 +00001024 then
1025 THREAD_LIBS=""
1026 BASE_THREAD_LIBS="-lpthread"
1027 else
1028 echo old GCC disabling weak symbols for pthread
1029 fi
1030 fi
1031 fi
Daniel Veillarddbfe05a2005-05-04 09:18:00 +00001032 fi
1033 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001034 esac
Daniel Veillardb8478642001-10-12 17:29:10 +00001035 if test "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +00001036 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
1037 TEST_THREADS="Threadtests"
Daniel Veillardb8478642001-10-12 17:29:10 +00001038 fi
1039fi
William M. Brack306e33c2004-06-12 01:01:22 +00001040if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
Tim Starling0ad948e2012-10-29 13:41:55 +11001041 WITH_THREAD_ALLOC=1
Daniel Veillard64a411c2001-10-15 12:32:07 +00001042fi
1043
Daniel Veillardb8478642001-10-12 17:29:10 +00001044AC_SUBST(THREAD_LIBS)
Daniel Veillarddbfe05a2005-05-04 09:18:00 +00001045AC_SUBST(BASE_THREAD_LIBS)
Daniel Veillardb8478642001-10-12 17:29:10 +00001046AC_SUBST(WITH_THREADS)
1047AC_SUBST(THREAD_CFLAGS)
Daniel Veillardab7488e2001-10-17 11:30:37 +00001048AC_SUBST(TEST_THREADS)
Tim Starling0ad948e2012-10-29 13:41:55 +11001049AC_SUBST(WITH_THREAD_ALLOC)
Roumen Petrov8886f332012-08-13 16:38:09 +08001050AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
Daniel Veillardb8478642001-10-12 17:29:10 +00001051
William M. Brack21e4ef22005-01-02 09:53:13 +00001052dnl
1053dnl xmllint shell history
1054dnl
Daniel Veillard259ff742001-10-06 13:49:59 +00001055if test "$with_history" = "yes" ; then
Daniel Veillardf012a642001-07-23 19:10:52 +00001056 echo Enabling xmllint shell history
1057 dnl check for terminal library. this is a very cool solution
1058 dnl from octave's configure.in
1059 unset tcap
1060 for termlib in ncurses curses termcap terminfo termlib; do
1061 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
1062 test -n "$tcap" && break
1063 done
1064
1065 AC_CHECK_HEADER(readline/history.h,
1066 AC_CHECK_LIB(history, append_history,[
1067 RDL_LIBS="-lhistory"
Daniel Veillardc790bf42003-10-11 10:50:10 +00001068 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
Daniel Veillardf012a642001-07-23 19:10:52 +00001069 AC_CHECK_HEADER(readline/readline.h,
1070 AC_CHECK_LIB(readline, readline,[
1071 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
Daniel Veillardc790bf42003-10-11 10:50:10 +00001072 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
Daniel Veillardf012a642001-07-23 19:10:52 +00001073 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
1074 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
1075 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
Daniel Veillardf012a642001-07-23 19:10:52 +00001076 fi
Daniel Veillardf012a642001-07-23 19:10:52 +00001077fi
1078
William M. Brack21e4ef22005-01-02 09:53:13 +00001079dnl
1080dnl Tree functions
1081dnl
Daniel Veillard652327a2003-09-29 18:02:38 +00001082if test "$with_tree" = "no" ; then
1083 echo Disabling DOM like tree manipulation APIs
1084 WITH_TREE=0
1085else
1086 WITH_TREE=1
1087fi
1088AC_SUBST(WITH_TREE)
1089
Daniel Veillard361d8452000-04-03 19:48:13 +00001090if test "$with_ftp" = "no" ; then
1091 echo Disabling FTP support
1092 WITH_FTP=0
1093 FTP_OBJ=
1094else
1095 WITH_FTP=1
1096 FTP_OBJ=nanoftp.o
1097fi
1098AC_SUBST(WITH_FTP)
1099AC_SUBST(FTP_OBJ)
1100
Daniel Veillard361d8452000-04-03 19:48:13 +00001101if test "$with_http" = "no" ; then
1102 echo Disabling HTTP support
1103 WITH_HTTP=0
1104 HTTP_OBJ=
1105else
1106 WITH_HTTP=1
1107 HTTP_OBJ=nanohttp.o
1108fi
1109AC_SUBST(WITH_HTTP)
1110AC_SUBST(HTTP_OBJ)
1111
Daniel Veillard4432df22003-09-28 18:58:27 +00001112if test "$with_legacy" = "no" ; then
1113 echo Disabling deprecated APIs
1114 WITH_LEGACY=0
1115else
1116 WITH_LEGACY=1
1117fi
1118AC_SUBST(WITH_LEGACY)
1119
Daniel Veillard81273902003-09-30 00:43:48 +00001120if test "$with_reader" = "no" ; then
1121 echo Disabling the xmlReader parsing interface
1122 WITH_READER=0
Daniel Veillard73b013f2003-09-30 12:36:01 +00001123 READER_TEST=
Daniel Veillard81273902003-09-30 00:43:48 +00001124else
1125 WITH_READER=1
Daniel Veillard73b013f2003-09-30 12:36:01 +00001126 READER_TEST=Readertests
William M. Brack21e4ef22005-01-02 09:53:13 +00001127 if test "$with_push" = "no" ; then
1128 echo xmlReader requires Push interface - enabling it
1129 with_push=yes
1130 fi
Daniel Veillard81273902003-09-30 00:43:48 +00001131fi
1132AC_SUBST(WITH_READER)
Daniel Veillard73b013f2003-09-30 12:36:01 +00001133AC_SUBST(READER_TEST)
Daniel Veillard81273902003-09-30 00:43:48 +00001134
William M. Brack21e4ef22005-01-02 09:53:13 +00001135if test "$with_writer" = "no" ; then
1136 echo Disabling the xmlWriter saving interface
1137 WITH_WRITER=0
1138# WRITER_TEST=
1139else
1140 WITH_WRITER=1
1141# WRITER_TEST=Writertests
1142 if test "$with_push" = "no" ; then
1143 echo xmlWriter requires Push interface - enabling it
1144 with_push=yes
1145 fi
1146 if test "$with_output" = "no" ; then
1147 echo xmlWriter requires Output interface - enabling it
1148 with_output=yes
1149 fi
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001150fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001151AC_SUBST(WITH_WRITER)
1152#AC_SUBST(WRITER_TEST)
1153
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001154if test "$with_pattern" = "no" ; then
1155 echo Disabling the xmlPattern parsing interface
1156 WITH_PATTERN=0
Daniel Veillardf9d16912005-01-30 22:36:30 +00001157 TEST_PATTERN=
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001158else
1159 WITH_PATTERN=1
Daniel Veillardf9d16912005-01-30 22:36:30 +00001160 TEST_PATTERN=Patterntests
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001161fi
1162AC_SUBST(WITH_PATTERN)
Daniel Veillardf9d16912005-01-30 22:36:30 +00001163AC_SUBST(TEST_PATTERN)
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001164
Daniel Veillard81273902003-09-30 00:43:48 +00001165if test "$with_sax1" = "no" ; then
1166 echo Disabling the older SAX1 interface
1167 WITH_SAX1=0
1168 TEST_SAX=
1169else
1170 WITH_SAX1=1
1171 TEST_SAX=SAXtests
1172fi
1173AC_SUBST(WITH_SAX1)
Akira TAGOH961b5352012-07-03 14:13:59 +09001174AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1")
Daniel Veillard81273902003-09-30 00:43:48 +00001175AC_SUBST(TEST_SAX)
1176
Daniel Veillard73b013f2003-09-30 12:36:01 +00001177if test "$with_push" = "no" ; then
1178 echo Disabling the PUSH parser interfaces
1179 WITH_PUSH=0
1180 TEST_PUSH=
1181else
1182 WITH_PUSH=1
1183 TEST_PUSH="XMLPushtests"
1184fi
1185AC_SUBST(WITH_PUSH)
1186AC_SUBST(TEST_PUSH)
1187
Daniel Veillard73b013f2003-09-30 12:36:01 +00001188if test "$with_html" = "no" ; then
1189 echo Disabling HTML support
1190 WITH_HTML=0
1191 HTML_OBJ=
1192 TEST_HTML=
1193else
1194 WITH_HTML=1
1195 HTML_OBJ="HTMLparser.o HTMLtree.o"
1196 TEST_HTML=HTMLtests
William M. Brack871611b2003-10-18 04:53:14 +00001197 if test "$with_push" != "no" ; then
Daniel Veillard73b013f2003-09-30 12:36:01 +00001198 TEST_PHTML=HTMLPushtests
1199 else
1200 TEST_PHTML=
1201 fi
1202fi
1203AC_SUBST(WITH_HTML)
1204AC_SUBST(HTML_OBJ)
1205AC_SUBST(TEST_HTML)
1206AC_SUBST(TEST_PHTML)
1207
Daniel Veillard73b013f2003-09-30 12:36:01 +00001208if test "$with_valid" = "no" ; then
Daniel Veillard4432df22003-09-28 18:58:27 +00001209 echo Disabling DTD validation support
1210 WITH_VALID=0
1211 TEST_VALID=
1212 TEST_VTIME=
1213else
1214 WITH_VALID=1
1215 TEST_VALID=Validtests
1216 TEST_VTIME=VTimingtests
1217fi
1218AC_SUBST(WITH_VALID)
1219AC_SUBST(TEST_VALID)
1220AC_SUBST(TEST_VTIME)
Daniel Veillard361d8452000-04-03 19:48:13 +00001221
Daniel Veillarda7374592001-05-10 14:17:55 +00001222if test "$with_catalog" = "no" ; then
1223 echo Disabling Catalog support
1224 WITH_CATALOG=0
1225 CATALOG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001226 TEST_CATALOG=
Daniel Veillarda7374592001-05-10 14:17:55 +00001227else
1228 WITH_CATALOG=1
1229 CATALOG_OBJ="catalog.o"
Daniel Veillard4432df22003-09-28 18:58:27 +00001230 TEST_CATALOG=Catatests
Daniel Veillarda7374592001-05-10 14:17:55 +00001231fi
1232AC_SUBST(WITH_CATALOG)
1233AC_SUBST(CATALOG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001234AC_SUBST(TEST_CATALOG)
Daniel Veillarda7374592001-05-10 14:17:55 +00001235
Daniel Veillardb59076b2001-04-29 17:04:07 +00001236if test "$with_docbook" = "no" ; then
1237 echo Disabling Docbook support
Daniel Veillardeae522a2001-04-23 13:41:34 +00001238 WITH_DOCB=0
1239 DOCB_OBJ=
Daniel Veillardb59076b2001-04-29 17:04:07 +00001240else
1241 WITH_DOCB=1
1242 DOCB_OBJ="DOCBparser.o"
Daniel Veillardeae522a2001-04-23 13:41:34 +00001243fi
1244AC_SUBST(WITH_DOCB)
1245AC_SUBST(DOCB_OBJ)
1246
1247
William M. Brack21e4ef22005-01-02 09:53:13 +00001248if test "$with_xptr" = "no" ; then
1249 echo Disabling XPointer support
1250 WITH_XPTR=0
1251 XPTR_OBJ=
1252 TEST_XPTR=
1253else
1254 WITH_XPTR=1
1255 XPTR_OBJ=xpointer.o
1256 TEST_XPTR=XPtrtests
1257 if test "$with_xpath" = "no" ; then
1258 echo XPointer requires XPath support - enabling it
1259 with_xpath=yes
1260 fi
Daniel Veillard4432df22003-09-28 18:58:27 +00001261fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001262AC_SUBST(WITH_XPTR)
1263AC_SUBST(XPTR_OBJ)
1264AC_SUBST(TEST_XPTR)
1265
1266if test "$with_c14n" = "no" ; then
1267 echo Disabling C14N support
1268 WITH_C14N=0
1269 C14N_OBJ=
1270 TEST_C14N=
1271else
1272 WITH_C14N=1
1273 C14N_OBJ="c14n.c"
1274 TEST_C14N=C14Ntests
1275 if test "$with_xpath" = "no" ; then
1276 echo C14N requires XPath support - enabling it
1277 with_xpath=yes
1278 fi
1279fi
1280AC_SUBST(WITH_C14N)
1281AC_SUBST(C14N_OBJ)
1282AC_SUBST(TEST_C14N)
1283
1284if test "$with_xinclude" = "no" ; then
1285 echo Disabling XInclude support
1286 WITH_XINCLUDE=0
1287 XINCLUDE_OBJ=
1288 with_xinclude="no"
1289 TEST_XINCLUDE=
1290else
1291 WITH_XINCLUDE=1
1292 XINCLUDE_OBJ=xinclude.o
1293 TEST_XINCLUDE=XIncludetests
1294 if test "$with_xpath" = "no" ; then
1295 echo XInclude requires XPath support - enabling it
1296 with_xpath=yes
1297 fi
1298fi
1299AC_SUBST(WITH_XINCLUDE)
1300AC_SUBST(XINCLUDE_OBJ)
1301AC_SUBST(TEST_XINCLUDE)
1302
Daniel Veillard361d8452000-04-03 19:48:13 +00001303if test "$with_xpath" = "no" ; then
1304 echo Disabling XPATH support
1305 WITH_XPATH=0
1306 XPATH_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001307 TEST_XPATH=
Daniel Veillard361d8452000-04-03 19:48:13 +00001308else
1309 WITH_XPATH=1
1310 XPATH_OBJ=xpath.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001311 TEST_XPATH=XPathtests
Daniel Veillard361d8452000-04-03 19:48:13 +00001312fi
1313AC_SUBST(WITH_XPATH)
1314AC_SUBST(XPATH_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001315AC_SUBST(TEST_XPATH)
Daniel Veillard361d8452000-04-03 19:48:13 +00001316
William M. Brack21e4ef22005-01-02 09:53:13 +00001317dnl
1318dnl output functions
1319dnl
1320if test "$with_output" = "no" ; then
1321 echo Disabling serialization/saving support
1322 WITH_OUTPUT=0
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001323else
William M. Brack21e4ef22005-01-02 09:53:13 +00001324 WITH_OUTPUT=1
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001325fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001326AC_SUBST(WITH_OUTPUT)
Daniel Veillard9e8bfae2000-11-06 16:43:11 +00001327
Daniel Veillard6e90d192001-07-03 16:37:49 +00001328WITH_ICONV=0
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001329if test "$with_iconv" = "no" ; then
1330 echo Disabling ICONV support
Daniel Veillardd574f782001-03-14 19:40:17 +00001331else
Daniel Veillard220346d2001-12-07 11:33:54 +00001332 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
Daniel Veillard6e90d192001-07-03 16:37:49 +00001333 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
Daniel Veillardf5b44e42001-09-17 17:19:54 +00001334 # Export this since our headers include iconv.h
1335 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
Daniel Veillard6e90d192001-07-03 16:37:49 +00001336 ICONV_LIBS="-L$with_iconv/lib"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001337 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001338
1339 AC_CHECK_HEADER(iconv.h,
1340 AC_MSG_CHECKING(for iconv)
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001341 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1342#include <iconv.h>]],[[
Daniel Veillard6e90d192001-07-03 16:37:49 +00001343iconv_t cd = iconv_open ("","");
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001344iconv (cd, NULL, NULL, NULL, NULL);]])],[
Daniel Veillard6e90d192001-07-03 16:37:49 +00001345 AC_MSG_RESULT(yes)
1346 WITH_ICONV=1],[
1347 AC_MSG_RESULT(no)
1348 AC_MSG_CHECKING(for iconv in -liconv)
1349
1350 _ldflags="${LDFLAGS}"
1351 _libs="${LIBS}"
1352 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1353 LIBS="${LIBS} -liconv"
1354
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001355 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
1356#include <iconv.h>]],[[
Daniel Veillard6e90d192001-07-03 16:37:49 +00001357iconv_t cd = iconv_open ("","");
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001358iconv (cd, NULL, NULL, NULL, NULL);]])],[
Daniel Veillard6e90d192001-07-03 16:37:49 +00001359 AC_MSG_RESULT(yes)
1360 WITH_ICONV=1
1361 ICONV_LIBS="${ICONV_LIBS} -liconv"
1362 LIBS="${_libs}"
1363 LDFLAGS="${_ldflags}"],[
1364 AC_MSG_RESULT(no)
1365 LIBS="${_libs}"
1366 LDFLAGS="${_ldflags}"])]))
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001367
1368 if test "$WITH_ICONV" = "1" ; then
1369 AC_MSG_CHECKING([for iconv declaration])
1370 AC_CACHE_VAL(xml_cv_iconv_arg2, [
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001372#include <iconv.h>
1373extern
1374#ifdef __cplusplus
1375"C"
1376#endif
1377#if defined(__STDC__) || defined(__cplusplus)
1378size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1379#else
1380size_t iconv();
1381#endif
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001382]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001383
1384 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);"
1385 AC_MSG_RESULT([${xml_xxx:-
1386 }$xml_cv_iconv_decl])
1387 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1388 [Define as const if the declaration of iconv() needs const.])
1389 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001390fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001391case "$host" in
1392 *mingw*) M_LIBS=""
1393 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +00001394 *beos*) M_LIBS=""
1395 ;;
Scott McCreary508a8d62009-08-24 16:35:35 +02001396 *haiku*) M_LIBS=""
1397 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001398 *) M_LIBS="-lm"
1399 ;;
1400esac
Daniel Veillardb82c1662001-12-09 14:00:54 +00001401XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
Daniel Veillard90d165b2003-09-01 20:33:13 +00001402XML_LIBTOOLLIBS="libxml2.la"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001403AC_SUBST(WITH_ICONV)
1404
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001405WITH_ICU=0
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +08001406ICU_LIBS=""
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001407if test "$with_icu" != "yes" ; then
1408 echo Disabling ICU support
1409else
1410 ICU_CONFIG=icu-config
1411 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1412 then
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +08001413 ICU_LIBS=`${ICU_CONFIG} --ldflags`
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001414 WITH_ICU=1
1415 echo Enabling ICU support
1416 else
1417 AC_MSG_ERROR([libicu config program icu-config not found])
1418 fi
1419fi
1420AC_SUBST(WITH_ICU)
Arfrever Frehtes Taifersar Arahesis1f01f492012-08-28 22:16:50 +08001421AC_SUBST(ICU_LIBS)
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001422
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001423WITH_ISO8859X=1
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001424if test "$WITH_ICONV" != "1" ; then
1425if test "$with_iso8859x" = "no" ; then
1426 echo Disabling ISO8859X support
1427 WITH_ISO8859X=0
1428fi
1429fi
1430AC_SUBST(WITH_ISO8859X)
1431
Daniel Veillarded6c5492005-07-23 15:00:22 +00001432if test "$with_schematron" = "no" ; then
1433 echo "Disabling Schematron support"
1434 WITH_SCHEMATRON=0
1435 TEST_SCHEMATRON=
1436else
1437 echo "Enabled Schematron support"
1438 WITH_SCHEMATRON=1
1439 TEST_SCHEMATRON="Schematrontests"
1440 with_xpath=yes
1441 with_pattern=yes
1442fi
1443AC_SUBST(WITH_SCHEMATRON)
1444AC_SUBST(TEST_SCHEMATRON)
1445
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001446if test "$with_schemas" = "no" ; then
William M. Brack21e4ef22005-01-02 09:53:13 +00001447 echo "Disabling Schemas/Relax-NG support"
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001448 WITH_SCHEMAS=0
1449 TEST_SCHEMAS=
1450else
Daniel Veillard71531f32003-02-05 13:19:53 +00001451 echo "Enabled Schemas/Relax-NG support"
Daniel Veillard4255d502002-04-16 15:50:10 +00001452 WITH_SCHEMAS=1
Daniel Veillard6eadf632003-01-23 18:29:16 +00001453 TEST_SCHEMAS="Schemastests Relaxtests"
Daniel Veillard6dc91962004-03-22 19:10:02 +00001454 if test "$PYTHON_INCLUDES" != "" ; then
1455 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1456 fi
Daniel Veillard23e73572002-09-19 19:56:43 +00001457 with_regexps=yes
Daniel Veillard4255d502002-04-16 15:50:10 +00001458fi
1459AC_SUBST(WITH_SCHEMAS)
1460AC_SUBST(TEST_SCHEMAS)
1461
Daniel Veillard23e73572002-09-19 19:56:43 +00001462if test "$with_regexps" = "no" ; then
1463 echo Disabling Regexps support
1464 WITH_REGEXPS=0
1465 TEST_REGEXPS=
1466else
1467 WITH_REGEXPS=1
1468 TEST_REGEXPS="Regexptests Automatatests"
1469fi
1470AC_SUBST(WITH_REGEXPS)
1471AC_SUBST(TEST_REGEXPS)
1472
Daniel Veillard361d8452000-04-03 19:48:13 +00001473if test "$with_debug" = "no" ; then
1474 echo Disabling DEBUG support
1475 WITH_DEBUG=0
1476 DEBUG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001477 TEST_DEBUG=
Daniel Veillard361d8452000-04-03 19:48:13 +00001478else
1479 WITH_DEBUG=1
1480 DEBUG_OBJ=debugXML.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001481 TEST_DEBUG=Scripttests
Daniel Veillard361d8452000-04-03 19:48:13 +00001482fi
1483AC_SUBST(WITH_DEBUG)
1484AC_SUBST(DEBUG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001485AC_SUBST(TEST_DEBUG)
Daniel Veillard361d8452000-04-03 19:48:13 +00001486
Daniel Veillard361d8452000-04-03 19:48:13 +00001487if test "$with_mem_debug" = "yes" ; then
William M. Brack306e33c2004-06-12 01:01:22 +00001488 if test "$with_thread_alloc" = "yes" ; then
1489 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1490 WITH_MEM_DEBUG=0
1491 else
1492 echo Enabling memory debug support
1493 WITH_MEM_DEBUG=1
1494 fi
Daniel Veillard361d8452000-04-03 19:48:13 +00001495else
1496 WITH_MEM_DEBUG=0
1497fi
1498AC_SUBST(WITH_MEM_DEBUG)
1499
Daniel Veillard22cdb842004-10-04 14:09:17 +00001500if test "$with_run_debug" = "yes" ; then
1501 echo Enabling runtime debug support
1502 WITH_RUN_DEBUG=1
1503else
1504 WITH_RUN_DEBUG=0
1505fi
1506AC_SUBST(WITH_RUN_DEBUG)
Daniel Veillard1638a472003-08-14 01:23:25 +00001507
1508WIN32_EXTRA_LIBADD=
1509WIN32_EXTRA_LDFLAGS=
William M. Bracka73f45b2005-01-11 02:21:33 +00001510CYGWIN_EXTRA_LDFLAGS=
1511CYGWIN_EXTRA_PYTHON_LIBADD=
LRNfbd4ddf2010-11-04 15:45:46 +01001512WIN32_EXTRA_PYTHON_LIBADD=
Daniel Veillard1638a472003-08-14 01:23:25 +00001513case "$host" in
1514 *-*-mingw*)
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001515 CPPFLAGS="$CPPFLAGS -DWIN32"
1516 WIN32_EXTRA_LIBADD="-lws2_32"
Daniel Veillard1638a472003-08-14 01:23:25 +00001517 WIN32_EXTRA_LDFLAGS="-no-undefined"
1518 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
LRNfbd4ddf2010-11-04 15:45:46 +01001519 if test "${PYTHON}" != ""
1520 then
John Heina4fe9b22012-05-10 22:12:46 +08001521 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
LRNfbd4ddf2010-11-04 15:45:46 +01001522 fi
Daniel Veillard1638a472003-08-14 01:23:25 +00001523 ;;
Daniel Veillardd392ba72004-08-04 14:56:45 +00001524 *-*-cygwin*)
1525 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
William M. Bracka73f45b2005-01-11 02:21:33 +00001526 if test "${PYTHON}" != ""
1527 then
1528 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1529 fi
Daniel Veillardd392ba72004-08-04 14:56:45 +00001530 ;;
Daniel Veillard1638a472003-08-14 01:23:25 +00001531esac
1532AC_SUBST(WIN32_EXTRA_LIBADD)
1533AC_SUBST(WIN32_EXTRA_LDFLAGS)
LRNfbd4ddf2010-11-04 15:45:46 +01001534AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
Daniel Veillardd392ba72004-08-04 14:56:45 +00001535AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1536AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
Daniel Veillard1638a472003-08-14 01:23:25 +00001537
Andoni Moralesfda57172012-05-08 10:46:09 +08001538dnl Checking the standard string functions availability
Roumen Petrov978ff222012-05-20 16:07:54 +03001539dnl
1540dnl Note mingw* has C99 implementation that produce expected xml numbers
1541dnl if code use {v}snprintf functions.
1542dnl If you like to activate at run-time C99 compatible number output
1543dnl see release note for mingw runtime 3.15:
1544dnl http://sourceforge.net/project/shownotes.php?release_id=24832
1545dnl
1546dnl Also *win32*config.h files redefine them for various MSC compilers.
1547dnl
1548dnl So do not redefine {v}snprintf to _{v}snprintf like follwing:
1549dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1550dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1551dnl and do not redefine those functions is C-source files.
1552dnl
1553AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
1554 NEED_TRIO=1)
Andoni Moralesfda57172012-05-08 10:46:09 +08001555
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001556if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1557then
1558 echo Enabling code coverage for GCC
1559 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1560 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1561else
1562 echo Disabling code coverage for GCC
1563fi
1564
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001565AC_SUBST(CPPFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001566AC_SUBST(CFLAGS)
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001567AC_SUBST(LDFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +00001568AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001569
Daniel Veillardb05deb71999-08-10 19:04:08 +00001570AC_SUBST(XML_LIBDIR)
1571AC_SUBST(XML_LIBS)
Daniel Veillard90d165b2003-09-01 20:33:13 +00001572AC_SUBST(XML_LIBTOOLLIBS)
Daniel Veillard81418e32001-05-22 15:08:55 +00001573AC_SUBST(ICONV_LIBS)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001574AC_SUBST(XML_INCLUDEDIR)
1575AC_SUBST(HTML_DIR)
1576AC_SUBST(HAVE_ISNAN)
1577AC_SUBST(HAVE_ISINF)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +00001578AC_SUBST(PYTHON)
1579AC_SUBST(PYTHON_VERSION)
1580AC_SUBST(PYTHON_INCLUDES)
Daniel Veillard253aa2c2002-02-02 09:17:16 +00001581AC_SUBST(PYTHON_SITE_PACKAGES)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001582
Daniel Veillardb05deb71999-08-10 19:04:08 +00001583AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +00001584AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +00001585
Daniel Veillard9715c172002-11-25 16:33:40 +00001586dnl for the spec file
1587RELDATE=`date +'%a %b %e %Y'`
1588AC_SUBST(RELDATE)
Daniel Veillard6dc91962004-03-22 19:10:02 +00001589AC_SUBST(PYTHON_TESTS)
Daniel Veillard9715c172002-11-25 16:33:40 +00001590
Daniel Veillardc6e997c2003-01-27 12:35:42 +00001591rm -f COPYING.LIB COPYING
Daniel Richard G5706b6d2012-08-06 11:32:54 +08001592ln -s $srcdir/Copyright COPYING
Daniel Veillardc575b992002-02-08 13:28:40 +00001593
Daniel Veillarde4177a52004-01-08 16:43:57 +00001594# keep on one line for cygwin c.f. #130896
Daniel Richard Gec4fc522012-08-17 10:04:30 +08001595AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py])
1596AC_OUTPUT
Arturo Espinosa15fe6e71998-09-07 17:27:57 +00001597
Daniel Veillard06d25242004-02-25 13:01:42 +00001598chmod +x xml2-config python/setup.py
Daniel Veillard67952602006-01-05 15:29:44 +00001599echo Done configuring