blob: 4d4379662d36d2478413b09a3c94a020772d70a7 [file] [log] [blame]
Daniel Veillard01791d51998-07-24 19:24:09 +00001dnl Process this file with autoconf to produce a configure script.
Adrian Bunk64b0d602010-11-04 09:43:31 +01002AC_PREREQ(2.59)
Owen Taylor3473f882001-02-23 17:55:21 +00003AC_INIT(entities.c)
Daniel Veillard01791d51998-07-24 19:24:09 +00004AM_CONFIG_HEADER(config.h)
Daniel Veillard3157e512010-03-09 11:32:46 +01005AC_CONFIG_MACRO_DIR([m4])
Daniel Veillardd2ade932000-09-30 14:39:55 +00006AC_CANONICAL_HOST
Daniel Veillard14fff061999-06-22 21:49:07 +00007
Daniel Veillardcf461992000-03-14 18:30:20 +00008LIBXML_MAJOR_VERSION=2
Daniel Veillard15724252008-08-30 15:01:04 +00009LIBXML_MINOR_VERSION=7
Daniel Veillardbb5055f2010-03-15 16:21:00 +010010LIBXML_MICRO_VERSION=7
Daniel Veillard3e35f8e2003-10-21 00:05:38 +000011LIBXML_MICRO_VERSION_SUFFIX=
Daniel Veillard4fc52812003-09-01 20:33:13 +000012LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
Daniel Veillard14fff061999-06-22 21:49:07 +000013LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
14
Daniel Veillard361d8452000-04-03 19:48:13 +000015LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
16
Daniel Veillard9cb1b642007-01-03 15:07:44 +000017if test -f CVS/Entries ; then
Daniel Veillarddab93ea2004-08-20 16:47:10 +000018 extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
19 echo extra=$extra
20 if test "$extra" != ""
21 then
22 LIBXML_VERSION_EXTRA="-CVS$extra"
23 fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000024else if test -d .svn ; then
25 extra=`svn info | grep Revision | sed 's+Revision: ++'`
26 echo extra=$extra
27 if test "$extra" != ""
28 then
29 LIBXML_VERSION_EXTRA="-SVN$extra"
30 fi
veillard97c7be62009-05-12 08:43:54 +020031else if test -d .git ; then
32 extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
33 echo extra=$extra
34 if test "$extra" != ""
35 then
36 LIBXML_VERSION_EXTRA="-GIT$extra"
37 fi
38fi
Daniel Veillard9cb1b642007-01-03 15:07:44 +000039fi
William M. Brackf4025492004-08-18 21:08:46 +000040fi
Daniel Veillard14fff061999-06-22 21:49:07 +000041AC_SUBST(LIBXML_MAJOR_VERSION)
42AC_SUBST(LIBXML_MINOR_VERSION)
43AC_SUBST(LIBXML_MICRO_VERSION)
44AC_SUBST(LIBXML_VERSION)
45AC_SUBST(LIBXML_VERSION_INFO)
Daniel Veillard361d8452000-04-03 19:48:13 +000046AC_SUBST(LIBXML_VERSION_NUMBER)
William M. Brackf4025492004-08-18 21:08:46 +000047AC_SUBST(LIBXML_VERSION_EXTRA)
Daniel Veillard14fff061999-06-22 21:49:07 +000048
Daniel Veillard361d8452000-04-03 19:48:13 +000049VERSION=${LIBXML_VERSION}
Daniel Veillard14fff061999-06-22 21:49:07 +000050
Daniel Veillardedfb29b2000-03-14 19:59:05 +000051AM_INIT_AUTOMAKE(libxml2, $VERSION)
Daniel Veillard1164e751999-02-16 16:29:17 +000052
Daniel Veillard01791d51998-07-24 19:24:09 +000053dnl Checks for programs.
54AC_PROG_CC
55AC_PROG_INSTALL
Adrian Bunk64b0d602010-11-04 09:43:31 +010056AC_PROG_MKDIR_P
Sebastian Wilhelmia44c8a41998-08-07 08:38:58 +000057AC_PROG_CPP
Daniel Veillard01791d51998-07-24 19:24:09 +000058AC_PATH_PROG(RM, rm, /bin/rm)
59AC_PATH_PROG(MV, mv, /bin/mv)
60AC_PATH_PROG(TAR, tar, /bin/tar)
William M. Brack1826d0a2004-07-21 09:03:57 +000061AC_PATH_PROG(PERL, perl, /usr/bin/perl)
Daniel Veillard33a2de92006-10-11 08:33:22 +000062AC_PATH_PROG(WGET, wget, /usr/bin/wget)
Daniel Veillard8b817da2004-09-30 09:19:33 +000063AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
Daniel Veillard06500c82004-09-07 09:12:44 +000064AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
Daniel Veillard01791d51998-07-24 19:24:09 +000065
Daniel Veillard03109292000-08-14 14:58:22 +000066dnl Make sure we have an ANSI compiler
67AM_C_PROTOTYPES
68test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
69
Daniel Veillard6984e6d2003-12-09 14:20:17 +000070AC_LIBTOOL_WIN32_DLL
Daniel Veillard01791d51998-07-24 19:24:09 +000071AM_PROG_LIBTOOL
72
Daniel Veillard4432df22003-09-28 18:58:27 +000073dnl
Daniel Veillard8ed10722009-08-20 19:17:36 +020074dnl if the system support linker version scripts for symbol versioning
75dnl then add it
76dnl
77VERSION_SCRIPT_FLAGS=
Roumen Petrovf39adc22010-03-11 14:49:13 +010078# lt_cv_prog_gnu_ld is from libtool 2.+
79if test "$lt_cv_prog_gnu_ld" = yes; then
80 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
81else
82 case $host in
83 *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
84 esac
85fi
Daniel Veillard8ed10722009-08-20 19:17:36 +020086AC_SUBST(VERSION_SCRIPT_FLAGS)
87AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
88
89dnl
William M. Brack21e4ef22005-01-02 09:53:13 +000090dnl We process the AC_ARG_WITH first so that later we can modify
91dnl some of them to try to prevent impossible combinations. This
92dnl also allows up so alphabetize the choices
Daniel Veillard4432df22003-09-28 18:58:27 +000093dnl
Daniel Veillard4432df22003-09-28 18:58:27 +000094
William M. Brack21e4ef22005-01-02 09:53:13 +000095dnl
96dnl zlib option might change flags, so we save them initially
97dnl
Owen Taylor3473f882001-02-23 17:55:21 +000098_cppflags="${CPPFLAGS}"
99_ldflags="${LDFLAGS}"
Daniel Veillard71b656e2000-01-05 14:46:17 +0000100
William M. Brack21e4ef22005-01-02 09:53:13 +0000101AC_ARG_WITH(c14n,
102[ --with-c14n add the Canonicalization support (on)])
103AC_ARG_WITH(catalog,
104[ --with-catalog add the Catalog support (on)])
105AC_ARG_WITH(debug,
106[ --with-debug add the debugging module (on)])
107AC_ARG_WITH(docbook,
108[ --with-docbook add Docbook SGML support (on)])
109AC_ARG_WITH(fexceptions,
110[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
111AC_ARG_WITH(ftp,
112[ --with-ftp add the FTP support (on)])
113AC_ARG_WITH(history,
114[ --with-history add history support to xmllint shell(off)])
115AC_ARG_WITH(html,
116[ --with-html add the HTML support (on)])
117dnl Specific dir for HTML output ?
118AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
119 [path to base html directory, default $datadir/doc/html]),
120 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
Daniel Veillard259ff742001-10-06 13:49:59 +0000121
William M. Brack21e4ef22005-01-02 09:53:13 +0000122AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
123 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
124 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
125 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
126AC_SUBST(HTML_DIR)
127AC_ARG_WITH(http,
128[ --with-http add the HTTP support (on)])
129AC_ARG_WITH(iconv,
130[ --with-iconv[[=DIR]] add ICONV support (on)])
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +0100131AC_ARG_WITH(icu,
132[ --with-icu add ICU support (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000133AC_ARG_WITH(iso8859x,
134[ --with-iso8859x add ISO8859X support if no iconv (on)])
135AC_ARG_WITH(legacy,
136[ --with-legacy add deprecated APIs for compatibility (on)])
137AC_ARG_WITH(mem_debug,
138[ --with-mem-debug add the memory debugging module (off)])
139AC_ARG_WITH(minimum,
140[ --with-minimum build a minimally sized library (off)])
141AC_ARG_WITH(output,
142[ --with-output add the serialization support (on)])
143AC_ARG_WITH(pattern,
144[ --with-pattern add the xmlPattern selection interface (on)])
145AC_ARG_WITH(push,
146[ --with-push add the PUSH parser interfaces (on)])
147AC_ARG_WITH(python,
148[ --with-python[[=DIR]] build Python bindings if found])
149AC_ARG_WITH(reader,
150[ --with-reader add the xmlReader parsing interface (on)])
151AC_ARG_WITH(readline,
152[ --with-readline=DIR use readline in DIR],[
153 if test "$withval" != "no" -a "$withval" != "yes"; then
154 RDL_DIR=$withval
155 CPPFLAGS="${CPPFLAGS} -I$withval/include"
156 LDFLAGS="${LDFLAGS} -L$withval/lib"
157 fi
158])
159AC_ARG_WITH(regexps,
160[ --with-regexps add Regular Expressions support (on)])
161AC_ARG_WITH(run_debug,
162[ --with-run-debug add the runtime debugging module (off)])
163AC_ARG_WITH(sax1,
164[ --with-sax1 add the older SAX1 interface (on)])
165AC_ARG_WITH(schemas,
Daniel Veillard39e5c892005-07-03 22:48:50 +0000166[ --with-schemas add Relax-NG and Schemas support (on)])
Daniel Veillarded6c5492005-07-23 15:00:22 +0000167AC_ARG_WITH(schematron,
168[ --with-schematron add Schematron support (on)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000169AC_ARG_WITH(threads,
170[ --with-threads add multithread support(on)])
171AC_ARG_WITH(thread-alloc,
172[ --with-thread-alloc add per-thread memory(off)])
173AC_ARG_WITH(tree,
174[ --with-tree add the DOM like tree manipulation APIs (on)])
175AC_ARG_WITH(valid,
176[ --with-valid add the DTD validation support (on)])
177AC_ARG_WITH(writer,
178[ --with-writer add the xmlWriter saving interface (on)])
179AC_ARG_WITH(xinclude,
180[ --with-xinclude add the XInclude support (on)])
181AC_ARG_WITH(xpath,
182[ --with-xpath add the XPATH support (on)])
183AC_ARG_WITH(xptr,
184[ --with-xptr add the XPointer support (on)])
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000185AC_ARG_WITH(modules,
186[ --with-modules add the dynamic modules support (on)])
Owen Taylor3473f882001-02-23 17:55:21 +0000187AC_ARG_WITH(zlib,
William M. Brack97ad4c72003-05-13 08:08:36 +0000188[ --with-zlib[[=DIR]] use libz in DIR],[
Owen Taylor3473f882001-02-23 17:55:21 +0000189 if test "$withval" != "no" -a "$withval" != "yes"; then
190 Z_DIR=$withval
191 CPPFLAGS="${CPPFLAGS} -I$withval/include"
192 LDFLAGS="${LDFLAGS} -L$withval/lib"
193 fi
Daniel Veillard259ff742001-10-06 13:49:59 +0000194])
Daniel Veillardbfa5cf12008-08-27 15:33:28 +0000195AC_ARG_WITH(coverage,
196[ --with-coverage build for code coverage with GCC (off)])
William M. Brack21e4ef22005-01-02 09:53:13 +0000197
Daniel Veillardb40744e2008-10-17 13:26:44 +0000198AC_ARG_ENABLE(rebuild-docs,
199[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
200AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
201
William M. Brack21e4ef22005-01-02 09:53:13 +0000202dnl
Daniel Veillard39e5c892005-07-03 22:48:50 +0000203dnl hard dependancies on options
204dnl
205if test "$with_schemas" = "yes"
206then
207 with_pattern=yes
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000208 with_regexps=yes
Daniel Veillard39e5c892005-07-03 22:48:50 +0000209fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000210if test "$with_schematron" = "yes"
211then
212 with_pattern=yes
213 with_xpath=yes
214fi
Daniel Veillard39e5c892005-07-03 22:48:50 +0000215if test "$with_reader" = "yes"
216then
217 with_push=yes
218fi
219if test "$with_xptr" = "yes"
220then
221 with_xpath=yes
222fi
223dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000224dnl option to build a minimal libxml2 library
225dnl
226if test "$with_minimum" = "yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000227then
William M. Brack21e4ef22005-01-02 09:53:13 +0000228 echo "Configuring for a minimal library"
229 if test "$with_c14n" = ""
230 then
231 with_c14n=no
232 fi
233 if test "$with_catalog" = ""
234 then
235 with_catalog=no
236 fi
237 echo So far so good!
238 if test "$with_debug" = ""
239 then
240 with_debug=no
241 fi
242 if test "$with_docbook" = ""
243 then
244 with_docbook=no
245 fi
246 if test "$with_fexceptions" = ""
247 then
248 with_fexceptions=no
249 fi
250 if test "$with_ftp" = ""
251 then
252 with_ftp=no
253 fi
254 if test "$with_history" = ""
255 then
256 with_history=no
257 fi
258 if test "$with_html" = ""
259 then
260 with_html=no
261 fi
262 if test "$with_http" = ""
263 then
264 with_http=no
265 fi
266 if test "$with_iconv" = ""
267 then
268 with_iconv=no
269 fi
270 if test "$with_iso8859x" = ""
271 then
272 with_iso8859x=no
273 fi
274 if test "$with_legacy" = ""
275 then
276 with_legacy=no
277 fi
278 if test "$with_mem_debug" = ""
279 then
280 with_mem_debug=no
281 fi
282 if test "$with_output" = ""
283 then
284 with_output=no
285 fi
286 if test "$with_pattern" = ""
287 then
288 with_pattern=no
289 fi
290 if test "$with_push" = ""
291 then
292 with_push=no
293 fi
294 if test "$with_python" = ""
295 then
296 with_python=no
297 fi
298 if test "$with_reader" = ""
299 then
300 with_reader=no
301 fi
302 if test "$with_readline" = ""
303 then
304 with_readline=no
305 fi
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000306 if test "$with_regexps" = ""
William M. Brack21e4ef22005-01-02 09:53:13 +0000307 then
Daniel Veillardc51f51c2007-05-02 16:25:45 +0000308 with_regexps=no
William M. Brack21e4ef22005-01-02 09:53:13 +0000309 fi
310 if test "$with_run_debug" = ""
311 then
312 with_run_debug=no
313 fi
314 if test "$with_sax1" = ""
315 then
316 with_sax1=no
317 fi
318 if test "$with_schemas" = ""
319 then
320 with_schemas=no
321 fi
Daniel Veillarded6c5492005-07-23 15:00:22 +0000322 if test "$with_schematron" = ""
323 then
324 with_schematron=no
325 fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000326 if test "$with_threads" = ""
327 then
328 with_threads=no
329 fi
330 if test "$with_thread_alloc" = ""
331 then
332 with_thread_alloc=no
333 fi
334 if test "$with_tree" = ""
335 then
336 with_tree=no
337 fi
338 if test "$with_valid" = ""
339 then
340 with_valid=no
341 fi
342 if test "$with_writer" = ""
343 then
344 with_writer=no
345 fi
346 if test "$with_xinclude" = ""
347 then
348 with_xinclude=no
349 fi
350 if test "$with_xpath" = ""
351 then
352 with_xpath=no
353 fi
354 if test "$with_xptr" = ""
355 then
356 with_xptr=no
357 fi
358 if test "$with_zlib" = ""
359 then
360 with_zlib=no
361 fi
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000362 if test "$with_modules" = ""
363 then
364 with_modules=no
365 fi
Daniel Veillard4432df22003-09-28 18:58:27 +0000366fi
William M. Brack21e4ef22005-01-02 09:53:13 +0000367
368echo Checking zlib
369
370dnl Checks for zlib library.
371
Daniel Veillard75acfee2006-07-13 06:29:56 +0000372WITH_ZLIB=0
Daniel Veillard259ff742001-10-06 13:49:59 +0000373if test "$with_zlib" = "no"; then
374 echo "Disabling compression support"
375else
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000376 AC_CHECK_HEADERS(zlib.h,
377 AC_CHECK_LIB(z, gzread,[
Daniel Veillard75acfee2006-07-13 06:29:56 +0000378 AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
379 WITH_ZLIB=1
Daniel Veillard3fbe8e32001-10-06 13:30:33 +0000380 if test "x${Z_DIR}" != "x"; then
381 Z_CFLAGS="-I${Z_DIR}/include"
382 Z_LIBS="-L${Z_DIR}/lib -lz"
383 [case ${host} in
384 *-*-solaris*)
385 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
386 ;;
387 esac]
388 else
389 Z_LIBS="-lz"
390 fi]))
Daniel Veillard259ff742001-10-06 13:49:59 +0000391fi
Owen Taylor3473f882001-02-23 17:55:21 +0000392
Owen Taylor3473f882001-02-23 17:55:21 +0000393AC_SUBST(Z_CFLAGS)
394AC_SUBST(Z_LIBS)
Daniel Veillard75acfee2006-07-13 06:29:56 +0000395AC_SUBST(WITH_ZLIB)
Owen Taylor3473f882001-02-23 17:55:21 +0000396
397CPPFLAGS=${_cppflags}
398LDFLAGS=${_ldflags}
Daniel Veillardb05deb71999-08-10 19:04:08 +0000399
William M. Brack21e4ef22005-01-02 09:53:13 +0000400echo Checking headers
401
Daniel Veillard01791d51998-07-24 19:24:09 +0000402dnl Checks for header files.
403AC_HEADER_DIRENT
404AC_HEADER_STDC
Daniel Veillard817e70b2002-11-19 22:28:48 +0000405AC_CHECK_HEADERS([fcntl.h])
406AC_CHECK_HEADERS([unistd.h])
407AC_CHECK_HEADERS([ctype.h])
408AC_CHECK_HEADERS([dirent.h])
409AC_CHECK_HEADERS([errno.h])
410AC_CHECK_HEADERS([malloc.h])
411AC_CHECK_HEADERS([stdarg.h])
412AC_CHECK_HEADERS([sys/stat.h])
413AC_CHECK_HEADERS([sys/types.h])
Daniel Veillard7f4547c2008-10-03 07:58:23 +0000414AC_CHECK_HEADERS([stdint.h])
415AC_CHECK_HEADERS([inttypes.h.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000416AC_CHECK_HEADERS([time.h])
417AC_CHECK_HEADERS([ansidecl.h])
418AC_CHECK_HEADERS([ieeefp.h])
419AC_CHECK_HEADERS([nan.h])
420AC_CHECK_HEADERS([math.h])
Daniel Veillardebe48c62003-12-03 12:12:27 +0000421AC_CHECK_HEADERS([limits.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000422AC_CHECK_HEADERS([fp_class.h])
423AC_CHECK_HEADERS([float.h])
424AC_CHECK_HEADERS([stdlib.h])
425AC_CHECK_HEADERS([sys/socket.h], [], [],
426[#if HAVE_SYS_TYPES_H
427# include <sys/types.h>
428# endif
429])
430AC_CHECK_HEADERS([netinet/in.h], [], [],
431[#if HAVE_SYS_TYPES_H
432# include <sys/types.h>
433# endif
434])
435AC_CHECK_HEADERS([arpa/inet.h], [], [],
436[#if HAVE_SYS_TYPES_H
437# include <sys/types.h>
438# endif
439#if HAVE_ARPA_INET_H
440# include <arpa/inet.h>
441# endif
442])
443AC_CHECK_HEADERS([netdb.h])
444AC_CHECK_HEADERS([sys/time.h])
445AC_CHECK_HEADERS([sys/select.h])
Raphael Prevost48b60c32009-08-23 13:11:01 +0200446AC_CHECK_HEADERS([poll.h])
Daniel Veillard817e70b2002-11-19 22:28:48 +0000447AC_CHECK_HEADERS([sys/mman.h])
448AC_CHECK_HEADERS([sys/timeb.h])
449AC_CHECK_HEADERS([signal.h])
450AC_CHECK_HEADERS([arpa/nameser.h], [], [],
451[#if HAVE_SYS_TYPES_H
452# include <sys/types.h>
453# endif
454])
455AC_CHECK_HEADERS([resolv.h], [], [],
456[#if HAVE_SYS_TYPES_H
457# include <sys/types.h>
458# endif
459#if HAVE_NETINET_IN_H
460# include <netinet/in.h>
461# endif
462#if HAVE_ARPA_NAMESER_H
463# include <arpa/nameser.h>
464# endif
465])
Daniel Veillarddcd93902005-01-13 11:25:15 +0000466AC_CHECK_HEADERS([dl.h])
467AC_CHECK_HEADERS([dlfcn.h])
Daniel Veillard01791d51998-07-24 19:24:09 +0000468
Daniel Veillardfc979062004-03-04 22:07:16 +0000469
William M. Brack21e4ef22005-01-02 09:53:13 +0000470echo Checking libraries
Daniel Veillard1164e751999-02-16 16:29:17 +0000471
Daniel Veillard01791d51998-07-24 19:24:09 +0000472dnl Checks for library functions.
473AC_FUNC_STRFTIME
Daniel Veillard92ad2102001-03-27 12:47:33 +0000474AC_CHECK_FUNCS(strdup strndup strerror)
Daniel Veillard71b656e2000-01-05 14:46:17 +0000475AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
Daniel Veillard90bc3712002-03-07 15:12:58 +0000476AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
Daniel Veillard068a9652001-06-07 15:30:26 +0000477AC_CHECK_FUNCS(stat _stat signal)
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000478
Daniel Veillard92ad2102001-03-27 12:47:33 +0000479dnl Checking the standard string functions availability
480AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
481 NEED_TRIO=1)
482
William M. Brackf4caa5e2005-10-20 09:04:05 +0000483dnl Checking for va_copy availability
484AC_MSG_CHECKING([for va_copy])
485AC_TRY_LINK([#include <stdarg.h>
486va_list ap1,ap2;], [va_copy(ap1,ap2);],
487have_va_copy=yes,
488have_va_copy=no)
489AC_MSG_RESULT($have_va_copy)
490if test x"$have_va_copy" = x"yes"; then
491 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
492else
493 AC_MSG_CHECKING([for __va_copy])
494 AC_TRY_LINK([#include <stdarg.h>
495 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
496 have___va_copy=yes,
497 have___va_copy=no)
498 AC_MSG_RESULT($have___va_copy)
499 if test x"$have___va_copy" = x"yes"; then
500 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
501 fi
502fi
503
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000504dnl Checks for inet libraries:
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000505AC_SEARCH_LIBS(gethostent, [nsl])
Scott McCreary59f53082009-08-26 09:55:24 +0200506AC_SEARCH_LIBS(setsockopt, [socket net network])
Daniel Veillardd4e39ae2005-10-28 15:59:14 +0000507AC_SEARCH_LIBS(connect, [inet])
Daniel Veillardb05deb71999-08-10 19:04:08 +0000508
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000509dnl Determine what socket length (socklen_t) data type is
510AC_MSG_CHECKING([for type of socket length (socklen_t)])
511AC_TRY_COMPILE2([
512#include <stddef.h>
513#include <sys/types.h>
514#include <sys/socket.h>],[
515(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
516 AC_MSG_RESULT(socklen_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000517 XML_SOCKLEN_T=socklen_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000518 AC_TRY_COMPILE2([
519#include <stddef.h>
520#include <sys/types.h>
521#include <sys/socket.h>],[
522(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
523 AC_MSG_RESULT(size_t *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000524 XML_SOCKLEN_T=size_t],[
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000525 AC_TRY_COMPILE2([
526#include <stddef.h>
527#include <sys/types.h>
528#include <sys/socket.h>],[
529(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
530 AC_MSG_RESULT(int *)
Daniel Veillardc284c642005-03-31 10:24:24 +0000531 XML_SOCKLEN_T=int],[
William M. Brack2e6b1432004-02-09 15:10:28 +0000532 AC_MSG_WARN(could not determine)
Daniel Veillardc284c642005-03-31 10:24:24 +0000533 XML_SOCKLEN_T="int"])])])
534AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000535
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000536dnl ***********************Checking for availability of IPv6*******************
537
538AC_MSG_CHECKING([whether to enable IPv6])
William M. Brack21e4ef22005-01-02 09:53:13 +0000539AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
Daniel Veillard4432df22003-09-28 18:58:27 +0000540if test "$with_minimum" = "yes"
541then
542 enable_ipv6=no
543fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000544if test $enable_ipv6 = yes; then
545 have_ipv6=no
546 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000547 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000548 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000549 ], [
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000550 struct sockaddr_storage ss;
551 socket(AF_INET6, SOCK_STREAM, 0)
552 ],
553 have_ipv6=yes,
554 have_ipv6=no
555 )
556 AC_MSG_RESULT($have_ipv6)
557
William M. Brack476cd962003-08-13 11:09:42 +0000558 if test $have_ipv6 = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000559 AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000560 have_broken_ss_family=no
561
562 dnl *********************************************************************
563 dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
564 dnl a ss_family member, but rather __ss_family. Let's detect that
William M. Brack7d8b36b2005-06-25 07:30:50 +0000565 dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
566 dnl platforms. However, we should only do this if ss_family is not
567 dnl present.
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000568 dnl ********************************************************************
William M. Brack7d8b36b2005-06-25 07:30:50 +0000569 AC_MSG_CHECKING([struct sockaddr::ss_family])
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000570 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000571 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000572 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000573 ], [
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000574 struct sockaddr_storage ss ;
William M. Brack7d8b36b2005-06-25 07:30:50 +0000575 ss.ss_family = 0 ;
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000576 ],
William M. Brack7d8b36b2005-06-25 07:30:50 +0000577 have_ss_family=yes,
578 have_ss_family=no
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000579 )
William M. Brack7d8b36b2005-06-25 07:30:50 +0000580 AC_MSG_RESULT($have_ss_family)
581 if test x$have_ss_family = xno ; then
582 AC_MSG_CHECKING([broken struct sockaddr::ss_family])
583 AC_TRY_COMPILE([
William M. Brack0c1e3012007-03-14 12:40:21 +0000584 #include <sys/types.h>
William M. Brack06559b32007-03-14 09:34:15 +0000585 #include <sys/socket.h>
William M. Brack0c1e3012007-03-14 12:40:21 +0000586 ], [
William M. Brack7d8b36b2005-06-25 07:30:50 +0000587 struct sockaddr_storage ss ;
588 ss.__ss_family = 0 ;
589 ],
590 have_broken_ss_family=yes,
591 have_broken_ss_family=no
592 )
593 AC_MSG_RESULT($have_broken_ss_family)
594 if test x$have_broken_ss_family = xyes ; then
595 AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
596 [Whether struct sockaddr::__ss_family exists])
597 AC_DEFINE(ss_family, __ss_family,
598 [ss_family is not defined here, use __ss_family instead])
599 else
600 AC_MSG_WARN(ss_family and __ss_family not found)
601 fi
Dodji Seketeli8eba3f32004-11-09 18:30:30 +0000602 fi
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000603
604 have_getaddrinfo=no
605 AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
606 if test $have_getaddrinfo != yes; then
607 for lib in bsd socket inet; do
608 AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
609 done
610 fi
611
William M. Brack476cd962003-08-13 11:09:42 +0000612 if test $have_getaddrinfo = yes; then
Daniel Veillardc790bf42003-10-11 10:50:10 +0000613 AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
Daniel Veillardde2a67b2003-06-21 14:20:04 +0000614 fi
615 fi
616fi
617
618dnl ******************************End IPv6 checks******************************
619
Daniel Veillardb05deb71999-08-10 19:04:08 +0000620dnl Checks for isnan in libm if not in libc
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000621AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
Daniel Veillardc790bf42003-10-11 10:50:10 +0000622 [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000623
Daniel Veillardc790bf42003-10-11 10:50:10 +0000624AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
625 [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000626
627XML_LIBDIR='-L${libdir}'
Daniel Veillarde7dd2b82002-03-15 18:44:02 +0000628XML_INCLUDEDIR='-I${includedir}/libxml2'
Daniel Veillardb05deb71999-08-10 19:04:08 +0000629
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000630dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000631dnl Extra flags
632dnl
633XML_CFLAGS=""
Daniel Veillard357c9602001-05-03 10:49:20 +0000634RDL_LIBS=""
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000635
636dnl
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000637dnl Workaround for native compilers
638dnl HP : http://bugs.gnome.org/db/31/3163.html
639dnl DEC : Enable NaN/Inf
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000640dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000641if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000642 case "${host}" in
Daniel Veillard6a0baa02005-12-10 11:11:12 +0000643 hppa*-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000644 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000645 ;;
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000646 *-dec-osf* )
647 CFLAGS="${CFLAGS} -ieee"
648 ;;
William M. Brack476cd962003-08-13 11:09:42 +0000649 alpha*-*-linux* )
650 CFLAGS="${CFLAGS} -ieee"
651 ;;
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000652 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000653else
Daniel Veillardd94849b2003-07-28 13:02:24 +0000654 if test "$with_fexceptions" = "yes"
655 then
656 #
657 # Not activated by default because this inflates the code size
658 # Used to allow propagation of C++ exceptions through the library
659 #
660 CFLAGS="${CFLAGS} -fexceptions"
661 fi
662
Daniel Veillard05f97352004-10-31 15:35:32 +0000663 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 +0000664 case "${host}" in
665 alpha*-*-linux* )
666 CFLAGS="${CFLAGS} -mieee"
667 ;;
Daniel Veillardcb5b4d62002-04-11 08:24:26 +0000668 alpha*-*-osf* )
669 CFLAGS="${CFLAGS} -mieee"
670 ;;
Daniel Veillard14839d52001-06-06 16:11:56 +0000671 esac
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000672fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000673case ${host} in
674 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000675 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
676 ;;
Daniel Veillardd30be4a2002-03-28 18:25:31 +0000677 hppa*-hp-mpeix)
678 NEED_TRIO=1
679 ;;
Daniel Veillard4188ddf2006-01-19 08:58:42 +0000680 *-*-mingw* | *-*-cygwin* | *-*-msvc* )
681 # If the host is Windows, and shared libraries are disabled, we
682 # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
683 # work properly (without it, xmlexports.h would force the use of
684 # DLL imports, which obviously aren't present in a static
685 # library).
686 if test "x$enable_shared" = "xno"; then
687 XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
688 CFLAGS="$CFLAGS -DLIBXML_STATIC"
689 fi
690 ;;
Daniel Veillardd2ade932000-09-30 14:39:55 +0000691esac
692
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000693
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000694dnl
695dnl check for python
696dnl
697
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000698PYTHON_VERSION=
699PYTHON_INCLUDES=
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000700PYTHON_SITE_PACKAGES=
Daniel Veillard6dc91962004-03-22 19:10:02 +0000701PYTHON_TESTS=
Daniel Veillard38b80a82003-05-14 18:59:00 +0000702pythondir=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000703if test "$with_python" != "no" ; then
704 if test -x "$with_python/bin/python"
705 then
706 echo Found python in $with_python/bin/python
707 PYTHON="$with_python/bin/python"
Daniel Veillard9b731d72002-04-14 12:56:08 +0000708 else
LRNfbd4ddf2010-11-04 15:45:46 +0100709 if test -x "$with_python/python.exe"
710 then
711 echo Found python in $with_python/python.exe
712 PYTHON="$with_python/python.exe"
713 else
714 if test -x "$with_python"
715 then
716 echo Found python in $with_python
717 PYTHON="$with_python"
718 else
719 if test -x "$PYTHON"
720 then
721 echo Found python in environment PYTHON=$PYTHON
722 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
723 else
724 AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
725 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000726 fi
Daniel Veillarda8a89fe2002-04-12 21:03:34 +0000727 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000728 fi
729 if test "$PYTHON" != ""
730 then
731 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
732 echo Found Python version $PYTHON_VERSION
733 fi
734 if test "$PYTHON_VERSION" != ""
735 then
Daniel Veillard253aa2c2002-02-02 09:17:16 +0000736 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
737 -d $with_python/lib/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000738 then
739 PYTHON_INCLUDES=$with_python/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 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
743 then
Daniel Veillard8492ba12006-04-25 12:52:12 +0000744 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000745 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000746 else
747 if test -r /usr/include/python$PYTHON_VERSION/Python.h
748 then
749 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
Daniel Veillardd7d07482006-05-03 13:15:44 +0000750 PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000751 else
LRNfbd4ddf2010-11-04 15:45:46 +0100752 if test -r $with_python/include/Python.h -a \
753 -d $with_python/lib/site-packages
754 then
755 PYTHON_INCLUDES=$with_python/include
756 PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
757 else
758 echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
759 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000760 fi
761 fi
William M. Brack5d4cba42004-01-06 15:19:12 +0000762 if test ! -d "$PYTHON_SITE_PACKAGES"
Daniel Veillardb6984ef2002-08-14 16:55:31 +0000763 then
764 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
765 fi
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000766 fi
Daniel Macks12febe82010-03-15 10:31:24 +0100767 PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000768 fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000769 if test "$with_python" != ""
770 then
Daniel Veillardd7d07482006-05-03 13:15:44 +0000771 pythondir='$(PYTHON_SITE_PACKAGES)'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000772 else
Daniel Veillardb2f8f1d2006-04-28 16:30:48 +0000773 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
Daniel Veillard38b80a82003-05-14 18:59:00 +0000774 fi
Daniel Veillard4f69eb62005-08-24 22:19:10 +0000775else
776 PYTHON=
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000777fi
778AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
Daniel Veillard40b11342002-09-20 12:01:39 +0000779if test "$PYTHON_INCLUDES" != ""
780then
781 PYTHON_SUBDIR=python
782else
783 PYTHON_SUBDIR=
784fi
Daniel Veillard38b80a82003-05-14 18:59:00 +0000785AC_SUBST(pythondir)
Daniel Veillard40b11342002-09-20 12:01:39 +0000786AC_SUBST(PYTHON_SUBDIR)
Frederic Crozate21731d2009-09-12 18:02:40 +0200787AC_SUBST(PYTHON_LIBS)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +0000788
Daniel Veillardce1648b2005-01-04 15:10:22 +0000789dnl check for dso support
790WITH_MODULES=0
Daniel Veillardce1648b2005-01-04 15:10:22 +0000791TEST_MODULES=
792
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000793if test "$with_modules" != "no" ; then
Daniel Veillard9202b672005-07-14 09:31:14 +0000794 case "$host" in
795 *-*-cygwin*)
796 MODULE_EXTENSION=".dll"
797 AC_CHECK_LIB(cygwin, dlopen, [
798 WITH_MODULES=1
799 MODULE_PLATFORM_LIBS=
800 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
801 ])
802 ;;
Roumen Petrov120a2692010-03-10 10:07:49 +0100803 *-*-mingw*)
804 MODULE_EXTENSION=".dll"
805 WITH_MODULES=1
806 ;;
Daniel Veillard9202b672005-07-14 09:31:14 +0000807 *)
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000808 AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
809 AC_CHECK_LIB(dld, shl_load, [
810 MODULE_PLATFORM_LIBS="-ldld"
811 libxml_have_shl_load=yes], [
812 AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
813 AC_CHECK_LIB(dl, dlopen, [
814 MODULE_PLATFORM_LIBS="-ldl"
815 libxml_have_dlopen=yes])])])])
816
817 if test "${libxml_have_shl_load}" = "yes"; then
818 MODULE_EXTENSION=".sl"
Daniel Veillard9202b672005-07-14 09:31:14 +0000819 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000820 AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000821 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000822
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000823 if test "${libxml_have_dlopen}" = "yes"; then
824 case "${host}" in
825 *-*-hpux* )
826 MODULE_EXTENSION=".sl"
827 ;;
828 * )
829 MODULE_EXTENSION=".so"
830 ;;
831 esac
832
Daniel Veillard9202b672005-07-14 09:31:14 +0000833 WITH_MODULES=1
Daniel Veillard9202b672005-07-14 09:31:14 +0000834 AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
Daniel Veillard1d96f5a2005-10-28 08:44:48 +0000835 fi
Daniel Veillard9202b672005-07-14 09:31:14 +0000836 ;;
837 esac
Daniel Veillardf6b71bd2005-01-04 17:50:14 +0000838fi
Daniel Veillardce1648b2005-01-04 15:10:22 +0000839
840if test "${WITH_MODULES}" = "1"; then
841 TEST_MODULES="ModuleTests"
842fi
843
844AC_SUBST(WITH_MODULES)
845AC_SUBST(MODULE_PLATFORM_LIBS)
846AC_SUBST(MODULE_EXTENSION)
847AC_SUBST(TEST_MODULES)
848
Daniel Veillard437b87b2000-01-03 17:30:46 +0000849dnl
850dnl Tester makes use of readline if present
851dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000852
Daniel Veillard361d8452000-04-03 19:48:13 +0000853dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000854dnl specific tests to setup DV and Bill's devel environments with debug etc ...
Daniel Veillard81418e32001-05-22 15:08:55 +0000855dnl (-Wunreachable-code)
Daniel Veillardf6eea272001-01-18 12:17:12 +0000856dnl
William M. Brack871611b2003-10-18 04:53:14 +0000857if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
Daniel Veillardb7c6ac42004-06-29 22:01:27 +0000858 [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
William M. Brack7f28a012007-01-11 23:42:10 +0000859 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
William M. Brack871611b2003-10-18 04:53:14 +0000860 then
Daniel Veillard4432df22003-09-28 18:58:27 +0000861 if test "$with_minimum" != "yes"
862 then
863 if test "${with_mem_debug}" = "" ; then
Daniel Veillard379a3b72005-08-12 10:18:14 +0000864 echo Activating memory debugging
Daniel Veillard4432df22003-09-28 18:58:27 +0000865 with_mem_debug="yes"
Daniel Veillard22cdb842004-10-04 14:09:17 +0000866 with_run_debug="yes"
Daniel Veillard4432df22003-09-28 18:58:27 +0000867 fi
868 if test "${with_docbook}" = "" ; then
869 with_docbook="yes"
870 fi
Daniel Veillardeae522a2001-04-23 13:41:34 +0000871 fi
Daniel Veillard3854c572005-08-25 10:17:45 +0000872 if test "${GCC}" = "yes" ; then
Daniel Veillard05f97352004-10-31 15:35:32 +0000873 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 +0000874 fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000875 STATIC_BINARIES="-static"
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000876dnl -Wcast-qual -ansi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000877else
878 STATIC_BINARIES=
Daniel Veillardf6eea272001-01-18 12:17:12 +0000879fi
Daniel Veillard2e9b1652003-02-19 13:29:45 +0000880AC_SUBST(STATIC_BINARIES)
Daniel Veillard92ad2102001-03-27 12:47:33 +0000881
882dnl
883dnl Check for trio string functions
884dnl
885
886if test "${NEED_TRIO}" = "1" ; then
887 echo Adding trio library for string functions
888 WITH_TRIO=1
889else
890 WITH_TRIO=0
891fi
Daniel Veillard01ef7382001-05-08 07:31:43 +0000892AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
Daniel Veillard92ad2102001-03-27 12:47:33 +0000893AC_SUBST(WITH_TRIO)
894
Daniel Veillardf6eea272001-01-18 12:17:12 +0000895dnl
William M. Brack97ad4c72003-05-13 08:08:36 +0000896dnl Allow to enable/disable various pieces
Daniel Veillard361d8452000-04-03 19:48:13 +0000897dnl
William M. Brack21e4ef22005-01-02 09:53:13 +0000898echo Checking configuration requirements
Daniel Veillard361d8452000-04-03 19:48:13 +0000899
William M. Brack21e4ef22005-01-02 09:53:13 +0000900dnl
901dnl Thread-related stuff
902dnl
Daniel Veillardb8478642001-10-12 17:29:10 +0000903THREAD_LIBS=""
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000904BASE_THREAD_LIBS=""
Daniel Veillardb8478642001-10-12 17:29:10 +0000905WITH_THREADS=0
906THREAD_CFLAGS=""
Daniel Veillardab7488e2001-10-17 11:30:37 +0000907TEST_THREADS=""
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000908THREADS_W32=""
Daniel Veillard64a411c2001-10-15 12:32:07 +0000909
Daniel Veillard84942712003-04-18 14:40:05 +0000910if test "$with_threads" = "no" ; then
911 echo Disabling multithreaded support
912else
Daniel Veillardb8478642001-10-12 17:29:10 +0000913 echo Enabling multithreaded support
LRN203fd2e2009-08-07 21:47:25 +0200914 dnl Use pthread by default
Andrew W. Nosenko858084f2009-10-06 18:14:15 +0200915 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
LRN203fd2e2009-08-07 21:47:25 +0200916 AC_CHECK_HEADER(pthread.h,
917 AC_CHECK_LIB(pthread, pthread_join,[
918 THREAD_LIBS="-lpthread"
919 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
920 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
921 WITH_THREADS="1"]))
922 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000923 case $host_os in
LRN203fd2e2009-08-07 21:47:25 +0200924 *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
925 WITH_THREADS="1"
926 THREADS_W32="Win32"
927 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
928 fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000929 ;;
William M. Bracka73f45b2005-01-11 02:21:33 +0000930 *cygwin*) THREAD_LIBS=""
931 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +0000932 *beos*) WITH_THREADS="1"
933 THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
934 ;;
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000935 *linux*)
Daniel Veillard32a461f2005-08-25 21:48:54 +0000936 if test "${GCC}" = "yes" ; then
937 GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
938 GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
939 GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
940 if test "${THREAD_LIBS}" = "-lpthread" ; then
941 if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
942 then
943 THREAD_LIBS=""
944 BASE_THREAD_LIBS="-lpthread"
945 else
LRN203fd2e2009-08-07 21:47:25 +0200946 if expr ${GCC_MAJOR} \> 3 > /dev/null
Daniel Veillard32a461f2005-08-25 21:48:54 +0000947 then
948 THREAD_LIBS=""
949 BASE_THREAD_LIBS="-lpthread"
950 else
951 echo old GCC disabling weak symbols for pthread
952 fi
953 fi
954 fi
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000955 fi
956 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000957 esac
Daniel Veillardb8478642001-10-12 17:29:10 +0000958 if test "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +0000959 THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
960 TEST_THREADS="Threadtests"
Daniel Veillardb8478642001-10-12 17:29:10 +0000961 fi
962fi
William M. Brack306e33c2004-06-12 01:01:22 +0000963if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
Daniel Veillardab7488e2001-10-17 11:30:37 +0000964 THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
Daniel Veillard64a411c2001-10-15 12:32:07 +0000965fi
966
Daniel Veillardb8478642001-10-12 17:29:10 +0000967AC_SUBST(THREAD_LIBS)
Daniel Veillarddbfe05a2005-05-04 09:18:00 +0000968AC_SUBST(BASE_THREAD_LIBS)
Daniel Veillardb8478642001-10-12 17:29:10 +0000969AC_SUBST(WITH_THREADS)
970AC_SUBST(THREAD_CFLAGS)
Daniel Veillardab7488e2001-10-17 11:30:37 +0000971AC_SUBST(TEST_THREADS)
Daniel Veillard6984e6d2003-12-09 14:20:17 +0000972AC_SUBST(THREADS_W32)
Daniel Veillardb8478642001-10-12 17:29:10 +0000973
William M. Brack21e4ef22005-01-02 09:53:13 +0000974dnl
975dnl xmllint shell history
976dnl
Daniel Veillard259ff742001-10-06 13:49:59 +0000977if test "$with_history" = "yes" ; then
Daniel Veillardf012a642001-07-23 19:10:52 +0000978 echo Enabling xmllint shell history
979 dnl check for terminal library. this is a very cool solution
980 dnl from octave's configure.in
981 unset tcap
982 for termlib in ncurses curses termcap terminfo termlib; do
983 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
984 test -n "$tcap" && break
985 done
986
987 AC_CHECK_HEADER(readline/history.h,
988 AC_CHECK_LIB(history, append_history,[
989 RDL_LIBS="-lhistory"
Daniel Veillardc790bf42003-10-11 10:50:10 +0000990 AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
Daniel Veillardf012a642001-07-23 19:10:52 +0000991 AC_CHECK_HEADER(readline/readline.h,
992 AC_CHECK_LIB(readline, readline,[
993 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
Daniel Veillardc790bf42003-10-11 10:50:10 +0000994 AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
Daniel Veillardf012a642001-07-23 19:10:52 +0000995 if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
996 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
997 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
Daniel Veillardf012a642001-07-23 19:10:52 +0000998 fi
Daniel Veillardf012a642001-07-23 19:10:52 +0000999fi
1000
William M. Brack21e4ef22005-01-02 09:53:13 +00001001dnl
1002dnl Tree functions
1003dnl
Daniel Veillard652327a2003-09-29 18:02:38 +00001004if test "$with_tree" = "no" ; then
1005 echo Disabling DOM like tree manipulation APIs
1006 WITH_TREE=0
1007else
1008 WITH_TREE=1
1009fi
1010AC_SUBST(WITH_TREE)
1011
Daniel Veillard361d8452000-04-03 19:48:13 +00001012if test "$with_ftp" = "no" ; then
1013 echo Disabling FTP support
1014 WITH_FTP=0
1015 FTP_OBJ=
1016else
1017 WITH_FTP=1
1018 FTP_OBJ=nanoftp.o
1019fi
1020AC_SUBST(WITH_FTP)
1021AC_SUBST(FTP_OBJ)
1022
Daniel Veillard361d8452000-04-03 19:48:13 +00001023if test "$with_http" = "no" ; then
1024 echo Disabling HTTP support
1025 WITH_HTTP=0
1026 HTTP_OBJ=
1027else
1028 WITH_HTTP=1
1029 HTTP_OBJ=nanohttp.o
1030fi
1031AC_SUBST(WITH_HTTP)
1032AC_SUBST(HTTP_OBJ)
1033
Daniel Veillard4432df22003-09-28 18:58:27 +00001034if test "$with_legacy" = "no" ; then
1035 echo Disabling deprecated APIs
1036 WITH_LEGACY=0
1037else
1038 WITH_LEGACY=1
1039fi
1040AC_SUBST(WITH_LEGACY)
1041
Daniel Veillard81273902003-09-30 00:43:48 +00001042if test "$with_reader" = "no" ; then
1043 echo Disabling the xmlReader parsing interface
1044 WITH_READER=0
Daniel Veillard73b013f2003-09-30 12:36:01 +00001045 READER_TEST=
Daniel Veillard81273902003-09-30 00:43:48 +00001046else
1047 WITH_READER=1
Daniel Veillard73b013f2003-09-30 12:36:01 +00001048 READER_TEST=Readertests
William M. Brack21e4ef22005-01-02 09:53:13 +00001049 if test "$with_push" = "no" ; then
1050 echo xmlReader requires Push interface - enabling it
1051 with_push=yes
1052 fi
Daniel Veillard81273902003-09-30 00:43:48 +00001053fi
1054AC_SUBST(WITH_READER)
Daniel Veillard73b013f2003-09-30 12:36:01 +00001055AC_SUBST(READER_TEST)
Daniel Veillard81273902003-09-30 00:43:48 +00001056
William M. Brack21e4ef22005-01-02 09:53:13 +00001057if test "$with_writer" = "no" ; then
1058 echo Disabling the xmlWriter saving interface
1059 WITH_WRITER=0
1060# WRITER_TEST=
1061else
1062 WITH_WRITER=1
1063# WRITER_TEST=Writertests
1064 if test "$with_push" = "no" ; then
1065 echo xmlWriter requires Push interface - enabling it
1066 with_push=yes
1067 fi
1068 if test "$with_output" = "no" ; then
1069 echo xmlWriter requires Output interface - enabling it
1070 with_output=yes
1071 fi
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001072fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001073AC_SUBST(WITH_WRITER)
1074#AC_SUBST(WRITER_TEST)
1075
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001076if test "$with_pattern" = "no" ; then
1077 echo Disabling the xmlPattern parsing interface
1078 WITH_PATTERN=0
Daniel Veillardf9d16912005-01-30 22:36:30 +00001079 TEST_PATTERN=
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001080else
1081 WITH_PATTERN=1
Daniel Veillardf9d16912005-01-30 22:36:30 +00001082 TEST_PATTERN=Patterntests
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001083fi
1084AC_SUBST(WITH_PATTERN)
Daniel Veillardf9d16912005-01-30 22:36:30 +00001085AC_SUBST(TEST_PATTERN)
Daniel Veillardb3de70c2003-12-02 22:32:15 +00001086
Daniel Veillard81273902003-09-30 00:43:48 +00001087if test "$with_sax1" = "no" ; then
1088 echo Disabling the older SAX1 interface
1089 WITH_SAX1=0
1090 TEST_SAX=
1091else
1092 WITH_SAX1=1
1093 TEST_SAX=SAXtests
1094fi
1095AC_SUBST(WITH_SAX1)
1096AC_SUBST(TEST_SAX)
1097
Daniel Veillard73b013f2003-09-30 12:36:01 +00001098if test "$with_push" = "no" ; then
1099 echo Disabling the PUSH parser interfaces
1100 WITH_PUSH=0
1101 TEST_PUSH=
1102else
1103 WITH_PUSH=1
1104 TEST_PUSH="XMLPushtests"
1105fi
1106AC_SUBST(WITH_PUSH)
1107AC_SUBST(TEST_PUSH)
1108
Daniel Veillard73b013f2003-09-30 12:36:01 +00001109if test "$with_html" = "no" ; then
1110 echo Disabling HTML support
1111 WITH_HTML=0
1112 HTML_OBJ=
1113 TEST_HTML=
1114else
1115 WITH_HTML=1
1116 HTML_OBJ="HTMLparser.o HTMLtree.o"
1117 TEST_HTML=HTMLtests
William M. Brack871611b2003-10-18 04:53:14 +00001118 if test "$with_push" != "no" ; then
Daniel Veillard73b013f2003-09-30 12:36:01 +00001119 TEST_PHTML=HTMLPushtests
1120 else
1121 TEST_PHTML=
1122 fi
1123fi
1124AC_SUBST(WITH_HTML)
1125AC_SUBST(HTML_OBJ)
1126AC_SUBST(TEST_HTML)
1127AC_SUBST(TEST_PHTML)
1128
Daniel Veillard73b013f2003-09-30 12:36:01 +00001129if test "$with_valid" = "no" ; then
Daniel Veillard4432df22003-09-28 18:58:27 +00001130 echo Disabling DTD validation support
1131 WITH_VALID=0
1132 TEST_VALID=
1133 TEST_VTIME=
1134else
1135 WITH_VALID=1
1136 TEST_VALID=Validtests
1137 TEST_VTIME=VTimingtests
1138fi
1139AC_SUBST(WITH_VALID)
1140AC_SUBST(TEST_VALID)
1141AC_SUBST(TEST_VTIME)
Daniel Veillard361d8452000-04-03 19:48:13 +00001142
Daniel Veillarda7374592001-05-10 14:17:55 +00001143if test "$with_catalog" = "no" ; then
1144 echo Disabling Catalog support
1145 WITH_CATALOG=0
1146 CATALOG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001147 TEST_CATALOG=
Daniel Veillarda7374592001-05-10 14:17:55 +00001148else
1149 WITH_CATALOG=1
1150 CATALOG_OBJ="catalog.o"
Daniel Veillard4432df22003-09-28 18:58:27 +00001151 TEST_CATALOG=Catatests
Daniel Veillarda7374592001-05-10 14:17:55 +00001152fi
1153AC_SUBST(WITH_CATALOG)
1154AC_SUBST(CATALOG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001155AC_SUBST(TEST_CATALOG)
Daniel Veillarda7374592001-05-10 14:17:55 +00001156
Daniel Veillardb59076b2001-04-29 17:04:07 +00001157if test "$with_docbook" = "no" ; then
1158 echo Disabling Docbook support
Daniel Veillardeae522a2001-04-23 13:41:34 +00001159 WITH_DOCB=0
1160 DOCB_OBJ=
Daniel Veillardb59076b2001-04-29 17:04:07 +00001161else
1162 WITH_DOCB=1
1163 DOCB_OBJ="DOCBparser.o"
Daniel Veillardeae522a2001-04-23 13:41:34 +00001164fi
1165AC_SUBST(WITH_DOCB)
1166AC_SUBST(DOCB_OBJ)
1167
1168
William M. Brack21e4ef22005-01-02 09:53:13 +00001169if test "$with_xptr" = "no" ; then
1170 echo Disabling XPointer support
1171 WITH_XPTR=0
1172 XPTR_OBJ=
1173 TEST_XPTR=
1174else
1175 WITH_XPTR=1
1176 XPTR_OBJ=xpointer.o
1177 TEST_XPTR=XPtrtests
1178 if test "$with_xpath" = "no" ; then
1179 echo XPointer requires XPath support - enabling it
1180 with_xpath=yes
1181 fi
Daniel Veillard4432df22003-09-28 18:58:27 +00001182fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001183AC_SUBST(WITH_XPTR)
1184AC_SUBST(XPTR_OBJ)
1185AC_SUBST(TEST_XPTR)
1186
1187if test "$with_c14n" = "no" ; then
1188 echo Disabling C14N support
1189 WITH_C14N=0
1190 C14N_OBJ=
1191 TEST_C14N=
1192else
1193 WITH_C14N=1
1194 C14N_OBJ="c14n.c"
1195 TEST_C14N=C14Ntests
1196 if test "$with_xpath" = "no" ; then
1197 echo C14N requires XPath support - enabling it
1198 with_xpath=yes
1199 fi
1200fi
1201AC_SUBST(WITH_C14N)
1202AC_SUBST(C14N_OBJ)
1203AC_SUBST(TEST_C14N)
1204
1205if test "$with_xinclude" = "no" ; then
1206 echo Disabling XInclude support
1207 WITH_XINCLUDE=0
1208 XINCLUDE_OBJ=
1209 with_xinclude="no"
1210 TEST_XINCLUDE=
1211else
1212 WITH_XINCLUDE=1
1213 XINCLUDE_OBJ=xinclude.o
1214 TEST_XINCLUDE=XIncludetests
1215 if test "$with_xpath" = "no" ; then
1216 echo XInclude requires XPath support - enabling it
1217 with_xpath=yes
1218 fi
1219fi
1220AC_SUBST(WITH_XINCLUDE)
1221AC_SUBST(XINCLUDE_OBJ)
1222AC_SUBST(TEST_XINCLUDE)
1223
Daniel Veillard361d8452000-04-03 19:48:13 +00001224if test "$with_xpath" = "no" ; then
1225 echo Disabling XPATH support
1226 WITH_XPATH=0
1227 XPATH_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001228 TEST_XPATH=
Daniel Veillard361d8452000-04-03 19:48:13 +00001229else
1230 WITH_XPATH=1
1231 XPATH_OBJ=xpath.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001232 TEST_XPATH=XPathtests
Daniel Veillard361d8452000-04-03 19:48:13 +00001233fi
1234AC_SUBST(WITH_XPATH)
1235AC_SUBST(XPATH_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001236AC_SUBST(TEST_XPATH)
Daniel Veillard361d8452000-04-03 19:48:13 +00001237
William M. Brack21e4ef22005-01-02 09:53:13 +00001238dnl
1239dnl output functions
1240dnl
1241if test "$with_output" = "no" ; then
1242 echo Disabling serialization/saving support
1243 WITH_OUTPUT=0
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001244else
William M. Brack21e4ef22005-01-02 09:53:13 +00001245 WITH_OUTPUT=1
Daniel Veillardc8df0aa2000-10-10 23:50:30 +00001246fi
William M. Brack21e4ef22005-01-02 09:53:13 +00001247AC_SUBST(WITH_OUTPUT)
Daniel Veillard9e8bfae2000-11-06 16:43:11 +00001248
Daniel Veillard6e90d192001-07-03 16:37:49 +00001249WITH_ICONV=0
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001250if test "$with_iconv" = "no" ; then
1251 echo Disabling ICONV support
Daniel Veillardd574f782001-03-14 19:40:17 +00001252else
Daniel Veillard220346d2001-12-07 11:33:54 +00001253 if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
Daniel Veillard6e90d192001-07-03 16:37:49 +00001254 CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
Daniel Veillardf5b44e42001-09-17 17:19:54 +00001255 # Export this since our headers include iconv.h
1256 XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
Daniel Veillard6e90d192001-07-03 16:37:49 +00001257 ICONV_LIBS="-L$with_iconv/lib"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001258 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001259
1260 AC_CHECK_HEADER(iconv.h,
1261 AC_MSG_CHECKING(for iconv)
1262 AC_TRY_LINK([#include <stdlib.h>
1263#include <iconv.h>],[
1264iconv_t cd = iconv_open ("","");
1265iconv (cd, NULL, NULL, NULL, NULL);],[
1266 AC_MSG_RESULT(yes)
1267 WITH_ICONV=1],[
1268 AC_MSG_RESULT(no)
1269 AC_MSG_CHECKING(for iconv in -liconv)
1270
1271 _ldflags="${LDFLAGS}"
1272 _libs="${LIBS}"
1273 LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
1274 LIBS="${LIBS} -liconv"
1275
1276 AC_TRY_LINK([#include <stdlib.h>
1277#include <iconv.h>],[
1278iconv_t cd = iconv_open ("","");
1279iconv (cd, NULL, NULL, NULL, NULL);],[
1280 AC_MSG_RESULT(yes)
1281 WITH_ICONV=1
1282 ICONV_LIBS="${ICONV_LIBS} -liconv"
1283 LIBS="${_libs}"
1284 LDFLAGS="${_ldflags}"],[
1285 AC_MSG_RESULT(no)
1286 LIBS="${_libs}"
1287 LDFLAGS="${_ldflags}"])]))
Daniel Veillard8e1a46d2008-02-15 07:47:26 +00001288
1289 if test "$WITH_ICONV" = "1" ; then
1290 AC_MSG_CHECKING([for iconv declaration])
1291 AC_CACHE_VAL(xml_cv_iconv_arg2, [
1292 AC_TRY_COMPILE([#include <stdlib.h>
1293#include <iconv.h>
1294extern
1295#ifdef __cplusplus
1296"C"
1297#endif
1298#if defined(__STDC__) || defined(__cplusplus)
1299size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1300#else
1301size_t iconv();
1302#endif
1303], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
1304
1305 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);"
1306 AC_MSG_RESULT([${xml_xxx:-
1307 }$xml_cv_iconv_decl])
1308 AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
1309 [Define as const if the declaration of iconv() needs const.])
1310 fi
Daniel Veillard6e90d192001-07-03 16:37:49 +00001311fi
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001312case "$host" in
1313 *mingw*) M_LIBS=""
1314 ;;
Daniel Veillard7a3447a2005-01-04 14:31:14 +00001315 *beos*) M_LIBS=""
1316 ;;
Scott McCreary508a8d62009-08-24 16:35:35 +02001317 *haiku*) M_LIBS=""
1318 ;;
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001319 *) M_LIBS="-lm"
1320 ;;
1321esac
Daniel Veillardb82c1662001-12-09 14:00:54 +00001322XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
Daniel Veillard90d165b2003-09-01 20:33:13 +00001323XML_LIBTOOLLIBS="libxml2.la"
Daniel Veillard496a1cf2000-05-03 14:20:55 +00001324AC_SUBST(WITH_ICONV)
1325
Giuseppe Iuculano48f7dcb2010-11-04 17:42:42 +01001326WITH_ICU=0
1327if test "$with_icu" != "yes" ; then
1328 echo Disabling ICU support
1329else
1330 ICU_CONFIG=icu-config
1331 if ${ICU_CONFIG} --cflags >/dev/null 2>&1
1332 then
1333 ICU_LIBS=`icu-config --ldflags`
1334 LDFLAGS="$LDFLAGS $ICU_LIBS"
1335 WITH_ICU=1
1336 echo Enabling ICU support
1337 else
1338 AC_MSG_ERROR([libicu config program icu-config not found])
1339 fi
1340fi
1341AC_SUBST(WITH_ICU)
1342
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001343WITH_ISO8859X=1
Daniel Veillard01fc1a92003-07-30 15:12:01 +00001344if test "$WITH_ICONV" != "1" ; then
1345if test "$with_iso8859x" = "no" ; then
1346 echo Disabling ISO8859X support
1347 WITH_ISO8859X=0
1348fi
1349fi
1350AC_SUBST(WITH_ISO8859X)
1351
Daniel Veillarded6c5492005-07-23 15:00:22 +00001352if test "$with_schematron" = "no" ; then
1353 echo "Disabling Schematron support"
1354 WITH_SCHEMATRON=0
1355 TEST_SCHEMATRON=
1356else
1357 echo "Enabled Schematron support"
1358 WITH_SCHEMATRON=1
1359 TEST_SCHEMATRON="Schematrontests"
1360 with_xpath=yes
1361 with_pattern=yes
1362fi
1363AC_SUBST(WITH_SCHEMATRON)
1364AC_SUBST(TEST_SCHEMATRON)
1365
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001366if test "$with_schemas" = "no" ; then
William M. Brack21e4ef22005-01-02 09:53:13 +00001367 echo "Disabling Schemas/Relax-NG support"
Daniel Veillardef4d3bc2003-02-07 12:38:22 +00001368 WITH_SCHEMAS=0
1369 TEST_SCHEMAS=
1370else
Daniel Veillard71531f32003-02-05 13:19:53 +00001371 echo "Enabled Schemas/Relax-NG support"
Daniel Veillard4255d502002-04-16 15:50:10 +00001372 WITH_SCHEMAS=1
Daniel Veillard6eadf632003-01-23 18:29:16 +00001373 TEST_SCHEMAS="Schemastests Relaxtests"
Daniel Veillard6dc91962004-03-22 19:10:02 +00001374 if test "$PYTHON_INCLUDES" != "" ; then
1375 PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
1376 fi
Daniel Veillard23e73572002-09-19 19:56:43 +00001377 with_regexps=yes
Daniel Veillard4255d502002-04-16 15:50:10 +00001378fi
1379AC_SUBST(WITH_SCHEMAS)
1380AC_SUBST(TEST_SCHEMAS)
1381
Daniel Veillard23e73572002-09-19 19:56:43 +00001382if test "$with_regexps" = "no" ; then
1383 echo Disabling Regexps support
1384 WITH_REGEXPS=0
1385 TEST_REGEXPS=
1386else
1387 WITH_REGEXPS=1
1388 TEST_REGEXPS="Regexptests Automatatests"
1389fi
1390AC_SUBST(WITH_REGEXPS)
1391AC_SUBST(TEST_REGEXPS)
1392
Daniel Veillard361d8452000-04-03 19:48:13 +00001393if test "$with_debug" = "no" ; then
1394 echo Disabling DEBUG support
1395 WITH_DEBUG=0
1396 DEBUG_OBJ=
Daniel Veillard4432df22003-09-28 18:58:27 +00001397 TEST_DEBUG=
Daniel Veillard361d8452000-04-03 19:48:13 +00001398else
1399 WITH_DEBUG=1
1400 DEBUG_OBJ=debugXML.o
Daniel Veillard4432df22003-09-28 18:58:27 +00001401 TEST_DEBUG=Scripttests
Daniel Veillard361d8452000-04-03 19:48:13 +00001402fi
1403AC_SUBST(WITH_DEBUG)
1404AC_SUBST(DEBUG_OBJ)
Daniel Veillard4432df22003-09-28 18:58:27 +00001405AC_SUBST(TEST_DEBUG)
Daniel Veillard361d8452000-04-03 19:48:13 +00001406
Daniel Veillard361d8452000-04-03 19:48:13 +00001407if test "$with_mem_debug" = "yes" ; then
William M. Brack306e33c2004-06-12 01:01:22 +00001408 if test "$with_thread_alloc" = "yes" ; then
1409 echo Disabling memory debug - cannot use mem-debug with thread-alloc!
1410 WITH_MEM_DEBUG=0
1411 else
1412 echo Enabling memory debug support
1413 WITH_MEM_DEBUG=1
1414 fi
Daniel Veillard361d8452000-04-03 19:48:13 +00001415else
1416 WITH_MEM_DEBUG=0
1417fi
1418AC_SUBST(WITH_MEM_DEBUG)
1419
Daniel Veillard22cdb842004-10-04 14:09:17 +00001420if test "$with_run_debug" = "yes" ; then
1421 echo Enabling runtime debug support
1422 WITH_RUN_DEBUG=1
1423else
1424 WITH_RUN_DEBUG=0
1425fi
1426AC_SUBST(WITH_RUN_DEBUG)
Daniel Veillard1638a472003-08-14 01:23:25 +00001427
1428WIN32_EXTRA_LIBADD=
1429WIN32_EXTRA_LDFLAGS=
William M. Bracka73f45b2005-01-11 02:21:33 +00001430CYGWIN_EXTRA_LDFLAGS=
1431CYGWIN_EXTRA_PYTHON_LIBADD=
LRNfbd4ddf2010-11-04 15:45:46 +01001432WIN32_EXTRA_PYTHON_LIBADD=
Daniel Veillard1638a472003-08-14 01:23:25 +00001433case "$host" in
1434 *-*-mingw*)
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001435 CPPFLAGS="$CPPFLAGS -DWIN32"
1436 WIN32_EXTRA_LIBADD="-lws2_32"
Daniel Veillard1638a472003-08-14 01:23:25 +00001437 WIN32_EXTRA_LDFLAGS="-no-undefined"
1438 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
1439 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
1440 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
LRNfbd4ddf2010-11-04 15:45:46 +01001441 if test "${PYTHON}" != ""
1442 then
1443 WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
1444 fi
Daniel Veillard1638a472003-08-14 01:23:25 +00001445 ;;
Daniel Veillardd392ba72004-08-04 14:56:45 +00001446 *-*-cygwin*)
1447 CYGWIN_EXTRA_LDFLAGS="-no-undefined"
William M. Bracka73f45b2005-01-11 02:21:33 +00001448 if test "${PYTHON}" != ""
1449 then
1450 CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1451 fi
Daniel Veillardd392ba72004-08-04 14:56:45 +00001452 ;;
Daniel Veillard1638a472003-08-14 01:23:25 +00001453esac
1454AC_SUBST(WIN32_EXTRA_LIBADD)
1455AC_SUBST(WIN32_EXTRA_LDFLAGS)
LRNfbd4ddf2010-11-04 15:45:46 +01001456AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
Daniel Veillardd392ba72004-08-04 14:56:45 +00001457AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
1458AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
Daniel Veillard1638a472003-08-14 01:23:25 +00001459
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001460if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
1461then
1462 echo Enabling code coverage for GCC
1463 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
1464 LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
1465else
1466 echo Disabling code coverage for GCC
1467fi
1468
Daniel Veillard6984e6d2003-12-09 14:20:17 +00001469AC_SUBST(CPPFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001470AC_SUBST(CFLAGS)
Daniel Veillardbfa5cf12008-08-27 15:33:28 +00001471AC_SUBST(LDFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +00001472AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +00001473
Daniel Veillardb05deb71999-08-10 19:04:08 +00001474AC_SUBST(XML_LIBDIR)
1475AC_SUBST(XML_LIBS)
Daniel Veillard90d165b2003-09-01 20:33:13 +00001476AC_SUBST(XML_LIBTOOLLIBS)
Daniel Veillard81418e32001-05-22 15:08:55 +00001477AC_SUBST(ICONV_LIBS)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001478AC_SUBST(XML_INCLUDEDIR)
1479AC_SUBST(HTML_DIR)
1480AC_SUBST(HAVE_ISNAN)
1481AC_SUBST(HAVE_ISINF)
Daniel Veillardf1d0e6b2002-01-31 23:42:44 +00001482AC_SUBST(PYTHON)
1483AC_SUBST(PYTHON_VERSION)
1484AC_SUBST(PYTHON_INCLUDES)
Daniel Veillard253aa2c2002-02-02 09:17:16 +00001485AC_SUBST(PYTHON_SITE_PACKAGES)
Daniel Veillardb05deb71999-08-10 19:04:08 +00001486
Daniel Veillardb05deb71999-08-10 19:04:08 +00001487AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +00001488AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +00001489
Daniel Veillard9715c172002-11-25 16:33:40 +00001490dnl for the spec file
1491RELDATE=`date +'%a %b %e %Y'`
1492AC_SUBST(RELDATE)
Daniel Veillard6dc91962004-03-22 19:10:02 +00001493AC_SUBST(PYTHON_TESTS)
Daniel Veillard9715c172002-11-25 16:33:40 +00001494
Daniel Veillardc6e997c2003-01-27 12:35:42 +00001495rm -f COPYING.LIB COPYING
Daniel Veillardc575b992002-02-08 13:28:40 +00001496ln -s Copyright COPYING
1497
Daniel Veillarde4177a52004-01-08 16:43:57 +00001498# keep on one line for cygwin c.f. #130896
Daniel Veillard99b78502005-09-11 22:04:08 +00001499AC_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 +00001500
Daniel Veillard06d25242004-02-25 13:01:42 +00001501chmod +x xml2-config python/setup.py
Daniel Veillard67952602006-01-05 15:29:44 +00001502echo Done configuring