blob: 17c11cde6821193c97474f26464b85804c9013e5 [file] [log] [blame]
Daniel Veillard01791d51998-07-24 19:24:09 +00001dnl Process this file with autoconf to produce a configure script.
Owen Taylor3473f882001-02-23 17:55:21 +00002AC_INIT(entities.c)
Daniel Veillard01791d51998-07-24 19:24:09 +00003AM_CONFIG_HEADER(config.h)
Daniel Veillard3157e512010-03-09 11:32:46 +01004AC_CONFIG_MACRO_DIR([m4])
Daniel Veillardd2ade932000-09-30 14:39:55 +00005AC_CANONICAL_HOST
Daniel Veillard14fff061999-06-22 21:49:07 +00006
Daniel Veillardcf461992000-03-14 18:30:20 +00007LIBXML_MAJOR_VERSION=2
Daniel Veillard15724252008-08-30 15:01:04 +00008LIBXML_MINOR_VERSION=7
Daniel Veillardbb5055f2010-03-15 16:21:00 +01009LIBXML_MICRO_VERSION=7
Daniel Veillard3e35f8e2003-10-21 00:05:38 +000010LIBXML_MICRO_VERSION_SUFFIX=
Daniel Veillard4fc52812003-09-01 20:33:13 +000011LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
Daniel Veillard14fff061999-06-22 21:49:07 +000012LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
13
Daniel Veillard361d8452000-04-03 19:48:13 +000014LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
15
Daniel Veillard9cb1b642007-01-03 15:07:44 +000016if test -f CVS/Entries ; then
Daniel Veillarddab93ea2004-08-20 16:47:10 +000017 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
18 echo extra=$extra
19 if test "$extra" != ""
20 then
21 LIBXML_VERSION_EXTRA="-CVS$extra"
22 fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000023else if test -d .svn ; then
24 extra=`svn info | grep Revision | sed 's+Revision: ++'`
25 echo extra=$extra
26 if test "$extra" != ""
27 then
28 LIBXML_VERSION_EXTRA="-SVN$extra"
29 fi
veillard97c7be62009-05-12 08:43:54 +020030else if test -d .git ; then
31 extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
32 echo extra=$extra
33 if test "$extra" != ""
34 then
35 LIBXML_VERSION_EXTRA="-GIT$extra"
36 fi
37fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000038fi
William M. Brackf4025492004-08-18 21:08:46 +000039fi
Daniel Veillard14fff061999-06-22 21:49:07 +000040AC_SUBST(LIBXML_MAJOR_VERSION)
41AC_SUBST(LIBXML_MINOR_VERSION)
42AC_SUBST(LIBXML_MICRO_VERSION)
43AC_SUBST(LIBXML_VERSION)
44AC_SUBST(LIBXML_VERSION_INFO)
Daniel Veillard361d8452000-04-03 19:48:13 +000045AC_SUBST(LIBXML_VERSION_NUMBER)
William M. Brackf4025492004-08-18 21:08:46 +000046AC_SUBST(LIBXML_VERSION_EXTRA)
Daniel Veillard14fff061999-06-22 21:49:07 +000047
Daniel Veillard361d8452000-04-03 19:48:13 +000048VERSION=${LIBXML_VERSION}
Daniel Veillard14fff061999-06-22 21:49:07 +000049
Daniel Veillardedfb29b2000-03-14 19:59:05 +000050AM_INIT_AUTOMAKE(libxml2, $VERSION)
Daniel Veillard1164e751999-02-16 16:29:17 +000051
Daniel Veillard01791d51998-07-24 19:24:09 +000052dnl Checks for programs.
53AC_PROG_CC
54AC_PROG_INSTALL
Sebastian Wilhelmia44c8a41998-08-07 08:38:58 +000055AC_PROG_CPP
Daniel Veillard01791d51998-07-24 19:24:09 +000056AC_PATH_PROG(RM, rm, /bin/rm)
57AC_PATH_PROG(MV, mv, /bin/mv)
58AC_PATH_PROG(TAR, tar, /bin/tar)
William M. Brack1826d0a2004-07-21 09:03:57 +000059AC_PATH_PROG(PERL, perl, /usr/bin/perl)
Daniel Veillard33a2de92006-10-11 08:33:22 +000060AC_PATH_PROG(WGET, wget, /usr/bin/wget)
Daniel Veillard8b817da2004-09-30 09:19:33 +000061AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
Daniel Veillard06500c82004-09-07 09:12:44 +000062AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
Daniel Veillard01791d51998-07-24 19:24:09 +000063
Daniel Veillard03109292000-08-14 14:58:22 +000064dnl Make sure we have an ANSI compiler
65AM_C_PROTOTYPES
66test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
67
Daniel Veillard6984e6d2003-12-09 14:20:17 +000068AC_LIBTOOL_WIN32_DLL
Daniel Veillard01791d51998-07-24 19:24:09 +000069AM_PROG_LIBTOOL
70
Daniel Veillard4432df22003-09-28 18:58:27 +000071dnl
Daniel Veillard8ed10722009-08-20 19:17:36 +020072dnl if the system support linker version scripts for symbol versioning
73dnl then add it
74dnl
75VERSION_SCRIPT_FLAGS=
Roumen Petrovf39adc22010-03-11 14:49:13 +010076# lt_cv_prog_gnu_ld is from libtool 2.+
77if test "$lt_cv_prog_gnu_ld" = yes; then
78 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
79else
80 case $host in
81 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
82 esac
83fi
Daniel Veillard8ed10722009-08-20 19:17:36 +020084AC_SUBST(VERSION_SCRIPT_FLAGS)
85AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
86
87dnl
William M. Brack21e4ef22005-01-02 09:53:13 +000088dnl We process the AC_ARG_WITH first so that later we can modify
89dnl some of them to try to prevent impossible combinations. This
90dnl also allows up so alphabetize the choices
Daniel Veillard4432df22003-09-28 18:58:27 +000091dnl
Daniel Veillard4432df22003-09-28 18:58:27 +000092
William M. Brack21e4ef22005-01-02 09:53:13 +000093dnl
94dnl zlib option might change flags, so we save them initially
95dnl
Owen Taylor3473f882001-02-23 17:55:21 +000096_cppflags="${CPPFLAGS}"
97_ldflags="${LDFLAGS}"
Daniel Veillard71b656e2000-01-05 14:46:17 +000098
William M. Brack21e4ef22005-01-02 09:53:13 +000099AC_ARG_WITH(c14n,
100[ --with-c14n add the Canonicalization support (on)])
101AC_ARG_WITH(catalog,
102[ --with-catalog add the Catalog support (on)])
103AC_ARG_WITH(debug,
104[ --with-debug add the debugging module (on)])
105AC_ARG_WITH(docbook,
106[ --with-docbook add Docbook SGML support (on)])
107AC_ARG_WITH(fexceptions,
108[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
109AC_ARG_WITH(ftp,
110[ --with-ftp add the FTP support (on)])
111AC_ARG_WITH(history,
112[ --with-history add history support to xmllint shell(off)])
113AC_ARG_WITH(html,
114[ --with-html add the HTML support (on)])
115dnl Specific dir for HTML output ?
116AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
117 [path to base html directory, default $datadir/doc/html]),
118 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
Daniel Veillard259ff742001-10-06 13:49:59 +0000119
William M. Brack21e4ef22005-01-02 09:53:13 +0000120AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
121 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
122 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
123 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
124AC_SUBST(HTML_DIR)
125AC_ARG_WITH(http,
126[ --with-http add the HTTP support (on)])
127AC_ARG_WITH(iconv,
128[ --with-iconv[[=DIR]] add ICONV support (on)])
129AC_ARG_WITH(iso8859x,
130[ --with-iso8859x add ISO8859X support if no iconv (on)])
131AC_ARG_WITH(legacy,
132[ --with-legacy add deprecated APIs for compatibility (on)])
133AC_ARG_WITH(mem_debug,
134[ --with-mem-debug add the memory debugging module (off)])
135AC_ARG_WITH(minimum,
136[ --with-minimum build a minimally sized library (off)])
137AC_ARG_WITH(output,
138[ --with-output add the serialization support (on)])
139AC_ARG_WITH(pattern,
140[ --with-pattern add the xmlPattern selection interface (on)])
141AC_ARG_WITH(push,
142[ --with-push add the PUSH parser interfaces (on)])
143AC_ARG_WITH(python,
144[ --with-python[[=DIR]] build Python bindings if found])
145AC_ARG_WITH(reader,
146[ --with-reader add the xmlReader parsing interface (on)])
147AC_ARG_WITH(readline,
148[ --with-readline=DIR use readline in DIR],[
149 if test "$withval" != "no" -a "$withval" != "yes"; then
150 RDL_DIR=$withval
151 CPPFLAGS="${CPPFLAGS} -I$withval/include"
152 LDFLAGS="${LDFLAGS} -L$withval/lib"
153 fi
154])
155AC_ARG_WITH(regexps,
156[ --with-regexps add Regular Expressions support (on)])
157AC_ARG_WITH(run_debug,
158[ --with-run-debug add the runtime debugging module (off)])
159AC_ARG_WITH(sax1,
160[ --with-sax1 add the older SAX1 interface (on)])
161AC_ARG_WITH(schemas,
Daniel Veillard39e5c892005-07-03 22:48:50 +0000162[ --with-schemas add Relax-NG and Schemas support (on)])
Daniel Veillarded6c5492005-07-23 15:00:22 +0000163AC_ARG_WITH(schematron,
164[ --with-schematron add Schematron support (on)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000165AC_ARG_WITH(threads,
166[ --with-threads add multithread support(on)])
167AC_ARG_WITH(thread-alloc,
168[ --with-thread-alloc add per-thread memory(off)])
169AC_ARG_WITH(tree,
170[ --with-tree add the DOM like tree manipulation APIs (on)])
171AC_ARG_WITH(valid,
172[ --with-valid add the DTD validation support (on)])
173AC_ARG_WITH(writer,
174[ --with-writer add the xmlWriter saving interface (on)])
175AC_ARG_WITH(xinclude,
176[ --with-xinclude add the XInclude support (on)])
177AC_ARG_WITH(xpath,
178[ --with-xpath add the XPATH support (on)])
179AC_ARG_WITH(xptr,
180[ --with-xptr add the XPointer support (on)])
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000181AC_ARG_WITH(modules,
182[ --with-modules add the dynamic modules support (on)])
Owen Taylor3473f882001-02-23 17:55:21 +0000183AC_ARG_WITH(zlib,
William M. Brack97ad4c72003-05-13 08:08:36 +0000184[ --with-zlib[[=DIR]] use libz in DIR],[
Owen Taylor3473f882001-02-23 17:55:21 +0000185 if test "$withval" != "no" -a "$withval" != "yes"; then
186 Z_DIR=$withval
187 CPPFLAGS="${CPPFLAGS} -I$withval/include"
188 LDFLAGS="${LDFLAGS} -L$withval/lib"
189 fi
Daniel Veillard259ff742001-10-06 13:49:59 +0000190])
Daniel Veillardbfa5cf12008-08-27 15:33:28 +0000191AC_ARG_WITH(coverage,
192[ --with-coverage build for code coverage with GCC (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000193
Daniel Veillardb40744e2008-10-17 13:26:44 +0000194AC_ARG_ENABLE(rebuild-docs,
195[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
196AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
197
William M. Brack21e4ef22005-01-02 09:53:13 +0000198dnl
Daniel Veillard39e5c892005-07-03 22:48:50 +0000199dnl hard dependancies on options
200dnl
201if test "$with_schemas" = "yes"
202then
203 with_pattern=yes
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000204 with_regexps=yes
Daniel Veillard39e5c892005-07-03 22:48:50 +0000205fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000206if test "$with_schematron" = "yes"
207then
208 with_pattern=yes
209 with_xpath=yes
210fi
Daniel Veillard39e5c892005-07-03 22:48:50 +0000211if test "$with_reader" = "yes"
212then
213 with_push=yes
214fi
215if test "$with_xptr" = "yes"
216then
217 with_xpath=yes
218fi
219dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000220dnl option to build a minimal libxml2 library
221dnl
222if test "$with_minimum" = "yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000223then
William M. Brack21e4ef22005-01-02 09:53:13 +0000224 echo "Configuring for a minimal library"
225 if test "$with_c14n" = ""
226 then
227 with_c14n=no
228 fi
229 if test "$with_catalog" = ""
230 then
231 with_catalog=no
232 fi
233 echo So far so good!
234 if test "$with_debug" = ""
235 then
236 with_debug=no
237 fi
238 if test "$with_docbook" = ""
239 then
240 with_docbook=no
241 fi
242 if test "$with_fexceptions" = ""
243 then
244 with_fexceptions=no
245 fi
246 if test "$with_ftp" = ""
247 then
248 with_ftp=no
249 fi
250 if test "$with_history" = ""
251 then
252 with_history=no
253 fi
254 if test "$with_html" = ""
255 then
256 with_html=no
257 fi
258 if test "$with_http" = ""
259 then
260 with_http=no
261 fi
262 if test "$with_iconv" = ""
263 then
264 with_iconv=no
265 fi
266 if test "$with_iso8859x" = ""
267 then
268 with_iso8859x=no
269 fi
270 if test "$with_legacy" = ""
271 then
272 with_legacy=no
273 fi
274 if test "$with_mem_debug" = ""
275 then
276 with_mem_debug=no
277 fi
278 if test "$with_output" = ""
279 then
280 with_output=no
281 fi
282 if test "$with_pattern" = ""
283 then
284 with_pattern=no
285 fi
286 if test "$with_push" = ""
287 then
288 with_push=no
289 fi
290 if test "$with_python" = ""
291 then
292 with_python=no
293 fi
294 if test "$with_reader" = ""
295 then
296 with_reader=no
297 fi
298 if test "$with_readline" = ""
299 then
300 with_readline=no
301 fi
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000302 if test "$with_regexps" = ""
William M. Brack21e4ef22005-01-02 09:53:13 +0000303 then
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000304 with_regexps=no
William M. Brack21e4ef22005-01-02 09:53:13 +0000305 fi
306 if test "$with_run_debug" = ""
307 then
308 with_run_debug=no
309 fi
310 if test "$with_sax1" = ""
311 then
312 with_sax1=no
313 fi
314 if test "$with_schemas" = ""
315 then
316 with_schemas=no
317 fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000318 if test "$with_schematron" = ""
319 then
320 with_schematron=no
321 fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000322 if test "$with_threads" = ""
323 then
324 with_threads=no
325 fi
326 if test "$with_thread_alloc" = ""
327 then
328 with_thread_alloc=no
329 fi
330 if test "$with_tree" = ""
331 then
332 with_tree=no
333 fi
334 if test "$with_valid" = ""
335 then
336 with_valid=no
337 fi
338 if test "$with_writer" = ""
339 then
340 with_writer=no
341 fi
342 if test "$with_xinclude" = ""
343 then
344 with_xinclude=no
345 fi
346 if test "$with_xpath" = ""
347 then
348 with_xpath=no
349 fi
350 if test "$with_xptr" = ""
351 then
352 with_xptr=no
353 fi
354 if test "$with_zlib" = ""
355 then
356 with_zlib=no
357 fi
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000358 if test "$with_modules" = ""
359 then
360 with_modules=no
361 fi
Daniel Veillard4432df22003-09-28 18:58:27 +0000362fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000363
364echo Checking zlib
365
366dnl Checks for zlib library.
367
Daniel Veillard75acfee2006-07-13 06:29:56 +0000368WITH_ZLIB=0
Daniel Veillard259ff742001-10-06 13:49:59 +0000369if test "$with_zlib" = "no"; then
370 echo "Disabling compression support"
371else
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000372 AC_CHECK_HEADERS(zlib.h,
373 AC_CHECK_LIB(z, gzread,[
Daniel Veillard75acfee2006-07-13 06:29:56 +0000374 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
375 WITH_ZLIB=1
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000376 if test "x${Z_DIR}" != "x"; then
377 Z_CFLAGS="-I${Z_DIR}/include"
378 Z_LIBS="-L${Z_DIR}/lib -lz"
379 [case ${host} in
380 *-*-solaris*)
381 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
382 ;;
383 esac]
384 else
385 Z_LIBS="-lz"
386 fi]))
Daniel Veillard259ff742001-10-06 13:49:59 +0000387fi
Owen Taylor3473f882001-02-23 17:55:21 +0000388
Owen Taylor3473f882001-02-23 17:55:21 +0000389AC_SUBST(Z_CFLAGS)
390AC_SUBST(Z_LIBS)
Daniel Veillard75acfee2006-07-13 06:29:56 +0000391AC_SUBST(WITH_ZLIB)
Owen Taylor3473f882001-02-23 17:55:21 +0000392
393CPPFLAGS=${_cppflags}
394LDFLAGS=${_ldflags}
Daniel Veillardb05deb71999-08-10 19:04:08 +0000395
William M. Brack21e4ef22005-01-02 09:53:13 +0000396echo Checking headers
397
Daniel Veillard01791d51998-07-24 19:24:09 +0000398dnl Checks for header files.
399AC_HEADER_DIRENT
400AC_HEADER_STDC
Daniel Veillard817e70b2002-11-19 22:28:48 +0000401AC_CHECK_HEADERS([fcntl.h])
402AC_CHECK_HEADERS([unistd.h])
403AC_CHECK_HEADERS([ctype.h])
404AC_CHECK_HEADERS([dirent.h])
405AC_CHECK_HEADERS([errno.h])
406AC_CHECK_HEADERS([malloc.h])
407AC_CHECK_HEADERS([stdarg.h])
408AC_CHECK_HEADERS([sys/stat.h])
409AC_CHECK_HEADERS([sys/types.h])
Daniel Veillard7f4547c2008-10-03 07:58:23 +0000410AC_CHECK_HEADERS([stdint.h])
411AC_CHECK_HEADERS([inttypes.h.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000412AC_CHECK_HEADERS([time.h])
413AC_CHECK_HEADERS([ansidecl.h])
414AC_CHECK_HEADERS([ieeefp.h])
415AC_CHECK_HEADERS([nan.h])
416AC_CHECK_HEADERS([math.h])
Daniel Veillardebe48c62003-12-03 12:12:27 +0000417AC_CHECK_HEADERS([limits.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000418AC_CHECK_HEADERS([fp_class.h])
419AC_CHECK_HEADERS([float.h])
420AC_CHECK_HEADERS([stdlib.h])
421AC_CHECK_HEADERS([sys/socket.h], [], [],
422[#if HAVE_SYS_TYPES_H
423# include <sys/types.h>
424# endif
425])
426AC_CHECK_HEADERS([netinet/in.h], [], [],
427[#if HAVE_SYS_TYPES_H
428# include <sys/types.h>
429# endif
430])
431AC_CHECK_HEADERS([arpa/inet.h], [], [],
432[#if HAVE_SYS_TYPES_H
433# include <sys/types.h>
434# endif
435#if HAVE_ARPA_INET_H
436# include <arpa/inet.h>
437# endif
438])
439AC_CHECK_HEADERS([netdb.h])
440AC_CHECK_HEADERS([sys/time.h])
441AC_CHECK_HEADERS([sys/select.h])
Raphael Prevost48b60c32009-08-23 13:11:01 +0200442AC_CHECK_HEADERS([poll.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000443AC_CHECK_HEADERS([sys/mman.h])
444AC_CHECK_HEADERS([sys/timeb.h])
445AC_CHECK_HEADERS([signal.h])
446AC_CHECK_HEADERS([arpa/nameser.h], [], [],
447[#if HAVE_SYS_TYPES_H
448# include <sys/types.h>
449# endif
450])
451AC_CHECK_HEADERS([resolv.h], [], [],
452[#if HAVE_SYS_TYPES_H
453# include <sys/types.h>
454# endif
455#if HAVE_NETINET_IN_H
456# include <netinet/in.h>
457# endif
458#if HAVE_ARPA_NAMESER_H
459# include <arpa/nameser.h>
460# endif
461])
Daniel Veillarddcd93902005-01-13 11:25:15 +0000462AC_CHECK_HEADERS([dl.h])
463AC_CHECK_HEADERS([dlfcn.h])
Daniel Veillard01791d51998-07-24 19:24:09 +0000464
Daniel Veillardfc979062004-03-04 22:07:16 +0000465
William M. Brack21e4ef22005-01-02 09:53:13 +0000466echo Checking libraries
Daniel Veillard1164e751999-02-16 16:29:17 +0000467
Daniel Veillard01791d51998-07-24 19:24:09 +0000468dnl Checks for library functions.
469AC_FUNC_STRFTIME
Daniel Veillard92ad2102001-03-27 12:47:33 +0000470AC_CHECK_FUNCS(strdup strndup strerror)
Daniel Veillard71b656e2000-01-05 14:46:17 +0000471AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
Daniel Veillard90bc3712002-03-07 15:12:58 +0000472AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
Daniel Veillard068a9652001-06-07 15:30:26 +0000473AC_CHECK_FUNCS(stat _stat signal)
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000474
Daniel Veillard92ad2102001-03-27 12:47:33 +0000475dnl Checking the standard string functions availability
476AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
477 NEED_TRIO=1)
478
William M. Brackf4caa5e2005-10-20 09:04:05 +0000479dnl Checking for va_copy availability
480AC_MSG_CHECKING([for va_copy])
481AC_TRY_LINK([#include <stdarg.h>
482va_list ap1,ap2;], [va_copy(ap1,ap2);],
483have_va_copy=yes,
484have_va_copy=no)
485AC_MSG_RESULT($have_va_copy)
486if test x"$have_va_copy" = x"yes"; then
487 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
488else
489 AC_MSG_CHECKING([for __va_copy])
490 AC_TRY_LINK([#include <stdarg.h>
491 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
492 have___va_copy=yes,
493 have___va_copy=no)
494 AC_MSG_RESULT($have___va_copy)
495 if test x"$have___va_copy" = x"yes"; then
496 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
497 fi
498fi
499
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000500dnl Checks for inet libraries:
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000501AC_SEARCH_LIBS(gethostent, [nsl])
Scott McCreary59f53082009-08-26 09:55:24 +0200502AC_SEARCH_LIBS(setsockopt, [socket net network])
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000503AC_SEARCH_LIBS(connect, [inet])
Daniel Veillardb05deb71999-08-10 19:04:08 +0000504
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000505dnl Determine what socket length (socklen_t) data type is
506AC_MSG_CHECKING([for type of socket length (socklen_t)])
507AC_TRY_COMPILE2([
508#include <stddef.h>
509#include <sys/types.h>
510#include <sys/socket.h>],[
511(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
512 AC_MSG_RESULT(socklen_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000513 XML_SOCKLEN_T=socklen_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000514 AC_TRY_COMPILE2([
515#include <stddef.h>
516#include <sys/types.h>
517#include <sys/socket.h>],[
518(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
519 AC_MSG_RESULT(size_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000520 XML_SOCKLEN_T=size_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000521 AC_TRY_COMPILE2([
522#include <stddef.h>
523#include <sys/types.h>
524#include <sys/socket.h>],[
525(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
526 AC_MSG_RESULT(int *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000527 XML_SOCKLEN_T=int],[
William M. Brack2e6b1432004-02-09 15:10:28 +0000528 AC_MSG_WARN(could not determine)
Daniel Veillardc284c642005-03-31 10:24:24 +0000529 XML_SOCKLEN_T="int"])])])
530AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000531
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000532dnl ***********************Checking for availability of IPv6*******************
533
534AC_MSG_CHECKING([whether to enable IPv6])
William M. Brack21e4ef22005-01-02 09:53:13 +0000535AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
Daniel Veillard4432df22003-09-28 18:58:27 +0000536if test "$with_minimum" = "yes"
537then
538 enable_ipv6=no
539fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000540if test $enable_ipv6 = yes; then
541 have_ipv6=no
542 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000543 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000544 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000545 ], [
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000546 struct sockaddr_storage ss;
547 socket(AF_INET6, SOCK_STREAM, 0)
548 ],
549 have_ipv6=yes,
550 have_ipv6=no
551 )
552 AC_MSG_RESULT($have_ipv6)
553
William M. Brack476cd962003-08-13 11:09:42 +0000554 if test $have_ipv6 = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000555 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000556 have_broken_ss_family=no
557
558 dnl *********************************************************************
559 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
560 dnl a ss_family member, but rather __ss_family. Let's detect that
William M. Brack7d8b36b2005-06-25 07:30:50 +0000561 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
562 dnl platforms. However, we should only do this if ss_family is not
563 dnl present.
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000564 dnl ********************************************************************
William M. Brack7d8b36b2005-06-25 07:30:50 +0000565 AC_MSG_CHECKING([struct sockaddr::ss_family])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000566 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000567 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000568 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000569 ], [
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000570 struct sockaddr_storage ss ;
William M. Brack7d8b36b2005-06-25 07:30:50 +0000571 ss.ss_family = 0 ;
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000572 ],
William M. Brack7d8b36b2005-06-25 07:30:50 +0000573 have_ss_family=yes,
574 have_ss_family=no
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000575 )
William M. Brack7d8b36b2005-06-25 07:30:50 +0000576 AC_MSG_RESULT($have_ss_family)
577 if test x$have_ss_family = xno ; then
578 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
579 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000580 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000581 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000582 ], [
William M. Brack7d8b36b2005-06-25 07:30:50 +0000583 struct sockaddr_storage ss ;
584 ss.__ss_family = 0 ;
585 ],
586 have_broken_ss_family=yes,
587 have_broken_ss_family=no
588 )
589 AC_MSG_RESULT($have_broken_ss_family)
590 if test x$have_broken_ss_family = xyes ; then
591 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
592 [Whether struct sockaddr::__ss_family exists])
593 AC_DEFINE(ss_family, __ss_family,
594 [ss_family is not defined here, use __ss_family instead])
595 else
596 AC_MSG_WARN(ss_family and __ss_family not found)
597 fi
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000598 fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000599
600 have_getaddrinfo=no
601 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
602 if test $have_getaddrinfo != yes; then
603 for lib in bsd socket inet; do
604 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
605 done
606 fi
607
William M. Brack476cd962003-08-13 11:09:42 +0000608 if test $have_getaddrinfo = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000609 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000610 fi
611 fi
612fi
613
614dnl ******************************End IPv6 checks******************************
615
Daniel Veillardb05deb71999-08-10 19:04:08 +0000616dnl Checks for isnan in libm if not in libc
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000617AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
Daniel Veillardc790bf42003-10-11 10:50:10 +0000618 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000619
Daniel Veillardc790bf42003-10-11 10:50:10 +0000620AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
621 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000622
623XML_LIBDIR='-L${libdir}'
Daniel Veillarde7dd2b82002-03-15 18:44:02 +0000624XML_INCLUDEDIR='-I${includedir}/libxml2'
Daniel Veillardb05deb71999-08-10 19:04:08 +0000625
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000626dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000627dnl Extra flags
628dnl
629XML_CFLAGS=""
Daniel Veillard357c9602001-05-03 10:49:20 +0000630RDL_LIBS=""
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000631
632dnl
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000633dnl Workaround for native compilers
634dnl HP : http://bugs.gnome.org/db/31/3163.html
635dnl DEC : Enable NaN/Inf
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000636dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000637if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000638 case "${host}" in
Daniel Veillard6a0baa02005-12-10 11:11:12 +0000639 hppa*-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000640 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000641 ;;
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000642 *-dec-osf* )
643 CFLAGS="${CFLAGS} -ieee"
644 ;;
William M. Brack476cd962003-08-13 11:09:42 +0000645 alpha*-*-linux* )
646 CFLAGS="${CFLAGS} -ieee"
647 ;;
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000648 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000649else
Daniel Veillardd94849b2003-07-28 13:02:24 +0000650 if test "$with_fexceptions" = "yes"
651 then
652 #
653 # Not activated by default because this inflates the code size
654 # Used to allow propagation of C++ exceptions through the library
655 #
656 CFLAGS="${CFLAGS} -fexceptions"
657 fi
658
Daniel Veillard05f97352004-10-31 15:35:32 +0000659 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"
Daniel Veillard14839d52001-06-06 16:11:56 +0000660 case "${host}" in
661 alpha*-*-linux* )
662 CFLAGS="${CFLAGS} -mieee"
663 ;;
Daniel Veillardcb5b4d62002-04-11 08:24:26 +0000664 alpha*-*-osf* )
665 CFLAGS="${CFLAGS} -mieee"
666 ;;
Daniel Veillard14839d52001-06-06 16:11:56 +0000667 esac
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000668fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000669case ${host} in
670 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000671 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
672 ;;
Daniel Veillardd30be4a2002-03-28 18:25:31 +0000673 hppa*-hp-mpeix)
674 NEED_TRIO=1
675 ;;
Daniel Veillard4188ddf2006-01-19 08:58:42 +0000676 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
677 # If the host is Windows, and shared libraries are disabled, we
678 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
679 # work properly (without it, xmlexports.h would force the use of
680 # DLL imports, which obviously aren't present in a static
681 # library).
682 if test "x$enable_shared" = "xno"; then
683 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
684 CFLAGS="$CFLAGS -DLIBXML_STATIC"
685 fi
686 ;;
Daniel Veillardd2ade932000-09-30 14:39:55 +0000687esac
688
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000689
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000690dnl
691dnl check for python
692dnl
693
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000694PYTHON_VERSION=
695PYTHON_INCLUDES=
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000696PYTHON_SITE_PACKAGES=
Daniel Veillard6dc91962004-03-22 19:10:02 +0000697PYTHON_TESTS=
Daniel Veillard38b80a82003-05-14 18:59:00 +0000698pythondir=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000699if test "$with_python" != "no" ; then
700 if test -x "$with_python/bin/python"
701 then
702 echo Found python in $with_python/bin/python
703 PYTHON="$with_python/bin/python"
Daniel Veillard9b731d72002-04-14 12:56:08 +0000704 else
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000705 if test -x "$with_python"
706 then
Daniel Veillard4efd3be2002-11-18 09:11:13 +0000707 echo Found python in $with_python
708 PYTHON="$with_python"
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000709 else
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000710 if test -x "$PYTHON"
711 then
712 echo Found python in environment PYTHON=$PYTHON
Daniel Veillard8492ba12006-04-25 12:52:12 +0000713 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000714 else
Daniel Veillardc2f70562005-09-01 12:45:26 +0000715 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000716 fi
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000717 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000718 fi
719 if test "$PYTHON" != ""
720 then
721 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
722 echo Found Python version $PYTHON_VERSION
723 fi
724 if test "$PYTHON_VERSION" != ""
725 then
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000726 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
727 -d $with_python/lib/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000728 then
729 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000730 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000731 else
732 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
733 then
Daniel Veillard8492ba12006-04-25 12:52:12 +0000734 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000735 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000736 else
737 if test -r /usr/include/python$PYTHON_VERSION/Python.h
738 then
739 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000740 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000741 else
742 echo could not find python$PYTHON_VERSION/Python.h
743 fi
744 fi
William M. Brack5d4cba42004-01-06 15:19:12 +0000745 if test ! -d "$PYTHON_SITE_PACKAGES"
Daniel Veillardb6984ef2002-08-14 16:55:31 +0000746 then
747 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
748 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000749 fi
Daniel Macks12febe82010-03-15 10:31:24 +0100750 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000751 fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000752 if test "$with_python" != ""
753 then
Daniel Veillardd7d07482006-05-03 13:15:44 +0000754 pythondir='$(PYTHON_SITE_PACKAGES)'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000755 else
Daniel Veillardb2f8f1d2006-04-28 16:30:48 +0000756 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000757 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000758else
759 PYTHON=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000760fi
761AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
Daniel Veillard40b11342002-09-20 12:01:39 +0000762if test "$PYTHON_INCLUDES" != ""
763then
764 PYTHON_SUBDIR=python
765else
766 PYTHON_SUBDIR=
767fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000768AC_SUBST(pythondir)
Daniel Veillard40b11342002-09-20 12:01:39 +0000769AC_SUBST(PYTHON_SUBDIR)
Frederic Crozate21731d2009-09-12 18:02:40 +0200770AC_SUBST(PYTHON_LIBS)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000771
Daniel Veillardce1648b2005-01-04 15:10:22 +0000772dnl check for dso support
773WITH_MODULES=0
Daniel Veillardce1648b2005-01-04 15:10:22 +0000774TEST_MODULES=
775
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000776if test "$with_modules" != "no" ; then
Daniel Veillard9202b672005-07-14 09:31:14 +0000777 case "$host" in
778 *-*-cygwin*)
779 MODULE_EXTENSION=".dll"
780 AC_CHECK_LIB(cygwin, dlopen, [
781 WITH_MODULES=1
782 MODULE_PLATFORM_LIBS=
783 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
784 ])
785 ;;
Roumen Petrov120a2692010-03-10 10:07:49 +0100786 *-*-mingw*)
787 MODULE_EXTENSION=".dll"
788 WITH_MODULES=1
789 ;;
Daniel Veillard9202b672005-07-14 09:31:14 +0000790 *)
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000791 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
792 AC_CHECK_LIB(dld, shl_load, [
793 MODULE_PLATFORM_LIBS="-ldld"
794 libxml_have_shl_load=yes], [
795 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
796 AC_CHECK_LIB(dl, dlopen, [
797 MODULE_PLATFORM_LIBS="-ldl"
798 libxml_have_dlopen=yes])])])])
799
800 if test "${libxml_have_shl_load}" = "yes"; then
801 MODULE_EXTENSION=".sl"
Daniel Veillard9202b672005-07-14 09:31:14 +0000802 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000803 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000804 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000805
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000806 if test "${libxml_have_dlopen}" = "yes"; then
807 case "${host}" in
808 *-*-hpux* )
809 MODULE_EXTENSION=".sl"
810 ;;
811 * )
812 MODULE_EXTENSION=".so"
813 ;;
814 esac
815
Daniel Veillard9202b672005-07-14 09:31:14 +0000816 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000817 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000818 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000819 ;;
820 esac
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000821fi
Daniel Veillardce1648b2005-01-04 15:10:22 +0000822
823if test "${WITH_MODULES}" = "1"; then
824 TEST_MODULES="ModuleTests"
825fi
826
827AC_SUBST(WITH_MODULES)
828AC_SUBST(MODULE_PLATFORM_LIBS)
829AC_SUBST(MODULE_EXTENSION)
830AC_SUBST(TEST_MODULES)
831
Daniel Veillard437b87b2000-01-03 17:30:46 +0000832dnl
833dnl Tester makes use of readline if present
834dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000835
Daniel Veillard361d8452000-04-03 19:48:13 +0000836dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000837dnl specific tests to setup DV and Bill's devel environments with debug etc ...
Daniel Veillard81418e32001-05-22 15:08:55 +0000838dnl (-Wunreachable-code)
Daniel Veillardf6eea272001-01-18 12:17:12 +0000839dnl
William M. Brack871611b2003-10-18 04:53:14 +0000840if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
Daniel Veillardb7c6ac42004-06-29 22:01:27 +0000841 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
William M. Brack7f28a012007-01-11 23:42:10 +0000842 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
William M. Brack871611b2003-10-18 04:53:14 +0000843 then
Daniel Veillard4432df22003-09-28 18:58:27 +0000844 if test "$with_minimum" != "yes"
845 then
846 if test "${with_mem_debug}" = "" ; then
Daniel Veillard379a3b72005-08-12 10:18:14 +0000847 echo Activating memory debugging
Daniel Veillard4432df22003-09-28 18:58:27 +0000848 with_mem_debug="yes"
Daniel Veillard22cdb842004-10-04 14:09:17 +0000849 with_run_debug="yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000850 fi
851 if test "${with_docbook}" = "" ; then
852 with_docbook="yes"
853 fi
Daniel Veillardeae522a2001-04-23 13:41:34 +0000854 fi
Daniel Veillard3854c572005-08-25 10:17:45 +0000855 if test "${GCC}" = "yes" ; then
Daniel Veillard05f97352004-10-31 15:35:32 +0000856 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 +0000857 fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000858 STATIC_BINARIES="-static"
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000859dnl -Wcast-qual -ansi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000860else
861 STATIC_BINARIES=
Daniel Veillardf6eea272001-01-18 12:17:12 +0000862fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000863AC_SUBST(STATIC_BINARIES)
Daniel Veillard92ad2102001-03-27 12:47:33 +0000864
865dnl
866dnl Check for trio string functions
867dnl
868
869if test "${NEED_TRIO}" = "1" ; then
870 echo Adding trio library for string functions
871 WITH_TRIO=1
872else
873 WITH_TRIO=0
874fi
Daniel Veillard01ef7382001-05-08 07:31:43 +0000875AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
Daniel Veillard92ad2102001-03-27 12:47:33 +0000876AC_SUBST(WITH_TRIO)
877
Daniel Veillardf6eea272001-01-18 12:17:12 +0000878dnl
William M. Brack97ad4c72003-05-13 08:08:36 +0000879dnl Allow to enable/disable various pieces
Daniel Veillard361d8452000-04-03 19:48:13 +0000880dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000881echo Checking configuration requirements
Daniel Veillard361d8452000-04-03 19:48:13 +0000882
William M. Brack21e4ef22005-01-02 09:53:13 +0000883dnl
884dnl Thread-related stuff
885dnl
Daniel Veillardb8478642001-10-12 17:29:10 +0000886THREAD_LIBS=""
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000887BASE_THREAD_LIBS=""
Daniel Veillardb8478642001-10-12 17:29:10 +0000888WITH_THREADS=0
889THREAD_CFLAGS=""
Daniel Veillardab7488e2001-10-17 11:30:37 +0000890TEST_THREADS=""
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000891THREADS_W32=""
Daniel Veillard64a411c2001-10-15 12:32:07 +0000892
Daniel Veillard84942712003-04-18 14:40:05 +0000893if test "$with_threads" = "no" ; then
894 echo Disabling multithreaded support
895else
Daniel Veillardb8478642001-10-12 17:29:10 +0000896 echo Enabling multithreaded support
LRN203fd2e2009-08-07 21:47:25 +0200897 dnl Use pthread by default
Andrew W. Nosenko858084f2009-10-06 18:14:15 +0200898 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
LRN203fd2e2009-08-07 21:47:25 +0200899 AC_CHECK_HEADER(pthread.h,
900 AC_CHECK_LIB(pthread, pthread_join,[
901 THREAD_LIBS="-lpthread"
902 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
903 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
904 WITH_THREADS="1"]))
905 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000906 case $host_os in
LRN203fd2e2009-08-07 21:47:25 +0200907 *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
908 WITH_THREADS="1"
909 THREADS_W32="Win32"
910 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
911 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000912 ;;
William M. Bracka73f45b2005-01-11 02:21:33 +0000913 *cygwin*) THREAD_LIBS=""
914 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +0000915 *beos*) WITH_THREADS="1"
916 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
917 ;;
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000918 *linux*)
Daniel Veillard32a461f2005-08-25 21:48:54 +0000919 if test "${GCC}" = "yes" ; then
920 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
921 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
922 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
923 if test "${THREAD_LIBS}" = "-lpthread" ; then
924 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
925 then
926 THREAD_LIBS=""
927 BASE_THREAD_LIBS="-lpthread"
928 else
LRN203fd2e2009-08-07 21:47:25 +0200929 if expr ${GCC_MAJOR} \> 3 > /dev/null
Daniel Veillard32a461f2005-08-25 21:48:54 +0000930 then
931 THREAD_LIBS=""
932 BASE_THREAD_LIBS="-lpthread"
933 else
934 echo old GCC disabling weak symbols for pthread
935 fi
936 fi
937 fi
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000938 fi
939 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000940 esac
Daniel Veillardb8478642001-10-12 17:29:10 +0000941 if test "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +0000942 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
943 TEST_THREADS="Threadtests"
Daniel Veillardb8478642001-10-12 17:29:10 +0000944 fi
945fi
William M. Brack306e33c2004-06-12 01:01:22 +0000946if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +0000947 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
Daniel Veillard64a411c2001-10-15 12:32:07 +0000948fi
949
Daniel Veillardb8478642001-10-12 17:29:10 +0000950AC_SUBST(THREAD_LIBS)
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000951AC_SUBST(BASE_THREAD_LIBS)
Daniel Veillardb8478642001-10-12 17:29:10 +0000952AC_SUBST(WITH_THREADS)
953AC_SUBST(THREAD_CFLAGS)
Daniel Veillardab7488e2001-10-17 11:30:37 +0000954AC_SUBST(TEST_THREADS)
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000955AC_SUBST(THREADS_W32)
Daniel Veillardb8478642001-10-12 17:29:10 +0000956
William M. Brack21e4ef22005-01-02 09:53:13 +0000957dnl
958dnl xmllint shell history
959dnl
Daniel Veillard259ff742001-10-06 13:49:59 +0000960if test "$with_history" = "yes" ; then
Daniel Veillardf012a642001-07-23 19:10:52 +0000961 echo Enabling xmllint shell history
962 dnl check for terminal library. this is a very cool solution
963 dnl from octave's configure.in
964 unset tcap
965 for termlib in ncurses curses termcap terminfo termlib; do
966 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
967 test -n "$tcap" && break
968 done
969
970 AC_CHECK_HEADER(readline/history.h,
971 AC_CHECK_LIB(history, append_history,[
972 RDL_LIBS="-lhistory"
Daniel Veillardc790bf42003-10-11 10:50:10 +0000973 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
Daniel Veillardf012a642001-07-23 19:10:52 +0000974 AC_CHECK_HEADER(readline/readline.h,
975 AC_CHECK_LIB(readline, readline,[
976 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
Daniel Veillardc790bf42003-10-11 10:50:10 +0000977 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
Daniel Veillardf012a642001-07-23 19:10:52 +0000978 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
979 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
980 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
Daniel Veillardf012a642001-07-23 19:10:52 +0000981 fi
Daniel Veillardf012a642001-07-23 19:10:52 +0000982fi
983
William M. Brack21e4ef22005-01-02 09:53:13 +0000984dnl
985dnl Tree functions
986dnl
Daniel Veillard652327a2003-09-29 18:02:38 +0000987if test "$with_tree" = "no" ; then
988 echo Disabling DOM like tree manipulation APIs
989 WITH_TREE=0
990else
991 WITH_TREE=1
992fi
993AC_SUBST(WITH_TREE)
994
Daniel Veillard361d8452000-04-03 19:48:13 +0000995if test "$with_ftp" = "no" ; then
996 echo Disabling FTP support
997 WITH_FTP=0
998 FTP_OBJ=
999else
1000 WITH_FTP=1
1001 FTP_OBJ=nanoftp.o
1002fi
1003AC_SUBST(WITH_FTP)
1004AC_SUBST(FTP_OBJ)
1005
Daniel Veillard361d8452000-04-03 19:48:13 +00001006if test "$with_http" = "no" ; then
1007 echo Disabling HTTP support
1008 WITH_HTTP=0
1009 HTTP_OBJ=
1010else
1011 WITH_HTTP=1
1012 HTTP_OBJ=nanohttp.o
1013fi
1014AC_SUBST(WITH_HTTP)
1015AC_SUBST(HTTP_OBJ)
1016
Daniel Veillard4432df22003-09-28 18:58:27 +00001017if test "$with_legacy" = "no" ; then
1018 echo Disabling deprecated APIs
1019 WITH_LEGACY=0
1020else
1021 WITH_LEGACY=1
1022fi
1023AC_SUBST(WITH_LEGACY)
1024
Daniel Veillard81273902003-09-30 00:43:48 +00001025if test "$with_reader" = "no" ; then
1026 echo Disabling the xmlReader parsing interface
1027 WITH_READER=0
Daniel Veillard73b013f2003-09-30 12:36:01 +00001028 READER_TEST=
Daniel Veillard81273902003-09-30 00:43:48 +00001029else
1030 WITH_READER=1
Daniel Veillard73b013f2003-09-30 12:36:01 +00001031 READER_TEST=Readertests
William M. Brack21e4ef22005-01-02 09:53:13 +00001032 if test "$with_push" = "no" ; then
1033 echo xmlReader requires Push interface - enabling it
1034 with_push=yes
1035 fi
Daniel Veillard81273902003-09-30 00:43:48 +00001036fi
1037AC_SUBST(WITH_READER)
Daniel Veillard73b013f2003-09-30 12:36:01 +00001038AC_SUBST(READER_TEST)
Daniel Veillard81273902003-09-30 00:43:48 +00001039
William M. Brack21e4ef22005-01-02 09:53:13 +00001040if test "$with_writer" = "no" ; then
1041 echo Disabling the xmlWriter saving interface
1042 WITH_WRITER=0
1043# WRITER_TEST=
1044else
1045 WITH_WRITER=1
1046# WRITER_TEST=Writertests
1047 if test "$with_push" = "no" ; then
1048 echo xmlWriter requires Push interface - enabling it
1049 with_push=yes
1050 fi
1051 if test "$with_output" = "no" ; then
1052 echo xmlWriter requires Output interface - enabling it
1053 with_output=yes
1054 fi
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001055fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001056AC_SUBST(WITH_WRITER)
1057#AC_SUBST(WRITER_TEST)
1058
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001059if test "$with_pattern" = "no" ; then
1060 echo Disabling the xmlPattern parsing interface
1061 WITH_PATTERN=0
Daniel Veillardf9d16912005-01-30 22:36:30 +00001062 TEST_PATTERN=
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001063else
1064 WITH_PATTERN=1
Daniel Veillardf9d16912005-01-30 22:36:30 +00001065 TEST_PATTERN=Patterntests
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001066fi
1067AC_SUBST(WITH_PATTERN)
Daniel Veillardf9d16912005-01-30 22:36:30 +00001068AC_SUBST(TEST_PATTERN)
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001069
Daniel Veillard81273902003-09-30 00:43:48 +00001070if test "$with_sax1" = "no" ; then
1071 echo Disabling the older SAX1 interface
1072 WITH_SAX1=0
1073 TEST_SAX=
1074else
1075 WITH_SAX1=1
1076 TEST_SAX=SAXtests
1077fi
1078AC_SUBST(WITH_SAX1)
1079AC_SUBST(TEST_SAX)
1080
Daniel Veillard73b013f2003-09-30 12:36:01 +00001081if test "$with_push" = "no" ; then
1082 echo Disabling the PUSH parser interfaces
1083 WITH_PUSH=0
1084 TEST_PUSH=
1085else
1086 WITH_PUSH=1
1087 TEST_PUSH="XMLPushtests"
1088fi
1089AC_SUBST(WITH_PUSH)
1090AC_SUBST(TEST_PUSH)
1091
Daniel Veillard73b013f2003-09-30 12:36:01 +00001092if test "$with_html" = "no" ; then
1093 echo Disabling HTML support
1094 WITH_HTML=0
1095 HTML_OBJ=
1096 TEST_HTML=
1097else
1098 WITH_HTML=1
1099 HTML_OBJ="HTMLparser.o HTMLtree.o"
1100 TEST_HTML=HTMLtests
William M. Brack871611b2003-10-18 04:53:14 +00001101 if test "$with_push" != "no" ; then
Daniel Veillard73b013f2003-09-30 12:36:01 +00001102 TEST_PHTML=HTMLPushtests
1103 else
1104 TEST_PHTML=
1105 fi
1106fi
1107AC_SUBST(WITH_HTML)
1108AC_SUBST(HTML_OBJ)
1109AC_SUBST(TEST_HTML)
1110AC_SUBST(TEST_PHTML)
1111
Daniel Veillard73b013f2003-09-30 12:36:01 +00001112if test "$with_valid" = "no" ; then
Daniel Veillard4432df22003-09-28 18:58:27 +00001113 echo Disabling DTD validation support
1114 WITH_VALID=0
1115 TEST_VALID=
1116 TEST_VTIME=
1117else
1118 WITH_VALID=1
1119 TEST_VALID=Validtests
1120 TEST_VTIME=VTimingtests
1121fi
1122AC_SUBST(WITH_VALID)
1123AC_SUBST(TEST_VALID)
1124AC_SUBST(TEST_VTIME)
Daniel Veillard361d8452000-04-03 19:48:13 +00001125
Daniel Veillarda7374592001-05-10 14:17:55 +00001126if test "$with_catalog" = "no" ; then
1127 echo Disabling Catalog support
1128 WITH_CATALOG=0
1129 CATALOG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001130 TEST_CATALOG=
Daniel Veillarda7374592001-05-10 14:17:55 +00001131else
1132 WITH_CATALOG=1
1133 CATALOG_OBJ="catalog.o"
Daniel Veillard4432df22003-09-28 18:58:27 +00001134 TEST_CATALOG=Catatests
Daniel Veillarda7374592001-05-10 14:17:55 +00001135fi
1136AC_SUBST(WITH_CATALOG)
1137AC_SUBST(CATALOG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001138AC_SUBST(TEST_CATALOG)
Daniel Veillarda7374592001-05-10 14:17:55 +00001139
Daniel Veillardb59076b2001-04-29 17:04:07 +00001140if test "$with_docbook" = "no" ; then
1141 echo Disabling Docbook support
Daniel Veillardeae522a2001-04-23 13:41:34 +00001142 WITH_DOCB=0
1143 DOCB_OBJ=
Daniel Veillardb59076b2001-04-29 17:04:07 +00001144else
1145 WITH_DOCB=1
1146 DOCB_OBJ="DOCBparser.o"
Daniel Veillardeae522a2001-04-23 13:41:34 +00001147fi
1148AC_SUBST(WITH_DOCB)
1149AC_SUBST(DOCB_OBJ)
1150
1151
William M. Brack21e4ef22005-01-02 09:53:13 +00001152if test "$with_xptr" = "no" ; then
1153 echo Disabling XPointer support
1154 WITH_XPTR=0
1155 XPTR_OBJ=
1156 TEST_XPTR=
1157else
1158 WITH_XPTR=1
1159 XPTR_OBJ=xpointer.o
1160 TEST_XPTR=XPtrtests
1161 if test "$with_xpath" = "no" ; then
1162 echo XPointer requires XPath support - enabling it
1163 with_xpath=yes
1164 fi
Daniel Veillard4432df22003-09-28 18:58:27 +00001165fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001166AC_SUBST(WITH_XPTR)
1167AC_SUBST(XPTR_OBJ)
1168AC_SUBST(TEST_XPTR)
1169
1170if test "$with_c14n" = "no" ; then
1171 echo Disabling C14N support
1172 WITH_C14N=0
1173 C14N_OBJ=
1174 TEST_C14N=
1175else
1176 WITH_C14N=1
1177 C14N_OBJ="c14n.c"
1178 TEST_C14N=C14Ntests
1179 if test "$with_xpath" = "no" ; then
1180 echo C14N requires XPath support - enabling it
1181 with_xpath=yes
1182 fi
1183fi
1184AC_SUBST(WITH_C14N)
1185AC_SUBST(C14N_OBJ)
1186AC_SUBST(TEST_C14N)
1187
1188if test "$with_xinclude" = "no" ; then
1189 echo Disabling XInclude support
1190 WITH_XINCLUDE=0
1191 XINCLUDE_OBJ=
1192 with_xinclude="no"
1193 TEST_XINCLUDE=
1194else
1195 WITH_XINCLUDE=1
1196 XINCLUDE_OBJ=xinclude.o
1197 TEST_XINCLUDE=XIncludetests
1198 if test "$with_xpath" = "no" ; then
1199 echo XInclude requires XPath support - enabling it
1200 with_xpath=yes
1201 fi
1202fi
1203AC_SUBST(WITH_XINCLUDE)
1204AC_SUBST(XINCLUDE_OBJ)
1205AC_SUBST(TEST_XINCLUDE)
1206
Daniel Veillard361d8452000-04-03 19:48:13 +00001207if test "$with_xpath" = "no" ; then
1208 echo Disabling XPATH support
1209 WITH_XPATH=0
1210 XPATH_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001211 TEST_XPATH=
Daniel Veillard361d8452000-04-03 19:48:13 +00001212else
1213 WITH_XPATH=1
1214 XPATH_OBJ=xpath.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001215 TEST_XPATH=XPathtests
Daniel Veillard361d8452000-04-03 19:48:13 +00001216fi
1217AC_SUBST(WITH_XPATH)
1218AC_SUBST(XPATH_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001219AC_SUBST(TEST_XPATH)
Daniel Veillard361d8452000-04-03 19:48:13 +00001220
William M. Brack21e4ef22005-01-02 09:53:13 +00001221dnl
1222dnl output functions
1223dnl
1224if test "$with_output" = "no" ; then
1225 echo Disabling serialization/saving support
1226 WITH_OUTPUT=0
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001227else
William M. Brack21e4ef22005-01-02 09:53:13 +00001228 WITH_OUTPUT=1
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001229fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001230AC_SUBST(WITH_OUTPUT)
Daniel Veillard9e8bfae2000-11-06 16:43:11 +00001231
Daniel Veillard6e90d192001-07-03 16:37:49 +00001232WITH_ICONV=0
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001233if test "$with_iconv" = "no" ; then
1234 echo Disabling ICONV support
Daniel Veillardd574f782001-03-14 19:40:17 +00001235else
Daniel Veillard220346d2001-12-07 11:33:54 +00001236 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
Daniel Veillard6e90d192001-07-03 16:37:49 +00001237 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
Daniel Veillardf5b44e42001-09-17 17:19:54 +00001238 # Export this since our headers include iconv.h
1239 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
Daniel Veillard6e90d192001-07-03 16:37:49 +00001240 ICONV_LIBS="-L$with_iconv/lib"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001241 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001242
1243 AC_CHECK_HEADER(iconv.h,
1244 AC_MSG_CHECKING(for iconv)
1245 AC_TRY_LINK([#include <stdlib.h>
1246#include <iconv.h>],[
1247iconv_t cd = iconv_open ("","");
1248iconv (cd, NULL, NULL, NULL, NULL);],[
1249 AC_MSG_RESULT(yes)
1250 WITH_ICONV=1],[
1251 AC_MSG_RESULT(no)
1252 AC_MSG_CHECKING(for iconv in -liconv)
1253
1254 _ldflags="${LDFLAGS}"
1255 _libs="${LIBS}"
1256 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1257 LIBS="${LIBS} -liconv"
1258
1259 AC_TRY_LINK([#include <stdlib.h>
1260#include <iconv.h>],[
1261iconv_t cd = iconv_open ("","");
1262iconv (cd, NULL, NULL, NULL, NULL);],[
1263 AC_MSG_RESULT(yes)
1264 WITH_ICONV=1
1265 ICONV_LIBS="${ICONV_LIBS} -liconv"
1266 LIBS="${_libs}"
1267 LDFLAGS="${_ldflags}"],[
1268 AC_MSG_RESULT(no)
1269 LIBS="${_libs}"
1270 LDFLAGS="${_ldflags}"])]))
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001271
1272 if test "$WITH_ICONV" = "1" ; then
1273 AC_MSG_CHECKING([for iconv declaration])
1274 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1275 AC_TRY_COMPILE([#include <stdlib.h>
1276#include <iconv.h>
1277extern
1278#ifdef __cplusplus
1279"C"
1280#endif
1281#if defined(__STDC__) || defined(__cplusplus)
1282size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1283#else
1284size_t iconv();
1285#endif
1286], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1287
1288 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);"
1289 AC_MSG_RESULT([${xml_xxx:-
1290 }$xml_cv_iconv_decl])
1291 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1292 [Define as const if the declaration of iconv() needs const.])
1293 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001294fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001295case "$host" in
1296 *mingw*) M_LIBS=""
1297 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +00001298 *beos*) M_LIBS=""
1299 ;;
Scott McCreary508a8d62009-08-24 16:35:35 +02001300 *haiku*) M_LIBS=""
1301 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001302 *) M_LIBS="-lm"
1303 ;;
1304esac
Daniel Veillardb82c1662001-12-09 14:00:54 +00001305XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
Daniel Veillard90d165b2003-09-01 20:33:13 +00001306XML_LIBTOOLLIBS="libxml2.la"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001307AC_SUBST(WITH_ICONV)
1308
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001309WITH_ISO8859X=1
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001310if test "$WITH_ICONV" != "1" ; then
1311if test "$with_iso8859x" = "no" ; then
1312 echo Disabling ISO8859X support
1313 WITH_ISO8859X=0
1314fi
1315fi
1316AC_SUBST(WITH_ISO8859X)
1317
Daniel Veillarded6c5492005-07-23 15:00:22 +00001318if test "$with_schematron" = "no" ; then
1319 echo "Disabling Schematron support"
1320 WITH_SCHEMATRON=0
1321 TEST_SCHEMATRON=
1322else
1323 echo "Enabled Schematron support"
1324 WITH_SCHEMATRON=1
1325 TEST_SCHEMATRON="Schematrontests"
1326 with_xpath=yes
1327 with_pattern=yes
1328fi
1329AC_SUBST(WITH_SCHEMATRON)
1330AC_SUBST(TEST_SCHEMATRON)
1331
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001332if test "$with_schemas" = "no" ; then
William M. Brack21e4ef22005-01-02 09:53:13 +00001333 echo "Disabling Schemas/Relax-NG support"
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001334 WITH_SCHEMAS=0
1335 TEST_SCHEMAS=
1336else
Daniel Veillard71531f32003-02-05 13:19:53 +00001337 echo "Enabled Schemas/Relax-NG support"
Daniel Veillard4255d502002-04-16 15:50:10 +00001338 WITH_SCHEMAS=1
Daniel Veillard6eadf632003-01-23 18:29:16 +00001339 TEST_SCHEMAS="Schemastests Relaxtests"
Daniel Veillard6dc91962004-03-22 19:10:02 +00001340 if test "$PYTHON_INCLUDES" != "" ; then
1341 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1342 fi
Daniel Veillard23e73572002-09-19 19:56:43 +00001343 with_regexps=yes
Daniel Veillard4255d502002-04-16 15:50:10 +00001344fi
1345AC_SUBST(WITH_SCHEMAS)
1346AC_SUBST(TEST_SCHEMAS)
1347
Daniel Veillard23e73572002-09-19 19:56:43 +00001348if test "$with_regexps" = "no" ; then
1349 echo Disabling Regexps support
1350 WITH_REGEXPS=0
1351 TEST_REGEXPS=
1352else
1353 WITH_REGEXPS=1
1354 TEST_REGEXPS="Regexptests Automatatests"
1355fi
1356AC_SUBST(WITH_REGEXPS)
1357AC_SUBST(TEST_REGEXPS)
1358
Daniel Veillard361d8452000-04-03 19:48:13 +00001359if test "$with_debug" = "no" ; then
1360 echo Disabling DEBUG support
1361 WITH_DEBUG=0
1362 DEBUG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001363 TEST_DEBUG=
Daniel Veillard361d8452000-04-03 19:48:13 +00001364else
1365 WITH_DEBUG=1
1366 DEBUG_OBJ=debugXML.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001367 TEST_DEBUG=Scripttests
Daniel Veillard361d8452000-04-03 19:48:13 +00001368fi
1369AC_SUBST(WITH_DEBUG)
1370AC_SUBST(DEBUG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001371AC_SUBST(TEST_DEBUG)
Daniel Veillard361d8452000-04-03 19:48:13 +00001372
Daniel Veillard361d8452000-04-03 19:48:13 +00001373if test "$with_mem_debug" = "yes" ; then
William M. Brack306e33c2004-06-12 01:01:22 +00001374 if test "$with_thread_alloc" = "yes" ; then
1375 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1376 WITH_MEM_DEBUG=0
1377 else
1378 echo Enabling memory debug support
1379 WITH_MEM_DEBUG=1
1380 fi
Daniel Veillard361d8452000-04-03 19:48:13 +00001381else
1382 WITH_MEM_DEBUG=0
1383fi
1384AC_SUBST(WITH_MEM_DEBUG)
1385
Daniel Veillard22cdb842004-10-04 14:09:17 +00001386if test "$with_run_debug" = "yes" ; then
1387 echo Enabling runtime debug support
1388 WITH_RUN_DEBUG=1
1389else
1390 WITH_RUN_DEBUG=0
1391fi
1392AC_SUBST(WITH_RUN_DEBUG)
Daniel Veillard1638a472003-08-14 01:23:25 +00001393
1394WIN32_EXTRA_LIBADD=
1395WIN32_EXTRA_LDFLAGS=
William M. Bracka73f45b2005-01-11 02:21:33 +00001396CYGWIN_EXTRA_LDFLAGS=
1397CYGWIN_EXTRA_PYTHON_LIBADD=
Daniel Veillard1638a472003-08-14 01:23:25 +00001398case "$host" in
1399 *-*-mingw*)
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001400 CPPFLAGS="$CPPFLAGS -DWIN32"
1401 WIN32_EXTRA_LIBADD="-lws2_32"
Daniel Veillard1638a472003-08-14 01:23:25 +00001402 WIN32_EXTRA_LDFLAGS="-no-undefined"
1403 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1404 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1405 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
1406 ;;
Daniel Veillardd392ba72004-08-04 14:56:45 +00001407 *-*-cygwin*)
1408 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
William M. Bracka73f45b2005-01-11 02:21:33 +00001409 if test "${PYTHON}" != ""
1410 then
1411 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1412 fi
Daniel Veillardd392ba72004-08-04 14:56:45 +00001413 ;;
Daniel Veillard1638a472003-08-14 01:23:25 +00001414esac
1415AC_SUBST(WIN32_EXTRA_LIBADD)
1416AC_SUBST(WIN32_EXTRA_LDFLAGS)
Daniel Veillardd392ba72004-08-04 14:56:45 +00001417AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1418AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
Daniel Veillard1638a472003-08-14 01:23:25 +00001419
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001420if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1421then
1422 echo Enabling code coverage for GCC
1423 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1424 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1425else
1426 echo Disabling code coverage for GCC
1427fi
1428
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001429AC_SUBST(CPPFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001430AC_SUBST(CFLAGS)
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001431AC_SUBST(LDFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +00001432AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001433
Daniel Veillardb05deb71999-08-10 19:04:08 +00001434AC_SUBST(XML_LIBDIR)
1435AC_SUBST(XML_LIBS)
Daniel Veillard90d165b2003-09-01 20:33:13 +00001436AC_SUBST(XML_LIBTOOLLIBS)
Daniel Veillard81418e32001-05-22 15:08:55 +00001437AC_SUBST(ICONV_LIBS)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001438AC_SUBST(XML_INCLUDEDIR)
1439AC_SUBST(HTML_DIR)
1440AC_SUBST(HAVE_ISNAN)
1441AC_SUBST(HAVE_ISINF)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +00001442AC_SUBST(PYTHON)
1443AC_SUBST(PYTHON_VERSION)
1444AC_SUBST(PYTHON_INCLUDES)
Daniel Veillard253aa2c2002-02-02 09:17:16 +00001445AC_SUBST(PYTHON_SITE_PACKAGES)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001446
Daniel Veillardb05deb71999-08-10 19:04:08 +00001447AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +00001448AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +00001449
Daniel Veillard9715c172002-11-25 16:33:40 +00001450dnl for the spec file
1451RELDATE=`date +'%a %b %e %Y'`
1452AC_SUBST(RELDATE)
Daniel Veillard6dc91962004-03-22 19:10:02 +00001453AC_SUBST(PYTHON_TESTS)
Daniel Veillard9715c172002-11-25 16:33:40 +00001454
Daniel Veillardc6e997c2003-01-27 12:35:42 +00001455rm -f COPYING.LIB COPYING
Daniel Veillardc575b992002-02-08 13:28:40 +00001456ln -s Copyright COPYING
1457
Daniel Veillarde4177a52004-01-08 16:43:57 +00001458# keep on one line for cygwin c.f. #130896
Daniel Veillard99b78502005-09-11 22:04:08 +00001459AC_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 +00001460
Daniel Veillard06d25242004-02-25 13:01:42 +00001461chmod +x xml2-config python/setup.py
Daniel Veillard67952602006-01-05 15:29:44 +00001462echo Done configuring